Notifications
Clear all

[Closed] Newbie Questions – Where do I look?

Okay, I knew I had it tucked away some where…

This will create a box object, add a empty modifier, add a “custom attribute” and rollout to the empty modifier, wire it all together and finally select the object so you can see the handy work…


  (
 [i]   -- Create a box object[/i]
    local oBox = box()
  	
 [i]   -- Create a new empty modifier for the custom attributes to reside in...[/i]
    local modMyAttributes = EmptyModifier name:"[b]My Attributes[/b]"
  
 [i]   -- Add the new modifier to the box[/i]
    addModifier oBox modMyAttributes
  
 [i]   -- Construct the custom attributes
    -- Look up scripted custom attributes, or get Pen's awesome rigging DVD set for
    -- more details
 [/i]   local aMine = attributes [b]MyCustomAttributes[/b] (
  	parameters main rollout:MyRollout (
 [i] 	  -- This is the actual value we work with...it is what will appear in the
  	  -- track view and parameter wiring dialog
 [/i] 	  [b]fValue[/b] type:#float [b]ui:spnValue[/b] default:0
 [i] 	  -- Note that the ui parameter is pointing to the spinner below
 [/i] 	)
  	
 [i] 	-- This is what the user will see...    [/i]
  	rollout MyRollout "My Controls" (
 	 [i]-- Changes to the spinner will be reflected in the [b]fValue[/b] above[/i]
  	  spinner [b]spnValue[/b] "X Position: " type:#float range:[-10000, 10000, 0]
  	)
    )
  	
 [i]   -- Add the custom attribute to the box
    -- Note the way we reference the modifier!
 [/i]   custAttributes.add oBox.[b]My_Attributes[/b] aMine
  	
 [i]   -- Wire it all together
 [/i]   paramWire.connect oBox.modifiers[#[b]My_Attributes[/b]].[b]MyCustomAttributes[/b][#[b]fValue[/b]] oBox.pos.controller[#X_Position] "fValue"
  
 [i]   -- Switch the command panel over to the modify tab...
 [/i]   setCommandPanelTaskMode mode:#modify
  	
 [i]   -- Select the box so you can marvel...
 [/i]   select oBox
  )

I’ve tried to highlight portions of the code that are important (hay, it’s all important), but because we tend not to reference the a variable in the scene you might be use to, it can quickly become confusing.

Now have LOTs of fun!!

Shane

Page 3 / 3