Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
220 views
in Technique[技术] by (71.8m points)

c++ - 3ds Max Programming Materials Category()

it is a bit strange but no matter how many times I tried all materials and maps that I create will appear in the General category material. That’s my code for the material category.

const TCHAR* Category() { return NULL; }//_T(""); }//GetString(IDS_CATEGORY); }
const MCHAR* GetEntryName() const { return LuxMixMapFriendlyClassName; } //NULL; }
const MCHAR* GetEntryCategory() const {
    HINSTANCE hInst = GetModuleHandle(_T("sme.gup"));
    if (hInst) {
        //Extract a resource from the calling module's string table.
        static MSTR category(MaxSDK::GetResourceStringAsMSTR(hInst,
            IDS_3DSMAX_SME_MATERIALS_CATLABEL).Append(_T("\Lux")));
        return category.data();
    }
    else
    {
        return _T("Maps\Lux");
    }
}
enter code here
question from:https://stackoverflow.com/questions/65617180/3ds-max-programming-materials-category

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Finally, I fix the problem, honestly, 3dsmax needs better documentation. Just writing the solution if this is the case for someone else. All the code is perfectly correct but in order to apply there is one class that should be called that is optional but not work without it. Also, no error if you not calling it. ( a bit funny )

first, in public classDesc2 i add the "public IMaterialBrowserEntryInfo"

class Lux_AddClassDesc : public ClassDesc2, public IMaterialBrowserEntryInfo

hen inside the class add.

FPInterface* GetInterface(Interface_ID id) {
if (IMATERIAL_BROWSER_ENTRY_INFO_INTERFACE == id) {
    return static_cast<IMaterialBrowserEntryInfo*>(this);
}
    return ClassDesc2::GetInterface(id);
}

All other part is exactly the same.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...