Created
December 14, 2014 21:46
-
-
Save mclavan/3c04dc05a90823d6b91e to your computer and use it in GitHub Desktop.
This file contains 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 | |
selected_material = pm.ls(selection=True)[0] | |
# Printing out the material type will give you the information you want to compare. | |
print selected_material.type() | |
# Here is a comparison check between the mental ray material and your target. | |
# selected_material.type() == 'mia_material_x' | |
# Below is a list to check through. | |
# Add the new material names you want to check. | |
material_types = ['mia_material_x'] | |
# The in keyword will check through a list to fine if there is a match. | |
if selected_material.type() in material_types: | |
print 'Whoo Hoo. We got a mental ray material' | |
# You can push this further by comparing class types and using the is keyword instead. | |
# This will allow you to directly compare instances instead of strings. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment