This script is useful only for script writers.
This is just simple function to get selected materials / textures / controllers from active view in SME.
Function returns materials :) - not names of materials.
function SMEGetSelMats = (
viewNode = sme.GetView (sme.activeView)
smeSelMats = #()
for n = 1 to trackViewNodes[#sme][(sme.activeView)].numSubs do (
m = trackViewNodes[#sme][(sme.activeView)][n].reference
b = viewNode.GetNodeByRef m
if b.selected do append smeSelMats m
)
return smeSelMats
)
-- do something here
print (SMEGetSelMats())
I've got message - it doesn't work with 2012. If anybody has 2012, please test and let me know
Enjoy
Pixamoon
Comments (3)
Comment policy
Just to expand on this more :)
notes to comment:
Thanks for sharing. I've used a similar set of logic for a while but ended up simply abandoning it. You might want to look at http://forums.autodesk.com/t5/programming/sme-maxscript-access/m-p/56339… because the results seem to be bugged in many cases. I noticed that the results were sometimes correct, but just as often totally wrong.
AD has confirmed the bug. It's annoying, but at least as of June it was still broken in all versions of Max. I haven't tested in 2016 SP1 yet.
`
hey hey,
I saw that on AD forum and CGSociety forum but it didn't work for me because:
"n" index is different than "n" index in:
I noticed that index can be the same on beginning only - till double click on node (to load it into right panel). After that index is moved.
That's why we can't get selected material from selected node by
But your post was a big step to find this solution :) Thanks!
Best,
Pixammon