Created
January 20, 2017 19:35
-
-
Save anonymous/9ba64a675b52d2475c0386b532d425e9 to your computer and use it in GitHub Desktop.
Set all shader attributes to a new prefixed and indexed string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymel.core as pm | |
# This will replace the values in all selected objects (based on order of selection) to "<new_name>_<index in selection>" | |
# Feel free to replace all these variables to whatever specifics you need. | |
shader_type = 'aiSurface' | |
use_selection = True | |
attribute = 'aovid' | |
new_name = 'assetID' | |
padding = 2 | |
for index, shader in enumerate(pm.ls(type=shader_type, sl=use_selection)): | |
shader.attr(attribute).set('%s_%{PAD}d'.format(PAD='0' + padding) % (prefix, index) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment