Arnold Subdivision

This script will go through all your selected geometry in your scene and set your subdivision type and iteration.

To Run: Select the objects you want to have subdivision then run the script.

#Arnold Subdivison version 1.0.0
#For Maya. Tested in Maya 2014 & 2015 with Arnold
#Bryanna London
#!/usr/bin/env python

import maya.cmds as cmds

#Create GUI
if cmds.window('arnoldSubdWindow', exists=True):

def createGUI():
    #window layout
    arnoldSubdWindow= cmds.window('arnoldSubdWindow',title="Add SubDivisions", rtf=True)
    cmds.columnLayout(adjustableColumn= True, rowSpacing= 3)
    cmds.optionMenu('subdType', label='Type')
    cmds.menuItem( label='Catclark')
    cmds.menuItem( label='None')
    cmds.menuItem( label='Linear')
    cmds.intFieldGrp('iterations', numberOfFields=1, label="Iterations", value1= 2)
    cmds.rowColumnLayout(numberOfRows = 2)
    cmds.button( label='Run', width= 250, command=('setSubdivision()'))
    cmds.button( label='Close', width= 250, command=('cmds.deleteUI(\"' + arnoldSubdWindow + '\", window=True)'))

#Query Values
def queryValues():

   x= cmds.intFieldGrp('iterations',query=True, value=True)

   #query option menu
   selectedMenuItem = cmds.optionMenu('subdType', query = True, value = True)
   #print selectedMenuItem

   if selectedMenuItem == 'Catclark':
      menuValue = 1

   if selectedMenuItem == 'None':
       menuValue = 0

   if selectedMenuItem == 'Linear':
       menuValue = 2

   #query intFieldGrp
   queriedValuesX = x

   #Return Queried Values
   return queriedValuesX[0], menuValue

#Set Subdivision Values
def setSubdivision():

    #Get GUI values
    queriedValuesX, menuValue = queryValues()

    selectedObjs = = True, dag = True, lf = True, visible=True, type = 'mesh')

    for sel in selectedObjs:
        cmds.setAttr('%s.aiSubdivType' %(sel), menuValue)
        cmds.setAttr('%s.aiSubdivIterations' %(sel), queriedValuesX)

#Run Script


© 2016 Bryanna London