def fixAllBelow(): # Fix face assignment hfFixBadShading() # delete unused nodes mel.deleteUnusedNodes() # select top node cmds.select(get_top_node()) # freeze transforms on top node mel.FreezeTransformations() # set pivot to origin mel.xform(zeroTransformPivots=1) # select hierarchy and freeze transforms cmds.select(hi=1) mel.FreezeTransformations() # delete history for all mel.DeleteHistory() # delete all display layers deleteDPLayers()
def create_ui(self): if get_author_initials() == 'mj': bg_colour = [0.9, 0.4, 1] else: bg_colour = [0.4, 0.4, 0.4] tab = str(cmds.columnLayout()) cmds.separator(style="none") cmds.frameLayout(collapsable=True, label="Common") cmds.columnLayout() cmds.button(command=lambda *args: self.new_scene(), label="New Work Scene", backgroundColor=bg_colour) cmds.button(command=lambda *args: self.setProjectAsCurrDirectory(), label="Set Project", backgroundColor=bg_colour) cmds.button(command=lambda *args: self.importRefCube(), label="Import Reference Cube", backgroundColor=bg_colour) cmds.button(command=lambda *args: mel.Reset(), label="Create Playblast Turntable", backgroundColor=bg_colour) cmds.button(command=lambda *args: exportFBX.export_asset(), label="Export as FBX", backgroundColor=bg_colour) cmds.button(command=lambda *args: makeReference.make_reference(), label="Make Reference File", backgroundColor=bg_colour) cmds.setParent('..') cmds.setParent('..') cmds.frameLayout(collapsable=True, label="Status") cmds.columnLayout(rowSpacing=2) cmds.button(command=lambda *args: self.update_check_list(), label="Update Status", backgroundColor=bg_colour) cmds.text(label="Status errors:", align="left", backgroundColor=[0.2, 0.2, 0.2], height=15) self.statusText = cmds.text("Status", backgroundColor=[1, 1, 0]) self.statusText = cmds.text(self.statusText, query=True, fullPathName=True) cmds.setParent('..') cmds.setParent('..') cmds.frameLayout(collapsable=True, label="Check List") cmds.columnLayout(rowSpacing=2) cmds.button(command=lambda *args: fixAllBelow.fixAllBelow(), label="Run All Fix Scripts Below", backgroundColor=bg_colour) cmds.button(command=lambda *args: hfFixBadShading(), label="Fix Face Assignments on Scene Objects", backgroundColor=bg_colour) cmds.button(command=lambda *args: mel.deleteUnusedNodes(), label="Delete Unused Nodes", backgroundColor=bg_colour) cmds.button(command=lambda *args: self.select_top_node(), label="Select Top Node", backgroundColor=bg_colour) cmds.button(command=lambda *args: self.select_hierachy(), label="Select Hierarchy", backgroundColor=bg_colour) cmds.button(command=lambda *args: mel.FreezeTransformations(), label="Freeze Transformations", backgroundColor=bg_colour) cmds.button(command=lambda *args: mel.DeleteHistory(), label="Delete History", backgroundColor=bg_colour) cmds.button(command=lambda *args: self.pivot_at_origin(), label="Pivot at Origin", backgroundColor=bg_colour) cmds.button(command=lambda *args: deleteDPLayers.deleteDPLayers(), label="Delete Display Layers", backgroundColor=bg_colour) cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') return tab, "Scene"