ΠΡ ΠΏΠΎΡΡΠ°ΡΠ°Π»ΠΈΡΡ ΠΌΠ°ΠΊΡΠΈΠΌΠ°Π»ΡΠ½ΠΎ ΡΠΏΡΠΎΡΡΠΈΡΡ Π΄ΠΎΡΡΡΠΏ ΠΊ UI (User Interface) 3DCoat ΠΈΠ· ΡΠΊΡΠΈΠΏΡΠΈΠ½Π³Π°.
Π’Ρ ΠΌΠΎΠΆΠ΅ΡΡ Π²ΡΠ±ΡΠ°ΡΡ ΠΈΠ· ΡΠΊΡΠΈΠΏΡΠ° Π»ΡΠ±ΠΎΠΉ ΠΏΡΠ½ΠΊΡ ΠΌΠ΅Π½Ρ, Π½Π°ΠΆΠ°ΡΡ Π»ΡΠ±ΡΡ ΠΊΠ½ΠΎΠΏΠΊΡ, ΠΏΡΠΎΡΡΠΎ Π·Π°ΠΏΠΈΡΠ°Π²
UI ui;
ui( "ΠΠ°Π·Π²Π°Π½ΠΈΠ΅ΠΠΎΡΠΎΡΠΎΠ΅ΠΠΈΠ΄ΠΈΡΡΠΠ°ΠΠΊΡΠ°Π½Π΅" );
Π‘ΠΏΡΠΎΡΠΈΡΡ: "Π ΠΊΠ°ΠΊ ΠΆΠ΅ Π±ΡΡΡ Ρ ΠΏΠΎΠ»ΡΠΌΠΈ Π΄Π°Π½Π½ΡΡ "? Π Π½ΠΈΠΌ ΠΏΠΎΠ»ΡΡΠ°ΠΉ Π΄ΠΎΡΡΡΠΏ, ΠΎΠ±ΡΠ°ΡΠ°ΡΡΡ ΠΏΠΎ Π²Π½ΡΡΡΠ΅Π½Π½Π΅ΠΌΡ ΠΈΠΌΠ΅Π½ΠΈ.
ΠΡΠΈΠΌΠ΅Ρ:
// Π΄ΠΎΡΡΡΠΏ ΠΊ ΠΎΡΠ»Π°Π΄ΠΊΠ΅
Debug dbg;
DebugLog log = dbg.log();
void main() {
log.clear();
// ΠΏΠΎΠ΄Π³ΠΎΡΠ°Π²Π»ΠΈΠ²Π°Π΅ΠΌ ΡΡΠ΅Π½Ρ
SculptRoom room;
room.clear().toSurface();
// ΠΏΠΎΡΡΡΠΎΠΈΠΌ ΡΡΠ΅ΡΡ
UI ui;
ui.toSculptRoom();
// ΠΎΠ±ΡΠ°ΡΠ°Π΅ΠΌΡΡ, ΠΏΠΎ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡΠΈ, ΠΊ Π½Π°Π·Π²Π°Π½ΠΈΡΠΌ, ΠΊΠΎΡΠΎΡΡΠ΅ Π²ΠΈΠ΄ΠΈΠΌ Π½Π° ΡΠΊΡΠ°Π½Π΅
// Π΄Π»Ρ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ Π·Π½Π°ΡΠ΅Π½ΠΈΠΉ ΠΏΠΎΠ»Π΅ΠΉ Π² ΠΊΠ°Π²ΡΡΠΊΠ°Ρ
, ΠΎΠ±ΡΠ°ΡΠ°ΠΉΡΠ΅ΡΡ ΠΊ Π½ΠΈΠΌ
// ΠΏΠΎ Π²Π½ΡΡΡΠ΅Π½Π½Π΅ΠΌΡ ΠΈΠΌΠ΅Π½ΠΈ; Π΄Π»Ρ Π΅Π³ΠΎ ΠΏΠΎΠ»ΡΡΠ΅Π½ΠΈΡ, Π½Π°ΠΆΠΌΠΈ MClick + RClick
// Π½Π° ΠΈΠ½ΡΠ΅ΡΠ΅ΡΡΡΡΠ΅ΠΌ ΡΠ΅Π±Ρ ΠΏΠΎΠ»Π΅
// Π³ΠΎΠ²ΠΎΡΠΈΠΌ `*Apply` Π²ΠΌΠ΅ΡΡΠΎ `Apply`, ΡΡΠΎΠ±Ρ 3DCoat ΠΏΠΎΠ½ΡΠ» Π½Π°ΡΠ΅ Π½Π°ΠΌΠ΅ΡΠ΅Π½ΠΈΠ΅,
// Π° ΠΈΠΌΠ΅Π½Π½ΠΎ: *Π½Π°ΠΆΠ°ΡΡ* Π½Π° ΠΊΠ½ΠΎΠΏΠΊΡ
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" );
}
Π’. ΠΊ. ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡ 3DCoat - ΠΌΠ½ΠΎΠ³ΠΎΡΠ·ΡΡΠ½ΡΠΉ, Π΅ΡΡΡ ΠΎΠ΄ΠΈΠ½ Π½ΡΡΠ°Π½Ρ.
Π ΠΈΠΌΠ΅Π½Π½ΠΎ, ΡΡΠΎΠ±Ρ ΡΠ²ΠΎΠΉ ΡΠΊΡΠΈΠΏΡ ΡΠ°Π±ΠΎΡΠ°Π» ΠΈ Π΄Π»Ρ 3DCoat, ΠΊΠΎΡΠΎΡΡΠΉ Π·Π°ΠΏΡΡΠ΅Π½ Π½Π° Π΄ΡΡΠ³ΠΎΠΌ ΡΠ·ΡΠΊΠ΅, ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠΉ ΠΎΠ±ΡΠ°ΡΠ΅Π½ΠΈΠ΅ ΠΏΠΎ ΠΊΠΎΠ΄Ρ (Π½Π°ΡΠΈΠ½Π°Π΅ΡΡΡ Ρ ΡΠΈΠΌΠ²ΠΎΠ»Π° $
) ΠΈΠ»ΠΈ ΠΏΡΠΈ Π·Π°ΠΏΡΡΠΊΠ΅ ΡΠΊΡΠΈΠΏΡΠ° ΠΏΠ΅ΡΠ΅ΠΊΠ»ΡΡΠ°ΠΉ ΡΠ·ΡΠΊ ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡΠ°. Π₯ΠΎΡΠΎΡΠΈΠΌ ΡΠΎΠ½ΠΎΠΌ Π±ΡΠ΄Π΅Ρ Π²Π΅ΡΠ½ΡΡΡ ΡΠ·ΡΠΊ ΠΏΠΎ Π·Π°Π²Π΅ΡΡΠ΅Π½ΠΈΡ ΡΠΊΡΠΈΠΏΡΠ°.
string currentLang = ui.lang();
// Π΅ΡΠ»ΠΈ ΡΠ²ΠΎΠΉ ΡΠΊΡΠΈΠΏΡ ΡΠΎΠ·Π΄Π°Π²Π°Π»ΡΡ Π΄Π»Ρ Π°Π½Π³Π»ΠΈΠΉΡΠΊΠΎΠ³ΠΎ ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡΠ°
ui.lang( "english" );
// ΡΠ²ΠΎΠΉ ΡΠΊΡΠΈΠΏΡ
// Π²ΠΎΠ·Π²ΡΠ°ΡΠ°ΠΉ ΡΠ·ΡΠΊ ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡΠ°, ΠΊ ΠΊΠΎΡΠΎΡΠΎΠΌΡ ΠΏΡΠΈΠ²ΡΠΊ Ρ
ΡΠ΄ΠΎΠΆΠ½ΠΈΠΊ
ui.lang( currentLang );
ΠΡΡΡ Π΅ΡΡ Π½Π΅ΡΠΊΠΎΠ»ΡΠΊΠΎ ΡΡΠ½ΠΊΡΠΈΠΉ, ΠΊΠΎΡΠΎΡΡΠ΅ ΠΌΠΎΠ³ΡΡ Π±ΡΡΡ ΡΠ΅Π±Π΅ ΠΏΠΎΠ»Π΅Π·Π½Ρ ΠΏΡΠΈ ΡΠΎΠ·Π΄Π°Π½ΠΈΠΈΠΈ ΡΠΊΡΠΈΠΏΡΠ° Π΄Π»Ρ 3DCoat:
// Π’ΠΎ ΠΆΠ΅, ΡΡΠΎ `ui( string )`, Π½ΠΎ Π·Π΄Π΅ΡΡ ΠΎΠ±ΡΠ°ΡΠ°ΡΡΡΡ ΠΊ UI ΠΌΠΎΠΆΠ½ΠΎ
// ΡΠΎΠ»ΡΠΊΠΎ ΠΏΠΎ Π²Π½ΡΡΡΠ΅Π½Π½Π΅ΠΌΡ ΠΈΠΌΠ΅Π½ΠΈ.
DEPRECATED bool cmd( string );
// ΠΡΠΎΠΏΡΡΡΠΈΡΡ `n` ΠΏΡΠΎΡΠΈΡΠΎΠ²ΠΎΠΊ ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡΠ° 3DCoat.
void Step( int n );
// ΠΠΎΠ΄ΠΎΠΆΠ΄Π°ΡΡ ΡΠΊΠ°Π·Π°Π½Π½ΡΠΉ Π² ΠΌΠΈΠ»Π»ΠΈΡΠ΅ΠΊΡΠ½Π΄Π°Ρ
ΠΈΠ½ΡΠ΅ΡΠ²Π°Π» ΠΈ ΠΏΡΠΎΠ΄ΠΎΠ»ΠΆΠΈΡΡ
// Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ ΡΠΊΡΠΈΠΏΡΠ°.
void Wait( int ms );
// Π‘ΠΎΠ·Π΄Π°ΡΡ ΠΌΠ΅Π½Ρ, ΠΊΠΎΡΠΎΡΠΎΠ΅ Π±ΡΠ΄Π΅Ρ Π·Π°ΠΏΡΡΠΊΠ°ΡΡ ΡΠΊΡΠΈΠΏΡ.
// Π‘ΠΊΡΠΈΠΏΡ Π±ΡΠ΄Π΅Ρ ΡΠΊΠΎΠΏΠΈΡΠΎΠ²Π°Π½ Π² ΠΏΠ°ΠΏΠΊΡ `Scripts/ExtraMenuItems`.
// \param path Path to script which will run.
void InstallToMenu( string path, string itemName );
// Check if element exists in UI. ID has same meaning as in cmd.
DEPRECATED bool FieldExists(string &in ID);
// Example β how to get to know amount of lights in Render room?
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,"");
}
// Get bool field from UI. ID has same meaning as in cmd.
DEPRECATED bool GetBoolField(string &in ID);
// Set value of the boolean field in UI. ID has same meaning as in cmd.
// Returns true if set value successfuly.
DEPRECATED bool SetBoolField(string &in ID,bool val);
// Get color field from UI as integer value. ID has same meaning as in cmd.
DEPRECATED int GetColorField(string &in ID);
// Set value of the color field in UI. ID has same meaning as in cmd.
// Returns true if set value successfully.
// Example of colors β 0xFF0000 β red, 0x00FF00 β green, 0x0000FF - blue.
DEPRECATED bool SetColorField(string &in ID,bool val);
// Get value of slider in UI. ID has same meaning as in cmd.
DEPRECATED float GetSliderValue(string &in ID);
// Set value of slider in UI. ID has same meaning as in cmd.
// Returns true if set value successfuly.
DEPRECATED bool SetSliderValue(string &in ID,float val);
// Get value of edit box in UI. ID has same meaning as in cmd.
// Returns 0 if field not found.
DEPRECATED float GetEditBoxValue(string &in ID);
// Get value of edit box in UI. ID has same meaning as in cmd.
// Returns true if field found.
DEPRECATED bool GetEditBoxValue(string &out ID,string &out value);
// Set value of edit box in UI. ID has same meaning as in cmd.
// Returns true if field found.
DEPRECATED bool SetEditBoxValue(string &in ID,string &out val);
DEPRECATED bool SetEditBoxValue(string &in ID,float val);
DEPRECATED void SubstituteInputText(const string & val);
// Substitute string or value to the next input text dialog.
// You need this command if there is button that triggers input
// dialog to enter some text or value.
DEPRECATED void SubstituteInputText(float val);
// Example - transform tool, ScaleY button. Code to scane object
// twice along Y-axis:
SubstituteInputText(200.0);
cmd("$CubPrim::ScaleY");
Step(1);
Π’Π°ΠΊΠΆΠ΅ ΡΠ΅Π±Π΅ ΠΌΠΎΠ³ΡΡ ΠΏΡΠΈΠ³ΠΎΠ΄ΠΈΡΡΡ ΠΈ ΡΡΠΈ ΡΡΠ½ΠΊΡΠΈΠΈΠΈ:
// Get current mouse coordinate X.
DEPRECATED float GetMouseX()
// Get current mouse coordinate Y.
DEPRECATED float GetMouseY()
// Get pen pressure.
DEPRECATED float GetPressure()
// Check if LMB pressed.
DEPRECATED bool LMBPressed()
// Check if RMB pressed.
DEPRECATED bool RMBPressed()
// Check if MMB pressed.
DEPRECATED bool MMBPressed();
// Get visible (in screen projection) radius of the brush.
DEPRECATED float GetVisiblePenRadius();
// Start drawing stroke at point (x,y) with some pressure.
// \param Pressure In diapason [ 0.0 (without pressure); 1.0 (maximum pressure) ].
DEPRECATED void StartStroke(float x,float y,float Pressure)
// Draw stroke to point (x,y) with some pressure.
// \param Pressure In diapason [ 0.0 (without pressure); 1.0 (maximum pressure) ].
DEPRECATED void DrawStrokeTo(float x,float y,float Pressure)
// After that command stroke will be actually drawn.
// Set of commands StartStroke. DrawStrokeTo should be
// terminated by EndStroke.
DEPRECATED void EndStroke()
// True when object presents by ray (x,y).
DEPRECATED bool ScreenRayPicksObject(float x,float y)
// Was widget with identifier ID recently (within last Time sec) pressed?
DEPRECATED bool WasRecentlyPressed(string &in ID,float Time);
// Was widget with identifier ID recently (within last Time sec)
// pressed via RMB?
DEPRECATED bool WasRecentlyRMBPressed(string &in ID,float Time);
// Is user in tool identified as ID? To get current tool
// identifier press RMB + MMB over empty field.
DEPRECATED bool IsInTool(string &in ToolID);
// Get active tool ID.
DEPRECATED string GetCurrentToolID ();
// Get time (sec) since script started.
DEPRECATED float GetTimeSinceStart();
ΠΠΎΡΠΌΠΎΡΡΠΈ ΡΠ°ΠΊΠΆΠ΅ ΡΡΠΎΡ Π½Π°Π±ΠΎΡ ΡΡΠ½ΠΊΡΠΈΠΉ Π΄Π»Ρ ΠΏΠΎΠ»Π½ΠΎΠΉ ΠΊΠ°ΡΡΠΈΠ½Ρ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡΠ΅ΠΉ:
// Returns whole command line.
string getCommandLine();
// Stores some string as global value that may be read later in
// the session. The value will be stored in 3B file and you will
// be able to read in further work with this scene.
DEPRECATED void SetGlobalVar(string& Name,string& Value)
// Returns value previously stored using SetGlobalVar.
DEPRECATED string GetGlobalVar (string& Name)
// Returns scene filename (last saved or opened as 3B file).
DEPRECATED string GetSceneFileName()
// Sets scene filename for further saving.
DEPRECATED void SetSceneFileName(string& Name)
// Highlight element with red rectangle.
// Pass the `time` in seconds.
void HighlightUIElement(string &ID, float time);
// Goes to one of previous dialogs in call stack.
DEPRECATED void back(int steps=1);
// Opens window described by xml-file pointed by Path.
// If Path contains .3b file will be opened as 3B file.
DEPRECATED void open(string &Path);
// Opens model for PPP, if path is empty, shows open dialog.
DEPRECATED void ppp(string &path);
// Opens model for MV painting, if path is empty, shows open dialog.
DEPRECATED void mv(string &path);
// Opens model for Ptex, if path is empty, shows open dialog.
DEPRECATED void ptex(string &path);
// Import image as mesh, dialog will be shown.
DEPRECATED void imagemesh();
// Import mesh as reference, if path is empty dialog will be shown.
DEPRECATED void refmesh(string &path);
// Import mesh for vertex painting, if path is empty dialog will be shown.
DEPRECATED void vertexpaint(string &path);
// Perform autopo over the mesh chosen in dialog.
DEPRECATED void autopo(string &path);
// Opens mesh for repairing. If id contains "vox" then model will be
// voxelized, if there is substring "shell" then mesh will be imported
// as thin shell. Mesh Opening dialog will be shown.
DEPRECATED void repair(string &id);
// Activate bas-relief tool.
DEPRECATED void bass();
// Activale remove undercuts mode.
DEPRECATED void undercut();
// Activate special voxel tool. id may be found in English.xml between
// ... if you will find name of tool between
// ... tags.
DEPRECATED void activate(string &id);
// Activate retopo tool.
DEPRECATED void retopo();
// Open mesh using dialog and merge as retopo mesh.
DEPRECATED void retopopen();
// Activate any room - name is one of "Paint", "Tweak", "UV",
// "Voxels", "Retopo", "Render".
DEPRECATED void ToRoom(string &name);
// Check if you are in specified room - name is one of "Paint",
// "Tweak", "UV", "Voxels", "Retopo", "Render".
DEPRECATED bool IsInRoom(string &name);
// Add new volume in voxel room. If name is empty name will be
// assigned automatically.
DEPRECATED void AddNewVolume(string &name);
// Activate UV room.
DEPRECATED void uv();
// Activate voxel room and add new volume.
DEPRECATED void vox();
// Create sphere of radius R in voxel room in current object.
// \param mode 0 - add, 1 - subtract, 2 - intersect with scene.
DEPRECATED void sphere(float x,float y,float z,float r,int mode);
// Create cube in voxel room in current object.
// \param mode 0 - add, 1 - subtract, 2 - intersect with scene.
// \param sizex Size by X-axis.
// \param sizey Size by Y-axis.
// \param sizez Size by Z-axis.
DEPRECATED void cube(float x,float y,float z,float sizex,float sizey,float sizez,int mode);
// Turn all volumes to surface mode.
DEPRECATED void surf();
// Turn current volume to the surface mode.
DEPRECATED void cursurf();
// Turn current volume to voxel mode, voxelize if need.
DEPRECATED void voxelize();
// Sets merging options in voxel room. opt is just set of substrings
// with different options. Possible values are:
// [voxelize=true]
// [voxelize=false]
// [separate=true]
// [separate=false]
// [respectneg=true]
// [respectneg=false]
// [as_skin=true]
// [as_skin=false]
// [skin=....] - to set skin thickness.
DEPRECATED void mergeopt(string &opt);
// Example:
mergeopt( "[voxelize=true][as_skin=true][skin=4.5]" );
// Merge model in voxel room. Empty string means that dialog will be shown.
DEPRECATED void merge(string &model);
// Activate voxel primitives tool. Possible primitives:
// cube, cylinder, sphere, tube, cone, ellipse, n-gon, gear.
DEPRECATED void prim(string &id);
// Apply in current tool (same as press enter).
DEPRECATED void apply();
// Apply in Merge tool without asking "Keep scale?".
// Scale will not be kept and scene scale will not be changed.
DEPRECATED void ApplyAndKeepScale();
// Apply in current tool (same as press enter) wint one difference -
// in Merge tool scale of merged object sill be automatically kept and
// scene scale changed if this merge is first.
DEPRECATED void mapply();
// Open recent 3B-file.
DEPRECATED void recent3b();
// Print text to MyDocuments/3D-CoatV4/log.txt.
DEPRECATED void Log(string &line);
// Generate integer random number min..max.
int rand(int min,int max);
// Generate floating random number min..max.
float randF(float min,float max);
// Set random generator seed.
void seed(int val);
// Show progress bar pos = 0..100.
DEPRECATED void ProgressBar(const string& message,int pos);
// Set orthogonal (true) or perspective (false) view mode.
DEPRECATED void SetOrthoMode(bool value);