[Sidefx-houdini-list] changed inputs
edward at sidefx.com
Mon Jun 4 16:43:42 EDT 2007
I got a crash as soon as I tried cooking your example because we were
passing uninitialized GU_Detail pointers. To get it to run at all, I had
to change input11_geo and input2_geo into full GU_Detail objects and
pass their addresses to duplicateChangedSource() like so:
duplicateChangedSource(1, context, input1_top, &changed1, &input1_geo);
duplicateChangedSource(2, context, input2_top, &changed2, &input2_geo);
After that, it worked as expected because that version of
duplicateChangedSource() which takes a GU_Topology only notifies of
topology changes and not point position changes.
If you used the other versions of duplicateChangedSource() without
GU_Topology, then it will notify of any changes in the input. However,
it will necessarily duplicate the particular input's geometry into your
current gdp, which you may or may not want.
So for the other inputs, you may wish to consider using
SOP_Node::checkChangedSourceFlags() for changes, and then manually
updating the duplicate counter yourself instead of relying on
duplicateChangedSource(). Something like this (UNTESTED):
- Create a member variable to keep track of the cook counter.
eg. int myInputCookCount1;
- In your cookMySop() method:
int input_num = 1;
checkChangedSourceFlags(input_num, context, &changed1);
SOP_Node *input = CAST_SOPNODE(getInput(input_num));
if (input && input->error() < UT_ERROR_ABORT)
Chris Mangnall wrote:
> Hi Edward,
> Attached is a simple SOP and hip file. Changing the topology of the
> grids triggers a change, but simply translating them around doesn't...
> I'm using houdini 8.2.66 and uname -a
> Linux henley 2.6.17-1.2143_FC4smp #1 SMP Mon Jul 31 17:51:15 BST 2006
> x86_64 x86_64 x86_64 GNU/Linux
> Edward Lam wrote:
>> Hi Chris,
>> It should work. Try stripping your problem down to as simple a SOP as
>> possible first. And if that doesn't work, try posting your simple code
>> to the list. Make sure you're giving it the correct input index. :)
>> I assume you're using Houdini 7.0 or later though. In earlier
>> versions, it would only work for a single input.
>> Chris Mangnall wrote:
>>> Hi - HDK question...
>>> Is there a reliable way to determine if a SOP input has changed at
>>> all? I'm using duplicateChangedSource(...) and fetching the
>>> 'changed' flag, but the flag returns 0 if i just transform/edit the
>>> input points.
>>> I'm writing a three-input deformer SOP, and there's a whole bunch of
>>> heavy processing that only needs to be done if either of the first
>>> two inputs have changed.
>>> Sidefx-houdini-list mailing list
>>> Sidefx-houdini-list at sidefx.com
More information about the Sidefx-houdini-list