On 10/07/2014 at 08:19, xxxxxxxx wrote:
I am really stuck here.
What I am looking for is a way to assign multiple materials to the same object, without making the object editable since it's a procedural object; something similar to MultiSubObject material in 3DS MAX. This should work for a generator plugin.
Bool MyTest::Init(GeListNode *node)
{
BaseObject *op = (BaseObject* )node;
BaseContainer *data = op->GetDataInstance();
op->SetPhong(TRUE, FALSE, 1.5);
TextureTag *tex = TextureTag::Alloc(); // I would like this tags to be assigned to the BOX
TextureTag *tex1 = TextureTag::Alloc(); // I would like this tags to be assigned to the SPHERE
}
BaseObject* MyTest::GenerateBox(BaseObject *op)
{
BaseObject *box = BaseObject::Alloc(Ocube);
return box;
}
BaseObject* MyTest::GenerateSphere(BaseObject *op)
{
BaseObject *sphere = BaseObject::Alloc(Osphere);
return sphere;
}
BaseObject* MyTest::GetVirtualObjects(BaseObject *op, HierarchyHelp *hh)
{
BaseDocument *doc = hh->GetDocument();
BaseContainer *bc = op->GetDataInstance();
BaseObject *ret = NULL;
Bool dirty = op->CheckCache(hh) || op->IsDirty(DIRTYFLAGS_DATA) ;
if (!dirty) return op->GetCache(hh);
BaseObject *box = GenerateBox(op);
BaseObject *sphere = GenerateSphere(op);
ret = box;
sphere->InsertUnder(ret);
if(ret)
{
op->CopyTagsTo(ret, TRUE, FALSE, FALSE, NULL);
ret->Message(MSG_UPDATE);
return ret;
} else return BaseObject::Alloc(Onull);
}
The question is, how do I show the tags tex and tex1 in the OM and have tex change the material of the box and tex1 change the material of the sphere.
Any help would be greatly appreciated.