Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Duroure <julien.duroure@gmail.com>2020-10-08 20:19:20 +0300
committerJulien Duroure <julien.duroure@gmail.com>2020-10-08 20:19:20 +0300
commit6cef5e013e54da23990ebb26ef9bbc15f3977c8d (patch)
treec5c8cc710b6c9184d97f013a92f0309241cb6840 /io_scene_gltf2/blender
parentd3100f5f71ce71691b6d72bdc70ae3698a5e86ac (diff)
glTF importer: use bpy.utils.escape_identifier to escape names for action paths
Diffstat (limited to 'io_scene_gltf2/blender')
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_animation_node.py6
-rw-r--r--io_scene_gltf2/blender/imp/gltf2_blender_animation_weight.py3
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,