redpawfx
'nother question

have you ever used the MArrayDataBuilder  to create an attribute like :
fieldData and fieldPPData
 on a particle object.  I'm trying to replicate that  attribute on a custom node, so I can properly hook up fields to it just like  a particle object.

I tried  a slighty modified version of  something like whats in the multiCurveNode.cpp file,  but it didn't seem to make the attribute  correctly and wouldn't connect. 

any ideas? 

thanks :-)

-johnc


Reply 0 0
pshipkov
Yes, i used it numerous times.

If you build on top of MPxFieldNode you get it for free.

Otherwise you have to figure out what is the structure of the multi attribute there. I never bothered to look at that really.
I think the easiest way is to do it in the script editor using python calls to the C API.

create particles, slap dyn field and then script few lines to get plug

import maya.OpenMaya as om
selList = om.MSelectionList()
selList.add("node.attr")
plug = om.MPlug()
selList.getPlug(0, plug)

Now look at the provided examples on the MPlug() help page - how to get the child plugs and their types of the compound one.

Then replicate the same structure in your code.
Reply 0 0
redpawfx
Thanks that totally helped...

it turns out it was only a standard  MFnCompound attribute afterall

just in case you ever need to do this in the future.

to exactly match the  attributes on a  particle/fluid 

sFieldDataPosition = tAttr.create("fieldDataPosition", "fdp",  MFnNumericData::kVectorArray);
sFieldDataVelocity = tAttr.create("fieldDataVelocity", "fdv", MFnNumericData::kVectorArray);
sFieldDataPosition = tAttr.create("fieldDataMass", "fdm", MFnNumericData::kDoubleArray);
sFieldDataPosition = uAttr.create("fieldDataDeltaTime", "fdt", MFnUnitAttribute::kTime, 0.0);
sFieldData = compoundAttr.create( "fieldData", "fd" );
addChild.. etc...


thanks again  :-)

-johnc


Reply 0 0
pshipkov
Good.

Saving the link to your post for future reference.

Reply 0 0
Reply