ScriptSpot home

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

this what you looking for

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

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

Reply to fajar
Branko Živković

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

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

Reply to fajar
Branko Živković

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!

fajar

select (for i in objects

select (for i in objects where i.material==undefined collect i)
Reply to fajar
Branko Živković

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

Reply to fajar
M3

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.

Reply to M3
Branko Živković

No need for that. Just use this

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

3DV

isKindof means: 'is a bit like'

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

Reply to 3DV
Branko Živković

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

3DV

Nice one, thanks!

On a sidenote, considering coding: isKindof is hilarious!

Reply to 3DV
Branko Živković

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

Branko Živković

Simplified version

Or you can use simplified version


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

Obj with no material

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?