Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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
    • Recent
    • Tags
    • Users
    • Login

    Check if an object has changed

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 326 Views
    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.
    • H Offline
      Helper
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            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=0

            for 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"

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