On 03/05/2018 at 06:01, xxxxxxxx wrote:
Hi Maxime & Andreas, thanks for the reply.
>> Polygon objects within a cache are read-only.
I am not making modifications to the polygon objects inside existing caches -- I am creating new
Polygon Objects. However when I recognize that the Polygon Object that I would build from scratch
already exists in the cache due to the previous call to GetVirtualObjects(), I want to re-use that.
Similar to returning the whole cache, as it can be seen in some of the example ObjectData plugins:
if (nothing changed) {
return op->GetCache(hh);
}
I may want to select only some of the Polygon Objects in the cache.
AutoAlloc<BaseObject> root(Onull);
BaseObject* cache = op->GetCache(hh);
for (auto&& obj : input_objects) {
if (nothing_changed && cache) {
BaseObject* cache_obj = FindObjectInCache(cache, GetUuid(obj));
if (cache_obj) { // Reuse the object
cache_obj->Remove();
cache_obj->InsertUnder(root);
continue;
}
AutoAlloc<PolygonObject> poly(0, 0);
// ... build polygon object
poly->InsertUnder(root);
poly.Release();
}
}
This works without problems as far as I can see. Just to check whether this causes the issue that
you can not navigate on top of the object, I tried cloning the object from the cache (which would
not be desirable) and I get the same problem.
if (cache_obj) { // Reuse the object
cache_obj = (BaseObject* ) cache_obj->GetClone(COPYFLAGS_0, nullptr);
if (cache_obj) {
cache_obj->Remove();
cache_obj->InsertUnder(root);
continue;
}
}
>> About your issue of the bounding box, make sure to override GetDimension.
Overriding GetDimension() will not solve the problem that I am facing.
I try to be more descriptive: When you have an object in the Viewport, you can press ALT and LEFT
MOUSE BUTTON to pivot around the object at the location where your cursor intersects with the
geometry.
This does not work in my case. And I am wondering if you have any clues where this could be
coming from. My initial guess was that I needed to use MSG_UPDATE before I return the object,
but that didn't help.
Here is a small video that hopefully clarifies the issues: https://public.niklasrosenstein.com/_quickshare/2018-05-03-generator-polygonobject-navpivot.flv
The cube is a standard cube, the two cars are both Polygon Objects returned by my generator.
Any idea what could cause the Pivot to not recognize the geometry from my generator?
Thanks for looking into this.
Cheers,
Niklas