Strange Bug with Correction Deformer and Bounding Box Node
-
Hey there,
I am making use of the trick where I put a correction deformer under a generator (extrude object in this case) to make it readable by the bounding box xpresso node
However, for some strange reason it only works when I add the deformer manually to the scene.
Using python to create the object somehow makes it impotent for this method.
Even dragging it out of the hierarchy and back in again, refreshing xpresso etc. doesn't help with the problem.Only creating a new deformer manually seems to do the trick.
Please help me make sense of this and fix it.
Thank you
-
Hello @interfaceguy,
Thank you for reaching out to us. Please provide the executable code with your questions, as we are otherwise guessing what you are doing. I am not going to unpack here what you could potentially be doing when you say 'using python to create the object', and why each of these options might be going wrong.
With that being said, I am a bit puzzled by why you choose this approach in general. Inserting a correction deformer only to get the bounding box of an object seems wildly inefficient. I would understand it if you were a user who is unwilling to touch Python, but since you are not, why not simply get the bounding box yourself? Am I overlooking here some Xpresso conventions or problems? I am not a big Xpresso user, so my apologies when I am overlooking something obvious.
I have provided a small example below. You could of course fashion this differently with min and max values, evaluating different caches, etc. I am just piping through the
BaseObject
methods in the example to keep things simple.If you want more help with your original solution, please provide an executable example scene.
Cheers,
FerdinandThe file: gv_py_bounding_box.c4d
The result:
The code for the Get Bounding Box node:"""Example for a GV python node which retrieves the bounding box of an object. """ import c4d op: c4d.modules.graphview.GvNode # The Xpresso node Object: c4d.BaseList2D # In: The object to measure the bounding box for. Offset: c4d.Vector # Out: The bounding box center. Radius: c4d.Vector # Out: The bounding box radius. def main() -> None: """Called by Cinema 4D to execute the node. """ global Offset, Radius # Pass the null vector for the results when the passed BaseLink is either # None or not a BaseObject. if not isinstance(Object, c4d.BaseObject): Offset, Radius = c4d.Vector(), c4d.Vector() # Otherwise return the bounding box values of the object. else: Offset = Object.GetMp() Radius = Object.GetRad()
-
Oh yes that's a much better approach!
I will provide executables from now on, sorry for the trouble
To be honest I was just stuck in an inaccurate frame for how to solve this... thanks for breaking it