class MatchOivot(object): def __init__(self): self.dlg = CustomDialog("match object pivot to another objects center") self.dlg.addDescription( "Match object pivot point to the center of another selected object. select the source object then select the taget object. source objects pivot point will be moved to the center of the target object" ) self.dlg.addTextFieldButton("source object", "source", "none", self.sourceObj, editable=True) self.dlg.addTextFieldButton("target object", "target", "none", self.targetObj, editable=True) self.dlg.addButton("Apply") # Buttons always go on the bottom self.dlg.addButton( "Close") # Each button gets and index value returned on exit self.result = self.dlg.show( ) # result will be 0 for OK, and 1 for Close def sourceObj(self): selectedCam = cmds.ls(sl=True) selectedCam = str(selectedCam[0]) self.dlg.setValue("source object", selectedCam) def targetObj(self): selectedShad = cmds.ls(sl=True) selectedShad = str(selectedShad[0]) self.dlg.setValue("target object", selectedShad)
class myclass(object): def __init__(self): parent = QtGui.QApplication.activeWindow() self.dlg = CustomDialog("Create Light Selects",parent=parent) self.dlg.addDescription("This tool will create a light select for each light in your scene. select either Diffuse or Specular to create that type of lightselect for each light. You can check both to get one of each.") self.dlg.addCheckBox("Diffuse", state = True) self.dlg.addCheckBox("Specular", state = False) self.dlg.addButton("Apply") # Buttons always go on the bottom self.dlg.addButton("Close") # Each button gets and index value returned on exit self.result = self.dlg.show() # result will be 0 for OK, and 1 for Close
class myclass(object): def __init__(self): parent = QtGui.QApplication.activeWindow() self.dlg = CustomDialog("Clean Geo",parent=parent) self.dlg.addDescription("This tool will export an obj for each object selected. Objects will be imported and marked Clean, you can also use the tool to export multiple obj's") self.dlg.addTextFieldButton("Load Objects", "Load source objects", "none" , self.mkLoadSource , editable = True ) self.dlg.addButton("Apply") # Buttons always go on the bottom self.dlg.addButton("Close") # Each button gets and index value returned on exit self.result = self.dlg.show() # result will be 0 for OK, and 1 for Close def mkLoadSource(self): selectedOBJ = cmds.ls(sl = True,g = True,tr = True) selectedOBJ = ",".join(selectedOBJ) self.dlg.setValue("Load Objects", selectedOBJ)
def vrayStndAloneUI(): parent = QtGui.QApplication.activeWindow() dlg = CustomDialog("Render Vray Stand Alone",parent=parent) dlg.addDescription("Render with Vray Stand alone. use this tool to test your scene file with Vray stand alone.") Modes = ['standard','preview','draft','SaveExr'] dlg.addComboBox("Vray Modes", Modes) dlg.addButton("Apply") # Buttons always go on the bottom dlg.addButton("Cancel") # Each button gets and index value returned on exit result = dlg.show() # result will be 0 for Apply, and 1 for Cancel if result == 0: # Apply VrayMode = dlg.getValue("Vray Modes") return VrayMode else: return False
def vrayStndAloneUI(): parent = QtGui.QApplication.activeWindow() dlg = CustomDialog("Render Vray Stand Alone", parent=parent) dlg.addDescription( "Render with Vray Stand alone. use this tool to test your scene file with Vray stand alone." ) Modes = ['standard', 'preview', 'draft', 'SaveExr'] dlg.addComboBox("Vray Modes", Modes) dlg.addButton("Apply") # Buttons always go on the bottom dlg.addButton( "Cancel") # Each button gets and index value returned on exit result = dlg.show() # result will be 0 for Apply, and 1 for Cancel if result == 0: # Apply VrayMode = dlg.getValue("Vray Modes") return VrayMode else: return False
class MatchOivot(object): def __init__(self): self.dlg = CustomDialog("match object pivot to another objects center") self.dlg.addDescription("Match object pivot point to the center of another selected object. select the source object then select the taget object. source objects pivot point will be moved to the center of the target object") self.dlg.addTextFieldButton("source object", "source", "none" , self.sourceObj , editable = True ) self.dlg.addTextFieldButton("target object", "target", "none" , self.targetObj , editable = True ) self.dlg.addButton("Apply") # Buttons always go on the bottom self.dlg.addButton("Close") # Each button gets and index value returned on exit self.result = self.dlg.show() # result will be 0 for OK, and 1 for Close def sourceObj(self): selectedCam = cmds.ls(sl = True) selectedCam = str(selectedCam[0]) self.dlg.setValue("source object", selectedCam) def targetObj(self): selectedShad = cmds.ls(sl = True) selectedShad = str(selectedShad[0]) self.dlg.setValue("target object", selectedShad)
class myclass(object): def __init__(self): parent = QtGui.QApplication.activeWindow() self.dlg = CustomDialog("Duplicate Objects",parent=parent) self.dlg.addDescription("This tool will duplicate an object and move it to the location of all target objects") self.dlg.addTextFieldButton("LoadSource", "Load source objects", "none" , self.mkLoadSource , editable = True ) self.dlg.addTextFieldButton("Load Object", "Load object to duplicate", "none" , self.mkLoadObject , editable = True ) self.dlg.addCheckBox("Include Input Graph", state = False) self.dlg.addCheckBox("Keep constrain", state = False) self.dlg.addButton("Apply") # Buttons always go on the bottom self.dlg.addButton("Close") # Each button gets and index value returned on exit self.result = self.dlg.show() # result will be 0 for OK, and 1 for Close def mkLoadSource(self): selectedOBJ = cmds.ls(sl = True,g = True,tr = True) selectedOBJ = ",".join(selectedOBJ) self.dlg.setValue("LoadSource", selectedOBJ) def mkLoadObject(self): heroOBJ = cmds.ls(sl = True,sn = True,tr = True) heroOBJ = str(heroOBJ[0]) self.dlg.setValue("Load Object", heroOBJ)
class myclass(object): def __init__(self): parent = QtGui.QApplication.activeWindow() self.dlg = CustomDialog("Clean Geo", parent=parent) self.dlg.addDescription( "This tool will export an obj for each object selected. Objects will be imported and marked Clean, you can also use the tool to export multiple obj's" ) self.dlg.addTextFieldButton("Load Objects", "Load source objects", "none", self.mkLoadSource, editable=True) self.dlg.addButton("Apply") # Buttons always go on the bottom self.dlg.addButton( "Close") # Each button gets and index value returned on exit self.result = self.dlg.show( ) # result will be 0 for OK, and 1 for Close def mkLoadSource(self): selectedOBJ = cmds.ls(sl=True, g=True, tr=True) selectedOBJ = ",".join(selectedOBJ) self.dlg.setValue("Load Objects", selectedOBJ)
class mkOnionUI(object): def __init__(self): self.dlg = CustomDialog("onion skin") self.dlg.addDescription( "This tool will duplicate an object for each frame, this is usfull for onion skinning or for creating blend shapes from animations" ) FrameIncraments = [ '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15' ] self.dlg.addComboBox("Incrament", FrameIncraments) self.dlg.addTextField("Frame range", defaultValue='', enabled=True) self.dlg.addTextFieldButton("Load object", "select object", "none", self.mkLoadobj, editable=True) self.mkTimeRange() self.dlg.addButton("Apply") # Buttons always go on the bottom self.dlg.addButton( "Close") # Each button gets and index value returned on exit self.result = self.dlg.show( ) # result will be 0 for OK, and 1 for Close # --------------Time range ------------------------ def mkTimeRange(self): startFrame = cmds.playbackOptions(query=True, minTime=True) endFrame = cmds.playbackOptions(query=True, maxTime=True) startFrame = int(startFrame) endFrame = int(endFrame) self.dlg.setValue("Frame range", str(startFrame) + '-' + str(endFrame)) # ---------------load object----------------------- def mkLoadobj(self): selectedObj = cmds.ls(sl=True) selectedObj = str(selectedObj[0]) self.dlg.setValue("Load object", selectedObj)
class mkOnionUI(object): def __init__(self): self.dlg = CustomDialog("onion skin") self.dlg.addDescription("This tool will duplicate an object for each frame, this is usfull for onion skinning or for creating blend shapes from animations") FrameIncraments = ['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15'] self.dlg.addComboBox("Incrament", FrameIncraments) self.dlg.addTextField("Frame range",defaultValue= '',enabled=True) self.dlg.addTextFieldButton("Load object", "select object", "none" , self.mkLoadobj , editable = True ) self.mkTimeRange() self.dlg.addButton("Apply") # Buttons always go on the bottom self.dlg.addButton("Close") # Each button gets and index value returned on exit self.result = self.dlg.show() # result will be 0 for OK, and 1 for Close # --------------Time range ------------------------ def mkTimeRange(self): startFrame = cmds.playbackOptions (query = True, minTime = True) endFrame = cmds.playbackOptions (query = True, maxTime = True) startFrame = int(startFrame) endFrame = int(endFrame) self.dlg.setValue("Frame range", str(startFrame)+ '-' + str(endFrame)) # ---------------load object----------------------- def mkLoadobj(self): selectedObj = cmds.ls(sl = True) selectedObj = str(selectedObj[0]) self.dlg.setValue("Load object", selectedObj)
class myclass(object): def __init__(self): parent = QtGui.QApplication.activeWindow() fileTpyes = ['jpg', 'tiff', 'tga', 'png'] resolution = ['256', '512', '1024', '2048', '4096'] self.dlg = CustomDialog("bake camera projections", parent=parent) self.dlg.addDescription( "This tool will bake out an animated camera projection") self.dlg.addComboBox("formats", fileTpyes) self.dlg.addComboBox("resolution", resolution) self.dlg.addTextField("Image name", defaultValue='', enabled=True) self.dlg.addTextField("Frame range", defaultValue='', enabled=True) self.mkTimeRange() self.dlg.addTextFieldButton("Load camera", "select camera", "none", self.mkLoadCam, editable=True) self.dlg.addTextFieldButton("Load shader", "select shader", "none", self.mkLoadShader, editable=True) self.dlg.addTextFieldButton("Load object", "select object", "none", self.mkLoadobj, editable=True) self.dlg.addCheckBox("Normal map", state=False) self.dlg.addButton("Apply") # Buttons always go on the bottom self.dlg.addButton( "Close") # Each button gets and index value returned on exit self.result = self.dlg.show( ) # result will be 0 for OK, and 1 for Close # --------------Time range ------------------------ def mkTimeRange(self): startFrame = cmds.playbackOptions(query=True, minTime=True) endFrame = cmds.playbackOptions(query=True, maxTime=True) startFrame = int(startFrame) endFrame = int(endFrame) self.dlg.setValue("Frame range", str(startFrame) + '-' + str(endFrame)) # --------------load ui with selections------------------------ def mkLoadCam(self): selectedCam = cmds.ls(sl=True) selectedCam = str(selectedCam[0]) self.dlg.setValue("Load camera", selectedCam) def mkLoadShader(self): selectedShad = cmds.ls(sl=True) selectedShad = str(selectedShad[0]) self.dlg.setValue("Load shader", selectedShad) def mkLoadobj(self): selectedObj = cmds.ls(sl=True) selectedObj = str(selectedObj[0]) self.dlg.setValue("Load object", selectedObj) # --------------bake camer normal maps------------------------ def mkCreateCamNrml(self): surfaceShdr = cmds.shadingNode('surfaceShader', asShader=True, n="surfaceShaderNode") setRangeShdr = cmds.shadingNode('setRange', asUtility=True, n='setRangeNode') samplerInfoShader = cmds.shadingNode('samplerInfo', asUtility=True, n='samplerInfoNode') cmds.setAttr(setRangeShdr + ".maxX", 1) cmds.setAttr(setRangeShdr + ".oldMinX", -1) cmds.setAttr(setRangeShdr + ".oldMaxX", 1) cmds.setAttr(setRangeShdr + ".maxY", 1) cmds.setAttr(setRangeShdr + ".oldMinY", -1) cmds.setAttr(setRangeShdr + ".oldMaxY", 1) cmds.setAttr(setRangeShdr + ".maxZ", 1) cmds.setAttr(setRangeShdr + ".oldMinZ", -1) cmds.setAttr(setRangeShdr + ".oldMaxZ", 1) cmds.connectAttr(samplerInfoShader + ".normalCameraX", setRangeShdr + ".valueX") cmds.connectAttr(samplerInfoShader + ".normalCameraY", setRangeShdr + ".valueY") cmds.connectAttr(samplerInfoShader + ".normalCameraZ", setRangeShdr + ".valueZ") cmds.connectAttr(setRangeShdr + ".outValue", surfaceShdr + ".outColor") shaders = {} shaders['surface'] = surfaceShdr shaders['setRange'] = setRangeShdr shaders['sampler'] = samplerInfoShader return (shaders)
class myclass(object): def __init__(self): parent = QtGui.QApplication.activeWindow() fileTpyes = ['jpg','tiff','tga','png'] resolution = ['256','512','1024','2048','4096'] self.dlg = CustomDialog("bake camera projections",parent=parent) self.dlg.addDescription("This tool will bake out an animated camera projection") self.dlg.addComboBox("formats", fileTpyes) self.dlg.addComboBox("resolution", resolution) self.dlg.addTextField("Image name",defaultValue='',enabled=True) self.dlg.addTextField("Frame range",defaultValue= '',enabled=True) self.mkTimeRange() self.dlg.addTextFieldButton("Load camera", "select camera", "none" , self.mkLoadCam , editable = True ) self.dlg.addTextFieldButton("Load shader", "select shader", "none" , self.mkLoadShader , editable = True ) self.dlg.addTextFieldButton("Load object", "select object", "none" , self.mkLoadobj , editable = True ) self.dlg.addCheckBox("Normal map", state = False) self.dlg.addButton("Apply") # Buttons always go on the bottom self.dlg.addButton("Close") # Each button gets and index value returned on exit self.result = self.dlg.show() # result will be 0 for OK, and 1 for Close # --------------Time range ------------------------ def mkTimeRange(self): startFrame = cmds.playbackOptions (query = True, minTime = True) endFrame = cmds.playbackOptions (query = True, maxTime = True) startFrame = int(startFrame) endFrame = int(endFrame) self.dlg.setValue("Frame range", str(startFrame)+ '-' + str(endFrame)) # --------------load ui with selections------------------------ def mkLoadCam(self): selectedCam = cmds.ls(sl = True) selectedCam = str(selectedCam[0]) self.dlg.setValue("Load camera", selectedCam) def mkLoadShader(self): selectedShad = cmds.ls(sl = True) selectedShad = str(selectedShad[0]) self.dlg.setValue("Load shader", selectedShad) def mkLoadobj(self): selectedObj = cmds.ls(sl = True) selectedObj = str(selectedObj[0]) self.dlg.setValue("Load object", selectedObj) # --------------bake camer normal maps------------------------ def mkCreateCamNrml(self): surfaceShdr = cmds.shadingNode('surfaceShader', asShader=True, n = "surfaceShaderNode") setRangeShdr = cmds.shadingNode('setRange', asUtility = True, n='setRangeNode') samplerInfoShader = cmds.shadingNode('samplerInfo', asUtility = True, n='samplerInfoNode') cmds.setAttr (setRangeShdr+".maxX", 1) cmds.setAttr (setRangeShdr+".oldMinX", -1) cmds.setAttr (setRangeShdr+".oldMaxX", 1) cmds.setAttr (setRangeShdr+".maxY", 1) cmds.setAttr (setRangeShdr+".oldMinY", -1) cmds.setAttr (setRangeShdr+".oldMaxY", 1) cmds.setAttr (setRangeShdr+".maxZ", 1) cmds.setAttr (setRangeShdr+".oldMinZ", -1) cmds.setAttr (setRangeShdr+".oldMaxZ", 1) cmds.connectAttr(samplerInfoShader+".normalCameraX", setRangeShdr+".valueX") cmds.connectAttr(samplerInfoShader+".normalCameraY", setRangeShdr+".valueY") cmds.connectAttr(samplerInfoShader+".normalCameraZ", setRangeShdr+".valueZ") cmds.connectAttr(setRangeShdr+".outValue", surfaceShdr+".outColor") shaders = {} shaders['surface']=surfaceShdr shaders['setRange']=setRangeShdr shaders['sampler']=samplerInfoShader return (shaders)