Member coverman Posted February 7, 2015 Member Report Share Posted February 7, 2015 I write an easy script to get current tool ID. ------------- void main(){ string ID = GetCurrentToolID(); ShowFloatingMessage(ID, 10); } ------------- This is the result. VOX_SCULPT_TOOL::SCULP_GROW I think this is the command ID! ------------- bool cmd(string &in ID); This is main command that you will use. It performs any action from user interface. To get the command ID hover your mouse cursor over required item and press MMB+RMB simultaneously. The command ID will be copied to clipboard. Pay attention that if a command is not present in current UV layout it will not be performed. ------------- So I write two script. cmd("$[Page4]Grow); //Yes!it is working! cmd("$VOX_SCULPT_TOOL::SCULP_GROW); //No!it is not working. What is the meaning of this command exists? GetCurrentToolID(); Quote Link to comment Share on other sites More sharing options...
Carlosan Posted February 7, 2015 Report Share Posted February 7, 2015 Hi! Which version are you using ? Quote Link to comment Share on other sites More sharing options...
Member coverman Posted February 7, 2015 Author Member Report Share Posted February 7, 2015 I'm using V4.1 and V4.5 beta10. Quote Link to comment Share on other sites More sharing options...
Carlosan Posted February 7, 2015 Report Share Posted February 7, 2015 Please send a technical related question, to Andrew Shpagin atsupport@3d-coat.com ty Quote Link to comment Share on other sites More sharing options...
Contributor ajz3d Posted February 9, 2015 Contributor Report Share Posted February 9, 2015 (edited) I too am puzzled when it comes to a purpose of the GetCurrentToolID() function. The IsInTool(string) accepts commands (cmd) and not tool IDs that are returned by the GetCurrentToolID(). RMB+MMB on a tool also returns a command. Looks like the values returned by GetCurrentToolID() function cannot be used anywhere. Maybe Andrew overlooked or forgot about it? Maybe they were supposed to work with IsInTool? Did you write to Andrew? PS. You can write a function that takes IDs and translates them into commands, but it doesn't make much sense when you can use commands directly. void main(){ setCurrentTool("VOX_SCULPT_TOOL::SCULP_FILL"); } void setCurrentTool(string id){ //Using array, because dictionary doesn't seem to work. array<array<string>> dict = { {"VOX_SCULPT_TOOL::SCULP_GROW", "$[Page4]Grow"}, {"VOX_SCULPT_TOOL::SCULPT_SMOOTH","$[Page4]Smooth"}, {"VOX_SCULPT_TOOL::SCULP_FILL","$[Page4]Fill"} // (...) }; for(int i=0;i<dict.length();i++){ if(dict[i][0]==id){ cmd(dict[i][1]); break; } } } Edited February 9, 2015 by ajz3d Quote Link to comment Share on other sites More sharing options...
Member coverman Posted February 10, 2015 Author Member Report Share Posted February 10, 2015 Thanks to your reply and script ajz3d. I also agree with your opinion. The values returned by GetCurrentToolID() is very accurate but cannot be used anywhere. The ID is clearly translated like this. "VOX_SCULPT_TOOL::SCULP_GROW" to "$[Page4]Grow" So if we want to get ID and change Tool with a script, we need retranslation like your script. I was just surprised.Really!? I just have a surprise, but I'm not troubled at all. So I do not send any mail to Andrew. I prefer this type string ID "VOX_SCULPT_TOOL::SCULP_GROW" It's long, but it looks like common format in 3D-Coat and accurate. Quote Link to comment Share on other sites More sharing options...
Advanced Member Spiraloid Posted August 29, 2016 Advanced Member Report Share Posted August 29, 2016 (edited) thanks for this you guys. I made myself an increase and decrease density script and bound it to a hotkey, it kept selecting the transform tool and I used your script to reselect the current tool. giving as I get: // this script degrades the current layer by 2 and keeps the active tool. // used for a quick "degrade" current vox layer hotkey. void setCurrentTool(string id){ array<array<string>> dict = { {"VOX_SCULPT_TOOL::SCULP_GROW", "$[Page4]Grow"}, {"VOX_SCULPT_TOOL::SCULPT_SMOOTH","$[Page4]Smooth"}, {"VOX_SCULPT_TOOL::SCULP_FILL","$[Page4]Fill"} // (...) }; for(int i=0;i<dict.length();i++){ if(dict[i][0]==id){ cmd(dict[i][1]); break; } } } void main(){ // make sure we're in the sculpting room if(!IsInRoom("Sculpt")){ ToRoom("Sculpt"); Step(1); } //store current layer name string CurrentVoxLayer = GetCurVolume(); // rename it RenameCurVolume("DELETE_ME"); // store the current tool string CurrentToolID = GetCurrentToolID(); // clone and degrade the current layer by 2 cmd("$VoxTreeBtn7"); // name it the same. RenameCurVolume(CurrentVoxLayer); // delete the old layer. SetCurVolume("DELETE_ME"); cmd("$VoxTreeBtn1"); //select the new layer just in case SetCurVolume(CurrentVoxLayer); Step(1); // recall the tool so you're not in transform mode. setCurrentTool(CurrentToolID); } Edited August 29, 2016 by Spiraloid 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.