Handling VRayMaterial from C++

Hello!,
First of all, this is my first topic. Thus, forgive me if this is not the right place to request help.
Despite the fact my company has a license I cannot open a topic in the SDK forum.

My issue is related with VRay sdk for 3dsMax 2018.

Is there any way to handle the VRayMaterial in a native manner? I mean, handling VRayMaterials without using the paramblock interface.

Thanks for your help,
Jesus

Hello,

Can you elaborate a bit more - what do you need to do with the VRayMtl ?

Best regards,
Yavor

Thanks for the quick answer Yavor,

I just need to check some material properties, but trying to guess every single combination of (Parameter block - Parameter) id is rough.
Thus, I would like to have something like VRayMtl.h where I can access the class definition.

I attach a code just to give a hint of what I’m asking:


// This is how I'm accessing the properties right now
void actOnAColor(Mtl* material) {
    // This is the intended way of getting properties in 3ds Max sdk if I'm not wrong
    IParamBlock2 *paramBlock = material->GetParamBlock(VRayMtlParameters::vrayMtl_old_id );
    if (paramBlock != nullptr) {
        Color color = paramBlock->GetColor(VRayMtlParameters::pb_diffuse_color);
        // Do whatever you want with the color.
    }
}

// This is how I would like to access the properties
void actOnAColor(Mtl* material) {
    VRayMtl *mtl = dynamic_cast<VRayMtl *>(material);
    if (mtl != nullptr) {
        Color color = mtl->GetDiffuseColor(); // Or something similar
        // Do whatever you want with the color.
    }
}

Best regards,
Jesus

Actually the param block way is the right way. VRayMtl itself reads the values from the param block in the beginning of the render.
From the example code I see you’ve already found the pb2vraymtl.h header that has the IDs of all the params. You should use the GetParamBlockByID function with the values from the first enum (vrayMtl_basic_id, vrayMtl_BRDF_id…).

If there are params you have trouble finding - list them here and I can check.

Best regards,
Yavor

Yes, I’ve found that header.
I guess I’ll stick to the right way.
Thanks for your help.

Best regards,
Jesus