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
    • Login

    Python tag - IsDirty() not working?

    General Talk
    3
    11
    2.2k
    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.
    • P
      PluginStudent
      last edited by PluginStudent

      IsDirty() is only relevant in the pipeline of an ObjectData generator plugin (BaseObject Manual).

      You need C4DAtom.GetDirty() or C4DAtom.GetHDirty() to compare the dirty checksums.

      intenditoreI 1 Reply Last reply Reply Quote 2
      • intenditoreI
        intenditore
        last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • intenditoreI
          intenditore
          last edited by intenditore

          Thanks, that's what I thought(
          I found a nice dummy tegdTegData python plugin template, for sure somebody needs it too
          https://github.com/gundamboy/DummyTagdataPluginTemplate

          1 Reply Last reply Reply Quote 0
          • intenditoreI
            intenditore @PluginStudent
            last edited by intenditore

            @PluginStudent said in Python tag - IsDirty() not working?:

            IsDirty() is only relevant in the pipeline of an ObjectData generator plugin (BaseObject Manual).

            You need C4DAtom.GetDirty() or C4DAtom.GetHDirty() to compare the dirty checksums.

            I'm sorry, but I can't untangle it. I try to execute the following in the tag plugin:

            def Execute(self, tag, doc, op, bt, priority, flags):
                op.SetDirty(c4d.DIRTY_CHILDREN)
                print op.GetDirty(c4d.DIRTY_CHILDREN)
            
            AttributeError: 'c4d.BaseObject' object has no attribute 'SetDitry'
            
            P 1 Reply Last reply Reply Quote 0
            • P
              PluginStudent @intenditore
              last edited by

              @intenditore said in Python tag - IsDirty() not working?:

              AttributeError: 'c4d.BaseObject' object has no attribute 'SetDitry'

              According to this error message, you wrote SetDitry

              1 Reply Last reply Reply Quote 2
              • intenditoreI
                intenditore
                last edited by

                Yeah... I fought with this type for almost a day ;D
                But than some weirder things has been discovered.
                I have this easy code in TagData plugin:

                def Execute(self, tag, doc, op, bt, priority, flags):
                
                    op.SetDirty(c4d.DIRTYFLAGS_CHILDREN)
                    print op.GetDirty(c4d.DIRTYFLAGS_CHILDREN)
                

                It always prints 0, no matter what happens to the children. I also tried other model, DIRTYFLAGS_ALL - there it starts with a small random number and adds 1 every update even if nothing happens. I tried DIRTY_CHILDREN also, the same "0".
                Can't get how hierarchy change checking works. And does it?

                1 Reply Last reply Reply Quote 0
                • P
                  PluginStudent
                  last edited by

                  Why are you calling SetDirty() before calling GetDirty() ?

                  Why not use GetHDirty(c4d.HDIRTYFLAGS_OBJECT_HIERARCHY)? (Dirty States)

                  intenditoreI 1 Reply Last reply Reply Quote 2
                  • intenditoreI
                    intenditore @PluginStudent
                    last edited by

                    @PluginStudent oh God! You helped me so much!
                    Many thanks for that. Sincerely, it's not very well explained in docs, really not well (in opposite to Undo system for instance) and getting how exactly should it work is tricky. But your last suggestion surely works, and it raises the number every time hierarchy is changed, so I need only check has it been changed or not and than decide to run the code or not (maybe somebody will stuck in the same position so I hope my plain explanation would be useful)
                    Thanks!

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

                      Hi, I confirmed as @PluginStudent said you should use, HDirty for this purpose.
                      SetDirty with the flag DIRTYFLAGS_CHILDREN only works for new CCurve and Ckey.
                      To be honest, I'm not sure why, and it's indeed misleading, I will reach the development team about it, and in any case, will fix the documentation.

                      Cheers,
                      Maxime.

                      MAXON SDK Specialist

                      Development Blog, MAXON Registered Developer

                      intenditoreI 1 Reply Last reply Reply Quote 1
                      • intenditoreI
                        intenditore @m_adam
                        last edited by

                        @m_adam thank you, that's really confusing..

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