PDA

View Full Version : get class by classID


JHN
07-06-2011, 10:52 AM
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

Gravey
07-06-2011, 11:17 AM
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
07-06-2011, 11:45 AM
So bruteforce all the way... hmm, not very friendly.
Thanks, didn't look into the material utility functions any further.

-Johan

denisT
07-06-2011, 01:10 PM
So bruteforce all the way... hmm, not very friendly.
Thanks, didn't look into the material utility functions any further.

-Johan

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
07-06-2011, 01:38 PM
Thanks, brute force it is :)

-Johan

CGTalk Moderation
07-06-2011, 01:38 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.