diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2020-10-08 20:19:20 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2020-10-08 20:19:20 +0300 |
commit | 6cef5e013e54da23990ebb26ef9bbc15f3977c8d (patch) | |
tree | c5c8cc710b6c9184d97f013a92f0309241cb6840 /io_scene_gltf2/blender | |
parent | d3100f5f71ce71691b6d72bdc70ae3698a5e86ac (diff) |
glTF importer: use bpy.utils.escape_identifier to escape names for action paths
Diffstat (limited to 'io_scene_gltf2/blender')
-rwxr-xr-x | io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py | 6 | ||||
-rw-r--r-- | io_scene_gltf2/blender/imp/gltf2_blender_animation_weight.py | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py index d41b7892..6cbc85f4 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import json import bpy from mathutils import Vector @@ -90,7 +89,10 @@ class BlenderNodeAnim(): if vnode.type == VNode.Bone: # Need to animate the pose bone when the node is a bone. group_name = vnode.blender_bone_name - blender_path = "pose.bones[%s].%s" % (json.dumps(vnode.blender_bone_name), blender_path) + blender_path = 'pose.bones["%s"].%s' % ( + bpy.utils.escape_identifier(vnode.blender_bone_name), + blender_path + ) # We have the final TRS of the bone in values. We need to give # the TRS of the pose bone though, which is relative to the edit diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_animation_weight.py b/io_scene_gltf2/blender/imp/gltf2_blender_animation_weight.py index 1bf67213..ac36904a 100644 --- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_weight.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_weight.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import json import bpy from ...io.imp.gltf2_io_binary import BinaryData @@ -75,7 +74,7 @@ class BlenderWeightAnim(): if pymesh.shapekey_names[sk] is not None: # Do not animate shapekeys not created coords[1::2] = (values[offset + stride * i + sk][0] for i in range(len(keys))) kb_name = pymesh.shapekey_names[sk] - data_path = "key_blocks[" + json.dumps(kb_name) + "].value" + data_path = 'key_blocks["%s"].value' % bpy.utils.escape_identifier(kb_name) make_fcurve( action, |