Maya Python: cmds.button( ) with UI passing variables and calling a function?

后端 未结 4 834
难免孤独
难免孤独 2020-12-28 11:04

First of all, this seems to be a great place to learn more about programming. I\'ve written a maya python script, where both functions work, I\'m having trouble getting the

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-28 11:59

    cmds.button(label="Apply", command=superExtrude(extrScaleVal, extrDistVal))
    

    This line calls superExtrude and assigns its return value to command. Since superExtrude doesn't return anything, the button effectively has a commnand of None.

    Perhaps you meant to have superExtrude get called when the button is clicked, in which case you ought to wrap it in a lambda to prevent it from being called immediately:

    cmds.button(label="Apply", command=lambda *args: superExtrude(extrScaleVal, extrDistVal))
    

提交回复
热议问题