Notifications
Clear all

[Closed] adding and deleting rollouts in a scripted simpleobject plugin

hi,
what i am trying to do is add and remove an additional rollout in a simple object plugin depending on the status of a checkbuttion, not seeming to be having anyluck. cant redefine the plugin defintion becase i want it to affect on a per object basis… any ideas?

cheers.
mark

6 Replies

mark,

Just to make sure I understand right you want to add and remove rollouts? If thats it, which I am suspicious its not, you can do that with this syntax:

addsubrollout main_dialog_foo.rollout_to_add_to NewRolloutFoo

to remove
[size=1]
removeSubRollout main_dialog_foo.rollout_to_remove_from NewRolloutFoo

If that doesnt help do you have an example of what your trying to do?

-RyanT
[/size]

hi ryan,
yeah thanks for the reply,
the problem with subrollouts is that their height is not adjustable so you are stuck with what it is first defined as – i could use them but i would rather that i could somehow redefine the rollout in the plugin so that it updates completly…

i can post eample code if you want…

thanks,…
mark

hi,
here is a simple example

plugin simpleObject tower_plugin_def
  
  name:"Tower"
  
  classID:#(145345,543211)
  
  category:"Scripted Primitives"
  
  ( 
  
  parameters main rollout:params
  
  (
  
  newroll type:#boolean ui:newroll default:false
  
  height type:#worldUnits ui:height default:0
  
  width type:#worldUnits ui:width default:0
  
  depth type:#worldUnits ui:depth default:0
  
  )
  
  rollout params "Two Faces Parameters"
  
  (
  
  spinner height "Height" type:#worldunits range:[-1000,1000,0]
  
  spinner width "Width" type:#worldunits range:[-1000,1000,0]
  
  spinner depth "Depth" type:#worldunits range:[-1000,1000,0]
  
  checkbutton newroll "newroll"
  on newroll changed state do
  	(
  	if newroll.state == on then
  		(
  		newrollout = rollout setup "setup"
  			(
  			button blah "blah"
  			)
  			addrollout newrollout
  		)--end if
  	)--end on
  
  )--end rollout
  
  on buildMesh do
  
  (
  
  setMesh mesh \
  
  verts:#([0,0,0],[width,0,0],[width,depth,0],[0,depth,0]) \
  
  faces:#([3,2,1], [1,4,3])
  
  extrudeFace mesh #(1,2) (height * 0.5) 40 dir:#common
  
  extrudeFace mesh #(1,2) (height * 0.5) 50 dir:#common
  
  )
  
  tool create
  
  (
  
  on mousePoint click do
  
  case click of
  
  (
  
  1: nodeTM.translation = gridPoint
  
  3: #stop
  
  )
  
  on mouseMove click do
  
  case click of
  
  (
  
  2: (width = gridDist.x; depth = gridDist.y)
  
  3: height = gridDist.z
  
  )
  
  )
  
  )
  
  

when you press the newroll button i want a new rollout to be added to the plugin – here it adds it to the command panel… which is not what i want.

cheers,
mark

This is kind of a hack but how about trying it this way:

  
plugin simpleObject tower_plugin_def
  
name:"Tower"
classID:#(145345,543211)
category:"Scripted Primitives"
(
 parameters main rollout:params  
 (  
	newroll type:#boolean ui:newroll default:false
	height type:#worldUnits ui:height default:0   
	width type:#worldUnits ui:width default:0   
	depth type:#worldUnits ui:depth default:0 
 )  
 rollout params "Two Faces Parameters"  
   (
  local AddRollout = attributes newRoll 
  (
   Parameters main rollout:params
   (
   )
   Rollout Params "New Rollout"
   (
	button foo1 "Foo 1" pos:[5,5] width:80 height:20
	button foo2 "Foo 2" pos:[90,5] width:80 height:20
   )
  )
  
	spinner height "Height" type:#worldunits range:[-1000,1000,0]   
   spinner width "Width" type:#worldunits range:[-1000,1000,0]
	spinner depth "Depth" type:#worldunits range:[-1000,1000,0]
  
	checkbutton newroll "newroll"
   on newroll changed state do
   (
	 if newroll.state == on then
	 (
	  custAttributes.add this AddRollout
	 )--end if
   else
   (
	custAttributes.delete this AddRollout
   )
	)--end on
  
   )--end rollout
	
 on buildMesh do 
 (   
   setMesh mesh \	
   verts:#([0,0,0],[width,0,0],[width,depth,0],[0,depth,0]) \	
   faces:#([3,2,1], [1,4,3])	
   extrudeFace mesh #(1,2) (height * 0.5) 40 dir:#common 
   extrudeFace mesh #(1,2) (height * 0.5) 50 dir:#common
 )
	 
   tool create
 (
  on mousePoint click do
  case click of
  (
	 1: nodeTM.translation = gridPoint
	 3: #stop\
  )
  on mouseMove click do
  case click of
  (
	 2: (width = gridDist.x; depth = gridDist.y)
	 3: height = gridDist.z
  )
 )
)


thanks for having a look ryan,
i will give it a go and see if its suitable

cheers,
mark

thanks ryan,
that works good enough for me,

cheers

mark