From f95f6ed04f447afe4ba0bab6ad9a54c5b0dd699c Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Sat, 3 Jul 2010 17:39:45 +0000 Subject: [PATCH] update for changes in blender --- add_curve_aceous_galore.py | 2 +- add_curve_torus_knots.py | 2 +- add_mesh_3d_function_surface.py | 2 +- add_mesh_extras.py | 2 +- add_mesh_gears.py | 2 +- add_mesh_gemstones.py | 2 +- add_mesh_pipe_joint.py | 2 +- add_mesh_twisted_torus.py | 2 +- curve_simplify.py | 2 +- export_unreal_psk_psa.py | 6 +++--- io_anim_camera.py | 2 +- io_mesh_raw/export_raw.py | 2 +- space_view3d_panel_measure.py | 11 +++++------ space_view3d_spacebar_menu.py | 2 +- 14 files changed, 20 insertions(+), 21 deletions(-) diff --git a/add_curve_aceous_galore.py b/add_curve_aceous_galore.py index 7b7159c0e..a4ce149e0 100644 --- a/add_curve_aceous_galore.py +++ b/add_curve_aceous_galore.py @@ -652,7 +652,7 @@ def createCurve(vertArray, options, curveOptions, align_matrix): scene.objects.link(new_obj) # place in active scene new_obj.selected = True # set as selected scene.objects.active = new_obj # set as active - new_obj.matrix = align_matrix # apply matrix + new_obj.matrix_world = align_matrix # apply matrix # set bezierhandles if splineType == 'BEZIER': diff --git a/add_curve_torus_knots.py b/add_curve_torus_knots.py index 245d8a696..f49c25e29 100644 --- a/add_curve_torus_knots.py +++ b/add_curve_torus_knots.py @@ -105,7 +105,7 @@ def createCurve(vertArray, GEO, align_matrix): scene.objects.link(new_obj) # place in active scene new_obj.selected = True # set as selected scene.objects.active = new_obj # set as active - new_obj.matrix = align_matrix # apply matrix + new_obj.matrix_world = align_matrix # apply matrix return diff --git a/add_mesh_3d_function_surface.py b/add_mesh_3d_function_surface.py index c4abc8381..bc9c4814f 100644 --- a/add_mesh_3d_function_surface.py +++ b/add_mesh_3d_function_surface.py @@ -196,7 +196,7 @@ def create_mesh_object(context, verts, edges, faces, name, edit, align_matrix): # Place the object at the 3D cursor location. # apply viewRotaion - ob_new.matrix = align_matrix + ob_new.matrix_world = align_matrix if obj_act and obj_act.mode == 'EDIT': if not edit: diff --git a/add_mesh_extras.py b/add_mesh_extras.py index 230efa0d0..4c6b842ad 100644 --- a/add_mesh_extras.py +++ b/add_mesh_extras.py @@ -107,7 +107,7 @@ def create_mesh_object(context, verts, edges, faces, name, edit, align_matrix): # Place the object at the 3D cursor location. # apply viewRotaion - ob_new.matrix = align_matrix + ob_new.matrix_world = align_matrix if obj_act and obj_act.mode == 'EDIT': if not edit: diff --git a/add_mesh_gears.py b/add_mesh_gears.py index f329de911..b08f3cd5b 100644 --- a/add_mesh_gears.py +++ b/add_mesh_gears.py @@ -142,7 +142,7 @@ def create_mesh_object(context, verts, edges, faces, name, edit, align_matrix): # Place the object at the 3D cursor location. # apply viewRotaion - ob_new.matrix = align_matrix + ob_new.matrix_world = align_matrix if obj_act and obj_act.mode == 'EDIT': diff --git a/add_mesh_gemstones.py b/add_mesh_gemstones.py index 5f916d670..0d12ab16b 100644 --- a/add_mesh_gemstones.py +++ b/add_mesh_gemstones.py @@ -107,7 +107,7 @@ def create_mesh_object(context, verts, edges, faces, name, edit, align_matrix): # Place the object at the 3D cursor location. # apply viewRotaion - ob_new.matrix = align_matrix + ob_new.matrix_world = align_matrix if obj_act and obj_act.mode == 'EDIT': if not edit: diff --git a/add_mesh_pipe_joint.py b/add_mesh_pipe_joint.py index 04f368d7b..68baca292 100644 --- a/add_mesh_pipe_joint.py +++ b/add_mesh_pipe_joint.py @@ -198,7 +198,7 @@ def create_mesh_object(context, verts, edges, faces, name, edit, align_matrix): ob_new.selected = True # Place the object at the 3D cursor location. - ob_new.matrix = align_matrix + ob_new.matrix_world = align_matrix if obj_act and obj_act.mode == 'EDIT': if not edit: diff --git a/add_mesh_twisted_torus.py b/add_mesh_twisted_torus.py index 03c8a1f31..31996774c 100644 --- a/add_mesh_twisted_torus.py +++ b/add_mesh_twisted_torus.py @@ -135,7 +135,7 @@ def create_mesh_object(context, verts, edges, faces, name, edit, align_matrix): # Place the object at the 3D cursor location. # apply viewRotaion - ob_new.matrix = align_matrix + ob_new.matrix_world = align_matrix if obj_act and obj_act.mode == 'EDIT': if not edit: diff --git a/curve_simplify.py b/curve_simplify.py index a6b579f69..b1f3c8e6d 100644 --- a/curve_simplify.py +++ b/curve_simplify.py @@ -285,7 +285,7 @@ def main(context, obj, options): scene.objects.link(newCurve) newCurve.selected = True scene.objects.active = newCurve - newCurve.matrix = obj.matrix + newCurve.matrix = obj.matrix_world # set bezierhandles to auto setBezierHandles(newCurve) diff --git a/export_unreal_psk_psa.py b/export_unreal_psk_psa.py index df66d3448..b5be318ff 100644 --- a/export_unreal_psk_psa.py +++ b/export_unreal_psk_psa.py @@ -792,7 +792,7 @@ def parse_meshes(blender_meshes, psk_file): # Transform position for export #vpos = vert.co * object_material_index - vpos = vert.co * current_obj.matrix + vpos = vert.co * current_obj.matrix_world # Create the point p = VPoint() p.Point.X = vpos.x @@ -891,7 +891,7 @@ def parse_meshes(blender_meshes, psk_file): vert_weight = vgroup.weight if(bonegroup.index == vgroup.group): p = VPoint() - vpos = current_vert.co * current_obj.matrix + vpos = current_vert.co * current_obj.matrix_world p.Point.X = vpos.x p.Point.Y = vpos.y p.Point.Z = vpos.z @@ -1053,7 +1053,7 @@ def parse_armature(blender_armature, psk_file, psa_file): """ for current_bone in current_armature.bones: #list the bone. #note this will list all the bones. if(current_bone.parent == None): - parse_bone(current_bone, psk_file, psa_file, 0, 0, current_obj.matrix, None) + parse_bone(current_bone, psk_file, psa_file, 0, 0, current_obj.matrix_world, None) break # get blender objects by type diff --git a/io_anim_camera.py b/io_anim_camera.py index 6e186b25a..489cf8569 100644 --- a/io_anim_camera.py +++ b/io_anim_camera.py @@ -82,7 +82,7 @@ def writeCameras(context, filepath, frame_start, frame_end, only_selected=False) for obj, obj_data in cameras: fw("obj = cameras['%s']\n" % obj.name) - matrix = obj.matrix.copy() + matrix = obj.matrix_world.copy() fw("obj.location = %s\n" % repr(tuple(matrix.translation_part()))) fw("obj.scale = %s\n" % repr(tuple(matrix.scale_part()))) fw("obj.rotation_euler = %s\n" % repr(tuple(matrix.to_euler()))) diff --git a/io_mesh_raw/export_raw.py b/io_mesh_raw/export_raw.py index e2fd918bc..59f838104 100644 --- a/io_mesh_raw/export_raw.py +++ b/io_mesh_raw/export_raw.py @@ -65,7 +65,7 @@ def export_raw(filepath, applyMods, triangulate): faces = [] for obj in bpy.context.selected_objects: if obj.type == 'MESH': - matrix = obj.matrix + matrix = obj.matrix_world if (applyMods): me = obj.create_mesh(True, "PREVIEW") diff --git a/space_view3d_panel_measure.py b/space_view3d_panel_measure.py index b893b2714..a790a1049 100644 --- a/space_view3d_panel_measure.py +++ b/space_view3d_panel_measure.py @@ -180,10 +180,9 @@ def getMeasurePoints(context): mesh = obj.data # Get transformation matrix from object. - ob_mat = obj.matrix + ob_mat = obj.matrix_world # Also make an inversed copy! of the matrix. - ob_mat_inv = ob_mat.copy() - Matrix.invert(ob_mat_inv) + ob_mat_inv = ob_mat.copy().invert() # Get the selected vertices. # @todo: Better (more efficient) way to do this? @@ -282,14 +281,14 @@ def getMeasurePoints(context): # Return the area of a face (in global space). # @note Copies the functionality of the following functions, -# but also respects the scaling (via the "obj.matrix" parameter): +# but also respects the scaling (via the "obj.matrix_world" parameter): # @sa: rna_mesh.c:rna_MeshFace_area_get # @sa: math_geom.c:area_quad_v3 # @sa: math_geom.c:area_tri_v3 def faceAreaGlobal(face, obj): area = 0.0 - mat = obj.matrix + mat = obj.matrix_world if len(face.verts) == 4: # Quad @@ -665,7 +664,7 @@ class VIEW3D_PT_measure(bpy.types.Panel): mesh = obj.data # Get transformation matrix from object. - ob_mat = obj.matrix + ob_mat = obj.matrix_world # Also make an inversed copy! of the matrix. ob_mat_inv = ob_mat.copy() Matrix.invert(ob_mat_inv) diff --git a/space_view3d_spacebar_menu.py b/space_view3d_spacebar_menu.py index 18e66ea0c..ab9395ba7 100644 --- a/space_view3d_spacebar_menu.py +++ b/space_view3d_spacebar_menu.py @@ -1397,7 +1397,7 @@ def edgeIntersect(context, operator): operator.report({'ERROR'}, "Selected edges are parallel.") return - tm = obj.matrix.copy() + tm = obj.matrix_world.copy() point = ((line[0] + line[1]) / 2) point = tm * point -- GitLab