How does C4DAtom.GetHDirty(c4d.HDIRTYFLAGS_OBJECT_HIERARCHY) work?
-
Hi community,
My understanding is that
C4DAtom.GetHDirty(c4d.HDIRTYFLAGS_OBJECT_HIERARCHY)
can track the document dirty with when a new object is created( hierarchy changed of course ), but if I delete objects, the dirty count will not change, but if I reload python plugin, it can worked again.I didn't know if I misunderstand this method, why that happened?
Cheers~
DunHouWin11 23H2 + C4D 2024.5.1
Codes:
import c4d import typing doc: c4d.documents.BaseDocument # The active document op: typing.Optional[c4d.BaseObject] # The selected object, can be None. class Dialog (c4d.gui.GeDialog): def CreateLayout(self) -> bool: return True def CoreMessage(self, mid: int, data: c4d.BaseContainer) -> bool: if mid == c4d.EVMSG_CHANGE: doc = c4d.documents.GetActiveDocument() print(doc.GetHDirty(c4d.HDIRTYFLAGS_OBJECT_HIERARCHY)) return super().CoreMessage(mid, data) if __name__ == '__main__': global dlg dlg = Dialog() dlg.Open(c4d.DLG_TYPE_ASYNC)
Video:
-
Hi @Dunhou thanks for contacting us, after investigating it's seems there is a bug that freeze the dirty count once you had an object hierarchy, and delete the complete object hierarchy. Then after this operation the dirty count stop to work. This also impact object with children, their dirty count stop at 1.
Reloading Python make it works, because since few version, it create a new documents and refresh everything under the hood and its just a "workaround".
So thanks a lot for reporting it to us, I've created an internal bug for it, let's see what's the outcome of it.
Cheers,
Maxime. -
-
woops, I try lots of stuff to debug this, hope it can fix soon. will use old way to track new objects for now.
-
Hi just to let you know that the bug has been fixed, this will be available in one of the next releases. I will post on this topic once the fix is available.
Cheers,
Maxime.