From f87799dd838f2253f861940b4e65a9cd04e5784a Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Thu, 14 Mar 2013 05:31:04 +0000 Subject: [PATCH] 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. --- system_property_chart.py | 45 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/system_property_chart.py b/system_property_chart.py index 082a83047..87855d3f2 100644 --- a/system_property_chart.py +++ b/system_property_chart.py @@ -35,6 +35,42 @@ bl_info = { """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): @@ -132,9 +168,14 @@ def _property_chart_draw(self, context): else: col.label(text="<missing>") - # edit the display props + # Presets for properties col = layout.column() - col.label(text="Object Properties") + 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.prop(id_storage, self._PROP_STORAGE_ID, text="") -- GitLab