SME Maxscript access
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to run functions only on materials or textures that are currently selected in the Slate view. But the node.selected parameter seems to be wrong very often.
In the code below, it doesn't matter what node is set to be selected... the only node that seems to be selected via the node.selected property is the last created checkbox.
Can others confirm this? If so, please submit a bug report:
sme.Open()
testname = "MXS Selection Test"
existing = sme.GetViewByName testname
if existing > 0 then (
sme.DeleteView existing false
)
sme.activeView = (sme.CreateView testname)
v = sme.activeView
view = sme.GetView v
pos = [0,0]
numsubs = 10
MultiMat = MultiMaterial name:"multimaterial" numsubs:numsubs
view.CreateNode MultiMat pos
for m = 1 to numsubs do (
mat = multiMat.materialList[m]
mat.diffuseMap = checker name: ("tex"+m as string)
mat.name = ("Mat "+ (m as string))
multiMat.names[m] = ("Mat "+ (m as string))
)
view.SetSelectedNodes (#((multiMat.materialList[random 1 numsubs])))
numNodes = view.GetNumNodes()
for n = 1 to numNodes do (
nd = view.GetNode n
if nd.selected == true then (
ref = trackViewNodes[#sme][v][n].reference
format "% > % > % \n" n nd ref
)
)
Shawn Olson
Developer of Wall Worm
3ds Max plugins and Scripts
3ds Max 4/Gmax - 3ds Max 2020
Mudbox 2009-2019
Windows 10 x64
i7 8700K
64GB RAM
Geforce 1080ti