Announcement

Collapse
No announcement yet.

is there a script to count number of materials in the scene?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • is there a script to count number of materials in the scene?

    I got a scene with what seems like a thousand shaders in it. Multisubmats with materials inside, and I am just curious if there is a script that can count how many materials including submaterials are in the scene?
    Dmitry Vinnik
    Silhouette Images Inc.
    ShowReel:
    https://www.youtube.com/watch?v=qxSJlvSwAhA
    https://www.linkedin.com/in/dmitry-v...-identity-name

  • #2
    This should give you a good estimate:

    Code:
    unique_scene_materials = #()
    
    fn collectMaterials material_list = (
        for m in material_list do (
            if (classof m == Multimaterial) then collectMaterials m.materialList
            else appendIfUnique unique_scene_materials m
        )
    )
    
    collectMaterials sceneMaterials
    
    print (unique_scene_materials.count as string + " materials in the scene.")
    Note it doesn't count Submaterials as I don't consider them materials per se, delete the "else" if you want them to be added.

    Cheers

    Comment


    • #3
      I used a script called material lister available on scriptspot

      it does crash if you have a ridiculous amount of materials but its got a nice interface for finding different mat types

      Comment

      Working...
      X