ScriptSpot home

Forum topic · General Scripting

select multiple objects by material ID

By V-MOTION · 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

tassel, the link points to this thread.

Reply to miauu
Raymond Homme Ingebretsen

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

miauu

Something like this?



(
	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
)