PDA

View Full Version : Add layers to a layered texture from the API


lilli
10-15-2004, 06:47 PM
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?

Thanks!

espeno
12-13-2005, 11:52 AM
I face the same problem too. Does anyone have any experience in 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.

Thanks a lot!

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

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

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.setColor(rgbaValues);

b1.setTransparency(MColor(MColor::kRGB,0.957,0.957,0.957));

b1.setDiffuseCoeff(1.00);

b1.setEccentricity(0.085);

b1.setSpecularRollOff(6.00);

b1.setSpecularColor(MColor(MColor::kRGB,1.0,1.0,1.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 );

CGTalk Moderation
12-13-2005, 11:52 AM
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.