getting object selection from map

Hi, i'd like to be able to get a selection of objects based on the presence of a map in the object's material

right now for a specific material i do use something like

 on findvrblend pressed do (for o in objects where classof o.material == VRayBlendMtl do selectmore o)

this will let me search and select all the objects that have a vrayblendmtl

however (of course) this wont work if i try to get the material through a map in the material slot, let say a vraydirt.

i'm guessing i need to write it to an array which i can get with  getclassinstances vraydirt however i can't go further i spent about an afternoon in searchings and lots of tests but i can't get a clue.

thankyou in advance
cdb

Comments

Comment viewing options

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

...

Are you try this tool?
http://www.scriptspot.com/3ds-max/scripts/select-objects-by-bitmaptex

barigazy

cdb's picture

yes i tryed it, however it

yes i tryed it, however it looks to me it work only on bitmaptextures and with a specific name not entire class (for example vraydirt or vraycolor etc...), plus i'd like to embedd it in a wider utility i'm trying to get around. i'm pretty sure it's feasible but can't get it working right now, i looked inside a lot of users scripts but can't find a solution right now. thank you very much tough, have a nice day

pixamoon's picture

`

oki, try this one:

that's just modified function form other posts by barigazy

objs = for o in objects where (getclassinstances VRayDirt target:o).count > 0 collect o
 
select objs
cdb's picture

Good!

Hey pixamoon! it works very well! thank you so much!
i have only one thing to ask, i tried to get it into a one line script but if i do it it give me a

type error: Call needs function or class, got: .....

is it because the first line "objs = for o...." is a variable right?
how would i get this working on a maxscript listener?
of course this script is so ok!and i don't actually need it to be one line but i'm just curious, i tried to embrace with nested parenthesis but it seems to not work.

THANK YOU so much mr.pixamoon and mr.Barigazy
all the best
cdb

pixamoon's picture

`

no prob :)

to make it in one line it will look like this :

for o in objects where (getclassinstances VRayDirt target:o).count > 0 do selectmore o

but I think this could be slower, because multiple operations in viewport - selectmore

cdb's picture

wow!

Thank you very much! i'll update the old code with your method instead of the selectmore.
i will study those lines and eventually get back for questions :)

thanks again for the support

Comment viewing options

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