Yes, this is not reliable.  My example was very specific in not doing
that, and in fetching values out of knob()->get_value() directly, which
will work.

On Thu, 2011-06-16 at 10:03 -0700, Nathan Rusch wrote:
> Ah, that did the trick... mostly.
> 
> Unfortunately, the knob updating seems to be a little lazy. However, this 
> may be a result of some bad order-of-operations on my part.
> 
> Currently I'm using a private bool pretty much directly as the feedback 
> knob's value. This bool is being set in _validate (skeleton code is included 
> below). The bool is used in request and engine to determine which input to 
> use, and that part of things seems to be working fine (which makes me think 
> it should be safe to use as the feedback value). However, the knob seems to 
> be failing to update fairly randomly. Sometimes it's one change behind, and 
> sometimes it just doesn't do anything.
> 
> ----------------------------------------------------------------------------------
> 
> class HashSwitch : public NoIop, public ArrayKnobI::ValueProvider
> {
>     bool m_useMeta;
>     int m_which;
> 
> public:
>     HashSwitch(Node* node) : NoIop(node
>     {
>         inputs(2);
>         m_useMeta = false;
>         m_which = 0;
>     }
> 
>     void knobs(Knob_Callback f)
>     {
>         Knob* wch = Int_knob(f, &m_which, "which")
>         wch->set_flag(Knob::DO_NOT_WRITE);
>         if (f.makeKnobs())
>         {
>             dynamic_cast<ArrayKnobI*>(wch)->setValueProvider(this);
>         }
>     }
> 
>     std::vector<double> provideValues(const ArrayKnobI*, const 
> OutputContext& oc) const
>     {
>         std::vector<double> values;
>         values.push_back(m_useMeta);
>         return values;
>     }
> 
>     void _validate(bool for_real)
>     {
>         // Test metadata from one input against hash generated from other 
> input
>         // then do copy_info() on one input or the other and set m_useMeta 
> to true/false
>         // based on whether the hashes match.
> 
>         // Is this bool unreliable as a feedback value?
>     }
> }
> ----------------------------------------------------------------------------------
> 
> Any thoughts?
> 
> Thanks for your patience on this one,
> 
> -Nathan
> 
> 
> 
> -----Original Message----- 
> From: Abigail Brady
> Sent: Thursday, June 16, 2011 2:25 AM
> To: Nuke plug-in development discussion
> Subject: Re: [Nuke-dev] Using knob as a feedback device
> 
> Oh, sorry, I think that's a new thing in 6.3.  if f.makeKnobs()
> dynamic_cast the Knob to ArrayKnobI and call setValueProvider() on that,
> I believe is the actual answer. 
> 
> _______________________________________________
> Nuke-dev mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev


-- 
Abigail Brady, Senior Architect
The Foundry, 6th Floor, 48 Leicester Square, London. WC2H 7LT
Tel: +44 20 7968 6828 * Fax: +44 20 7930 8906
Web: www.thefoundry.co.uk

The Foundry Visionmongers Ltd
Registered in England and Wales No: 4642027

_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to