ScriptSpot

Forum topic · General Scripting

Select Material by name in SME

By nobo · 2021-07-09

Description

Hello everyone,
I try to select a material in Slate Mode Editor to delete it from the view.
My material to delete exist in the view and have an explicit name.
I don't find any solution to select material of the slate editor view by his name and delete it from the view.
I have you got some tips to realise this?

Many thanks
Bruno

Comments (2)

nobo · 2021-07-15

Thank you very much Swordslayer, this is exactly what i want!

Swordslayer · 2021-07-15

matchName = "Material Name to select"
if sme.IsOpen() do
(
	local view = sme.GetView (sme.activeView)
	view.SelectNone()
	for i = 1 to view.GetNumNodes() where (n = view.GetNode i).reference.name == matchName do n.selected = on
)