Hi,
I am trying to build a plugin which iterates over each shader in a scene and for each ".color/.ambientColor/.transparency" attribute (just to name a few common attributes) on a shader it generates and exports a image file texture which condenses all the complex shader network graph infomation into a single image, for example a procedural maya ramp node exported to a single image called "ShaderName_base_color.tiff".
I've tried to build something like this before in PyMEL, however when I accessed the shaders color attribute it would always say float3 (0.0, 0.0, 0.0) even if I had a file texture node connected, I couldn't just access the individual pixel values so that I could then feed those through a image exporter to export a image?
I'm now trying to do this but this time in C++ using the Maya API but I'm not sure how to correctly get a reference to the attribute value for a color attribute or MPlug.
Is getting a reference to the shaders color attribute the place to start? or is there important something I'm missing?
I feel that i need to access the data a certain way in order to obtain individual pixel values and iterate over pixel coordinates.
Since I'm new to the C++ API (I have some knowledge of C++) I started my plugin using a example by Autodesk called "nodeInfoCmd/nodeInfoCmd.cpp" which simply creates a custom command which will output information on all nodes in the current selection list and I've started to modify this code to output the attribute/plug type and the value e.g float3.
But I'm not sure what type to use to get a reference should I use plug.asMObject or MObjectHandle or .asFloat or .asDouble? I have no idea.
I can post the current code I have if needed?
Any help would be greatly appreciated.
Thank you.
Zach Coley.