Notifications
Clear all

[Closed] Setting the text of a Map button

Hi,

I’m writing a renderer plugin in C++ using the 3ds Max 2015 SDK.

My material plugin has buttons to assign maps to inputs. Just like for the standard material, I’d like the text of this button to change to M when a map is assigned.

Here is the ParamBlock2 description of the button:

ParamIdMetallicTexMap, _T("metallic_texmap"), TYPE_TEXMAP, P_NO_AUTO_LABELS, IDS_TEXMAP_METALLIC,
    p_subtexno, 0,
    p_accessor, &g_param_accessor,
    p_ui, TYPE_TEXMAPBUTTON, IDC_TEXMAP_METALLIC,
p_end

In the Set method of the parameter accessor, I set the text of the button to M:

auto mtl = static_cast<AppleseedStdMtl*>(owner);
auto pblock = mtl->GetParamBlockByID(ParamBlockIdStdMtl);
auto pmap = pblock->GetMap();

switch (id)
{
  case ParamIdMetallicTexMap:
    if (pmap)
        pmap->SetText(ParamIdMetallicTexMap, _T("M"));
        break;
}

However, for some reason this has no effect. Moreover, the second time I click on the button and assign a map, pblock->GetMap() returns null.

I’ve looked quite extensively at the standard material implementation and the other provided examples but I couldn’t find significant differences in the approach.

Does this ring a bell to anyone?

All suggestions welcome at this point. Thanks!