Jump to content

2 inputs on a custom Pop?


Recommended Posts

Hello, I'd like to access points feeding the second input of a custom Pop but I don't see how that's done. Looks like in Sops you use "inputGeo" to grab the second inputs data but I don't see the equiv in pops. There aren't many pops that use a second input.. most fetch geometry from a sop path.. is that the way I should go? my second input isn't dynamic partical data so it wouldn't be a problem I guess

still would like to know if the second input thing is possible

thnx

Daniel

Link to comment
Share on other sites

Guest xionmark

Hi Daniel,

I'm not sure if you were asking how to get your POP to accept two inputs or how to grab the geometry coming from the second input. I don't have access to any POP source code at the moment but here's a bit of CHOP code:

void
newChopOperator(OP_OperatorTable *table)
{
 table->addOperator(
    new OP_Operator("file_out",             // Internal name
    "File Out",                     // UI name
    CHOP_file_out::myConstructor,  // CHOP constructor
    &CHOP_file_out::myTemplatePair, // Parameters
    1,                          // Min # of inputs
    2,                          // Max # of inputs
    &CHOP_file_out::myVariablePair) // Local variables
);
}

I believe for any OP the declaration above is almost the same; notice the next to the last line for Max # of inputs.

As for grabbing SOP geo, I think you can use the "getSopGeo (OP_Node *sop, OP_Context &context)" method. And I think the duplicateSource() and getInput() works in POP land too ... but I'm not in the office and am trying to pull (from a VERY tired) memory ...

Hope that helps, I can look into it further Saturday if you haven't figured it out.

Take care,

Mark

Link to comment
Share on other sites

  • 2 years later...

Hello

Actually , I'm doing somehting similar and I have a few questions regarding this topic.

By looking at the sample codes provided by SESI, data.getDetail () returns the geo info for the source. But let's say that I have a collision object and I want to feed that into my pop like in Collision pop.

My first question is how can I look for that specific colliion sop from POP and

the second question is starting from I have heard, starting from Houdini 8.0.387 and onwards getSopGeo() method is obsolete. If that's the case, which method is available to get the handle for the GU_Detail.?

Thanks.

Hi Daniel,

I'm not sure if you were asking how to get your POP to accept two inputs or how to grab the geometry coming from the second input. I don't have access to any POP source code at the moment but here's a bit of CHOP code:

void
newChopOperator(OP_OperatorTable *table)
{
 table->addOperator(
	new OP_Operator("file_out",			 // Internal name
	"File Out",					 // UI name
	CHOP_file_out::myConstructor,  // CHOP constructor
	&CHOP_file_out::myTemplatePair, // Parameters
	1,						  // Min # of inputs
	2,						  // Max # of inputs
	&CHOP_file_out::myVariablePair) // Local variables
);
}

I believe for any OP the declaration above is almost the same; notice the next to the last line for Max # of inputs.

As for grabbing SOP geo, I think you can use the "getSopGeo (OP_Node *sop, OP_Context &context)" method. And I think the duplicateSource() and getInput() works in POP land too ... but I'm not in the office and am trying to pull (from a VERY tired) memory ...

Hope that helps, I can look into it further Saturday if you haven't figured it out.

Take care,

Mark

Edited by mwin
Link to comment
Share on other sites

Well, first you need to have some way to specify the path to your SOP. The easiest way is to have a PRM_STRING parameter for this with the extended type PRM_TYPE_DYNAMIC_PATH. So then after you evaluate the parameter to get your sop path, you find it like this:

SOP_Node *sop = findNode(my_sop_path);

if (sop == NULL)

// flag error as path is invalid.

Now to obtain the geometry, you should obtain a read lock to it like so (see GU_DetailHandle.h)

GU_DetailHandleAutoReadLock gdh(sop->getCookedGeoHandle());

GU_Detail *sop_gdp = gdh.getGdp();

Now you can use sop_gdp as long as gdh exists. When gdh is destructed, the lock will automatically be released.

Link to comment
Share on other sites

cheers Ed!

I'll give it a try.

Well, first you need to have some way to specify the path to your SOP. The easiest way is to have a PRM_STRING parameter for this with the extended type PRM_TYPE_DYNAMIC_PATH. So then after you evaluate the parameter to get your sop path, you find it like this:

SOP_Node *sop = findNode(my_sop_path);

if (sop == NULL)

// flag error as path is invalid.

Now to obtain the geometry, you should obtain a read lock to it like so (see GU_DetailHandle.h)

GU_DetailHandleAutoReadLock gdh(sop->getCookedGeoHandle());

GU_Detail *sop_gdp = gdh.getGdp();

Now you can use sop_gdp as long as gdh exists. When gdh is destructed, the lock will automatically be released.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...