glTF importer: use bpy.utils.escape_identifier to escape names for action paths

This commit is contained in:
Julien Duroure 2020-10-08 19:19:20 +02:00
parent d3100f5f71
commit 6cef5e013e
3 changed files with 6 additions and 5 deletions

View File

@ -15,7 +15,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
"version": (1, 4, 33),
"version": (1, 4, 34),
'blender': (2, 91, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

View File

@ -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

View File

@ -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,