From 969f17762f947e1351c199366730c473d331116d Mon Sep 17 00:00:00 2001 From: Martin Buerbaum Date: Mon, 6 Sep 2010 14:10:38 +0000 Subject: * Version 0.10.6 - Made PEP8 compatible again. * Some minor formatting * Synced with my local copy. --- add_mesh_pipe_joint.py | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'add_mesh_pipe_joint.py') diff --git a/add_mesh_pipe_joint.py b/add_mesh_pipe_joint.py index b43d6564..03a769cc 100644 --- a/add_mesh_pipe_joint.py +++ b/add_mesh_pipe_joint.py @@ -19,7 +19,7 @@ bl_addon_info = { "name": "Pipe Joints", "author": "Buerbaum Martin (Pontiac)", - "version": (0,10,5), + "version": (0, 10, 6), "blender": (2, 5, 3), "api": 31667, "location": "View3D > Add > Mesh > Pipe Joint", @@ -42,6 +42,14 @@ The functionality can then be accessed via the Note: Currently only the "Elbow" type supports odd number of vertices. Version history: +v0.10.6 - Removed "recall properties" from all functions. + Updated various code for new API. + API: mathutils.RotationMatrix -> mathutils.Matrix.Rotation + API: xxx.selected -> xxx.select + API: "invoke" function for each operator. + Updated for new bl_addon_info structure. + New code for the "align_matrix". + made script PEP8 compatible. v0.10.5 - createFaces can now create fan/star like faces. v0.10.4 - Updated the function "createFaces" a bit. No functional changes. v0.10.3 - Updated store_recall_properties, apply_object_align @@ -136,11 +144,14 @@ def align_matrix(context): obj_align = context.user_preferences.edit.object_align if (context.space_data.type == 'VIEW_3D' and obj_align == 'VIEW'): - rot = context.space_data.region_3d.view_matrix.rotation_part().invert().resize4x4() + view_mat = context.space_data.region_3d.view_matrix + rot = view_mat.rotation_part().invert().resize4x4() else: rot = mathutils.Matrix() align_matrix = loc * rot return align_matrix + + # Create a new mesh (object) from verts/edges/faces. # verts/edges/faces ... List of vertices/edges/faces for the # new mesh (as used in from_pydata). @@ -403,6 +414,7 @@ class AddElbowJoint(bpy.types.Operator): obj = create_mesh_object(context, verts, [], faces, "Elbow Joint", edit, self.align_matrix) + return {'FINISHED'} def invoke(self, context, event): @@ -410,6 +422,7 @@ class AddElbowJoint(bpy.types.Operator): self.execute(context) return {'FINISHED'} + class AddTeeJoint(bpy.types.Operator): # Create the vertices and polygons for a simple tee (T) joint. # The base arm of the T can be positioned in an angle if needed though. @@ -592,7 +605,8 @@ class AddTeeJoint(bpy.types.Operator): faces.extend(createFaces(loopJoint2, loopArm, closed=True)) faces.extend(createFaces(loopJoint3, loopMainEnd, closed=True)) - obj = create_mesh_object(context, verts, [], faces, "Tee Joint", edit, self.align_matrix) + obj = create_mesh_object(context, verts, [], faces, + "Tee Joint", edit, self.align_matrix) return {'FINISHED'} @@ -601,6 +615,7 @@ class AddTeeJoint(bpy.types.Operator): self.execute(context) return {'FINISHED'} + class AddWyeJoint(bpy.types.Operator): '''Add a Wye-Joint mesh''' bl_idname = "mesh.primitive_wye_joint_add" @@ -798,7 +813,8 @@ class AddWyeJoint(bpy.types.Operator): faces.extend(createFaces(loopJoint2, loopArm1, closed=True)) faces.extend(createFaces(loopJoint3, loopArm2, closed=True)) - obj = create_mesh_object(context, verts, [], faces, "Wye Joint", edit, self.align_matrix) + obj = create_mesh_object(context, verts, [], faces, + "Wye Joint", edit, self.align_matrix) return {'FINISHED'} @@ -807,6 +823,7 @@ class AddWyeJoint(bpy.types.Operator): self.execute(context) return {'FINISHED'} + class AddCrossJoint(bpy.types.Operator): '''Add a Cross-Joint mesh''' # Create the vertices and polygons for a coss (+ or X) pipe joint. @@ -1075,6 +1092,7 @@ class AddCrossJoint(bpy.types.Operator): self.execute(context) return {'FINISHED'} + class AddNJoint(bpy.types.Operator): '''Add a N-Joint mesh''' # Create the vertices and polygons for a regular n-joint. @@ -1235,7 +1253,8 @@ class AddNJoint(bpy.types.Operator): createFaces(loopsJoints[loopIdx], loopsEndCircles[loopIdx], closed=True)) - obj = create_mesh_object(context, verts, [], faces, "N Joint", edit, self.align_matrix) + obj = create_mesh_object(context, verts, [], faces, + "N Joint", edit, self.align_matrix) return {'FINISHED'} @@ -1244,6 +1263,7 @@ class AddNJoint(bpy.types.Operator): self.execute(context) return {'FINISHED'} + class INFO_MT_mesh_pipe_joints_add(bpy.types.Menu): # Define the "Pipe Joints" menu bl_idname = "INFO_MT_mesh_pipe_joints_add" @@ -1267,6 +1287,7 @@ class INFO_MT_mesh_pipe_joints_add(bpy.types.Menu): import space_info + # Define "Pipe Joints" menu def menu_func(self, context): self.layout.menu("INFO_MT_mesh_pipe_joints_add", icon="PLUGIN") -- cgit v1.2.3