How do I get the cache of a cloner in an ObjectData Plugin
-
Hi, sorry for this as always dumb question.
I was trying to get the Cache of a cloner object in the GetVirtualObjects(self, op, hh) method.
First I tried it in the python generator, there was already a cloner in the scene and in the python generator I returned the cache so to say, but this approach doesn´t work out in an object plugin.
Even if I create a temp_doc. The returned cache is always None.
But converting the cloner with a ModelingCommand is not the best way, if the cloner produces for instance a million clones.This method works in a python generator when the clone is already in the scene
cloner = op.GetDown() return cloner.GetCache().GetClone()
But creating a cloner and returning its cache doesn`t work.
cloner = c4d.BaseObject(1018544) c4d.BaseObject(c4d.Ocube).InsertUnder(cloner) return cloner.GetCache().GetClone()
Is there a way to get the cache in a plugin?
Sweep, Extrude, other Generators, Deformers and parametric objects work perfectly. -
Hey @ThomasB,
thank you for reaching out to us. First of all, there are no dumb questions Caches must be built, and a newly allocated object has no cache. Please have a look at geometry_caches_s26.py for an introduction into caches, including how to build them.
Cheers,
Ferdinand -
@ferdinand
oh man thanks I forgot thisBaseDocument.ExecutePasses(bt=None, animation=False, expressions=False, caches=True, flags=c4d.BUILDFLAGS_NONE)
I tried that before but it seems I have set the caches parameter wrong.
Thank you very much.... -
Good to hear!