SOLVED Check if the object parameters has been changed

Hello,

The following line of code is supposed returning True only if parameters of the object changed? But why it also returning True when my object selected and I Move / Scale / Zoom / rotate the perspective view.

# dirty = True if a cache is dirty or if the data (any parameters) of the object changed.
dirty = op.CheckCache(hh) or op.IsDirty(c4d.DIRTY_DATA)

Thanks.

Hi @mfersaoui thanks for writing us.

The following line of code is supposed returning True only if parameters of the object changed?

That's partially true: the expression can be True also if the object's cache is dirty

But why it also returning True when my object selected and I Move / Scale / Zoom / rotate the perspective view.

That's weird and to answer here you've to show how you're using it with the rest of your ObjectData::GetVirtualObjects() method.

Best, R

Hi,

I am a bit confused about @r_gigante answer, I might be misunderstanding something here.

BaseObject.GetCache will return the hierarchical cache tree for an object or None if neither the object nor its cache children has a cache.

Since objects (in a pythonic sense) do evaluate as True, your expression will evaluate in 99% of the cases as True. The natural language version of the expression would be: Has the object been touched or has itself or one of its cache children a cache? You are probably missing a not/ negation in your expression.

Cheers,
zipit

@zipit: I'm a bit confused of your remarks here as well 🤣
In my answer I see no reference to BaseObject::GetCache() here and looking at the documentation of both methods reported in the initial boolean expression, to answer first @mfersaoui's question, it results to be True if the cache is dirty or any object's parameter has become dirty.

Cheers, R

@r_gigante

jeah, my bad, happens when you write stuff on the train. I was mixing up BaseObject.CheckCache with GetCache.

Cheers,
zipit

Hi, Thank you @r_gigante, @zipit for your replies.

The problem comes from the GetDDescription funtion because I use some of dynamic parameters on my objects.
It is for this reason that op.IsDirty(c4d.DIRTY_DATA) returning True when I Move, Scale, Zoom or Rotate the perspective view.