What inputs does a particleInstancerNode need?

What inputs does a particleInstancerNode need?

haggi_master
Advocate Advocate
549 Views
2 Replies
Message 1 of 3

What inputs does a particleInstancerNode need?

haggi_master
Advocate
Advocate

Hi,

I wrote a shape node which reads particle data via the Disney open source Partio library what works quite fine. Now I want be able to output the correct data in a way which allows me to connect the ouput to an particle instancer node. As much as I know this is a quite complex nested compound attribute. Does anyone know the structure of such an attribute?

0 Likes
Accepted solutions (1)
550 Views
2 Replies
Replies (2)
Message 2 of 3

haggi_master
Advocate
Advocate

What I have tried so far is defining an output as:

 

	outInstanceData = tAttr.create( "outInstanceData", "outInstanceData", MFnData::kDynArrayAttrs);
	tAttr.setStorable(false);
	addAttribute( outInstanceData );

And in the compute method I created some test Data:

 

		MFnArrayAttrsData	instancePointDataFn;
		MObject				instancePointDataObj = instancePointDataFn.create();
		MVectorArray		outPosArray = instancePointDataFn.vectorArray("position");
		MIntArray			outIdArray = instancePointDataFn.intArray("id");
		MDoubleArray		outAgeArray = instancePointDataFn.doubleArray("age");

		MDataHandle instanceDataHandle = datablock.outputValue(outInstanceData);
		instanceDataHandle.setMObject(instancePointDataObj);

		outPosArray.append(MVector(0,0,0));
		outPosArray.append(MVector(1,0,0));
		outPosArray.append(MVector(2,0,0));
		outPosArray.append(MVector(3,0,0));

		outIdArray.append(0);
		outIdArray.append(1);
		outIdArray.append(2);
		outIdArray.append(3);

		outAgeArray.append(0.0);
		outAgeArray.append(0.1);
		outAgeArray.append(0.2);
		outAgeArray.append(0.3);

		datablock.setClean(plug);

But this was not successful, I do not see any instances. So what's wrong here?

0 Likes
Message 3 of 3

haggi_master
Advocate
Advocate
Accepted solution

If I set the line

instanceDataHandle.setMObject(instancePointDataObj);

at the end before the setClean(), the whole thing works fine.

 

0 Likes