def create_handle(name): maya_helpers.load_plugin('zRigHandle') handle = pm.createNode('zRigHandle') handle = pm.rename(handle, name + 'Shape') parent = pm.listRelatives(handle, p=True, pa=True) parent = pm.rename(parent, name) return parent.getShape()
def get_singleton(create=True): """ Return the singleton node. If create is true, create it if it doesn't exist, otherwise return None. """ # If the plugin isn't loaded, then the node doesn't exist. If we're not creating it, # don't load it. if not create and not pm.pluginInfo('zKeyframeNaming', q=True, loaded=True): return None maya_helpers.load_plugin('zKeyframeNaming') nodes = pm.ls(':zKeyframeNaming', type='zKeyframeNaming') if not nodes: if not create: return None return pm.createNode('zKeyframeNaming', name=':zKeyframeNaming') assert len(nodes) == 1 return nodes[0]
def _create_cvwrap(control_object, target): """ Create a wrap deformer with cvwrap, if available. If the cvwrap plugin isn't available, return None. """ if not maya_helpers.load_plugin('cvwrap.mll', required=False): return None old_selection = pm.ls(sl=True) pm.select(target) pm.select(control_object, add=True) deformer_node = cmds.cvWrap() # Restore the old selection. pm.select(old_selection) return pm.PyNode(deformer_node)
def create(cls): maya_helpers.load_plugin('zCreateCurve') node = pm.createNode('zCreateCurve', skipSelect=True) return cls(node)