On Sat, Oct 26, 2019, 9:10 AM kiteh <[email protected]> wrote:

> Hi Justin, the python command actually sets the optionVar in the tool
> itself.
>
> def toggle_mode():
>     state = cmds.optionVar(q = 'myToolState')
>
>     # In the method of these two, it will set the optionVar value again
>     # cmds.optionVar(intValue = ('myToolState', state))
>     if state == 1:
>         print "Enable myToolState"
>         myTool.utils.enableState()
>     else:
>         print "DISABLE myToolState"
>         myTool.utils.disableState()
>
> And in the `get_state`, it's meant to be that way. So in the code itself,
> if the state is 0, it means enable while if the state is 1, it means
> disable...
>

There is alot of wiring and calls between the Mel and the python logic. So
I am not really sure where your problem is in this limited scope. If they
are all reading from the optionVar and the toggle just tells the other one
to look up the current state, then I would expect it to work.

> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/a0eeea83-a598-4a10-b32b-4d706ca5d266%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/a0eeea83-a598-4a10-b32b-4d706ca5d266%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2gtKSor3yfwBtG66tA2_VKaQozUZ1E5oOpw5YKqb1N0w%40mail.gmail.com.

Reply via email to