Material and map category name


#1

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");
	}
}


#2

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

Then 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.


#3

Nice catch! Thanks for posting the solution.