ScriptSpot

Forum topic · General Scripting

select multiple objects by material ID

By W DIGITAL · 2012-11-07

Description

i was not able to find a script that select all objects in the scene based on material ID

anyone?

Comments (5)

miauu · 2012-11-08

tassel, the link points to this thread.

tassel · 2012-11-09

Hehe, Think it's time to jump in bed ;)

Something like this?

miauu · 2012-11-08



(
	local matID = 4
	local objWithMatID = #()
	local poGetMatID = polyop.getFaceMatID
	for obj in geometry where (classof obj) == Editable_Poly do
	(
		allFaces = polyop.getNumFaces obj
		notFound = true
		for i = 1 to allFaces while notFound where (matID == (poGetMatID obj i) ) do
		(
			append objWithMatID obj
			notFound = false
		)
	)
	if objWithMatID.count != 0 do select objWithMatID
)

Thnx - Short and sweet

mpowers10000 · 2021-07-08

Nice job