I would like some opinions on the way I am using instance variables in my
class as I am not so sure if I am doing it right.. To be honest, this is my
first time using parameters in my class __init__..
class HierarchyDialog(QtGui.QDialog):
def __init__(self, state, parent=None):
QtGui.QDialog.__init__(self, parent)
self.setWindowTitle('Hierarchy Dialog')
self.setModal(False)
self.state = state
if self.state == "root_sels":
# Run function_A()
elif self.state == "user_sels":
# Run function_B()
else:
cmds.warning("Please check your selections. Either select some
nodes or a root node")
...
...
def run_dialog():
state = ""
selection = cmds.ls(selection=True)
if not selection:
cmds.warning("Please select a Stack or some nodes")
return
if len(selection) == 1 and cmds.nodeType(selection) == 'nurbsSurface':
state = "root_sels"
elif len(selection) >= 1:
for items in selection:
if not cmds.nodeType(selection) == 'nurbsSurface' in items:
state = "user_sels"
dialog = HierarchyDialog(state)
dialog.show()
return dialog
In my `run_dialog`, I am checking for selections in the scene.
There are only 2 types of selections - Selecting a nurbs surface node -
suppose that is the top node of the hierarchy, or any of its children
(suppose they are all meshs) within that nurbs suface node
Is checking against a string as defined in my `__init__` function the right
way to do so?
--
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/afdd4e64-f331-467a-b46d-c5f46b0a9a66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.