New NURBS tools
- clintonman
- Captain
- Posts: 5422
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
- Contact:
Re: New NURBS tools
Fixed one line that had "System.Alert" to just "Alert"
Added the Control aspect back in.
Formatted the code so it is readable.
Added the Control aspect back in.
Formatted the code so it is readable.
- Attachments
-
- Guard.RsObj
- (19.82 KiB) Downloaded 122 times
Re: New NURBS tools
Any suggestions?clintonman wrote: ↑10 Aug 2021, 23:35 Probably not a good place for it. This works with cameras and lights, it's not exclusive to NURBS. Which is also the reason Guard isn't inside the NURBS group.
Even though it protects Cameras & Lights, the majority protects NURBS
I thought it was the best choice since it is more front and center and because the Protect NURBS' Set button is in the NURBS Utilities
Set button script can also call the Guard panel
Code: Select all
if(!Node.Exists("Scripts/CustomCommands/Guard")) return;
if(Node.Value("%THIS_NAME%", "ProtectNURBS"))
Node.Value("Scripts/CustomCommands/Guard", "Active") = true;
else
Node.Value("Scripts/CustomCommands/Guard", "Active") = false;
if(Node.Value("Scripts/CustomCommands/Guard", "Active") == false) {
Warning("\nProtect NURBS is not Active!\n\nDisabling Protect NURBS is not recommended!")
UserInterface.OpenToolPanelViewEx2('', '','Scripts/CustomCommands/Guard',3,1,0);
}
function Warning(strText)
{
var nSecondsToWait = -1;
var strTitle = "Warning";
// values are hexadecimal
var MB_OK = 0;
var MB_SYSTEMMODAL = 4096;//1000L force on top
var MB_ICONEXCLAMATION = 48;//30L
var nType = MB_OK + MB_SYSTEMMODAL + MB_ICONEXCLAMATION;
var shell = new ActiveXObject("WScript.shell");
shell.Popup (strText, nSecondsToWait, strTitle, nType);
}
- clintonman
- Captain
- Posts: 5422
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
- Contact:
Re: New NURBS tools
Desktop would be a better place for it. Once there it can be removed from the NURBS panel.
Re: New NURBS tools
Cool, thanks!clintonman wrote: ↑10 Aug 2021, 23:38 Fixed one line that had "System.Alert" to just "Alert"
Added the Control aspect back in.
Formatted the code so it is readable.
Are you able to identify which tool is being used and display it in the Alerts?
Or break in down into individual Alerts with each tool?
- clintonman
- Captain
- Posts: 5422
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
- Contact:
Re: New NURBS tools
Nope, I wish. There is a command "params.GetControlIn();" which is supposed to tell you what called the script but it doesn't work.trueBlue wrote: ↑11 Aug 2021, 03:49Cool, thanks!clintonman wrote: ↑10 Aug 2021, 23:38 Fixed one line that had "System.Alert" to just "Alert"
Added the Control aspect back in.
Formatted the code so it is readable.
Are you able to identify which tool is being used and display it in the Alerts?
Or break in down into individual Alerts with each tool?
Re: New NURBS tools
Are you sure?clintonman wrote: ↑11 Aug 2021, 03:56Nope, I wish. There is a command "params.GetControlIn();" which is supposed to tell you what called the script but it doesn't work.trueBlue wrote: ↑11 Aug 2021, 03:49Cool, thanks!clintonman wrote: ↑10 Aug 2021, 23:38 Fixed one line that had "System.Alert" to just "Alert"
Added the Control aspect back in.
Formatted the code so it is readable.
Are you able to identify which tool is being used and display it in the Alerts?
Or break in down into individual Alerts with each tool?
What do theses names mean or how are they being used to generate an Alert?
Code: Select all
var reHair = /Hair/;
var rePrim = /AddPrimitive/;
var rePaintFace = /PaintFace/;
var reCPMesh = /AddMorph|DisplacementMapping|OptimizeTriangulation|PE soft paint/
- clintonman
- Captain
- Posts: 5422
- Joined: 21 May 2009, 21:08
- Type the number ten into the box: 0
- Location: California
- Contact:
Re: New NURBS tools
I misunderstood. I was trying to get GetControlIn to work when I read your message, so that was on my mind and I forgot that Guard has commands passed into it.trueBlue wrote: ↑11 Aug 2021, 04:11Are you sure?clintonman wrote: ↑11 Aug 2021, 03:56Nope, I wish. There is a command "params.GetControlIn();" which is supposed to tell you what called the script but it doesn't work.
What do theses names mean or how are they being used to generate an Alert?It seems to me, that you might be able to create individual functions for each tool with their own Alert's.Code: Select all
var reHair = /Hair/; var rePrim = /AddPrimitive/; var rePaintFace = /PaintFace/; var reCPMesh = /AddMorph|DisplacementMapping|OptimizeTriangulation|PE soft paint/
I see three possibilities. The button "Name" or "HelpText" or some manually typed in text can be sent into the Guard and used to make decisions.
this
Code: Select all
RsApp.SendCustomEvent("Scripts/CustomCommands/Guard", {Cmd:"MeshModifiers.ActivateBooleansTool('Intersection','')"});
Activity.Run("Scripts/CustomCommands/Guard");
Code: Select all
RsApp.SendCustomEvent("Scripts/CustomCommands/Guard", {HelpText: "Boolean intersection", Name: "Intersection", Cmd:"MeshModifiers.ActivateBooleansTool('Intersection','')"});
Activity.Run("Scripts/CustomCommands/Guard");
Code: Select all
var Cmd = "";
if(eventData.Cmd)
Cmd = eventData.Cmd;
params.Global("Cmd") = Cmd;
Code: Select all
var Cmd = params.Global("Cmd");
It seems like a lot of work for such a small change.
Re: New NURBS tools
That was going to be my last question if you said, "Nope"clintonman wrote: ↑11 Aug 2021, 04:46I misunderstood. I was trying to get GetControlIn to work when I read your message, so that was on my mind and I forgot that Guard has commands passed into it.trueBlue wrote: ↑11 Aug 2021, 04:11Are you sure?clintonman wrote: ↑11 Aug 2021, 03:56
Nope, I wish. There is a command "params.GetControlIn();" which is supposed to tell you what called the script but it doesn't work.
What do theses names mean or how are they being used to generate an Alert?It seems to me, that you might be able to create individual functions for each tool with their own Alert's.Code: Select all
var reHair = /Hair/; var rePrim = /AddPrimitive/; var rePaintFace = /PaintFace/; var reCPMesh = /AddMorph|DisplacementMapping|OptimizeTriangulation|PE soft paint/
I see three possibilities. The button "Name" or "HelpText" or some manually typed in text can be sent into the Guard and used to make decisions.
thiswould change to something like thisCode: Select all
RsApp.SendCustomEvent("Scripts/CustomCommands/Guard", {Cmd:"MeshModifiers.ActivateBooleansTool('Intersection','')"}); Activity.Run("Scripts/CustomCommands/Guard");
Then inside Guard OnCustomEvent function this add more code with var Name="", Name=eventData.Name...Code: Select all
RsApp.SendCustomEvent("Scripts/CustomCommands/Guard", {HelpText: "Boolean intersection", Name: "Intersection", Cmd:"MeshModifiers.ActivateBooleansTool('Intersection','')"}); Activity.Run("Scripts/CustomCommands/Guard");
Then inside Execute add like Cmd only use Name instead... var Name = params.Global("Name")Code: Select all
var Cmd = ""; if(eventData.Cmd) Cmd = eventData.Cmd; params.Global("Cmd") = Cmd;
So long story short you add the new data to the button command, save the data in the OnCustomEvent, and finally read and use the data inside Execute.Code: Select all
var Cmd = params.Global("Cmd");
It seems like a lot of work for such a small change.
Was thinking there could be some kind of individual Flag in each of the toolbar commands that would give you an indication from where it was being ran
Also figured it would be a LOT of work!
I seen some toolbar commands like '%TOOLBAR_CMD%' or something like that
I will see if I can find it again
They were used in a Physics toolbar
I think Anton was the author