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 "doc_url": "{BLENDER_MANUAL_URL}/addons/system/blend_info.html",
38 def quantity_string(quantity
, text_single
, text_plural
, text_none
=None):
42 text_none
= text_plural
45 string
= str(quantity
) + sep
+ text_none
48 string
= str(quantity
) + sep
+ text_single
51 string
= str(quantity
) + sep
+ text_plural
59 class OBJECT_PT_blendinfo(bpy
.types
.Panel
):
60 bl_label
= "Blend Info"
61 bl_space_type
= "PROPERTIES"
62 bl_region_type
= "WINDOW"
64 bl_options
= {'DEFAULT_CLOSED'}
66 def draw(self
, context
):
70 objects
= bpy
.data
.objects
77 num
= len(bpy
.data
.objects
)
78 l_row
.label(text
=quantity_string(num
, "Object", "Objects")
83 ob_cols
.append(l_row
.column())
84 ob_cols
.append(l_row
.column())
86 row
= ob_cols
[0].row()
87 meshes
= [o
for o
in objects
.values() if o
.type == 'MESH']
89 row
.label(text
=quantity_string(num
, "Mesh", "Meshes"),
92 row
= ob_cols
[1].row()
93 curves
= [o
for o
in objects
.values() if o
.type == 'CURVE']
95 row
.label(text
=quantity_string(num
, "Curve", "Curves"),
98 row
= ob_cols
[0].row()
99 cameras
= [o
for o
in objects
.values() if o
.type == 'CAMERA']
101 row
.label(text
=quantity_string(num
, "Camera", "Cameras"),
104 row
= ob_cols
[1].row()
105 lamps
= [o
for o
in objects
.values() if o
.type == 'LIGHT']
107 row
.label(text
=quantity_string(num
, "Lamp", "Lamps"),
110 row
= ob_cols
[0].row()
111 armatures
= [o
for o
in objects
.values() if o
.type == 'ARMATURE']
113 row
.label(text
=quantity_string(num
, "Armature", "Armatures"),
114 icon
='ARMATURE_DATA')
116 row
= ob_cols
[1].row()
117 lattices
= [o
for o
in objects
.values() if o
.type == 'LATTICE']
119 row
.label(text
=quantity_string(num
, "Lattice", "Lattices"),
122 row
= ob_cols
[0].row()
123 empties
= [o
for o
in objects
.values() if o
.type == 'EMPTY']
125 row
.label(text
=quantity_string(num
, "Empty", "Empties"),
128 row
= ob_cols
[1].row()
129 empties
= [o
for o
in objects
.values() if o
.type == 'SPEAKER']
131 row
.label(text
=quantity_string(num
, "Speaker", "Speakers"),
132 icon
='OUTLINER_OB_SPEAKER')
139 num
= len(bpy
.data
.objects
)
140 l_row
.label(text
="Datablocks in the scene:")
143 db_cols
.append(l_row
.column())
144 db_cols
.append(l_row
.column())
146 row
= db_cols
[0].row()
147 num
= len(bpy
.data
.meshes
)
148 row
.label(text
=quantity_string(num
, "Mesh", "Meshes"),
151 row
= db_cols
[1].row()
152 num
= len(bpy
.data
.curves
)
153 row
.label(text
=quantity_string(num
, "Curve", "Curves"),
156 row
= db_cols
[0].row()
157 num
= len(bpy
.data
.cameras
)
158 row
.label(text
=quantity_string(num
, "Camera", "Cameras"),
161 row
= db_cols
[1].row()
162 num
= len(bpy
.data
.lights
)
163 row
.label(text
=quantity_string(num
, "Lamp", "Lamps"),
166 row
= db_cols
[0].row()
167 num
= len(bpy
.data
.armatures
)
168 row
.label(text
=quantity_string(num
, "Armature", "Armatures"),
169 icon
='ARMATURE_DATA')
171 row
= db_cols
[1].row()
172 num
= len(bpy
.data
.lattices
)
173 row
.label(text
=quantity_string(num
, "Lattice", "Lattices"),
176 row
= db_cols
[0].row()
177 num
= len(bpy
.data
.materials
)
178 row
.label(text
=quantity_string(num
, "Material", "Materials"),
179 icon
='MATERIAL_DATA')
181 row
= db_cols
[1].row()
182 num
= len(bpy
.data
.worlds
)
183 row
.label(text
=quantity_string(num
, "World", "Worlds"),
186 row
= db_cols
[0].row()
187 num
= len(bpy
.data
.textures
)
188 row
.label(text
=quantity_string(num
, "Texture", "Textures"),
191 row
= db_cols
[1].row()
192 num
= len(bpy
.data
.images
)
193 row
.label(text
=quantity_string(num
, "Image", "Images"),
196 row
= db_cols
[0].row()
197 num
= len(bpy
.data
.texts
)
198 row
.label(text
=quantity_string(num
, "Text", "Texts"),
207 from bpy
.utils
import register_class
212 from bpy
.utils
import unregister_class
213 for cls
in reversed(classes
):
214 unregister_class(cls
)
217 if __name__
== "__main__":