diff options
Diffstat (limited to 'io_anim_bvh/import_bvh.py')
-rw-r--r-- | io_anim_bvh/import_bvh.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/io_anim_bvh/import_bvh.py b/io_anim_bvh/import_bvh.py index 1f3c93fe..0a9e4b30 100644 --- a/io_anim_bvh/import_bvh.py +++ b/io_anim_bvh/import_bvh.py @@ -348,19 +348,19 @@ def bvh_node_dict2objects(context, bvh_name, bvh_nodes, rotate_mode='NATIVE', fr scene = context.scene for obj in scene.objects: - obj.select = False + obj.select_set("DESELECT") objects = [] def add_ob(name): obj = bpy.data.objects.new(name, None) - scene.objects.link(obj) + context.collection.objects.link(obj) objects.append(obj) - obj.select = True + obj.select_set("SELECT") # nicer drawing. - obj.empty_draw_type = 'CUBE' - obj.empty_draw_size = 0.1 + obj.empty_display_type = 'CUBE' + obj.empty_display_size = 0.1 return obj @@ -422,15 +422,15 @@ def bvh_node_dict2armature( # Add the new armature, scene = context.scene for obj in scene.objects: - obj.select = False + obj.select_set("DESELECT") arm_data = bpy.data.armatures.new(bvh_name) arm_ob = bpy.data.objects.new(bvh_name, arm_data) - scene.objects.link(arm_ob) + context.collection.objects.link(arm_ob) - arm_ob.select = True - scene.objects.active = arm_ob + arm_ob.select_set("SELECT") + context.view_layer.objects.active = arm_ob bpy.ops.object.mode_set(mode='OBJECT', toggle=False) bpy.ops.object.mode_set(mode='EDIT', toggle=False) @@ -580,7 +580,7 @@ def bvh_node_dict2armature( bone_translate_matrix = Matrix.Translation( Vector(bvh_loc) - bvh_node.rest_head_local) - location[frame_i] = (bone_rest_matrix_inv * + location[frame_i] = (bone_rest_matrix_inv @ bone_translate_matrix).to_translation() # For each location x, y, z. @@ -617,8 +617,8 @@ def bvh_node_dict2armature( euler = Euler(bvh_rot, bvh_node.rot_order_str[::-1]) bone_rotation_matrix = euler.to_matrix().to_4x4() bone_rotation_matrix = ( - bone_rest_matrix_inv * - bone_rotation_matrix * + bone_rest_matrix_inv @ + bone_rotation_matrix @ bone_rest_matrix ) |