[Closed] Selection by Diffuse Color
[left]Hello everyone,[/left]
[left]Well I’m trying to create a script that collects all the objects with the same diffuse color. I’ve gotten some of the info I need from other threads. But I’m having trouble on one spot. [/left]
[left]So from this thread[/left]
[left] http://forums.cgsociety.org/showthread.php?f=98&t=772087&page=1&pp=15 [/left]
[left]I adjusted some of the script and this is where I’m currently at.[/left]
([indent][indent][left]mats= for m in sceneMaterials collect mfor m in mats do [left]([/left]
[left]if m.diffuse == color 150 150 150 do [/left]
[left]–So for example I need the mats with this diffuse color to do what action I need below[/left]
[left]( [/left]
[left]–Select the all objects with the diffuse color properties above[/left]
[left])[/left]
[left])[/left]
[left])[/left]
[/left]
[/indent][/indent][left]So I dont know how to go about selecting the objects with the specific diffuse color applied.All I really need to do is select all the materials with this certain diffuse color applied to them and select these objects so I can just apply a new material to them.[/left]
[left] [/left]
[left]([/left]
[left]mats= for m in sceneMaterials collect m[/left]
[left]for m in mats do[/left]
( [left]if m.diffuse == color 150 150 150 do[/left]
[left]( m.diffuse = color 1 1 1 –So I know something like this works for example.–Just dont know how to go about and selecting the objects in the scene. [/left]
[left])[/left]
[left])[/left]
[left]) [/left]
[left]Thanks for any help that is posted[/left]
[left]Alex Antuna[/left]
try this:
objectsArray=for i in objects where i.material.diffuse==color 150 150 150 collect i
select objectsArray
theObjs = #()
for m in scenematerials where m.diffusecolor == color 150 150 150 do join theObjs (refs.dependentNodes m)
select theObjs
plastic and jonlauf Thank you for the Replies! I tried them both and they work great.
jonlauf – on yours I just had to change the text m.diffusecolor to m.diffuse and it worked after that. I’m using Vray so not sure if that had something to do with it not working with the original text you posted.
Alex