[Closed] get selected mtl from Slate Material Editor
I solved the delete problem on rollout by using theHold as Denis said, but still got the a bug if I try the #sme_node. Anyway thanks a lot guys you’re my heroes
rollout testRollout "CGS rollout"
(
button btnRun "run"
function setHold =
(
if (theHold.holding() == false) do
theHold.begin()
)
function getHold sTag =
(
if (theHold.holding() == true) do
theHold.accept sTag
)
fn sme_getSelectedNodes _return:#sme_nodes =
(
local viewNode = sme.GetView (sme.activeView)
local view = trackViewNodes[#sme][(viewNode.name)]
if view.numsubs > 0 do
(
allMats = for n = 1 to view.numsubs collect view[n].reference
setHold()
viewNode.DeleteSelection()
getHold "material manipulation"
theHold.End()
names = for n = 1 to view.numsubs collect (view[n].reference.name) ; max undo
if _return == #sme_mats then (for n in allMats where findItem names n.name == 0 collect n)
else (for n = 1 to viewNode.GetNumNodes() where findItem names (smeNode = viewNode.GetNode n).name == 0 collect smeNode)
)
)
on btnRun pressed do
(
res = sme_getSelectedNodes _return:#sme_node
print res
)
) -- end rollout testRollout
createDialog testRollout width:175 height:100
Very interesting thread!! I’m dabling with Slate and Maxscript these days too.
So, what’s the use of #(<MixinInterface:Node>, <MixinInterface:Node>) ? I mean, I can get the name of a material by putting a .name on a variable assigned to the above matrix, but is that all? Can’t one access something else like a materials’ opacity value, or diffuse map?
Cheers!
Hi, I tried to get materials form selected Nodes in SME for for some time… Finally I got it working with:
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 and superclassof m == material do append smeSelMats m
)
print smeSelMats
cheers,
Pixamoon
works for max 2014 and over, but not 2012
see page 2 if you want the solution for max 2012.
anyway, thank you for the input