def testUninitializedLayers(self): ''' if layers on mesh were uninitialized, just initialize layers as usual, and do not fail ''' LayerUtils.deleteCustomNodes() self.model.saveTo(self.targetMesh)
def cleanCustomNodes(self): ''' removes all custom nodes from current scene ''' LayerUtils.deleteCustomNodes() self.updateLayerAvailability()
def delete_ngSKinToolsNodes(): logger.info("Removing ngSkinsTools nodes --------------------------") try: # remove ngSkinTools custom nodes from ngSkinTools.layerUtils import LayerUtils LayerUtils.deleteCustomNodes() except: logger.info( "ngSkinsTools not installed / no ngSkinTools nodes in the scene")
def cleanCustomNodes(self): ''' removes all custom nodes from current scene ''' # just in case we were in the middle of painting cmds.setToolTo('selectSuperContext') LayerUtils.deleteCustomNodes() # notify the rest of the world self.updateLayerAvailability() selectionState.selectionInfo.dropCache()
def clean_up_file(): pass # import references refs = cmds.ls(type='reference') for i in refs: rFile = cmds.referenceQuery(i, f=True) cmds.file(rFile, importReference=True, mnr=True) defaults = ['UI', 'shared'] # Used as a sort key, this will sort namespaces by how many children they have. def num_children(ns): return ns.count(':') namespaces = [ns for ns in cmds.namespaceInfo(lon=True, r=True) if ns not in defaults] # We want to reverse the list, so that namespaces with more children are at the front of the list. namespaces.sort(key=num_children, reverse=True) for ns in namespaces: if namespaces.index(ns)+1 < len(namespaces): parent_ns = namespaces[namespaces.index(ns)+1] cmds.namespace(mv=[ns,parent_ns], f=True) cmds.namespace(rm=ns) else: cmds.namespace(mv=[ns,":"], f=True) cmds.namespace(rm=ns) # remove ngSkinTools custom nodes from ngSkinTools.layerUtils import LayerUtils LayerUtils.deleteCustomNodes() # remove RRM proxies if cmds.objExists("RRM_MAIN"): cmds.select("RRM_MAIN",hi=True) proxies = cmds.ls(sl=True) cmds.lockNode(proxies,lock=False) cmds.delete(proxies) if cmds.objExists("RRM_ProxiesLayer"): cmds.delete("RRM_ProxiesLayer")
def execCleanNodes(self,*args): if not LayerUtils.hasCustomNodes(): Utils.confirmDialog(icon='information', title='Info', message='Scene does not contain any custom ngSkinTools nodes.', button=['Ok']); return message = 'This command deletes all custom nodes from ngSkinTools plugin. Skin weights will be preserved, but all layer data will be lost. Do you want to continue?' if Utils.confirmDialog( icon='warning', title='Warning', message=message, button=['Yes','No'], defaultButton='No')!='Yes': return LayerDataModel.getInstance().cleanCustomNodes()
def removeAllNodes(): if not LayerUtils.hasCustomNodes(): utils.confirmDialog(icon='information', title='Info', message='Scene does not contain any custom ngSkinTools nodes.', button=['Ok']); return message = 'This command deletes all custom ngSkinTools nodes. Skin weights will be preserved, but all layer data will be lost. Do you want to continue?' if utils.confirmDialog( icon='warning', title='Warning', message=message, button=['Yes', 'No'], defaultButton='No') != 'Yes': return LayerDataModel.getInstance().cleanCustomNodes()