[Closed] [Python] Equivalent of MXS getClassInstances
Hello everyone, I’m currently writing an asset Tracking replacement for 3dsmax, in the past i’ve done one version in maxscript but i’d like to convert it in Python/Pyside2 to have a more appealing UI for the users.
In maxscript, i gather all bitmaptexture/vrayhdri/pointcache etc… using getClassInstances functions, it was really fast and give me directly the list of max nodes i wanna show/modify (better than enumerateFile that give me only strings of bitmaps loaded).
You would probably ask why i don’t use the AssetManager Class in MaxPlus, it’s because it doesn’t list some of the bitmap we use (like UDIMs in VrayHDRIs). That’s also the reason why i didn’t use it in maxscript either (via AssetManager interface).
I’d prefer not to browse every material/modifiers… of the scene to gather everything because it’ll be slow.
So is there something like getClassInstances in MaxPlus, or how to do it wia pymxs.
Thanks,
Tony
use pymxs. MaxPLus will be gone in the future.
Also try MAX File Asset Metadata Stream Access you can see UDIM map and everything.
I tried the Asset Metadata Stream like you said , but the problem is that i cant figure out how to get the BitmapTexture or the VrayHDRI that use that specific asset (from that IObject it returns). Its something that i need in order to modify not only the filename but the properties of those maps.
With pymxs i don’t understand how to make the getClassInstances to work, i’ve tried many way to do it but didn’t manage to have a result
Thanks for your help.
Got it working, that was pretty easy (forgot to call the class on the runtime) :
ru = pymxs.runtime
array_ = ru.getClassInstances(ru.bitmapTex)
for m in array_:
print m.filename
I’ll try to see if i succeed.
Thanks for your help.
In the meantime, do you have some info i can read about the switching from MaxPlus to pymxs ?
pymxs is just python version of maxscript.
You just convert mxs syntax to python.
Also… pymxs can load sny maxscript struct include what you made.
So, you can write all your core functions in maxscript and just all from python.
import pymxs
mxs = pymxs.runtime
mxs.myCoolStrct.doSomthing “for this”