[Bf-blender-cvs] [24e1ce2] master: Use string escaping when renaming custom properties

Campbell Barton noreply at git.blender.org
Tue Feb 25 07:04:57 CET 2014


Commit: 24e1ce25d14cbb61499d9b1229f1f35e9d3408f5
Author: Campbell Barton
Date:   Tue Feb 25 16:49:14 2014 +1100
https://developer.blender.org/rB24e1ce25d14cbb61499d9b1229f1f35e9d3408f5

Use string escaping when renaming custom properties

===================================================================

M	release/scripts/startup/bl_operators/wm.py

===================================================================

diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index a6060c6..5dadf77 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -1081,12 +1081,12 @@ class WM_OT_properties_edit(Operator):
         prop_type_old = type(item[prop_old])
 
         rna_idprop_ui_prop_clear(item, prop_old)
-        exec_str = "del item['%s']" % prop_old
+        exec_str = "del item[%r]" % prop_old
         # print(exec_str)
         exec(exec_str)
 
         # Reassign
-        exec_str = "item['%s'] = %s" % (prop, repr(value_eval))
+        exec_str = "item[%r] = %s" % (prop, repr(value_eval))
         # print(exec_str)
         exec(exec_str)
         self._last_prop[:] = [prop]
@@ -1103,7 +1103,7 @@ class WM_OT_properties_edit(Operator):
 
         # If we have changed the type of the property, update its potential anim curves!
         if prop_type_old != prop_type:
-            data_path = '["%s"]' % prop
+            data_path = '["%s"]' % bpy.utils.escape_identifier(prop)
             done = set()
 
             def _update(fcurves):
@@ -1114,9 +1114,9 @@ class WM_OT_properties_edit(Operator):
 
             def _update_strips(strips):
                 for st in strips:
-                    if st.type in {'CLIP'} and st.action:
+                    if st.type == 'CLIP' and st.action:
                         _update(st.action.fcurves)
-                    elif st.type in {'META'}:
+                    elif st.type == 'META':
                         _update_strips(st.strips)
 
             adt = getattr(item, "animation_data", None)




More information about the Bf-blender-cvs mailing list