Notifications
Clear all
[Closed] Create a scripted material through the SDK?
Jan 21, 2013 6:30 pm
Now I have my own materials created using the scripted plugin materials system.
And I wanna to create a material of this class and put it on the material editor.
Having a instance of that material is trivial but… how I can create a new material having its name and its ClassID? Creating a stdmaterial is pretty straightfoward using NewDefaultStdMat() but what for the rest of materials (including third party ones)?
I’ve been digging on the help and googling without luck :S
2 Replies
Jan 21, 2013 6:30 pm
if you have an instance of the material then this will put it on the old style editor.
void Interface::PutMtlToMtlEditor( MtlBase *mb, int slot = -1)
something like this should crash something ;0
MtlBase *mtlb = (MtlBase *)ip->CreateInstance(SUPER_CLASS_ID, CLASS_ID);
if(mtlb)
{
// check duplicate name with
if(ip->OKMtlForScene(mtlb))
{
ip->PutMtlToMtlEditor( mtlb,1);
}
else
// assign unique name....
}
Jan 21, 2013 6:30 pm
I’ve come to put my own reply but you find it too!
CreateInstance(SUPER_CLASS_ID, CLASS_ID); is what I was looking for.
Thanks!