Self-installing menus 2004-07-19 - By Hardt, Michael
Back Self-Installers,
I LOVE creating scripted, self-installing, spdl-free, custom properties and sticking them under the Get, Property menu on the left toolbar.
However, I want to be able to drop any number of new property scripts into the plugins folder, and have them automatically show up under my own menu item.
I'm having a hard time with this. I can create all my custom properties from a single script, and put them all under the same menu item. Like this:
'''''''''''''''''''''Save as PropCAndD.vbs ''''''''''''''''''''''''''''''''''''''''
'Drop into a ...\Softimage\XSI_4.0\Application\Plugins folder to install. 'Go under Get, Property, PropCAndD_Menu to apply / inspect.
function XSILoadPlugin( in_reg ) in_reg.Name = "PropCAndD SDK Example" in_reg.RegisterProperty "PropC" in_reg.RegisterProperty "PropD" in_reg.RegisterMenu siMenuTbGetPropertyPSetID, "PropCAndD_Menu", true, false XSILoadPlugin = true end function
function PropC_Define( io_Context ) io_Context.Source.AddParameter3 "MyCParam", siInt4, 1, 0, 20 end function
function PropD_Define( io_Context ) io_Context.Source.AddParameter3 "MyDParam", siDouble, 0, 0, 1 end function
function PropCAndD_Menu_Init( io_Context ) io_Context.Source.AddCallbackItem "PropCMenuItem", "OnPropCMenuClicked" io_Context.Source.AddCallbackItem "PropDMenuItem", "OnPropDMenuClicked" end function function PropC_DefineLayout( io_Context ) io_Context.Source.Clear io_Context.Source.AddItem "MyCParam", "My C Parameter" end function
function PropD_DefineLayout( io_Context ) io_Context.Source.Clear io_Context.Source.AddItem "MyDParam", "My D Parameter" end function
function OnPropCMenuClicked( io_Context ) Set oNewProp = Application.ActiveSceneRoot.AddProperty("PropC") InspectObj oNewProp, , "PropC", siRecycle end function
function OnPropDMenuClicked( io_Context ) Set oNewProp = Application.ActiveSceneRoot.AddProperty("PropD") InspectObj oNewProp, , "PropD", siRecycle end function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''
Or I can create them all from separate files and have them all show up separately under Get, Property. Like this:
'''''''''''''''''''''Save as PropA.vbs ''''''''''''''''''''''''''''''''''''''''''''
'Drop into a ...\Softimage\XSI_4.0\Application\Plugins folder to install. 'Go under Get, Property, PropAMenuItem to apply / inspect. 'Creates and inspects a PropA custom property under the scene root.
function XSILoadPlugin( in_reg ) in_reg.Name = "PropA SDK Example" in_reg.RegisterProperty "PropA" in_reg.RegisterMenu siMenuTbGetPropertyPSetID, "PropA_Menu", false, false XSILoadPlugin = true end function
function PropA_Define( io_Context ) io_Context.Source.AddParameter3 "MyAParam", siInt4, 1, 0, 20 end function
function PropA_DefineLayout( io_Context ) io_Context.Source.Clear io_Context.Source.AddItem "MyAParam", "My A Parameter" end function
function PropA_Menu_Init( io_Context ) io_Context.Source.AddCallbackItem "PropAMenuItem", "OnPropAMenuClicked" end function
function OnPropAMenuClicked( io_Context ) Set oNewProp = Application.ActiveSceneRoot.AddProperty("PropA") InspectObj oNewProp, , "PropA", siRecycle end function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''
'''''''''''''''''''''Save as PropB.vbs ''''''''''''''''''''''''''''''''''''''''''''
'Drop into a ...\Softimage\XSI_4.0\Application\Plugins folder to install. 'Go under Get, Property, PropBMenuItem to apply / inspect. 'Creates and inspects a PropB custom property under the scene root.
function XSILoadPlugin( in_reg ) in_reg.Name = "PropB SDK Example" in_reg.RegisterProperty "PropB" in_reg.RegisterMenu siMenuTbGetPropertyPSetID, "PropB_Menu", false, false XSILoadPlugin = true end function
function PropB_Define( io_Context ) io_Context.Source.AddParameter3 "MyBParam", siDouble, 0, 0, 1 end function
function PropB_DefineLayout( io_Context ) io_Context.Source.Clear io_Context.Source.AddItem "MyBParam", "My B Parameter" end function
function PropB_Menu_Init( io_Context ) io_Context.Source.AddCallbackItem "PropBMenuItem", "OnPropBMenuClicked" end function
function OnPropBMenuClicked( io_Context ) Set oNewProp = Application.ActiveSceneRoot.AddProperty("PropB") InspectObj oNewProp, , "PropB", siRecycle end function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''
But I can't create them from separate files and have them show up under my own menu item. Can anybody point me in the right direction?
I'm following the example here: ...\Softimage\XSI_4.0\XSISDK\examples\properties\SimpleProperty\VBScript \SimpleProperty.vbs.
Michael Hardt EA Chicago
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|