Hi Kent,
the cast is safe. In the public API, NimbusInterface is an incomplete type. Only NimbusBaseInterface is defined there. But internally, NimbusInterface is derived from NimbusBaseInterface, therefore you can safely do the cast.
Best posts made by o_kniemeyer
-
RE: How to correctly get maxon::NimbusInterface?
Latest posts made by o_kniemeyer
-
RE: How to correctly get maxon::NimbusInterface?
Hi Kent,
the cast is safe. In the public API, NimbusInterface is an incomplete type. Only NimbusBaseInterface is defined there. But internally, NimbusInterface is derived from NimbusBaseInterface, therefore you can safely do the cast. -
RE: Overriding `NodeData::GetAccessedObjects(..)` prevents cache generation of cloned hierarchy
The function
GetAndCheckHierarchyClone
creates clones of all children, therefore it has to read everything from the children and you needACCESSED_OBJECTS_MASK::ALL
in the read part. It'll also mark the children as being consumed by your generator so that they don't create virtual objects on their own (only their clones in the cache of your generator will create virtual objects), and for this mark you needACCESSED_OBJECTS_MASK::CACHE
in the write part.GetAndCheckHierarchyClone
doesn't read global matrices, so theGLOBAL_MATRIX
flag isn't needed.The flags in the other call can be reduced to
access.MayAccess(node, ACCESSED_OBJECTS_MASK::NONE, ACCESSED_OBJECTS_MASK::CACHE)
. That's because yourGetVirtualObjects
doesn't read anything from the generator itself (NONE
), it'll only set up its virtual objects (CACHE
). As soon as you access the BaseContainer of your generator, you have to addDATA
. For the matrixMATRIX
or evenGLOBAL_MATRIX
etc. -
RE: Overriding `NodeData::GetAccessedObjects(..)` prevents cache generation of cloned hierarchy
There's no way for you to know if an object implements
GetAccessedObjects
or not. And even if there was a way, that wouldn't help in general because that implementation could still decide to callMayAccessAnything()
, e.g. based on the object's settings. You need the knowledge that the connect object supportsGetAccessedObjects
AND won't callMayAccessAnything()
in the configuration which you create in your code.The only clean way would be to call
GetAccessedObjects
on the connect object withinMyGenerator::GetAccessedObjects
. That's whatnode->GetAccessedObjectsOfFirstChildHierarchy()
does with the object's children. But you don't have the connect object yet inGetAccessedObjects
, so that's not feasible. -
RE: Overriding `NodeData::GetAccessedObjects(..)` prevents cache generation of cloned hierarchy
Hi Deyan,
your code for GetAccessedObjects is correct. The problem is that you use the connect object, and this object doesn't implement GetAccessedObjects yet. There are a lot of objects in the C4D code base, and we at Maxon haven't had the time yet to implement GetAccessedObjects for all of them.
A GetAccessedObjects implementation has to tell about all access which GetVirtualObjects will make to the scene, and also about all access which the objects created by GetVirtualObjects will make to the scene when GetVirtualObjects is called on them. Also all objects created by GetVirtualObjects have to support GetAccessedObjects. The connect object doesn't, so your code fails.
The connect object will support GetAccessedObjects in 2024.4. So you have to wait a bit, I'm sorry.