Skip to content

Instantly share code, notes, and snippets.

@teionn
Created June 5, 2018 07:33
Show Gist options
  • Save teionn/208370a84d42a21eed75fbb5d46e0949 to your computer and use it in GitHub Desktop.
Save teionn/208370a84d42a21eed75fbb5d46e0949 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
#コーディング: utf-8
#------------------------------------------------------------------------------
import maya.cmds as cmds
#------------------------------------------------------------------------------
checkAttr={"castsShadows":1
,"receiveShadows":1
#,"holdOut":0 #Maya2017~
,"motionBlur":1
,"primaryVisibility":1
,"smoothShading":1
,"visibleInReflections":1
,"visibleInRefractions":1
,"doubleSided":1}
_shapeList=cmds.listRelatives(cmds.ls(sl=True),shapes=True)
if not _shapeList is None:
for _shape in _shapeList:
for _attr,_value in checkAttr.items():
_shapeAttr="%s.%s" % (_shape,_attr)
#_shapeAttr=_shape+"."+_attr
_getValue=cmds.getAttr(_shapeAttr)
print "getAttr : ",_shapeAttr,_getValue
if not _getValue == _value:
cmds.setAttr(_shapeAttr,_value)
print "setAttr : ",_shapeAttr,_value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment