Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hi guys. ObjectData::GetDimension() callback is ignored in most of the cases.
When ObjectData::GetVirtualObjects() callback returns null object, in this case GetDimension() is completely ignored. It is the case when it would be most useful!
When ObjectData::GetVirtualObjects() callback returns valid PolygonObject, in this case GetDimension() is again ignored because the plugin is calculating dimension from returned PolygonObject.
Is there some additional settings which needs to be set to force plugin to use GetDimension()?
Thanks!
Hello @wtools3d,
Thank you for reaching out to us. Unfortunately, your question is a bit ambiguous, especially regarding how you register your plugin and what you would consider to be "to be completely ignored", and finally the code you have written.
Our C++ ObjectData example plugin Rounded Tube does overwrite ::GetDimension and it does what I would expect it to do.
ObjectData
::GetDimension
ObjectData::GetDimension
BaseObject::GetDimension
.GetMp()
.GetRad()
OBJECT_ISSPLINE
SplineObject.GetDimension
Calling BaseObject::GetDimension indirectly from Python, the returned value 250, 50, 250 lines up with the value 500, 100, 500 in the Coordinate Manager. Note that GetDimension asks for the 'radii' of the bounding box, not its diameters. So, you must return half the value for each bounding box axis.
250, 50, 250
500, 100, 500
GetDimension
And RoundedTube::GetDimension being called, setting these values, the break point is on the method scope exit, and shown are the returned values for rad:
RoundedTube::GetDimension
rad
Cheers, Ferdinand
Hi Ferdinand. I'll explain each issue separately:
First. try to multiply *rad value by 10, in your example. case 1: *rad = Vector(rady, rado + radx, rado + radx) *10; break;
Then when you try to select this object and use 'Frame Selected Elements' function in the viewport. It will frame to the size of actual geometry not to the overridden size multiplied by 10. So it ignores the override.
This is a different issue as you claim in the title and body of your first posting, and your core claim, that GetDimension is being ignored, is not true. Here I multiply the values by 10.
And as you can see, these values are respected in API calls as well as the Coordinate Manager and other elements of Cinema 4D using them.
Your issue seems to lie with the fact that the multiple frame commands as 'Frame Elements' and 'Frame Geometry' do not frame bounding boxes as yielded by the objects, but the actual geometry. This is not really an SDK issue and there are three things you can do:
Current State to Object
RoundedTube::GetVirtualObjects
if (hh->GetBuildFlags() & BUILDFLAGS::ISOPARM) { lop = GenerateIsoLathe(cpadr, cpcnt, seg); if (!lop) goto error; SetAxis(lop, axis); ret->SetIsoparm(lop); } // --- Start of modifications of RoundedTube::GetVirtualObjects // I just added here a null object as the child of the cache root which // is 2500 units 'above' the root on the y-axis. BaseObject* null = BaseObject::Alloc(Onull); if (!null) goto error; null->InsertUnder(ret); Matrix ml = null->GetMl(); ml.off = Vector(0, 2500, 0); null->SetMl(ml); // --- End of modifications of RoundedTube::GetVirtualObjects DeleteMem(cpadr); return ret; error: DeleteMem(cpadr); blDelete(ret); return nullptr; }
Which will frame then like this when pressing O:
O
Now it's more clear. I assumed behavior of the framing commands on wrong premise.
Maybe you could add some further explanation in the documentation where the overwritten bounding data is used in the cinema.
Thank you for your suggestions how to resolve this on my side!
Regards, Viktor
@wtools3d said in ObjectData::GetDimension() ignored?:
Yes, this is a good idea, I will do that.