We tried to simplified access to 3DCoat's UI from scripts.
You can select any menu item, press any button by writing a correspondent code.
UI ui;
ui( "TitleThatYouSeeOnScreen" );
You may ask: "What about data fields"? You can get access to them by using internal name.
Example:
Debug dbg;
DebugLog log = dbg.log();
void main() {
log.clear();
SculptRoom room;
room.clear().toSurface();
UI ui;
ui.toSculptRoom();
ui( "Primitives" )( "Create sphere" )
( "$SpherePrim::%$px4[62]", 0 )
( "$SpherePrim::%$py5[62]", 0 )
( "*Apply" );
ui( "$SpherePrim::%$px4[62]", 50 )
( "*Apply" );
ui( "$SpherePrim::%$py5[62]", 50 )
( "*Apply" );
}
Because 3DCoat is multilingual, there is nuance.
In order for your script to work properly in 3DCoat instance that uses different UI language use code (starts with $
) or switch the UI language in the script. It is, of course, good to switch it back when you finish.
string currentLang = ui.lang();
ui.lang( "english" );
ui.lang( currentLang );
Some other useful functions:
DEPRECATED bool cmd( string );
void Step( int n );
void Wait( int ms );
void InstallToMenu( string path, string itemName );
DEPRECATED bool FieldExists(string &in ID);
void main(){
int n=0;
do{
string s="$ExtraLight::Color["+formatInt(n,"l")+"]";
if(FieldExists(s)){
n++;
}else break;
}while(true);
string s="Amount of lights = "+formatInt(n,"l");
ModalDialog(s,"");
}
DEPRECATED bool GetBoolField(string &in ID);
DEPRECATED bool SetBoolField(string &in ID,bool val);
DEPRECATED int GetColorField(string &in ID);
DEPRECATED bool SetColorField(string &in ID,bool val);
DEPRECATED float GetSliderValue(string &in ID);
DEPRECATED bool SetSliderValue(string &in ID,float val);
DEPRECATED float GetEditBoxValue(string &in ID);
DEPRECATED bool GetEditBoxValue(string &out ID,string &out value);
DEPRECATED bool SetEditBoxValue(string &in ID,string &out val);
DEPRECATED bool SetEditBoxValue(string &in ID,float val);
DEPRECATED void SubstituteInputText(const string & val);
DEPRECATED void SubstituteInputText(float val);
SubstituteInputText(200.0);
cmd("$CubPrim::ScaleY");
Step(1);
You may need these functions:
DEPRECATED float GetMouseX()
DEPRECATED float GetMouseY()
DEPRECATED float GetPressure()
DEPRECATED bool LMBPressed()
DEPRECATED bool RMBPressed()
DEPRECATED bool MMBPressed();
DEPRECATED float GetVisiblePenRadius();
DEPRECATED void StartStroke(float x,float y,float Pressure)
DEPRECATED void DrawStrokeTo(float x,float y,float Pressure)
DEPRECATED void EndStroke()
DEPRECATED bool ScreenRayPicksObject(float x,float y)
DEPRECATED bool WasRecentlyPressed(string &in ID,float Time);
DEPRECATED bool WasRecentlyRMBPressed(string &in ID,float Time);
DEPRECATED bool IsInTool(string &in ToolID);
DEPRECATED string GetCurrentToolID ();
DEPRECATED float GetTimeSinceStart();
Also check this full list of functions:
string getCommandLine();
DEPRECATED void SetGlobalVar(string& Name,string& Value)
DEPRECATED string GetGlobalVar (string& Name)
DEPRECATED string GetSceneFileName()
DEPRECATED void SetSceneFileName(string& Name)
void HighlightUIElement(string &ID, float time);
DEPRECATED void back(int steps=1);
DEPRECATED void open(string &Path);
DEPRECATED void ppp(string &path);
DEPRECATED void mv(string &path);
DEPRECATED void ptex(string &path);
DEPRECATED void imagemesh();
DEPRECATED void refmesh(string &path);
DEPRECATED void vertexpaint(string &path);
DEPRECATED void autopo(string &path);
DEPRECATED void repair(string &id);
DEPRECATED void bass();
DEPRECATED void undercut();
DEPRECATED void activate(string &id);
DEPRECATED void retopo();
DEPRECATED void retopopen();
DEPRECATED void ToRoom(string &name);
DEPRECATED bool IsInRoom(string &name);
DEPRECATED void AddNewVolume(string &name);
DEPRECATED void uv();
DEPRECATED void vox();
DEPRECATED void sphere(float x,float y,float z,float r,int mode);
DEPRECATED void cube(float x,float y,float z,float sizex,float sizey,float sizez,int mode);
DEPRECATED void surf();
DEPRECATED void cursurf();
DEPRECATED void voxelize();
DEPRECATED void mergeopt(string &opt);
mergeopt( "[voxelize=true][as_skin=true][skin=4.5]" );
DEPRECATED void merge(string &model);
DEPRECATED void prim(string &id);
DEPRECATED void apply();
DEPRECATED void ApplyAndKeepScale();
DEPRECATED void mapply();
DEPRECATED void recent3b();
DEPRECATED void Log(string &line);
int rand(int min,int max);
float randF(float min,float max);
void seed(int val);
DEPRECATED void ProgressBar(const string& message,int pos);
DEPRECATED void SetOrthoMode(bool value);
- See Also
- π Creating custom dialog windows
-
π Dialogs windows