ScriptSpot

Forum topic · Scripts Wanted

Select objects that have no material assigned

By 3DV · 2012-05-26

Description

Is there a script to select all objects in a scene that don't have a material applied yet?

Comments (16)

this what you looking for

ratatouille · 2017-08-31

select (for i in objects where i.material==undefined collect i)

fajar · 2012-05-28

hey what an coincidence im architect too also not scripter (like you , script is just hobby)...nice to meet you barigazy.

barigazy · 2012-05-28

my pleasure, fajar
I think that 90% members here use maxscript for hobby and the others are
pro scripters. It is good to know that I have a colleague here :)
Regards!

fajar · 2012-05-27

dont know about that , but as far as I know its "geometry" mean its filtering by only geometry object, but how about editable spline, helper....not to mean to offend but he said "select all objects in a scene that had no material" may be he mean all object including spline, helper or something like that. But mey be youre correct in geometry more faster, im not script master, just learning maxscript few month ago with no foundation from scripters or so whatever corelating with script.

Best regard

Fajar

barigazy · 2012-05-27

For his questions your solution is OK (better).
But i never saw helper with assigned material, also light, cams etc.
You are longer than me on this forum(site), also you have very useful scripts
here. Just keep it up.
I'm architect no script master. maxscript is only my hobby.

Cheers!

select (for i in objects

fajar · 2012-05-27

select (for i in objects where i.material==undefined collect i)

barigazy · 2012-05-27

Hi fajar,
Probably would be faster for larger scenes if you use "geometry" instead of "objects"

It works!

IgrBessonov · 2015-05-11

Thank you! It is very helpful!

Vendetta · 2015-07-29

I hope you see this..

How would I add for it to select both geometry and shapes. I changed objects to geometry but I don't know how to add another selection to the script.

barigazy · 2015-07-29

No need for that. Just use this

select (for o in objects where canconvertto o Editable_Mesh and o.mat != undefined collect o)

3DV · 2012-05-26

isKindof means: 'is a bit like'

Mostly used when you can't decide to which category something belongs.

barigazy · 2012-05-26

But it is very useful function for filtering some objects class,
especially for PickButon ctrl.

3DV · 2012-05-26

Nice one, thanks!

On a sidenote, considering coding: isKindof is hilarious!

barigazy · 2012-05-26

I don't understand what is hilarious in "isKindof"?

Simplified version

barigazy · 2012-05-26

Or you can use simplified version


select (for geo in geometry where not isKindof geo TargetObject and isKindOf geo.material UndefinedClass collect geo)

Obj with no material

barigazy · 2012-05-26

It easy task.Try this code


select (for obj in objects where isKindof obj GeometryClass and not isKindof obj TargetObject and obj.material == undefined collect obj)

Are you need rollout dialog for this?