[Sidefx-houdini-list] changed inputs

Edward Lam edward at sidefx.com
Tue Jun 5 14:45:33 EDT 2007


Hi Chris,

Ooops, that should have been:

setDuplicateCount(input_num, getInput(input_num)->getCookCount());

The "cook count" is a counter that is incremented upon every cook of a node.

Cheers,
-Edward

Chris Mangnall wrote:
> Hi Edward - thanks very much for your help, it's all working as expected 
> now.  I changed:
> 
> setDuplicateCount(input_num, getInput(input_num));
> 
> to
> 
> setDuplicateCount(input_num, ++myInputCookCount1);
> 
> ..is that correct?  It seems to work...
> 
> Also, in the SOP I'm working on, I was allocating memory for 
> input{1,2}_geo in the constructor, but i missed it out of this stripped 
> down version.  It's a bit spooky that it doesn't crash for me...
> 
> thanks,
> c
> 
> Edward Lam wrote:
>> Hi Chris,
>>
>> 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);
>>   if (changed1)
>>   {
>>      SOP_Node *input = CAST_SOPNODE(getInput(input_num));
>>      if (input && input->error() < UT_ERROR_ABORT)
>>      {
>>          setDuplicateCount(input_num, getInput(input_num));
>>          mySopFlags.setResetGeo(false);
>>       }
>>   }
>>
>> Cheers,
>> -Edward
>>
>> 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.
>>>>
>>>> -Edward
>>>>
>>>> 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.
>>>>>
>>>>> c
>>>>> _______________________________________________
>>>>> Sidefx-houdini-list mailing list
>>>>> Sidefx-houdini-list at sidefx.com
>>>>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>>>
>>




More information about the Sidefx-houdini-list mailing list