Cannot set ID_BASEOBJECT_USECOLOR to a child object.
-
Hey guys, i'm on R23, Windows, C++ and I have an issue setting ID_BASEOBJECT_USECOLOR.
Basically I have a spline object as a sub-object of my ObjectData plugin which I want to have a solid color.
In GetVirtualObjects() before inserting this spline under my cache root, I use the following:splineObject->SetParameter(DescID(ID_BASEOBJECT_USECOLOR), ID_BASEOBJECT_USECOLOR_ALWAYS, DESCFLAGS_SET::NONE); splineObject->SetParameter(DescID(ID_BASEOBJECT_COLOR), Vector(1,0,1), DESCFLAGS_SET::NONE);
But this doesn't work...
Also tried setting with the ObjectColorProperties struct but no luck:ObjectColorProperties props; props.color = Vector(1, 0, 1); props.usecolor = ID_BASEOBJECT_USECOLOR_ALWAYS; splineObject->SetColorProperties(&props);
Any ideas what I'm doing wrong?
EDIT: In edit mode I manage to do set them separately for each of my objects, so I assume it's possible.
Thank you for the attention!
-Georgi.
-
One thing that wasn't mentioned.
All the children objects seem to inherit the properties from the base object. If I set the base objects properties with the code in my previous post, the spline object will receive them.
Maybe there's a way to tell some objects to inherit and others to not? -
Hi @mastergog please for your next topic, try to use the Q&A functionality.
Regarding your issue, you should first register your object plugin with the flag
OBJECT_USECACHECOLOR
.
Then if you are returning multiple objects a good practice is also to define an UniqueIP for each of them, for more information please read BaseObject - GeneratingCheers,
Maxime. -
@m_adam Yay thank you very much! Was almost ready to compromise with the default color.
Will use the Q&A functionality, excuse me for the posts so far.
Warm regards,
Georgi.