Hey y'all!

I think I may have asked my question confusingly - I don't really need for
this data to persist across nuke sessions, it's just for interactive use.
The "monkey patching" idea seems to be a good one, and I'm going to go with
that for now.

Chris

On Thu, Jan 26, 2012 at 2:31 PM, jrab <[email protected]>wrote:

> **
> Hey Chris!
>
> On the serialization front, maybe try to pickle your object to a node's
> txt or string knob? If it's something you want to read from disk just once
> (when the script is launched maybe?), then use a
> nuke.addOnScriptLoad(getObjAndPickle)callback and with it, get your object
> and pickle it to use anytime.
>
>  *Code:*  import cPickle
>
> def pickleObjToNode(node, obj, txtKnob='pcl'):
>     """pickleObjToNode(node, obj, txtKnob='pcl') -- write an object in
> pickle
>     format to the txtKnob on a node
>     """
>     pcl = cPickle.dumps(obj)
>     node[txtKnob].setValue(pcl)
>
>
> def getPclObj(node, txtKnob='pcl'):
>     """getPclObj(node, txtKnob='pcl') -- retrieve the pickled object
> stored in the txtKnob
>     """
>     return cPickle.loads(node[txtKnob].value())
>
> jrab
>
> _______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>


-- 
I think this situation absolutely requires that a really futile and stupid
gesture be done on somebody's part. And we're just the guys to do it.
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to