I have a SOP node with two inputs. I wish to regenerate some data if and only if the data on input 0 has changed since my last cook. (If input 1 has changed, I do something else.)
Is there a mechanism in the HDK to detect this? I tried using “checkChangedSourceFlags” but even with my upsteam inputs locked, the ‘changed’ flag is always 1.
I am writing this SOP in C++, and using Houdini 12
Determine if an input has changed since the last cook
2061 3 0- riotnrrd
- Member
- 7 posts
- Joined: Aug. 2012
- Offline
- edward
- Member
- 7756 posts
- Joined: July 2005
- Offline
I think you just want to use duplicateChangedSource() which can tell you whether the input changed (at the same time as possibly duplicating your input). See
http://www.sidefx.com/docs/hdk12.1/class_s_o_p___node.html#ae677e74670a4bedf2c5a18b259ba7a8 [sidefx.com]
http://www.sidefx.com/docs/hdk12.1/class_s_o_p___node.html#ae677e74670a4bedf2c5a18b259ba7a8 [sidefx.com]
- riotnrrd
- Member
- 7 posts
- Joined: Aug. 2012
- Offline
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();
}
- edward
- Member
- 7756 posts
- Joined: July 2005
- Offline
-
- Quick Links