PDA

View Full Version : Alter RMB context menus?


nevermetagerman
04-09-2008, 05:06 PM
I would like to add some tools to my RMB and arrange a few things, i wanna add like freeze transformations, center pivot, lots of little things, anyone know if this is possible/ if this is very difficult? would love to make my own rmb stuff.

StephenBlair
04-09-2008, 07:40 PM
If you don't mind doing a little scripting it is not too hard.
I used the SDK Command Wizard to generate the code. The Command Wizard allows you to put a custom command on a menu, I just deleted the custom command part after.

Here's an example plugin that adds Freeze All Transforms to the context menu for 3D objects.

Line 10: The menu anchor siMenu3DViewObjectEditContextID (http://http://softimage.wiki.avid.com/sdkdocs/siMenuAnchorPoints.htm) specifies where to put the menu on the RMB context menu.

Line 28: Add a menu item named "Freeze All Transforms" to the RMB context menu for objects in a 3D view.
The menu item invokes the command "ResetTransforms", just like Transform > Freeze All Transforms in the MCP.

1 function XSILoadPlugin( in_reg )
2 {
3 in_reg.Author = "sblair";
4 in_reg.Name = "RMB_CommandPlugin";
5 in_reg.Email = "";
6 in_reg.URL = "";
7 in_reg.Major = 1;
8 in_reg.Minor = 0;
9
10 in_reg.RegisterMenu(siMenu3DViewObjectEditContextI D,"RMB_Command_Menu",false,false);
11 //RegistrationInsertionPoint - do not remove this line
12
13 return true;
14 }
15
16 function XSIUnloadPlugin( in_reg )
17 {
18 var strPluginName;
19 strPluginName = in_reg.Name;
20 Application.LogMessage(strPluginName + " has been unloaded.",siVerbose);
21 return true;
22 }
23
24 function RMB_Command_Menu_Init( in_ctxt )
25 {
26 var oMenu;
27 oMenu = in_ctxt.Source;
28 oMenu.AddCommandItem("Freeze All Transforms","Freeze All Transforms" );
29 return true;
30 }

mantom
04-10-2008, 05:07 PM
Stephen,
You might want to revise your post, ResetTransforms is not the same as Freeze Transforms.


Matt

StephenBlair
04-10-2008, 05:37 PM
I did rush the post out, but I think I got it right...

In the MCP, Transform > Freeze All Transforms logs

ResetTransform(null, siCtr, siSRT, siXYZ);

and Transform > Reset All Transforms logs

ResetTransform(null, siObj, siSRT, siXYZ);

Update: Matt you are right, this is a tricky one, both resolve to the same scripting command so my example is too simplistic. I should use a custom command or callback item to make the right call to ResetTransform.