def debugView(self): mxs.gw.Marker(self.pos1, mxs.readvalue(mxs.StringStream('#circle')), color=mxs.red) mxs.gw.Marker(self.pos2, mxs.readvalue(mxs.StringStream('#circle')), color=mxs.red) mxs.gw.Polyline((self.pos1, self.pos2), False) mxs.gw.enlargeUpdateRect(mxs.readvalue(mxs.StringStream('#whole'))) mxs.gw.updateScreen()
def removeMod(self): item = self.lw_skiin.selectedItems() allowed = mxs.readvalue(mxs.StringStream('Skin')) if mxs.classOf(mxs.modPanel.getCurrentObject()) == allowed: try: node = mxs.selection[0] mod = mxs.modPanel.getCurrentObject() modID = mxs.modPanel.getModifierIndex(mxs.selection[0], mod) if [node, mod, modID] in self.skinMeshes: print(self.skinMeshes) self.skinMeshes.remove([node, mod, modID]) self.lw_skiin.takeItem(self.lw_skiin.row(item[0])) print(self.skinMeshes) else: pass except: pass else: pass
def filter(input): new = [] allowed = [] allowed.append(mxs.readvalue(mxs.StringStream('CATBone'))) allowed.append(mxs.readvalue(mxs.StringStream('HubObject'))) # print("NOT ALLOWED NODES:") index = 0 for i in input: new.append(i) if mxs.classOf(i) in allowed: self.selectedNodes.append(i) # print("{}".format(index), i.name) index += 1 # print("{}\n".format(len(self.selectedNodes))) self.result = new self.writeInNodeList(self.result)
def import_fbx_file(file_path, force=True, **kwargs): """ Imports FBX file into current DCC scene :param file_path: str :param force: bool :param kwargs: keyword arguments :return: """ skin = kwargs.get('skin', True) animation = kwargs.get('animation', True) rt.FBXExporterSetParam("Mode", rt.readvalue(rt.StringStream('#create'))) # rt.FBXExporterSetParam("Skin", skin) # rt.FBXExporterSetParam("Animation", animation) if force: return rt.importFile(file_path, rt.readValue(rt.StringStream('#noPrompt'))) else: return rt.importFile(file_path)
def pickPoints(self): self.geo = self.geometry() self.hide() try: mxs.unregisterRedrawViewsCallback(self.debugView) except: pass try: self.pos1 = mxs.pickPoint( snap=mxs.readvalue(mxs.StringStream('#3D'))) self.pos2 = mxs.pickPoint( snap=mxs.readvalue(mxs.StringStream('#3D'))) self.moveVector = self.pos2 - self.pos1 vector = self.moveVector X = mxs.normalize(vector) Z = mxs.point3(0, 0, 1) Y = mxs.normalize(mxs.cross(Z, X)) Z = mxs.normalize(mxs.cross(X, Y)) self.transform = mxs.matrix3(Z, Y, X, mxs.point3(0, 0, 0)) mxs.WorkingPivot.SetTM(self.transform) mxs.execute("max tti") mxs.registerRedrawViewsCallback(self.debugView) mxs.execute("max move") mxs.execute("toolMode.coordsys #working_pivot") self.show() self.setGeometry(self.geo) except: print("Point Picking Cancelled")
def import_obj_file(file_path, force=True, **kwargs): """ Imports OBJ file into current DCC scene :param file_path: str :param force: bool :param kwargs: keyword arguments :return: """ if force: return rt.importFile(file_path, rt.readValue(rt.StringStream('#noPrompt')), using='OBJIMP') else: return rt.importFile(file_path, using='OBJIMP')
def addMod(self): allowed = mxs.readvalue(mxs.StringStream('Skin')) if mxs.classOf(mxs.modPanel.getCurrentObject()) == allowed: try: node = mxs.selection[0] mod = mxs.modPanel.getCurrentObject() modID = mxs.modPanel.getModifierIndex(mxs.selection[0], mod) if [node, mod, modID] in self.skinMeshes: pass else: self.skinMeshes.append([node, mod, modID]) self.lw_skiin.addItem("{} > {} > ID:{}".format( mxs.selection[0].name, mod, modID)) self.lw_skiin.item(self.lw_skiin.count() - 1).setBackground( QColor.fromRgb(60, 60, 60)) except: pass # print("Error") else: pass