Notifications
Clear all

[Closed] spinner/slider maxscript problem

so i’m a newbie in maxscript and i want to make custom attributes for rigging
but i have a little problem
when i make a spinner/slider, it makes excellent spinner/slider UI like it should be
but when i click another object then i come back to the object that have the spinner/slider custom attributes
the value change to zero

i want to keep the value when i click another object but i dont know what to do
heres an images to explain better since english aint my main language

and heres my code


test = attributes custom_Attributes
(
rollout unnamedRollout "Untitled" width:162 height:300
(
    spinner 'spn1' "" pos:[38,16] width:74 height:16 type:#worldunits align:#left
    slider 'sld1' "Slider" pos:[1,41] width:167 height:44 type:#float align:#left
    on spn1 changed val do
    (
        sld1.value = val
        )
    on sld1 changed val do
    (
        spn1.value = val
        )
)
)

custAttributes.add $.modifiers [1] test

3 Replies

you have to use the same instance of the empty modifier (attribute holder) or the same attribute for both objects. in your case they are unique and have their own unique set of parameters

thanks for the reply denisT

but when i try to make instance attribute holder, when i switch the object the slider value reset to zero in display.
heres another example

is there a problem with my max?

There are no parameters in your code . check out the Scripted Plug-in Clauses in maxscript refrence for parameters block
If you don’t use parameter , for Pick button it doesn’t remember the picked object and listbox doesn’t store any array and …

Here what denis told you


Yourobject = $ ---
def= attributes LegCtrl
(
      parameters params rollout:unnamedRollout
        (
         theObject type:#node ui:btn1 animatable:false
         XXX type:#float animatable:true default:0 ui:spn1
         YYY type:#float animatable:true default:0 ui:sld1
        )   
        
      rollout unnamedRollout "Untitled" width:162 height:300
      (
         spinner 'spn1' "" pos:[38,16] width:74 height:16 type:#worldunits align:#left
         slider 'sld1' "Slider" pos:[1,41] width:167 height:44 type:#float align:#left
         pickbutton btn1 "Pick your object" autoDisplay:on
            
         on spn1 changed val do      ( sld1.value = val   )
         on sld1 changed val do      ( spn1.value = val   )
      )
)
atriholder=(EmptyModifier())
addModifier Yourobject atriholder
custAttributes.add atriholder def

and if you have to use your code here

   
test = attributes custom_Attributes
(
      parameters params rollout:unnamedRollout
        (
         XXX type:#float animatable:true default:0 ui:spn1
         YYY type:#float animatable:true default:0 ui:sld1
        )      
   
   
rollout unnamedRollout "Untitled" width:162 height:300
(
    spinner 'spn1' "" pos:[38,16] width:74 height:16 type:#worldunits align:#left
    slider 'sld1' "Slider" pos:[1,41] width:167 height:44 type:#float align:#left
    on spn1 changed val do    ( sld1.value = val   )
    on sld1 changed val do    ( spn1.value = val   )
)
)
custAttributes.add $.modifiers [1] test

and check out paul neal tutorials about rigging on youtube and Managing Multiple Custom Attributes for further info
https://www.youtube.com/watch?v=GGfxeymS85w