Accessing multiple input context geometry in a POP Node?

   3749   2   2
User Avatar
Member
5 posts
Joined: Jan. 2011
Offline
Hi,

I am writing a POP Node, that generates & drives particles with a velocity field. This field is based on some other reference geometry. I'm having two inputs for my pop network: the particle source and the reference geometry, and now inside the network, I have a POP, how can I access the reference geometry(second input in the pop network) in that POP node (e.g. when cookPop-ing)? Also, this reference geometry is not necessarily related to particle, it is just one or a few nurbs.

Thanks!

-yong
User Avatar
Member
543 posts
Joined: July 2005
Offline
Hello,

If you want to read geometry outside of your POP network (from a SOP network), you can do something like this:


POP_ContextData* data = (POP_ContextData*) context.getData();
GU_Detail gdpcopy;
UT_String myGeoSOP = “/obj/collision_geo/OUT”;

GU_Detail * myCollisionSource = getGeo(myGeoSOP,
data, // Context data for context geos
t, // Time to cooksops at
1, // Add extra inputs so we recook if SOP does
0, // Ignore object level transforms
&gdpcopy, // Where to store result if we need to transform
0 /*&myPrevSop*/, // Tracks last SOP so we can detect changes
0 /*&doXform*/, // If transform was needed
0 /*&xform*/, // What the transform was
0 /*&myNeedResetAttractor*/ // Did the SOP change?
);

if(!myCollisionSource) {
addError(POP_INVALID_SRC);
return error();
}

long int numCollisionFaces = myCollisionSource->primitives().entries();


If you need to read particles from a different input on your POP, I'm not sure, I just ran into a problem but can post what I find if you need that too.


Take care,
Mark
========================================================
You are no age between space
User Avatar
Member
5 posts
Joined: Jan. 2011
Offline
Thanks, Mark!

I am doing

OP_Context sopContext(t);
GU_Detail *dfil = (GU_Detail*) node->getCookedGeo(sopContext);
if(!dfil){
addError(POP_NO_SOP_DETAIL ,“Could not get the detail from the specified sop ”);
return error();
}
myGuide->duplicate(*dfil);

It doesn't always display myGuide until I refresh the node, but seems yours is better.
  • Quick Links