[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4373] trunk/py/scripts/addons/ system_property_chart.py: patch [#34624] Proposed extensions to Property Chart addon ( system_property_chart_with_presets.diff)

Campbell Barton ideasman42 at gmail.com
Thu Mar 14 06:31:05 CET 2013


Revision: 4373
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4373
Author:   campbellbarton
Date:     2013-03-14 05:31:04 +0000 (Thu, 14 Mar 2013)
Log Message:
-----------
patch [#34624] Proposed extensions to Property Chart addon (system_property_chart_with_presets.diff)
from Satish Goda (iluvblender)

Added Presets feature to the existing property chart addon.

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

Modified: trunk/py/scripts/addons/system_property_chart.py
===================================================================
--- trunk/py/scripts/addons/system_property_chart.py	2013-03-14 04:33:09 UTC (rev 4372)
+++ trunk/py/scripts/addons/system_property_chart.py	2013-03-14 05:31:04 UTC (rev 4373)
@@ -35,8 +35,44 @@
 """List properties of selected objects"""
 
 import bpy
+from bl_operators.presets import AddPresetBase
 
 
+class AddPresetProperties(AddPresetBase, bpy.types.Operator):
+    """Add an properties preset"""
+    bl_idname = "scene.properties_preset_add"
+    bl_label = "Add Properties Preset"
+    preset_menu = "SCENE_MT_properties_presets"
+
+    preset_defines = [
+        "scene = bpy.context.scene",
+    ]
+
+    def pre_cb(self, context):
+        space_type = context.space_data.type
+        if space_type == 'VIEW_3D':
+            self.preset_subdir = "system_property_chart_view3d"
+            self.preset_values = ["scene.view3d_edit_props"]
+        else:
+            self.preset_subdir = "system_property_chart_sequencer"
+            self.preset_values = ["scene.sequencer_edit_props"]
+
+
+class SCENE_MT_properties_presets(bpy.types.Menu):
+    bl_label = "Properties Presets"
+    preset_operator = "script.execute_preset"
+
+    def draw(self, context):
+        space_type = context.space_data.type
+
+        if space_type == 'VIEW_3D':
+            self.preset_subdir = "system_property_chart_view3d"
+        else:
+            self.preset_subdir = "system_property_chart_sequencer"
+
+        bpy.types.Menu.draw_preset(self, context)
+
+
 def _property_chart_data_get(self, context):
     # eg. context.active_object
     obj = eval("context.%s" % self.context_data_path_active)
@@ -132,9 +168,14 @@
                 else:
                     col.label(text="<missing>")
 
+    # Presets for properties
+    col = layout.column()
+    col.label(text="Properties")
+    row = col.row(align=True)
+    row.menu("SCENE_MT_properties_presets", text=bpy.types.SCENE_MT_properties_presets.bl_label)
+    row.operator("scene.properties_preset_add", text="", icon="ZOOMIN")
+    row.operator("scene.properties_preset_add", text="", icon="ZOOMOUT").remove_active = True
     # edit the display props
-    col = layout.column()
-    col.label(text="Object Properties")
     col.prop(id_storage, self._PROP_STORAGE_ID, text="")
 
 



More information about the Bf-extensions-cvs mailing list