Find Multi/Sub Objects with Standard Materials

Hi Guys -

I am looking to add on to this code to add only select if multimaterial has standard material in .materialList[]

select (for i in objects where  (classof i.mat == multimaterial) collect i)

Thank you.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

...

U can define filter FN that can be used like this

fn filterMultiStd mtl = isKindOf mtl Multimaterial and (for m in mtl.materialList where isKindOf m Standard collect m).count != 0
for o in objects where filterMultiStd o.mat collect o

bga

xathletic01x's picture

Thank you! In case anyone

Thank you!

In case anyone wants this. This might come in handy for anyone working with VRay Scene and trying to remove Standard or Architectural Material from your scene. This script will help you find / select objects with non VRay Materials.

Cheers

rollout SelectionTool "Selection Tool" width:162 height:110
(
	button Arch "Architectural Materials" pos:[8,82] width:145 height:18
	button stn "Standard Materials" pos:[9,31] width:145 height:18
	button Multi "Multi/Sub Mats w/ Stn Mat" pos:[9,56] width:145 height:18
	label lbl1 "Select in Scene" pos:[10,10] width:89 height:15
 
	fn filterMultiStd mtl = 
	(
		isKindOf mtl Multimaterial and (for m in mtl.materialList where isKindOf m Standard collect m) .count != 0
	)
 
 
	on stn pressed do
	(
		select (for m in objects where classof m.mat == standard collect m)
		)
	on Multi pressed do
	(
		select (for m in objects where filterMultiStd m.mat collect m)
		)
	on Arch pressed do
	(
		select (for m in objects where classof m.mat == Architectural collect m)
		)
)
 
 
createDialog SelectionTool 
barigazy's picture

...

Not tested but simplified version

;)

try(destroyDialog ::SelectionTool)catch()
rollout SelectionTool "Selection Tool" width:162 height:110
(
	radiobuttons rb_mtlTypes "Material Types:" labels:#("Standard Mtl", "Architectural Mtl", "Arch&&Design Mtl") pos:[5,5]
	checkbox cb_multimat "Consider Also Multi/Sub Mtl" pos:[5,70] checked:on
	button btn_doit "DO IT!" pos:[105,5] width:50 height:60
 
	fn filterMultiStd mtl class: considerMMtl: = 
	(
		if not considerMMtl then isKindOf mtl class else
			isKindOf mtl class or (isKindOf mtl Multimaterial and (for m in mtl.materialList where isKindOf m class collect m).count != 0)
	)
	on btn_doit pressed do
	(
		material = case rb_mtlTypes.state of
		(
			1: Standard
			2: Architectural
			3: Arch___Design__mi
		)
		select (for m in objects where m.mat != undefined and (filterMultiStd mtl class:material considerMMtl:cb_multimat.checked) collect m)
	)
)
createDialog SelectionTool 160 90 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

bga

xathletic01x's picture

Clean

I am unable to get it to work though.

!this is way more simplified then what i had!

barigazy's picture

...

What cause the problem?

bga

xathletic01x's picture

not really sure

its not giving any errors.....

barigazy's picture

...

try(destroyDialog ::SelectionTool)catch()
rollout SelectionTool "Selection Tool" width:162 height:110
(
	radiobuttons rb_mtlTypes "Material Types:" labels:#("Standard Mtl", "Architectural Mtl", "Arch&&Design Mtl") pos:[5,5] fieldwidth:50
	checkbox cb_multimat "Consider Also Multi/Sub Mtl" pos:[5,70] checked:on
	button btn_doit "DO IT!" pos:[105,5] width:50 height:60
 
	fn filterMultiStd mtl class: considerMMtl:cb_multimat.checked = 
	(
		if not considerMMtl then isKindOf mtl class else
			isKindOf mtl class or (isKindOf mtl Multimaterial and (for m in mtl.materialList where isKindOf m class collect m).count != 0)
	)
	on btn_doit pressed do
	(
		material = case rb_mtlTypes.state of
		(
			1: Standard
			2: Architectural
			3: Arch___Design__mi
		)
		select (for m in objects where m.mat != undefined and (filterMultiStd m.mat class:material) collect m)
	)
)
createDialog SelectionTool 160 90 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

bga

xathletic01x's picture

Worked!

Worked!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.