Or just use the Hash.append() method, and you should only need one line for
each knob/variable you want to attach to the Hash. You may also need to add
the input's hash to it if any changes in the input (like changing to a
different frame) should also trigger recalculation.

IE.

// Define these as variables in your Op
Hash oldHash,
Hash newHash;

// then do this in validate()
oldHash.reset();
oldHash.append(_in0->hash()); // _in0 being a pointer to input0
oldHash.append(first_variable);
oldHash.append(second_variable);
... etc

// Compare hashes
  if ( oldHash != newHash ) {
    // do your expensive calculation here
    ......
  }

// Make both hashes equal
newHash = oldHash;


Essentially what John suggested. But maybe a short example will give you
some ideas to find the strategy that suits your case best.

Hope it helps.
Cheers,
Ivan


On Mon, May 9, 2011 at 8:48 AM, Steven Booth <sbo...@legend3d.com> wrote:

>  Just build two arrays; one with pointers to the knobs, and the other with
> their hashes.  The loop code is like five lines long.
>
>
>
> Steve
>
>
>
>
>
> *From:* nuke-dev-boun...@support.thefoundry.co.uk [mailto:
> nuke-dev-boun...@support.thefoundry.co.uk] *On Behalf Of *Stephen Newbold
> *Sent:* Monday, May 09, 2011 8:46 AM
> *To:* nuke-dev@support.thefoundry.co.uk
> *Subject:* Re: [Nuke-dev] Re: Conditional statements based on knob changes
>
>
>
> That's kind of the approach I'm taking but there are a lot of knobs and it
> seems kind of clunky checking a large number of knobs directly.  If it was
> just one or two then this is the way I'd do it.
>
> Just seen John's reply and that seems like a way I only have to check to
> see if the hash has changed for the selected knobs, but I will still have to
> hard code which of my knobs should be hashed.
>
> Steve
>
> Steve3D wrote:
>
> I'm not sure you can keep _validate from being called when a knob is moved,
> but you certainly can remember the last value for each nob in static
> variables, and then simply check to see if a new value has been assigned by
> the knob, executing update code only when it has a new value.
>
> Does that help?
>
>
>
> ------------------------------
>
>
>
> _______________________________________________
>
> Nuke-dev mailing list
>
> Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
>
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
>
>
>
>
>
>
>  --
>
> Stephen Newbold
>
> Senior Compositor - Film
>
> MPC
>
> 127 Wardour Street
>
> Soho, London, W1F 0NL
>
> Main - + 44 (0) 20 7434 3100
>
> www.moving-picture.com
>
>  (CONFIDENTIALITY NOTICE: The information contained in this email may be 
> confidential and/or privileged. This email is intended to be reviewed by only 
> the individual or organization named above. If you are not the intended 
> recipient, or an authorized representative of the intended recipient, you are 
> hereby notified that any review, dissemination or copying of this email, or 
> the information contained herein is strictly prohibited. If you have received 
> this communication in error, please notify the sender by return email and 
> delete this email from your system. Thank You.)
>
>
>
> _______________________________________________
> Nuke-dev mailing list
> Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
>
>
_______________________________________________
Nuke-dev mailing list
Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to