Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search

Update size of cube [SOLVED]

Author
Message
  Topic Search Topic Search
casimirsmets View Drop Down
Member
Member


Joined: 2013 Apr 29
Location: Belgium
Online Status: Offline
Posts: 321
Direct Link To This Post Topic: Update size of cube [SOLVED]
    Posted: 2015 Jun 04 at 2:34am

User Information:

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

---------

Hi,

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!
Greetings,
Casimir Smets
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1878
Direct Link To This Post Posted: 2015 Jun 04 at 7:20am
Hi Casimir,

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

Cheers,
Andreas
SDK Support Engineer
Back to Top
casimirsmets View Drop Down
Member
Member


Joined: 2013 Apr 29
Location: Belgium
Online Status: Offline
Posts: 321
Direct Link To This Post Posted: 2015 Jun 04 at 8:07am
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!

Greetings,
Casimir Smets
Back to Top
casimirsmets View Drop Down
Member
Member


Joined: 2013 Apr 29
Location: Belgium
Online Status: Offline
Posts: 321
Direct Link To This Post Posted: 2015 Jun 05 at 2:20am
Hi,

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
Back to Top
casimirsmets View Drop Down
Member
Member


Joined: 2013 Apr 29
Location: Belgium
Online Status: Offline
Posts: 321
Direct Link To This Post Posted: 2015 Jun 05 at 5:17am
Hi,

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!

Greetings,
Casimir Smets


Edited by casimirsmets - 2015 Jun 05 at 6:15am
Back to Top
casimirsmets View Drop Down
Member
Member


Joined: 2013 Apr 29
Location: Belgium
Online Status: Offline
Posts: 321
Direct Link To This Post Posted: 2015 Jun 08 at 2:00am
Hi,

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


Edited by casimirsmets - 2015 Jun 08 at 2:02am
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1878
Direct Link To This Post Posted: 2015 Jun 09 at 10:20am
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.

Cheers,
Andreas
SDK Support Engineer
Back to Top
casimirsmets View Drop Down
Member
Member


Joined: 2013 Apr 29
Location: Belgium
Online Status: Offline
Posts: 321
Direct Link To This Post Posted: 2015 Jun 09 at 11:03am
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!

Greetings,
Casimir Smets
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1878
Direct Link To This Post Posted: 2015 Jun 09 at 11:04am
I already added this to the docs, will show up with next update.
Cheers,
Andreas
SDK Support Engineer
Back to Top
casimirsmets View Drop Down
Member
Member


Joined: 2013 Apr 29
Location: Belgium
Online Status: Offline
Posts: 321
Direct Link To This Post Posted: 2015 Jun 09 at 11:08am
That's great to hear!
Also, the support team is really getting better and better! That's very nice! :)
Keep it up, guys ;)

Greetings,
Casimir Smets
Back to Top

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.110 seconds.