glTF importer: refactor: use action_group parameter to fcurves.new

This commit is contained in:
Julien Duroure 2020-09-05 15:29:05 +02:00
parent ee912f6fd2
commit 5ebb907bf7
2 changed files with 3 additions and 9 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, 13),
"version": (1, 4, 14),
'blender': (2, 90, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

View File

@ -45,19 +45,13 @@ def restore_animation_on_object(obj, anim_name):
obj.animation_data.action = None
def make_fcurve(action, co, data_path, index=0, group_name=None, interpolation=None):
def make_fcurve(action, co, data_path, index=0, group_name='', interpolation=None):
try:
fcurve = action.fcurves.new(data_path=data_path, index=index)
fcurve = action.fcurves.new(data_path=data_path, index=index, action_group=group_name)
except:
# Some non valid files can have multiple target path
return None
if group_name:
if group_name not in action.groups:
action.groups.new(group_name)
group = action.groups[group_name]
fcurve.group = group
fcurve.keyframe_points.add(len(co) // 2)
fcurve.keyframe_points.foreach_set('co', co)