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 dirtyBut 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 orNone
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 asTrue
. 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 anot
/ 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 toBaseObject::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 beTrue
if the cache is dirty or any object's parameter has become dirty.Cheers, R
-
jeah, my bad, happens when you write stuff on the train. I was mixing up
BaseObject.CheckCache
withGetCache
.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 thatop.IsDirty(c4d.DIRTY_DATA)
returning True when I Move, Scale, Zoom or Rotate the perspective view.