Update size of cube [SOLVED]

On 04/06/2015 at 02:34, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R16 
Platform:      Mac OSX  ; 
Language(s) :     C++  ;


I'm coding an objectData plugin.
I create a complex hierarchy in GetVirtualObjects, which gets editable when a button is pressed.
My problem is, C4D doesn't update the size of the objects in the coordinate manager.
In the viewport it is no problem.
I'm not sure if I will need it, but it is possible that I have to set up some Xpresso depending on the sizes of objects.
Well, with my objects having wrong values in the coordinate manager, I guess you can understand that that will get a bit tricky.

Now, I've found a way to change those values to the correct values, by pressing enter on one of the size edit fields in the coordinate manager. However, this is after my plugin gets editable (and gets the XPresso files) so it's too late for me.

Is there a way to do this programatically?
If you need more information, just ask me!

Thanks in advance for your help and time!
Casimir Smets

On 04/06/2015 at 07:20, xxxxxxxx wrote:

Hi Casimir,

I'm not sure I understand the problem completely.
Did you correctly implement GetDimension() in your ObjectData plugin?

On 04/06/2015 at 08:07, xxxxxxxx wrote:

Hi Andreas,

I'm looking into that, but I have no idea how to do this for all my children objects.
For the moment I'm looking at examples from other people so I can understand how it works.
Thanks for your help and time!

Casimir Smets

On 05/06/2015 at 02:20, xxxxxxxx wrote:


The method I have now is:

void MyPluginData::GetDimension(BaseObject* op, Vector* mp, Vector* rad)  
  BaseContainer* data = op->GetDataInstance();  
  if (op->GetName == "myCube")  
      *mp = Vector(0, data->GetFloat(CUBE_LENGTH) * 3 / 4 - data->GetFloat(CUBE_HEIGHT) / 2, 0);  
      *rad = Vector(data->GetFloat(CUBE_WIDTH), data->GetFloat(CUBE_LENGTH), data->GetFloat(CUBE_HEIGHT));  

Yet it doesn't change the size of my cube in the coordinate manager.
You just need to implement the method, right? The calls are internally in C4D, or am I missing something? At least the examples don't seem to call it in their code.

In my case the cube is a child of a null object (the plugin object). If I press a button in my plugin, my nullobject + childs get editable. But, at this point, the plugin can't acces the newly generated "editable" object, right? Or am I wrong in this?

Also, I saw another example where someone called GetDimension in another method, which makes me a bit confused.

I'd love to get some directions!
Thanks in advance for your help and time!

With kind regards,
Casimir Smets

On 05/06/2015 at 05:17, xxxxxxxx wrote:


Ok, I've done a little test in another file, with 2 simple cubes.
It seems like you don't have to implement GetDimension() (at least, if you have cubes?).
I did it without the method, and the values in the coordinate manager are correct!
Yet, it does not work in my other plugin, where I have also null-objects (as parents) and spline-objects.
Does that change something?
Also, in my main plugin my plugin-object's bounding box gets updated correctly, but as soon as I make it editable, it doesn't update the bounding boxes of my child cube objects. My spline child-objects get updated correctly.

Of course, with this new information, I totally don't know what to do anymore.
Some help and clarification on this would be heavily appreciated!
Thanks in advance for your help and time!

Casimir Smets

On 08/06/2015 at 02:00, xxxxxxxx wrote:


I have found the problem.
When I make my cubes in GetVirtualObjects() I use current state to object, and then I change the points of my cube. This way, it seems to not call GetDimension(), or not properly.

If I give the cube dimension with SetParameter(PRIM_CUBE_LEN, ...) before I change the points, the bounding box gets updated correctly. So that fixes my problem.

But, I didn't have to implement GetDimension() at all.
So, I'd like to get some information about this.
Can somebody please explain in which situations you have to:
- Implement GetDimension(). Only for polygon objects? Custom objects? Spline objects?
- Call GetDimension()
- Do nothing? (Like in my case)

Also, shouldn't the docs tell us that this happens internally by C4D in some cases?

Thanks in advance for  your help and time!
With kind regards,
Casimir Smets

On 09/06/2015 at 10:20, xxxxxxxx wrote:

GetDimension() should be implemented for objects of types Opolygon, Opoint, Oline and Ospline.
Furthermore it may be implemented, if you do not want Cinema4D's default handling of bounding boxes.

On 09/06/2015 at 11:03, xxxxxxxx wrote:

Hi Andreas,

Thanks for your information! I greatly appreciate it :D
This would be very handy inside the docs :p

You can mark this post as solved!

Casimir Smets

On 09/06/2015 at 11:04, xxxxxxxx wrote:

I already added this to the docs, will show up with next update.

On 09/06/2015 at 11:08, xxxxxxxx wrote:

That's great to hear!
Also, the support team is really getting better and better! That's very nice! :)
Keep it up, guys ;)

Casimir Smets