Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Materials Category()

Materials Category()

omidt_gh
Enthusiast Enthusiast
883 Views
4 Replies
Message 1 of 5

Materials Category()

omidt_gh
Enthusiast
Enthusiast

Hi everybody.
I know its a long shot but i create a plugin for 3dsmax all part works perfectly and every object is on their places but Materials always showing in general material category and Category() function not work at all.
i tried many things and solutions but none of them work.

here is the line that should create a new category in the material editor :

virtual const TCHAR* Category() { return _T("Materials\\lux");}

work for all other categories but for materials, i know it probably a simple issue but not work for me.

i appreciate any kind of help.

0 Likes
Accepted solutions (1)
884 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

I don't understand what you mean with category.

like structure?

0 Likes
Message 3 of 5

omidt_gh
Enthusiast
Enthusiast

All materials appear in the general material category and not "Lux" category that I created.
take a look at the image.

Screenshot 2020-12-19 033759.jpg

 

0 Likes
Message 4 of 5

omidt_gh
Enthusiast
Enthusiast

Almost nothing works. super strange behavior.

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

 

Screenshot 2020-12-21 145955.jpg 

0 Likes
Message 5 of 5

omidt_gh
Enthusiast
Enthusiast
Accepted solution

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.

0 Likes