THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/10/2011 at 08:41, xxxxxxxx wrote:
Hey guys, new day, new problem.
So I need to initialize compositing tags, a lot of them. They need to have different states concerning "seen by camera", "seen by reflection", etc. but their object buffers need to be the same.
I started with one object and one tag for testing things:
import c4d
from c4d import gui
#Welcome to the world of Python
def main() :
object = doc.GetActiveObject(False)
tags = object.GetTags()
for item in tags:
if item.GetType() == c4d.Tcompositing:
item[c4d.COMPOSITINGTAG_ENABLECHN0] = True
item[c4d.COMPOSITINGTAG_ENABLECHN1] = True
item[c4d.COMPOSITINGTAG_ENABLECHN2] = True
item[c4d.COMPOSITINGTAG_ENABLECHN3] = True
item[c4d.COMPOSITINGTAG_ENABLECHN4] = True
item[c4d.COMPOSITINGTAG_ENABLECHN5] = True
item[c4d.COMPOSITINGTAG_ENABLECHN6] = True
item[c4d.COMPOSITINGTAG_ENABLECHN7] = True
item[c4d.COMPOSITINGTAG_ENABLECHN8] = True
item[c4d.COMPOSITINGTAG_ENABLECHN9] = True
item[c4d.COMPOSITINGTAG_ENABLECHN10] = True
item[c4d.COMPOSITINGTAG_ENABLECHN11] = True
item[c4d.COMPOSITINGTAG_IDCHN0] = rendertag[c4d.COMPOSITINGTAG_IDCHN0]
item[c4d.COMPOSITINGTAG_IDCHN1] = rendertag[c4d.COMPOSITINGTAG_IDCHN1]
item[c4d.COMPOSITINGTAG_IDCHN2] = rendertag[c4d.COMPOSITINGTAG_IDCHN2]
item[c4d.COMPOSITINGTAG_IDCHN3] = rendertag[c4d.COMPOSITINGTAG_IDCHN3]
item[c4d.COMPOSITINGTAG_IDCHN4] = rendertag[c4d.COMPOSITINGTAG_IDCHN4]
item[c4d.COMPOSITINGTAG_IDCHN5] = rendertag[c4d.COMPOSITINGTAG_IDCHN5]
item[c4d.COMPOSITINGTAG_IDCHN6] = rendertag[c4d.COMPOSITINGTAG_IDCHN6]
item[c4d.COMPOSITINGTAG_IDCHN7] = rendertag[c4d.COMPOSITINGTAG_IDCHN7]
item[c4d.COMPOSITINGTAG_IDCHN8] = rendertag[c4d.COMPOSITINGTAG_IDCHN8]
item[c4d.COMPOSITINGTAG_IDCHN9] = rendertag[c4d.COMPOSITINGTAG_IDCHN9]
item[c4d.COMPOSITINGTAG_IDCHN10] = rendertag[c4d.COMPOSITINGTAG_IDCHN10]
item[c4d.COMPOSITINGTAG_IDCHN11] = rendertag[c4d.COMPOSITINGTAG_IDCHN11]
break
c4d.EventAdd()
if __name__=='__main__':
main()
The strange thing is, that it sometimes works, and sometimes I get this error message:
"TypeError: __setitem__ expected c4d.BaseList2D, not bool" concerning one (not always the same) COMPOSITINGTAG_ENABLECHN -states.
I also tried to allocate with values from other rendertags and there I get something just the other way around "TypeError: __setitem__ expected bool or int, not c4d.BaseList2D"
Would be really glad if someone could explain this behavior to me.
cheers
Phil