Rigify: store advanced options in armature instead of window manager.
[blender-addons.git] / system_blend_info.py
blobe49748e358fde4954521d11ce690af799cc816b9
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 *****
23 bl_info = {
24 "name": "Scene Information",
25 "author": "uselessdreamer",
26 "version": (0, 3, 1),
27 "blender": (2, 80, 0),
28 "location": "Properties > Scene > Blend Info Panel",
29 "description": "Show information about the .blend",
30 "warning": "",
31 "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
32 "Scripts/System/Blend Info",
33 "category": "System",
36 import bpy
39 def quantity_string(quantity, text_single, text_plural, text_none=None):
40 sep = " "
42 if not text_none:
43 text_none = text_plural
45 if quantity == 0:
46 string = str(quantity) + sep + text_none
48 if quantity == 1:
49 string = str(quantity) + sep + text_single
51 if quantity >= 2:
52 string = str(quantity) + sep + text_plural
54 if quantity < 0:
55 return None
57 return string
60 class OBJECT_PT_blendinfo(bpy.types.Panel):
61 bl_label = "Blend Info"
62 bl_space_type = "PROPERTIES"
63 bl_region_type = "WINDOW"
64 bl_context = "scene"
65 bl_options = {'DEFAULT_CLOSED'}
67 def draw(self, context):
68 ob_cols = []
69 db_cols = []
71 objects = bpy.data.objects
73 layout = self.layout
75 # OBJECTS
77 l_row = layout.row()
78 num = len(bpy.data.objects)
79 l_row.label(text=quantity_string(num, "Object", "Objects")
80 + " in the scene:",
81 icon='OBJECT_DATA')
83 l_row = layout.row()
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']
89 num = len(meshes)
90 row.label(text=quantity_string(num, "Mesh", "Meshes"),
91 icon='MESH_DATA')
93 row = ob_cols[1].row()
94 curves = [o for o in objects.values() if o.type == 'CURVE']
95 num = len(curves)
96 row.label(text=quantity_string(num, "Curve", "Curves"),
97 icon='CURVE_DATA')
99 row = ob_cols[0].row()
100 cameras = [o for o in objects.values() if o.type == 'CAMERA']
101 num = len(cameras)
102 row.label(text=quantity_string(num, "Camera", "Cameras"),
103 icon='CAMERA_DATA')
105 row = ob_cols[1].row()
106 lamps = [o for o in objects.values() if o.type == 'LIGHT']
107 num = len(lamps)
108 row.label(text=quantity_string(num, "Lamp", "Lamps"),
109 icon='LIGHT_DATA')
111 row = ob_cols[0].row()
112 armatures = [o for o in objects.values() if o.type == 'ARMATURE']
113 num = len(armatures)
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']
119 num = len(lattices)
120 row.label(text=quantity_string(num, "Lattice", "Lattices"),
121 icon='LATTICE_DATA')
123 row = ob_cols[0].row()
124 empties = [o for o in objects.values() if o.type == 'EMPTY']
125 num = len(empties)
126 row.label(text=quantity_string(num, "Empty", "Empties"),
127 icon='EMPTY_DATA')
129 row = ob_cols[1].row()
130 empties = [o for o in objects.values() if o.type == 'SPEAKER']
131 num = len(empties)
132 row.label(text=quantity_string(num, "Speaker", "Speakers"),
133 icon='OUTLINER_OB_SPEAKER')
135 layout.separator()
137 # DATABLOCKS
139 l_row = layout.row()
140 num = len(bpy.data.objects)
141 l_row.label(text="Datablocks in the scene:")
143 l_row = layout.row()
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"),
150 icon='MESH_DATA')
152 row = db_cols[1].row()
153 num = len(bpy.data.curves)
154 row.label(text=quantity_string(num, "Curve", "Curves"),
155 icon='CURVE_DATA')
157 row = db_cols[0].row()
158 num = len(bpy.data.cameras)
159 row.label(text=quantity_string(num, "Camera", "Cameras"),
160 icon='CAMERA_DATA')
162 row = db_cols[1].row()
163 num = len(bpy.data.lights)
164 row.label(text=quantity_string(num, "Lamp", "Lamps"),
165 icon='LIGHT_DATA')
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"),
175 icon='LATTICE_DATA')
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"),
185 icon='WORLD_DATA')
187 row = db_cols[0].row()
188 num = len(bpy.data.textures)
189 row.label(text=quantity_string(num, "Texture", "Textures"),
190 icon='TEXTURE_DATA')
192 row = db_cols[1].row()
193 num = len(bpy.data.images)
194 row.label(text=quantity_string(num, "Image", "Images"),
195 icon='IMAGE_DATA')
197 row = db_cols[0].row()
198 num = len(bpy.data.texts)
199 row.label(text=quantity_string(num, "Text", "Texts"),
200 icon='TEXT')
202 # Register
203 classes = [
204 OBJECT_PT_blendinfo
207 def register():
208 from bpy.utils import register_class
209 for cls in classes:
210 register_class(cls)
212 def unregister():
213 from bpy.utils import unregister_class
214 for cls in reversed(classes):
215 unregister_class(cls)
218 if __name__ == "__main__":
219 register()