Hi @r_gigante, @zipit,
I'm creating something like the following code. I tried to use the GetAndCheckHierarchyClone, this works but the cloner object became to slow to calculate. For this reason I used the following solution:
def __init__(self):
pass
#self.SetOptimizeCache(True)
def GetVirtualObjects(self, op, hh):
instance = op.GetDown()
if instance is None:
return c4d.BaseObject(c4d.Onull)
dirty = op.CheckCache(hh) or op.IsDirty(c4d.DIRTY_DATA)
instance_dirty = instance.IsDirty(c4d.DIRTY_DATA)
dirty |= instance_dirty
if not dirty:
return op.GetCache(hh)
cloner = c4d.BaseObject(c4d.Onull)
count = 3
n = 0
while n < count:
instance.GetCache().GetClone().InsertUnder(cloner)
n += 1
cloner.Message(c4d.MSG_UPDATE)
return cloner
So, by just deactivating the SetOptimizeCache and cloning only the cache of the instance object the cloner object calculate is become to fast. The unique problem now is the cloner object is return the cache of previous modification on the instance object. This is perceptible only with bool parameters.
Example:
When I check a bool parameter of the instance object, the cloner return the result of the previous state of the bool parameter. but if I mouseover the cloner in the Viewport or I select it object manager this update the cloner object.
Thanks