3DCoat Python API
The 3DCoat Python API documentation.
|
Public Member Functions | |
bool | cmd (id=str, fn=Any) |
perform some command in UI. | |
bool | wait (id=str, max_seconds=float) |
wait till the element id will appear in the UI. | |
bool | setSliderValue (id=str, value=float) |
Set the value for the the slider (if exists in UI) | |
float | getSliderValue (id=str) |
get the value of the slider | |
bool | setEditBoxValue (id=str, value=str) |
set the edit box value | |
bool | setEditBoxValue (id=str, value=int) |
set the edit box value | |
bool | setEditBoxValue (id=str, value=float) |
set the edit box value | |
bool | getEditBoxValue (id=str, result=Any) |
get the edit box value | |
str | getEditBoxValue (id=str) |
get the edit box value | |
apply () | |
pess ENTER, acts as Apply usually | |
setFileForFileDialog (filename=str) | |
Set the file for the next file dialog that will be triggered by user. | |
bool | getBoolField (id=str) |
Get the bool field from the checkbox in UI. | |
bool | setBoolValue (id=str, value=bool) |
Set the value for the checkbox in UI. | |
str | currentRoom () |
get the current room name | |
bool | isInRoom (name=str) |
check if we are in the specified room | |
toRoom (name=str) | |
switch to the room | |
int | roomsCount () |
returns the rooms count | |
str | roomName (index=int) |
get the room name by index | |
str | roomID (index=int) |
get the text identifier of the room | |
toolParam (B=Any) | |
show the class B as the part of the tools params panel | |
removeToolParam (B=Any) | |
remove the class from the tools params | |
str | getOption (id=str) |
get the option from preferences | |
bool | setOption (id=str, value=str) |
set the value to preferences | |
bool | setOption (id=str, value=bool) |
set the value to preferences | |
bool | setOption (id=str, value=float) |
set the value to preferences | |
hideDontShowAgainMessage (id=str) | |
Hides the "Don't show again dialog" for the current session (not forever) | |
showInfoMessage (infoID=str, milliseconds=int) | |
Show the floating information message for the some time period. | |
insertInMenu (Menu=str, ID_in_menu=str, script_path=str) | |
Insert the scripted command into the main menu. | |
insertInToolset (roomID=str, section=str, toolID=str, script_path=str) | |
Insert the script-based tool into the toolset. | |
removeCommandFromMenu (ID_in_menu=str) | |
remove the command from the menu | |
bool | checkIfMenuItemInserted (ID_in_menu=str) |
Check if the command inserted somewhere into the menu. | |
addExtension (roomID=str, section=str, obj=Any) | |
Add the extension (new tool) into the room. | |
bool | checkIfExtensionPresent (extension_ID=str) |
Check if extension named as extension_ID is present in the 3DCoat. | |
addTranslation (id=str, text=str) | |
Add the translation for the text identifier. | |
str | getIdTranslation (id=str) |
Get the translation for the text identifier. | |
str | getCurrentLanguage () |
Get the current language file name (without the XML extension) | |
switchToLanguage (language=str) | |
Switch the layout to the language. | |
float | scale () |
returns the scale in comparison to the smallest UI theme | |
str | inputString (text=str, min_length=int) |
input text under the mouse position | |
int | inputInt (initial_value=int) |
input the integer value under the mouse position | |
float | inputFloat (initial_value=float) |
inputh the float value under the mouse position | |
coat.ui.addExtension | ( | roomID = str , |
|
section = str , |
|||
obj = Any |
|||
) |
Add the extension (new tool) into the room.
Look the GeneratorExample.py
roomID | roomID the room identifier, same as folders names in Documents/3DCoat/UserPrefs/Rooms/CustomRooms/ |
section | section the section name. This string may be empty to add beyond sections (anyway, at the end) or in any existing section. To get section name, pres RMB+MMB over the section name in the toolset. You will get something like " #Adjust" in the clipboard. The "Adjust" in this case is the section name. |
obj | the object that contains the extension. Look the GeneratorExample.py |
coat.ui.addTranslation | ( | id = str , |
|
text = str |
|||
) |
Add the translation for the text identifier.
id | the identifier |
text | the translation |
coat.ui.apply | ( | ) |
pess ENTER, acts as Apply usually
bool coat.ui.checkIfExtensionPresent | ( | extension_ID = str | ) |
Check if extension named as extension_ID is present in the 3DCoat.
extension_ID | the identifier of the extension |
bool coat.ui.checkIfMenuItemInserted | ( | ID_in_menu = str | ) |
Check if the command inserted somewhere into the menu.
ID_in_menu | the ID of the command in the menu, look the list in C:\Users\andre\OneDrive\Documents\3DCoat\UserPrefs\Scripts\ExtraMenuItems\menu_sections.txt it is the english text or the identifier of the command |
bool coat.ui.cmd | ( | id = str , |
|
fn = Any |
|||
) |
perform some command in UI.
The ID may be taken from the UI by clicking RMB+MMB, then the ID will appear in the clipboard (look Edit->Prferences->General->Script info type). If the element triggers modal dialog, the execution will be paused till the modal dialog will be closed, but the callback will be called each frame in modal dialog, so you will be able to control what happens in the modal dialog.
id | the identifier taken from the UI |
fn | the callback/lambda that will be called each frame till you are within the modal dialog. It looks like def _callback():
cmd("#id_to_press")
...code...
|
str coat.ui.currentRoom | ( | ) |
get the current room name
bool coat.ui.getBoolField | ( | id = str | ) |
Get the bool field from the checkbox in UI.
id | the element identifier |
str coat.ui.getCurrentLanguage | ( | ) |
Get the current language file name (without the XML extension)
str coat.ui.getEditBoxValue | ( | id = str | ) |
get the edit box value
id | the ID of the element |
result | the string the will get the result |
bool coat.ui.getEditBoxValue | ( | id = str , |
|
result = Any |
|||
) |
get the edit box value
id | the ID of the element |
result | the string the will get the result |
str coat.ui.getIdTranslation | ( | id = str | ) |
Get the translation for the text identifier.
id | the text identifier |
str coat.ui.getOption | ( | id = str | ) |
get the option from preferences
id | the identifier of english text of the option |
float coat.ui.getSliderValue | ( | id = str | ) |
get the value of the slider
id | the ID of the element |
coat.ui.hideDontShowAgainMessage | ( | id = str | ) |
Hides the "Don't show again dialog" for the current session (not forever)
id | the identifier, for example "AttachTextureHint", look the currently hidden list as files names in Docs/3DCoat/data/Temp/ #.dontshow |
float coat.ui.inputFloat | ( | initial_value = float | ) |
inputh the float value under the mouse position
initial_value | the initial float value |
int coat.ui.inputInt | ( | initial_value = int | ) |
input the integer value under the mouse position
initial_value | the initial integer value |
str coat.ui.inputString | ( | text = str , |
|
min_length = int |
|||
) |
input text under the mouse position
text | the initial text value |
min_length | the minimal width of the input field, if zero passed the width taken from the parent control (if exists) |
coat.ui.insertInMenu | ( | Menu = str , |
|
ID_in_menu = str , |
|||
script_path = str |
|||
) |
Insert the scripted command into the main menu.
Menu | One of main menu items, look the list in Documents/3DCoat/UserPrefs/Scripts/ExtraMenuItems/menu_sections.txt |
ID_in_menu | the ID of the command in the menu, it is the english text or the identifier of the command |
script_path | the full or relative path to the script file, if relative, it is relative to the 3DCoat root folder If it comes without path, it is assumed to be in same folder as the script that calls this function. If this parameter is empty, this script will be called. |
coat.ui.insertInToolset | ( | roomID = str , |
|
section = str , |
|||
toolID = str , |
|||
script_path = str |
|||
) |
Insert the script-based tool into the toolset.
roomID | the room identifier, same as folders names in Documents/3DCoat/UserPrefs/Rooms/CustomRooms/ |
section | the section name. This string may be empty to add beyond sections (anyway, at the end) or in any existing section. To get section name, pres RMB+MMB over the section name in the toolset. You will get something like " #Adjust" in the clipboard. The "Adjust" in this case is the section name. |
toolID | the tool identifier, how it will appear in UI. You may provide the text for the identifier using the addTranslation(...) Also, if there is image in the data/Textures/icons64/ named as toolID.png, it will be used as the icon for the tool. |
script_path | the full or relative path to the script file, if relative, it is relative to the 3DCoat root folder If it comes without path, it is assumed to be in same folder as the script that calls this function. If this parameter is empty, this script will be called. |
bool coat.ui.isInRoom | ( | name = str | ) |
check if we are in the specified room
name | the room name to check |
coat.ui.removeCommandFromMenu | ( | ID_in_menu = str | ) |
remove the command from the menu
ID_in_menu | the ID of the command in the menu, it is the english text or the identifier of the command |
coat.ui.removeToolParam | ( | B = Any | ) |
remove the class from the tools params
B | the class pointer |
str coat.ui.roomID | ( | index = int | ) |
get the text identifier of the room
index | the room index |
str coat.ui.roomName | ( | index = int | ) |
get the room name by index
index | the room index |
int coat.ui.roomsCount | ( | ) |
returns the rooms count
float coat.ui.scale | ( | ) |
returns the scale in comparison to the smallest UI theme
bool coat.ui.setBoolValue | ( | id = str , |
|
value = bool |
|||
) |
Set the value for the checkbox in UI.
id | the element identifier |
value | the value to set |
bool coat.ui.setEditBoxValue | ( | id = str , |
|
value = float |
|||
) |
set the edit box value
id | the ID of the element |
value | the value to set |
bool coat.ui.setEditBoxValue | ( | id = str , |
|
value = int |
|||
) |
set the edit box value
id | the ID of the element |
value | the value to set |
bool coat.ui.setEditBoxValue | ( | id = str , |
|
value = str |
|||
) |
set the edit box value
id | the ID of the element |
value | the value to set |
coat.ui.setFileForFileDialog | ( | filename = str | ) |
Set the file for the next file dialog that will be triggered by user.
If you will use coat::ui:cmd(...) to trigger some command that shows the file dialog this command allows to substitute the filename for that dialog instead of showing the dialog. This acts only for ONE next dialog.
filename | the filename to substitute. |
bool coat.ui.setOption | ( | id = str , |
|
value = bool |
|||
) |
set the value to preferences
id | the value identifier or english text |
value |
bool coat.ui.setOption | ( | id = str , |
|
value = float |
|||
) |
set the value to preferences
id | the value identifier or english text |
value |
bool coat.ui.setOption | ( | id = str , |
|
value = str |
|||
) |
set the value to preferences
id | the value identifier or english text |
value |
bool coat.ui.setSliderValue | ( | id = str , |
|
value = float |
|||
) |
Set the value for the the slider (if exists in UI)
id | the ID of the element |
value | the value to set |
coat.ui.showInfoMessage | ( | infoID = str , |
|
milliseconds = int |
|||
) |
Show the floating information message for the some time period.
infoID | the message or message identifier (from language files) |
milliseconds | how ling to display the message |
coat.ui.switchToLanguage | ( | language = str | ) |
Switch the layout to the language.
language | the language identifier, actually it is the file name (withot the XML extension) in the data/Languages/ folder |
coat.ui.toolParam | ( | B = Any | ) |
show the class B as the part of the tools params panel
B | the class pointer |
coat.ui.toRoom | ( | name = str | ) |
switch to the room
name | the room name. Pay attention, you may pass the name or identifier, but name has bigger priory. |
bool coat.ui.wait | ( | id = str , |
|
max_seconds = float |
|||
) |
wait till the element id will appear in the UI.
The element will not be clicked. The max wait time is max_seconds.
id | The ID we wait to appear |
max_seconds | the max wait time (seconds) |