riotnrrd
riotnrrd
About Me
Connect
LOCATION
Not Specified
WEBSITE
Houdini Skills
Availability
Not Specified
Recent Forum Posts
Copying points from one GU_Detail to another Oct. 4, 2012, 6:46 p.m.
To answer my own question, I can track the current index of the point I'm adding, and then use the indexToOffset() function to get the offset I need.
Copying points from one GU_Detail to another Oct. 4, 2012, 2:06 p.m.
I'm writing a SOP in C++. I have an input GU_Detail and I wish to copy some its points, including all attributes, to my output GU_Detail. However, for each point I decide copy over, I need its GA_Offset, so I can add my own attributes or change the ones that exist. How can I do this?
Right now, I'm doing something like:
// Copy the points and their attributes
for (GA_Iterator it(gdp_input->getPointRange()); !it.atEnd(); ++it)
{
GA_PointGroup* grp = gdp_input->newPointGroup(“tmpgrp”, false);
grp->addOffset(*it);
GA_Range range(*grp);
gdp->mergePoints(*gdp_input, range);
// need the offset here for further operations
}
While this successfully copies points and their attributes from “gdp_input” to “gdp”, it doesn't give me an offset.
I could then do something like:
// need the offset here for further operations
GA_IndexMap tmpMap(*gdp, GA_ATTRIB_POINT);
offset = tmpMap.lastOffset();
}
But there is no indication in the documentation (if it could be called that) of ‘lastOffset’ what exactly ‘last’ means. Is it the most-recently added point? The largest offset? The offset of the largest index? None of these?
Right now, I'm doing something like:
// Copy the points and their attributes
for (GA_Iterator it(gdp_input->getPointRange()); !it.atEnd(); ++it)
{
GA_PointGroup* grp = gdp_input->newPointGroup(“tmpgrp”, false);
grp->addOffset(*it);
GA_Range range(*grp);
gdp->mergePoints(*gdp_input, range);
// need the offset here for further operations
}
While this successfully copies points and their attributes from “gdp_input” to “gdp”, it doesn't give me an offset.
I could then do something like:
// need the offset here for further operations
GA_IndexMap tmpMap(*gdp, GA_ATTRIB_POINT);
offset = tmpMap.lastOffset();
}
But there is no indication in the documentation (if it could be called that) of ‘lastOffset’ what exactly ‘last’ means. Is it the most-recently added point? The largest offset? The offset of the largest index? None of these?
Determine if an input has changed since the last cook Aug. 29, 2012, 1:48 p.m.
Okay. So this does not work:
GU_Topology topo;
int changed = 0;
duplicateChangedSource(0, context, topo, &changed, gdp_input0);
if (changed == 1)
inputChanged = true;
(“changed” is always equal to 1).
But this appears to (kind of; there are some false positives):
int changed = 0;
duplicateChangedSource(0, context, &changed);
if (changed == 1)
{
inputChanged = true;
gdp_input0->copy(*gdp);
gdp->clearAndDestroy();
}
GU_Topology topo;
int changed = 0;
duplicateChangedSource(0, context, topo, &changed, gdp_input0);
if (changed == 1)
inputChanged = true;
(“changed” is always equal to 1).
But this appears to (kind of; there are some false positives):
int changed = 0;
duplicateChangedSource(0, context, &changed);
if (changed == 1)
{
inputChanged = true;
gdp_input0->copy(*gdp);
gdp->clearAndDestroy();
}