Notifications
Clear all

[Closed] Cant make a slider

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

10 Replies

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
) 

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.

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
)   

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  

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.

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

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
 )
)  

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

Thank you viro, got it all working nicely now with your help

Page 1 / 2