13
$\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$
  • 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 Jul 24 '15 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 Jul 26 '15 at 10:18
  • $\begingroup$ Maybe if someone has this they can reupload it somewhere? Otherwise the question should be edited $\endgroup$ – MicroMachine Jan 17 '17 at 6:56
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
| improve this answer | |
$\endgroup$
  • $\begingroup$ Note that this isn't the actual count of geometric elements on screen - modifiers are not included. $\endgroup$ – CodeManX Jul 4 '14 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 Jul 4 '14 at 19:20
  • $\begingroup$ Thanks for the answers! Is there a way to include modifiers? $\endgroup$ – Biene Maja Jul 5 '14 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 Jul 7 '14 at 8:04
21
$\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

| improve this answer | |
$\endgroup$
  • $\begingroup$ Neat! reminds me of the meshlint addon. $\endgroup$ – gandalf3 Jul 9 '14 at 7:52
  • $\begingroup$ Nice :) I basicly did the same lol. $\endgroup$ – Biene Maja Jul 12 '14 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 Jan 24 at 21:44
  • $\begingroup$ @mins yes I didn't update it after the 2.80 release, it is fixed now. $\endgroup$ – sambler Jan 26 at 10:42
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()
| improve this answer | |
$\endgroup$
  • 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 Jul 7 '14 at 9:09
  • $\begingroup$ Whoa. I should never post without testing on bigger scenes :) Thanks $\endgroup$ – Oskar Świerad Jul 7 '14 at 9:53
0
$\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

| improve this answer | |
$\endgroup$
  • $\begingroup$ Hi Vinc3r, does your addon still perform the feature listed here? The github page seems to indicate other features. $\endgroup$ – softyoda yoann Apr 19 at 12:51
  • 1
    $\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 Apr 20 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.