1 # SPDX-License-Identifier: GPL-2.0-or-later
2 # Copyright 2010 Mariano Hidalgo
4 # Show Information About the Blend.
7 "name": "Scene Information",
8 "author": "uselessdreamer",
10 "blender": (2, 80, 0),
11 "location": "Properties > Scene > Blend Info Panel",
12 "description": "Show information about the .blend",
14 "doc_url": "{BLENDER_MANUAL_URL}/addons/system/blend_info.html",
21 def quantity_string(quantity
, text_single
, text_plural
, text_none
=None):
25 text_none
= text_plural
28 string
= str(quantity
) + sep
+ text_none
31 string
= str(quantity
) + sep
+ text_single
34 string
= str(quantity
) + sep
+ text_plural
42 class OBJECT_PT_blendinfo(bpy
.types
.Panel
):
43 bl_label
= "Blend Info"
44 bl_space_type
= "PROPERTIES"
45 bl_region_type
= "WINDOW"
47 bl_options
= {'DEFAULT_CLOSED'}
49 def draw(self
, context
):
53 objects
= bpy
.data
.objects
60 num
= len(bpy
.data
.objects
)
61 l_row
.label(text
=quantity_string(num
, "Object", "Objects")
66 ob_cols
.append(l_row
.column())
67 ob_cols
.append(l_row
.column())
69 row
= ob_cols
[0].row()
70 meshes
= [o
for o
in objects
.values() if o
.type == 'MESH']
72 row
.label(text
=quantity_string(num
, "Mesh", "Meshes"),
75 row
= ob_cols
[1].row()
76 curves
= [o
for o
in objects
.values() if o
.type == 'CURVE']
78 row
.label(text
=quantity_string(num
, "Curve", "Curves"),
81 row
= ob_cols
[0].row()
82 cameras
= [o
for o
in objects
.values() if o
.type == 'CAMERA']
84 row
.label(text
=quantity_string(num
, "Camera", "Cameras"),
87 row
= ob_cols
[1].row()
88 lamps
= [o
for o
in objects
.values() if o
.type == 'LIGHT']
90 row
.label(text
=quantity_string(num
, "Lamp", "Lamps"),
93 row
= ob_cols
[0].row()
94 armatures
= [o
for o
in objects
.values() if o
.type == 'ARMATURE']
96 row
.label(text
=quantity_string(num
, "Armature", "Armatures"),
99 row
= ob_cols
[1].row()
100 lattices
= [o
for o
in objects
.values() if o
.type == 'LATTICE']
102 row
.label(text
=quantity_string(num
, "Lattice", "Lattices"),
105 row
= ob_cols
[0].row()
106 empties
= [o
for o
in objects
.values() if o
.type == 'EMPTY']
108 row
.label(text
=quantity_string(num
, "Empty", "Empties"),
111 row
= ob_cols
[1].row()
112 empties
= [o
for o
in objects
.values() if o
.type == 'SPEAKER']
114 row
.label(text
=quantity_string(num
, "Speaker", "Speakers"),
115 icon
='OUTLINER_OB_SPEAKER')
122 num
= len(bpy
.data
.objects
)
123 l_row
.label(text
="Datablocks in the scene:")
126 db_cols
.append(l_row
.column())
127 db_cols
.append(l_row
.column())
129 row
= db_cols
[0].row()
130 num
= len(bpy
.data
.meshes
)
131 row
.label(text
=quantity_string(num
, "Mesh", "Meshes"),
134 row
= db_cols
[1].row()
135 num
= len(bpy
.data
.curves
)
136 row
.label(text
=quantity_string(num
, "Curve", "Curves"),
139 row
= db_cols
[0].row()
140 num
= len(bpy
.data
.cameras
)
141 row
.label(text
=quantity_string(num
, "Camera", "Cameras"),
144 row
= db_cols
[1].row()
145 num
= len(bpy
.data
.lights
)
146 row
.label(text
=quantity_string(num
, "Lamp", "Lamps"),
149 row
= db_cols
[0].row()
150 num
= len(bpy
.data
.armatures
)
151 row
.label(text
=quantity_string(num
, "Armature", "Armatures"),
152 icon
='ARMATURE_DATA')
154 row
= db_cols
[1].row()
155 num
= len(bpy
.data
.lattices
)
156 row
.label(text
=quantity_string(num
, "Lattice", "Lattices"),
159 row
= db_cols
[0].row()
160 num
= len(bpy
.data
.materials
)
161 row
.label(text
=quantity_string(num
, "Material", "Materials"),
162 icon
='MATERIAL_DATA')
164 row
= db_cols
[1].row()
165 num
= len(bpy
.data
.worlds
)
166 row
.label(text
=quantity_string(num
, "World", "Worlds"),
169 row
= db_cols
[0].row()
170 num
= len(bpy
.data
.textures
)
171 row
.label(text
=quantity_string(num
, "Texture", "Textures"),
174 row
= db_cols
[1].row()
175 num
= len(bpy
.data
.images
)
176 row
.label(text
=quantity_string(num
, "Image", "Images"),
179 row
= db_cols
[0].row()
180 num
= len(bpy
.data
.texts
)
181 row
.label(text
=quantity_string(num
, "Text", "Texts"),
190 from bpy
.utils
import register_class
195 from bpy
.utils
import unregister_class
196 for cls
in reversed(classes
):
197 unregister_class(cls
)
200 if __name__
== "__main__":