PDA

View Full Version : Storing hypergraph/node


tommix
03-08-2011, 06:58 PM
Hi guys,

Working in python, I want to copy part of the hypergraph in memory. I thought to go node by node, listing and storing their connections.

I need to save the state of a node somewhere (for instance, into an object) and be able to recreate an exact copy of that node later on. That means no use of cmds.duplicate() function.

What I am looking for is a general procedure that works for any kind of node. for instance, if we have a transform node, it will store the transform data, plus all the hidden values. If the node is a shape, I would be able to save all the geo points and so on.

I could use the flag type to first recognize the type of node and reinstantiate it by using cmds.createNode(<nodeType>, ...), but in this way I create an ex-novo node of the same type of the previous, without copying all the information stored in.

I tried to iterate over all the attributes and store their values, but even using flags such as "r" for the readable only, "hd" for the hasData attributes and so on, I still get weird results.

Anybody out there can figure a solution? Maybe the solution the simplest one, but my ideas lightbulb is dark so far..

Thanks.


Tommaso

NaughtyNathan
03-08-2011, 09:10 PM
Export Selected...? ;)

:nathaN

tommix
03-08-2011, 09:27 PM
Uhhmm.. Yes and no. I would be able to have a copy of the whole structure in memory, so I can act on specific nodes and links and rebuild the whole network, without the need of navigating through the scene. But you gave me a good input to find a workaround and just in case probably the solution of exporting the selected object and then doing my stuff during the import may work.. I will let you know.

Thank you

CGTalk Moderation
03-08-2011, 09:27 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.