PDA

View Full Version : radiobuttons change following rooloutsettigns?


CapitanRed
07-22-2007, 12:33 PM
how can I affect my rollout with radiobuttons?
f.e. if i want to have three states:

rollout create "create Objects"
(
group "what shape do you want to create?"
(
radiobuttons rbShape labels:#("box","sphere","cylinder")

--now here i would like to have a new group with some settings for the specific object.
--but this settings should change when the user selects a different radiobutton.
)
)



creator = newRolloutFloater "ObjectCreator" 218 400
addRollout create creator


I hope you guys understand and can help me :)

mir-vadim
07-22-2007, 07:56 PM
Try this. It must works.

rollout create "create Objects"
(
group "what shape do you want to create?"
(
radiobuttons rbShape labels:#("box","sphere","cylinder")
spinner SphereRadiusSpinner "SphereRadius" visible:FALSE
spinner CylinderRadiusSpinner "CylinderRadius" visible:FALSE
spinner BoxHeightSpinner "BoxHeight" visible:True
)
on rbShape changed state do (
If rbShape.state == 1 then (

SphereRadiusSpinner.visible = false
CylinderRadiusSpinner.visible = false
BoxHeightSpinner.visible = true )

If rbShape.state == 2 then (

SphereRadiusSpinner.visible = true
CylinderRadiusSpinner.visible = false
BoxHeightSpinner.visible = false )

If rbShape.state == 3 then (

SphereRadiusSpinner.visible = false
CylinderRadiusSpinner.visible = true
BoxHeightSpinner.visible = false )

)
)

creator = newRolloutFloater "ObjectCreator" 218 400
addRollout create creator

abyjoe
07-22-2007, 08:03 PM
that does work.. i have a similar issue but with checkboxes...

i want checkboxes that have the name of each scenematerial and then i want to be able to read the total checkboxes i.e materials selected so i can perform my action but dont know how to do it.... if i try to put the scenematerial variable for the checkbox values, it gives me an error.

Dave Black
07-22-2007, 09:40 PM
if i try to put the scenematerial variable for the checkbox values, it gives me an error.

The checkbox captions hold strings, not material values.

Try this:

material.name

-Dave

abyjoe
07-22-2007, 09:55 PM
thats exactly what i am doing... its a multisub material so the name of the sub-material "name" slot is different than the name of the actual sub-material

i am using the multimaterial.names[i] for the slot name and it works throughout the script i am using but not with checkboxes... works with radiobuttons...

CapitanRed
07-22-2007, 10:22 PM
hey vadim, thanx a lot. I allways tried to add a new rollout :p now i'm using the enabled property instead of .visible to avoid tool settings jumping.

CapitanRed
07-23-2007, 03:34 PM
funny, last time it didn't work, now it does for some reason :D


rollout create "create Objects"
(

group "what shape do you want to create?"

(

radiobuttons rbShape labels:#("box","sphere","cylinder")

)

on rbShape changed state do

(

if rbShape.state == 1 do

(

addRollout cBox creator

removeRollout cSphere creator

removeRollout cCylinder creator

)

if rbShape.state == 2 do

(

removeRollout cBox creator

addRollout cSphere creator

removeRollout cCylinder creator

)

if rbShape.state == 3 do

(

removeRollout cBox creator

removeRollout cSphere creator

addRollout cCylinder creator

)

)

)

rollout cBox "createBox"

(

spinner bLength "Length" range:[0,9999,10]
)
rollout cSphere "createSphere"

(

spinner sRadius "radius" range:[0,9999,10]

)

rollout cCylinder "createCylinder"

(

spinner cHeigth "height" range:[0,9999,10]

)



creator = newRolloutFloater "ObjectCreator" 218 400

addRollout create creator

addRollout cbox creator

mir-vadim
07-23-2007, 07:15 PM
If You want to use a lots of rollouts in one floater You must define them as global.
Otherwise maxscript will return error every time when You restart max.

global creator
global cBox
global cSphere
global cCylinder
global create

rollout create "create Objects"
(
group "what shape do you want to create?"
(
radiobuttons rbShape labels:#("box","sphere","cylinder")
)

on rbShape changed state do
(
if rbShape.state == 1 do
(
addRollout cBox creator
removeRollout cSphere creator
removeRollout cCylinder creator
)
if rbShape.state == 2 do
(
removeRollout cBox creator
addRollout cSphere creator
removeRollout cCylinder creator
)
if rbShape.state == 3 do
(
removeRollout cBox creator
removeRollout cSphere creator
addRollout cCylinder creator
)
)
)

rollout cBox "createBox"
(
spinner bLength "Length" range:[0,9999,10]
)

rollout cSphere "createSphere"
(
spinner sRadius "radius" range:[0,9999,10]

)

rollout cCylinder "createCylinder"
(
spinner cHeigth "height" range:[0,9999,10]
)

creator = newRolloutFloater "ObjectCreator" 218 400
addRollout create creator
addRollout cbox creator

CGTalk Moderation
07-23-2007, 07:15 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.