On 09/06/2016 at 10:08, xxxxxxxx wrote:
Cinema 4D Version: R17
Platform: Windows ;
Language(s) : C++ ;
I've made a plugin but almost eachtime I move the mouse CopyTo is triggered to all my objects (also GetVirtualObject).
And this has a really huge performance penalty in my case since I need to clone highres meshes.
Anyone have suffered this in the past?
On 09/06/2016 at 10:16, xxxxxxxx wrote:
CopyTo is called whenever necessary. There is nothing you can do about it.
It rather sounds like your object does not correctly build its cache (or is somehow forced to rebuild). Some code might be helpful.
On 09/06/2016 at 10:57, xxxxxxxx wrote:
Your response about cache sounds coherent.
My object contains some PolygonObject * inside and it returns a copy of one of them depending on parameter, obviously if I'm only orbiting around it that doesn't change but CopyTo and GetVirtualObjects are suffering continuous calls.
Is there anyway to say that cache is already ok?
On 09/06/2016 at 13:27, xxxxxxxx wrote:
Here is one way to check that the cache doesn't need to be rebuilt in GetVirtualObjects(). Please, check out the API documentation and example object plugins (cinema4dsdk) for other possibilities:
// Check if this needs rebuild and get cloned hierarchy of input objects
Bool dirty = op->CheckCache(hh) || op->IsDirty(DIRTYFLAGS_DATA);
On 10/06/2016 at 02:21, xxxxxxxx wrote:
Thank you for your response, unfortunatly CopyTo is triggered before so op is dirty.
On 13/06/2016 at 04:07, xxxxxxxx wrote:
without your code it's pretty hard to tell.
While there might be problems with your dirty checks, I'm also wondering, if you might be returning nullptr from GVO? This would certainly trigger C4D to call your GVO over and over again.
But instead of guessing, it's probably best to share some of your code (GVO and CopyTo).