CLO HELP CENTER

How can we help you?

Python Script API

Follow

Objective

Learn variables used in Python Script API.

※Note:

  • Location of Example File:
    • CLO install folder

  • How to Execute Example File:
    • Please type below text in Script Console

    • py> import example

    • py> from example import *

    • py> exam = example()

    • py> exam.function(mdsa)

    • Function is example, please find usable function from example.py file.

    • mdsa is python module allows to use functions of Marvelous Designer from python.



Operation

  1. Open Python Script.

  2. When the Python Script console appears, type in desired API.

API

#mdsa = CLO Script API

 

Variable

Variable name

Type

Explication

open_avatar_file_list

String List

List type Variable, designate directory of Avatar files want to open.

open_garment_file_list

String List

List type Variable, designate directory of Garment files want to open.

open_animation_file_list

String List

List type Variable, designate directory of Animation files want to open.

save_file_path_list

String List

List type Variable, designate directory and name of files will be saved.

obj_type_list

Integer List

List type Variable, saves Type of Avatar want to use.

simulation_quality_list

Integer List

List type Variable, designate Simulation Quality.

simulation_delay_time_list

Integer List

List type Variable, designate time of default pose Simulation.

export_scale_unit_list

String List

List type Variable, designate scale of object by unit when exporting.

export_fps_list

Integer List

List type Variable, designate fps of object when exporting.

unified_map_list

Boolean List

List type Variable, decide whether unify UV or not when exporting.

export_scale_unit

String

Variable, designate scale of object by unit when exporting.

export_fps

Integer

Variable, designate fps of object when exporting.

unified_map

Boolean

Variable, decide whether unify UV or not when exporting.

import_scale_unit_list

String List

List type Variable, designate scale of object by unit when importing.

import_fps_list

Integer List

List type Variable, designate fps of object by unit when importing.

import_scale_unit

String

Variable, designate scale of object by unit when importing.

import_fps

Integer

Variable, designate fps of object when importing.

current_process

Integer

‘Process’ represent a flow of ‘file open -> simulation-> Animation -> Saving file’. Multiple ‘Process’ can be calculated at the same time. 
This variable shows progress of the Multiple process.

We do not recommend to access this variable.

export_option_count

Integer

Size of designated Export option list. When setting standalone option variables, this variable it will have 0 value.

import_option_count

Integer

Size of designated Import option list. When setting standalone option variables, this variable it will have 0 value.

save_folder_path

String

Variable designates save folder

module_obj

CLO Module

Internal API module of MarvelousDesigner. We do recommend not to access this variable.

 

Function

def initialize(object):

- Reset mdsa object currently use.

def clear_console(object):

- Clear console window.

def get_split_string(object, string, split_filter_list):

- String = string type, split_filter_list = string list type

