1 # scene_blend_info.py Copyright (C) 2010, Mariano Hidalgo
3 # Show Information About the Blend.
4 # ***** BEGIN GPL LICENSE BLOCK *****
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
9 # as published by the Free Software Foundation; either version 2
10 # of the License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 # ***** END GPL LICENCE BLOCK *****
24 "name": "Scene Information",
25 "author": "uselessdreamer",
27 "blender": (2, 80, 0),
28 "location": "Properties > Scene > Blend Info Panel",
29 "description": "Show information about the .blend",
31 "wiki_url": "https://docs.blender.org/manual/en/dev/addons/"
32 "system/blend_info.html",
39 def quantity_string(quantity
, text_single
, text_plural
, text_none
=None):
43 text_none
= text_plural
46 string
= str(quantity
) + sep
+ text_none
49 string
= str(quantity
) + sep
+ text_single
52 string
= str(quantity
) + sep
+ text_plural
60 class OBJECT_PT_blendinfo(bpy
.types
.Panel
):
61 bl_label
= "Blend Info"
62 bl_space_type
= "PROPERTIES"
63 bl_region_type
= "WINDOW"
65 bl_options
= {'DEFAULT_CLOSED'}
67 def draw(self
, context
):
71 objects
= bpy
.data
.objects
78 num
= len(bpy
.data
.objects
)
79 l_row
.label(text
=quantity_string(num
, "Object", "Objects")
84 ob_cols
.append(l_row
.column())
85 ob_cols
.append(l_row
.column())
87 row
= ob_cols
[0].row()
88 meshes
= [o
for o
in objects
.values() if o
.type == 'MESH']
90 row
.label(text
=quantity_string(num
, "Mesh", "Meshes"),
93 row
= ob_cols
[1].row()
94 curves
= [o
for o
in objects
.values() if o
.type == 'CURVE']
96 row
.label(text
=quantity_string(num
, "Curve", "Curves"),
99 row
= ob_cols
[0].row()
100 cameras
= [o
for o
in objects
.values() if o
.type == 'CAMERA']
102 row
.label(text
=quantity_string(num
, "Camera", "Cameras"),
105 row
= ob_cols
[1].row()
106 lamps
= [o
for o
in objects
.values() if o
.type == 'LIGHT']
108 row
.label(text
=quantity_string(num
, "Lamp", "Lamps"),
111 row
= ob_cols
[0].row()
112 armatures
= [o
for o
in objects
.values() if o
.type == 'ARMATURE']
114 row
.label(text
=quantity_string(num
, "Armature", "Armatures"),
115 icon
='ARMATURE_DATA')
117 row
= ob_cols
[1].row()
118 lattices
= [o
for o
in objects
.values() if o
.type == 'LATTICE']
120 row
.label(text
=quantity_string(num
, "Lattice", "Lattices"),
123 row
= ob_cols
[0].row()
124 empties
= [o
for o
in objects
.values() if o
.type == 'EMPTY']
126 row
.label(text
=quantity_string(num
, "Empty", "Empties"),
129 row
= ob_cols
[1].row()
130 empties
= [o
for o
in objects
.values() if o
.type == 'SPEAKER']
132 row
.label(text
=quantity_string(num
, "Speaker", "Speakers"),
133 icon
='OUTLINER_OB_SPEAKER')
140 num
= len(bpy
.data
.objects
)
141 l_row
.label(text
="Datablocks in the scene:")
144 db_cols
.append(l_row
.column())
145 db_cols
.append(l_row
.column())
147 row
= db_cols
[0].row()
148 num
= len(bpy
.data
.meshes
)
149 row
.label(text
=quantity_string(num
, "Mesh", "Meshes"),
152 row
= db_cols
[1].row()
153 num
= len(bpy
.data
.curves
)
154 row
.label(text
=quantity_string(num
, "Curve", "Curves"),
157 row
= db_cols
[0].row()
158 num
= len(bpy
.data
.cameras
)
159 row
.label(text
=quantity_string(num
, "Camera", "Cameras"),
162 row
= db_cols
[1].row()
163 num
= len(bpy
.data
.lights
)
164 row
.label(text
=quantity_string(num
, "Lamp", "Lamps"),
167 row
= db_cols
[0].row()
168 num
= len(bpy
.data
.armatures
)
169 row
.label(text
=quantity_string(num
, "Armature", "Armatures"),
170 icon
='ARMATURE_DATA')
172 row
= db_cols
[1].row()
173 num
= len(bpy
.data
.lattices
)
174 row
.label(text
=quantity_string(num
, "Lattice", "Lattices"),
177 row
= db_cols
[0].row()
178 num
= len(bpy
.data
.materials
)
179 row
.label(text
=quantity_string(num
, "Material", "Materials"),
180 icon
='MATERIAL_DATA')
182 row
= db_cols
[1].row()
183 num
= len(bpy
.data
.worlds
)
184 row
.label(text
=quantity_string(num
, "World", "Worlds"),
187 row
= db_cols
[0].row()
188 num
= len(bpy
.data
.textures
)
189 row
.label(text
=quantity_string(num
, "Texture", "Textures"),
192 row
= db_cols
[1].row()
193 num
= len(bpy
.data
.images
)
194 row
.label(text
=quantity_string(num
, "Image", "Images"),
197 row
= db_cols
[0].row()
198 num
= len(bpy
.data
.texts
)
199 row
.label(text
=quantity_string(num
, "Text", "Texts"),
208 from bpy
.utils
import register_class
213 from bpy
.utils
import unregister_class
214 for cls
in reversed(classes
):
215 unregister_class(cls
)
218 if __name__
== "__main__":