Message 1 of 3
Setting vertex colours
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
just trying to understand how to set vertex colours. When I run the code below (Box001 is an editable mesh), I still need to add and then remove a vertex paint modifier to get the colours copied to the base object. Is there a better way to directly access the base object's vertices?
Many thanks in advance, -Duncan.
INode* node = GetCOREInterface()->GetINodeByName(_T("Box001"));
const ObjectState* os = &node->EvalWorldState(MAXScript_time());
Object* obj = os->obj;
TriObject* as_tri = dynamic_cast<TriObject*>(obj);
Mesh* mesh = &as_tri->GetMesh();
for (int i = 0; i < mesh->getNumVertCol(); i++) {
mesh->vertCol[i].x = 1.f;
mesh->vertCol[i].y = 0.f;
mesh->vertCol[i].z = 0.f;
}