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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Dirty when visibility or enabled changes

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 463 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 20/10/2017 at 02:51, xxxxxxxx wrote:

      I have an object plugin and I want to detect when the Visibility (Editor or Rendered) or Enabled of the child  object changes?

      I am checking IsDirty in GetVirtualObjects(), but the child is not dirty when I change the Visibility or Enabled.

      dirty = child.IsDirty(c4d.DIRTY_MATRIX | c4d.DIRTY_DATA | c4d.DIRTY_CACHE)
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 23/10/2017 at 22:14, xxxxxxxx wrote:

        Hi Pim, thanks for writing us.

        From a brief test I can't reproduce the issue you mentioned since the code below properly regenerates "new" geometry every time render/editor visibility is changed or the object is turned on/off.

          
          def GetVirtualObjects(self, op, hh) :  
              if op is None or hh is None:  
                  return None  
          
              child = op.GetDown()  
              if not child:   
                  return None  
          
              childDirty = child.IsDirty(c4d.DIRTY_MATRIX | c4d.DIRTY_DATA | c4d.DIRTY_CACHE)      
              child.Touch()  
          
              cache = op.GetCache()  
          
              if not childDirty and cache is not None:  
                  print "cache"  
                  return cache  
              else:  
                  print "regenerated"  
          
              sphere = c4d.BaseObject(c4d.Osphere)  
              sphere.SetMl(child.GetMl())  
          
              return sphere      
        

        Maybe I didn't properly get your point?

        Best, Riccardo

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

          On 31/10/2017 at 00:52, xxxxxxxx wrote:

          Sorry, together with the answers in the other post, the issue is now solved and I guess you are correct.
          I took the wrong approach.

          -Pim

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