15
$\begingroup$

Is there a way to see a list of all objects in the scene with the number of verts, tris, faces of each object?

I know you can click on a object and go into edit mode and it shows the numbers, but if you have many objects in a scene and you have to decrease the amount of verts in the scene this procedure gets tiresome.

A list with all objects of the scene and their counts where you can immediately see where you could possibly remove some verts would be very handy.

------------------------------------------------------------

Edit: If anyone is interested the user sambler and i (independently) both wrote an addon. Look further down for his solution.

Mine is downloadable here: pasteAll download

enter image description here

The addon shows the geometry information of the scene. It is sortable and you can select an object by clicking on the button.

$\endgroup$
3
  • 1
    $\begingroup$ @brasshat: your link is not working anymore. I'd like to try yours for the sorting portion (nothing against samblers, it works). Any chance of re-posting it? $\endgroup$
    – Jahf
    Commented Jul 24, 2015 at 21:43
  • $\begingroup$ @Jahif, thanks, but it was not my link. I merely added one tag to the question. The missing link was by Biene Maja, who does not seem to have been active in the community for nearly a year. . $\endgroup$
    – brasshat
    Commented Jul 26, 2015 at 10:18
  • $\begingroup$ Maybe if someone has this they can reupload it somewhere? Otherwise the question should be edited $\endgroup$ Commented Jan 17, 2017 at 6:56

4 Answers 4

8
$\begingroup$

I miss the tris so far but you can do that :

import bpy
print("Object, Verts, faces, edges")
for element in bpy.context.scene.objects:
    if element.type != "MESH": continue
    print("%s, %i, %i, %i" % (element.data.name, len(element.data.vertices), len(element.data.polygons), len(element.data.edges)))

That will return in the console the informations you are looking for :

Object, Verts, faces, edges
Cone, 33, 33, 64
Cube, 8, 6, 12
Cube.001, 8, 6, 12
$\endgroup$
4
  • $\begingroup$ Note that this isn't the actual count of geometric elements on screen - modifiers are not included. $\endgroup$
    – CodeManX
    Commented Jul 4, 2014 at 19:07
  • 1
    $\begingroup$ 3 issues in this example, no need to call list(), and use bpy.context.scene.objects, not bpy.data.objects, if element.type not in ("MESH") is also incorrect. != 'MESH' is fine here. no need to call __str__.__contains__ $\endgroup$
    – ideasman42
    Commented Jul 4, 2014 at 19:20
  • $\begingroup$ Thanks for the answers! Is there a way to include modifiers? $\endgroup$
    – Biene Maja
    Commented Jul 5, 2014 at 13:58
  • $\begingroup$ Thanks for the feedback and fixes. I'll update my post. But I was using "in" so he can include something else than the meshes if needed. But it's clearer with the other test. Sorry @BieneMaja, so far I don't know how to get the count including the modifiers... without applying them... I'll think about it. $\endgroup$
    – Flavio
    Commented Jul 7, 2014 at 8:04
22
$\begingroup$

With some inspiration from the other answers I made an addon to show mesh information.

You can save this link to your addon folder or to somewhere convenient and use the Install from file button in the preferences. As awi's step of using bmesh to calculate the vertices after modifiers are applied takes some time in larger scenes, even without modifiers (a few seconds with a million verts scene) I have displaying that count as an option.

When you enable the addon there is an option to set how many mesh objects are listed (default is 5). The list is sorted by the true vertex count so you can easily see what objects have the vertices. Also large numbers are nicely truncated with k,M,G suffixes to make for easier reading.

Once enabled you can find the Mesh Information panel under scene properties.

enter image description here

$\endgroup$
5
  • $\begingroup$ Neat! reminds me of the meshlint addon. $\endgroup$
    – gandalf3
    Commented Jul 9, 2014 at 7:52
  • $\begingroup$ Nice :) I basicly did the same lol. $\endgroup$
    – Biene Maja
    Commented Jul 12, 2014 at 22:27
  • $\begingroup$ Thanks, however doesn't work completely with 2.8 (option modifiers displays nothing except number of vertices for the first object) $\endgroup$
    – mins
    Commented Jan 24, 2020 at 21:44
  • $\begingroup$ @mins yes I didn't update it after the 2.80 release, it is fixed now. $\endgroup$
    – sambler
    Commented Jan 26, 2020 at 10:42
  • $\begingroup$ You are a god, thanks $\endgroup$ Commented Sep 2, 2023 at 19:25
2
$\begingroup$

It's an update of @Flavio answer.

There is a way to get the final polycount. An object after conversion to BMesh will have the modifiers already applied:

import bpy
import bmesh
print( "Object, Verts, faces, edges" )
for element in bpy.context.scene.objects:
    if element.type != "MESH": continue
    finalMesh = bmesh.new()
    finalMesh.from_object( element, bpy.context.scene )
    print( "%s, %i, %i, %i" % ( element.name, len( finalMesh.verts ), len( finalMesh.faces ), len( finalMesh.edges ) ) )
finalMesh.free()
$\endgroup$
2
  • 1
    $\begingroup$ I was updating my question with your great answer but creating another answer is better. Thanks ! Beaware that if the finalMesh = bmesh.new() is not in the loop it will increment your answer and be wrong. I my case I had (before including it in the loop : Cube.001, 6179, 6177, 12352 Cube, 6187, 6183, 12364 And then (once in the loop) Cube.001, 6146, 6144, 12288 Cube, 8, 6, 12 $\endgroup$
    – Flavio
    Commented Jul 7, 2014 at 9:09
  • $\begingroup$ Whoa. I should never post without testing on bigger scenes :) Thanks $\endgroup$ Commented Jul 7, 2014 at 9:53
1
$\begingroup$

Sorry for the up but it is thanks to this thread that I could write my own polycount addon, so I share it if this can help people : https://github.com/Vinc3r/Polycount

Here stats are shown only for objects in selection, in verts & tri.

blender stats tool

$\endgroup$
3
  • $\begingroup$ Hi Vinc3r, does your addon still perform the feature listed here? The github page seems to indicate other features. $\endgroup$ Commented Apr 19, 2020 at 12:51
  • 2
    $\begingroup$ I've made some breaking changes of my main addon, which is became ReTiCo : github.com/Vinc3r/ReTiCo and you'll now find my new PolyCount addon with more features here : github.com/Vinc3r/Polycount $\endgroup$
    – Vinc3r
    Commented Apr 20, 2020 at 14:47
  • $\begingroup$ THANK YOU for the up, not sorry :-) $\endgroup$ Commented Oct 27, 2021 at 13:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .