Wednesday, August 27, 2014

Camera Projection and smoke creation in nuke


Custom Python Script For Rotomation ------------- by Arif Rahman

I started my carrier as a "Rotomation Artist" after few months of my joining i analyzed the we all are doing few file managing task that takes more than 20 each shot per artist. I came up with an idea to shorten this task to save time and i was assuming that it can be done using python script. I started working on it in my spare time and gradually i wrote a python script in Maya that was very helpful and after testing everyone started using it.

After that i wrote its second version with some another changes suggested by my colleagues. Here i want to share that script you all.

I will update a video showing the use of my script soon.

--------------------------------------------

#AutoMeshCombinerV2
import maya.cmds as cmds
if cmds.window ('arif', exists=1 ):
       cmds.deleteUI ('arif', window=1)
window = cmds.window('arif',title = "AutoMeshCombinerV2")
cmds.columnLayout(adjustableColumn = True)
getName = cmds.textFieldButtonGrp(adj = True, ed = False, l='Selected Object', text= 'Select Object', buttonLabel='Get Name', ann = '"Get the name of selected mesh" -A Tool By Arif Rahman', bc = "selObj()")
valStr = cmds.textFieldButtonGrp( label='Input Object Name',adj = True,text = 'Desired Name', buttonLabel='Change', bc = "log()", ann = '"Take out the mesh from the rig group and remane" - A Tool By Arif Rahman' )
button = cmds.button(l="close", c = "cmds.deleteUI('arif', window=0)", ann = 'Close the window')
cmds.frameLayout(labelAlign='center', borderStyle='out', h = 500, lv=0 )
panel = cmds.outlinerPanel()
outliner = cmds.outlinerPanel(panel, query=True,outlinerEditor=True, mbv = 0, up = 1)
cmds.outlinerEditor( outliner, edit=True, mainListConnection='worldList', selectionConnection='modelList', showShapes=False, showAttributes=False, showConnected=False, showAnimCurvesOnly=False, autoExpand=False, showDagOnly=True, ignoreDagHierarchy=False, expandConnections=False, showCompounds=True, showNumericAttrsOnly=False, highlightActive=True, autoSelectNewObjects=False, doNotSelectNewObjects=False, transmitFilters=False, showSetMembers=True, setFilter='defaultSetFilter' )
cmds.showWindow( window )
def log():
       doSel =  cmds.isTrue( 'SomethingSelected' )
       if doSel <= 0:
              cmds.headsUpMessage( 'select an object' )
       else:
              getStr = cmds.textFieldButtonGrp(valStr, query=True, text=True)
              list = cmds.ls(sl = True)
              size = len(list)
              if size >= 2:
                     cmds.polyUnite()
              verSel = cmds.ls(sl=True)
              refObj = cmds.polyPlane(sw = 1, sh = 1)
              print refObj
              cmds.polyUnite ( verSel[0], refObj[0] , name = getStr)
              cmds.delete (refObj[0])
def selObj():
       doSel =  cmds.isTrue( 'SomethingSelected' )
       if doSel <= 0:
              cmds.headsUpMessage( 'select an object' )
       else:
              sel = cmds.ls (sl = 1)
              cmds.textFieldButtonGrp (getName,edit= True, text=sel[0])

-------------------------------------------

How to run this script

1) open your script editor and add a python tab
2) copy and paste the script in python tab
3) select all the controllers (For Rotomation)
4) now select  the code and ctrl+enter (For Rotomation)
5) work is done check your outliner (For Rotomation)

you can add this script in your custom shelf just select the code from the script editor (python), drag and drop with MMB to your shelf.



enjoy........