[MAYA] Accessing the main texture from any material?


#1

One problem that I am trying to accomplish is grabbing the “MainTexture” generically From any material. Some shaders name them “Albedo”, “Diffuse” just wondering if there is a way to return a texture.
Example, a user attaches a blinn, I want to grab the Albedo, and if a user attaches a lambert I want to grab the Diffuse.

A hack I can think of is to get a list of the textures attached to a material and just return the first on.


#2

Can you just get the type of the material and choose which attribute to query based on that?

>>> cmds.objectType('blinn1')
u'blinn'

#3

I could, but I’m looking for a more generic way seeing how it may be a shader that we don’t support with a case.


#4

Right. I admit I don’t know a lot on the shader end of things, but I’ve used phong, blinn, and lambert, and I thought I always dragged a file onto the Color attribute of each material type. Do they hook up in different ways under the hood? I don’t have Maya at the moment, or I’d just find out myself.