Check if an object has changed
-
On 14/05/2014 at 11:24, xxxxxxxx wrote:
I have a IN_EXCLUDE list that contains splines (parametric or freehand)
I need to check if any of these splines changed. If it changed position, rotation, scale, point position or, if it is a parametric spline, if any of the parameters changed.
I tried using IsDirty but it is not working.
How can I check for any change in the splines of the list? -
On 14/05/2014 at 16:45, xxxxxxxx wrote:
It's not the most elegant solution, but you can cache all of the data you want to watch, and then check for changes anytime C4D sends an c4d.EVMSG_CHANGE message via CoreMessage.
If someone knows of something cleaner with less overhead, I'd love to hear about it.
-
On 14/05/2014 at 17:24, xxxxxxxx wrote:
I found a way. I will post it here tomorrow. It is very late here now.
-
On 15/05/2014 at 04:03, xxxxxxxx wrote:
Here is what I did:
I created a global variable (actually, a variable that exists only in the scope of my plugin class) named "old_changes" and initialized it to zero.
then, in the GetVirtualObjects method, I used some code similar to this:op_list is a IN-EXCLUDE field
count=op_list.GetObjectCount()
new_changes=0for i in range(count) :
obj=op_list.ObjectFromIndex(doc,i)
if obj is not None:
new_changes+=obj.GetDirty(c4d.DIRTYFLAGS_DATA) + obj.GetDirty(c4d.DIRTY_MATRIX)
obj.Touch()Comparing "new_changes" and "old_chages", if they differ, something was changed in the objects of the list.
Finally, of course, I set "old_changes" to be equal to "new_changes"