Notifications
Clear all

[Closed] get class by classID

 JHN

I’m not finding a way to find the class that belongs to a classId.

Say I have #(0x70b05735, 0x4a163654) how do I “convert” it to the creatable Arch___Design__mi class.

I know it can be done because in the macro : macro_MeditUtilities.mcr on line 36 (max2010) is the following code
defaultsFile = MeditUtilities.getDefaultsFile()
defaultMtl = MeditUtilities.getDefaultMaterial defaultsFile

this returns the materials, but in the iniFile only the classId is noted, so it converts the classId to a className and creates materials from there. I want a more general purpose solution than that. And I can’t figure out a way to tie the classId’s to the classNames without a brute force baseClasses traversal.

Thanks,
-Johan

4 Replies

MeditUtilities is a scripted struct defined in “…max\stdplugs\stdscripts\meditfunctions.ms”

the source code will speak for itself but the short version is that it goes through every material class and compares the 2 classID values until a match is found

 JHN

So bruteforce all the way… hmm, not very friendly.
Thanks, didn’t look into the material utility functions any further.

-Johan

1 Reply
(@denist)
Joined: 2 years ago

Posts: 0

as I know Max SDK doesn’t have any smart built-in methods to get class by classID. It enumerates through all classes searching for matched.

 JHN

Thanks, brute force it is

-Johan