Last active
May 9, 2019 10:40
-
-
Save fwilleke80/afa2abdaefaec9f0ddbadc890df8002d to your computer and use it in GitHub Desktop.
[C4D] A small Tag plugin that will output the most important dirty checksums for the object it's attached to into the console. Quite handy to check if an object keeps refreshing or rebuilding its cache. Simply attach the "Show Dirty Checksums" tag to an object and watch the Python console output.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import c4d | |
ID_SHOWDIRTYCHECKSUMSTAG = 1052821 | |
class ShowDirtySumsTag(c4d.plugins.TagData): | |
def Init(self, node): | |
priorityData = node[c4d.EXPRESSION_PRIORITY] | |
if priorityData is not None: | |
priorityData.SetPriorityValue( | |
c4d.PRIORITYVALUE_CAMERADEPENDENT, True) | |
priorityData.SetPriorityValue( | |
c4d.PRIORITYVALUE_MODE, c4d.CYCLE_GENERATORS) | |
node[c4d.EXPRESSION_PRIORITY] = priorityData | |
return True | |
def Execute(self, tag, doc, op, bt, priority, flags): | |
if op is None: | |
return c4d.EXECUTIONRESULT_OK | |
# Get dirty checksums | |
dirtyMatrix = op.GetDirty(c4d.DIRTYFLAGS_MATRIX) | |
dirtyData = op.GetDirty(c4d.DIRTYFLAGS_DATA) | |
dirtySelect = op.GetDirty(c4d.DIRTYFLAGS_SELECT) | |
dirtyCache = op.GetDirty(c4d.DIRTYFLAGS_CACHE) | |
dirtyChildren = op.GetDirty(c4d.DIRTYFLAGS_CHILDREN) | |
dirtyDescription = op.GetDirty(c4d.DIRTYFLAGS_DESCRIPTION) | |
print('[' + str(c4d.GeGetTimer()) + ']' + | |
' Dirty checksums for object "' + op.GetName() + '":') | |
print('DIRTYFLAGS_MATRIX: ' + str(dirtyMatrix)) | |
print('DIRTYFLAGS_DATA: ' + str(dirtyData)) | |
print('DIRTYFLAGS_SELECT: ' + str(dirtySelect)) | |
print('DIRTYFLAGS_CACHE: ' + str(dirtyCache)) | |
print('DIRTYFLAGS_CHILDREN: ' + str(dirtyChildren)) | |
print('DIRTYFLAGS_DESCRIPTION: ' + str(dirtyDescription)) | |
print('') | |
return c4d.EXECUTIONRESULT_OK | |
if __name__ == "__main__": | |
c4d.plugins.RegisterTagPlugin(id=ID_SHOWDIRTYCHECKSUMSTAG, str="Show Dirty Checksums", | |
info=c4d.TAG_EXPRESSION | c4d.TAG_VISIBLE, g=ShowDirtySumsTag, description='tshowdirtychecksums', icon=None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment