HDK : OP/SOP data retrieval via ROP ?

   2440   4   0
User Avatar
Member
301 posts
Joined: 7月 2005
Offline
Hi,

I am pairing up the use of a SOP and ROP node.

Using the ROP_Dumper example, I am traversing the Houdini scene graph.

When I arrived at my custom SOP node, I want retrieve information from that SOP node.

I am new to the cooking/dependency-trigger flow in Houdini

Question I have are:
When I query the SOP, will it automatically do the necessary cook or do I have to call some cooking function ? Assuming there is a chain of SOP before my custom SOP
There are a number of getData*() related function within the OP_Node and SOP class hierarchy, which are the ones useful to HDK developer to retrieve data (cooked/uncooked). The sort of data I am after are geometry related.
I have already successfully retrieve the world transformation matrix, is there a concept of local transformation, is the terminology ‘relative’ in HDK speak ?

Regards
Nicholas Yue
User Avatar
Member
301 posts
Joined: 7月 2005
Offline
Answering part of my own question with some trepidation :

so far, the following works

if (node->getOpTypeID() == SOP_OPTYPE_ID) {
const GU_Detail* gud = static_cast<SOP_Node *>(node)->getCookedGeo(context);
if (gud != 0 ) {
const GEO_PrimList& primitives = gud->primitives();
uint entries = primitives.entries();

The entries count matches what I see via MMB on the SOP
Nicholas Yue
User Avatar
Member
7733 posts
Joined: 7月 2005
Offline
It's recommended to explicitly read or write lock the geo using getCookedGeoHandle() instead.

eg.
SOP_Node *sop = CAST_SOPNODE(OPgetDirector->findNode(path));
if (!sop)
return;
GU_DetailHandleAutoReadLock gdl(sop->getCookedGeoHandle(context));
const GU_Detail *geo = gdl.readLock(); // valid until gdl goes out of scope
User Avatar
Member
301 posts
Joined: 7月 2005
Offline
edward
It's recommended to explicitly read or write lock the geo using getCookedGeoHandle() instead.

eg.
SOP_Node *sop = CAST_SOPNODE(OPgetDirector->findNode(path));
if (!sop)
return;
GU_DetailHandleAutoReadLock gdl(sop->getCookedGeoHandle(context));
const GU_Detail *geo = gdl.readLock(); // valid until gdl goes out of scope

I believe you meant:

const GU_Detail *geo = gdl.getGdp(); // valid until gdl goes out of scope
Nicholas Yue
User Avatar
Member
7733 posts
Joined: 7月 2005
Offline
Yes, sorry. There goes writing code directly into forum posts.
  • Quick Links