def isDirty(self, tag):
doc = tag.GetObject().GetDocument()
vertexmapdata = tag[c4d.IDC_VERTEXMAP].GetAllHighlevelData()
containerdata = tag.GetData()
pointcountdata = tag[c4d.IDC_TARGETOBJECT].GetPointCount()
mode = tag[c4d.IDC_TARGETOBJECT].GetDocument().GetMode()
isselect = tag[c4d.IDC_TARGETOBJECT] in doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_CHILDREN)
istagselect = tag in doc.GetActiveTags()
islive = tag[c4d.IDC_LIVESELECTION]
datadirty = False
livedirty = False
isSilent = False
containerdata[c4d.IDC_VERTEXMAP] = None
containerdata[c4d.IDC_TARGETOBJECT] = None
containerdata[c4d.IDC_SELECTIONTAGS] = None
# get silence
if c4d.CheckIsRunning(c4d.CHECKISRUNNING_ANIMATIONRUNNING):
if tag[c4d.IDC_SILENT] and self.DataCache != None:
# check if the current frame is silent
if tag[c4d.IDC_SILENTSKIP] > 0 and not self.IsRenderDirty:
frame = doc.GetTime().GetFrame(doc.GetFps())
frameoffset = doc.GetMinTime().GetFrame(doc.GetFps()) % 2
isSilent = ((frame - frameoffset) % (tag[c4d.IDC_SILENTSKIP] + 1)) != 0
# all frames are silent
elif not self.IsRenderDirty:
isSilent = True
self.IsRenderDirty = False
# set livedirty
if islive:
# the target object has been selected while tag is selected
if isselect != self.SelectionCache:
self.SelectionCache = isselect
if self.SelectionCache and istagselect:
livedirty = True
# viewport mode has been changed to an edit mode while tag and target are selected
if mode != self.ModeCache and (isselect and istagselect):
if ((mode == c4d.Mpoints or mode == c4d.Medges or mode == c4d.Mpolygons)):
self.ModeCache = mode
livedirty = True
# set datadirty
# tag container is dirty
if (not isSilent and self.ContainerCache != containerdata):
self.ContainerCache = containerdata
datadirty = True
if isselect and istagselect and islive:
livedirty = True
# target object pointcount is dirty
if (not isSilent and tag[c4d.IDC_CHECKPOINTCOUNT] and self.PointCountCache != pointcountdata):
self.PointCountCache = pointcountdata
datadirty = True
if isselect and istagselect and islive:
livedirty = True
# vertexmap is dirty
if (not isSilent and tag[c4d.IDC_CHECKVERTEXMAP] and self.VertexmapCache != vertexmapdata):
self.VertexmapCache = vertexmapdata
datadirty = True
if isselect and istagselect and islive:
livedirty = True
# animated noise
if (not isSilent and
tag[c4d.IDC_NOISE_SPREAD] and
(tag[c4d.IDC_NOISE_SPEED] > 0 or tag[c4d.IDC_NOISE_MOVEMENTSPEED] > 0)):
datadirty = True
if isselect and istagselect and islive:
livedirty = True
return (livedirty, datadirty)