Here is already a start: remove all texture tags except the last one.
import c4d
gTagType = c4d.Ttexture
def GetTextureTagCount(obj):
count = 0
if obj:
while (obj.GetTag(gTagType, count)):
count += 1
return count
def RemoveTextureTagsButLast(obj):
if not obj:
print ('No object selected')
return
count = GetTextureTagCount(obj)
if count == 0:
print ('No texture tags')
return
doc.StartUndo()
for i in range(0, count - 1):
tag = obj.GetTag(gTagType)
doc.AddUndo(c4d.UNDOTYPE_DELETE, tag)
obj.KillTag(gTagType)
doc.EndUndo()
return
def main():
if not op:
print ('No object selected')
return
RemoveTextureTagsButLast(op)
c4d.EventAdd()
if __name__=='__main__':
main()
It only works on a single selected object, but you get the point.
Now this script works with default Cinema4D materials and Cinema4D texture tags. Not sure how this looks like when Octane is used.
Is only the Octane material different from the native one, or does an object also carry specific Octane texture tags? Honestly, I wouldn't know.
If specific Octane texture tags are used, you can replace "c4d.Ttexture" with the pluginID of such Octane texture tag.
EDIT: modified the script to perform the undo on the tag instead of the host object, for a correct redo.