def on_btn_FixSkinBsEnd_clicked(self, clicked=None): if clicked == None:return selectIndexes = self.listView_attributeList.selectedIndexes() if len(selectIndexes) == 0:return selectAttr = self.__AttributeModel.data(selectIndexes[0], QtCore.Qt.DisplayRole) if not uiTool.warning('BlendShape\'s shape on attribute "%s" will be changed,\nand it can\'t to undo, \ncontinue? ?'%selectAttr):return openCloseDeformer(self.__baseModel, 0, ('skinCluster')) newSculpModel = cvShapeInverterCmds.invert(self.__baseModel, self.__sculpmodel, self.progressBar) mc.delete(newSculpModel, ch=True) openCloseDeformer(self.__baseModel, 1, ('skinCluster')) if mc.objExists(selectAttr): mc.blendShape(newSculpModel, selectAttr, w=((0, 1))) mc.delete(selectAttr, ch=True) mc.delete(newSculpModel) else: shape = mc.listRelatives(newSculpModel, s=True, path=True)[0] weightID = self.__AttributeDT2.get(selectAttr, None) TGTattr = self.__IGTAttributeDT.get(weightID, None) mc.connectAttr('%s.worldMesh[0]'%shape, '%s.%s'%(self.__blendShape, TGTattr), f=True) mc.rename(newSculpModel, selectAttr) mc.delete(self.__sculpmodel) mc.delete(self.__tempmodel)
def on_btn_FixBsEnd_clicked(self, clicked=None): if clicked == None:return #- selectIndexes = self.listView_attributeList.selectedIndexes() if len(selectIndexes) == 0:return selectAttr = self.__AttributeModel.data(selectIndexes[0], QtCore.Qt.DisplayRole) #- if not uiTool.warning('BlendShape\'s shape on attribute "%s" will be changed,\nand it can\'t to undo, \ncontinue? ?'%selectAttr):return if mc.objExists(selectAttr): mc.blendShape(self.__sculpmodel, selectAttr, w=((0, 1))) mc.delete(selectAttr, ch=True) mc.delete(self.__sculpmodel) else: shape = mc.listRelatives(self.__sculpmodel, s=True, path=True)[0] weightID = self.__AttributeDT2.get(selectAttr, None) TGTattr = self.__IGTAttributeDT.get(weightID, None) mc.connectAttr('%s.worldMesh[0]'%shape, '%s.%s'%(self.__blendShape, TGTattr), f=True) mc.rename(self.__sculpmodel, selectAttr) mc.delete(self.__tempmodel)
def on_btn_FixBsBsEnd_clicked(self, clicked=None): if clicked == None:return #- selectIndexes = self.listView_attributeList.selectedIndexes() if len(selectIndexes) == 0:return selectAttr = self.__AttributeModel.data(selectIndexes[0], QtCore.Qt.DisplayRole) if not uiTool.warning('BlendShape\'s shape on attribute "%s" will be changed,\nand it can\'t to undo, \ncontinue? ?'%selectAttr):return #- dup model openCloseDeformer(self.__baseModel, 0) midModel = mc.duplicate(self.__baseModel, n=nameTool.compileMayaObjectName('%s_mid'%self.__baseModel.split(':')[-1]))[0] openCloseDeformer(self.__baseModel, 1) #- add blendShape mc.blendShape(self.__sculpmodel, self.__baseModel, midModel, w=((0, 1), (1, -1))) mc.delete(midModel, ch=True) if mc.objExists(selectAttr): mc.blendShape(midModel, selectAttr, w=((0, 1))) mc.delete(selectAttr, ch=True) mc.delete(midModel) else: shape = mc.listRelatives(midModel, s=True, path=True)[0] weightID = self.__AttributeDT2.get(selectAttr, None) TGTattr = self.__IGTAttributeDT.get(weightID, None) mc.connectAttr('%s.worldMesh[0]'%shape, '%s.%s'%(self.__blendShape, TGTattr), f=True) mc.rename(midModel, selectAttr) mc.delete(self.__sculpmodel) mc.delete(self.__tempmodel)
def on_btn_FixSkinBsEnd_clicked(self, clicked=None): if clicked == None: return selectIndexes = self.listView_attributeList.selectedIndexes() if len(selectIndexes) == 0: return selectAttr = self.__AttributeModel.data(selectIndexes[0], QtCore.Qt.DisplayRole) if not uiTool.warning( 'BlendShape\'s shape on attribute "%s" will be changed,\nand it can\'t to undo, \ncontinue? ?' % selectAttr): return openCloseDeformer(self.__baseModel, 0, ('skinCluster')) newSculpModel = cvShapeInverterCmds.invert(self.__baseModel, self.__sculpmodel, self.progressBar) mc.delete(newSculpModel, ch=True) openCloseDeformer(self.__baseModel, 1, ('skinCluster')) if mc.objExists(selectAttr): mc.blendShape(newSculpModel, selectAttr, w=((0, 1))) mc.delete(selectAttr, ch=True) mc.delete(newSculpModel) else: shape = mc.listRelatives(newSculpModel, s=True, path=True)[0] weightID = self.__AttributeDT2.get(selectAttr, None) TGTattr = self.__IGTAttributeDT.get(weightID, None) mc.connectAttr('%s.worldMesh[0]' % shape, '%s.%s' % (self.__blendShape, TGTattr), f=True) mc.rename(newSculpModel, selectAttr) mc.delete(self.__sculpmodel) mc.delete(self.__tempmodel)
def on_btn_FixBsEnd_clicked(self, clicked=None): if clicked == None: return #- selectIndexes = self.listView_attributeList.selectedIndexes() if len(selectIndexes) == 0: return selectAttr = self.__AttributeModel.data(selectIndexes[0], QtCore.Qt.DisplayRole) #- if not uiTool.warning( 'BlendShape\'s shape on attribute "%s" will be changed,\nand it can\'t to undo, \ncontinue? ?' % selectAttr): return if mc.objExists(selectAttr): mc.blendShape(self.__sculpmodel, selectAttr, w=((0, 1))) mc.delete(selectAttr, ch=True) mc.delete(self.__sculpmodel) else: shape = mc.listRelatives(self.__sculpmodel, s=True, path=True)[0] weightID = self.__AttributeDT2.get(selectAttr, None) TGTattr = self.__IGTAttributeDT.get(weightID, None) mc.connectAttr('%s.worldMesh[0]' % shape, '%s.%s' % (self.__blendShape, TGTattr), f=True) mc.rename(self.__sculpmodel, selectAttr) mc.delete(self.__tempmodel)
def mirrorDrivenkeyByControls(): if not uiTool.warning(message="Mirror face control's drivenKeys? ?"): return controls = mc.ls("L_*_ctl_*", type="transform") for src in controls: dst = src.replace("L_", "R_") if not mc.objExists(dst): continue mirrorDrivenkeys(src, dst)
def mirrorDrivenkeyByControls(): if not uiTool.warning(message='Mirror face control\'s drivenKeys? ?'): return controls = mc.ls('L_*_ctl_*', type='transform') for src in controls: dst = src.replace('L_', 'R_') if not mc.objExists(dst): continue mirrorDrivenkeys(src, dst)
def on_btn_RepalceBlendShape_clicked(self, clicked=None): if clicked == None:return selModel = mc.ls(sl=True) if len(selModel) == 0:return shape = mc.listRelatives(selModel, s=True, path=True)[0] if len(self.listView_attributeList.selectedIndexes()) == 0:return selectAttr = self.__AttributeModel.data(self.listView_attributeList.selectedIndexes()[0], QtCore.Qt.DisplayRole) if not uiTool.warning('BlendShape\'s shape on attribute "%s" will be changed,\nand it can\'t to undo, \ncontinue? ?'%selectAttr):return weightID = self.__AttributeDT2.get(selectAttr, None) TGTattr = self.__IGTAttributeDT.get(weightID, None) mc.connectAttr('%s.worldMesh[0]'%shape, '%s.%s'%(self.__blendShape, TGTattr), f=True)
def on_btn_replace_clicked(self, clicked=None): if clicked == None: return polyGeometry = mc.ls(type="mesh") if not polyGeometry: print "# Error # No polyGon geometrys...", return polyGeometry = mc.listRelatives(polyGeometry, p=True) polyGeometry = dict.fromkeys(polyGeometry).keys() selectIndexes = self.listView.selectedIndexes() if not selectIndexes: print "# Error # - You must select a model file...", return index = selectIndexes[0].row() modelPath = self.asset_data[index] if not uiTool.warning(message="Model's UV will be replaced, and it can not to undo !!!\nContinue ? ?"): return # - refrence f = mc.file(modelPath, r=True, namespace="UV") self.progressBar.setMaximum(len(polyGeometry)) for i, geo in enumerate(polyGeometry): self.progressBar.setValue(i) self.btn_replace.setText("%d%%" % mathTool.setRange(0, len(polyGeometry), 0, 100, i)) realName = re.search("\w+$", geo).group() UVgeo = "UV:%s" % realName if not mc.objExists(UVgeo): print "# Warning # There are no model in new file for %s..." % geo continue # - mc.transferAttributes( UVgeo, geo, pos=0, nml=0, uvs=2, col=0, spa=5, sus="map1", tus="map1", sm=0, fuv=0, clb=1 ) # - print "# Result # Copyed UV %s -> %s" % (UVgeo, geo) # - delete history RemoveUVWasteNode.delUVTransferAttributesNode(geo) self.progressBar.setMaximum(1) self.progressBar.setValue(0) self.btn_replace.setText("Replace") # - remove refrence mc.file(f, rr=True)
def on_btn_FixBsBsEnd_clicked(self, clicked=None): if clicked == None: return #- selectIndexes = self.listView_attributeList.selectedIndexes() if len(selectIndexes) == 0: return selectAttr = self.__AttributeModel.data(selectIndexes[0], QtCore.Qt.DisplayRole) if not uiTool.warning( 'BlendShape\'s shape on attribute "%s" will be changed,\nand it can\'t to undo, \ncontinue? ?' % selectAttr): return #- dup model openCloseDeformer(self.__baseModel, 0) midModel = mc.duplicate( self.__baseModel, n=nameTool.compileMayaObjectName( '%s_mid' % self.__baseModel.split(':')[-1]))[0] openCloseDeformer(self.__baseModel, 1) #- add blendShape mc.blendShape(self.__sculpmodel, self.__baseModel, midModel, w=((0, 1), (1, -1))) mc.delete(midModel, ch=True) if mc.objExists(selectAttr): mc.blendShape(midModel, selectAttr, w=((0, 1))) mc.delete(selectAttr, ch=True) mc.delete(midModel) else: shape = mc.listRelatives(midModel, s=True, path=True)[0] weightID = self.__AttributeDT2.get(selectAttr, None) TGTattr = self.__IGTAttributeDT.get(weightID, None) mc.connectAttr('%s.worldMesh[0]' % shape, '%s.%s' % (self.__blendShape, TGTattr), f=True) mc.rename(midModel, selectAttr) mc.delete(self.__sculpmodel) mc.delete(self.__tempmodel)
def on_btn_RepalceBlendShape_clicked(self, clicked=None): if clicked == None: return selModel = mc.ls(sl=True) if len(selModel) == 0: return shape = mc.listRelatives(selModel, s=True, path=True)[0] if len(self.listView_attributeList.selectedIndexes()) == 0: return selectAttr = self.__AttributeModel.data( self.listView_attributeList.selectedIndexes()[0], QtCore.Qt.DisplayRole) if not uiTool.warning( 'BlendShape\'s shape on attribute "%s" will be changed,\nand it can\'t to undo, \ncontinue? ?' % selectAttr): return weightID = self.__AttributeDT2.get(selectAttr, None) TGTattr = self.__IGTAttributeDT.get(weightID, None) mc.connectAttr('%s.worldMesh[0]' % shape, '%s.%s' % (self.__blendShape, TGTattr), f=True)
def on_btn_replace_clicked(self, clicked=None): if clicked == None: return polyGeometry = mc.ls(type='mesh') if not polyGeometry: print '# Error # No polyGon geometrys...', return polyGeometry = (mc.listRelatives(polyGeometry, p=True)) polyGeometry = dict.fromkeys(polyGeometry).keys() selectIndexes = self.listView.selectedIndexes() if not selectIndexes: print '# Error # - You must select a model file...', return index = selectIndexes[0].row() modelPath = self.asset_data[index] if not uiTool.warning( message= 'Model\'s UV will be replaced, and it can not to undo !!!\nContinue ? ?' ): return #- refrence f = mc.file(modelPath, r=True, namespace='UV') self.progressBar.setMaximum(len(polyGeometry)) for i, geo in enumerate(polyGeometry): self.progressBar.setValue(i) self.btn_replace.setText( '%d%%' % mathTool.setRange(0, len(polyGeometry), 0, 100, i)) realName = re.search('\w+$', geo).group() UVgeo = 'UV:%s' % realName if not mc.objExists(UVgeo): print '# Warning # There are no model in new file for %s...' % geo continue #- mc.transferAttributes(UVgeo, geo, pos=0, nml=0, uvs=2, col=0, spa=5, sus="map1", tus="map1", sm=0, fuv=0, clb=1) #- print '# Result # Copyed UV %s -> %s' % (UVgeo, geo) #- delete history RemoveUVWasteNode.delUVTransferAttributesNode(geo) self.progressBar.setMaximum(1) self.progressBar.setValue(0) self.btn_replace.setText('Replace') #- remove refrence mc.file(f, rr=True)