Home Website Youtube GitHub

Anim Picker - Code auto executed at startup

My issue is as follows. If you set a custom script to be run when you click a picker button, the code gets executed once when the Anim Picker window is first shown.

So if for example I set this custom script:

‘’’
import maya.cmds as cmds
cmds.sphere()
‘’’

when I first open the Anim Picker GUI a sphere is created. This means that i f I have 7 buttons with the above code, 7 spheres are created. I don’t know if this is something just happening to me or what.

Cheers

There is an __INIT__ global var to know when is the anim_picker initialized. :wink:

image

it is needed to change the button text and update data the first time is load.
For example here:

Note also the var __SELF__

2 Likes

Nice, is this documented? just to know where I can find more info. Already working as expected introducing

if not __INIT__:

at the start of the code block

Thanks Miquel for the quick response. Keep it up!

Dadle duro y gracias de nuevo.

Carlos Rico Adega

I am working on a tool to create Pickers from degree 1 curves,so we can use Maya tools to draw our widgets. I attach a screenshot. For now you can set the widget color, text, text size, text color, associated controls and associated script. I think via curves we can design more intricate pickers. Cheers.

5 Likes

Sorry, I think is not documented. At less yet :stuck_out_tongue:

Your curve to widget idea looks really cool!!! :smiley:

1 Like