On 03/06/2017 at 19:51, xxxxxxxx wrote:
Hello!
I'm trying to change some attributes from a different objects at the same time, in this case I'm trying to change "use color" and "display color" attribute for testing with that.
When I use the code with one object works fine but if the object have some children objects the console shows me "IndexError: list assignment index out of range" but I don't understand why, because I've use a GetActiveObjects with a c4d.GetActiveObject_Children flag.
I need to get the entire objects selection with other way maybe? Here is the code:
import c4d
from c4d import gui
def geo_color() :
doc = c4d.documents.GetActiveDocument()
#activeObject = doc.GetActiveObject()
activeObject = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_CHILDREN)
#List of selected objects
print activeObject
#geo color actions
activeObject[c4d.ID_BASEOBJECT_USECOLOR]=2
#cdlg = c4d.gui.ColorDialog(1)
#activeObject[c4d.ID_BASEOBJECT_COLOR]=cdlg
#update scene
c4d.EventAdd()
if __name__=='__main__':
geo_color()
Thanks!