PDA

View Full Version : Cant make a slider


cgillblack
01-05-2011, 01:35 AM
i just want to make a slider that isnt in a rollout called "custom attributes" but i cant find the code anywhere, i have managed to pull something together that looks right but doesnt work.


rollout slidertest "slidertest2"
(
slider sliderthing "sliderythingy" type:#float range:[0,1,0] scale:.01 width:150 ticks:10
)



thats what i got, i can see it in the attribute holder and it slides but the only problem is it doesn't seem to exist according to reaction manager or wire parameters so i cant do anything with it.

not even the rollout appears so it could be something wrong with that

thanks

viro
01-05-2011, 07:27 PM
Is this what your trying to do?
(
global slidertestFLOAT
try (cui.unregisterDialogBar slidertestFLOAT) catch() -- If already registered, then unregister.

try (closeRolloutFloater slidertestFLOAT) catch() -- If already open, then close.
rollout slidertest "slidertest2"
(
slider sliderthing "sliderythingy" type:#float range:[0,1,0] scale:.01 width:150 ticks:10
)
)
--createdialog
slidertestFLOAT = NewRolloutFloater "SliderFloater" 200 200
addRollout slidertest slidertestFLOAT rolledup:false --put the rollout in the floater
cui.registerDialogBar slidertestFLOAT style:#(#cui_floatable, #cui_handles, #cui_dock_all) --registar the floater as dockable
)

cgillblack
01-06-2011, 12:01 AM
erm well i get an error when i run that bit of code but basically i just want a slider that i can choose the text at the top of the roll out thing and that i can use with reaction manager.

i only just started this scripting thing so i dont know much XD i just scavenge code off tutorials.

viro
01-06-2011, 03:56 PM
oops, sorry looks like I had an extra bracket. Here somthing less comlicated.
(
rollout slidertest "slidertest2"
(
slider sliderthing "sliderythingy" type:#float range:[0,1,0] scale:.01 width:150 ticks:10
)
--createdialog
sliderFloater = newRolloutFloater "Slider Thing" 200 200
addRollout slidertest sliderFloater
)

viro
01-06-2011, 04:00 PM
And if you want to add a slider to the attribute holder.

ca = attributes AttributeHolder
(
parameters main rollout:slidertest
(
sliderthing type:#float UI:sliderthing default:0.0
)
rollout slidertest "slidertest2"
(
slider sliderthing "sliderythingy" type:#float range:[0,1,0] scale:.01 width:150 ticks:10
)
)
custAttributes.add $.modifiers[1] ca #unique --add to custom attribute holder

viro
01-06-2011, 04:04 PM
Have you tried the Parameter Editor under Animation>Parameter Editor? It sounds like this would be the easiest way for you to create a slider and change the name of it.

cgillblack
01-06-2011, 07:31 PM
Thanks people il try those suggestions a bit later.

using parameter editor would be fine but i just dont want it to say "custom attributes" in the rollout dropdown thing, and i cant find a way of changing that.. only changing the text by the slider itself, its a small thing that i can put up with if i have to but just one of those little things that would annoy me lol.

thanks

viro
01-06-2011, 07:50 PM
Then this is waht you need:

ca = attributes AttributeHolder
(
parameters main rollout:slidertest
(
sliderthing type:#float UI:sliderthing default:0.0
)
rollout slidertest "slidertest2" --the area inbetween the "" will change the name of the rollout
(
slider sliderthing "sliderythingy" type:#float range:[0,1,0] scale:.01 width:150 ticks:10
)
)
custAttributes.add $.modifiers[1] ca #unique
--[1] this represnets the level of attribute holder in the modifier stacks
-- so if its the third in the stack it will be [3]

So just open this in the maxcript editer, select the object you want to apply this to and run evauate all from the script editor and you should have a slider in your attrubutes holder and it will say slider test instead of custom attributes.
Then to edit it and change it you will need to redifne it. This sciprt can be used to redifne it.
ca = custAttributes.getDef $.modifiers[1].AttributeHolder
attributes AttributeHolder
redefine:ca
(
parameters main rollout:slidertest
(
sliderthing type:#float UI:sliderthing default:0.0
)
rollout slidertest "slidertest2"
(
slider sliderthing "sliderythingy" type:#float range:[0,1,0] scale:.01 width:150 ticks:10
)
)

viro
01-06-2011, 07:59 PM
This is a really good tool I use all the time to edit custom attributes among many other things. http://www.penproductions.ca/scripts/riggingUtils/index.htm

cgillblack
01-08-2011, 03:26 PM
Thank you viro, got it all working nicely now with your help :)

viro
01-09-2011, 11:36 PM
No problem, I was going through the same thing about a year and half ago. Glad I could help.

CGTalk Moderation
01-09-2011, 11:36 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.