glTF exporter: Reset pose bone between each action
[blender-addons.git] / system_blend_info.py
blobb8e79a6fd0fa7df724f4f30225682f7af5cb515b
1 # SPDX-License-Identifier: GPL-2.0-or-later
2 # Copyright 2010 Mariano Hidalgo
4 # Show Information About the Blend.
6 bl_info = {
7 "name": "Scene Information",
8 "author": "uselessdreamer",
9 "version": (0, 3, 1),
10 "blender": (2, 80, 0),
11 "location": "Properties > Scene > Blend Info Panel",
12 "description": "Show information about the .blend",
13 "warning": "",
14 "doc_url": "{BLENDER_MANUAL_URL}/addons/system/blend_info.html",
15 "category": "System",
18 import bpy
21 def quantity_string(quantity, text_single, text_plural, text_none=None):
22 sep = " "
24 if not text_none:
25 text_none = text_plural
27 if quantity == 0:
28 string = str(quantity) + sep + text_none
30 if quantity == 1:
31 string = str(quantity) + sep + text_single
33 if quantity >= 2:
34 string = str(quantity) + sep + text_plural
36 if quantity < 0:
37 return None
39 return string
42 class OBJECT_PT_blendinfo(bpy.types.Panel):
43 bl_label = "Blend Info"
44 bl_space_type = "PROPERTIES"
45 bl_region_type = "WINDOW"
46 bl_context = "scene"
47 bl_options = {'DEFAULT_CLOSED'}
49 def draw(self, context):
50 ob_cols = []
51 db_cols = []
53 objects = bpy.data.objects
55 layout = self.layout
57 # OBJECTS
59 l_row = layout.row()
60 num = len(bpy.data.objects)
61 l_row.label(text=quantity_string(num, "Object", "Objects")
62 + " in the scene:",
63 icon='OBJECT_DATA')
65 l_row = layout.row()
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']
71 num = len(meshes)
72 row.label(text=quantity_string(num, "Mesh", "Meshes"),
73 icon='MESH_DATA')
75 row = ob_cols[1].row()
76 curves = [o for o in objects.values() if o.type == 'CURVE']
77 num = len(curves)
78 row.label(text=quantity_string(num, "Curve", "Curves"),
79 icon='CURVE_DATA')
81 row = ob_cols[0].row()
82 cameras = [o for o in objects.values() if o.type == 'CAMERA']
83 num = len(cameras)
84 row.label(text=quantity_string(num, "Camera", "Cameras"),
85 icon='CAMERA_DATA')
87 row = ob_cols[1].row()
88 lamps = [o for o in objects.values() if o.type == 'LIGHT']
89 num = len(lamps)
90 row.label(text=quantity_string(num, "Lamp", "Lamps"),
91 icon='LIGHT_DATA')
93 row = ob_cols[0].row()
94 armatures = [o for o in objects.values() if o.type == 'ARMATURE']
95 num = len(armatures)
96 row.label(text=quantity_string(num, "Armature", "Armatures"),
97 icon='ARMATURE_DATA')
99 row = ob_cols[1].row()
100 lattices = [o for o in objects.values() if o.type == 'LATTICE']
101 num = len(lattices)
102 row.label(text=quantity_string(num, "Lattice", "Lattices"),
103 icon='LATTICE_DATA')
105 row = ob_cols[0].row()
106 empties = [o for o in objects.values() if o.type == 'EMPTY']
107 num = len(empties)
108 row.label(text=quantity_string(num, "Empty", "Empties"),
109 icon='EMPTY_DATA')
111 row = ob_cols[1].row()
112 empties = [o for o in objects.values() if o.type == 'SPEAKER']
113 num = len(empties)
114 row.label(text=quantity_string(num, "Speaker", "Speakers"),
115 icon='OUTLINER_OB_SPEAKER')
117 layout.separator()
119 # DATABLOCKS
121 l_row = layout.row()
122 num = len(bpy.data.objects)
123 l_row.label(text="Datablocks in the scene:")
125 l_row = layout.row()
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"),
132 icon='MESH_DATA')
134 row = db_cols[1].row()
135 num = len(bpy.data.curves)
136 row.label(text=quantity_string(num, "Curve", "Curves"),
137 icon='CURVE_DATA')
139 row = db_cols[0].row()
140 num = len(bpy.data.cameras)
141 row.label(text=quantity_string(num, "Camera", "Cameras"),
142 icon='CAMERA_DATA')
144 row = db_cols[1].row()
145 num = len(bpy.data.lights)
146 row.label(text=quantity_string(num, "Lamp", "Lamps"),
147 icon='LIGHT_DATA')
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"),
157 icon='LATTICE_DATA')
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"),
167 icon='WORLD_DATA')
169 row = db_cols[0].row()
170 num = len(bpy.data.textures)
171 row.label(text=quantity_string(num, "Texture", "Textures"),
172 icon='TEXTURE_DATA')
174 row = db_cols[1].row()
175 num = len(bpy.data.images)
176 row.label(text=quantity_string(num, "Image", "Images"),
177 icon='IMAGE_DATA')
179 row = db_cols[0].row()
180 num = len(bpy.data.texts)
181 row.label(text=quantity_string(num, "Text", "Texts"),
182 icon='TEXT')
184 # Register
185 classes = [
186 OBJECT_PT_blendinfo
189 def register():
190 from bpy.utils import register_class
191 for cls in classes:
192 register_class(cls)
194 def unregister():
195 from bpy.utils import unregister_class
196 for cls in reversed(classes):
197 unregister_class(cls)
200 if __name__ == "__main__":
201 register()