[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [726] trunk/py/scripts/addons/ space_view3d_property_chart.py: modified layout and dont display a row if no attributes are found

Campbell Barton ideasman42 at gmail.com
Thu Jun 10 11:43:21 CEST 2010


Revision: 726
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=726
Author:   campbellbarton
Date:     2010-06-10 11:43:19 +0200 (Thu, 10 Jun 2010)

Log Message:
-----------
modified layout and dont display a row if no attributes are found

Modified Paths:
--------------
    trunk/py/scripts/addons/space_view3d_property_chart.py

Modified: trunk/py/scripts/addons/space_view3d_property_chart.py
===================================================================
--- trunk/py/scripts/addons/space_view3d_property_chart.py	2010-06-10 09:18:57 UTC (rev 725)
+++ trunk/py/scripts/addons/space_view3d_property_chart.py	2010-06-10 09:43:19 UTC (rev 726)
@@ -47,15 +47,13 @@
         if obj is None:
             return
 
-        obj_type_sel = [obj_sel for obj_sel in context.selected_objects if obj.type == obj_sel.type]
+        selected_objects = context.selected_objects
 
         if not obj_type_sel:
             return
 
         # box = layout.separator()
         
-        col = layout.column()
-        
         id_storage = context.scene
         
         strings = id_storage.get(self._PROP_STORAGE_ID)
@@ -66,16 +64,12 @@
         if strings:
             strings = strings.split()
 
-            row = col.row(align=True)
-            row.label(text="         ")
-            for attr_string in strings:
-                row.label(text=attr_string.rsplit(".", 1)[-1])
+            prop_all = []
 
-            for obj in obj_type_sel:
-                row = col.row(align=True)
-                row.label(text=obj.name)
+            for obj in selected_objects:
+                prop_pairs = []
+                prop_found = False
                 for attr_string in strings:
-
                     attrs = attr_string.split(".")
                     val_new = obj
                     for i, attr in enumerate(attrs):
@@ -86,10 +80,37 @@
                             break
 
                     if val_new is not Ellipsis:
-                        row.prop(val_old, attrs[-1], text="")
+                        prop_pairs.append((val_old, attrs[-1]))
+                        prop_found = True
                     else:
-                        row.label(text="<unknown>")
+                        prop_pairs.append(None)
+                
+                if prop_found:
+                    prop_all.append((obj, prop_pairs))
+
+            # now we built a list of props, display them all
+            row = layout.row()
+
+            col = row.column()
+            col.label(text="")
+            for obj, prop_pairs in prop_all:
+                col.label(text=obj.name)
+
+            for i in range(len(strings)):
+                col = row.column()
+                col.label(text=strings[i].rsplit(".", 1)[-1])
+                for obj, prop_pairs in prop_all:
+                    pair = prop_pairs[i]
+                    if pair:
+                        col.prop(pair[0], pair[1], text="")
+                    else:
+                        col.label(text="<missing>")
+            
+            #row = col.row(align=True)
+            #for attr_string in strings:
+            #    row.label(text=attr_string.rsplit(".", 1)[-1])
         
+        col = layout.column()
         col.label(text="Display Properties")
         col.prop(id_storage, '["%s"]' % self._PROP_STORAGE_ID, text="")
 




More information about the Bf-extensions-cvs mailing list