diff --git a/io_anim_camera.py b/io_anim_camera.py index 64c79d20a7dbfa4ec76e2d03d6b03f39e9fb6374..50951226ae1aee78a645034e296a9b67e1a1344e 100644 --- a/io_anim_camera.py +++ b/io_anim_camera.py @@ -79,9 +79,9 @@ def writeCameras(context, filepath, frame_start, frame_end, only_selected=False) for f in frame_range: - scene.set_frame(f) + scene.frame_set(f) fw("# new frame\n") - fw("scene.set_frame(%d + frame)\n" % f) + fw("scene.frame_set(%d + frame)\n" % f) for obj, obj_data in cameras: fw("obj = cameras['%s']\n" % obj.name) diff --git a/io_export_directx_x.py b/io_export_directx_x.py index a4773dea487d0c72b1efad1b23aef81ab8e91a9d..e32f542a889aec52366a350db9bd3b29ee6aa6f7 100644 --- a/io_export_directx_x.py +++ b/io_export_directx_x.py @@ -669,7 +669,7 @@ def WriteKeyedAnimationSet(Config): if len(AllKeyframes): Config.File.write("{}2;\n{}{};\n".format(" " * Config.Whitespace, " " * Config.Whitespace, len(AllKeyframes))) for Keyframe in AllKeyframes: - bpy.context.scene.set_frame(Keyframe) + bpy.context.scene.frame_set(Keyframe) Position = Vector() Position[0] = ((PositionFCurves[0][Keyframe] if Keyframe in PositionFCurves[0] else Object.location[0]) if PositionFCurves[0] else Object.location[0]) Position[1] = ((PositionFCurves[1][Keyframe] if Keyframe in PositionFCurves[1] else Object.location[1]) if PositionFCurves[1] else Object.location[1]) @@ -678,7 +678,7 @@ def WriteKeyedAnimationSet(Config): Config.File.write("{}{}{:9f},{:9f},{:9f};;\n".format(" " * Config.Whitespace, (str(Keyframe - bpy.context.scene.frame_start) + ";3;").ljust(8), Position[0], Position[1], Position[2])) else: Config.File.write("{}2;\n{}1;\n".format(" " * Config.Whitespace, " " * Config.Whitespace)) - bpy.context.scene.set_frame(bpy.context.scene.frame_start) + bpy.context.scene.frame_set(bpy.context.scene.frame_start) Position = Config.SystemMatrix * Object.location Config.File.write("{}{}{:9f},{:9f},{:9f};;\n".format(" " * Config.Whitespace, ("0;3;").ljust(8), Position[0], Position[1], Position[2])) Config.Whitespace -= 1 @@ -704,7 +704,7 @@ def WriteKeyedAnimationSet(Config): if len(AllKeyframes): Config.File.write("{}0;\n{}{};\n".format(" " * Config.Whitespace, " " * Config.Whitespace, len(AllKeyframes))) for Keyframe in AllKeyframes: - bpy.context.scene.set_frame(Keyframe) + bpy.context.scene.frame_set(Keyframe) Rotation = Euler() Rotation[0] = ((RotationFCurves[0][Keyframe] if Keyframe in RotationFCurves[0] else Object.rotation_euler[0]) if RotationFCurves[0] else Object.rotation_euler[0]) Rotation[1] = ((RotationFCurves[1][Keyframe] if Keyframe in RotationFCurves[1] else Object.rotation_euler[1]) if RotationFCurves[1] else Object.rotation_euler[1]) @@ -713,7 +713,7 @@ def WriteKeyedAnimationSet(Config): Config.File.write("{}{}{:9f},{:9f},{:9f},{:9f};;\n".format(" " * Config.Whitespace, (str(Keyframe - bpy.context.scene.frame_start) + ";4;").ljust(8), - Rotation[0], Rotation[1], Rotation[2], Rotation[3])) else: Config.File.write("{}0;\n{}1;\n".format(" " * Config.Whitespace, " " * Config.Whitespace)) - bpy.context.scene.set_frame(bpy.context.scene.frame_start) + bpy.context.scene.frame_set(bpy.context.scene.frame_start) Rotation = (Config.SystemMatrix * (Object.rotation_euler.to_matrix().to_4x4()) * Config.InverseSystemMatrix).to_quat() Config.File.write("{}{}{:9f},{:9f},{:9f},{:9f};;\n".format(" " * Config.Whitespace, ("0;4;").ljust(8), -Rotation[0], Rotation[1], Rotation[2], Rotation[3])) Config.Whitespace -= 1 @@ -739,7 +739,7 @@ def WriteKeyedAnimationSet(Config): if len(AllKeyframes): Config.File.write("{}1;\n{}{};\n".format(" " * Config.Whitespace, " " * Config.Whitespace, len(AllKeyframes))) for Keyframe in AllKeyframes: - bpy.context.scene.set_frame(Keyframe) + bpy.context.scene.frame_set(Keyframe) Scale = Vector() Scale[0] = ((ScaleFCurves[0][Keyframe] if Keyframe in ScaleFCurves[0] else Object.scale[0]) if ScaleFCurves[0] else Object.scale[0]) Scale[1] = ((ScaleFCurves[1][Keyframe] if Keyframe in ScaleFCurves[1] else Object.scale[1]) if ScaleFCurves[1] else Object.scale[1]) @@ -748,7 +748,7 @@ def WriteKeyedAnimationSet(Config): Config.File.write("{}{}{:9f},{:9f},{:9f};;\n".format(" " * Config.Whitespace, (str(Keyframe - bpy.context.scene.frame_start) + ";3;").ljust(8), Scale[0], Scale[1], Scale[2])) else: Config.File.write("{}1;\n{}1;\n".format(" " * Config.Whitespace, " " * Config.Whitespace)) - bpy.context.scene.set_frame(bpy.context.scene.frame_start) + bpy.context.scene.frame_set(bpy.context.scene.frame_start) Scale = Config.SystemMatrix * Object.scale Config.File.write("{}{}{:9f},{:9f},{:9f};;\n".format(" " * Config.Whitespace, ("0;3;").ljust(8), Scale[0], Scale[1], Scale[2])) Config.Whitespace -= 1 @@ -807,7 +807,7 @@ def WriteKeyedAnimationSet(Config): AllKeyframes = [bpy.context.scene.frame_start] Config.File.write("{}2;\n{}{};\n".format(" " * Config.Whitespace, " " * Config.Whitespace, len(AllKeyframes))) for Keyframe in AllKeyframes: - bpy.context.scene.set_frame(Keyframe) + bpy.context.scene.frame_set(Keyframe) if Bone.parent: PoseMatrix = (Bone.parent.matrix * Matrix.Rotation(radians(-90), 4, "X")).invert() @@ -843,7 +843,7 @@ def WriteKeyedAnimationSet(Config): AllKeyframes = [bpy.context.scene.frame_start] Config.File.write("{}0;\n{}{};\n".format(" " * Config.Whitespace, " " * Config.Whitespace, len(AllKeyframes))) for Keyframe in AllKeyframes: - bpy.context.scene.set_frame(Keyframe) + bpy.context.scene.frame_set(Keyframe) if Bone.parent: PoseMatrix = (Bone.parent.matrix * Matrix.Rotation(radians(-90), 4, "X")).invert() @@ -879,7 +879,7 @@ def WriteKeyedAnimationSet(Config): AllKeyframes = [bpy.context.scene.frame_start] Config.File.write("{}1;\n{}{};\n".format(" " * Config.Whitespace, " " * Config.Whitespace, len(AllKeyframes))) for Keyframe in AllKeyframes: - bpy.context.scene.set_frame(Keyframe) + bpy.context.scene.frame_set(Keyframe) if Bone.parent: PoseMatrix = (Bone.parent.matrix * Matrix.Rotation(radians(-90), 4, "X")).invert() @@ -930,7 +930,7 @@ def WriteFullAnimationSet(Config): Config.Whitespace += 1 Config.File.write("{}2;\n{}{};\n".format(" " * Config.Whitespace, " " * Config.Whitespace, KeyframeCount)) for Frame in range(0, KeyframeCount): - bpy.context.scene.set_frame(Frame + bpy.context.scene.frame_start) + bpy.context.scene.frame_set(Frame + bpy.context.scene.frame_start) Position = Config.SystemMatrix * Object.location Config.File.write("{}{}{:9f},{:9f},{:9f};;\n".format(" " * Config.Whitespace, (str(Frame) + ";3;").ljust(8), Position[0], Position[1], Position[2])) Config.Whitespace -= 1 @@ -945,7 +945,7 @@ def WriteFullAnimationSet(Config): Config.Whitespace += 1 Config.File.write("{}0;\n{}{};\n".format(" " * Config.Whitespace, " " * Config.Whitespace, KeyframeCount)) for Frame in range(0, KeyframeCount): - bpy.context.scene.set_frame(Frame + bpy.context.scene.frame_start) + bpy.context.scene.frame_set(Frame + bpy.context.scene.frame_start) Rotation = Config.SystemQuaternion.cross(Object.rotation_euler.to_quat().cross(Config.InverseSystemQuaternion)) Config.File.write("{}{}{:9f},{:9f},{:9f},{:9f};;\n".format(" " * Config.Whitespace, (str(Frame) + ";4;").ljust(8), Rotation[0], Rotation[1], Rotation[2], Config.FlipZ * Rotation[3])) Config.Whitespace -= 1 @@ -960,7 +960,7 @@ def WriteFullAnimationSet(Config): Config.Whitespace += 1 Config.File.write("{}1;\n{}{};\n".format(" " * Config.Whitespace, " " * Config.Whitespace, KeyframeCount)) for Frame in range(0, KeyframeCount): - bpy.context.scene.set_frame(Frame + bpy.context.scene.frame_start) + bpy.context.scene.frame_set(Frame + bpy.context.scene.frame_start) Scale = Config.SystemMatrix * Object.scale Config.File.write("{}{}{:9f},{:9f},{:9f};;\n".format(" " * Config.Whitespace, (str(Frame) + ";3;").ljust(8), Scale[0], Scale[1], Scale[2])) Config.Whitespace -= 1 @@ -990,7 +990,7 @@ def WriteFullAnimationSet(Config): Config.Whitespace += 1 Config.File.write("{}2;\n{}{};\n".format(" " * Config.Whitespace, " " * Config.Whitespace, KeyframeCount)) for Frame in range(0, KeyframeCount): - bpy.context.scene.set_frame(Frame + bpy.context.scene.frame_start) + bpy.context.scene.frame_set(Frame + bpy.context.scene.frame_start) if Bone.parent: PoseMatrix = (Bone.parent.matrix * Matrix.Rotation(radians(-90), 4, "X")).invert() @@ -1014,7 +1014,7 @@ def WriteFullAnimationSet(Config): Config.Whitespace += 1 Config.File.write("{}0;\n{}{};\n".format(" " * Config.Whitespace, " " * Config.Whitespace, KeyframeCount)) for Frame in range(0, KeyframeCount): - bpy.context.scene.set_frame(Frame + bpy.context.scene.frame_start) + bpy.context.scene.frame_set(Frame + bpy.context.scene.frame_start) #Whew! I'm sure this could be simplified. Rotation = Config.SystemQuaternion.cross(Matrix.Rotation(radians(90), 4, "X").to_quat().cross(Bone.rotation_quaternion.cross(Matrix.Rotation(radians(-90), 4, "X").to_quat().cross(Config.InverseSystemQuaternion)))) Config.File.write("{}{}{:9f},{:9f},{:9f},{:9f};;\n".format(" " * Config.Whitespace, (str(Frame) + ";4;").ljust(8), Rotation[0], Rotation[1], Rotation[2], Config.FlipZ * Rotation[3])) @@ -1030,7 +1030,7 @@ def WriteFullAnimationSet(Config): Config.Whitespace += 1 Config.File.write("{}1;\n{}{};\n".format(" " * Config.Whitespace, " " * Config.Whitespace, KeyframeCount)) for Frame in range(0, KeyframeCount): - bpy.context.scene.set_frame(Frame + bpy.context.scene.frame_start) + bpy.context.scene.frame_set(Frame + bpy.context.scene.frame_start) if Bone.parent: PoseMatrix = (Bone.parent.matrix * Matrix.Rotation(radians(-90), 4, "X")).invert() diff --git a/io_export_unreal_psk_psa.py b/io_export_unreal_psk_psa.py index 819faa80b9e022a4cb25b4ef8d6dca243b06babe..501912adab5d3440057aa45ea547eac38339f955 100644 --- a/io_export_unreal_psk_psa.py +++ b/io_export_unreal_psk_psa.py @@ -1193,7 +1193,7 @@ def parse_animation(blender_scene, blender_armatures, psa_file): #print "This Frame: %i, Next Frame: NONE" % frame #frame start from 1 as number one from blender - blender_scene.set_frame(frame) + blender_scene.frame_set(frame) cur_frame_index = cur_frame_index + 1 for bone_data in ordered_bones: @@ -1346,7 +1346,7 @@ def fs_callback(filename, context, user_setting): print("//===============================") parse_meshes(blender_meshes, psk) except: - context.scene.set_frame(cur_frame) #set frame back to original frame + context.scene.frame_set(cur_frame) #set frame back to original frame print ("Exception during Mesh Parse") raise @@ -1361,7 +1361,7 @@ def fs_callback(filename, context, user_setting): parse_armature(blender_armature, psk, psa) except: - context.scene.set_frame(cur_frame) #set frame back to original frame + context.scene.frame_set(cur_frame) #set frame back to original frame print ("Exception during Armature Parse") raise @@ -1375,13 +1375,13 @@ def fs_callback(filename, context, user_setting): parse_animation(current_scene, blender_armature, psa) except: - context.scene.set_frame(cur_frame) #set frame back to original frame + context.scene.frame_set(cur_frame) #set frame back to original frame print ("Exception during Animation Parse") raise # reset current frame - context.scene.set_frame(cur_frame) #set frame back to original frame + context.scene.frame_set(cur_frame) #set frame back to original frame ########################## # FILE WRITE diff --git a/io_import_images_as_planes.py b/io_import_images_as_planes.py index fedd89da2a658c7d0c8e8c47fc5810c1c637d215..61c88c467c9c6068897e9f5d75e86025e538cf82 100644 --- a/io_import_images_as_planes.py +++ b/io_import_images_as_planes.py @@ -327,7 +327,7 @@ def main(filePath, options, mapping, dimension): plane = createPlaneObj(img, dimension) # Assign Material - plane.data.materials.link(mat) + plane.data.materials.append(mat) # Put Image into UVTextureLayer plane.data.uv_textures[0].data[0].image = img @@ -356,7 +356,7 @@ def main(filePath, options, mapping, dimension): plane = createPlaneObj(img, dimension) # Assign Material - plane.data.materials.link(mat) + plane.data.materials.append(mat) # Put image into UVTextureLayer plane.data.uv_textures[0].data[0].image = img diff --git a/io_import_scene_mhx.py b/io_import_scene_mhx.py index 9230f9c7213876ada448c0c3868291821ffa608c..765ba0d98bfe033482a813663183084fedf0c376 100644 --- a/io_import_scene_mhx.py +++ b/io_import_scene_mhx.py @@ -1128,7 +1128,7 @@ def parseMesh (args, tokens): parseShapeKeys(ob, me, val, sub) elif key == 'Material': try: - me.materials.link(loadedData['Material'][val[0]]) + me.materials.append(loadedData['Material'][val[0]]) except: print("Could not add material", val[0]) else: diff --git a/io_import_scene_unreal_psk.py b/io_import_scene_unreal_psk.py index 5060156aff2415ccaad3c00a40a79fe1b50f3b01..0c2e878b472fd275adf610ee08d673ae04b908f2 100644 --- a/io_import_scene_unreal_psk.py +++ b/io_import_scene_unreal_psk.py @@ -540,7 +540,7 @@ def pskimport(infile): #= make sure the list isnt too big for material in materials: #add material to the mesh list of materials - me_ob.materials.link(material) + me_ob.materials.append(material) #=================================================================================================== # #===================================================================================================