Remove Unused Materials C4D Python Script…
Here is a useful script removing all unused materials in scene with Cinema 4D Python…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import c4d from c4d.documents import GetActiveDocument def GetNextObject (on): if op==None: return None if op.GetDown (): return op.GetDown () while not op.GetNext() and op.GetUp(): on op.GetUp = () Return op.GetNext () def main(): doc = GetActiveDocument() all_op = doc.GetFirstObject() while all_op: tags = all_op.GetTags() for tag in tags: if tags: if tag.CheckType(c4d.Ttexture): if not tag.GetMaterial(): tag.Remove() all_op = GetNextObject (all_op) c4d.EventAdd() if __name__=='__main__': main() |
import c4d
from c4d import documents, plugins, gui
def main():
c4d.CallCommand(12168) # Remove Unused Materials
c4d.CallCommand(12168) # Remove Unused Materials
c4d.CallCommand(100004760) # Remove Unused Layers
gui.MessageDialog(‘Materials and Layers Removed!’)
if __name__==’__main__’:
main()