PDA

View Full Version : Outputting String Data From A Shader


Pars
11-23-2005, 01:49 PM
Hi, im trying to learn the maya api and c++ and have been going through the shader examples in the devkit (specifically the geomShader).
Ive been attempting to add an additional output to the node for string data. I managed to add an output for float data without many problems but am having trouble outputting string data.
Aside from adding the attribute to the node etc i added the following code..

MStatus GeomNode::initialize()

MFnTypedAttribute sAttr;

aTestRa = sAttr.create( "TestAttribute", "r", MFnData::kString);
MAKE_INPUT(sAttr);
aOutTest = sAttr.create("outTest", "ot", MFnData::kString);
MAKE_OUTPUT(sAttr);

MStatus GeomNode::compute( const MPlug& plug, MDataBlock& block ) {

char& resultTest = block.inputValue( aTestRa ).asChar();

MDataHandle outTestHandle = block.outputValue( aOutTest );
char& outTest = outTestHandle.asChar();
outTest = resultTest;
outTestHandle.setClean();

When i compile i dont recieve any errors but the outTest attribute doesnt appear in the list of outputs for the node from within the hypershade. If any is able to shed some light onto this then it would be greatly appreciated. I think i need to use the MFnStringData class but am not sure how to use it :/

thanks

CGTalk Moderation
11-23-2005, 01:49 PM
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.