Message 1 of 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am rewriting the mel command on this site to a python command for learning python.(maya2019)
https://www.patrickgambleanimation.com/post/show-hide-nurbs-curves-in-maya-hotkey
code[mel]:
string $activePanel = `getPanel -wf`;
if (`modelEditor -q -nurbsCurves $activePanel` == 1) {
modelEditor -e -nurbsCurves 0 $activePanel;
} else {
modelEditor -e -nurbsCurves 1 $activePanel;
}my code[python]
import maya.cmds as cmds
activePanel = cmds.getPanel(withFocus=True)
if cmds.modelEditor(query=True, nurbsCurves=True, activePanel=True):
cmds.modelEditor(edit=True, nurbsCurves=False, activePanel)
else:
cmds.modelEditor(edit=True, nurbsCurves=True, activePanel)If I search for Technical Document in the linked command, I can find
- getPanel<undoable, NOT queryable, NOT editable.>(-wf= withFocus boolean)
- modelEditor<undoable, queryable, and editable.>[-nc= nurbsCurves boolean]
I can not find string $activePanel so this could be a variable.
I am a beginner in programming. learning on Zurbrick's site.
http://zurbrigg.com/tutorials/beginning-python-for-maya/2-1-maya-commands
It's not finished yet. Please give me various advice.
Solved! Go to Solution.