On 24/01/2013 at 09:22, xxxxxxxx wrote:
User Information:
Cinema 4D Version:
Platform:
Language(s) :
---------
My plugin has a private attribute AtomArray* objects which is a collection of BaseObject instances.
The objects in this array are not linked in any relationship (free-standing, no document, no parent,
but possibly children). On GVO, I clone these objects and insert the clones under a null-object.
BaseObject\* GetVirtualObjects(BaseObject\* op, HierarchyHelp\* hh) {
LONG count = objects->GetCount();
if (count <= 0) return NULL;
/\* This Null-Object will serve as a "container" for all the
\* other objects. \*/
BaseObject\* root = BaseObject::Alloc(Onull);
if (root == NULL) return NULL;
for (LONG i=0; i < count; i++) {
BaseObject\* reference = (BaseObject\*) objects->GetIndex(i);
BaseObject\* clone = (BaseObject\*) reference->GetClone(
COPYFLAGS_0, NULL);
if (clone == NULL) {
GeDebugOut("ERROR %s:%d - %s: cloning cached reference "
"object failed.", \__FILE\_\_, \__LINE\_\_, \__FUNCTION\_\_);
}
else {
clone->InsertUnder(root);
}
}
/\* FIXME: The cloned objects inserted under `root` are not
\* "recognized" by Cinema 4D. \*/
return root;
}
The objects do not show up in the editor. When casting a CSTO on the generator, the resulting
null-object does not have any children.
Before I began the C++ version, I was attempting a Python version, where this issue occured
and I was hoping it was an issue with Python, but it isn't. You can find the (incomplete, but
enough for demonstration) [Python version here](https://docs.google.com/file/d/0B8i9BbP98pJRUWRzLTVYYnFzOEk/edit).
The internal objects come from the active document, therefore before I add them to my array,
I call GeListNode::Remove() on them. When I store an object in the array that does not come
from the active document (eg. allocated and inserted directly, Remove() not called), the object
is shown. In the following video, the "packed" object is loaded from the HyperFile when the
scene is loaded from the disk, therefore it is shown (because it was allocated and inserted
directly). [Video on Youtube](
)
How can I fix this issue?