PDA

View Full Version : adding and deleting rollouts in a scripted simpleobject plugin


marktsang
10-06-2005, 11:44 PM
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

RyanT
10-10-2005, 07:31 PM
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

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

marktsang
10-10-2005, 09:55 PM
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

marktsang
10-10-2005, 10:16 PM
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

RyanT
10-11-2005, 02:50 AM
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
)
)
)

marktsang
10-11-2005, 03:10 AM
thanks for having a look ryan,
i will give it a go and see if its suitable

cheers,
mark

marktsang
10-14-2005, 06:05 PM
thanks ryan,
that works good enough for me,

cheers

mark

CGTalk Moderation
10-14-2005, 06:05 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.