Add layers to a layered texture from the API


I am writing a plugin that creates a Layered texture in the API.

I have the MObject for the Layered Texture and the MPlug to the inputs[], but since I just created the object, the inputs array is of size 0. Eventually I’d like to add several textures to the layered texture and connect them to various files.

What is the best way to add textures to the layered texture from the API? How do you resize a MPlug array once you have it?



[color=white]I face the same problem too. Does anyone have any experience in [size=3][color=red]initialising / connecting attributes that are array/compound attributes? I do not have such problems when face with single value elements. But it’s really a tricky process when it comes to arrays.[/color]

Thanks a lot!

// ******************************************************************
// Connecting WetBlinn and LayerShader

// *****************************************************************

[/color][/size]MDGModifier modifier;

//3rd method – best metd …but how to connect???
MFnLayeredShader l1;

MObject layeredShaderNode = l1.create(true,&stat);

MFnBlinnShader b1;

MObject blinnNode = b1.create(true,&stat);

MColor rgbaValues(MColor::kRGB, 1.0, 0.418, 0.0);







//b1.setTransparency(0); //flaky, double check —this is wrong!!cause of MAJOR error

// 1.

//make the LayeredShader Node

//MObject layeredShaderNode = depNodeFn.create(“layeredShader”, &stat);

//adding the attributes

MObject input1 = l1.attribute(“color”);

MObject input2 = l1.attribute(“glowColor”);

MObject input3 = l1.attribute(“transparency”);

MObject b1_normalCamera = b1.attribute(“normalCamera”);

// 2.

//make new Blinn Node

//MObject blinnNode = depNodeFn.create(“blinn”, &stat);

//output attr

MObject output1 = b1.attribute(“outColor”);

MObject output2 = b1.attribute(“outGlowColor”);

MObject output3 = b1.attribute(“outTransparency”);

//connect the nodes — this is where the error occurs

//modifier.connect(blinnNode, output1, layeredShaderNode, input1 );

//modifier.connect(blinnNode, output2, layeredShaderNode, input2 );

//modifier.connect(blinnNode, output3, layeredShaderNode, input3 );


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.