Replace "Shape Node"?
-
Hi,
In Maya, an object in the outliner is usually represented by a
shape node
and atransform node
.
Shape node is what you see in the viewport. Transform node is what holds the PSR data, among others.This separation allows user to swap shape nodes (through scripting) easily with no consequence.
Is this possible in C4D?
For example, I want to swap a cube spline with a sphere spline
I can't do it directly since the cube spline is already connected to various xpresso, python tag etc. It will break if I just do so.I just want to have the cube look like a spline (i.e. change the shape node).
Is this possible?
P.S. The expressions the cube is connected into is not points dependent so I will not have problem changing the number of points if necessary.
-
I'm referring to a lazy single command API that I might have missed .lol
Like in Maya, it would be justparent -r -s
. haha.If there's no direct API, no worries.
I probably can get away with it with
ResizeObject
. And just store the point position of source spline and modify the point position of the target spline. No need for illustration code.Just need a confirmation if such API call exist. Thanks!
-
Hello @bentraje,
Thank you for reaching out to us. This is a tricky question to answer, especially since you do not clarify what you would expect that function to do exactly.
When I take here all hints and assume a bit, then the answer is: No, in a classic API scene graph this is not possible in the way you probably think about it, but in a maxon API scene graph it is.
Scene Graphs
The classic API scene graph, i.e., things you see in the Object, Material, etc. managers, is organized as a monohierarchical structure (with a twist), while the Nodes API and Maya are inherently polyhierarchical. A common example of a monohierarchy would be a classical file system. Every node in a classical file system can have exactly one parent, it cannot appear twice in two separate places. A common example of a polyhierarchy is the human family. Here a child usually has more than one parent (both Alice and Bob consider Carol to be their child).
Technically speaking, polyhierarchies are not really hierarchies but directed acyclic graphs, a.k.a., 'a scene graph'. A monohierarchy is what we usually call 'a tree'. The classic API scene graph puts a twist on the tree concept, branches, but it would be more aptly named as a scene tree. At its core it is however bound to this
1:N
relation, opposed to Nodes API scene graphs or Maya, which express relations in the complexity ofN:N
.With this fundamental difference also follow many other changes, ranging from a more granular node model to high level things as dependency relations. In the end, this means that you can drive two geometries with the same transform in a Scene Nodes scene and Maya, but you cannot in a classic API scene. Switching out the geometry of a node, replacing a cube with a circle spline, is only a variation of the same problem.
What Can I Do?
Okay, that was a lot of tech blah-blah for a simple question. But I explained this to highlight how deeply rooted the problem is. You can of course just replace data:
- By using the Replace With Command. It does some heavy lifting for you, but it will also break links and will not copy over many forms of data. Transforms are however preserved.
- By writing something yourself in Python as indicated by yourself. Here you could be more specific about what you want to happen, but this can be a lot of work. You cannot really escape the fact that a classic API scene is organized as a tree, and your idea of 'replacing just one aspect of an entity' requires conceptually a true scene graph.
You could also simply use Scene Nodes, as there this all no problem:
Cheers,
Ferdinand -
Thanks for the outlining the limitation.
For options
- Yep the replace command does not carry over the connection so that's a no go.
- I just went with the python route. Works as expected. Basically, I just deleted all the points of the spline object through the resize object. Then rebuild it again with the reference. No problem so far.
RE: scene nodes.
Uhm I really find the nodes implementation clunky at the moment and this is coming from a user who uses Houdini.
No plans in implementing it at all in my workflow.And the pyro being implemented as a tag and not as a scene nodes set-up tells a lot that they are not confident in that workflow. Too convoluted for what it is trying to achieve and doesn't use "attributes" like what Houdini and Blender can. I find it as a "toy" at the moment rather than an actual production tool.Anyway, will close this thread for now.