you could pickle to a string and then add that to a string attribute on the 
node.  the advantage of .messages is that if a node is moved in the DAG or 
renamed the connection remains, but pickled string data containing object names 
will become invalid.  ( on a side note: houdini creates a unique id for every 
node in every file for all time.  that's pretty handy.  i wish that maya would 
do that natively, though there are ways of hacking it into place.)

-chad



On Jan 12, 2010, at 9:10 PM, JP wrote:

> Hi all,
> 
> I'm currently working on a script that allows for space-switching
> between objects, and came across some general questions regarding data
> persistence.
> 
> In short, I have a couple classes I've created that represent parents,
> children, etc, and was thinking about how to keep track of some of
> this data.  In the past, I've used the tried-and-true method of
> connecting .message attributes between objects and then checking for
> them later.  While this works, it's not terribly elegant, and when I
> start having a lot
> of data I want to keep track of, it becomes cumbersome to inspect all
> of those connections.
> 
> I was wondering if anyone had experimented with creating file-like
> objects from script nodes (or other nodes) that would allow something
> like this:
> 
> f = ScriptNodeFile("spaceSwitching", "r")
> f.write("Some line of text \n.")
> f.close()
> 
> It would also be very very cool if you could pickle data to this
> ScriptNodeFile object!
> 
> Obviously, pickling/saving an external file with this data would work,
> but I'm almost certain these would be quickly lost in our file
> system.  I think it would be very handy indeed to be able to store and
> recall data to a node within the scene file.  Just wondered if anyone
> out there had come across anything like this, or had any bright ideas
> that might help me with this sort of thing.
> 
> Thanks!
> -- 
> http://groups.google.com/group/python_inside_maya

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to