Simplify Materials


#1

Hello,

I’ve got a few hundred materials in a scene which I need to send to 3dsmax. Using the FBX exporter I get the geo fine and the material name assignment, but I lose a lot of the texture assignments due to maya having ‘Projection’ and ‘bump3D’ nodes in the material tree which don’t export as FBX. I need to make it so that if there’s any projection or bump3D nodes that it disconnects these and plugs straight into the material instead. Thus when I export as FBX I’ll get the texture map assignment correctly in 3dsmax.

Make sense? I could write this in a couple of lines in maxscript but not so in Mel/python.

//loop through all the materials
// loop through all the connections of the material
//// if the class of the connection is projection
////// get the sub-map of the projectection map
////// assign the sub-map to the material

Haven’t got far before stumbling into rookie errors…it’s been a while since I last coded in Maya.


sceneMaterials = cmds.ls(type='shadingEngine') 
    for mat in sceneMaterials: cmds.getAttr(mat, 'surfaceShader')


#2

Actually it’d be even easier in maxscript…

for o in getclassinstances ‘projection’ do replaceinstances o (o.submaterial)

Any equivalent in MEL/Python?