The C++ SDK does have BaseObject::GetColorProperties
to obtain the custom displaycolor assigned to an object. This seems not to be available in the Python SDK.
Solved Python missing ObjectColorProperties?
You can go directly through the properties, e.g.
import c4d
def main():
selectlist = doc.GetSelection()
for obj in selectlist:
print obj.GetName(), " ", obj[c4d.ID_BASEOBJECT_COLOR]
obj[c4d.ID_BASEOBJECT_USECOLOR] = True
obj[c4d.ID_BASEOBJECT_COLOR] = c4d.Vector(0,0,1)
obj.Message(c4d.MSG_UPDATE)
c4d.EventAdd()
if __name__=='__main__':
main()
So you don't need specific functions.
You can go directly through the properties, e.g.
import c4d
def main():
selectlist = doc.GetSelection()
for obj in selectlist:
print obj.GetName(), " ", obj[c4d.ID_BASEOBJECT_COLOR]
obj[c4d.ID_BASEOBJECT_USECOLOR] = True
obj[c4d.ID_BASEOBJECT_COLOR] = c4d.Vector(0,0,1)
obj.Message(c4d.MSG_UPDATE)
c4d.EventAdd()
if __name__=='__main__':
main()
So you don't need specific functions.
@cairyn
You are right.
I thought having to go over the BaseContainer obtained from the object via GetData()
, but didn't see anything in its content related to the displaycolor ... didn't think of just accessing the object's properties directly. I am not that confident with the Python SDK.
Thanks for the piece of code.