Skip to content
Snippets Groups Projects
Commit 3b1f9d05 authored by Campbell Barton's avatar Campbell Barton
Browse files

use rna values because id-properties cant be edited/added during draw.

parent f81cbb5f
No related branches found
No related tags found
No related merge requests found
# # ##### BEGIN GPL LICENSE BLOCK #####
# ***** BEGIN GPL LICENSE BLOCK *****
#
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
...@@ -16,7 +14,9 @@ ...@@ -16,7 +14,9 @@
# along with this program; if not, write to the Free Software Foundation, # along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# ***** END GPL LICENCE BLOCK ***** # ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
bl_info = { bl_info = {
"name": "Object Property Chart", "name": "Object Property Chart",
...@@ -37,6 +37,7 @@ bl_info = { ...@@ -37,6 +37,7 @@ bl_info = {
import bpy import bpy
def _property_chart_data_get(self, context): def _property_chart_data_get(self, context):
# eg. context.active_object # eg. context.active_object
obj = eval("context.%s" % self.context_data_path_active) obj = eval("context.%s" % self.context_data_path_active)
...@@ -73,10 +74,10 @@ def _property_chart_draw(self, context): ...@@ -73,10 +74,10 @@ def _property_chart_draw(self, context):
id_storage = context.scene id_storage = context.scene
strings = id_storage.get(self._PROP_STORAGE_ID) strings = getattr(id_storage, self._PROP_STORAGE_ID)
if strings is None: # Collected all props, now display them all
strings = id_storage[self._PROP_STORAGE_ID] = "data data.name" layout = self.layout
if strings: if strings:
...@@ -107,10 +108,6 @@ def _property_chart_draw(self, context): ...@@ -107,10 +108,6 @@ def _property_chart_draw(self, context):
if prop_found: if prop_found:
prop_all.append((obj, prop_pairs)) prop_all.append((obj, prop_pairs))
# Collected all props, now display them all
layout = self.layout
row = layout.row(align=True) row = layout.row(align=True)
col = row.column() col = row.column()
...@@ -139,7 +136,7 @@ def _property_chart_draw(self, context): ...@@ -139,7 +136,7 @@ def _property_chart_draw(self, context):
# edit the display props # edit the display props
col = layout.column() col = layout.column()
col.label(text="Object Properties") col.label(text="Object Properties")
col.prop(id_storage, '["%s"]' % self._PROP_STORAGE_ID, text="") col.prop(id_storage, self._PROP_STORAGE_ID, text="")
class View3DEditProps(bpy.types.Panel): class View3DEditProps(bpy.types.Panel):
...@@ -150,6 +147,7 @@ class View3DEditProps(bpy.types.Panel): ...@@ -150,6 +147,7 @@ class View3DEditProps(bpy.types.Panel):
bl_context = "objectmode" bl_context = "objectmode"
_PROP_STORAGE_ID = "view3d_edit_props" _PROP_STORAGE_ID = "view3d_edit_props"
_PROP_STORAGE_DEFAULT = "data data.name"
# _property_chart_draw needs these # _property_chart_draw needs these
context_data_path_active = "active_object" context_data_path_active = "active_object"
...@@ -165,6 +163,7 @@ class SequencerEditProps(bpy.types.Panel): ...@@ -165,6 +163,7 @@ class SequencerEditProps(bpy.types.Panel):
bl_label = "Property Chart" bl_label = "Property Chart"
_PROP_STORAGE_ID = "sequencer_edit_props" _PROP_STORAGE_ID = "sequencer_edit_props"
_PROP_STORAGE_DEFAULT = "blend_type blend_alpha"
# _property_chart_draw needs these # _property_chart_draw needs these
context_data_path_active = "scene.sequence_editor.active_strip" context_data_path_active = "scene.sequence_editor.active_strip"
...@@ -220,11 +219,24 @@ class CopyPropertyChart(bpy.types.Operator): ...@@ -220,11 +219,24 @@ class CopyPropertyChart(bpy.types.Operator):
def register(): def register():
pass Scene = bpy.types.Scene
for cls in View3DEditProps, SequencerEditProps:
setattr(Scene,
cls._PROP_STORAGE_ID,
StringProperty(
name="Scene Name",
description="Name of POV-Ray scene to create. Empty name will use the name of the blend file.",
default=cls._PROP_STORAGE_DEFAULT, maxlen=1024),
)
def unregister(): def unregister():
pass for cls in View3DEditProps, SequencerEditProps:
delattr(Scene,
cls._PROP_STORAGE_ID,
)
if __name__ == "__main__": if __name__ == "__main__":
register() register()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment