[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [619] contrib/py/scripts/addons/ system_blend_info_v0_3.py: add contrib/py/scripts/addons/ system_blend_info_v0_3.py

Brendon Murphy meta.androcto1 at gmail.com
Wed Apr 21 17:04:48 CEST 2010


Revision: 619
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=619
Author:   meta-androcto
Date:     2010-04-21 17:04:48 +0200 (Wed, 21 Apr 2010)

Log Message:
-----------
add contrib/py/scripts/addons/system_blend_info_v0_3.py
useful script for viewing objects in the scene

Added Paths:
-----------
    contrib/py/scripts/addons/system_blend_info_v0_3.py

Added: contrib/py/scripts/addons/system_blend_info_v0_3.py
===================================================================
--- contrib/py/scripts/addons/system_blend_info_v0_3.py	                        (rev 0)
+++ contrib/py/scripts/addons/system_blend_info_v0_3.py	2010-04-21 15:04:48 UTC (rev 619)
@@ -0,0 +1,206 @@
+# scene_blend_info.py Copyright (C) 2010, Mariano Hidalgo
+#
+# Show Information About the Blend.
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# ***** END GPL LICENCE BLOCK *****
+
+bl_addon_info = {
+    'name': 'System: Scene Information',
+    'author': 'uselessdreamer',
+    'version': '0.3',
+    'blender': (2, 5, 3),
+    'location': 'Object Properties > Scene',
+    'description': 'Show information about the .blend',
+    'url': 'http://wiki.blender.org/index.php/Extensions:2.5/Py/' \
+        'Scripts/',
+    'category': 'System'}
+
+import bpy
+
+
+def quantity_string(quantity, text_single, text_plural, text_none=None):
+    sep = " "
+
+    if not text_none:
+        text_none = text_plural
+
+    if quantity == 0:
+        string = str(quantity) + sep + text_none
+
+    if quantity == 1:
+        string = str(quantity) + sep + text_single
+
+    if quantity >= 2:
+        string = str(quantity) + sep + text_plural
+
+    if quantity < 0:
+        return None
+
+    return string
+
+
+class OBJECT_PT_blendinfo(bpy.types.Panel):
+    bl_label = "Blend Info"
+    bl_space_type = "PROPERTIES"
+    bl_region_type = "WINDOW"
+    bl_context = "scene"
+
+    def draw(self, context):
+        amount = 2
+        ob_cols = []
+        db_cols = []
+        etc_cols = []
+
+        objects = bpy.data.objects
+
+        layout = self.layout
+        
+        # OBJECTS
+
+        l_row = layout.row()
+        num = len(bpy.data.objects)
+        l_row.label(text=quantity_string(num, "Object", "Objects")
+            + " in the scene:",
+            icon='OBJECT_DATA')
+
+        l_row = layout.row()
+        ob_cols.append(l_row.column())
+        ob_cols.append(l_row.column())
+
+        row = ob_cols[0].row()
+        meshes = [o for o in objects.values() if o.type == 'MESH']
+        num = len(meshes)
+        row.label(text=quantity_string(num, "Mesh", "Meshes"),
+            icon='MESH_DATA')
+
+        row = ob_cols[1].row()
+        curves = [o for o in objects.values() if o.type == 'CURVE']
+        num = len(curves)
+        row.label(text=quantity_string(num, "Curve", "Curves"),
+            icon='CURVE_DATA')
+
+        row = ob_cols[0].row()
+        cameras = [o for o in objects.values() if o.type == 'CAMERA']
+        num = len(cameras)
+        row.label(text=quantity_string(num, "Camera", "Cameras"),
+            icon='CAMERA_DATA')
+
+        row = ob_cols[1].row()
+        lamps = [o for o in objects.values() if o.type == 'LAMP']
+        num = len(lamps)
+        row.label(text=quantity_string(num, "Lamp", "Lamps"),
+            icon='LAMP_DATA')
+
+        row = ob_cols[0].row()
+        armatures = [o for o in objects.values() if o.type == 'ARMATURE']
+        num = len(armatures)
+        row.label(text=quantity_string(num, "Armature", "Armatures"),
+            icon='ARMATURE_DATA')
+
+        row = ob_cols[1].row()
+        lattices = [o for o in objects.values() if o.type == 'LATTICE']
+        num = len(lattices)
+        row.label(text=quantity_string(num, "Lattice", "Lattices"),
+            icon='LATTICE_DATA')
+
+        row = ob_cols[0].row()
+        empties = [o for o in objects.values() if o.type == 'EMPTY']
+        num = len(empties)
+        row.label(text=quantity_string(num, "Empty", "Empties"),
+            icon='EMPTY_DATA')
+
+        l_row_sep = layout.separator()
+        
+        # DATABLOCKS
+
+        l_row = layout.row()
+        num = len(bpy.data.objects)
+        l_row.label(text="Datablocks in the scene:")
+
+        l_row = layout.row()
+        db_cols.append(l_row.column())
+        db_cols.append(l_row.column())
+
+        row = db_cols[0].row()
+        num = len(bpy.data.meshes)
+        row.label(text=quantity_string(num, "Mesh", "Meshes"),
+            icon='MESH_DATA')
+
+        row = db_cols[1].row()
+        num = len(bpy.data.curves)
+        row.label(text=quantity_string(num, "Curve", "Curves"),
+            icon='CURVE_DATA')
+
+        row = db_cols[0].row()
+        num = len(bpy.data.cameras)
+        row.label(text=quantity_string(num, "Camera", "Cameras"),
+            icon='CAMERA_DATA')
+
+        row = db_cols[1].row()
+        num = len(bpy.data.lamps)
+        row.label(text=quantity_string(num, "Lamp", "Lamps"),
+            icon='LAMP_DATA')
+
+        row = db_cols[0].row()
+        num = len(bpy.data.armatures)
+        row.label(text=quantity_string(num, "Armature", "Armatures"),
+            icon='ARMATURE_DATA')
+
+        row = db_cols[1].row()
+        num = len(bpy.data.lattices)
+        row.label(text=quantity_string(num, "Lattice", "Lattices"),
+            icon='LATTICE_DATA')
+
+        row = db_cols[0].row()
+        num = len(bpy.data.materials)
+        row.label(text=quantity_string(num, "Material", "Materials"),
+            icon='MATERIAL_DATA')
+
+        row = db_cols[1].row()
+        num = len(bpy.data.worlds)
+        row.label(text=quantity_string(num, "World", "Worlds"),
+            icon='WORLD_DATA')
+
+        row = db_cols[0].row()
+        num = len(bpy.data.textures)
+        row.label(text=quantity_string(num, "Texture", "Textures"),
+            icon='TEXTURE_DATA')
+
+        row = db_cols[1].row()
+        num = len(bpy.data.images)
+        row.label(text=quantity_string(num, "Image", "Images"),
+            icon='IMAGE_DATA')
+
+        row = db_cols[0].row()
+        num = len(bpy.data.texts)
+        row.label(text=quantity_string(num, "Text", "Texts"),
+            icon='TEXT')
+
+
+def register():
+    # Register the operators/menus.
+    bpy.types.register(OBJECT_PT_blendinfo)
+
+
+def unregister():
+    # Unregister the operators/menus.
+    bpy.types.register(OBJECT_PT_blendinfo)
+
+if __name__ == "__main__":
+    register()




More information about the Bf-extensions-cvs mailing list