diff options
Diffstat (limited to 'release/scripts/modules/rna_prop_ui.py')
-rw-r--r-- | release/scripts/modules/rna_prop_ui.py | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py index f5b9e518c8f..246fa4bdb7d 100644 --- a/release/scripts/modules/rna_prop_ui.py +++ b/release/scripts/modules/rna_prop_ui.py @@ -12,7 +12,7 @@ # # 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. +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ##### END GPL LICENSE BLOCK ##### @@ -126,7 +126,7 @@ def draw(layout, context, context_member, use_edit=True): class PropertyPanel(bpy.types.Panel): """ - The subclass should have its own poll function + The subclass should have its own poll function and the variable '_context_path' MUST be set. """ bl_label = "Custom Properties" @@ -140,7 +140,7 @@ from bpy.props import * rna_path = StringProperty(name="Property Edit", - description="Property path edit", maxlen=1024, default="", hidden=True) + description="Property path edit", maxlen=1024, default="", options={'HIDDEN'}) rna_value = StringProperty(name="Property Value", description="Property value edit", maxlen=1024, default="") @@ -164,10 +164,6 @@ class WM_OT_properties_edit(bpy.types.Operator): max = rna_max description = StringProperty(name="Tip", default="") - # the class instance is not persistant, need to store in the class - # not ideal but changes as the op runs. - _last_prop = [''] - def execute(self, context): path = self.properties.path value = self.properties.value @@ -179,9 +175,6 @@ class WM_OT_properties_edit(bpy.types.Operator): except: value_eval = value - if type(value_eval) == str: - value_eval = '"' + value_eval + '"' - # First remove item = eval("context.%s" % path) @@ -192,7 +185,7 @@ class WM_OT_properties_edit(bpy.types.Operator): # Reassign - exec_str = "item['%s'] = %s" % (prop, value_eval) + exec_str = "item['%s'] = %s" % (prop, repr(value_eval)) # print(exec_str) exec(exec_str) self._last_prop[:] = [prop] @@ -212,7 +205,7 @@ class WM_OT_properties_edit(bpy.types.Operator): def invoke(self, context, event): - self._last_prop[:] = [self.properties.property] + self._last_prop = [self.properties.property] item = eval("context.%s" % self.properties.path) @@ -269,4 +262,3 @@ class WM_OT_properties_remove(bpy.types.Operator): item = eval("context.%s" % self.properties.path) del item[self.properties.property] return {'FINISHED'} - |