Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login

    How does C4DAtom.GetHDirty(c4d.HDIRTYFLAGS_OBJECT_HIERARCHY) work?

    Bugs
    windows python 2024
    2
    4
    593
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DunhouD
      Dunhou
      last edited by

      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~
      DunHou

      Win11 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:

      https://boghma.com
      https://github.com/DunHouGo

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by m_adam

        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.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 1
        • M m_adam moved this topic from Cinema 4D SDK on
        • DunhouD
          Dunhou
          last edited by

          woops, I try lots of stuff to debug this, hope it can fix soon. will use old way to track new objects for now.

          https://boghma.com
          https://github.com/DunHouGo

          1 Reply Last reply Reply Quote 0
          • M
            m_adam
            last edited by m_adam

            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.

            MAXON SDK Specialist

            Development Blog, MAXON Registered Developer

            1 Reply Last reply Reply Quote 1
            • First post
              Last post