Hi @Aaron sorry I have to admit I totally overlooked your case.
So Fracture Object is a bit special in how color is handled, and this is not as an usual mograph object, where there is Modata and an array of color. Instead each part is a different PolygonObject and the color is simply the color of the object (the one from the basic tab when you select a polygon object in the attribute manager). So with that said find bellow a code to read color.
// Get the fracture object
BaseObject* obj = doc->GetFirstObject();
if (!obj && obj->GetType() == 1036557)
return false;
// Retrieve the cache. The Cache of a fracture object consist of a null and a bunch of PolygonObject where
// each PolygonObject represents a part of the fracture.
BaseObject* rootObjCache = obj->GetCache();
if (!rootObjCache)
return false;
BaseObject* child = rootObjCache->GetDown();
Random randomGenerator = Random();
while (child)
{
// Read Color
GeData data;
child->GetParameter(DescID(ID_BASEOBJECT_COLOR), data, DESCFLAGS_GET::NONE);
Vector color = data.GetVector();
ApplicationOutput("@"_s, color);
// Write Color with new random value, note that we write the cache, meaning each new re-evaluation of the Fracture object will reset these changes
Vector randomColor = Vector(randomGenerator.Get01(), randomGenerator.Get01(), randomGenerator.Get01());
child->SetParameter(DescLevel(ID_BASEOBJECT_COLOR), randomColor, DESCFLAGS_SET::NONE);
// Get Next Polygon Object aka the next part from the fracture
child = child->GetNext();
}
Cheers,
Maxime.