Selecting objects from multiple materials

   1601   1   1
User Avatar
Member
2 posts
Joined: Nov. 2020
Offline
Hi,

Is there a way to select multiple objects from multiple materials at the same time? I'm aware of the “Select” button on the Material Palette, it only allows you to select one material at a time.

Lets say I have 100 objects with 100 materials assigned, it's not easy to select these objects in the viewport just by dragging a selection box, so I want to select the 100 material nodes and then somehow select the 100 objects that correspond to those materials, so that I can apply 1 single consolidated material to all of them. I'm dealing with an imported FBX with 2500 unique materials.

Is there a way to do this, or do I have to use python?

Thanks,
User Avatar
Member
2 posts
Joined: Nov. 2020
Offline
OK, I was able to figure out something with Python, I'm totally new to Python, so this is maybe not the “right” way of doing this, but it works for what I need.

So I use the search(crtl+f) in the network view to select all materials with the same name, for instance orange_1, orange_2..you get the idea, then I run this script over the selected nodes that returns the dependencies and then it goes and selects each one of those dependencies, then I can just select the new material I want to apply and hit assign in the material palette.
import hou

for node in hou.selectedNodes():
    selmat = node.dependents()
    for i in selmat:
        i.setSelected(True,False)

This is going to save me quite a bit of time, instead of going over 2000+ material nodes I can just do 50 searches and apply new consolidated materials. I think what I will try to find out next is a way to select nodes that have similar name and group them together and apply the new material automatically.
Edited by jloredo - Nov. 6, 2020 13:55:42
  • Quick Links