- This function returns a string list (string list = source string / split_filter_list. Split_filter_list is the list of standard string for split. get_split_string function split Split_filter_list from first string. If the string is not available to split by first string (If a character is not included in string) It Sequentially look up next string. If it find a string which can be split from split_filter_list, it returns split string list. If it could not find a string which can be split, it will return empty string list. Split_filter character will be excluded from string list.

- get_split_string(“C:\Users\Public\Documents\MarvelousDesigner\Assets_ver_3.0.9999\default.zpac”, [“\\”, “/”])

- [“C:”, “Users”, “Public”, “Documents”, “MarvelousDesigner”, “Assets_ver_3.0.9999”, “default.zpac”]

def get_file_name(object, file_path):

- file_path is string type

- This function only returns file_name which received from file_path as a factor.

- get_file_name(“C:\Users\Public\Documents\MarvelousDesigner\Assets_ver_3.0.9999\default.zpac”)

- default.zpac”

def get_filter_file_name(object, file_list, filter):

- file_list is string list type, filter is string type

- This function returns list of files with certain extension which received as a factor from file_list. It is case insensitive when look up extension of files.

def make_valid_folder_path(object, folder_path):.

- Folder_path is string type

- If the last letter of path is not “\” or “/”, it is recognized as invalid path. This function changes an invalid path to the valid form and return.

def get_entry_list(object, folder_path):

- Folder_path is string type

- get_entry_list returns a list of file from Folder_path.

def set_open_option(object, unit = "none", fps = 30):

- Unit is string type, allows you to set unit value as "cm", "mm", "inch", "feet", "m". default value is "mm".

- Fps is integer type, default is 30 fps.

- set_open_option designates import options of obj, cache, fbx and alembic file. In case you need to import multiple files and want to set different options, please use set_open_option_list function. This function only decides values. To apply this value to Marvelous Designer, must call set_app_open_option function.

def set_save_option(object, unit = "none", fps = 30, unified = False):

- unit is string type allows you to set unit value as "cm", "mm", "inch", "feet", "m". default is "mm".

- Fps is integer type, default is 30 fps

- Unified is Boolean type, when it is True, it changes value of object’s UV from 0 to 1. Default is False.

- Setting export option of obj, cache, fbx, alembic and Garment file. In case you need to export multiple files and want to set different options, please use set_save_option_list function. This function only decides values. To apply this value to Marvelous Designer, must call set_app_save_option function.

- def set_open_option_list(object, unit_list, fps_list):

- unit_list is string list type, fps_list is integer list type

- Setting import option for obj, cache, fbx, alembic and Garment file. In case you need to import multiple files and want to set different options, call this function. The factor is list type and the factor unit_list and fps_list must be the same count. If there are more files to import than option_list, values will be set the same as the last items. Please refer to example.py for details.

def set_save_option_list(object, unit_list, fps_list, unified_map_list):

- unit_list is string list type, fps_list is integer list type, unified_map_list is Boolean list type

- Setting export option for obj, cache, fbx, Alembic and Garment file. In case you need to export multiple files and want to set different options, call this function. The factor is list type and the factor unit_list, fps_list, unified_map_list must be the same count. If there are more files to export than option_list, values will be set the same as the last items. Please refer to example.py for details.

def run_app_open_option(object):

- run_app_open_option apply values which saved at set_open_option function and designates import option of Marvelous Designer.

def run_app_save_option(object):

- run_app_save_option apply values which saved at set_save_option, it designates export option of Marvelous Designer.

- def run_app_open_option(object, index):

- index is integer type

- This function apply value which saved at set_open_option_list, it designates export option of Marvelous Designer.

- If option is set list at set_open_option_list, it send index of designated items to factor. Minimum value of Index is -0 and total list size value of -1 is the maximum value of index.

def run_app_save_option(object, index):

- Index is integer type

- Function apply value which saved at set_save_option_list function. It designates Export of Marvelous Designer. If option is saved at set_save_option_list as a list, it will save option values and send it as factor and apply to items you want. Minimum value of Index is 0. The maximum value is total list size of -1.

def get_app_open_optin_count(object):

- Returns current setting of import option count. Default is 0.

def get_app_save_optin_count(object):

- Returns current setting of export option count. Default is 0.

def set_avatar_file_path(object, open_avatar_file_path):

- open_avatar_file_path is string type.

- Add avatar file path. If the count does not match with other files, the last avatar file path will be loaded.

def set_avatar_file_path_list(object, open_avatar_file_path_list):

- open_avatar_file_path_list is string list type

- Set avatar file list. It is used to set external list type value. If the count does not match with other file lists, the last avatar file path will be loaded.

def set_garment_file_path(object, open_garment_file_path):

- open_garment_file_path is string type

- Add garment file path. . If the count does not match with other files, the last garment file path will be loaded.

def set_garment_file_path_list(object, open_garment_file_path_list):

- open_garment_file_path_list is string list type

- Sets garment file list. It is used to set external list type value. If the count does not match with other file lists, the last garment file path will be loaded.

def set_animation_file_path(object, open_animation_file_path):

- open_animation_file_path is string list type

- Sets animation file list. It is used to set external list type value. If the count does not match with other file lists, the last animation file path will be loaded.

def set_animation_file_path_list(object, open_animation_file_path_list):

- open_animation_file_path_list is string list type

- Sets animation file list. It is used to set external list type value. If the count does not match with other file lists, the last animation file path will be loaded.

- def set_simulation_options(object, obj_type = 0, simulation_quality = 0, simulation_delay_time = 5000, process_simulation = True):

- obj_type is integer type, it loads object depends its value obj_type = 0 is avatar, if it is 1 trim object, if it is 2 obj to garment. Default is avatar type.

- Simulation_quality is integer type, it defines simulation quality by value 0 = Normal, 1 = complete, 2 = Custom type. Default is Normal.

- Simulation_delay_time is integer type, this Value represents the time of simulation before animation for stabilization. Default is 5000 micro seconds, (micro seconds = seconds*1000)

- Process_simulation is boolean type, this decides whether proceed simulation. Default is True.

- This function Adds Import options related to obj type and simulation. If the count does not match with files which will be imported or option is not set, value will be set to default.

def avatar_file_open(object, open_file_path, obj_type = 0, scale = "mm", fps = 30):

- open_file_path is string type, obj_type is string type, scale is string type, fps is integer type

- This function loads avatar files (avt, obj, fbx, alembic) located in open_file_path. Also applies saved obj_type, scale, fps option.

def garment_file_open(object, open_file_path):

- open_file_path is string type,

- This function loads garment (zpac, pac, zprj) file located in open_file_path.

def animation_file_open(object, open_file_path, scale = "mm", fps = 30):

- open_file_path is string type, scale is string type, fps is integer type

- This function loads animation (pos, mc, mcx, pc2, mdd) located in open_file_path file. Also applies saved scale, fps option.

def save_file_stand_alone(object, file_path, scale = "mm", fps = 30, unfined_map = True):

- File_path is string type, scale is string type, fps is integer type, unified_map은 Boolean type

- This function saves loaded files to file_path. It automatically designates file type depends on extension saved in File_path when saving. Also applies saved scale, fps, unified_map option.

def SimulationOn(object, time):

- Time is integer type, micro seconds (seconds * 1000)

- Start simulation after designated time.

def SimulationOff(object, time):

- Time is integer type, micro seconds (seconds * 1000)

- Stop simulation after designated time.

def StartAnimationRecord(object, time):

- Time is integer type, micro seconds (seconds * 1000)

- After designated time, start and record Animation.

def set_save_file_path(object, save_file_path):

- save_file_path is string type

- This function add path which received from factor to save_file_path_list. save_file_path_list need to be match at least one of saved import file list.

- This can be replaced by setting set_save_folder_path. Either of one must be set.

def set_save_folder_path(object, save_folder_path):

- save_folder_path is string type

- This function sets the path which received from factor as save folder path. Save folder path save files as Zprj. The name of file will be the same with import file list which have largest count. This can be replaced by setting set_save_file_path. Either of one must be set.

def set_garment_folder(object, garment_folder_path, filter = "zpac"):

- garment_folder_path is string type, filter is string type

- This function loads garment files from designated folder and set by open_garment_file_list. In case setting Filter value, it sets open_garment_file_list by extension which saved at filter.

- Default setting of Filter is “zpac”.

def set_avatar_folder(object, avatar_folder_path, filter = "avt"):

- avatar_folder_path is string type, filter is string type

- This function loads avatar files from designated folder and set by open_avatar_file_list로. In case setting Filter value, it sets open_avatar_file_list by extension which saved at filter. (?)

- Default setting of Filter is “avt”.

def set_animation_folder(object, animation_folder_path, filter = "pos"):

- animation_folder_path는 string type, filter는 string type

- This function loads animation files from designated folder and set by open_animation_file_list. In case setting Filter value, it sets open_animation_file_list by extension which saved at filter.

- Default setting of Filter is “pos”.

def get_max_count(object):

- This function returns the item count of the biggest size list among file lists which will be opened.

def single_process(object, open_garment_path, open_avatar_path, open_animation_path, save_file_path, obj_type = 0, simulation_delay_time = 5000, simulation_quality = 0, simulation = True, auto_save_project_file = True):

- single_process sequentially loads files from path which received from factor and save result to save_file_path.

- obj_type only applied when opened file is obj. if value of obj_type is 0, obj file will be opened as avatar, if it is 1, it is opened as trim object and if it is 2, it will be opened as obj to Garment file.

- simulation_delay_time is used to set a delay time before process animation for stabilization. Opened avatar and garment will simulate with start pose designated time and start animation.

- simulation_delay_time uses micro seconds (1000 == 1 seconds)

- simulation_quality controls precision of Simulation. When the value is 0 it simulate with Normal quality. When it is 1, it simulates with Complete quality. These options of simulation_quality is the same with Simulation quality of Marvelous Designer. Please refer to Marvelous Designer manual for details..

- Simulation factor decides whether it starts simulation after loading files. When it is True, it starts Simulation after load all files. Default value is True.

- auto_save_project_file is the option allows to save Project file to save_file_path. Default value is True.

Note. When calling single_process it only saves file once. Please use “process” function to save multiple files.

def process(object, auto_save_zprj_file = True):

- auto_save_zprj_file is Boolean type, if set auto_save_zprj_file as True, it saves additional Zprj file to the folder which saved to save_file_path or save_folder_path.

- process function open designated files and process and record animation, then save it as animation, garment and avatar file. Import / export setting need to be done before call process function. Process function allows to save and load one or multiple files by saved file list and import / export option.

Was this article helpful?
1 out of 1 found this helpful

Comments

Please sign in to leave a comment.