Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / SDK / C++ Maya API - Get a normal map's texture name?
  RSS 2.0 ATOM  

C++ Maya API - Get a normal map's texture name?
Rate this thread
 
38646
 
Permlink of this thread  
avatar
  • wiegje
  • Posted: 13 January 2010 02:12 AM
  • Total Posts: 12
  • Joined: 18 August 2009 05:52 PM

Currently I have been able to find the “color” node and “specularColor” node on a surfaceShader, howver I am having trouble finding the normal map. I look for the “color” and “specularColor” like so:

// look for files linked to this mesh
 
MStatus stat;
 
MFnDependencyNode typeDepNode(materialNode) // the surfaceShader node
 
MPlug typePlug typeDepNode.findPlug(MString("specularColor"), &stat) // the type
 
if(stat)
 {
 MPlugArray typePlugArray
;
 
typePlug.connectedTo(typePlugArraytruefalse)
 if(typePlugArray
.length() 0)
 {
 MObject colorNode 
typePlugArray[0].node() // misleading name, but this would be the node I found
 
if(colorNode.hasFn(MFn::kFileTexture))
 {
 MFnDependencyNode fileNode(colorNode)
 MPlug filePlug 
fileNode.findPlug("fileTextureName", &stat) // look for the "fileTextureName" attribute.
 
if(stat)
 {
 MString fileTextureName
;
 
filePlug.getValue(fileTextureName)
 MStringArray splitName
;
 
fileTextureName.split('/'splitName)
 sprintf_s(aOut
OMDL_STRSIZEsplitName[splitName.length()-1].asChar())
 }
 }
 }
 }

Now, how do I go about that when finding a normal map? I tried looking for the following nodes: “bump2d”, “bumpValue”, “normalMap”, “cameraNormal”. But none result in anything.

Please help, this is severely limiting my exporter’s development.



Replies: 0