Dirty when visibility or enabled changes

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)

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

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