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..