From 7eae59d9628311ad2ad0a3c634bbfa0bb611156b Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Tue, 7 Feb 2017 14:57:07 -0500 Subject: [PATCH 01/56] Added initial geometry editing on Quick Align Planes --- mesh_mesh_align_plus.py | 1097 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 1085 insertions(+), 12 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index a293062..6519829 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -467,6 +467,20 @@ class MAPlusData(bpy.types.PropertyGroup): ), default=True ) + quick_apl_show_src_geom = bpy.props.BoolProperty( + description=( + "Expand/collapse the source geometry editor" + " in the quick tools panel." + ), + default=False + ) + quick_apl_show_dest_geom = bpy.props.BoolProperty( + description=( + "Expand/collapse the destination geometry editor" + " in the quick tools panel." + ), + default=False + ) quick_align_planes_auto_grab_src = bpy.props.BoolProperty( description=( "Automatically grab source plane from selected geometry" @@ -778,6 +792,64 @@ def poll(cls, context): return True +class ShowHideQuickGeomBaseClass(bpy.types.Operator): + bl_idname = "maplus.showhidequickgeombaseclass" + bl_label = "Show/hide quick geometry base class" + bl_description = "The base class for showing/hiding quick geometry" + bl_options = {'REGISTER', 'UNDO'} + quick_op_target = None + + def execute(self, context): + addon_data = bpy.context.scene.maplus_data + if self.quick_op_target == "APTSRC": + active_item = addon_data.quick_apt_show_src_geom + elif self.quick_op_target == "APTDEST": + active_item = addon_data.quick_apt_show_dest_geom + + elif self.quick_op_target == "DSSRC": + active_item = addon_data.quick_ds_show_src_geom + + elif self.quick_op_target == "SMESRC": + active_item = addon_data.quick_sme_show_src_geom + elif self.quick_op_target == "SMEDEST": + active_item = addon_data.quick_sme_show_dest_geom + + elif self.quick_op_target == "ALNSRC": + active_item = addon_data.quick_aln_show_src_geom + elif self.quick_op_target == "ALNDEST": + active_item = addon_data.quick_aln_show_dest_geom + + elif self.quick_op_target == "AXRSRC": + active_item = addon_data.quick_axr_show_src_geom + + elif self.quick_op_target == "APLSRC": + addon_data.quick_apl_show_src_geom = ( + not addon_data.quick_apl_show_src_geom + ) + elif self.quick_op_target == "APLDEST": + addon_data.quick_apl_show_dest_geom = ( + not addon_data.quick_apl_show_dest_geom + ) + + return {'FINISHED'} + + +class ShowHideQuickAplSrcGeom(ShowHideQuickGeomBaseClass): + bl_idname = "maplus.showhidequickaplsrcgeom" + bl_label = "Show/hide quick align planes source geometry" + bl_description = "Show/hide quick align planes source geometry" + bl_options = {'REGISTER', 'UNDO'} + quick_op_target = 'APLSRC' + + +class ShowHideQuickAplDestGeom(ShowHideQuickGeomBaseClass): + bl_idname = "maplus.showhidequickapldestgeom" + bl_label = "Show/hide quick align planes destination geometry" + bl_description = "Show/hide quick align planes destination geometry" + bl_options = {'REGISTER', 'UNDO'} + quick_op_target = 'APLDEST' + + # Exception when adding new items, if we can't get a unique name class UniqueNameError(Exception): pass @@ -1192,7 +1264,34 @@ class GrabFromCursorBase(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list - active_item = prims[addon_data.active_list_item] + if hasattr(self, "quick_op_target"): + if self.quick_op_target == "APTSRC": + active_item = addon_data.quick_align_pts_src + elif self.quick_op_target == "APTDEST": + active_item = addon_data.quick_align_pts_dest + + elif self.quick_op_target == "DSSRC": + active_item = addon_data.quick_directional_slide_src + + elif self.quick_op_target == "SMESRC": + active_item = addon_data.quick_scale_match_edge_src + elif self.quick_op_target == "SMEDEST": + active_item = addon_data.quick_scale_match_edge_dest + + elif self.quick_op_target == "ALNSRC": + active_item = addon_data.quick_align_lines_src + elif self.quick_op_target == "ALNDEST": + active_item = addon_data.quick_align_lines_dest + + elif self.quick_op_target == "AXRSRC": + active_item = addon_data.quick_axis_rotate_src + + elif self.quick_op_target == "APLSRC": + active_item = addon_data.quick_align_planes_src + elif self.quick_op_target == "APLDEST": + active_item = addon_data.quick_align_planes_dest + else: + active_item = prims[addon_data.active_list_item] setattr( active_item, @@ -1214,7 +1313,34 @@ class SendCoordToCursorBase(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = bpy.context.scene.maplus_data.prim_list - active_item = prims[addon_data.active_list_item] + if hasattr(self, "quick_op_target"): + if self.quick_op_target == "APTSRC": + active_item = addon_data.quick_align_pts_src + elif self.quick_op_target == "APTDEST": + active_item = addon_data.quick_align_pts_dest + + elif self.quick_op_target == "DSSRC": + active_item = addon_data.quick_directional_slide_src + + elif self.quick_op_target == "SMESRC": + active_item = addon_data.quick_scale_match_edge_src + elif self.quick_op_target == "SMEDEST": + active_item = addon_data.quick_scale_match_edge_dest + + elif self.quick_op_target == "ALNSRC": + active_item = addon_data.quick_align_lines_src + elif self.quick_op_target == "ALNDEST": + active_item = addon_data.quick_align_lines_dest + + elif self.quick_op_target == "AXRSRC": + active_item = addon_data.quick_axis_rotate_src + + elif self.quick_op_target == "APLSRC": + active_item = addon_data.quick_align_planes_src + elif self.quick_op_target == "APLDEST": + active_item = addon_data.quick_align_planes_dest + else: + active_item = prims[addon_data.active_list_item] bpy.context.scene.cursor_location = getattr( active_item, @@ -1277,6 +1403,30 @@ class QuickAlignPointsGrabDest(GrabFromGeometryBase): quick_op_target = "APTDEST" +class QuickAlignPointsGrabSrcLoc(GrabFromGeometryBase): + bl_idname = "maplus.quickalignpointsgrabsrcloc" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('point',) + multiply_by_world_matrix = False + quick_op_target = "APTSRC" + + +class QuickAlignPointsGrabDestLoc(GrabFromGeometryBase): + bl_idname = "maplus.quickalignpointsgrabdestloc" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('point',) + multiply_by_world_matrix = False + quick_op_target = "APTDEST" + + class SendPointToCursor(SendCoordToCursorBase): bl_idname = "maplus.sendpointtocursor" bl_label = "Sends Point to Cursor" @@ -1464,6 +1614,24 @@ class GrabPlaneAFromCursor(GrabFromCursorBase): vert_attrib_to_set = 'plane_pt_a' +class QuickAplSrcGrabPlaneAFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickaplsrcgrabplaneafromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_a' + quick_op_target = 'APLSRC' + + +class QuickAplDestGrabPlaneAFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickapldestgrabplaneafromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_a' + quick_op_target = 'APLDEST' + + class GrabPlaneAFromActiveLocal(GrabFromGeometryBase): bl_idname = "maplus.grabplaneafromactivelocal" bl_label = "Grab Local Coordinates From Active Point" @@ -1486,6 +1654,54 @@ class GrabPlaneAFromActiveGlobal(GrabFromGeometryBase): multiply_by_world_matrix = True +class QuickAplSrcGrabPlaneAFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickaplsrcgrabplaneafromactivelocal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a',) + multiply_by_world_matrix = False + quick_op_target = 'APLSRC' + + +class QuickAplSrcGrabPlaneAFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickaplsrcgrabplaneafromactiveglobal" + bl_label = "Grab Global Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a',) + multiply_by_world_matrix = True + quick_op_target = 'APLSRC' + + +class QuickAplDestGrabPlaneAFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickapldestgrabplaneafromactivelocal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a',) + multiply_by_world_matrix = False + quick_op_target = 'APLDEST' + + +class QuickAplDestGrabPlaneAFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickapldestgrabplaneafromactiveglobal" + bl_label = "Grab Global Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a',) + multiply_by_world_matrix = True + quick_op_target = 'APLDEST' + + class SendPlaneAToCursor(SendCoordToCursorBase): bl_idname = "maplus.sendplaneatocursor" bl_label = "Sends Plane Point A to Cursor" @@ -1494,6 +1710,24 @@ class SendPlaneAToCursor(SendCoordToCursorBase): source_coord_attrib = 'plane_pt_a' +class QuickAplSrcSendPlaneAToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickaplsrcsendplaneatocursor" + bl_label = "Sends Plane Point A to Cursor" + bl_description = "Sends Plane Point A Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_a' + quick_op_target = 'APLSRC' + + +class QuickAplDestSendPlaneAToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickapldestsendplaneatocursor" + bl_label = "Sends Plane Point A to Cursor" + bl_description = "Sends Plane Point A Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_a' + quick_op_target = 'APLDEST' + + class GrabPlaneBFromCursor(GrabFromCursorBase): bl_idname = "maplus.grabplanebfromcursor" bl_label = "Grab From Cursor" @@ -1502,6 +1736,24 @@ class GrabPlaneBFromCursor(GrabFromCursorBase): vert_attrib_to_set = 'plane_pt_b' +class QuickAplSrcGrabPlaneBFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickaplsrcgrabplanebfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_b' + quick_op_target = 'APLSRC' + + +class QuickAplDestGrabPlaneBFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickapldestgrabplanebfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_b' + quick_op_target = 'APLDEST' + + class GrabPlaneBFromActiveLocal(GrabFromGeometryBase): bl_idname = "maplus.grabplanebfromactivelocal" bl_label = "Grab Local Coordinates From Active Point" @@ -1524,6 +1776,54 @@ class GrabPlaneBFromActiveGlobal(GrabFromGeometryBase): multiply_by_world_matrix = True +class QuickAplSrcGrabPlaneBFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickaplsrcgrabplanebfromactivelocal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = False + quick_op_target = 'APLSRC' + + +class QuickAplSrcGrabPlaneBFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickaplsrcgrabplanebfromactiveglobal" + bl_label = "Grab Global Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = True + quick_op_target = 'APLSRC' + + +class QuickAplDestGrabPlaneBFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickapldestgrabplanebfromactivelocal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = False + quick_op_target = 'APLDEST' + + +class QuickAplDestGrabPlaneBFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickapldestgrabplanebfromactiveglobal" + bl_label = "Grab Global Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = True + quick_op_target = 'APLDEST' + + class SendPlaneBToCursor(SendCoordToCursorBase): bl_idname = "maplus.sendplanebtocursor" bl_label = "Sends Plane Point B to Cursor" @@ -1532,6 +1832,24 @@ class SendPlaneBToCursor(SendCoordToCursorBase): source_coord_attrib = 'plane_pt_b' +class QuickAplSrcSendPlaneBToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickaplsrcsendplanebtocursor" + bl_label = "Sends Plane Point B to Cursor" + bl_description = "Sends Plane Point B Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_b' + quick_op_target = 'APLSRC' + + +class QuickAplDestSendPlaneBToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickapldestsendplanebtocursor" + bl_label = "Sends Plane Point B to Cursor" + bl_description = "Sends Plane Point B Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_b' + quick_op_target = 'APLDEST' + + class GrabPlaneCFromCursor(GrabFromCursorBase): bl_idname = "maplus.grabplanecfromcursor" bl_label = "Grab From Cursor" @@ -1540,6 +1858,24 @@ class GrabPlaneCFromCursor(GrabFromCursorBase): vert_attrib_to_set = 'plane_pt_c' +class QuickAplSrcGrabPlaneCFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickaplsrcgrabplanecfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_c' + quick_op_target = 'APLSRC' + + +class QuickAplDestGrabPlaneCFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickapldestgrabplanecfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_c' + quick_op_target = 'APLDEST' + + class GrabPlaneCFromActiveLocal(GrabFromGeometryBase): bl_idname = "maplus.grabplanecfromactivelocal" bl_label = "Grab Local Coordinates From Active Point" @@ -1558,16 +1894,82 @@ class GrabPlaneCFromActiveGlobal(GrabFromGeometryBase): "Grabs global coordinates from selected vertex in edit mode" ) bl_options = {'REGISTER', 'UNDO'} - vert_attribs_to_set = ('plane_pt_c',) - multiply_by_world_matrix = True + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = True + + +class QuickAplSrcGrabPlaneCFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickaplsrcgrabplanecfromactivelocal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = False + quick_op_target = 'APLSRC' + + +class QuickAplSrcGrabPlaneCFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickaplsrcgrabplanecfromactiveglobal" + bl_label = "Grab Global Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = True + quick_op_target = 'APLSRC' + + +class QuickAplDestGrabPlaneCFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickapldestgrabplanecfromactivelocal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = False + quick_op_target = 'APLDEST' + + +class QuickAplDestGrabPlaneCFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickapldestgrabplanecfromactiveglobal" + bl_label = "Grab Global Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = True + quick_op_target = 'APLDEST' + + +class SendPlaneCToCursor(SendCoordToCursorBase): + bl_idname = "maplus.sendplanectocursor" + bl_label = "Sends Plane Point C to Cursor" + bl_description = "Sends Plane Point C Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_c' + + +class QuickAplSrcSendPlaneCToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickaplsrcsendplanectocursor" + bl_label = "Sends Plane Point C to Cursor" + bl_description = "Sends Plane Point C Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_c' + quick_op_target = 'APLSRC' -class SendPlaneCToCursor(SendCoordToCursorBase): - bl_idname = "maplus.sendplanectocursor" +class QuickAplDestSendPlaneCToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickapldestsendplanectocursor" bl_label = "Sends Plane Point C to Cursor" bl_description = "Sends Plane Point C Coordinates to 3D Cursor" bl_options = {'REGISTER', 'UNDO'} source_coord_attrib = 'plane_pt_c' + quick_op_target = 'APLDEST' class GrabAllVertsPlaneLocal(GrabFromGeometryBase): @@ -1616,6 +2018,30 @@ class QuickAlignPlanesGrabDest(GrabFromGeometryBase): quick_op_target = "APLDEST" +class QuickAlignPlanesGrabSrcLoc(GrabFromGeometryBase): + bl_idname = "maplus.quickalignplanesgrabsrcloc" + bl_label = "Grab Plane Global Coordinates from Selected Verts" + bl_description = ( + "Grabs plane global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a', 'plane_pt_b', 'plane_pt_c') + multiply_by_world_matrix = False + quick_op_target = "APLSRC" + + +class QuickAlignPlanesGrabDestLoc(GrabFromGeometryBase): + bl_idname = "maplus.quickalignplanesgrabdestloc" + bl_label = "Grab Plane Local Coordinates from Selected Verts" + bl_description = ( + "Grabs plane local coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a', 'plane_pt_b', 'plane_pt_c') + multiply_by_world_matrix = False + quick_op_target = "APLDEST" + + # Coordinate swapper, present on all geometry primitives # that have multiple points (line, plane) class SwapPointsBase(bpy.types.Operator): @@ -1628,7 +2054,29 @@ class SwapPointsBase(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list - active_item = prims[addon_data.active_list_item] + if hasattr(self, "quick_op_target"): + if self.quick_op_target == "DSSRC": + active_item = addon_data.quick_directional_slide_src + + elif self.quick_op_target == "SMESRC": + active_item = addon_data.quick_scale_match_edge_src + elif self.quick_op_target == "SMEDEST": + active_item = addon_data.quick_scale_match_edge_dest + + elif self.quick_op_target == "ALNSRC": + active_item = addon_data.quick_align_lines_src + elif self.quick_op_target == "ALNDEST": + active_item = addon_data.quick_align_lines_dest + + elif self.quick_op_target == "AXRSRC": + active_item = addon_data.quick_axis_rotate_src + + elif self.quick_op_target == "APLSRC": + active_item = addon_data.quick_align_planes_src + elif self.quick_op_target == "APLDEST": + active_item = addon_data.quick_align_planes_dest + else: + active_item = prims[addon_data.active_list_item] source = getattr(active_item, self.targets[0]) source = mathutils.Vector( @@ -1688,6 +2136,60 @@ class SwapPlaneBPlaneC(SwapPointsBase): targets = ('plane_pt_b', 'plane_pt_c') +class QuickAplSrcSwapPlaneAPlaneB(SwapPointsBase): + bl_idname = "maplus.quickaplsrcswapplaneaplaneb" + bl_label = "Swap Plane Point A with Plane Point B" + bl_description = "Swap plane points A and B" + bl_options = {'REGISTER', 'UNDO'} + targets = ('plane_pt_a', 'plane_pt_b') + quick_op_target = 'APLSRC' + + +class QuickAplSrcSwapPlaneAPlaneC(SwapPointsBase): + bl_idname = "maplus.quickaplsrcswapplaneaplanec" + bl_label = "Swap Plane Point A with Plane Point C" + bl_description = "Swap plane points A and C" + bl_options = {'REGISTER', 'UNDO'} + targets = ('plane_pt_a', 'plane_pt_c') + quick_op_target = 'APLSRC' + + +class QuickAplSrcSwapPlaneBPlaneC(SwapPointsBase): + bl_idname = "maplus.quickaplsrcswapplanebplanec" + bl_label = "Swap Plane Point B with Plane Point C" + bl_description = "Swap plane points B and C" + bl_options = {'REGISTER', 'UNDO'} + targets = ('plane_pt_b', 'plane_pt_c') + quick_op_target = 'APLSRC' + + +class QuickAplDestSwapPlaneAPlaneB(SwapPointsBase): + bl_idname = "maplus.quickapldestswapplaneaplaneb" + bl_label = "Swap Plane Point A with Plane Point B" + bl_description = "Swap plane points A and B" + bl_options = {'REGISTER', 'UNDO'} + targets = ('plane_pt_a', 'plane_pt_b') + quick_op_target = 'APLDEST' + + +class QuickAplDestSwapPlaneAPlaneC(SwapPointsBase): + bl_idname = "maplus.quickapldestswapplaneaplanec" + bl_label = "Swap Plane Point A with Plane Point C" + bl_description = "Swap plane points A and C" + bl_options = {'REGISTER', 'UNDO'} + targets = ('plane_pt_a', 'plane_pt_c') + quick_op_target = 'APLDEST' + + +class QuickAplDestSwapPlaneBPlaneC(SwapPointsBase): + bl_idname = "maplus.quickapldestswapplanebplanec" + bl_label = "Swap Plane Point B with Plane Point C" + bl_description = "Swap plane points B and C" + bl_options = {'REGISTER', 'UNDO'} + targets = ('plane_pt_b', 'plane_pt_c') + quick_op_target = 'APLDEST' + + # Every x/y/z coordinate component has these functions on each of the # geometry primitives (lets users move in one direction easily, etc.) class SetOtherComponentsBase(bpy.types.Operator): @@ -5931,17 +6433,588 @@ def draw(self, context): 'quick_align_planes_auto_grab_src', 'Auto Grab Source from Selected Vertices' ) + + apl_src_geom_top = apl_grab_col.row() if not addon_data.quick_align_planes_auto_grab_src: - apl_grab_col.operator( + if not addon_data.quick_apl_show_src_geom: + apl_src_geom_top.operator( + "maplus.showhidequickaplsrcgeom", + icon='TRIA_RIGHT', + text="", + emboss=False + ) + apl_src_geom_top.operator( + "maplus.quickalignplanesgrabsrc", + icon='WORLD', + text="Grab Source" + ) + else: + apl_src_geom_top.operator( + "maplus.showhidequickaplsrcgeom", + icon='TRIA_DOWN', + text="", + emboss=False + ) + apl_src_geom_top.label("Source Coordinates") + + apl_src_geom_editor = apl_grab_col.box() + plane_grab_all = apl_src_geom_editor.row(align=True) + plane_grab_all.operator( + "maplus.quickalignplanesgrabsrcloc", + icon='VERTEXSEL', + text="Grab All Local" + ) + plane_grab_all.operator( "maplus.quickalignplanesgrabsrc", icon='WORLD', - text="Grab Source" + text="Grab All Global" + ) + + apl_src_geom_editor.label("Pt. A:") + # plane_a_items = apl_src_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + plane_a_items = apl_src_geom_editor.row() + typein_and_grab_plna = plane_a_items.column() + plane_a_uppers = typein_and_grab_plna.split(percentage=.33) + + plane_a_swap = plane_a_uppers.row(align=True) + plane_a_swap.label("Swap With:") + plane_a_swap.operator( + "maplus.quickaplsrcswapplaneaplaneb", + text="B" + ) + plane_a_swap.operator( + "maplus.quickaplsrcswapplaneaplanec", + text="C" + ) + + plane_a_uppers_rightside = plane_a_uppers.row(align=True) + plane_a_uppers_rightside.alignment = 'RIGHT' + plane_a_uppers_rightside.label("Send:") + plane_a_uppers_rightside.operator( + "maplus.quickaplsrcsendplaneatocursor", + icon='CURSOR', + text="" + ) + + plane_a_uppers_rightside.label("Grab:") + plane_a_uppers_rightside.operator( + "maplus.quickaplsrcgrabplaneafromcursor", + icon='CURSOR', + text="" + ) + plane_a_uppers_rightside.operator( + "maplus.quickaplsrcgrabplaneafromactivelocal", + icon='VERTEXSEL', + text="" + ) + plane_a_uppers_rightside.operator( + "maplus.quickaplsrcgrabplaneafromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_plna.prop( + bpy.types.AnyType(addon_data.quick_align_planes_src), + 'plane_pt_a', + "" + ) + + # component_changers_plna = plane_a_items.row() + # zero_components_plna = component_changers_plna.column( + # align=True + # ) + # zero_components_plna.label("Set Zeroes:") + # zero_components_plna.operator( + # "maplus.zerootherplanepointax", + # text="X00" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointay", + # text="0Y0" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointaz", + # text="00Z" + # ) + # one_components_plna = component_changers_plna.column( + # align=True + # ) + # one_components_plna.label("Set Ones:") + # one_components_plna.operator( + # "maplus.oneotherplanepointax", + # text="X11" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointay", + # text="1Y1" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointaz", + # text="11Z" + # ) + + apl_src_geom_editor.label("Pt. B (Pivot):") + # plane_b_items = apl_src_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + plane_b_items = apl_src_geom_editor.row() + typein_and_grab_plnb = plane_b_items.column() + plane_b_uppers = typein_and_grab_plnb.split(percentage=.33) + plane_b_swap = plane_b_uppers.row(align=True) + plane_b_swap.label("Swap With:") + plane_b_swap.operator( + "maplus.quickaplsrcswapplaneaplaneb", + text="A" + ) + plane_b_swap.operator( + "maplus.quickaplsrcswapplanebplanec", + text="C" + ) + + plane_b_uppers_rightside = plane_b_uppers.row(align=True) + plane_b_uppers_rightside.alignment = 'RIGHT' + plane_b_uppers_rightside.label("Send:") + plane_b_uppers_rightside.operator( + "maplus.quickaplsrcsendplanebtocursor", + icon='CURSOR', + text="" + ) + + plane_b_uppers_rightside.label("Grab:") + plane_b_uppers_rightside.operator( + "maplus.quickaplsrcgrabplanebfromcursor", + icon='CURSOR', + text="" + ) + plane_b_uppers_rightside.operator( + "maplus.quickaplsrcgrabplanebfromactivelocal", + icon='VERTEXSEL', + text="" + ) + plane_b_uppers_rightside.operator( + "maplus.quickaplsrcgrabplanebfromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_plnb.prop( + bpy.types.AnyType(addon_data.quick_align_planes_src), + 'plane_pt_b', + "" + ) + + # component_changers_plnb = plane_b_items.row() + # zero_components_plnb = component_changers_plnb.column( + # align=True + # ) + # zero_components_plnb.label("Set Zeroes:") + # zero_components_plnb.operator( + # "maplus.zerootherplanepointbx", + # text="X00" + # ) + # zero_components_plnb.operator( + # "maplus.zerootherplanepointby", + # text="0Y0" + # ) + # zero_components_plnb.operator( + # "maplus.zerootherplanepointbz", + # text="00Z" + # ) + # one_components_plnb = component_changers_plnb.column( + # align=True + # ) + # one_components_plnb.label("Set Ones:") + # one_components_plnb.operator( + # "maplus.oneotherplanepointbx", + # text="X11" + # ) + # one_components_plnb.operator( + # "maplus.oneotherplanepointby", + # text="1Y1" + # ) + # one_components_plnb.operator( + # "maplus.oneotherplanepointbz", + # text="11Z" + # ) + + apl_src_geom_editor.label("Pt. C:") + # plane_c_items = apl_src_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + plane_c_items = apl_src_geom_editor.row() + typein_and_grab_plnc = plane_c_items.column() + plane_c_uppers = typein_and_grab_plnc.split(percentage=.33) + plane_c_swap = plane_c_uppers.row(align=True) + plane_c_swap.label("Swap With:") + plane_c_swap.operator( + "maplus.quickaplsrcswapplaneaplanec", + text="A" + ) + plane_c_swap.operator( + "maplus.quickaplsrcswapplanebplanec", + text="B" + ) + + plane_c_uppers_rightside = plane_c_uppers.row(align=True) + plane_c_uppers_rightside.alignment = 'RIGHT' + plane_c_uppers_rightside.label("Send:") + plane_c_uppers_rightside.operator( + "maplus.quickaplsrcsendplanectocursor", + icon='CURSOR', + text="" + ) + + plane_c_uppers_rightside.label("Grab:") + plane_c_uppers_rightside.operator( + "maplus.quickaplsrcgrabplanecfromcursor", + icon='CURSOR', + text="" + ) + plane_c_uppers_rightside.operator( + "maplus.quickaplsrcgrabplanecfromactivelocal", + icon='VERTEXSEL', + text="" + ) + plane_c_uppers_rightside.operator( + "maplus.quickaplsrcgrabplanecfromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_plnc.prop( + bpy.types.AnyType(addon_data.quick_align_planes_src), + 'plane_pt_c', + "" + ) + + # component_changers_plnc = plane_c_items.row() + # zero_components_plnc = component_changers_plnc.column( + # align=True + # ) + # zero_components_plnc.label("Set Zeroes:") + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcx", + # text="X00" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcy", + # text="0Y0" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcz", + # text="00Z" + # ) + # one_components_plnc = component_changers_plnc.column( + # align=True + # ) + # one_components_plnc.label("Set Ones:") + # one_components_plnc.operator( + # "maplus.oneotherplanepointcx", + # text="X11" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcy", + # text="1Y1" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcz", + # text="11Z" + # ) + if addon_data.quick_apl_show_src_geom: + apl_grab_col.separator() + + # apl_dest_geom = apl_grab_col.row() + # apl_grab_col.operator( + # "maplus.quickalignplanesgrabdest", + # icon='WORLD', + # text="Grab Destination" + # ) + + apl_dest_geom_top = apl_grab_col.row() + if not addon_data.quick_apl_show_dest_geom: + apl_dest_geom_top.operator( + "maplus.showhidequickapldestgeom", + icon='TRIA_RIGHT', + text="", + emboss=False + ) + apl_dest_geom_top.operator( + "maplus.quickalignplanesgrabdest", + icon='WORLD', + text="Grab Destination" ) - apl_grab_col.operator( + else: + apl_dest_geom_top.operator( + "maplus.showhidequickapldestgeom", + icon='TRIA_DOWN', + text="", + emboss=False + ) + apl_dest_geom_top.label("Destination Coordinates") + + apl_dest_geom_editor = apl_grab_col.box() + plane_grab_all = apl_dest_geom_editor.row(align=True) + plane_grab_all.operator( + "maplus.quickalignplanesgrabdestloc", + icon='VERTEXSEL', + text="Grab All Local" + ) + plane_grab_all.operator( "maplus.quickalignplanesgrabdest", icon='WORLD', - text="Grab Destination" - ) + text="Grab All Global" + ) + + apl_dest_geom_editor.label("Pt. A:") + # plane_a_items = apl_dest_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + plane_a_items = apl_dest_geom_editor.row() + typein_and_grab_plna = plane_a_items.column() + plane_a_uppers = typein_and_grab_plna.split(percentage=.33) + + plane_a_swap = plane_a_uppers.row(align=True) + plane_a_swap.label("Swap With:") + plane_a_swap.operator( + "maplus.quickapldestswapplaneaplaneb", + text="B" + ) + plane_a_swap.operator( + "maplus.quickapldestswapplaneaplanec", + text="C" + ) + + plane_a_uppers_rightside = plane_a_uppers.row(align=True) + plane_a_uppers_rightside.alignment = 'RIGHT' + plane_a_uppers_rightside.label("Send:") + plane_a_uppers_rightside.operator( + "maplus.quickapldestsendplaneatocursor", + icon='CURSOR', + text="" + ) + + plane_a_uppers_rightside.label("Grab:") + plane_a_uppers_rightside.operator( + "maplus.quickapldestgrabplaneafromcursor", + icon='CURSOR', + text="" + ) + plane_a_uppers_rightside.operator( + "maplus.quickapldestgrabplaneafromactivelocal", + icon='VERTEXSEL', + text="" + ) + plane_a_uppers_rightside.operator( + "maplus.quickapldestgrabplaneafromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_plna.prop( + bpy.types.AnyType(addon_data.quick_align_planes_dest), + 'plane_pt_a', + "" + ) + + # component_changers_plna = plane_a_items.row() + # zero_components_plna = component_changers_plna.column( + # align=True + # ) + # zero_components_plna.label("Set Zeroes:") + # zero_components_plna.operator( + # "maplus.zerootherplanepointax", + # text="X00" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointay", + # text="0Y0" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointaz", + # text="00Z" + # ) + # one_components_plna = component_changers_plna.column( + # align=True + # ) + # one_components_plna.label("Set Ones:") + # one_components_plna.operator( + # "maplus.oneotherplanepointax", + # text="X11" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointay", + # text="1Y1" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointaz", + # text="11Z" + # ) + + apl_dest_geom_editor.label("Pt. B (Pivot):") + # plane_b_items = apl_dest_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + plane_b_items = apl_dest_geom_editor.row() + typein_and_grab_plnb = plane_b_items.column() + plane_b_uppers = typein_and_grab_plnb.split(percentage=.33) + plane_b_swap = plane_b_uppers.row(align=True) + plane_b_swap.label("Swap With:") + plane_b_swap.operator( + "maplus.quickapldestswapplaneaplaneb", + text="A" + ) + plane_b_swap.operator( + "maplus.quickapldestswapplanebplanec", + text="C" + ) + + plane_b_uppers_rightside = plane_b_uppers.row(align=True) + plane_b_uppers_rightside.alignment = 'RIGHT' + plane_b_uppers_rightside.label("Send:") + plane_b_uppers_rightside.operator( + "maplus.quickapldestsendplanebtocursor", + icon='CURSOR', + text="" + ) + + plane_b_uppers_rightside.label("Grab:") + plane_b_uppers_rightside.operator( + "maplus.quickapldestgrabplanebfromcursor", + icon='CURSOR', + text="" + ) + plane_b_uppers_rightside.operator( + "maplus.quickapldestgrabplanebfromactivelocal", + icon='VERTEXSEL', + text="" + ) + plane_b_uppers_rightside.operator( + "maplus.quickapldestgrabplanebfromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_plnb.prop( + bpy.types.AnyType(addon_data.quick_align_planes_dest), + 'plane_pt_b', + "" + ) + + # component_changers_plnb = plane_b_items.row() + # zero_components_plnb = component_changers_plnb.column( + # align=True + # ) + # zero_components_plnb.label("Set Zeroes:") + # zero_components_plnb.operator( + # "maplus.zerootherplanepointbx", + # text="X00" + # ) + # zero_components_plnb.operator( + # "maplus.zerootherplanepointby", + # text="0Y0" + # ) + # zero_components_plnb.operator( + # "maplus.zerootherplanepointbz", + # text="00Z" + # ) + # one_components_plnb = component_changers_plnb.column( + # align=True + # ) + # one_components_plnb.label("Set Ones:") + # one_components_plnb.operator( + # "maplus.oneotherplanepointbx", + # text="X11" + # ) + # one_components_plnb.operator( + # "maplus.oneotherplanepointby", + # text="1Y1" + # ) + # one_components_plnb.operator( + # "maplus.oneotherplanepointbz", + # text="11Z" + # ) + + apl_dest_geom_editor.label("Pt. C:") + # plane_c_items = apl_dest_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + plane_c_items = apl_dest_geom_editor.row() + typein_and_grab_plnc = plane_c_items.column() + plane_c_uppers = typein_and_grab_plnc.split(percentage=.33) + plane_c_swap = plane_c_uppers.row(align=True) + plane_c_swap.label("Swap With:") + plane_c_swap.operator( + "maplus.quickapldestswapplaneaplanec", + text="A" + ) + plane_c_swap.operator( + "maplus.quickapldestswapplanebplanec", + text="B" + ) + + plane_c_uppers_rightside = plane_c_uppers.row(align=True) + plane_c_uppers_rightside.alignment = 'RIGHT' + plane_c_uppers_rightside.label("Send:") + plane_c_uppers_rightside.operator( + "maplus.quickapldestsendplanectocursor", + icon='CURSOR', + text="" + ) + + plane_c_uppers_rightside.label("Grab:") + plane_c_uppers_rightside.operator( + "maplus.quickapldestgrabplanecfromcursor", + icon='CURSOR', + text="" + ) + plane_c_uppers_rightside.operator( + "maplus.quickapldestgrabplanecfromactivelocal", + icon='VERTEXSEL', + text="" + ) + plane_c_uppers_rightside.operator( + "maplus.quickapldestgrabplanecfromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_plnc.prop( + bpy.types.AnyType(addon_data.quick_align_planes_dest), + 'plane_pt_c', + "" + ) + + # component_changers_plnc = plane_c_items.row() + # zero_components_plnc = component_changers_plnc.column( + # align=True + # ) + # zero_components_plnc.label("Set Zeroes:") + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcx", + # text="X00" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcy", + # text="0Y0" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcz", + # text="00Z" + # ) + # one_components_plnc = component_changers_plnc.column( + # align=True + # ) + # one_components_plnc.label("Set Ones:") + # one_components_plnc.operator( + # "maplus.oneotherplanepointcx", + # text="X11" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcy", + # text="1Y1" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcz", + # text="11Z" + # ) + + ################################### + ################################### + + + ################################### + ################################### + apl_gui.label("Operator settings:") apl_mods = apl_gui.box() apl_mods_row1 = apl_mods.row() From 7c3ae060eca67376502b3d1df8e114a3247f0b00 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Wed, 8 Feb 2017 12:44:06 -0500 Subject: [PATCH 02/56] Added geometry editing on Quick Align Lines. --- mesh_mesh_align_plus.py | 615 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 607 insertions(+), 8 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 6519829..54094bb 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -434,6 +434,20 @@ class MAPlusData(bpy.types.PropertyGroup): ), default=True ) + quick_aln_show_src_geom = bpy.props.BoolProperty( + description=( + "Expand/collapse the source geometry editor" + " in the quick tools panel." + ), + default=False + ) + quick_aln_show_dest_geom = bpy.props.BoolProperty( + description=( + "Expand/collapse the destination geometry editor" + " in the quick tools panel." + ), + default=False + ) quick_align_lines_auto_grab_src = bpy.props.BoolProperty( description=( "Automatically grab source line from selected geometry" @@ -815,9 +829,13 @@ def execute(self, context): active_item = addon_data.quick_sme_show_dest_geom elif self.quick_op_target == "ALNSRC": - active_item = addon_data.quick_aln_show_src_geom + addon_data.quick_aln_show_src_geom = ( + not addon_data.quick_aln_show_src_geom + ) elif self.quick_op_target == "ALNDEST": - active_item = addon_data.quick_aln_show_dest_geom + addon_data.quick_aln_show_dest_geom = ( + not addon_data.quick_aln_show_dest_geom + ) elif self.quick_op_target == "AXRSRC": active_item = addon_data.quick_axr_show_src_geom @@ -850,6 +868,22 @@ class ShowHideQuickAplDestGeom(ShowHideQuickGeomBaseClass): quick_op_target = 'APLDEST' +class ShowHideQuickAlnSrcGeom(ShowHideQuickGeomBaseClass): + bl_idname = "maplus.showhidequickalnsrcgeom" + bl_label = "Show/hide quick align lines source geometry" + bl_description = "Show/hide quick align lines source geometry" + bl_options = {'REGISTER', 'UNDO'} + quick_op_target = 'ALNSRC' + + +class ShowHideQuickAlnDestGeom(ShowHideQuickGeomBaseClass): + bl_idname = "maplus.showhidequickalndestgeom" + bl_label = "Show/hide quick align lines destination geometry" + bl_description = "Show/hide quick align lines destination geometry" + bl_options = {'REGISTER', 'UNDO'} + quick_op_target = 'ALNDEST' + + # Exception when adding new items, if we can't get a unique name class UniqueNameError(Exception): pass @@ -1443,6 +1477,24 @@ class GrabLineStartFromCursor(GrabFromCursorBase): vert_attrib_to_set = 'line_start' +class QuickAlnSrcGrabLineStartFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickalnsrcgrablinestartfromcursor" + bl_label = "Grab Line Start From Cursor" + bl_description = "Grabs line start coordinates from the 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_start' + quick_op_target = 'ALNSRC' + + +class QuickAlnDestGrabLineStartFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickalndestgrablinestartfromcursor" + bl_label = "Grab Line Start From Cursor" + bl_description = "Grabs line start coordinates from the 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_start' + quick_op_target = 'ALNDEST' + + class GrabLineStartFromActiveLocal(GrabFromGeometryBase): bl_idname = "maplus.grablinestartfromactivelocal" bl_label = "Grab Local Coordinate for Line Start From Active Point" @@ -1451,7 +1503,6 @@ class GrabLineStartFromActiveLocal(GrabFromGeometryBase): "in edit mode" ) bl_options = {'REGISTER', 'UNDO'} - target_point_attribute = 'line_start' vert_attribs_to_set = ('line_start',) multiply_by_world_matrix = False @@ -1468,6 +1519,58 @@ class GrabLineStartFromActiveGlobal(GrabFromGeometryBase): multiply_by_world_matrix = True +class QuickAlnSrcGrabLineStartFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickalnsrcgrablinestartfromactivelocal" + bl_label = "Grab Local Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs local coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = False + quick_op_target = 'ALNSRC' + + +class QuickAlnSrcGrabLineStartFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickalnsrcgrablinestartfromactiveglobal" + bl_label = "Grab Global Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs global coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = 'ALNSRC' + + +class QuickAlnDestGrabLineStartFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickalndestgrablinestartfromactivelocal" + bl_label = "Grab Local Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs local coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = False + quick_op_target = 'ALNDEST' + + +class QuickAlnDestGrabLineStartFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickalndestgrablinestartfromactiveglobal" + bl_label = "Grab Global Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs global coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = 'ALNDEST' + + class SendLineStartToCursor(SendCoordToCursorBase): bl_idname = "maplus.sendlinestarttocursor" bl_label = "Sends Line Start to Cursor" @@ -1476,6 +1579,24 @@ class SendLineStartToCursor(SendCoordToCursorBase): source_coord_attrib = 'line_start' +class QuickAlnSrcSendLineStartToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickalnsrcsendlinestarttocursor" + bl_label = "Sends Line Start to Cursor" + bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_start' + quick_op_target = 'ALNSRC' + + +class QuickAlnDestSendLineStartToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickalndestsendlinestarttocursor" + bl_label = "Sends Line Start to Cursor" + bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_start' + quick_op_target = 'ALNDEST' + + class GrabLineEndFromCursor(GrabFromCursorBase): bl_idname = "maplus.grablineendfromcursor" bl_label = "Grab From Cursor" @@ -1484,6 +1605,24 @@ class GrabLineEndFromCursor(GrabFromCursorBase): vert_attrib_to_set = 'line_end' +class QuickAlnSrcGrabLineEndFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickalnsrcgrablineendfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_end' + quick_op_target = 'ALNSRC' + + +class QuickAlnDestGrabLineEndFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickalndestgrablineendfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_end' + quick_op_target = 'ALNDEST' + + class GrabLineEndFromActiveLocal(GrabFromGeometryBase): bl_idname = "maplus.grablineendfromactivelocal" bl_label = "Grab From Active Point" @@ -1504,6 +1643,58 @@ class GrabLineEndFromActiveGlobal(GrabFromGeometryBase): multiply_by_world_matrix = True +class QuickAlnSrcGrabLineEndFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickalnsrcgrablineendfromactivelocal" + bl_label = "Grab Local Coordinate for Line End From Active Point" + bl_description = ( + "Grabs local coordinates for line end from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = False + quick_op_target = 'ALNSRC' + + +class QuickAlnSrcGrabLineEndFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickalnsrcgrablineendfromactiveglobal" + bl_label = "Grab Global Coordinate for Line End From Active Point" + bl_description = ( + "Grabs global coordinates for line end from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = 'ALNSRC' + + +class QuickAlnDestGrabLineEndFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickalndestgrablineendfromactivelocal" + bl_label = "Grab Local Coordinate for Line End From Active Point" + bl_description = ( + "Grabs local coordinates for line end from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = False + quick_op_target = 'ALNDEST' + + +class QuickAlnDestGrabLineEndFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickalndestgrablineendfromactiveglobal" + bl_label = "Grab Global Coordinate for Line End From Active Point" + bl_description = ( + "Grabs global coordinates for line end from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = 'ALNDEST' + + class SendLineEndToCursor(SendCoordToCursorBase): bl_idname = "maplus.sendlineendtocursor" bl_label = "Sends Line End to Cursor" @@ -1512,6 +1703,24 @@ class SendLineEndToCursor(SendCoordToCursorBase): source_coord_attrib = 'line_end' +class QuickAlnSrcSendLineEndToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickalnsrcsendlineendtocursor" + bl_label = "Sends Line Start to Cursor" + bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_end' + quick_op_target = 'ALNSRC' + + +class QuickAlnDestSendLineEndToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickalndestsendlineendtocursor" + bl_label = "Sends Line Start to Cursor" + bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_end' + quick_op_target = 'ALNDEST' + + class GrabAllVertsLineLocal(GrabFromGeometryBase): bl_idname = "maplus.graballvertslinelocal" bl_label = "Grab Line from Selected Verts" @@ -1546,6 +1755,18 @@ class QuickAlignLinesGrabSrc(GrabFromGeometryBase): quick_op_target = "ALNSRC" +class QuickAlignLinesGrabSrcLoc(GrabFromGeometryBase): + bl_idname = "maplus.quickalignlinesgrabsrcloc" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = False + quick_op_target = "ALNSRC" + + class QuickAlignLinesGrabDest(GrabFromGeometryBase): bl_idname = "maplus.quickalignlinesgrabdest" bl_label = "Grab Line from Selected Verts" @@ -2112,6 +2333,24 @@ class SwapLinePoints(SwapPointsBase): targets = ('line_start', 'line_end') +class QuickAlnSrcSwapLinePoints(SwapPointsBase): + bl_idname = "maplus.quickalnsrcswaplinepoints" + bl_label = "Swap Line Points" + bl_description = "Swap line points" + bl_options = {'REGISTER', 'UNDO'} + targets = ('line_start', 'line_end') + quick_op_target = 'ALNSRC' + + +class QuickAlnDestSwapLinePoints(SwapPointsBase): + bl_idname = "maplus.quickalndestswaplinepoints" + bl_label = "Swap Line Points" + bl_description = "Swap line points" + bl_options = {'REGISTER', 'UNDO'} + targets = ('line_start', 'line_end') + quick_op_target = 'ALNDEST' + + class SwapPlaneAPlaneB(SwapPointsBase): bl_idname = "maplus.swapplaneaplaneb" bl_label = "Swap Plane Point A with Plane Point B" @@ -6365,17 +6604,377 @@ def draw(self, context): 'quick_align_lines_auto_grab_src', 'Auto Grab Source from Selected Vertices' ) + + aln_src_geom_top = aln_grab_col.row() if not addon_data.quick_align_lines_auto_grab_src: - aln_grab_col.operator( + if not addon_data.quick_aln_show_src_geom: + aln_src_geom_top.operator( + "maplus.showhidequickalnsrcgeom", + icon='TRIA_RIGHT', + text="", + emboss=False + ) + aln_src_geom_top.operator( + "maplus.quickalignlinesgrabsrc", + icon='WORLD', + text="Grab Source" + ) + else: + aln_src_geom_top.operator( + "maplus.showhidequickalnsrcgeom", + icon='TRIA_DOWN', + text="", + emboss=False + ) + aln_src_geom_top.label("Source Coordinates") + + aln_src_geom_editor = aln_grab_col.box() + ln_grab_all = aln_src_geom_editor.row(align=True) + ln_grab_all.operator( + "maplus.quickalignlinesgrabsrcloc", + icon='VERTEXSEL', + text="Grab All Local" + ) + ln_grab_all.operator( "maplus.quickalignlinesgrabsrc", icon='WORLD', - text="Grab Source" + text="Grab All Global" + ) + + aln_src_geom_editor.label("Start:") + # plane_a_items = aln_src_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_start_items = aln_src_geom_editor.row() + typein_and_grab_start = ln_start_items.column() + ln_start_uppers = typein_and_grab_start.split(percentage=.33) + + ln_start_swap = ln_start_uppers.row(align=True) + ln_start_swap.label("Swap With:") + ln_start_swap.operator( + "maplus.quickalnsrcswaplinepoints", + text="End" + ) + + ln_start_uppers_rightside = ln_start_uppers.row(align=True) + ln_start_uppers_rightside.alignment = 'RIGHT' + ln_start_uppers_rightside.label("Send:") + ln_start_uppers_rightside.operator( + "maplus.quickalnsrcsendlinestarttocursor", + icon='CURSOR', + text="" + ) + + ln_start_uppers_rightside.label("Grab:") + ln_start_uppers_rightside.operator( + "maplus.quickalnsrcgrablinestartfromcursor", + icon='CURSOR', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.quickalnsrcgrablinestartfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.quickalnsrcgrablinestartfromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_start.prop( + bpy.types.AnyType(addon_data.quick_align_lines_src), + 'line_start', + "" + ) + + # component_changers_plna = plane_a_items.row() + # zero_components_plna = component_changers_plna.column( + # align=True + # ) + # zero_components_plna.label("Set Zeroes:") + # zero_components_plna.operator( + # "maplus.zerootherplanepointax", + # text="X00" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointay", + # text="0Y0" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointaz", + # text="00Z" + # ) + # one_components_plna = component_changers_plna.column( + # align=True + # ) + # one_components_plna.label("Set Ones:") + # one_components_plna.operator( + # "maplus.oneotherplanepointax", + # text="X11" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointay", + # text="1Y1" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointaz", + # text="11Z" + # ) + + + aln_src_geom_editor.label("End:") + # plane_a_items = aln_src_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_end_items = aln_src_geom_editor.row() + typein_and_grab_end = ln_end_items.column() + ln_end_uppers = typein_and_grab_end.split(percentage=.33) + + ln_end_swap = ln_end_uppers.row(align=True) + ln_end_swap.label("Swap With:") + ln_end_swap.operator( + "maplus.quickalnsrcswaplinepoints", + text="Start" + ) + + ln_end_uppers_rightside = ln_end_uppers.row(align=True) + ln_end_uppers_rightside.alignment = 'RIGHT' + ln_end_uppers_rightside.label("Send:") + ln_end_uppers_rightside.operator( + "maplus.quickalnsrcsendlineendtocursor", + icon='CURSOR', + text="" + ) + + ln_end_uppers_rightside.label("Grab:") + ln_end_uppers_rightside.operator( + "maplus.quickalnsrcgrablineendfromcursor", + icon='CURSOR', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.quickalnsrcgrablineendfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.quickalnsrcgrablineendfromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_end.prop( + bpy.types.AnyType(addon_data.quick_align_lines_src), + 'line_end', + "" + ) + + # component_changers_plnc = plane_c_items.row() + # zero_components_plnc = component_changers_plnc.column( + # align=True + # ) + # zero_components_plnc.label("Set Zeroes:") + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcx", + # text="X00" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcy", + # text="0Y0" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcz", + # text="00Z" + # ) + # one_components_plnc = component_changers_plnc.column( + # align=True + # ) + # one_components_plnc.label("Set Ones:") + # one_components_plnc.operator( + # "maplus.oneotherplanepointcx", + # text="X11" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcy", + # text="1Y1" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcz", + # text="11Z" + # ) + if addon_data.quick_aln_show_src_geom: + aln_grab_col.separator() + + # apl_dest_geom = apl_grab_col.row() + # apl_grab_col.operator( + # "maplus.quickalignplanesgrabdest", + # icon='WORLD', + # text="Grab Destination" + # ) + + aln_dest_geom_top = aln_grab_col.row() + if not addon_data.quick_aln_show_dest_geom: + aln_dest_geom_top.operator( + "maplus.showhidequickalndestgeom", + icon='TRIA_RIGHT', + text="", + emboss=False + ) + aln_dest_geom_top.operator( + "maplus.quickalignlinesgrabdest", + icon='WORLD', + text="Grab Destination" ) - aln_grab_col.operator( + else: + aln_dest_geom_top.operator( + "maplus.showhidequickalndestgeom", + icon='TRIA_DOWN', + text="", + emboss=False + ) + aln_dest_geom_top.label("Destination Coordinates") + + aln_dest_geom_editor = aln_grab_col.box() + ln_grab_all = aln_dest_geom_editor.row(align=True) + ln_grab_all.operator( + "maplus.quickalignlinesgrabdestloc", + icon='VERTEXSEL', + text="Grab All Local" + ) + ln_grab_all.operator( "maplus.quickalignlinesgrabdest", icon='WORLD', - text="Grab Destination" - ) + text="Grab All Global" + ) + + aln_dest_geom_editor.label("Start:") + # plane_a_items = aln_dest_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_start_items = aln_dest_geom_editor.row() + typein_and_grab_start = ln_start_items.column() + ln_start_uppers = typein_and_grab_start.split(percentage=.33) + + ln_start_swap = ln_start_uppers.row(align=True) + ln_start_swap.label("Swap With:") + ln_start_swap.operator( + "maplus.quickalndestswaplinepoints", + text="End" + ) + + ln_start_uppers_rightside = ln_start_uppers.row(align=True) + ln_start_uppers_rightside.alignment = 'RIGHT' + ln_start_uppers_rightside.label("Send:") + ln_start_uppers_rightside.operator( + "maplus.quickalndestsendlinestarttocursor", + icon='CURSOR', + text="" + ) + + ln_start_uppers_rightside.label("Grab:") + ln_start_uppers_rightside.operator( + "maplus.quickalndestgrablinestartfromcursor", + icon='CURSOR', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.quickalndestgrablinestartfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.quickalndestgrablinestartfromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_start.prop( + bpy.types.AnyType(addon_data.quick_align_lines_dest), + 'line_start', + "" + ) + + # component_changers_plna = plane_a_items.row() + # zero_components_plna = component_changers_plna.column( + # align=True + # ) + # zero_components_plna.label("Set Zeroes:") + # zero_components_plna.operator( + # "maplus.zerootherplanepointax", + # text="X00" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointay", + # text="0Y0" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointaz", + # text="00Z" + # ) + # one_components_plna = component_changers_plna.column( + # align=True + # ) + # one_components_plna.label("Set Ones:") + # one_components_plna.operator( + # "maplus.oneotherplanepointax", + # text="X11" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointay", + # text="1Y1" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointaz", + # text="11Z" + # ) + + aln_dest_geom_editor.label("End:") + # plane_a_items = aln_dest_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_end_items = aln_dest_geom_editor.row() + typein_and_grab_end = ln_end_items.column() + ln_end_uppers = typein_and_grab_end.split(percentage=.33) + + ln_end_swap = ln_end_uppers.row(align=True) + ln_end_swap.label("Swap With:") + ln_end_swap.operator( + "maplus.quickalndestswaplinepoints", + text="Start" + ) + + ln_end_uppers_rightside = ln_end_uppers.row(align=True) + ln_end_uppers_rightside.alignment = 'RIGHT' + ln_end_uppers_rightside.label("Send:") + ln_end_uppers_rightside.operator( + "maplus.quickalndestsendlineendtocursor", + icon='CURSOR', + text="" + ) + + ln_end_uppers_rightside.label("Grab:") + ln_end_uppers_rightside.operator( + "maplus.quickalndestgrablineendfromcursor", + icon='CURSOR', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.quickalndestgrablineendfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.quickalndestgrablineendfromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_end.prop( + bpy.types.AnyType(addon_data.quick_align_lines_dest), + 'line_end', + "" + ) + + ################################### + ################################### + + + ################################### + ################################### + aln_gui.label("Operator settings:") aln_mods = aln_gui.box() aln_mods_row1 = aln_mods.row() From 81456919c1bad6495ee0c3460d34329c9b3d4d4b Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Wed, 8 Feb 2017 15:49:57 -0500 Subject: [PATCH 03/56] Added missing 'Grab all local' operator on ALN destination. --- mesh_mesh_align_plus.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 54094bb..0be55b4 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -1779,6 +1779,18 @@ class QuickAlignLinesGrabDest(GrabFromGeometryBase): quick_op_target = "ALNDEST" +class QuickAlignLinesGrabDestLoc(GrabFromGeometryBase): + bl_idname = "maplus.quickalignlinesgrabdestloc" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = False + quick_op_target = "ALNDEST" + + class QuickScaleMatchEdgeGrabSrc(GrabFromGeometryBase): bl_idname = "maplus.quickscalematchedgegrabsrc" bl_label = "Grab Line from Selected Verts" From 83f7509a5219f807950d2c14c0c61e841b3547aa Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Thu, 9 Feb 2017 16:54:01 -0500 Subject: [PATCH 04/56] Added geometry editing on Quick Align Points. --- mesh_mesh_align_plus.py | 306 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 281 insertions(+), 25 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 0be55b4..9dcf59c 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -371,6 +371,20 @@ class MAPlusData(bpy.types.PropertyGroup): ), default=True ) + quick_apt_show_src_geom = bpy.props.BoolProperty( + description=( + "Expand/collapse the source geometry editor" + " in the quick tools panel." + ), + default=False + ) + quick_apt_show_dest_geom = bpy.props.BoolProperty( + description=( + "Expand/collapse the source geometry editor" + " in the quick tools panel." + ), + default=False + ) quick_align_pts_auto_grab_src = bpy.props.BoolProperty( description=( "Automatically grab source point from selected geometry" @@ -816,17 +830,26 @@ class ShowHideQuickGeomBaseClass(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data if self.quick_op_target == "APTSRC": - active_item = addon_data.quick_apt_show_src_geom + addon_data.quick_apt_show_src_geom = ( + not addon_data.quick_apt_show_src_geom + ) elif self.quick_op_target == "APTDEST": - active_item = addon_data.quick_apt_show_dest_geom - + addon_data.quick_apt_show_dest_geom = ( + not addon_data.quick_apt_show_dest_geom + ) elif self.quick_op_target == "DSSRC": - active_item = addon_data.quick_ds_show_src_geom + addon_data.quick_ds_show_src_geom = ( + not addon_data.quick_ds_show_src_geom + ) elif self.quick_op_target == "SMESRC": - active_item = addon_data.quick_sme_show_src_geom + addon_data.quick_sme_show_src_geom = ( + not addon_data.quick_sme_show_src_geom + ) elif self.quick_op_target == "SMEDEST": - active_item = addon_data.quick_sme_show_dest_geom + addon_data.quick_sme_show_dest_geom = ( + not addon_data.quick_sme_show_dest_geom + ) elif self.quick_op_target == "ALNSRC": addon_data.quick_aln_show_src_geom = ( @@ -838,7 +861,9 @@ def execute(self, context): ) elif self.quick_op_target == "AXRSRC": - active_item = addon_data.quick_axr_show_src_geom + addon_data.quick_axr_show_src_geom = ( + not addon_data.quick_axr_show_src_geom + ) elif self.quick_op_target == "APLSRC": addon_data.quick_apl_show_src_geom = ( @@ -852,20 +877,20 @@ def execute(self, context): return {'FINISHED'} -class ShowHideQuickAplSrcGeom(ShowHideQuickGeomBaseClass): - bl_idname = "maplus.showhidequickaplsrcgeom" - bl_label = "Show/hide quick align planes source geometry" - bl_description = "Show/hide quick align planes source geometry" +class ShowHideQuickAptSrcGeom(ShowHideQuickGeomBaseClass): + bl_idname = "maplus.showhidequickaptsrcgeom" + bl_label = "Show/hide quick align points source geometry" + bl_description = "Show/hide quick align points source geometry" bl_options = {'REGISTER', 'UNDO'} - quick_op_target = 'APLSRC' + quick_op_target = 'APTSRC' -class ShowHideQuickAplDestGeom(ShowHideQuickGeomBaseClass): - bl_idname = "maplus.showhidequickapldestgeom" - bl_label = "Show/hide quick align planes destination geometry" - bl_description = "Show/hide quick align planes destination geometry" +class ShowHideQuickAptDestGeom(ShowHideQuickGeomBaseClass): + bl_idname = "maplus.showhidequickaptdestgeom" + bl_label = "Show/hide quick align points destination geometry" + bl_description = "Show/hide quick align points destination geometry" bl_options = {'REGISTER', 'UNDO'} - quick_op_target = 'APLDEST' + quick_op_target = 'APTDEST' class ShowHideQuickAlnSrcGeom(ShowHideQuickGeomBaseClass): @@ -884,6 +909,22 @@ class ShowHideQuickAlnDestGeom(ShowHideQuickGeomBaseClass): quick_op_target = 'ALNDEST' +class ShowHideQuickAplSrcGeom(ShowHideQuickGeomBaseClass): + bl_idname = "maplus.showhidequickaplsrcgeom" + bl_label = "Show/hide quick align planes source geometry" + bl_description = "Show/hide quick align planes source geometry" + bl_options = {'REGISTER', 'UNDO'} + quick_op_target = 'APLSRC' + + +class ShowHideQuickAplDestGeom(ShowHideQuickGeomBaseClass): + bl_idname = "maplus.showhidequickapldestgeom" + bl_label = "Show/hide quick align planes destination geometry" + bl_description = "Show/hide quick align planes destination geometry" + bl_options = {'REGISTER', 'UNDO'} + quick_op_target = 'APLDEST' + + # Exception when adding new items, if we can't get a unique name class UniqueNameError(Exception): pass @@ -1391,6 +1432,24 @@ class GrabPointFromCursor(GrabFromCursorBase): vert_attrib_to_set = 'point' +class QuickAptSrcGrabPointFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickaptsrcgrabpointfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'point' + quick_op_target = 'APTSRC' + + +class QuickAptDestGrabPointFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickaptdestgrabpointfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'point' + quick_op_target = 'APTDEST' + + class GrabPointFromActiveLocal(GrabFromGeometryBase): bl_idname = "maplus.grabpointfromactivelocal" bl_label = "Grab Local Coordinates From Active Point" @@ -1469,6 +1528,24 @@ class SendPointToCursor(SendCoordToCursorBase): source_coord_attrib = 'point' +class QuickAptSrcSendPointToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickaptsrcsendpointtocursor" + bl_label = "Sends Point to Cursor" + bl_description = "Sends Point Coordinates to the 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'point' + quick_op_target = 'APTSRC' + + +class QuickAptDestSendPointToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickaptdestsendpointtocursor" + bl_label = "Sends Point to Cursor" + bl_description = "Sends Point Coordinates to the 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'point' + quick_op_target = 'APTDEST' + + class GrabLineStartFromCursor(GrabFromCursorBase): bl_idname = "maplus.grablinestartfromcursor" bl_label = "Grab Line Start From Cursor" @@ -6537,17 +6614,196 @@ def draw(self, context): 'quick_align_pts_auto_grab_src', 'Auto Grab Source from Selected Vertices' ) + + apt_src_geom_top = apt_grab_col.row() if not addon_data.quick_align_pts_auto_grab_src: - apt_grab_col.operator( - "maplus.quickalignpointsgrabsrc", + if not addon_data.quick_apt_show_src_geom: + apt_src_geom_top.operator( + "maplus.showhidequickaptsrcgeom", + icon='TRIA_RIGHT', + text="", + emboss=False + ) + apt_src_geom_top.operator( + "maplus.quickalignpointsgrabsrc", + icon='WORLD', + text="Grab Source" + ) + else: + apt_src_geom_top.operator( + "maplus.showhidequickaptsrcgeom", + icon='TRIA_DOWN', + text="", + emboss=False + ) + apt_src_geom_top.label("Source Coordinates") + + apt_src_geom_editor = apt_grab_col.box() + pt_grab_all = apt_src_geom_editor.row(align=True) + pt_grab_all.operator( + "maplus.quickalignpointsgrabsrcloc", + icon='VERTEXSEL', + text="Grab All Local" + ) + pt_grab_all.operator( + "maplus.quickalignpointsgrabsrc", + icon='WORLD', + text="Grab All Global" + ) + + apt_src_geom_editor.label("Pt. Origin:") + # plane_a_items = apt_src_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + pt_items = apt_src_geom_editor.row() + typein_and_grab_pt = pt_items.column() + pt_uppers = typein_and_grab_pt.row() + + pt_uppers_leftside = pt_uppers.row(align=True) + pt_uppers_leftside.alignment = 'LEFT' + pt_uppers_leftside.label("Send:") + pt_uppers_leftside.operator( + "maplus.quickaptsrcsendpointtocursor", + icon='CURSOR', + text="" + ) + + pt_uppers_rightside = pt_uppers.row(align=True) + pt_uppers_rightside.alignment = 'RIGHT' + pt_uppers_rightside.label("Grab:") + pt_uppers_rightside.operator( + "maplus.quickaptsrcgrabpointfromcursor", + icon='CURSOR', + text="" + ) + pt_uppers_rightside.operator( + "maplus.quickalignpointsgrabsrcloc", + icon='VERTEXSEL', + text="" + ) + pt_uppers_rightside.operator( + "maplus.quickalignpointsgrabsrc", + icon='WORLD', + text="" + ) + typein_and_grab_pt.prop( + bpy.types.AnyType(addon_data.quick_align_pts_src), + 'point', + "" + ) + + # component_changers_plna = plane_a_items.row() + # zero_components_plna = component_changers_plna.column( + # align=True + # ) + # zero_components_plna.label("Set Zeroes:") + # zero_components_plna.operator( + # "maplus.zerootherplanepointax", + # text="X00" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointay", + # text="0Y0" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointaz", + # text="00Z" + # ) + # one_components_plna = component_changers_plna.column( + # align=True + # ) + # one_components_plna.label("Set Ones:") + # one_components_plna.operator( + # "maplus.oneotherplanepointax", + # text="X11" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointay", + # text="1Y1" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointaz", + # text="11Z" + # ) + if addon_data.quick_apt_show_src_geom: + apt_grab_col.separator() + + apt_dest_geom_top = apt_grab_col.row() + if not addon_data.quick_apt_show_dest_geom: + apt_dest_geom_top.operator( + "maplus.showhidequickaptdestgeom", + icon='TRIA_RIGHT', + text="", + emboss=False + ) + apt_dest_geom_top.operator( + "maplus.quickalignpointsgrabdest", + icon='WORLD', + text="Grab Destination" + ) + else: + apt_dest_geom_top.operator( + "maplus.showhidequickaptdestgeom", + icon='TRIA_DOWN', + text="", + emboss=False + ) + apt_dest_geom_top.label("Destination Coordinates") + + apt_dest_geom_editor = apt_grab_col.box() + pt_grab_all = apt_dest_geom_editor.row(align=True) + pt_grab_all.operator( + "maplus.quickalignpointsgrabdestloc", + icon='VERTEXSEL', + text="Grab All Local" + ) + pt_grab_all.operator( + "maplus.quickalignpointsgrabdest", icon='WORLD', - text="Grab Source" + text="Grab All Global" ) - apt_grab_col.operator( - "maplus.quickalignpointsgrabdest", - icon='WORLD', - text="Grab Destination" - ) + + apt_dest_geom_editor.label("Pt. Origin:") + # plane_a_items = apt_src_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + pt_items = apt_dest_geom_editor.row() + typein_and_grab_pt = pt_items.column() + pt_uppers = typein_and_grab_pt.row() + + pt_uppers_leftside = pt_uppers.row(align=True) + pt_uppers_leftside.alignment = 'LEFT' + pt_uppers_leftside.label("Send:") + pt_uppers_leftside.operator( + "maplus.quickaptdestsendpointtocursor", + icon='CURSOR', + text="" + ) + + pt_uppers_rightside = pt_uppers.row(align=True) + pt_uppers_rightside.alignment = 'RIGHT' + pt_uppers_rightside.label("Grab:") + pt_uppers_rightside.operator( + "maplus.quickaptdestgrabpointfromcursor", + icon='CURSOR', + text="" + ) + pt_uppers_rightside.operator( + "maplus.quickalignpointsgrabdestloc", + icon='VERTEXSEL', + text="" + ) + pt_uppers_rightside.operator( + "maplus.quickalignpointsgrabdest", + icon='WORLD', + text="" + ) + typein_and_grab_pt.prop( + bpy.types.AnyType(addon_data.quick_align_pts_dest), + 'point', + "" + ) + + ######################## + align_pts_gui.label("Operator settings:") apt_mods = align_pts_gui.box() apt_box_row1 = apt_mods.row() From a59ffb6678e8c2a34ba557b40f482a00a5332bd2 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Fri, 10 Feb 2017 13:09:17 -0500 Subject: [PATCH 05/56] Added geometry editing on Quick Axis Rotate. --- mesh_mesh_align_plus.py | 334 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 331 insertions(+), 3 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 9dcf59c..6ce8d1e 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -479,6 +479,13 @@ class MAPlusData(bpy.types.PropertyGroup): ), default=True ) + quick_axr_show_src_geom = bpy.props.BoolProperty( + description=( + "Expand/collapse the source geometry editor" + " in the quick tools panel." + ), + default=False + ) quick_axis_rotate_auto_grab_src = bpy.props.BoolProperty( description=( "Automatically grab source axis from selected geometry" @@ -925,6 +932,14 @@ class ShowHideQuickAplDestGeom(ShowHideQuickGeomBaseClass): quick_op_target = 'APLDEST' +class ShowHideQuickAxrSrcGeom(ShowHideQuickGeomBaseClass): + bl_idname = "maplus.showhidequickaxrsrcgeom" + bl_label = "Show/hide quick axis rotate source geometry" + bl_description = "Show/hide quick axis rotate source geometry" + bl_options = {'REGISTER', 'UNDO'} + quick_op_target = 'AXRSRC' + + # Exception when adding new items, if we can't get a unique name class UniqueNameError(Exception): pass @@ -1572,6 +1587,15 @@ class QuickAlnDestGrabLineStartFromCursor(GrabFromCursorBase): quick_op_target = 'ALNDEST' +class QuickAxrSrcGrabLineStartFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickaxrsrcgrablinestartfromcursor" + bl_label = "Grab Line Start From Cursor" + bl_description = "Grabs line start coordinates from the 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_start' + quick_op_target = 'AXRSRC' + + class GrabLineStartFromActiveLocal(GrabFromGeometryBase): bl_idname = "maplus.grablinestartfromactivelocal" bl_label = "Grab Local Coordinate for Line Start From Active Point" @@ -1648,6 +1672,32 @@ class QuickAlnDestGrabLineStartFromActiveGlobal(GrabFromGeometryBase): quick_op_target = 'ALNDEST' +class QuickAxrSrcGrabLineStartFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickaxrsrcgrablinestartfromactivelocal" + bl_label = "Grab Local Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs local coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = False + quick_op_target = 'AXRSRC' + + +class QuickAxrSrcGrabLineStartFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickaxrsrcgrablinestartfromactiveglobal" + bl_label = "Grab Global Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs global coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = 'AXRSRC' + + class SendLineStartToCursor(SendCoordToCursorBase): bl_idname = "maplus.sendlinestarttocursor" bl_label = "Sends Line Start to Cursor" @@ -1674,6 +1724,15 @@ class QuickAlnDestSendLineStartToCursor(SendCoordToCursorBase): quick_op_target = 'ALNDEST' +class QuickAxrSrcSendLineStartToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickaxrsrcsendlinestarttocursor" + bl_label = "Sends Line Start to Cursor" + bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_start' + quick_op_target = 'AXRSRC' + + class GrabLineEndFromCursor(GrabFromCursorBase): bl_idname = "maplus.grablineendfromcursor" bl_label = "Grab From Cursor" @@ -1700,6 +1759,15 @@ class QuickAlnDestGrabLineEndFromCursor(GrabFromCursorBase): quick_op_target = 'ALNDEST' +class QuickAxrSrcGrabLineEndFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickaxrsrcgrablineendfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_end' + quick_op_target = 'AXRSRC' + + class GrabLineEndFromActiveLocal(GrabFromGeometryBase): bl_idname = "maplus.grablineendfromactivelocal" bl_label = "Grab From Active Point" @@ -1772,6 +1840,45 @@ class QuickAlnDestGrabLineEndFromActiveGlobal(GrabFromGeometryBase): quick_op_target = 'ALNDEST' +class QuickAlnSrcGrabLineEndFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickalnsrcgrablineendfromactivelocal" + bl_label = "Grab Local Coordinate for Line End From Active Point" + bl_description = ( + "Grabs local coordinates for line end from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = False + quick_op_target = 'ALNSRC' + + +class QuickAxrSrcGrabLineEndFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickaxrsrcgrablineendfromactiveglobal" + bl_label = "Grab Global Coordinate for Line End From Active Point" + bl_description = ( + "Grabs global coordinates for line end from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = 'AXRSRC' + + +class QuickAxrSrcGrabLineEndFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickaxrsrcgrablineendfromactivelocal" + bl_label = "Grab Global Coordinate for Line End From Active Point" + bl_description = ( + "Grabs global coordinates for line end from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = False + quick_op_target = 'AXRSRC' + + class SendLineEndToCursor(SendCoordToCursorBase): bl_idname = "maplus.sendlineendtocursor" bl_label = "Sends Line End to Cursor" @@ -1798,6 +1905,15 @@ class QuickAlnDestSendLineEndToCursor(SendCoordToCursorBase): quick_op_target = 'ALNDEST' +class QuickAxrSrcSendLineEndToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickaxrsrcsendlineendtocursor" + bl_label = "Sends Line Start to Cursor" + bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_end' + quick_op_target = 'AXRSRC' + + class GrabAllVertsLineLocal(GrabFromGeometryBase): bl_idname = "maplus.graballvertslinelocal" bl_label = "Grab Line from Selected Verts" @@ -1904,6 +2020,18 @@ class QuickAxisRotateGrabSrc(GrabFromGeometryBase): quick_op_target = "AXRSRC" +class QuickAxisRotateGrabSrcLoc(GrabFromGeometryBase): + bl_idname = "maplus.quickaxisrotategrabsrcloc" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = False + quick_op_target = "AXRSRC" + + class QuickDirectionalSlideGrabSrc(GrabFromGeometryBase): bl_idname = "maplus.quickdirectionalslidegrabsrc" bl_label = "Grab Line from Selected Verts" @@ -2440,6 +2568,15 @@ class QuickAlnDestSwapLinePoints(SwapPointsBase): quick_op_target = 'ALNDEST' +class QuickAxrSrcSwapLinePoints(SwapPointsBase): + bl_idname = "maplus.quickaxrsrcswaplinepoints" + bl_label = "Swap Line Points" + bl_description = "Swap line points" + bl_options = {'REGISTER', 'UNDO'} + targets = ('line_start', 'line_end') + quick_op_target = 'AXRSRC' + + class SwapPlaneAPlaneB(SwapPointsBase): bl_idname = "maplus.swapplaneaplaneb" bl_label = "Swap Plane Point A with Plane Point B" @@ -7944,12 +8081,203 @@ def draw(self, context): 'quick_axis_rotate_auto_grab_src', 'Auto Grab Axis from Selected Vertices' ) + + axr_src_geom_top = axr_grab_col.row() if not addon_data.quick_axis_rotate_auto_grab_src: - axr_grab_col.operator( + if not addon_data.quick_axr_show_src_geom: + axr_src_geom_top.operator( + "maplus.showhidequickaxrsrcgeom", + icon='TRIA_RIGHT', + text="", + emboss=False + ) + axr_src_geom_top.operator( + "maplus.quickaxisrotategrabsrc", + icon='WORLD', + text="Grab Axis" + ) + else: + axr_src_geom_top.operator( + "maplus.showhidequickaxrsrcgeom", + icon='TRIA_DOWN', + text="", + emboss=False + ) + axr_src_geom_top.label("Source Coordinates") + + axr_src_geom_editor = axr_grab_col.box() + ln_grab_all = axr_src_geom_editor.row(align=True) + ln_grab_all.operator( + "maplus.quickaxisrotategrabsrcloc", + icon='VERTEXSEL', + text="Grab All Local" + ) + ln_grab_all.operator( "maplus.quickaxisrotategrabsrc", icon='WORLD', - text="Grab Axis" - ) + text="Grab All Global" + ) + + axr_src_geom_editor.label("Start:") + # plane_a_items = axr_src_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_start_items = axr_src_geom_editor.row() + typein_and_grab_start = ln_start_items.column() + ln_start_uppers = typein_and_grab_start.split(percentage=.33) + + ln_start_swap = ln_start_uppers.row(align=True) + ln_start_swap.label("Swap With:") + ln_start_swap.operator( + "maplus.quickaxrsrcswaplinepoints", + text="End" + ) + + ln_start_uppers_rightside = ln_start_uppers.row(align=True) + ln_start_uppers_rightside.alignment = 'RIGHT' + ln_start_uppers_rightside.label("Send:") + ln_start_uppers_rightside.operator( + "maplus.quickaxrsrcsendlinestarttocursor", + icon='CURSOR', + text="" + ) + + ln_start_uppers_rightside.label("Grab:") + ln_start_uppers_rightside.operator( + "maplus.quickaxrsrcgrablinestartfromcursor", + icon='CURSOR', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.quickaxrsrcgrablinestartfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.quickaxrsrcgrablinestartfromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_start.prop( + bpy.types.AnyType(addon_data.quick_axis_rotate_src), + 'line_start', + "" + ) + + # component_changers_plna = plane_a_items.row() + # zero_components_plna = component_changers_plna.column( + # align=True + # ) + # zero_components_plna.label("Set Zeroes:") + # zero_components_plna.operator( + # "maplus.zerootherplanepointax", + # text="X00" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointay", + # text="0Y0" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointaz", + # text="00Z" + # ) + # one_components_plna = component_changers_plna.column( + # align=True + # ) + # one_components_plna.label("Set Ones:") + # one_components_plna.operator( + # "maplus.oneotherplanepointax", + # text="X11" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointay", + # text="1Y1" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointaz", + # text="11Z" + # ) + + axr_src_geom_editor.label("End:") + # plane_a_items = axr_src_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_end_items = axr_src_geom_editor.row() + typein_and_grab_end = ln_end_items.column() + ln_end_uppers = typein_and_grab_end.split(percentage=.33) + + ln_end_swap = ln_end_uppers.row(align=True) + ln_end_swap.label("Swap With:") + ln_end_swap.operator( + "maplus.quickaxrsrcswaplinepoints", + text="Start" + ) + + ln_end_uppers_rightside = ln_end_uppers.row(align=True) + ln_end_uppers_rightside.alignment = 'RIGHT' + ln_end_uppers_rightside.label("Send:") + ln_end_uppers_rightside.operator( + "maplus.quickaxrsrcsendlineendtocursor", + icon='CURSOR', + text="" + ) + + ln_end_uppers_rightside.label("Grab:") + ln_end_uppers_rightside.operator( + "maplus.quickaxrsrcgrablineendfromcursor", + icon='CURSOR', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.quickaxrsrcgrablineendfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.quickaxrsrcgrablineendfromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_end.prop( + bpy.types.AnyType(addon_data.quick_axis_rotate_src), + 'line_end', + "" + ) + + # component_changers_plnc = plane_c_items.row() + # zero_components_plnc = component_changers_plnc.column( + # align=True + # ) + # zero_components_plnc.label("Set Zeroes:") + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcx", + # text="X00" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcy", + # text="0Y0" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcz", + # text="00Z" + # ) + # one_components_plnc = component_changers_plnc.column( + # align=True + # ) + # one_components_plnc.label("Set Ones:") + # one_components_plnc.operator( + # "maplus.oneotherplanepointcx", + # text="X11" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcy", + # text="1Y1" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcz", + # text="11Z" + # ) + if addon_data.quick_aln_show_src_geom: + axr_grab_col.separator() + axr_gui.label("Operator settings:") axr_mods = axr_gui.box() axr_mods_row1 = axr_mods.row() From d8bcc0d0a3bafc90fa4c07c4d3aa0b841b14ccf7 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Fri, 10 Feb 2017 23:54:00 -0500 Subject: [PATCH 06/56] Added geometry editing on Scale Match Edge. --- mesh_mesh_align_plus.py | 628 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 604 insertions(+), 24 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 6ce8d1e..198cd48 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -380,7 +380,7 @@ class MAPlusData(bpy.types.PropertyGroup): ) quick_apt_show_dest_geom = bpy.props.BoolProperty( description=( - "Expand/collapse the source geometry editor" + "Expand/collapse the destination geometry editor" " in the quick tools panel." ), default=False @@ -425,6 +425,20 @@ class MAPlusData(bpy.types.PropertyGroup): ), default=True ) + quick_sme_show_src_geom = bpy.props.BoolProperty( + description=( + "Expand/collapse the source geometry editor" + " in the quick tools panel." + ), + default=False + ) + quick_sme_show_dest_geom = bpy.props.BoolProperty( + description=( + "Expand/collapse the destination geometry editor" + " in the quick tools panel." + ), + default=False + ) quick_scale_match_edge_auto_grab_src = bpy.props.BoolProperty( description=( "Automatically grab source line from selected geometry" @@ -940,6 +954,22 @@ class ShowHideQuickAxrSrcGeom(ShowHideQuickGeomBaseClass): quick_op_target = 'AXRSRC' +class ShowHideQuickSmeSrcGeom(ShowHideQuickGeomBaseClass): + bl_idname = "maplus.showhidequicksmesrcgeom" + bl_label = "Show/hide quick scale match edge source geometry" + bl_description = "Show/hide quick scale match edge source geometry" + bl_options = {'REGISTER', 'UNDO'} + quick_op_target = 'SMESRC' + + +class ShowHideQuickSmeDestGeom(ShowHideQuickGeomBaseClass): + bl_idname = "maplus.showhidequicksmedestgeom" + bl_label = "Show/hide quick scale match edge source geometry" + bl_description = "Show/hide quick scale match edge source geometry" + bl_options = {'REGISTER', 'UNDO'} + quick_op_target = 'SMEDEST' + + # Exception when adding new items, if we can't get a unique name class UniqueNameError(Exception): pass @@ -1596,6 +1626,24 @@ class QuickAxrSrcGrabLineStartFromCursor(GrabFromCursorBase): quick_op_target = 'AXRSRC' +class QuickSmeSrcGrabLineStartFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quicksmesrcgrablinestartfromcursor" + bl_label = "Grab Line Start From Cursor" + bl_description = "Grabs line start coordinates from the 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_start' + quick_op_target = 'SMESRC' + + +class QuickSmeDestGrabLineStartFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quicksmedestgrablinestartfromcursor" + bl_label = "Grab Line Start From Cursor" + bl_description = "Grabs line start coordinates from the 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_start' + quick_op_target = 'SMEDEST' + + class GrabLineStartFromActiveLocal(GrabFromGeometryBase): bl_idname = "maplus.grablinestartfromactivelocal" bl_label = "Grab Local Coordinate for Line Start From Active Point" @@ -1698,6 +1746,58 @@ class QuickAxrSrcGrabLineStartFromActiveGlobal(GrabFromGeometryBase): quick_op_target = 'AXRSRC' +class QuickSmeSrcGrabLineStartFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quicksmesrcgrablinestartfromactivelocal" + bl_label = "Grab Local Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs local coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = False + quick_op_target = 'SMESRC' + + +class QuickSmeSrcGrabLineStartFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quicksmesrcgrablinestartfromactiveglobal" + bl_label = "Grab Global Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs global coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = 'SMESRC' + + +class QuickSmeDestGrabLineStartFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quicksmedestgrablinestartfromactivelocal" + bl_label = "Grab Local Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs local coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = False + quick_op_target = 'SMEDEST' + + +class QuickSmeDestGrabLineStartFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quicksmedestgrablinestartfromactiveglobal" + bl_label = "Grab Global Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs global coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = 'SMEDEST' + + class SendLineStartToCursor(SendCoordToCursorBase): bl_idname = "maplus.sendlinestarttocursor" bl_label = "Sends Line Start to Cursor" @@ -1733,6 +1833,24 @@ class QuickAxrSrcSendLineStartToCursor(SendCoordToCursorBase): quick_op_target = 'AXRSRC' +class QuickSmeSrcSendLineStartToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quicksmesrcsendlinestarttocursor" + bl_label = "Sends Line Start to Cursor" + bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_start' + quick_op_target = 'SMESRC' + + +class QuickSmeDestSendLineStartToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quicksmedestsendlinestarttocursor" + bl_label = "Sends Line Start to Cursor" + bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_start' + quick_op_target = 'SMEDEST' + + class GrabLineEndFromCursor(GrabFromCursorBase): bl_idname = "maplus.grablineendfromcursor" bl_label = "Grab From Cursor" @@ -1768,6 +1886,24 @@ class QuickAxrSrcGrabLineEndFromCursor(GrabFromCursorBase): quick_op_target = 'AXRSRC' +class QuickSmeSrcGrabLineEndFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quicksmesrcgrablineendfromcursor" + bl_label = "Grab Line End From Cursor" + bl_description = "Grabs line end coordinates from the 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_end' + quick_op_target = 'SMESRC' + + +class QuickSmeDestGrabLineEndFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quicksmedestgrablineendfromcursor" + bl_label = "Grab Line End From Cursor" + bl_description = "Grabs line end coordinates from the 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_end' + quick_op_target = 'SMEDEST' + + class GrabLineEndFromActiveLocal(GrabFromGeometryBase): bl_idname = "maplus.grablineendfromactivelocal" bl_label = "Grab From Active Point" @@ -1840,8 +1976,21 @@ class QuickAlnDestGrabLineEndFromActiveGlobal(GrabFromGeometryBase): quick_op_target = 'ALNDEST' -class QuickAlnSrcGrabLineEndFromActiveLocal(GrabFromGeometryBase): - bl_idname = "maplus.quickalnsrcgrablineendfromactivelocal" +class QuickAxrSrcGrabLineEndFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickaxrsrcgrablineendfromactiveglobal" + bl_label = "Grab Global Coordinate for Line End From Active Point" + bl_description = ( + "Grabs global coordinates for line end from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = 'AXRSRC' + + +class QuickAxrSrcGrabLineEndFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickaxrsrcgrablineendfromactivelocal" bl_label = "Grab Local Coordinate for Line End From Active Point" bl_description = ( "Grabs local coordinates for line end from selected vertex" @@ -1850,11 +1999,24 @@ class QuickAlnSrcGrabLineEndFromActiveLocal(GrabFromGeometryBase): bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_end',) multiply_by_world_matrix = False - quick_op_target = 'ALNSRC' + quick_op_target = 'AXRSRC' -class QuickAxrSrcGrabLineEndFromActiveGlobal(GrabFromGeometryBase): - bl_idname = "maplus.quickaxrsrcgrablineendfromactiveglobal" +class QuickSmeSrcGrabLineEndFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quicksmesrcgrablineendfromactivelocal" + bl_label = "Grab Local Coordinate for Line End From Active Point" + bl_description = ( + "Grabs local coordinates for line end from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = False + quick_op_target = 'SMESRC' + + +class QuickSmeSrcGrabLineEndFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quicksmesrcgrablineendfromactiveglobal" bl_label = "Grab Global Coordinate for Line End From Active Point" bl_description = ( "Grabs global coordinates for line end from selected vertex" @@ -1863,11 +2025,24 @@ class QuickAxrSrcGrabLineEndFromActiveGlobal(GrabFromGeometryBase): bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_end',) multiply_by_world_matrix = True - quick_op_target = 'AXRSRC' + quick_op_target = 'SMESRC' -class QuickAxrSrcGrabLineEndFromActiveLocal(GrabFromGeometryBase): - bl_idname = "maplus.quickaxrsrcgrablineendfromactivelocal" +class QuickSmeDestGrabLineEndFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quicksmedestgrablineendfromactivelocal" + bl_label = "Grab Local Coordinate for Line End From Active Point" + bl_description = ( + "Grabs local coordinates for line end from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = False + quick_op_target = 'SMEDEST' + + +class QuickSmeDestGrabLineEndFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quicksmedestgrablineendfromactiveglobal" bl_label = "Grab Global Coordinate for Line End From Active Point" bl_description = ( "Grabs global coordinates for line end from selected vertex" @@ -1875,8 +2050,8 @@ class QuickAxrSrcGrabLineEndFromActiveLocal(GrabFromGeometryBase): ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_end',) - multiply_by_world_matrix = False - quick_op_target = 'AXRSRC' + multiply_by_world_matrix = True + quick_op_target = 'SMEDEST' class SendLineEndToCursor(SendCoordToCursorBase): @@ -1889,8 +2064,8 @@ class SendLineEndToCursor(SendCoordToCursorBase): class QuickAlnSrcSendLineEndToCursor(SendCoordToCursorBase): bl_idname = "maplus.quickalnsrcsendlineendtocursor" - bl_label = "Sends Line Start to Cursor" - bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_label = "Sends Line End to Cursor" + bl_description = "Sends Line End Coordinates to 3D Cursor" bl_options = {'REGISTER', 'UNDO'} source_coord_attrib = 'line_end' quick_op_target = 'ALNSRC' @@ -1898,8 +2073,8 @@ class QuickAlnSrcSendLineEndToCursor(SendCoordToCursorBase): class QuickAlnDestSendLineEndToCursor(SendCoordToCursorBase): bl_idname = "maplus.quickalndestsendlineendtocursor" - bl_label = "Sends Line Start to Cursor" - bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_label = "Sends Line End to Cursor" + bl_description = "Sends Line End Coordinates to 3D Cursor" bl_options = {'REGISTER', 'UNDO'} source_coord_attrib = 'line_end' quick_op_target = 'ALNDEST' @@ -1907,13 +2082,31 @@ class QuickAlnDestSendLineEndToCursor(SendCoordToCursorBase): class QuickAxrSrcSendLineEndToCursor(SendCoordToCursorBase): bl_idname = "maplus.quickaxrsrcsendlineendtocursor" - bl_label = "Sends Line Start to Cursor" - bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_label = "Sends Line End to Cursor" + bl_description = "Sends Line End Coordinates to 3D Cursor" bl_options = {'REGISTER', 'UNDO'} source_coord_attrib = 'line_end' quick_op_target = 'AXRSRC' +class QuickSmeSrcSendLineEndToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quicksmesrcsendlineendtocursor" + bl_label = "Sends Line End to Cursor" + bl_description = "Sends Line End Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_end' + quick_op_target = 'SMESRC' + + +class QuickSmeDestSendLineEndToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quicksmedestsendlineendtocursor" + bl_label = "Sends Line End to Cursor" + bl_description = "Sends Line End Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_end' + quick_op_target = 'SMEDEST' + + class GrabAllVertsLineLocal(GrabFromGeometryBase): bl_idname = "maplus.graballvertslinelocal" bl_label = "Grab Line from Selected Verts" @@ -1996,6 +2189,18 @@ class QuickScaleMatchEdgeGrabSrc(GrabFromGeometryBase): quick_op_target = "SMESRC" +class QuickScaleMatchEdgeGrabSrcLoc(GrabFromGeometryBase): + bl_idname = "maplus.quickscalematchedgegrabsrcloc" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = False + quick_op_target = "SMESRC" + + class QuickScaleMatchEdgeGrabDest(GrabFromGeometryBase): bl_idname = "maplus.quickscalematchedgegrabdest" bl_label = "Grab Line from Selected Verts" @@ -2008,6 +2213,18 @@ class QuickScaleMatchEdgeGrabDest(GrabFromGeometryBase): quick_op_target = "SMEDEST" +class QuickScaleMatchEdgeGrabDestLoc(GrabFromGeometryBase): + bl_idname = "maplus.quickscalematchedgegrabdestloc" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = False + quick_op_target = "SMEDEST" + + class QuickAxisRotateGrabSrc(GrabFromGeometryBase): bl_idname = "maplus.quickaxisrotategrabsrc" bl_label = "Grab Line from Selected Verts" @@ -2458,9 +2675,9 @@ class QuickAlignPlanesGrabDest(GrabFromGeometryBase): class QuickAlignPlanesGrabSrcLoc(GrabFromGeometryBase): bl_idname = "maplus.quickalignplanesgrabsrcloc" - bl_label = "Grab Plane Global Coordinates from Selected Verts" + bl_label = "Grab Plane Local Coordinates from Selected Verts" bl_description = ( - "Grabs plane global coordinates from selected vertices in edit mode" + "Grabs plane local coordinates from selected vertices in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('plane_pt_a', 'plane_pt_b', 'plane_pt_c') @@ -2577,6 +2794,24 @@ class QuickAxrSrcSwapLinePoints(SwapPointsBase): quick_op_target = 'AXRSRC' +class QuickSmeSrcSwapLinePoints(SwapPointsBase): + bl_idname = "maplus.quicksmesrcswaplinepoints" + bl_label = "Swap Line Points" + bl_description = "Swap line points" + bl_options = {'REGISTER', 'UNDO'} + targets = ('line_start', 'line_end') + quick_op_target = 'SMESRC' + + +class QuickSmeDestSwapLinePoints(SwapPointsBase): + bl_idname = "maplus.quicksmedestswaplinepoints" + bl_label = "Swap Line Points" + bl_description = "Swap line points" + bl_options = {'REGISTER', 'UNDO'} + targets = ('line_start', 'line_end') + quick_op_target = 'SMEDEST' + + class SwapPlaneAPlaneB(SwapPointsBase): bl_idname = "maplus.swapplaneaplaneb" bl_label = "Swap Plane Point A with Plane Point B" @@ -8409,17 +8644,362 @@ def draw(self, context): 'quick_scale_match_edge_auto_grab_src', 'Auto Grab Source from Selected Vertices' ) + + sme_src_geom_top = sme_grab_col.row() if not addon_data.quick_scale_match_edge_auto_grab_src: - sme_grab_col.operator( + if not addon_data.quick_sme_show_src_geom: + sme_src_geom_top.operator( + "maplus.showhidequicksmesrcgeom", + icon='TRIA_RIGHT', + text="", + emboss=False + ) + sme_src_geom_top.operator( + "maplus.quickscalematchedgegrabsrc", + icon='WORLD', + text="Grab Source" + ) + else: + sme_src_geom_top.operator( + "maplus.showhidequicksmesrcgeom", + icon='TRIA_DOWN', + text="", + emboss=False + ) + sme_src_geom_top.label("Source Coordinates") + + sme_src_geom_editor = sme_grab_col.box() + ln_grab_all = sme_src_geom_editor.row(align=True) + ln_grab_all.operator( + "maplus.quickscalematchedgegrabsrcloc", + icon='VERTEXSEL', + text="Grab All Local" + ) + ln_grab_all.operator( "maplus.quickscalematchedgegrabsrc", icon='WORLD', - text="Grab Source" + text="Grab All Global" + ) + + sme_src_geom_editor.label("Start:") + # plane_a_items = sme_src_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_start_items = sme_src_geom_editor.row() + typein_and_grab_start = ln_start_items.column() + ln_start_uppers = typein_and_grab_start.split(percentage=.33) + + ln_start_swap = ln_start_uppers.row(align=True) + ln_start_swap.label("Swap With:") + ln_start_swap.operator( + "maplus.quicksmesrcswaplinepoints", + text="End" + ) + + ln_start_uppers_rightside = ln_start_uppers.row(align=True) + ln_start_uppers_rightside.alignment = 'RIGHT' + ln_start_uppers_rightside.label("Send:") + ln_start_uppers_rightside.operator( + "maplus.quicksmesrcsendlinestarttocursor", + icon='CURSOR', + text="" + ) + + ln_start_uppers_rightside.label("Grab:") + ln_start_uppers_rightside.operator( + "maplus.quicksmesrcgrablinestartfromcursor", + icon='CURSOR', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.quicksmesrcgrablinestartfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.quicksmesrcgrablinestartfromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_start.prop( + bpy.types.AnyType(addon_data.quick_scale_match_edge_src), + 'line_start', + "" + ) + + # component_changers_plna = plane_a_items.row() + # zero_components_plna = component_changers_plna.column( + # align=True + # ) + # zero_components_plna.label("Set Zeroes:") + # zero_components_plna.operator( + # "maplus.zerootherplanepointax", + # text="X00" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointay", + # text="0Y0" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointaz", + # text="00Z" + # ) + # one_components_plna = component_changers_plna.column( + # align=True + # ) + # one_components_plna.label("Set Ones:") + # one_components_plna.operator( + # "maplus.oneotherplanepointax", + # text="X11" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointay", + # text="1Y1" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointaz", + # text="11Z" + # ) + + sme_src_geom_editor.label("End:") + # plane_a_items = sme_src_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_end_items = sme_src_geom_editor.row() + typein_and_grab_end = ln_end_items.column() + ln_end_uppers = typein_and_grab_end.split(percentage=.33) + + ln_end_swap = ln_end_uppers.row(align=True) + ln_end_swap.label("Swap With:") + ln_end_swap.operator( + "maplus.quicksmesrcswaplinepoints", + text="Start" + ) + + ln_end_uppers_rightside = ln_end_uppers.row(align=True) + ln_end_uppers_rightside.alignment = 'RIGHT' + ln_end_uppers_rightside.label("Send:") + ln_end_uppers_rightside.operator( + "maplus.quicksmesrcsendlineendtocursor", + icon='CURSOR', + text="" + ) + + ln_end_uppers_rightside.label("Grab:") + ln_end_uppers_rightside.operator( + "maplus.quicksmesrcgrablineendfromcursor", + icon='CURSOR', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.quicksmesrcgrablineendfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.quicksmesrcgrablineendfromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_end.prop( + bpy.types.AnyType(addon_data.quick_scale_match_edge_src), + 'line_end', + "" + ) + + # component_changers_plnc = plane_c_items.row() + # zero_components_plnc = component_changers_plnc.column( + # align=True + # ) + # zero_components_plnc.label("Set Zeroes:") + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcx", + # text="X00" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcy", + # text="0Y0" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcz", + # text="00Z" + # ) + # one_components_plnc = component_changers_plnc.column( + # align=True + # ) + # one_components_plnc.label("Set Ones:") + # one_components_plnc.operator( + # "maplus.oneotherplanepointcx", + # text="X11" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcy", + # text="1Y1" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcz", + # text="11Z" + # ) + if addon_data.quick_sme_show_src_geom: + sme_grab_col.separator() + + sme_dest_geom_top = sme_grab_col.row() + if not addon_data.quick_sme_show_dest_geom: + sme_dest_geom_top.operator( + "maplus.showhidequicksmedestgeom", + icon='TRIA_RIGHT', + text="", + emboss=False + ) + sme_dest_geom_top.operator( + "maplus.quickscalematchedgegrabdest", + icon='WORLD', + text="Grab Destination" + ) + else: + sme_dest_geom_top.operator( + "maplus.showhidequicksmedestgeom", + icon='TRIA_DOWN', + text="", + emboss=False + ) + sme_dest_geom_top.label("Destination Coordinates") + + sme_dest_geom_editor = sme_grab_col.box() + ln_grab_all = sme_dest_geom_editor.row(align=True) + ln_grab_all.operator( + "maplus.quickscalematchedgegrabdestloc", + icon='VERTEXSEL', + text="Grab All Local" ) - sme_grab_col.operator( + ln_grab_all.operator( "maplus.quickscalematchedgegrabdest", icon='WORLD', - text="Grab Destination" - ) + text="Grab All Global" + ) + + sme_dest_geom_editor.label("Start:") + # plane_a_items = sme_dest_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_start_items = sme_dest_geom_editor.row() + typein_and_grab_start = ln_start_items.column() + ln_start_uppers = typein_and_grab_start.split(percentage=.33) + + ln_start_swap = ln_start_uppers.row(align=True) + ln_start_swap.label("Swap With:") + ln_start_swap.operator( + "maplus.quicksmedestswaplinepoints", + text="End" + ) + + ln_start_uppers_rightside = ln_start_uppers.row(align=True) + ln_start_uppers_rightside.alignment = 'RIGHT' + ln_start_uppers_rightside.label("Send:") + ln_start_uppers_rightside.operator( + "maplus.quicksmedestsendlinestarttocursor", + icon='CURSOR', + text="" + ) + + ln_start_uppers_rightside.label("Grab:") + ln_start_uppers_rightside.operator( + "maplus.quicksmedestgrablinestartfromcursor", + icon='CURSOR', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.quicksmedestgrablinestartfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.quicksmedestgrablinestartfromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_start.prop( + bpy.types.AnyType(addon_data.quick_scale_match_edge_dest), + 'line_start', + "" + ) + + # component_changers_plna = plane_a_items.row() + # zero_components_plna = component_changers_plna.column( + # align=True + # ) + # zero_components_plna.label("Set Zeroes:") + # zero_components_plna.operator( + # "maplus.zerootherplanepointax", + # text="X00" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointay", + # text="0Y0" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointaz", + # text="00Z" + # ) + # one_components_plna = component_changers_plna.column( + # align=True + # ) + # one_components_plna.label("Set Ones:") + # one_components_plna.operator( + # "maplus.oneotherplanepointax", + # text="X11" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointay", + # text="1Y1" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointaz", + # text="11Z" + # ) + + sme_dest_geom_editor.label("End:") + # plane_a_items = sme_dest_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_end_items = sme_dest_geom_editor.row() + typein_and_grab_end = ln_end_items.column() + ln_end_uppers = typein_and_grab_end.split(percentage=.33) + + ln_end_swap = ln_end_uppers.row(align=True) + ln_end_swap.label("Swap With:") + ln_end_swap.operator( + "maplus.quicksmedestswaplinepoints", + text="Start" + ) + + ln_end_uppers_rightside = ln_end_uppers.row(align=True) + ln_end_uppers_rightside.alignment = 'RIGHT' + ln_end_uppers_rightside.label("Send:") + ln_end_uppers_rightside.operator( + "maplus.quicksmedestsendlineendtocursor", + icon='CURSOR', + text="" + ) + + ln_end_uppers_rightside.label("Grab:") + ln_end_uppers_rightside.operator( + "maplus.quicksmedestgrablineendfromcursor", + icon='CURSOR', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.quicksmedestgrablineendfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.quicksmedestgrablineendfromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_end.prop( + bpy.types.AnyType(addon_data.quick_scale_match_edge_dest), + 'line_end', + "" + ) + sme_apply_header = sme_gui.row() sme_apply_header.label("Apply to:") sme_apply_header.prop( From 66393deed4f95dc6e97b7fa9212b6067d3882d86 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Sat, 11 Feb 2017 09:22:30 -0500 Subject: [PATCH 07/56] Added geometry editing on Directional Slide. --- mesh_mesh_align_plus.py | 411 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 407 insertions(+), 4 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 198cd48..cecd2d6 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -402,6 +402,13 @@ class MAPlusData(bpy.types.PropertyGroup): ), default=True ) + quick_ds_show_src_geom = bpy.props.BoolProperty( + description=( + "Expand/collapse the source geometry editor" + " in the quick tools panel." + ), + default=False + ) quick_directional_slide_auto_grab_src = bpy.props.BoolProperty( description=( "Automatically grab source line from selected geometry" @@ -954,6 +961,14 @@ class ShowHideQuickAxrSrcGeom(ShowHideQuickGeomBaseClass): quick_op_target = 'AXRSRC' +class ShowHideQuickDsSrcGeom(ShowHideQuickGeomBaseClass): + bl_idname = "maplus.showhidequickdssrcgeom" + bl_label = "Show/hide quick directional slide source geometry" + bl_description = "Show/hide quick directional slide source geometry" + bl_options = {'REGISTER', 'UNDO'} + quick_op_target = 'DSSRC' + + class ShowHideQuickSmeSrcGeom(ShowHideQuickGeomBaseClass): bl_idname = "maplus.showhidequicksmesrcgeom" bl_label = "Show/hide quick scale match edge source geometry" @@ -1626,6 +1641,24 @@ class QuickAxrSrcGrabLineStartFromCursor(GrabFromCursorBase): quick_op_target = 'AXRSRC' +class QuickDsSrcGrabLineStartFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickdssrcgrablinestartfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_start' + quick_op_target = 'DSSRC' + + +class QuickDsDestGrabLineStartFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickdsdestgrablinestartfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_start' + quick_op_target = 'DSDEST' + + class QuickSmeSrcGrabLineStartFromCursor(GrabFromCursorBase): bl_idname = "maplus.quicksmesrcgrablinestartfromcursor" bl_label = "Grab Line Start From Cursor" @@ -1746,6 +1779,58 @@ class QuickAxrSrcGrabLineStartFromActiveGlobal(GrabFromGeometryBase): quick_op_target = 'AXRSRC' +class QuickDsSrcGrabLineStartFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickdssrcgrablinestartfromactivelocal" + bl_label = "Grab Local Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs local coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = False + quick_op_target = 'DSSRC' + + +class QuickDsSrcGrabLineStartFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickdssrcgrablinestartfromactiveglobal" + bl_label = "Grab Global Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs global coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = 'DSSRC' + + +class QuickDsDestGrabLineStartFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickdsdestgrablinestartfromactivelocal" + bl_label = "Grab Local Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs local coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = False + quick_op_target = 'DSDEST' + + +class QuickDsDestGrabLineStartFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickdsdestgrablinestartfromactiveglobal" + bl_label = "Grab Global Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs global coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = 'DSDEST' + + class QuickSmeSrcGrabLineStartFromActiveLocal(GrabFromGeometryBase): bl_idname = "maplus.quicksmesrcgrablinestartfromactivelocal" bl_label = "Grab Local Coordinate for Line Start From Active Point" @@ -1833,6 +1918,24 @@ class QuickAxrSrcSendLineStartToCursor(SendCoordToCursorBase): quick_op_target = 'AXRSRC' +class QuickDsSrcSendLineStartToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickdssrcsendlinestarttocursor" + bl_label = "Sends Line Start to Cursor" + bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_start' + quick_op_target = 'DSSRC' + + +class QuickDsDestSendLineStartToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickdsdestsendlinestarttocursor" + bl_label = "Sends Line Start to Cursor" + bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_start' + quick_op_target = 'DSDEST' + + class QuickSmeSrcSendLineStartToCursor(SendCoordToCursorBase): bl_idname = "maplus.quicksmesrcsendlinestarttocursor" bl_label = "Sends Line Start to Cursor" @@ -1886,6 +1989,24 @@ class QuickAxrSrcGrabLineEndFromCursor(GrabFromCursorBase): quick_op_target = 'AXRSRC' +class QuickDsSrcGrabLineEndFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickdssrcgrablineendfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_end' + quick_op_target = 'DSSRC' + + +class QuickDsDestGrabLineEndFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickdsdestgrablineendfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_end' + quick_op_target = 'DSDEST' + + class QuickSmeSrcGrabLineEndFromCursor(GrabFromCursorBase): bl_idname = "maplus.quicksmesrcgrablineendfromcursor" bl_label = "Grab Line End From Cursor" @@ -2002,6 +2123,58 @@ class QuickAxrSrcGrabLineEndFromActiveLocal(GrabFromGeometryBase): quick_op_target = 'AXRSRC' +class QuickDsSrcGrabLineEndFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickdssrcgrablineendfromactivelocal" + bl_label = "Grab Local Coordinate for Line End From Active Point" + bl_description = ( + "Grabs local coordinates for line end from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = False + quick_op_target = 'DSSRC' + + +class QuickDsSrcGrabLineEndFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickdssrcgrablineendfromactiveglobal" + bl_label = "Grab Global Coordinate for Line End From Active Point" + bl_description = ( + "Grabs global coordinates for line end from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = 'DSSRC' + + +class QuickDsDestGrabLineEndFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickdsdestgrablineendfromactivelocal" + bl_label = "Grab Local Coordinate for Line End From Active Point" + bl_description = ( + "Grabs local coordinates for line end from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = False + quick_op_target = 'DSDEST' + + +class QuickDsDestGrabLineEndFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickdsdestgrablineendfromactiveglobal" + bl_label = "Grab Global Coordinate for Line End From Active Point" + bl_description = ( + "Grabs global coordinates for line end from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = 'DSDEST' + + class QuickSmeSrcGrabLineEndFromActiveLocal(GrabFromGeometryBase): bl_idname = "maplus.quicksmesrcgrablineendfromactivelocal" bl_label = "Grab Local Coordinate for Line End From Active Point" @@ -2089,6 +2262,24 @@ class QuickAxrSrcSendLineEndToCursor(SendCoordToCursorBase): quick_op_target = 'AXRSRC' +class QuickDsSrcSendLineEndToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickdssrcsendlineendtocursor" + bl_label = "Sends Line End to Cursor" + bl_description = "Sends Line End Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_end' + quick_op_target = 'DSSRC' + + +class QuickDsDestSendLineEndToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickdsdestsendlineendtocursor" + bl_label = "Sends Line End to Cursor" + bl_description = "Sends Line End Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_end' + quick_op_target = 'DSDEST' + + class QuickSmeSrcSendLineEndToCursor(SendCoordToCursorBase): bl_idname = "maplus.quicksmesrcsendlineendtocursor" bl_label = "Sends Line End to Cursor" @@ -2261,6 +2452,18 @@ class QuickDirectionalSlideGrabSrc(GrabFromGeometryBase): quick_op_target = "DSSRC" +class QuickDirectionalSlideGrabSrcLoc(GrabFromGeometryBase): + bl_idname = "maplus.quickdirectionalslidegrabsrcloc" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = False + quick_op_target = "DSSRC" + + class GrabPlaneAFromCursor(GrabFromCursorBase): bl_idname = "maplus.grabplaneafromcursor" bl_label = "Grab From Cursor" @@ -2794,6 +2997,15 @@ class QuickAxrSrcSwapLinePoints(SwapPointsBase): quick_op_target = 'AXRSRC' +class QuickDsSrcSwapLinePoints(SwapPointsBase): + bl_idname = "maplus.quickdssrcswaplinepoints" + bl_label = "Swap Line Points" + bl_description = "Swap line points" + bl_options = {'REGISTER', 'UNDO'} + targets = ('line_start', 'line_end') + quick_op_target = 'DSSRC' + + class QuickSmeSrcSwapLinePoints(SwapPointsBase): bl_idname = "maplus.quicksmesrcswaplinepoints" bl_label = "Swap Line Points" @@ -8510,7 +8722,7 @@ def draw(self, context): # "maplus.oneotherplanepointcz", # text="11Z" # ) - if addon_data.quick_aln_show_src_geom: + if addon_data.quick_axr_show_src_geom: axr_grab_col.separator() axr_gui.label("Operator settings:") @@ -8570,12 +8782,203 @@ def draw(self, context): 'quick_directional_slide_auto_grab_src', 'Auto Grab Source from Selected Vertices' ) + + ds_src_geom_top = ds_grab_col.row() if not addon_data.quick_directional_slide_auto_grab_src: - ds_grab_col.operator( + if not addon_data.quick_ds_show_src_geom: + ds_src_geom_top.operator( + "maplus.showhidequickdssrcgeom", + icon='TRIA_RIGHT', + text="", + emboss=False + ) + ds_src_geom_top.operator( + "maplus.quickdirectionalslidegrabsrc", + icon='WORLD', + text="Grab Source" + ) + else: + ds_src_geom_top.operator( + "maplus.showhidequickdssrcgeom", + icon='TRIA_DOWN', + text="", + emboss=False + ) + ds_src_geom_top.label("Source Coordinates") + + ds_src_geom_editor = ds_grab_col.box() + ln_grab_all = ds_src_geom_editor.row(align=True) + ln_grab_all.operator( + "maplus.quickdirectionalslidegrabsrcloc", + icon='VERTEXSEL', + text="Grab All Local" + ) + ln_grab_all.operator( "maplus.quickdirectionalslidegrabsrc", icon='WORLD', - text="Grab Source" - ) + text="Grab All Global" + ) + + ds_src_geom_editor.label("Start:") + # plane_a_items = ds_src_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_start_items = ds_src_geom_editor.row() + typein_and_grab_start = ln_start_items.column() + ln_start_uppers = typein_and_grab_start.split(percentage=.33) + + ln_start_swap = ln_start_uppers.row(align=True) + ln_start_swap.label("Swap With:") + ln_start_swap.operator( + "maplus.quickdssrcswaplinepoints", + text="End" + ) + + ln_start_uppers_rightside = ln_start_uppers.row(align=True) + ln_start_uppers_rightside.alignment = 'RIGHT' + ln_start_uppers_rightside.label("Send:") + ln_start_uppers_rightside.operator( + "maplus.quickdssrcsendlinestarttocursor", + icon='CURSOR', + text="" + ) + + ln_start_uppers_rightside.label("Grab:") + ln_start_uppers_rightside.operator( + "maplus.quickdssrcgrablinestartfromcursor", + icon='CURSOR', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.quickdssrcgrablinestartfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.quickdssrcgrablinestartfromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_start.prop( + bpy.types.AnyType(addon_data.quick_directional_slide_src), + 'line_start', + "" + ) + + # component_changers_plna = plane_a_items.row() + # zero_components_plna = component_changers_plna.column( + # align=True + # ) + # zero_components_plna.label("Set Zeroes:") + # zero_components_plna.operator( + # "maplus.zerootherplanepointax", + # text="X00" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointay", + # text="0Y0" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointaz", + # text="00Z" + # ) + # one_components_plna = component_changers_plna.column( + # align=True + # ) + # one_components_plna.label("Set Ones:") + # one_components_plna.operator( + # "maplus.oneotherplanepointax", + # text="X11" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointay", + # text="1Y1" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointaz", + # text="11Z" + # ) + + ds_src_geom_editor.label("End:") + # plane_a_items = ds_src_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_end_items = ds_src_geom_editor.row() + typein_and_grab_end = ln_end_items.column() + ln_end_uppers = typein_and_grab_end.split(percentage=.33) + + ln_end_swap = ln_end_uppers.row(align=True) + ln_end_swap.label("Swap With:") + ln_end_swap.operator( + "maplus.quickdssrcswaplinepoints", + text="Start" + ) + + ln_end_uppers_rightside = ln_end_uppers.row(align=True) + ln_end_uppers_rightside.alignment = 'RIGHT' + ln_end_uppers_rightside.label("Send:") + ln_end_uppers_rightside.operator( + "maplus.quickdssrcsendlineendtocursor", + icon='CURSOR', + text="" + ) + + ln_end_uppers_rightside.label("Grab:") + ln_end_uppers_rightside.operator( + "maplus.quickdssrcgrablineendfromcursor", + icon='CURSOR', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.quickdssrcgrablineendfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.quickdssrcgrablineendfromactiveglobal", + icon='WORLD', + text="" + ) + typein_and_grab_end.prop( + bpy.types.AnyType(addon_data.quick_directional_slide_src), + 'line_end', + "" + ) + + # component_changers_plnc = plane_c_items.row() + # zero_components_plnc = component_changers_plnc.column( + # align=True + # ) + # zero_components_plnc.label("Set Zeroes:") + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcx", + # text="X00" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcy", + # text="0Y0" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcz", + # text="00Z" + # ) + # one_components_plnc = component_changers_plnc.column( + # align=True + # ) + # one_components_plnc.label("Set Ones:") + # one_components_plnc.operator( + # "maplus.oneotherplanepointcx", + # text="X11" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcy", + # text="1Y1" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcz", + # text="11Z" + # ) + if addon_data.quick_ds_show_src_geom: + ds_grab_col.separator() + ds_gui.label("Operator settings:") ds_mods = ds_gui.box() ds_box_row1 = ds_mods.row() From 86b0fb4d9c38467209029394819a923b603a1dc7 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Tue, 21 Feb 2017 21:33:55 -0500 Subject: [PATCH 08/56] Added initial average vert position grabbing for Quick Tools geometry. --- mesh_mesh_align_plus.py | 443 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 443 insertions(+) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index cecd2d6..1a85c03 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -1306,6 +1306,40 @@ def return_selected_verts(mesh_object, raise NonMeshGrabError(mesh_object) +def return_avg_vert_pos(mesh_object, + global_matrix_multiplier=None): + if type(mesh_object.data) == bpy.types.Mesh: + + # Todo, check for a better way to handle/if this is needed + bpy.ops.object.editmode_toggle() + bpy.ops.object.editmode_toggle() + + # Init source mesh + src_mesh = bmesh.new() + src_mesh.from_mesh(mesh_object.data) + + selection = [] + vert_indices = [] + for vert in (v for v in src_mesh.verts if v.select): + coords = vert.co + if global_matrix_multiplier: + coords = global_matrix_multiplier * coords + if not (vert.index in vert_indices): + vert_indices.append(vert.index) + selection.append(coords) + + if len(selection) > 0: + average_position = mathutils.Vector((0, 0, 0)) + for item in selection: + average_position += item + average_position /= len(selection) + return [average_position] + else: + raise NotEnoughVertsError() + else: + raise NonMeshGrabError(mesh_object) + + def set_item_coords(item, coords_to_set, coords): target_data = collections.OrderedDict( zip(coords_to_set, coords) @@ -1387,6 +1421,75 @@ def execute(self, context): return {'FINISHED'} +class GrabAverageLocationBase(bpy.types.Operator): + bl_idname = "maplus.grabaveragelocationbase" + bl_label = "Grab Average Location Base Class" + bl_description = ( + "The base class for grabbing average point coords from mesh verts." + ) + bl_options = {'REGISTER', 'UNDO'} + # For grabbing global coords + multiply_by_world_matrix = None + # A tuple of attribute names (strings) that should be set on the maplus + # primitive (point, line or plane item). The length of this tuple + # determines how many verts will be grabbed. + vert_attribs_to_set = None + + def execute(self, context): + addon_data = bpy.context.scene.maplus_data + prims = addon_data.prim_list + if not hasattr(self, "quick_op_target"): + active_item = prims[addon_data.active_list_item] + else: + if self.quick_op_target == "APTSRC": + active_item = addon_data.quick_align_pts_src + elif self.quick_op_target == "APTDEST": + active_item = addon_data.quick_align_pts_dest + + elif self.quick_op_target == "DSSRC": + active_item = addon_data.quick_directional_slide_src + + elif self.quick_op_target == "SMESRC": + active_item = addon_data.quick_scale_match_edge_src + elif self.quick_op_target == "SMEDEST": + active_item = addon_data.quick_scale_match_edge_dest + + elif self.quick_op_target == "ALNSRC": + active_item = addon_data.quick_align_lines_src + elif self.quick_op_target == "ALNDEST": + active_item = addon_data.quick_align_lines_dest + + elif self.quick_op_target == "AXRSRC": + active_item = addon_data.quick_axis_rotate_src + + elif self.quick_op_target == "APLSRC": + active_item = addon_data.quick_align_planes_src + elif self.quick_op_target == "APLDEST": + active_item = addon_data.quick_align_planes_dest + + matrix_multiplier = None + if self.multiply_by_world_matrix: + matrix_multiplier = bpy.context.active_object.matrix_world + try: + vert_data = return_avg_vert_pos( + bpy.context.active_object, + matrix_multiplier + ) + except NotEnoughVertsError: + self.report({'ERROR'}, 'Not enough vertices selected.') + return {'CANCELLED'} + except NonMeshGrabError: + self.report( + {'ERROR'}, + 'Cannot grab coords: non-mesh or no active object.' + ) + return {'CANCELLED'} + + set_item_coords(active_item, self.vert_attribs_to_set, vert_data) + + return {'FINISHED'} + + # Coordinate grabber, present on all geometry primitives (point, line, plane) class GrabFromCursorBase(bpy.types.Operator): bl_idname = "maplus.grabfromcursorbase" @@ -1532,6 +1635,30 @@ class GrabPointFromActiveGlobal(GrabFromGeometryBase): multiply_by_world_matrix = True +class QuickAptGrabAvgSrc(GrabAverageLocationBase): + bl_idname = "maplus.quickaptgrabavgsrc" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('point',) + multiply_by_world_matrix = True + quick_op_target = "APTSRC" + + +class QuickAptGrabAvgDest(GrabAverageLocationBase): + bl_idname = "maplus.quickaptgrabavgdest" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('point',) + multiply_by_world_matrix = True + quick_op_target = "APTDEST" + + class QuickAlignPointsGrabSrc(GrabFromGeometryBase): bl_idname = "maplus.quickalignpointsgrabsrc" bl_label = "Grab Global Coordinates From Active Point" @@ -1701,6 +1828,150 @@ class GrabLineStartFromActiveGlobal(GrabFromGeometryBase): multiply_by_world_matrix = True +class QuickAlnGrabAvgSrcLineStart(GrabAverageLocationBase): + bl_idname = "maplus.quickalngrabavgsrclinestart" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = "ALNSRC" + + +class QuickAlnGrabAvgDestLineStart(GrabAverageLocationBase): + bl_idname = "maplus.quickalngrabavgdestlinestart" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = "ALNDEST" + + +class QuickAlnGrabAvgSrcLineEnd(GrabAverageLocationBase): + bl_idname = "maplus.quickalngrabavgsrclineend" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = "ALNSRC" + + +class QuickAlnGrabAvgDestLineEnd(GrabAverageLocationBase): + bl_idname = "maplus.quickalngrabavgdestlineend" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = "ALNDEST" + + +class QuickAxrGrabAvgSrcLineStart(GrabAverageLocationBase): + bl_idname = "maplus.quickaxrgrabavgsrclinestart" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = "AXRSRC" + + +class QuickAxrGrabAvgSrcLineEnd(GrabAverageLocationBase): + bl_idname = "maplus.quickaxrgrabavgsrclineend" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = "AXRSRC" + + +class QuickDsGrabAvgSrcLineStart(GrabAverageLocationBase): + bl_idname = "maplus.quickdsgrabavgsrclinestart" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = "DSSRC" + + +class QuickDsGrabAvgSrcLineEnd(GrabAverageLocationBase): + bl_idname = "maplus.quickdsgrabavgsrclineend" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = "DSSRC" + + +class QuickSmeGrabAvgSrcLineStart(GrabAverageLocationBase): + bl_idname = "maplus.quicksmegrabavgsrclinestart" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = "SMESRC" + + +class QuickSmeGrabAvgDestLineStart(GrabAverageLocationBase): + bl_idname = "maplus.quicksmegrabavgdestlinestart" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = "SMEDEST" + + +class QuickSmeGrabAvgSrcLineEnd(GrabAverageLocationBase): + bl_idname = "maplus.quicksmegrabavgsrclineend" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = "SMESRC" + + +class QuickSmeGrabAvgDestLineEnd(GrabAverageLocationBase): + bl_idname = "maplus.quicksmegrabavgdestlineend" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = "SMEDEST" + + class QuickAlnSrcGrabLineStartFromActiveLocal(GrabFromGeometryBase): bl_idname = "maplus.quickalnsrcgrablinestartfromactivelocal" bl_label = "Grab Local Coordinate for Line Start From Active Point" @@ -2512,6 +2783,30 @@ class GrabPlaneAFromActiveGlobal(GrabFromGeometryBase): multiply_by_world_matrix = True +class QuickAplGrabAvgSrcPlaneA(GrabAverageLocationBase): + bl_idname = "maplus.quickaplgrabavgsrcplanea" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a',) + multiply_by_world_matrix = True + quick_op_target = "APLSRC" + + +class QuickAplGrabAvgDestPlaneA(GrabAverageLocationBase): + bl_idname = "maplus.quickaplgrabavgdestplanea" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a',) + multiply_by_world_matrix = True + quick_op_target = "APLDEST" + + class QuickAplSrcGrabPlaneAFromActiveLocal(GrabFromGeometryBase): bl_idname = "maplus.quickaplsrcgrabplaneafromactivelocal" bl_label = "Grab Local Coordinates From Active Point" @@ -2634,6 +2929,30 @@ class GrabPlaneBFromActiveGlobal(GrabFromGeometryBase): multiply_by_world_matrix = True +class QuickAplGrabAvgSrcPlaneB(GrabAverageLocationBase): + bl_idname = "maplus.quickaplgrabavgsrcplaneb" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = True + quick_op_target = "APLSRC" + + +class QuickAplGrabAvgDestPlaneB(GrabAverageLocationBase): + bl_idname = "maplus.quickaplgrabavgdestplaneb" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = True + quick_op_target = "APLDEST" + + class QuickAplSrcGrabPlaneBFromActiveLocal(GrabFromGeometryBase): bl_idname = "maplus.quickaplsrcgrabplanebfromactivelocal" bl_label = "Grab Local Coordinates From Active Point" @@ -2756,6 +3075,30 @@ class GrabPlaneCFromActiveGlobal(GrabFromGeometryBase): multiply_by_world_matrix = True +class QuickAplGrabAvgSrcPlaneC(GrabAverageLocationBase): + bl_idname = "maplus.quickaplgrabavgsrcplanec" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = True + quick_op_target = "APLSRC" + + +class QuickAplGrabAvgDestPlaneC(GrabAverageLocationBase): + bl_idname = "maplus.quickaplgrabavgdestplanec" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = True + quick_op_target = "APLDEST" + + class QuickAplSrcGrabPlaneCFromActiveLocal(GrabFromGeometryBase): bl_idname = "maplus.quickaplsrcgrabplanecfromactivelocal" bl_label = "Grab Local Coordinates From Active Point" @@ -7269,6 +7612,11 @@ def draw(self, context): icon='WORLD', text="" ) + pt_uppers_rightside.operator( + "maplus.quickaptgrabavgsrc", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_pt.prop( bpy.types.AnyType(addon_data.quick_align_pts_src), 'point', @@ -7380,6 +7728,11 @@ def draw(self, context): icon='WORLD', text="" ) + pt_uppers_rightside.operator( + "maplus.quickaptgrabavgdest", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_pt.prop( bpy.types.AnyType(addon_data.quick_align_pts_dest), 'point', @@ -7532,6 +7885,11 @@ def draw(self, context): icon='WORLD', text="" ) + ln_start_uppers_rightside.operator( + "maplus.quickalngrabavgsrclinestart", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_start.prop( bpy.types.AnyType(addon_data.quick_align_lines_src), 'line_start', @@ -7612,6 +7970,11 @@ def draw(self, context): icon='WORLD', text="" ) + ln_end_uppers_rightside.operator( + "maplus.quickalngrabavgsrclineend", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_end.prop( bpy.types.AnyType(addon_data.quick_align_lines_src), 'line_end', @@ -7735,6 +8098,11 @@ def draw(self, context): icon='WORLD', text="" ) + ln_start_uppers_rightside.operator( + "maplus.quickalngrabavgdestlinestart", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_start.prop( bpy.types.AnyType(addon_data.quick_align_lines_dest), 'line_start', @@ -7814,6 +8182,11 @@ def draw(self, context): icon='WORLD', text="" ) + ln_end_uppers_rightside.operator( + "maplus.quickalngrabavgdestlineend", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_end.prop( bpy.types.AnyType(addon_data.quick_align_lines_dest), 'line_end', @@ -7964,6 +8337,11 @@ def draw(self, context): icon='WORLD', text="" ) + plane_a_uppers_rightside.operator( + "maplus.quickaplgrabavgsrcplanea", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_plna.prop( bpy.types.AnyType(addon_data.quick_align_planes_src), 'plane_pt_a', @@ -8046,6 +8424,11 @@ def draw(self, context): icon='WORLD', text="" ) + plane_b_uppers_rightside.operator( + "maplus.quickaplgrabavgsrcplaneb", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_plnb.prop( bpy.types.AnyType(addon_data.quick_align_planes_src), 'plane_pt_b', @@ -8128,6 +8511,11 @@ def draw(self, context): icon='WORLD', text="" ) + plane_c_uppers_rightside.operator( + "maplus.quickaplgrabavgsrcplanec", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_plnc.prop( bpy.types.AnyType(addon_data.quick_align_planes_src), 'plane_pt_c', @@ -8255,6 +8643,11 @@ def draw(self, context): icon='WORLD', text="" ) + plane_a_uppers_rightside.operator( + "maplus.quickaplgrabavgdestplanea", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_plna.prop( bpy.types.AnyType(addon_data.quick_align_planes_dest), 'plane_pt_a', @@ -8337,6 +8730,11 @@ def draw(self, context): icon='WORLD', text="" ) + plane_b_uppers_rightside.operator( + "maplus.quickaplgrabavgdestplaneb", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_plnb.prop( bpy.types.AnyType(addon_data.quick_align_planes_dest), 'plane_pt_b', @@ -8419,6 +8817,11 @@ def draw(self, context): icon='WORLD', text="" ) + plane_c_uppers_rightside.operator( + "maplus.quickaplgrabavgdestplanec", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_plnc.prop( bpy.types.AnyType(addon_data.quick_align_planes_dest), 'plane_pt_c', @@ -8604,6 +9007,11 @@ def draw(self, context): icon='WORLD', text="" ) + ln_start_uppers_rightside.operator( + "maplus.quickaxrgrabavgsrclinestart", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_start.prop( bpy.types.AnyType(addon_data.quick_axis_rotate_src), 'line_start', @@ -8683,6 +9091,11 @@ def draw(self, context): icon='WORLD', text="" ) + ln_end_uppers_rightside.operator( + "maplus.quickaxrgrabavgsrclineend", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_end.prop( bpy.types.AnyType(addon_data.quick_axis_rotate_src), 'line_end', @@ -8858,6 +9271,11 @@ def draw(self, context): icon='WORLD', text="" ) + ln_start_uppers_rightside.operator( + "maplus.quickdsgrabavgsrclinestart", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_start.prop( bpy.types.AnyType(addon_data.quick_directional_slide_src), 'line_start', @@ -8937,6 +9355,11 @@ def draw(self, context): icon='WORLD', text="" ) + ln_end_uppers_rightside.operator( + "maplus.quickdsgrabavgsrclineend", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_end.prop( bpy.types.AnyType(addon_data.quick_directional_slide_src), 'line_end', @@ -9123,6 +9546,11 @@ def draw(self, context): icon='WORLD', text="" ) + ln_start_uppers_rightside.operator( + "maplus.quicksmegrabavgsrclinestart", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_start.prop( bpy.types.AnyType(addon_data.quick_scale_match_edge_src), 'line_start', @@ -9202,6 +9630,11 @@ def draw(self, context): icon='WORLD', text="" ) + ln_end_uppers_rightside.operator( + "maplus.quicksmegrabavgsrclineend", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_end.prop( bpy.types.AnyType(addon_data.quick_scale_match_edge_src), 'line_end', @@ -9318,6 +9751,11 @@ def draw(self, context): icon='WORLD', text="" ) + ln_start_uppers_rightside.operator( + "maplus.quicksmegrabavgdestlinestart", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_start.prop( bpy.types.AnyType(addon_data.quick_scale_match_edge_dest), 'line_start', @@ -9397,6 +9835,11 @@ def draw(self, context): icon='WORLD', text="" ) + ln_end_uppers_rightside.operator( + "maplus.quicksmegrabavgdestlineend", + icon='GROUP_VERTEX', + text="" + ) typein_and_grab_end.prop( bpy.types.AnyType(addon_data.quick_scale_match_edge_dest), 'line_end', From 345ff563fe454082caa1f31c526659de7308454b Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Wed, 22 Feb 2017 16:34:57 -0500 Subject: [PATCH 09/56] Added initial normal grabbing on quick tools Line geometry. --- mesh_mesh_align_plus.py | 220 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index cecd2d6..6cbbbba 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -1306,6 +1306,59 @@ def return_selected_verts(mesh_object, raise NonMeshGrabError(mesh_object) +def return_normal_coords(mesh_object, + global_matrix_multiplier=None): + if type(mesh_object.data) == bpy.types.Mesh: + + # Todo, check for a better way to handle/if this is needed + bpy.ops.object.editmode_toggle() + bpy.ops.object.editmode_toggle() + + # Init source mesh + src_mesh = bmesh.new() + src_mesh.from_mesh(mesh_object.data) + src_mesh.select_history.validate() + + # Todo, make sure we're in face select mode + face_elems = [] + face_indices = [] + normal = [] + for element in src_mesh.select_history: + face_elems.append(element) + face_indices.append(element.index) + break + + for face in (f for f in src_mesh.faces if f.select): + if not (face.index in face_indices): + face_elems.append(face) + break + + if not face_elems: + # Todo, make proper exception or modify old + raise NotEnoughVertsError() + if global_matrix_multiplier: + face_normal_origin = ( + global_matrix_multiplier * + face_elems[0].calc_center_median() + ) + face_normal_endpoint = ( + global_matrix_multiplier * + (face_elems[0].calc_center_median() + face_elems[0].normal) + ) + else: + face_normal_origin = face_elems[0].calc_center_median() + face_normal_endpoint = face_normal_origin + face_elems[0].normal + + normal.extend( + [face_normal_origin, + face_normal_endpoint] + ) + return normal + + else: + raise NonMeshGrabError(mesh_object) + + def set_item_coords(item, coords_to_set, coords): target_data = collections.OrderedDict( zip(coords_to_set, coords) @@ -1387,6 +1440,65 @@ def execute(self, context): return {'FINISHED'} +class GrabNormalBase(bpy.types.Operator): + bl_idname = "maplus.grabnormalbase" + bl_label = "Grab Normal Base Class" + bl_description = ( + "The base class for grabbing normal coords from a selected face." + ) + bl_options = {'REGISTER', 'UNDO'} + # For grabbing global coords + multiply_by_world_matrix = None + # A tuple of attribute names (strings) that should be set on the maplus + # primitive (point, line or plane item). The length of this tuple + # determines how many verts will be grabbed. + vert_attribs_to_set = None + + def execute(self, context): + addon_data = bpy.context.scene.maplus_data + prims = addon_data.prim_list + if not hasattr(self, "quick_op_target"): + active_item = prims[addon_data.active_list_item] + else: + if self.quick_op_target == "DSSRC": + active_item = addon_data.quick_directional_slide_src + + elif self.quick_op_target == "SMESRC": + active_item = addon_data.quick_scale_match_edge_src + elif self.quick_op_target == "SMEDEST": + active_item = addon_data.quick_scale_match_edge_dest + + elif self.quick_op_target == "ALNSRC": + active_item = addon_data.quick_align_lines_src + elif self.quick_op_target == "ALNDEST": + active_item = addon_data.quick_align_lines_dest + + elif self.quick_op_target == "AXRSRC": + active_item = addon_data.quick_axis_rotate_src + + matrix_multiplier = None + if self.multiply_by_world_matrix: + matrix_multiplier = bpy.context.active_object.matrix_world + try: + vert_data = return_normal_coords( + bpy.context.active_object, + matrix_multiplier + ) + except NotEnoughVertsError: + self.report({'ERROR'}, 'Not enough vertices selected.') + return {'CANCELLED'} + except NonMeshGrabError: + self.report( + {'ERROR'}, + 'Cannot grab coords: non-mesh or no active object.' + ) + return {'CANCELLED'} + + set_item_coords(active_item, self.vert_attribs_to_set, vert_data) + + return {'FINISHED'} + + # Coordinate grabber, present on all geometry primitives (point, line, plane) class GrabFromCursorBase(bpy.types.Operator): bl_idname = "maplus.grabfromcursorbase" @@ -2320,6 +2432,78 @@ class GrabAllVertsLineGlobal(GrabFromGeometryBase): multiply_by_world_matrix = True +class QuickAlnGrabNormalSrc(GrabNormalBase): + bl_idname = "maplus.quickalngrabnormalsrc" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = True + quick_op_target = "ALNSRC" + + +class QuickAlnGrabNormalDest(GrabNormalBase): + bl_idname = "maplus.quickalngrabnormaldest" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = True + quick_op_target = "ALNDEST" + + +class QuickAxrGrabNormalSrc(GrabNormalBase): + bl_idname = "maplus.quickaxrgrabnormalsrc" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = True + quick_op_target = "AXRSRC" + + +class QuickDsGrabNormalSrc(GrabNormalBase): + bl_idname = "maplus.quickdsgrabnormalsrc" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = True + quick_op_target = "DSSRC" + + +class QuickSmeGrabNormalSrc(GrabNormalBase): + bl_idname = "maplus.quicksmegrabnormalsrc" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = True + quick_op_target = "SMESRC" + + +class QuickSmeGrabNormalDest(GrabNormalBase): + bl_idname = "maplus.quicksmegrabnormaldest" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = True + quick_op_target = "SMEDEST" + + class QuickAlignLinesGrabSrc(GrabFromGeometryBase): bl_idname = "maplus.quickalignlinesgrabsrc" bl_label = "Grab Line from Selected Verts" @@ -7492,6 +7676,12 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) + special_grabs = aln_src_geom_editor.row(align=True) + special_grabs.operator( + "maplus.quickalngrabnormalsrc", + icon='LAMP_HEMI', + text="Grab Normal" + ) aln_src_geom_editor.label("Start:") # plane_a_items = aln_src_geom_editor.split(percentage=.75) @@ -7695,6 +7885,12 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) + special_grabs = aln_dest_geom_editor.row(align=True) + special_grabs.operator( + "maplus.quickalngrabnormaldest", + icon='LAMP_HEMI', + text="Grab Normal" + ) aln_dest_geom_editor.label("Start:") # plane_a_items = aln_dest_geom_editor.split(percentage=.75) @@ -8564,6 +8760,12 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) + special_grabs = axr_src_geom_editor.row(align=True) + special_grabs.operator( + "maplus.quickaxrgrabnormalsrc", + icon='LAMP_HEMI', + text="Grab Normal" + ) axr_src_geom_editor.label("Start:") # plane_a_items = axr_src_geom_editor.split(percentage=.75) @@ -8818,6 +9020,12 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) + special_grabs = ds_src_geom_editor.row(align=True) + special_grabs.operator( + "maplus.quickdsgrabnormalsrc", + icon='LAMP_HEMI', + text="Grab Normal" + ) ds_src_geom_editor.label("Start:") # plane_a_items = ds_src_geom_editor.split(percentage=.75) @@ -9083,6 +9291,12 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) + special_grabs = sme_src_geom_editor.row(align=True) + special_grabs.operator( + "maplus.quicksmegrabnormalsrc", + icon='LAMP_HEMI', + text="Grab Normal" + ) sme_src_geom_editor.label("Start:") # plane_a_items = sme_src_geom_editor.split(percentage=.75) @@ -9278,6 +9492,12 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) + special_grabs = sme_dest_geom_editor.row(align=True) + special_grabs.operator( + "maplus.quicksmegrabnormaldest", + icon='LAMP_HEMI', + text="Grab Normal" + ) sme_dest_geom_editor.label("Start:") # plane_a_items = sme_dest_geom_editor.split(percentage=.75) From d88c240df4553d77284105bd0d25fb684a184160 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Wed, 22 Feb 2017 21:13:37 -0500 Subject: [PATCH 10/56] Added error checking to Grab Normal operator, minor cleanup. --- mesh_mesh_align_plus.py | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 6cbbbba..3033a1a 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -1178,7 +1178,7 @@ def execute(self, context): len(self.vert_attribs_to_set), bpy.context.active_object.matrix_world ) - except NotEnoughVertsError: + except InsufficientSelectionError: self.report({'ERROR'}, 'Not enough vertices selected.') return {'CANCELLED'} except NonMeshGrabError: @@ -1243,7 +1243,7 @@ class NonMeshGrabError(Exception): pass -class NotEnoughVertsError(Exception): +class InsufficientSelectionError(Exception): pass @@ -1301,7 +1301,7 @@ def return_selected_verts(mesh_object, if len(selection) == verts_to_grab: return selection else: - raise NotEnoughVertsError() + raise InsufficientSelectionError() else: raise NonMeshGrabError(mesh_object) @@ -1319,14 +1319,14 @@ def return_normal_coords(mesh_object, src_mesh.from_mesh(mesh_object.data) src_mesh.select_history.validate() - # Todo, make sure we're in face select mode face_elems = [] face_indices = [] normal = [] for element in src_mesh.select_history: - face_elems.append(element) - face_indices.append(element.index) - break + if type(element) == bmesh.types.BMFace: + face_elems.append(element) + face_indices.append(element.index) + break for face in (f for f in src_mesh.faces if f.select): if not (face.index in face_indices): @@ -1335,7 +1335,7 @@ def return_normal_coords(mesh_object, if not face_elems: # Todo, make proper exception or modify old - raise NotEnoughVertsError() + raise InsufficientSelectionError() if global_matrix_multiplier: face_normal_origin = ( global_matrix_multiplier * @@ -1425,7 +1425,7 @@ def execute(self, context): len(self.vert_attribs_to_set), matrix_multiplier ) - except NotEnoughVertsError: + except InsufficientSelectionError: self.report({'ERROR'}, 'Not enough vertices selected.') return {'CANCELLED'} except NonMeshGrabError: @@ -1484,8 +1484,11 @@ def execute(self, context): bpy.context.active_object, matrix_multiplier ) - except NotEnoughVertsError: - self.report({'ERROR'}, 'Not enough vertices selected.') + except InsufficientSelectionError: + self.report( + {'ERROR'}, + 'Select at least one face to grab a face normal.' + ) return {'CANCELLED'} except NonMeshGrabError: self.report( @@ -3809,7 +3812,7 @@ def execute(self, context): len(vert_attribs_to_set), bpy.context.active_object.matrix_world ) - except NotEnoughVertsError: + except InsufficientSelectionError: self.report({'ERROR'}, 'Not enough vertices selected.') return {'CANCELLED'} except NonMeshGrabError: @@ -4136,7 +4139,7 @@ def execute(self, context): len(vert_attribs_to_set), bpy.context.active_object.matrix_world ) - except NotEnoughVertsError: + except InsufficientSelectionError: self.report({'ERROR'}, 'Not enough vertices selected.') return {'CANCELLED'} except NonMeshGrabError: @@ -4403,7 +4406,7 @@ def execute(self, context): len(vert_attribs_to_set), bpy.context.active_object.matrix_world ) - except NotEnoughVertsError: + except InsufficientSelectionError: self.report({'ERROR'}, 'Not enough vertices selected.') return {'CANCELLED'} except NonMeshGrabError: @@ -4679,7 +4682,7 @@ def execute(self, context): len(vert_attribs_to_set), bpy.context.active_object.matrix_world ) - except NotEnoughVertsError: + except InsufficientSelectionError: self.report({'ERROR'}, 'Not enough vertices selected.') return {'CANCELLED'} except NonMeshGrabError: @@ -4977,7 +4980,7 @@ def execute(self, context): len(vert_attribs_to_set), bpy.context.active_object.matrix_world ) - except NotEnoughVertsError: + except InsufficientSelectionError: self.report({'ERROR'}, 'Not enough vertices selected.') return {'CANCELLED'} except NonMeshGrabError: @@ -5296,7 +5299,7 @@ def execute(self, context): len(vert_attribs_to_set), bpy.context.active_object.matrix_world ) - except NotEnoughVertsError: + except InsufficientSelectionError: self.report({'ERROR'}, 'Not enough vertices selected.') return {'CANCELLED'} except NonMeshGrabError: From 07b409b2eaed050015b14527e9eadc0a4905e6f3 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Thu, 23 Feb 2017 13:01:56 -0500 Subject: [PATCH 11/56] Minor UI improvements (fixed spacing b/w triangle/grab buttons). --- mesh_mesh_align_plus.py | 52 +++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index cecd2d6..e772b2c 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -7199,7 +7199,7 @@ def draw(self, context): 'Auto Grab Source from Selected Vertices' ) - apt_src_geom_top = apt_grab_col.row() + apt_src_geom_top = apt_grab_col.row(align=True) if not addon_data.quick_align_pts_auto_grab_src: if not addon_data.quick_apt_show_src_geom: apt_src_geom_top.operator( @@ -7208,11 +7208,13 @@ def draw(self, context): text="", emboss=False ) - apt_src_geom_top.operator( + preserve_button_roundedge = apt_src_geom_top.row() + preserve_button_roundedge.operator( "maplus.quickalignpointsgrabsrc", icon='WORLD', text="Grab Source" ) + else: apt_src_geom_top.operator( "maplus.showhidequickaptsrcgeom", @@ -7311,7 +7313,7 @@ def draw(self, context): if addon_data.quick_apt_show_src_geom: apt_grab_col.separator() - apt_dest_geom_top = apt_grab_col.row() + apt_dest_geom_top = apt_grab_col.row(align=True) if not addon_data.quick_apt_show_dest_geom: apt_dest_geom_top.operator( "maplus.showhidequickaptdestgeom", @@ -7319,11 +7321,13 @@ def draw(self, context): text="", emboss=False ) - apt_dest_geom_top.operator( + preserve_button_roundedge = apt_dest_geom_top.row() + preserve_button_roundedge.operator( "maplus.quickalignpointsgrabdest", icon='WORLD', text="Grab Destination" ) + else: apt_dest_geom_top.operator( "maplus.showhidequickaptdestgeom", @@ -7457,7 +7461,7 @@ def draw(self, context): 'Auto Grab Source from Selected Vertices' ) - aln_src_geom_top = aln_grab_col.row() + aln_src_geom_top = aln_grab_col.row(align=True) if not addon_data.quick_align_lines_auto_grab_src: if not addon_data.quick_aln_show_src_geom: aln_src_geom_top.operator( @@ -7466,7 +7470,8 @@ def draw(self, context): text="", emboss=False ) - aln_src_geom_top.operator( + preserve_button_roundedge = aln_src_geom_top.row() + preserve_button_roundedge.operator( "maplus.quickalignlinesgrabsrc", icon='WORLD', text="Grab Source" @@ -7661,7 +7666,7 @@ def draw(self, context): # text="Grab Destination" # ) - aln_dest_geom_top = aln_grab_col.row() + aln_dest_geom_top = aln_grab_col.row(align=True) if not addon_data.quick_aln_show_dest_geom: aln_dest_geom_top.operator( "maplus.showhidequickalndestgeom", @@ -7669,7 +7674,8 @@ def draw(self, context): text="", emboss=False ) - aln_dest_geom_top.operator( + preserve_button_roundedge = aln_dest_geom_top.row() + preserve_button_roundedge.operator( "maplus.quickalignlinesgrabdest", icon='WORLD', text="Grab Destination" @@ -7885,7 +7891,7 @@ def draw(self, context): 'Auto Grab Source from Selected Vertices' ) - apl_src_geom_top = apl_grab_col.row() + apl_src_geom_top = apl_grab_col.row(align=True) if not addon_data.quick_align_planes_auto_grab_src: if not addon_data.quick_apl_show_src_geom: apl_src_geom_top.operator( @@ -7894,7 +7900,8 @@ def draw(self, context): text="", emboss=False ) - apl_src_geom_top.operator( + preserve_button_roundedge = apl_src_geom_top.row() + preserve_button_roundedge.operator( "maplus.quickalignplanesgrabsrc", icon='WORLD', text="Grab Source" @@ -8177,7 +8184,7 @@ def draw(self, context): # text="Grab Destination" # ) - apl_dest_geom_top = apl_grab_col.row() + apl_dest_geom_top = apl_grab_col.row(align=True) if not addon_data.quick_apl_show_dest_geom: apl_dest_geom_top.operator( "maplus.showhidequickapldestgeom", @@ -8185,7 +8192,8 @@ def draw(self, context): text="", emboss=False ) - apl_dest_geom_top.operator( + preserve_button_roundedge = apl_dest_geom_top.row() + preserve_button_roundedge.operator( "maplus.quickalignplanesgrabdest", icon='WORLD', text="Grab Destination" @@ -8529,7 +8537,7 @@ def draw(self, context): 'Auto Grab Axis from Selected Vertices' ) - axr_src_geom_top = axr_grab_col.row() + axr_src_geom_top = axr_grab_col.row(align=True) if not addon_data.quick_axis_rotate_auto_grab_src: if not addon_data.quick_axr_show_src_geom: axr_src_geom_top.operator( @@ -8538,7 +8546,8 @@ def draw(self, context): text="", emboss=False ) - axr_src_geom_top.operator( + preserve_button_roundedge = axr_src_geom_top.row() + preserve_button_roundedge.operator( "maplus.quickaxisrotategrabsrc", icon='WORLD', text="Grab Axis" @@ -8783,7 +8792,7 @@ def draw(self, context): 'Auto Grab Source from Selected Vertices' ) - ds_src_geom_top = ds_grab_col.row() + ds_src_geom_top = ds_grab_col.row(align=True) if not addon_data.quick_directional_slide_auto_grab_src: if not addon_data.quick_ds_show_src_geom: ds_src_geom_top.operator( @@ -8792,7 +8801,8 @@ def draw(self, context): text="", emboss=False ) - ds_src_geom_top.operator( + preserve_button_roundedge = ds_src_geom_top.row() + preserve_button_roundedge.operator( "maplus.quickdirectionalslidegrabsrc", icon='WORLD', text="Grab Source" @@ -9048,7 +9058,7 @@ def draw(self, context): 'Auto Grab Source from Selected Vertices' ) - sme_src_geom_top = sme_grab_col.row() + sme_src_geom_top = sme_grab_col.row(align=True) if not addon_data.quick_scale_match_edge_auto_grab_src: if not addon_data.quick_sme_show_src_geom: sme_src_geom_top.operator( @@ -9057,7 +9067,8 @@ def draw(self, context): text="", emboss=False ) - sme_src_geom_top.operator( + preserve_button_roundedge = sme_src_geom_top.row() + preserve_button_roundedge.operator( "maplus.quickscalematchedgegrabsrc", icon='WORLD', text="Grab Source" @@ -9244,7 +9255,7 @@ def draw(self, context): if addon_data.quick_sme_show_src_geom: sme_grab_col.separator() - sme_dest_geom_top = sme_grab_col.row() + sme_dest_geom_top = sme_grab_col.row(align=True) if not addon_data.quick_sme_show_dest_geom: sme_dest_geom_top.operator( "maplus.showhidequicksmedestgeom", @@ -9252,7 +9263,8 @@ def draw(self, context): text="", emboss=False ) - sme_dest_geom_top.operator( + preserve_button_roundedge = sme_dest_geom_top.row() + preserve_button_roundedge.operator( "maplus.quickscalematchedgegrabdest", icon='WORLD', text="Grab Destination" From 19c3a898845cc98578169984301b1d95693af4c8 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Thu, 23 Feb 2017 14:15:09 -0500 Subject: [PATCH 12/56] Added top-level shortcuts to relevant quick tools. --- mesh_mesh_align_plus.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index fb94115..dceec6d 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -7663,6 +7663,11 @@ def draw(self, context): icon='WORLD', text="Grab Source" ) + preserve_button_roundedge.operator( + "maplus.quickalngrabnormalsrc", + icon='LAMP_HEMI', + text="" + ) else: aln_src_geom_top.operator( "maplus.showhidequickalnsrcgeom", @@ -7873,6 +7878,11 @@ def draw(self, context): icon='WORLD', text="Grab Destination" ) + preserve_button_roundedge.operator( + "maplus.quickalngrabnormaldest", + icon='LAMP_HEMI', + text="" + ) else: aln_dest_geom_top.operator( "maplus.showhidequickalndestgeom", @@ -8751,6 +8761,11 @@ def draw(self, context): icon='WORLD', text="Grab Axis" ) + preserve_button_roundedge.operator( + "maplus.quickaxrgrabnormalsrc", + icon='LAMP_HEMI', + text="" + ) else: axr_src_geom_top.operator( "maplus.showhidequickaxrsrcgeom", @@ -9012,6 +9027,11 @@ def draw(self, context): icon='WORLD', text="Grab Source" ) + preserve_button_roundedge.operator( + "maplus.quickdsgrabnormalsrc", + icon='LAMP_HEMI', + text="" + ) else: ds_src_geom_top.operator( "maplus.showhidequickdssrcgeom", From f57eb00783016e136b8e27e8dfdb901e66d0e034 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Thu, 23 Feb 2017 14:59:34 -0500 Subject: [PATCH 13/56] Corrected operator tooltips. --- mesh_mesh_align_plus.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index dceec6d..04bab28 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -2437,9 +2437,9 @@ class GrabAllVertsLineGlobal(GrabFromGeometryBase): class QuickAlnGrabNormalSrc(GrabNormalBase): bl_idname = "maplus.quickalngrabnormalsrc" - bl_label = "Grab Line from Selected Verts" + bl_label = "Grab Normal Coords from Selected Face" bl_description = ( - "Grabs line coordinates from selected vertices in edit mode" + "Grabs normal coordinates from selected face in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_start', 'line_end') @@ -2449,9 +2449,9 @@ class QuickAlnGrabNormalSrc(GrabNormalBase): class QuickAlnGrabNormalDest(GrabNormalBase): bl_idname = "maplus.quickalngrabnormaldest" - bl_label = "Grab Line from Selected Verts" + bl_label = "Grab Normal Coords from Selected Face" bl_description = ( - "Grabs line coordinates from selected vertices in edit mode" + "Grabs normal coordinates from selected face in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_start', 'line_end') @@ -2461,9 +2461,9 @@ class QuickAlnGrabNormalDest(GrabNormalBase): class QuickAxrGrabNormalSrc(GrabNormalBase): bl_idname = "maplus.quickaxrgrabnormalsrc" - bl_label = "Grab Line from Selected Verts" + bl_label = "Grab Normal Coords from Selected Face" bl_description = ( - "Grabs line coordinates from selected vertices in edit mode" + "Grabs normal coordinates from selected face in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_start', 'line_end') @@ -2473,9 +2473,9 @@ class QuickAxrGrabNormalSrc(GrabNormalBase): class QuickDsGrabNormalSrc(GrabNormalBase): bl_idname = "maplus.quickdsgrabnormalsrc" - bl_label = "Grab Line from Selected Verts" + bl_label = "Grab Normal Coords from Selected Face" bl_description = ( - "Grabs line coordinates from selected vertices in edit mode" + "Grabs normal coordinates from selected face in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_start', 'line_end') @@ -2485,9 +2485,9 @@ class QuickDsGrabNormalSrc(GrabNormalBase): class QuickSmeGrabNormalSrc(GrabNormalBase): bl_idname = "maplus.quicksmegrabnormalsrc" - bl_label = "Grab Line from Selected Verts" + bl_label = "Grab Normal Coords from Selected Face" bl_description = ( - "Grabs line coordinates from selected vertices in edit mode" + "Grabs normal coordinates from selected face in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_start', 'line_end') @@ -2497,9 +2497,9 @@ class QuickSmeGrabNormalSrc(GrabNormalBase): class QuickSmeGrabNormalDest(GrabNormalBase): bl_idname = "maplus.quicksmegrabnormaldest" - bl_label = "Grab Line from Selected Verts" + bl_label = "Grab Normal Coords from Selected Face" bl_description = ( - "Grabs line coordinates from selected vertices in edit mode" + "Grabs normal coordinates from selected face in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_start', 'line_end') From 3030c53645594b07d2b0ca335c40d513066f7279 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Wed, 8 Mar 2017 23:09:50 -0500 Subject: [PATCH 14/56] Added geometry modifiers to quick tools. 'Apply mods' not yet implemented. --- mesh_mesh_align_plus.py | 218 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 217 insertions(+), 1 deletion(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index e772b2c..58326b7 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -7214,7 +7214,7 @@ def draw(self, context): icon='WORLD', text="Grab Source" ) - + else: apt_src_geom_top.operator( "maplus.showhidequickaptsrcgeom", @@ -7237,6 +7237,33 @@ def draw(self, context): text="Grab All Global" ) + modifier_header = apt_src_geom_editor.row() + modifier_header.label("Point Modifiers:") + apply_mods = modifier_header.row() + apply_mods.alignment = 'RIGHT' + # apply_mods.operator( + # "maplus.applygeommodifiers", + # text="Apply ModifiersXXXXX" + # ) + item_mods_box = apt_src_geom_editor.box() + mods_row_1 = item_mods_box.row() + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_align_pts_src), + 'pt_make_unit_vec', + "Set Length Equal to One" + ) + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_align_pts_src), + 'pt_flip_direction', + "Flip Direction" + ) + mods_row_2 = item_mods_box.row() + mods_row_2.prop( + bpy.types.AnyType(addon_data.quick_align_pts_src), + 'pt_multiplier', + "Multiplier" + ) + apt_src_geom_editor.label("Pt. Origin:") # plane_a_items = apt_src_geom_editor.split(percentage=.75) # ^ line changed to remove component changers @@ -7349,6 +7376,33 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) + + modifier_header = apt_dest_geom_editor.row() + modifier_header.label("Point Modifiers:") + apply_mods = modifier_header.row() + apply_mods.alignment = 'RIGHT' + # apply_mods.operator( + # "maplus.applygeommodifiers", + # text="Apply ModifiersXXXXX" + # ) + item_mods_box = apt_dest_geom_editor.box() + mods_row_1 = item_mods_box.row() + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_align_pts_dest), + 'pt_make_unit_vec', + "Set Length Equal to One" + ) + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_align_pts_dest), + 'pt_flip_direction', + "Flip Direction" + ) + mods_row_2 = item_mods_box.row() + mods_row_2.prop( + bpy.types.AnyType(addon_data.quick_align_pts_dest), + 'pt_multiplier', + "Multiplier" + ) apt_dest_geom_editor.label("Pt. Origin:") # plane_a_items = apt_src_geom_editor.split(percentage=.75) @@ -7498,6 +7552,33 @@ def draw(self, context): text="Grab All Global" ) + modifier_header = aln_src_geom_editor.row() + modifier_header.label("Line Modifiers:") + apply_mods = modifier_header.row() + apply_mods.alignment = 'RIGHT' + # apply_mods.operator( + # "maplus.applygeommodifiers", + # text="Apply ModifiersXXXXX" + # ) + item_mods_box = aln_src_geom_editor.box() + mods_row_1 = item_mods_box.row() + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_align_lines_src), + 'ln_make_unit_vec', + "Set Length Equal to One" + ) + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_align_lines_src), + 'ln_flip_direction', + "Flip Direction" + ) + mods_row_2 = item_mods_box.row() + mods_row_2.prop( + bpy.types.AnyType(addon_data.quick_align_lines_src), + 'ln_multiplier', + "Multiplier" + ) + aln_src_geom_editor.label("Start:") # plane_a_items = aln_src_geom_editor.split(percentage=.75) # ^ line changed to remove component changers @@ -7701,6 +7782,33 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) + + modifier_header = aln_dest_geom_editor.row() + modifier_header.label("Line Modifiers:") + apply_mods = modifier_header.row() + apply_mods.alignment = 'RIGHT' + # apply_mods.operator( + # "maplus.applygeommodifiers", + # text="Apply ModifiersXXXXX" + # ) + item_mods_box = aln_dest_geom_editor.box() + mods_row_1 = item_mods_box.row() + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_align_lines_dest), + 'ln_make_unit_vec', + "Set Length Equal to One" + ) + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_align_lines_dest), + 'ln_flip_direction', + "Flip Direction" + ) + mods_row_2 = item_mods_box.row() + mods_row_2.prop( + bpy.types.AnyType(addon_data.quick_align_lines_dest), + 'ln_multiplier', + "Multiplier" + ) aln_dest_geom_editor.label("Start:") # plane_a_items = aln_dest_geom_editor.split(percentage=.75) @@ -8573,6 +8681,33 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) + + modifier_header = axr_src_geom_editor.row() + modifier_header.label("Line Modifiers:") + apply_mods = modifier_header.row() + apply_mods.alignment = 'RIGHT' + # apply_mods.operator( + # "maplus.applygeommodifiers", + # text="Apply ModifiersXXXXX" + # ) + item_mods_box = axr_src_geom_editor.box() + mods_row_1 = item_mods_box.row() + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_axis_rotate_src), + 'ln_make_unit_vec', + "Set Length Equal to One" + ) + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_axis_rotate_src), + 'ln_flip_direction', + "Flip Direction" + ) + mods_row_2 = item_mods_box.row() + mods_row_2.prop( + bpy.types.AnyType(addon_data.quick_axis_rotate_src), + 'ln_multiplier', + "Multiplier" + ) axr_src_geom_editor.label("Start:") # plane_a_items = axr_src_geom_editor.split(percentage=.75) @@ -8829,6 +8964,33 @@ def draw(self, context): text="Grab All Global" ) + modifier_header = ds_src_geom_editor.row() + modifier_header.label("Line Modifiers:") + apply_mods = modifier_header.row() + apply_mods.alignment = 'RIGHT' + # apply_mods.operator( + # "maplus.applygeommodifiers", + # text="Apply ModifiersXXXXX" + # ) + item_mods_box = ds_src_geom_editor.box() + mods_row_1 = item_mods_box.row() + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_directional_slide_src), + 'ln_make_unit_vec', + "Set Length Equal to One" + ) + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_directional_slide_src), + 'ln_flip_direction', + "Flip Direction" + ) + mods_row_2 = item_mods_box.row() + mods_row_2.prop( + bpy.types.AnyType(addon_data.quick_directional_slide_src), + 'ln_multiplier', + "Multiplier" + ) + ds_src_geom_editor.label("Start:") # plane_a_items = ds_src_geom_editor.split(percentage=.75) # ^ line changed to remove component changers @@ -9094,6 +9256,33 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) + + modifier_header = sme_src_geom_editor.row() + modifier_header.label("Line Modifiers:") + apply_mods = modifier_header.row() + apply_mods.alignment = 'RIGHT' + # apply_mods.operator( + # "maplus.applygeommodifiers", + # text="Apply ModifiersXXXXX" + # ) + item_mods_box = sme_src_geom_editor.box() + mods_row_1 = item_mods_box.row() + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_scale_match_edge_src), + 'ln_make_unit_vec', + "Set Length Equal to One" + ) + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_scale_match_edge_src), + 'ln_flip_direction', + "Flip Direction" + ) + mods_row_2 = item_mods_box.row() + mods_row_2.prop( + bpy.types.AnyType(addon_data.quick_scale_match_edge_src), + 'ln_multiplier', + "Multiplier" + ) sme_src_geom_editor.label("Start:") # plane_a_items = sme_src_geom_editor.split(percentage=.75) @@ -9291,6 +9480,33 @@ def draw(self, context): text="Grab All Global" ) + modifier_header = sme_dest_geom_editor.row() + modifier_header.label("Line Modifiers:") + apply_mods = modifier_header.row() + apply_mods.alignment = 'RIGHT' + # apply_mods.operator( + # "maplus.applygeommodifiers", + # text="Apply ModifiersXXXXX" + # ) + item_mods_box = sme_dest_geom_editor.box() + mods_row_1 = item_mods_box.row() + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_scale_match_edge_dest), + 'ln_make_unit_vec', + "Set Length Equal to One" + ) + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_scale_match_edge_dest), + 'ln_flip_direction', + "Flip Direction" + ) + mods_row_2 = item_mods_box.row() + mods_row_2.prop( + bpy.types.AnyType(addon_data.quick_scale_match_edge_dest), + 'ln_multiplier', + "Multiplier" + ) + sme_dest_geom_editor.label("Start:") # plane_a_items = sme_dest_geom_editor.split(percentage=.75) # ^ line changed to remove component changers From 4ad1d062b6091d0e68c732803bc01c2919280b6b Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Thu, 9 Mar 2017 10:18:46 -0500 Subject: [PATCH 15/56] Fixed minor merge errors (a few missing parens). --- mesh_mesh_align_plus.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index acceb59..7964747 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -8381,6 +8381,7 @@ def draw(self, context): bpy.types.AnyType(addon_data.quick_align_lines_dest), 'ln_multiplier', "Multiplier" + ) aln_dest_geom_editor.label("Start:") # plane_a_items = aln_dest_geom_editor.split(percentage=.75) @@ -9331,6 +9332,7 @@ def draw(self, context): bpy.types.AnyType(addon_data.quick_axis_rotate_src), 'ln_multiplier', "Multiplier" + ) axr_src_geom_editor.label("Start:") # plane_a_items = axr_src_geom_editor.split(percentage=.75) From 46e0e3c59ee63f9565066f26b4f7689f8ff04c8d Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Thu, 9 Mar 2017 16:17:04 -0500 Subject: [PATCH 16/56] Some initial work toward creating a copy/paste function. --- mesh_mesh_align_plus.py | 60 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 7964747..9f0e173 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -1079,6 +1079,66 @@ class AddNewTransformation(AddListItemBase): new_kind = "TRANSFORMATION" +def copy_source_attribs_to_dest(source, dest, set_attribs=None): + if set_attribs: + for att in set_attribs: + setattr(dest, att, getattr(source, att)) + + +class CopyToOtherBase(bpy.types.Operator): + bl_idname = "maplus.copytootherbase" + bl_label = "Copy to other" + bl_description = "Copies this item to a destination" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = None + + def execute(self, context): + addon_data = bpy.context.scene.maplus_data + prims = addon_data.prim_list + advanced_tools_active_item = prims[addon_data.active_list_item] + + string_to_target_mappings = { + 'APTSRC': addon_data.quick_align_points_source, + 'APTDEST': addon_data.quick_align_points_dest, + 'ALNSRC': addon_data.quick_align_lines_source, + 'ALNDEST': addon_data.quick_align_lines_dest, + 'APLSRC': addon_data.quick_align_planes_source, + 'APLDEST': addon_data.quick_align_planes_dest, + 'AXRSRC': addon_data.quick_axis_rotate_source, + 'DSSRC': addon_data.quick_directional_slide_source, + 'SMESRC': addon_data.scale_match_edge_source, + 'SMEDEST': addon_data.scale_match_edge_dest, + 'ADVTOOLSACTIVE': advanced_tools_active_item, + } + set_attribs = { + "POINT": ( + "point", + "pt_make_unit_vec", + "pt_flip_direction", + "pt_multiplier" + ), + "LINE": ( + "line_start", + "line_end", + "ln_make_unit_vec", + "ln_flip_direction", + "ln_multiplier" + ), + "PLANE": ( + "plane_pt_a", + "plane_pt_b", + "plane_pt_c" + ), + } + + source = string_to_target_mappings[self.source_dest_pair[0]] + dest = string_to_target_mappings[self.source_dest_pair[1]] + copy_source_attribs_to_dest(source, dest, set_attribs[source.kind]) + + return {'FINISHED'} + + class DuplicateItemBase(bpy.types.Operator): bl_idname = "maplus.duplicateitembase" bl_label = "Duplicate Item" From a9faa39a115aba66de11d1b4cbb1f19efb180bdf Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Tue, 14 Mar 2017 19:39:03 -0400 Subject: [PATCH 17/56] Added shortcuts to top level source/dest grab areas for Align Points. --- mesh_mesh_align_plus.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index e425e02..7322592 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -7557,7 +7557,12 @@ def draw(self, context): icon='WORLD', text="Grab Source" ) - + preserve_button_roundedge.operator( + "maplus.quickaptgrabavgsrc", + icon='GROUP_VERTEX', + text="" + ) + else: apt_src_geom_top.operator( "maplus.showhidequickaptsrcgeom", @@ -7675,6 +7680,11 @@ def draw(self, context): icon='WORLD', text="Grab Destination" ) + preserve_button_roundedge.operator( + "maplus.quickaptgrabavgdest", + icon='GROUP_VERTEX', + text="" + ) else: apt_dest_geom_top.operator( From 3f982ba3c396aaa8b82ce249016e46eddc3b6c9a Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Sun, 19 Mar 2017 15:26:57 -0400 Subject: [PATCH 18/56] Initial Calculate and Compose panel work. --- mesh_mesh_align_plus.py | 352 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 348 insertions(+), 4 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 7964747..f6395f9 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -556,6 +556,17 @@ class MAPlusData(bpy.types.PropertyGroup): ), default=True ) + + # Quick Calculation items + quick_calc_result_item = bpy.props.PointerProperty(type=MAPlusPrimitive) + internal_storage_slot_1 = bpy.props.PointerProperty(type=MAPlusPrimitive) + internal_storage_slot_2 = bpy.props.PointerProperty(type=MAPlusPrimitive) + quick_calc_result_to_clipboard = bpy.props.BoolProperty( + description=( + "Copy numeric calculations to clipboard" + ), + default=True + ) # Basic type selector functionality, derived classes provide @@ -1393,12 +1404,48 @@ def return_avg_vert_pos(mesh_object, raise NonMeshGrabError(mesh_object) +# For the ambiguous "internal storage slots", which can be any geom type in +# [POINT, LINE, PLANE]. Must return at least 1 selected vert (for a point). +def return_at_least_one_selected_vert(mesh_object, + global_matrix_multiplier=None): + if type(mesh_object.data) == bpy.types.Mesh: + + # Todo, check for a better way to handle/if this is needed + bpy.ops.object.editmode_toggle() + bpy.ops.object.editmode_toggle() + + # Init source mesh + src_mesh = bmesh.new() + src_mesh.from_mesh(mesh_object.data) + + selection = [] + vert_indices = [] + for vert in (v for v in src_mesh.verts if v.select): + if len(selection) == 3: + break + coords = vert.co + if global_matrix_multiplier: + coords = global_matrix_multiplier * coords + if not (vert.index in vert_indices): + vert_indices.append(vert.index) + selection.append(coords) + + print(selection) + if len(selection) > 0: + return selection + else: + raise InsufficientSelectionError() + else: + raise NonMeshGrabError(mesh_object) + + def set_item_coords(item, coords_to_set, coords): target_data = collections.OrderedDict( zip(coords_to_set, coords) ) for key, val in target_data.items(): setattr(item, key, val) + print('UMMM....') return True @@ -1474,6 +1521,70 @@ def execute(self, context): return {'FINISHED'} +class GrabAndSetItemKindBase(bpy.types.Operator): + bl_idname = "maplus.grabandsetitemkindbase" + bl_label = "Grab and Set Item Base Class" + bl_description = ( + "The base class for grabbing coords and setting item kind" + " based on the number of selected verts." + ) + bl_options = {'REGISTER', 'UNDO'} + # For grabbing global coords + multiply_by_world_matrix = None + # A tuple of attribute names (strings) that should be set on the maplus + # primitive (point, line or plane item). The length of this tuple + # determines how many verts will be grabbed. + vert_attribs_to_set = None + target = None + + def execute(self, context): + addon_data = bpy.context.scene.maplus_data + prims = addon_data.prim_list + + if self.target == "SLOT1": + active_item = addon_data.internal_storage_slot_1 + elif self.target == "SLOT2": + active_item = addon_data.internal_storage_slot_2 + + matrix_multiplier = None + if self.multiply_by_world_matrix: + matrix_multiplier = bpy.context.active_object.matrix_world + try: + vert_data = return_at_least_one_selected_vert( + bpy.context.active_object, + matrix_multiplier + ) + except InsufficientSelectionError: + self.report({'ERROR'}, 'Not enough vertices selected.') + return {'CANCELLED'} + except NonMeshGrabError: + self.report( + {'ERROR'}, + 'Cannot grab coords: non-mesh or no active object.' + ) + return {'CANCELLED'} + + if len(vert_data) == 1: + active_item.kind = 'POINT' + vert_attribs_to_set = ('point',) + print('A') + elif len(vert_data) == 2: + active_item.kind = 'LINE' + vert_attribs_to_set = ('line_start', 'line_end') + print('B') + elif len(vert_data) == 3: + print(active_item.kind) + active_item.kind = 'PLANE' + print(active_item.kind) + vert_attribs_to_set = ('plane_pt_a', 'plane_pt_b', 'plane_pt_c') + print('C') + + set_item_coords(active_item, vert_attribs_to_set, vert_data) + + print('YO') + return {'FINISHED'} + + class GrabAverageLocationBase(bpy.types.Operator): bl_idname = "maplus.grabaveragelocationbase" bl_label = "Grab Average Location Base Class" @@ -1702,6 +1813,28 @@ def execute(self, context): return {'FINISHED'} +class GrabAllSlot1(GrabAndSetItemKindBase): + bl_idname = "maplus.graballslot1" + bl_label = "Grab Global Coordinates From Selected Vertices" + bl_description = ( + "Grabs global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + multiply_by_world_matrix = True + target = 'SLOT1' + + +class GrabAllSlot2(GrabAndSetItemKindBase): + bl_idname = "maplus.graballslot2" + bl_label = "Grab Global Coordinates From Selected Vertices" + bl_description = ( + "Grabs global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + multiply_by_world_matrix = True + target = 'SLOT2' + + class GrabPointFromCursor(GrabFromCursorBase): bl_idname = "maplus.grabpointfromcursor" bl_label = "Grab From Cursor" @@ -6028,10 +6161,16 @@ class CalcLineLength(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list - active_item = prims[addon_data.active_list_item] - calc_target_item = prims[active_item.single_calc_target] + if hasattr(self, 'quick_calc_target'): + active_calculation = addon_data.quick_calc_result_item + result_attrib = 'single_calc_result' + calc_target_item = addon_data.internal_storage_slot_1 + else: + active_calculation = prims[addon_data.active_list_item] + result_attrib = 'single_calc_result' + calc_target_item = prims[active_calculation.single_calc_target] - if calc_target_item.kind != 'LINE': + if (not hasattr(self, 'quick_calc_target')) and calc_target_item.kind != 'LINE': self.report( {'ERROR'}, ('Wrong operand: "Calculate Line Length" can only operate on' @@ -6045,13 +6184,21 @@ def execute(self, context): ) src_line = src_global_data[1] - src_global_data[0] result = src_line.length - active_item.single_calc_result = result + setattr(active_calculation, result_attrib, result) if addon_data.calc_result_to_clipboard: bpy.context.window_manager.clipboard = str(result) return {'FINISHED'} +class QuickCalcLineLength(CalcLineLength): + bl_idname = "maplus.quickcalclinelength" + bl_label = "Calculate Line Length" + bl_description = "Calculates the length of the targeted line item" + bl_options = {'REGISTER', 'UNDO'} + quick_calc_target = True + + class CalcRotationalDiff(bpy.types.Operator): bl_idname = "maplus.calcrotationaldiff" bl_label = "Angle of Lines" @@ -10363,6 +10510,203 @@ def draw(self, context): ) +class CalculateAndComposeGUI(bpy.types.Panel): + bl_idname = "calculate_and_compose_gui" + bl_label = "Calculate and Compose" + bl_space_type = "VIEW_3D" + bl_region_type = "TOOLS" + bl_category = "Mesh Align Plus" + bl_options = {"DEFAULT_CLOSED"} + + def draw(self, context): + layout = self.layout + maplus_data_ptr = bpy.types.AnyType(bpy.context.scene.maplus_data) + addon_data = bpy.context.scene.maplus_data + + calc_gui = layout.column() + + calc_gui.operator( + "maplus.graballslot1", + icon='WORLD', + text="Grab Slot 1" + ) + calc_gui.operator( + "maplus.graballslot2", + icon='WORLD', + text="Grab Slot 2" + ) + calc_gui.separator() + + calcs_and_results_header = calc_gui.row() + calcs_and_results_header.label( + "Result:" + ) + clipboard_row_right = calcs_and_results_header.row() + clipboard_row_right.alignment = 'RIGHT' + clipboard_row_right.prop( + bpy.types.AnyType(maplus_data_ptr), + 'quick_calc_result_to_clipboard', + "Copy to Clipboard" + ) + calc_gui.prop( + bpy.types.AnyType(bpy.types.AnyType(addon_data.quick_calc_result_item)), + 'single_calc_result', + "" + ) + calc_gui.separator() + + calc_gui.operator( + "maplus.quickcalclinelength", + text="Line Length" + ) + + # slot1_geom_top = calc_gui.row(align=True) + # if not addon_data.quick_calc_show_slot1_geom: + # slot1_geom_top.operator( + # "maplus.showhidequickcalcslot1geom", + # icon='TRIA_RIGHT', + # text="", + # emboss=False + # ) + # preserve_button_roundedge = slot1_geom_top.row() + # preserve_button_roundedge.operator( + # "maplus.quickcalcgrabslot1", + # icon='WORLD', + # text="Grab Source" + # ) + + # else: + # slot1_geom_top.operator( + # "maplus.showhidequickcalcslot1geom", + # icon='TRIA_DOWN', + # text="", + # emboss=False + # ) + # slot1_geom_top.label("Slot 1 Coordinates") + + # if addon_data.quick_calc_result.kind == 'POINT': + # slot1_geom_editor = calc_gui.box() + # pt_grab_all = slot1_geom_editor.row(align=True) + # pt_grab_all.operator( + # "maplus.quickcalcgrabslot1loc", + # icon='VERTEXSEL', + # text="Grab All Local" + # ) + # pt_grab_all.operator( + # "maplus.quickcalcgrabslot1", + # icon='WORLD', + # text="Grab All Global" + # ) + + # modifier_header = slot1_geom_editor.row() + # modifier_header.label("Point Modifiers:") + # apply_mods = modifier_header.row() + # apply_mods.alignment = 'RIGHT' + # # apply_mods.operator( + # # "maplus.applygeommodifiers", + # # text="Apply ModifiersXXXXX" + # # ) + # item_mods_box = slot1_geom_editor.box() + # mods_row_1 = item_mods_box.row() + # mods_row_1.prop( + # bpy.types.AnyType(addon_data.internal_storage_slot_1), + # 'pt_make_unit_vec', + # "Set Length Equal to One" + # ) + # mods_row_1.prop( + # bpy.types.AnyType(addon_data.internal_storage_slot_1), + # 'pt_flip_direction', + # "Flip Direction" + # ) + # mods_row_2 = item_mods_box.row() + # mods_row_2.prop( + # bpy.types.AnyType(addon_data.internal_storage_slot_1), + # 'pt_multiplier', + # "Multiplier" + # ) + + # slot1_geom_editor.label("Pt. Origin:") + # # plane_a_items = slot1_geom_editor.split(percentage=.75) + # # ^ line changed to remove component changers + # pt_items = slot1_geom_editor.row() + # typein_and_grab_pt = pt_items.column() + # pt_uppers = typein_and_grab_pt.row() + + # pt_uppers_leftside = pt_uppers.row(align=True) + # pt_uppers_leftside.alignment = 'LEFT' + # pt_uppers_leftside.label("Send:") + # pt_uppers_leftside.operator( + # "maplus.quickcalcslot1sendpointtocursor", + # icon='CURSOR', + # text="" + # ) + + # pt_uppers_rightside = pt_uppers.row(align=True) + # pt_uppers_rightside.alignment = 'RIGHT' + # pt_uppers_rightside.label("Grab:") + # pt_uppers_rightside.operator( + # "maplus.quickcalcslot1grabpointfromcursor", + # icon='CURSOR', + # text="" + # ) + # pt_uppers_rightside.operator( + # "maplus.quickcalcgrabslot1loc", + # icon='VERTEXSEL', + # text="" + # ) + # pt_uppers_rightside.operator( + # "maplus.quickcalcgrabslot1", + # icon='WORLD', + # text="" + # ) + # pt_uppers_rightside.operator( + # "maplus.quickcalcgrabavgslot1", + # icon='GROUP_VERTEX', + # text="" + # ) + # typein_and_grab_pt.prop( + # bpy.types.AnyType(addon_data.internal_storage_slot_1), + # 'point', + # "" + # ) + + # # component_changers_plna = plane_a_items.row() + # # zero_components_plna = component_changers_plna.column( + # # align=True + # # ) + # # zero_components_plna.label("Set Zeroes:") + # # zero_components_plna.operator( + # # "maplus.zerootherplanepointax", + # # text="X00" + # # ) + # # zero_components_plna.operator( + # # "maplus.zerootherplanepointay", + # # text="0Y0" + # # ) + # # zero_components_plna.operator( + # # "maplus.zerootherplanepointaz", + # # text="00Z" + # # ) + # # one_components_plna = component_changers_plna.column( + # # align=True + # # ) + # # one_components_plna.label("Set Ones:") + # # one_components_plna.operator( + # # "maplus.oneotherplanepointax", + # # text="X11" + # # ) + # # one_components_plna.operator( + # # "maplus.oneotherplanepointay", + # # text="1Y1" + # # ) + # # one_components_plna.operator( + # # "maplus.oneotherplanepointaz", + # # text="11Z" + # # ) + # if addon_data.quick_apt_show_src_geom: + # calc_gui.separator() + + def specials_menu_items(self, context): self.layout.separator() self.layout.label('Add Mesh Align Plus items') From 93ab247e7e0b326c5c803f939921f1b17650b2ac Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Tue, 21 Mar 2017 14:35:04 -0400 Subject: [PATCH 19/56] Added another quick calculation, code restructuring. --- mesh_mesh_align_plus.py | 103 ++++++++++++++++++++++++++++++++-------- 1 file changed, 82 insertions(+), 21 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index f6395f9..84c6c50 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -559,6 +559,11 @@ class MAPlusData(bpy.types.PropertyGroup): # Quick Calculation items quick_calc_result_item = bpy.props.PointerProperty(type=MAPlusPrimitive) + quick_calc_result_numeric = bpy.props.FloatProperty( + description="Quick Calculation numeric result", + default=0, + precision=6 + ) internal_storage_slot_1 = bpy.props.PointerProperty(type=MAPlusPrimitive) internal_storage_slot_2 = bpy.props.PointerProperty(type=MAPlusPrimitive) quick_calc_result_to_clipboard = bpy.props.BoolProperty( @@ -1417,9 +1422,34 @@ def return_at_least_one_selected_vert(mesh_object, # Init source mesh src_mesh = bmesh.new() src_mesh.from_mesh(mesh_object.data) + src_mesh.select_history.validate() + + history_indices = [] + history_as_verts = [] + for element in src_mesh.select_history: + if len(history_as_verts) == 3: + break + if type(element) == bmesh.types.BMVert: + if not (element.index in history_indices): + history_as_verts.append(element) + else: + for item in element.verts: + if len(history_as_verts) == 3: + break + if not (item.index in history_indices): + history_as_verts.append(item) selection = [] vert_indices = [] + for vert in history_as_verts: + if len(selection) == 3: + break + coords = vert.co + if global_matrix_multiplier: + coords = global_matrix_multiplier * coords + if not (vert.index in vert_indices): + vert_indices.append(vert.index) + selection.append(coords) for vert in (v for v in src_mesh.verts if v.select): if len(selection) == 3: break @@ -1430,7 +1460,6 @@ def return_at_least_one_selected_vert(mesh_object, vert_indices.append(vert.index) selection.append(coords) - print(selection) if len(selection) > 0: return selection else: @@ -1445,7 +1474,6 @@ def set_item_coords(item, coords_to_set, coords): ) for key, val in target_data.items(): setattr(item, key, val) - print('UMMM....') return True @@ -1567,21 +1595,15 @@ def execute(self, context): if len(vert_data) == 1: active_item.kind = 'POINT' vert_attribs_to_set = ('point',) - print('A') elif len(vert_data) == 2: active_item.kind = 'LINE' vert_attribs_to_set = ('line_start', 'line_end') - print('B') elif len(vert_data) == 3: - print(active_item.kind) active_item.kind = 'PLANE' - print(active_item.kind) vert_attribs_to_set = ('plane_pt_a', 'plane_pt_b', 'plane_pt_c') - print('C') set_item_coords(active_item, vert_attribs_to_set, vert_data) - print('YO') return {'FINISHED'} @@ -6152,8 +6174,8 @@ def execute(self, context): return {'FINISHED'} -class CalcLineLength(bpy.types.Operator): - bl_idname = "maplus.calclinelength" +class CalcLineLengthBase(bpy.types.Operator): + bl_idname = "maplus.calclinelengthbase" bl_label = "Calculate Line Length" bl_description = "Calculates the length of the targeted line item" bl_options = {'REGISTER', 'UNDO'} @@ -6162,8 +6184,8 @@ def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list if hasattr(self, 'quick_calc_target'): - active_calculation = addon_data.quick_calc_result_item - result_attrib = 'single_calc_result' + active_calculation = addon_data + result_attrib = 'quick_calc_result_numeric' calc_target_item = addon_data.internal_storage_slot_1 else: active_calculation = prims[addon_data.active_list_item] @@ -6191,7 +6213,14 @@ def execute(self, context): return {'FINISHED'} -class QuickCalcLineLength(CalcLineLength): +class CalcLineLength(CalcLineLengthBase): + bl_idname = "maplus.calclinelength" + bl_label = "Calculate Line Length" + bl_description = "Calculates the length of the targeted line item" + bl_options = {'REGISTER', 'UNDO'} + + +class QuickCalcLineLength(CalcLineLengthBase): bl_idname = "maplus.quickcalclinelength" bl_label = "Calculate Line Length" bl_description = "Calculates the length of the targeted line item" @@ -6199,8 +6228,8 @@ class QuickCalcLineLength(CalcLineLength): quick_calc_target = True -class CalcRotationalDiff(bpy.types.Operator): - bl_idname = "maplus.calcrotationaldiff" +class CalcRotationalDiffBase(bpy.types.Operator): + bl_idname = "maplus.calcrotationaldiffbase" bl_label = "Angle of Lines" bl_description = ( "Calculates the rotational difference between line items" @@ -6211,10 +6240,18 @@ def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list active_item = prims[addon_data.active_list_item] - calc_target_one = prims[active_item.multi_calc_target_one] - calc_target_two = prims[active_item.multi_calc_target_two] + if hasattr(self, 'quick_calc_target'): + active_calculation = addon_data + result_attrib = 'quick_calc_result_numeric' + calc_target_one = addon_data.internal_storage_slot_1 + calc_target_two = addon_data.internal_storage_slot_2 + else: + active_calculation = prims[addon_data.active_list_item] + result_attrib = 'multi_calc_result' + calc_target_one = prims[active_calculation.multi_calc_target_one] + calc_target_two = prims[active_calculation.multi_calc_target_two] - if not (calc_target_one.kind == 'LINE' and + if (not hasattr(self, 'quick_calc_target')) and not (calc_target_one.kind == 'LINE' and calc_target_two.kind == 'LINE'): self.report( {'ERROR'}, @@ -6242,13 +6279,33 @@ def execute(self, context): result = angle else: result = math.degrees(angle) - active_item.multi_calc_result = result + + setattr(active_calculation, result_attrib, result) if addon_data.calc_result_to_clipboard: bpy.context.window_manager.clipboard = str(result) return {'FINISHED'} +class CalcRotationalDiff(CalcRotationalDiffBase): + bl_idname = "maplus.calcrotationaldiff" + bl_label = "Angle of Lines" + bl_description = ( + "Calculates the rotational difference between line items" + ) + bl_options = {'REGISTER', 'UNDO'} + + +class QuickCalcRotationalDiff(CalcRotationalDiffBase): + bl_idname = "maplus.quickcalcrotationaldiff" + bl_label = "Angle of Lines" + bl_description = ( + "Calculates the rotational difference between line items" + ) + bl_options = {'REGISTER', 'UNDO'} + quick_calc_target = True + + class ComposeNewLineFromOrigin(bpy.types.Operator): bl_idname = "maplus.composenewlinefromorigin" bl_label = "New Line from Origin" @@ -10549,8 +10606,8 @@ def draw(self, context): "Copy to Clipboard" ) calc_gui.prop( - bpy.types.AnyType(bpy.types.AnyType(addon_data.quick_calc_result_item)), - 'single_calc_result', + bpy.types.AnyType(bpy.types.AnyType(addon_data)), + 'quick_calc_result_numeric', "" ) calc_gui.separator() @@ -10559,6 +10616,10 @@ def draw(self, context): "maplus.quickcalclinelength", text="Line Length" ) + calc_gui.operator( + "maplus.quickcalcrotationaldiff", + text="Angle of Lines" + ) # slot1_geom_top = calc_gui.row(align=True) # if not addon_data.quick_calc_show_slot1_geom: From 031365fed2b53d3afeb3ba0300b5307cc420f5c6 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Tue, 21 Mar 2017 17:07:37 -0400 Subject: [PATCH 20/56] Added extra quick calculations. --- mesh_mesh_align_plus.py | 82 +++++++++++++++++++++++++++++++++-------- 1 file changed, 66 insertions(+), 16 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 84c6c50..5c0a369 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -6239,7 +6239,6 @@ class CalcRotationalDiffBase(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list - active_item = prims[addon_data.active_list_item] if hasattr(self, 'quick_calc_target'): active_calculation = addon_data result_attrib = 'quick_calc_result_numeric' @@ -6306,8 +6305,8 @@ class QuickCalcRotationalDiff(CalcRotationalDiffBase): quick_calc_target = True -class ComposeNewLineFromOrigin(bpy.types.Operator): - bl_idname = "maplus.composenewlinefromorigin" +class ComposeNewLineFromOriginBase(bpy.types.Operator): + bl_idname = "maplus.composenewlinefromoriginbase" bl_label = "New Line from Origin" bl_description = "Composes a new line item starting at the world origin" bl_options = {'REGISTER', 'UNDO'} @@ -6315,8 +6314,15 @@ class ComposeNewLineFromOrigin(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list - active_item = prims[addon_data.active_list_item] - calc_target_item = prims[active_item.single_calc_target] + if hasattr(self, 'quick_calc_target'): + active_calculation = addon_data + result_item = active_calculation.quick_calc_result_item + calc_target_item = addon_data.internal_storage_slot_1 + else: + active_calculation = prims[addon_data.active_list_item] + bpy.ops.maplus.addnewline() + result_item = prims[-1] + calc_target_item = prims[active_calculation.single_calc_target] if calc_target_item.kind != 'LINE': self.report( @@ -6334,16 +6340,29 @@ def execute(self, context): ) src_line = src_global_data[1] - src_global_data[0] - bpy.ops.maplus.addnewline() - new_line = prims[-1] - new_line.line_start = start_loc - new_line.line_end = ( + result_item.line_start = start_loc + result_item.line_end = ( start_loc + src_line ) return {'FINISHED'} +class ComposeNewLineFromOrigin(ComposeNewLineFromOriginBase): + bl_idname = "maplus.composenewlinefromorigin" + bl_label = "New Line from Origin" + bl_description = "Composes a new line item starting at the world origin" + bl_options = {'REGISTER', 'UNDO'} + + +class QuickComposeNewLineFromOrigin(ComposeNewLineFromOriginBase): + bl_idname = "maplus.quickcomposenewlinefromorigin" + bl_label = "New Line from Origin" + bl_description = "Composes a new line item starting at the world origin" + bl_options = {'REGISTER', 'UNDO'} + quick_calc_target = True + + class ComposeNormalFromPlane(bpy.types.Operator): bl_idname = "maplus.composenormalfromplane" bl_label = "Get Plane Normal" @@ -6471,8 +6490,8 @@ def execute(self, context): return {'FINISHED'} -class CalcDistanceBetweenPoints(bpy.types.Operator): - bl_idname = "maplus.calcdistancebetweenpoints" +class CalcDistanceBetweenPointsBase(bpy.types.Operator): + bl_idname = "maplus.calcdistancebetweenpointsbase" bl_label = "Distance Between Points" bl_description = "Calculate the distance between provided point items" bl_options = {'REGISTER', 'UNDO'} @@ -6480,11 +6499,18 @@ class CalcDistanceBetweenPoints(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list - active_item = prims[addon_data.active_list_item] - calc_target_one = prims[active_item.multi_calc_target_one] - calc_target_two = prims[active_item.multi_calc_target_two] + if hasattr(self, 'quick_calc_target'): + active_calculation = addon_data + result_attrib = 'quick_calc_result_numeric' + calc_target_one = addon_data.internal_storage_slot_1 + calc_target_two = addon_data.internal_storage_slot_2 + else: + active_calculation = prims[addon_data.active_list_item] + result_attrib = 'multi_calc_result' + calc_target_one = prims[active_calculation.multi_calc_target_one] + calc_target_two = prims[active_calculation.multi_calc_target_two] - if not (calc_target_one.kind == 'POINT' and + if (not hasattr(self, 'quick_calc_target')) and not (calc_target_one.kind == 'POINT' and calc_target_two.kind == 'POINT'): self.report( {'ERROR'}, @@ -6505,13 +6531,28 @@ def execute(self, context): dest_pt = dest_global_data[0] result = (dest_pt - src_pt).length - active_item.multi_calc_result = result + setattr(active_calculation, result_attrib, result) if addon_data.calc_result_to_clipboard: bpy.context.window_manager.clipboard = str(result) return {'FINISHED'} +class CalcDistanceBetweenPoints(CalcDistanceBetweenPointsBase): + bl_idname = "maplus.calcdistancebetweenpoints" + bl_label = "Distance Between Points" + bl_description = "Calculate the distance between provided point items" + bl_options = {'REGISTER', 'UNDO'} + + +class QuickCalcDistanceBetweenPoints(CalcDistanceBetweenPointsBase): + bl_idname = "maplus.quickcalcdistancebetweenpoints" + bl_label = "Distance Between Points" + bl_description = "Calculate the distance between provided point items" + bl_options = {'REGISTER', 'UNDO'} + quick_calc_target = True + + class ComposeNewLineFromPoints(bpy.types.Operator): bl_idname = "maplus.composenewlinefrompoints" bl_label = "New Line from Points" @@ -10620,6 +10661,15 @@ def draw(self, context): "maplus.quickcalcrotationaldiff", text="Angle of Lines" ) + calc_gui.operator( + "maplus.quickcomposenewlinefromorigin", + icon='MAN_TRANS', + text="New Line from Origin" + ) + calc_gui.operator( + "maplus.quickcalcdistancebetweenpoints", + text="Distance Between Points" + ) # slot1_geom_top = calc_gui.row(align=True) # if not addon_data.quick_calc_show_slot1_geom: From 460be0651cda6ec0f9f92bcdb446484b5f8ed472 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Wed, 22 Mar 2017 09:02:14 -0400 Subject: [PATCH 21/56] Added extra quick calculations (new line at point loc). --- mesh_mesh_align_plus.py | 46 ++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 5c0a369..ce1ce62 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -6447,8 +6447,8 @@ def execute(self, context): return {'FINISHED'} -class ComposeNewLineAtPointLocation(bpy.types.Operator): - bl_idname = "maplus.composenewlineatpointlocation" +class ComposeNewLineAtPointLocationBase(bpy.types.Operator): + bl_idname = "maplus.composenewlineatpointlocationbase" bl_label = "New Line at Point Location" bl_description = "Composes a new line item starting at the point location" bl_options = {'REGISTER', 'UNDO'} @@ -6456,14 +6456,22 @@ class ComposeNewLineAtPointLocation(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list - active_item = prims[addon_data.active_list_item] - calc_target_one = prims[active_item.multi_calc_target_one] - calc_target_two = prims[active_item.multi_calc_target_two] + if hasattr(self, 'quick_calc_target'): + active_calculation = addon_data + result_item = active_calculation.quick_calc_result_item + calc_target_one = addon_data.internal_storage_slot_1 + calc_target_two = addon_data.internal_storage_slot_2 + else: + active_calculation = prims[addon_data.active_list_item] + bpy.ops.maplus.addnewline() + result_item = prims[-1] + calc_target_one = prims[active_calculation.multi_calc_target_one] + calc_target_two = prims[active_calculation.multi_calc_target_two] targets_by_kind = { item.kind: item for item in [calc_target_one, calc_target_two] } - if not ('POINT' in targets_by_kind and 'LINE' in targets_by_kind): + if (not hasattr(self, 'quick_calc_target')) and not ('POINT' in targets_by_kind and 'LINE' in targets_by_kind): self.report( {'ERROR'}, ('Wrong operand: "Compose New Line at Point" can' @@ -6482,14 +6490,27 @@ def execute(self, context): start_loc = pt_global_data[0] src_line = line_global_data[1] - line_global_data[0] - bpy.ops.maplus.addnewline() - new_line = prims[-1] - new_line.line_start = start_loc - new_line.line_end = start_loc + src_line + result_item.line_start = start_loc + result_item.line_end = start_loc + src_line return {'FINISHED'} +class ComposeNewLineAtPointLocation(ComposeNewLineAtPointLocationBase): + bl_idname = "maplus.composenewlineatpointlocation" + bl_label = "New Line at Point Location" + bl_description = "Composes a new line item starting at the point location" + bl_options = {'REGISTER', 'UNDO'} + + +class QuickComposeNewLineAtPointLocation(ComposeNewLineAtPointLocationBase): + bl_idname = "maplus.quickcomposenewlineatpointlocation" + bl_label = "New Line at Point Location" + bl_description = "Composes a new line item starting at the point location" + bl_options = {'REGISTER', 'UNDO'} + quick_calc_target = True + + class CalcDistanceBetweenPointsBase(bpy.types.Operator): bl_idname = "maplus.calcdistancebetweenpointsbase" bl_label = "Distance Between Points" @@ -10670,6 +10691,11 @@ def draw(self, context): "maplus.quickcalcdistancebetweenpoints", text="Distance Between Points" ) + calc_gui.operator( + "maplus.quickcomposenewlineatpointlocation", + icon='MAN_TRANS', + text="New Line at Point" + ) # slot1_geom_top = calc_gui.row(align=True) # if not addon_data.quick_calc_show_slot1_geom: From d8b3aa86d8095e9abde315460828433985afce1c Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Wed, 22 Mar 2017 09:45:14 -0400 Subject: [PATCH 22/56] Added extra quick calculations (new line from points). --- mesh_mesh_align_plus.py | 46 ++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index ce1ce62..86ceb5d 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -6574,8 +6574,8 @@ class QuickCalcDistanceBetweenPoints(CalcDistanceBetweenPointsBase): quick_calc_target = True -class ComposeNewLineFromPoints(bpy.types.Operator): - bl_idname = "maplus.composenewlinefrompoints" +class ComposeNewLineFromPointsBase(bpy.types.Operator): + bl_idname = "maplus.composenewlinefrompointsbase" bl_label = "New Line from Points" bl_description = "Composes a new line item from provided point items" bl_options = {'REGISTER', 'UNDO'} @@ -6583,11 +6583,19 @@ class ComposeNewLineFromPoints(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list - active_item = prims[addon_data.active_list_item] - calc_target_one = prims[active_item.multi_calc_target_one] - calc_target_two = prims[active_item.multi_calc_target_two] + if hasattr(self, 'quick_calc_target'): + active_calculation = addon_data + result_item = active_calculation.quick_calc_result_item + calc_target_one = addon_data.internal_storage_slot_1 + calc_target_two = addon_data.internal_storage_slot_2 + else: + active_calculation = prims[addon_data.active_list_item] + bpy.ops.maplus.addnewline() + result_item = prims[-1] + calc_target_one = prims[active_calculation.multi_calc_target_one] + calc_target_two = prims[active_calculation.multi_calc_target_two] - if not (calc_target_one.kind == 'POINT' and + if (not hasattr(self, 'quick_calc_target')) and not (calc_target_one.kind == 'POINT' and calc_target_two.kind == 'POINT'): self.report( {'ERROR'}, @@ -6607,14 +6615,27 @@ def execute(self, context): src_pt = src_global_data[0] dest_pt = dest_global_data[0] - bpy.ops.maplus.addnewline() - new_line = prims[-1] - new_line.line_start = src_pt - new_line.line_end = dest_pt + result_item.line_start = src_pt + result_item.line_end = dest_pt return {'FINISHED'} +class ComposeNewLineFromPoints(ComposeNewLineFromPointsBase): + bl_idname = "maplus.composenewlinefrompoints" + bl_label = "New Line from Points" + bl_description = "Composes a new line item from provided point items" + bl_options = {'REGISTER', 'UNDO'} + + +class QuickComposeNewLineFromPoints(ComposeNewLineFromPointsBase): + bl_idname = "maplus.quickcomposenewlinefrompoints" + bl_label = "New Line from Points" + bl_description = "Composes a new line item from provided point items" + bl_options = {'REGISTER', 'UNDO'} + quick_calc_target = True + + class ComposeNewLineVectorAddition(bpy.types.Operator): bl_idname = "maplus.composenewlinevectoraddition" bl_label = "Add Lines" @@ -10696,6 +10717,11 @@ def draw(self, context): icon='MAN_TRANS', text="New Line at Point" ) + calc_gui.operator( + "maplus.quickcomposenewlinefrompoints", + icon='MAN_TRANS', + text="New Line from Points" + ) # slot1_geom_top = calc_gui.row(align=True) # if not addon_data.quick_calc_show_slot1_geom: From 4c99a8d1da274400d915b4353e24ee6a1add2615 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Wed, 22 Mar 2017 10:26:45 -0400 Subject: [PATCH 23/56] Added several new quick calculations. --- mesh_mesh_align_plus.py | 240 ++++++++++++++++++++++++++++++++-------- 1 file changed, 192 insertions(+), 48 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 86ceb5d..fe1133d 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -6324,7 +6324,7 @@ def execute(self, context): result_item = prims[-1] calc_target_item = prims[active_calculation.single_calc_target] - if calc_target_item.kind != 'LINE': + if (not hasattr(self, 'quick_calc_target')) and calc_target_item.kind != 'LINE': self.report( {'ERROR'}, ('Wrong operand: "Compose New Line from Origin" can' @@ -6363,8 +6363,8 @@ class QuickComposeNewLineFromOrigin(ComposeNewLineFromOriginBase): quick_calc_target = True -class ComposeNormalFromPlane(bpy.types.Operator): - bl_idname = "maplus.composenormalfromplane" +class ComposeNormalFromPlaneBase(bpy.types.Operator): + bl_idname = "maplus.composenormalfromplanebase" bl_label = "Get Plane Normal" bl_description = "Get the plane's normal as a new line item" bl_options = {'REGISTER', 'UNDO'} @@ -6372,10 +6372,17 @@ class ComposeNormalFromPlane(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list - active_item = prims[addon_data.active_list_item] - calc_target_item = prims[active_item.single_calc_target] + if hasattr(self, 'quick_calc_target'): + active_calculation = addon_data + result_item = active_calculation.quick_calc_result_item + calc_target_item = addon_data.internal_storage_slot_1 + else: + active_calculation = prims[addon_data.active_list_item] + bpy.ops.maplus.addnewline() + result_item = prims[-1] + calc_target_item = prims[active_calculation.single_calc_target] - if not calc_target_item.kind == 'PLANE': + if (not hasattr(self, 'quick_calc_target')) and not calc_target_item.kind == 'PLANE': self.report( {'ERROR'}, ('Wrong operand: "Get Plane Normal" can only operate on' @@ -6401,16 +6408,29 @@ def execute(self, context): calc_target_item.plane_pt_b[0:3] ) - bpy.ops.maplus.addnewline() - new_line = prims[-1] - new_line.line_start = start_loc - new_line.line_end = start_loc + normal + result_item.line_start = start_loc + result_item.line_end = start_loc + normal return {'FINISHED'} -class ComposeNewLineFromPoint(bpy.types.Operator): - bl_idname = "maplus.composenewlinefrompoint" +class ComposeNormalFromPlane(ComposeNormalFromPlaneBase): + bl_idname = "maplus.composenormalfromplane" + bl_label = "Get Plane Normal" + bl_description = "Get the plane's normal as a new line item" + bl_options = {'REGISTER', 'UNDO'} + + +class QuickComposeNormalFromPlane(ComposeNormalFromPlaneBase): + bl_idname = "maplus.quickcomposenormalfromplane" + bl_label = "Get Plane Normal" + bl_description = "Get the plane's normal as a new line item" + bl_options = {'REGISTER', 'UNDO'} + quick_calc_target = True + + +class ComposeNewLineFromPointBase(bpy.types.Operator): + bl_idname = "maplus.composenewlinefrompointbase" bl_label = "New Line from Point" bl_description = ( "Composes a new line item from the supplied point," @@ -6421,10 +6441,17 @@ class ComposeNewLineFromPoint(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list - active_item = prims[addon_data.active_list_item] - calc_target_item = prims[active_item.single_calc_target] + if hasattr(self, 'quick_calc_target'): + active_calculation = addon_data + result_item = active_calculation.quick_calc_result_item + calc_target_item = addon_data.internal_storage_slot_1 + else: + active_calculation = prims[addon_data.active_list_item] + bpy.ops.maplus.addnewline() + result_item = prims[-1] + calc_target_item = prims[active_calculation.single_calc_target] - if calc_target_item.kind != 'POINT': + if (not hasattr(self, 'quick_calc_target')) and calc_target_item.kind != 'POINT': self.report( {'ERROR'}, ('Wrong operand: "Compose New Line from Point" can' @@ -6439,14 +6466,33 @@ def execute(self, context): kind='POINT' ) - bpy.ops.maplus.addnewline() - new_line = prims[-1] - new_line.line_start = start_loc - new_line.line_end = src_global_data[0] + result_item.line_start = start_loc + result_item.line_end = src_global_data[0] return {'FINISHED'} +class ComposeNewLineFromPoint(bpy.types.Operator): + bl_idname = "maplus.composenewlinefrompoint" + bl_label = "New Line from Point" + bl_description = ( + "Composes a new line item from the supplied point," + " starting at the world origin" + ) + bl_options = {'REGISTER', 'UNDO'} + + +class QuickComposeNewLineFromPoint(bpy.types.Operator): + bl_idname = "maplus.quickcomposenewlinefrompoint" + bl_label = "New Line from Point" + bl_description = ( + "Composes a new line item from the supplied point," + " starting at the world origin" + ) + bl_options = {'REGISTER', 'UNDO'} + quick_calc_target = True + + class ComposeNewLineAtPointLocationBase(bpy.types.Operator): bl_idname = "maplus.composenewlineatpointlocationbase" bl_label = "New Line at Point Location" @@ -6636,8 +6682,8 @@ class QuickComposeNewLineFromPoints(ComposeNewLineFromPointsBase): quick_calc_target = True -class ComposeNewLineVectorAddition(bpy.types.Operator): - bl_idname = "maplus.composenewlinevectoraddition" +class ComposeNewLineVectorAdditionBase(bpy.types.Operator): + bl_idname = "maplus.composenewlinevectoradditionbase" bl_label = "Add Lines" bl_description = "Composes a new line item by vector-adding provided lines" bl_options = {'REGISTER', 'UNDO'} @@ -6645,11 +6691,19 @@ class ComposeNewLineVectorAddition(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list - active_item = prims[addon_data.active_list_item] - calc_target_one = prims[active_item.multi_calc_target_one] - calc_target_two = prims[active_item.multi_calc_target_two] + if hasattr(self, 'quick_calc_target'): + active_calculation = addon_data + result_item = active_calculation.quick_calc_result_item + calc_target_one = addon_data.internal_storage_slot_1 + calc_target_two = addon_data.internal_storage_slot_2 + else: + active_calculation = prims[addon_data.active_list_item] + bpy.ops.maplus.addnewline() + result_item = prims[-1] + calc_target_one = prims[active_calculation.multi_calc_target_one] + calc_target_two = prims[active_calculation.multi_calc_target_two] - if not (calc_target_one.kind == 'LINE' and + if (not hasattr(self, 'quick_calc_target')) and not (calc_target_one.kind == 'LINE' and calc_target_two.kind == 'LINE'): self.report( {'ERROR'}, @@ -6671,16 +6725,29 @@ def execute(self, context): src_line = src_global_data[1] - src_global_data[0] dest_line = dest_global_data[1] - dest_global_data[0] - bpy.ops.maplus.addnewline() - new_line = prims[-1] - new_line.line_start = start_loc - new_line.line_end = src_line + dest_line + result_item.line_start = start_loc + result_item.line_end = src_line + dest_line return {'FINISHED'} -class ComposeNewLineVectorSubtraction(bpy.types.Operator): - bl_idname = "maplus.composenewlinevectorsubtraction" +class ComposeNewLineVectorAddition(ComposeNewLineVectorAdditionBase): + bl_idname = "maplus.composenewlinevectoraddition" + bl_label = "Add Lines" + bl_description = "Composes a new line item by vector-adding provided lines" + bl_options = {'REGISTER', 'UNDO'} + + +class QuickComposeNewLineVectorAddition(ComposeNewLineVectorAdditionBase): + bl_idname = "maplus.quickcomposenewlinevectoraddition" + bl_label = "Add Lines" + bl_description = "Composes a new line item by vector-adding provided lines" + bl_options = {'REGISTER', 'UNDO'} + quick_calc_target = True + + +class ComposeNewLineVectorSubtractionBase(bpy.types.Operator): + bl_idname = "maplus.composenewlinevectorsubtractionbase" bl_label = "Subtract Lines" bl_description = ( "Composes a new line item by performing vector-subtraction" @@ -6691,11 +6758,19 @@ class ComposeNewLineVectorSubtraction(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list - active_item = prims[addon_data.active_list_item] - calc_target_one = prims[active_item.multi_calc_target_one] - calc_target_two = prims[active_item.multi_calc_target_two] + if hasattr(self, 'quick_calc_target'): + active_calculation = addon_data + result_item = active_calculation.quick_calc_result_item + calc_target_one = addon_data.internal_storage_slot_1 + calc_target_two = addon_data.internal_storage_slot_2 + else: + active_calculation = prims[addon_data.active_list_item] + bpy.ops.maplus.addnewline() + result_item = prims[-1] + calc_target_one = prims[active_calculation.multi_calc_target_one] + calc_target_two = prims[active_calculation.multi_calc_target_two] - if not (calc_target_one.kind == 'LINE' and + if (not hasattr(self, 'quick_calc_target')) and not (calc_target_one.kind == 'LINE' and calc_target_two.kind == 'LINE'): self.report( {'ERROR'}, @@ -6717,16 +6792,35 @@ def execute(self, context): src_line = src_global_data[1] - src_global_data[0] dest_line = dest_global_data[1] - dest_global_data[0] - bpy.ops.maplus.addnewline() - new_line = prims[-1] - new_line.line_start = start_loc - new_line.line_end = src_line - dest_line + result_item.line_start = start_loc + result_item.line_end = src_line - dest_line return {'FINISHED'} -class ComposePointIntersectingLinePlane(bpy.types.Operator): - bl_idname = "maplus.composepointintersectinglineplane" +class ComposeNewLineVectorSubtraction(ComposeNewLineVectorSubtractionBase): + bl_idname = "maplus.composenewlinevectorsubtraction" + bl_label = "Subtract Lines" + bl_description = ( + "Composes a new line item by performing vector-subtraction" + " (first line minus second line)" + ) + bl_options = {'REGISTER', 'UNDO'} + + +class QuickComposeNewLineVectorSubtraction(ComposeNewLineVectorSubtractionBase): + bl_idname = "maplus.quickcomposenewlinevectorsubtraction" + bl_label = "Subtract Lines" + bl_description = ( + "Composes a new line item by performing vector-subtraction" + " (first line minus second line)" + ) + bl_options = {'REGISTER', 'UNDO'} + quick_calc_target = True + + +class ComposePointIntersectingLinePlaneBase(bpy.types.Operator): + bl_idname = "maplus.composepointintersectinglineplanebase" bl_label = "Intersect Line/Plane" bl_description = ( "Composes a new point item by intersecting a line and a plane" @@ -6736,14 +6830,22 @@ class ComposePointIntersectingLinePlane(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list - active_item = prims[addon_data.active_list_item] - calc_target_one = prims[active_item.multi_calc_target_one] - calc_target_two = prims[active_item.multi_calc_target_two] + if hasattr(self, 'quick_calc_target'): + active_calculation = addon_data + result_item = active_calculation.quick_calc_result_item + calc_target_one = addon_data.internal_storage_slot_1 + calc_target_two = addon_data.internal_storage_slot_2 + else: + active_calculation = prims[addon_data.active_list_item] + bpy.ops.maplus.addnewline() + result_item = prims[-1] + calc_target_one = prims[active_calculation.multi_calc_target_one] + calc_target_two = prims[active_calculation.multi_calc_target_two] targets_by_kind = { item.kind: item for item in [calc_target_one, calc_target_two] } - if not ('LINE' in targets_by_kind and 'PLANE' in targets_by_kind): + if (not hasattr(self, 'quick_calc_target')) and not ('LINE' in targets_by_kind and 'PLANE' in targets_by_kind): self.report( {'ERROR'}, ('Wrong operand: "Intersect Line/Plane" can' @@ -6771,9 +6873,7 @@ def execute(self, context): ) if intersection: - bpy.ops.maplus.addnewpoint() - new_point = prims[-1] - new_point.point = intersection + result_item.point = intersection else: self.report( {'ERROR'}, @@ -6784,6 +6884,25 @@ def execute(self, context): return {'FINISHED'} +class ComposePointIntersectingLinePlane(ComposePointIntersectingLinePlaneBase): + bl_idname = "maplus.composepointintersectinglineplane" + bl_label = "Intersect Line/Plane" + bl_description = ( + "Composes a new point item by intersecting a line and a plane" + ) + bl_options = {'REGISTER', 'UNDO'} + + +class QuickComposePointIntersectingLinePlane(ComposePointIntersectingLinePlaneBase): + bl_idname = "maplus.quickcomposepointintersectinglineplane" + bl_label = "Intersect Line/Plane" + bl_description = ( + "Composes a new point item by intersecting a line and a plane" + ) + bl_options = {'REGISTER', 'UNDO'} + quick_calc_target = True + + # Custom list, for displaying combined list of all primitives (Used at top # of main panel and for item pointers in transformation primitives class MAPlusList(bpy.types.UIList): @@ -10708,6 +10827,16 @@ def draw(self, context): icon='MAN_TRANS', text="New Line from Origin" ) + calc_gui.operator( + "maplus.quickcomposenormalfromplane", + icon='MAN_TRANS', + text="Get Plane Normal (Normalized)" + ) + calc_gui.operator( + "maplus.quickcomposenewlinefrompoint", + icon='MAN_TRANS', + text="New Line from Point" + ) calc_gui.operator( "maplus.quickcalcdistancebetweenpoints", text="Distance Between Points" @@ -10722,6 +10851,21 @@ def draw(self, context): icon='MAN_TRANS', text="New Line from Points" ) + calc_gui.operator( + "maplus.quickcomposenewlinevectoraddition", + icon='MAN_TRANS', + text="Add Lines" + ) + calc_gui.operator( + "maplus.quickcomposenewlinevectorsubtraction", + icon='MAN_TRANS', + text="Subtract Lines" + ) + calc_gui.operator( + "maplus.quickcomposepointintersectinglineplane", + icon='LAYER_ACTIVE', + text="Intersect Line/Plane" + ) # slot1_geom_top = calc_gui.row(align=True) # if not addon_data.quick_calc_show_slot1_geom: From ca3cd33c1507268e43c08c6e2264febb400366cf Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Wed, 22 Mar 2017 14:00:45 -0400 Subject: [PATCH 24/56] Added clipboard copying of quick calculation results. --- mesh_mesh_align_plus.py | 97 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 89 insertions(+), 8 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 308967e..29ff029 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -566,12 +566,7 @@ class MAPlusData(bpy.types.PropertyGroup): ) internal_storage_slot_1 = bpy.props.PointerProperty(type=MAPlusPrimitive) internal_storage_slot_2 = bpy.props.PointerProperty(type=MAPlusPrimitive) - quick_calc_result_to_clipboard = bpy.props.BoolProperty( - description=( - "Copy numeric calculations to clipboard" - ), - default=True - ) + internal_storage_clipboard = bpy.props.PointerProperty(type=MAPlusPrimitive) # Basic type selector functionality, derived classes provide @@ -6393,7 +6388,6 @@ def execute(self, context): return {'CANCELLED'} start_loc = mathutils.Vector((0, 0, 0)) - src_global_data = get_modified_global_coords( geometry=calc_target_item, kind='LINE' @@ -6404,6 +6398,17 @@ def execute(self, context): result_item.line_end = ( start_loc + src_line ) + if addon_data.calc_result_to_clipboard: + addon_data.internal_storage_clipboard.kind = 'LINE' + copy_source_attribs_to_dest( + result_item, + addon_data.internal_storage_clipboard, + ("line_start", + "line_end", + "ln_make_unit_vec", + "ln_flip_direction", + "ln_multiplier") + ) return {'FINISHED'} @@ -6470,6 +6475,17 @@ def execute(self, context): result_item.line_start = start_loc result_item.line_end = start_loc + normal + if addon_data.calc_result_to_clipboard: + addon_data.internal_storage_clipboard.kind = 'LINE' + copy_source_attribs_to_dest( + result_item, + addon_data.internal_storage_clipboard, + ("line_start", + "line_end", + "ln_make_unit_vec", + "ln_flip_direction", + "ln_multiplier") + ) return {'FINISHED'} @@ -6528,6 +6544,17 @@ def execute(self, context): result_item.line_start = start_loc result_item.line_end = src_global_data[0] + if addon_data.calc_result_to_clipboard: + addon_data.internal_storage_clipboard.kind = 'LINE' + copy_source_attribs_to_dest( + result_item, + addon_data.internal_storage_clipboard, + ("line_start", + "line_end", + "ln_make_unit_vec", + "ln_flip_direction", + "ln_multiplier") + ) return {'FINISHED'} @@ -6598,6 +6625,17 @@ def execute(self, context): result_item.line_start = start_loc result_item.line_end = start_loc + src_line + if addon_data.calc_result_to_clipboard: + addon_data.internal_storage_clipboard.kind = 'LINE' + copy_source_attribs_to_dest( + result_item, + addon_data.internal_storage_clipboard, + ("line_start", + "line_end", + "ln_make_unit_vec", + "ln_flip_direction", + "ln_multiplier") + ) return {'FINISHED'} @@ -6723,6 +6761,17 @@ def execute(self, context): result_item.line_start = src_pt result_item.line_end = dest_pt + if addon_data.calc_result_to_clipboard: + addon_data.internal_storage_clipboard.kind = 'LINE' + copy_source_attribs_to_dest( + result_item, + addon_data.internal_storage_clipboard, + ("line_start", + "line_end", + "ln_make_unit_vec", + "ln_flip_direction", + "ln_multiplier") + ) return {'FINISHED'} @@ -6787,6 +6836,17 @@ def execute(self, context): result_item.line_start = start_loc result_item.line_end = src_line + dest_line + if addon_data.calc_result_to_clipboard: + addon_data.internal_storage_clipboard.kind = 'LINE' + copy_source_attribs_to_dest( + result_item, + addon_data.internal_storage_clipboard, + ("line_start", + "line_end", + "ln_make_unit_vec", + "ln_flip_direction", + "ln_multiplier") + ) return {'FINISHED'} @@ -6854,6 +6914,17 @@ def execute(self, context): result_item.line_start = start_loc result_item.line_end = src_line - dest_line + if addon_data.calc_result_to_clipboard: + addon_data.internal_storage_clipboard.kind = 'LINE' + copy_source_attribs_to_dest( + result_item, + addon_data.internal_storage_clipboard, + ("line_start", + "line_end", + "ln_make_unit_vec", + "ln_flip_direction", + "ln_multiplier") + ) return {'FINISHED'} @@ -6934,6 +7005,16 @@ def execute(self, context): if intersection: result_item.point = intersection + if addon_data.calc_result_to_clipboard: + addon_data.internal_storage_clipboard.kind = 'POINT' + copy_source_attribs_to_dest( + result_item, + addon_data.internal_storage_clipboard, + ("point", + "pt_make_unit_vec", + "pt_flip_direction", + "pt_multiplier") + ) else: self.report( {'ERROR'}, @@ -10864,7 +10945,7 @@ def draw(self, context): clipboard_row_right.alignment = 'RIGHT' clipboard_row_right.prop( bpy.types.AnyType(maplus_data_ptr), - 'quick_calc_result_to_clipboard', + 'calc_result_to_clipboard', "Copy to Clipboard" ) calc_gui.prop( From 0e8fb2f15e33107e26ea98d9a4cb1e4018e162cc Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Wed, 22 Mar 2017 16:10:45 -0400 Subject: [PATCH 25/56] Added initial copy/paste clipboard on Quick Align Points source/dest. --- mesh_mesh_align_plus.py | 86 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 10 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 29ff029..adea10c 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -1107,20 +1107,28 @@ class CopyToOtherBase(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list - advanced_tools_active_item = prims[addon_data.active_list_item] + advanced_tools_active_item = None + if 'ADVTOOLSACTIVE' in self.source_dest_pair: + if len(prims) < 1: + self.report({'ERROR'}, 'No stored geometry items exist to copy.') + return {'CANCELLED'} + advanced_tools_active_item = prims[addon_data.active_list_item] string_to_target_mappings = { - 'APTSRC': addon_data.quick_align_points_source, - 'APTDEST': addon_data.quick_align_points_dest, - 'ALNSRC': addon_data.quick_align_lines_source, + 'APTSRC': addon_data.quick_align_pts_src, + 'APTDEST': addon_data.quick_align_pts_dest, + 'ALNSRC': addon_data.quick_align_lines_src, 'ALNDEST': addon_data.quick_align_lines_dest, - 'APLSRC': addon_data.quick_align_planes_source, + 'APLSRC': addon_data.quick_align_planes_src, 'APLDEST': addon_data.quick_align_planes_dest, - 'AXRSRC': addon_data.quick_axis_rotate_source, - 'DSSRC': addon_data.quick_directional_slide_source, - 'SMESRC': addon_data.scale_match_edge_source, - 'SMEDEST': addon_data.scale_match_edge_dest, + 'AXRSRC': addon_data.quick_axis_rotate_src, + 'DSSRC': addon_data.quick_directional_slide_src, + 'SMESRC': addon_data.quick_scale_match_edge_src, + 'SMEDEST': addon_data.quick_scale_match_edge_dest, 'ADVTOOLSACTIVE': advanced_tools_active_item, + 'INTERNALCLIPBOARD': addon_data.internal_storage_clipboard, + 'SLOT1': addon_data.internal_storage_slot_1, + 'SLOT2': addon_data.internal_storage_slot_2 } set_attribs = { "POINT": ( @@ -1150,6 +1158,42 @@ def execute(self, context): return {'FINISHED'} +class PasteIntoAptSrc(CopyToOtherBase): + bl_idname = "maplus.pasteintoaptsrc" + bl_label = "Paste into this item" + bl_description = "Pastes from the internal clipboard into this item" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('INTERNALCLIPBOARD', 'APTSRC') + + +class CopyFromAptSrc(CopyToOtherBase): + bl_idname = "maplus.copyfromaptsrc" + bl_label = "Copy from this item" + bl_description = "Copies this item into the internal clipboard" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('APTSRC', 'INTERNALCLIPBOARD') + + +class PasteIntoAptDest(CopyToOtherBase): + bl_idname = "maplus.pasteintoaptdest" + bl_label = "Paste into this item" + bl_description = "Pastes from the internal clipboard into this item" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('INTERNALCLIPBOARD', 'APTDEST') + + +class CopyFromAptDest(CopyToOtherBase): + bl_idname = "maplus.copyfromaptdest" + bl_label = "Copy from this item" + bl_description = "Copies this item into the internal clipboard" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('APTDEST', 'INTERNALCLIPBOARD') + + class DuplicateItemBase(bpy.types.Operator): bl_idname = "maplus.duplicateitembase" bl_label = "Duplicate Item" @@ -8313,6 +8357,17 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) + special_grabs = apt_src_geom_editor.row(align=True) + special_grabs.operator( + "maplus.copyfromaptsrc", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs.operator( + "maplus.pasteintoaptsrc", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) modifier_header = apt_src_geom_editor.row() modifier_header.label("Point Modifiers:") @@ -8458,7 +8513,18 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) - + special_grabs = apt_dest_geom_editor.row(align=True) + special_grabs.operator( + "maplus.copyfromaptdest", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs.operator( + "maplus.pasteintoaptdest", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) + modifier_header = apt_dest_geom_editor.row() modifier_header.label("Point Modifiers:") apply_mods = modifier_header.row() From d3c0b5b53c19d7254653a18344bdd11ed2b33ac6 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Thu, 23 Mar 2017 10:48:01 -0400 Subject: [PATCH 26/56] Finished initial copy/paste implementation for calc panel/quick tools. --- mesh_mesh_align_plus.py | 362 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 334 insertions(+), 28 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index adea10c..bbdace3 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -1107,28 +1107,94 @@ class CopyToOtherBase(bpy.types.Operator): def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list + + # Safely set active advanced tools item values...both the item and the + # kind are needed to set mapping values, so dummy values are used if + # the prims collections is empty (avoids access exceptions) advanced_tools_active_item = None + active_kind = 'POINT' if 'ADVTOOLSACTIVE' in self.source_dest_pair: if len(prims) < 1: - self.report({'ERROR'}, 'No stored geometry items exist to copy.') + self.report( + {'ERROR'}, + 'No stored geometry items exist to copy.' + ) return {'CANCELLED'} advanced_tools_active_item = prims[addon_data.active_list_item] + active_kind = advanced_tools_active_item.kind string_to_target_mappings = { - 'APTSRC': addon_data.quick_align_pts_src, - 'APTDEST': addon_data.quick_align_pts_dest, - 'ALNSRC': addon_data.quick_align_lines_src, - 'ALNDEST': addon_data.quick_align_lines_dest, - 'APLSRC': addon_data.quick_align_planes_src, - 'APLDEST': addon_data.quick_align_planes_dest, - 'AXRSRC': addon_data.quick_axis_rotate_src, - 'DSSRC': addon_data.quick_directional_slide_src, - 'SMESRC': addon_data.quick_scale_match_edge_src, - 'SMEDEST': addon_data.quick_scale_match_edge_dest, - 'ADVTOOLSACTIVE': advanced_tools_active_item, - 'INTERNALCLIPBOARD': addon_data.internal_storage_clipboard, - 'SLOT1': addon_data.internal_storage_slot_1, - 'SLOT2': addon_data.internal_storage_slot_2 + 'APTSRC': { + "item": addon_data.quick_align_pts_src, + "geom_mode": 'POINT', + }, + 'APTDEST': { + "item": addon_data.quick_align_pts_dest, + "geom_mode": 'POINT', + }, + 'ALNSRC': { + "item": addon_data.quick_align_lines_src, + "geom_mode": 'LINE', + }, + 'ALNDEST': { + "item": addon_data.quick_align_lines_dest, + "geom_mode": 'LINE', + }, + 'APLSRC': { + "item": addon_data.quick_align_planes_src, + "geom_mode": 'PLANE', + }, + 'APLDEST': { + "item": addon_data.quick_align_planes_dest, + "geom_mode": 'PLANE', + }, + 'AXRSRC': { + "item": addon_data.quick_axis_rotate_src, + "geom_mode": 'LINE', + }, + 'DSSRC': { + "item": addon_data.quick_directional_slide_src, + "geom_mode": 'LINE', + }, + 'SMESRC': { + "item": addon_data.quick_scale_match_edge_src, + "geom_mode": 'LINE', + }, + 'SMEDEST': { + "item": addon_data.quick_scale_match_edge_dest, + "geom_mode": 'LINE', + }, + 'ADVTOOLSACTIVE': { + "item": advanced_tools_active_item, + "geom_mode": active_kind, + }, + 'INTERNALCLIPBOARD': { + "item": addon_data.internal_storage_clipboard, + "geom_mode": ( + addon_data.internal_storage_clipboard.kind if + addon_data.internal_storage_clipboard.kind in + ['POINT', 'LINE', 'PLANE'] else + 'POINT' + ), + }, + 'SLOT1': { + "item": addon_data.internal_storage_slot_1, + "geom_mode": ( + addon_data.internal_storage_slot_1.kind if + addon_data.internal_storage_slot_1.kind in + ['POINT', 'LINE', 'PLANE'] else + 'POINT' + ), + }, + 'SLOT2': { + "item": addon_data.internal_storage_slot_2, + "geom_mode": ( + addon_data.internal_storage_slot_2.kind if + addon_data.internal_storage_slot_2.kind in + ['POINT', 'LINE', 'PLANE'] else + 'POINT' + ), + } } set_attribs = { "POINT": ( @@ -1153,7 +1219,16 @@ def execute(self, context): source = string_to_target_mappings[self.source_dest_pair[0]] dest = string_to_target_mappings[self.source_dest_pair[1]] - copy_source_attribs_to_dest(source, dest, set_attribs[source.kind]) + # If internal storage is the destination, the kind needs to be set + # to the proper value + if self.source_dest_pair[1] in ['INTERNALCLIPBOARD', 'SLOT1', 'SLOT2']: + dest["item"].kind = source["geom_mode"] + + copy_source_attribs_to_dest( + source["item"], + dest["item"], + set_attribs[source["geom_mode"]] + ) return {'FINISHED'} @@ -1194,6 +1269,150 @@ class CopyFromAptDest(CopyToOtherBase): source_dest_pair = ('APTDEST', 'INTERNALCLIPBOARD') +class PasteIntoAlnSrc(CopyToOtherBase): + bl_idname = "maplus.pasteintoalnsrc" + bl_label = "Paste into this item" + bl_description = "Pastes from the internal clipboard into this item" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('INTERNALCLIPBOARD', 'ALNSRC') + + +class CopyFromAlnSrc(CopyToOtherBase): + bl_idname = "maplus.copyfromalnsrc" + bl_label = "Copy from this item" + bl_description = "Copies this item into the internal clipboard" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('ALNSRC', 'INTERNALCLIPBOARD') + + +class PasteIntoAlnDest(CopyToOtherBase): + bl_idname = "maplus.pasteintoalndest" + bl_label = "Paste into this item" + bl_description = "Pastes from the internal clipboard into this item" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('INTERNALCLIPBOARD', 'ALNDEST') + + +class CopyFromAlnDest(CopyToOtherBase): + bl_idname = "maplus.copyfromalndest" + bl_label = "Copy from this item" + bl_description = "Copies this item into the internal clipboard" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('ALNDEST', 'INTERNALCLIPBOARD') + + +class PasteIntoAplSrc(CopyToOtherBase): + bl_idname = "maplus.pasteintoaplsrc" + bl_label = "Paste into this item" + bl_description = "Pastes from the internal clipboard into this item" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('INTERNALCLIPBOARD', 'APLSRC') + + +class CopyFromAplSrc(CopyToOtherBase): + bl_idname = "maplus.copyfromaplsrc" + bl_label = "Copy from this item" + bl_description = "Copies this item into the internal clipboard" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('APLSRC', 'INTERNALCLIPBOARD') + + +class PasteIntoAplDest(CopyToOtherBase): + bl_idname = "maplus.pasteintoapldest" + bl_label = "Paste into this item" + bl_description = "Pastes from the internal clipboard into this item" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('INTERNALCLIPBOARD', 'APLDEST') + + +class CopyFromAplDest(CopyToOtherBase): + bl_idname = "maplus.copyfromapldest" + bl_label = "Copy from this item" + bl_description = "Copies this item into the internal clipboard" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('APLDEST', 'INTERNALCLIPBOARD') + + +class PasteIntoAxrSrc(CopyToOtherBase): + bl_idname = "maplus.pasteintoaxrsrc" + bl_label = "Paste into this item" + bl_description = "Pastes from the internal clipboard into this item" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('INTERNALCLIPBOARD', 'AXRSRC') + + +class CopyFromAxrSrc(CopyToOtherBase): + bl_idname = "maplus.copyfromaxrsrc" + bl_label = "Copy from this item" + bl_description = "Copies this item into the internal clipboard" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('AXRSRC', 'INTERNALCLIPBOARD') + + +class PasteIntoDsSrc(CopyToOtherBase): + bl_idname = "maplus.pasteintodssrc" + bl_label = "Paste into this item" + bl_description = "Pastes from the internal clipboard into this item" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('INTERNALCLIPBOARD', 'DSSRC') + + +class CopyFromDsSrc(CopyToOtherBase): + bl_idname = "maplus.copyfromdssrc" + bl_label = "Copy from this item" + bl_description = "Copies this item into the internal clipboard" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('DSSRC', 'INTERNALCLIPBOARD') + + +class PasteIntoSmeSrc(CopyToOtherBase): + bl_idname = "maplus.pasteintosmesrc" + bl_label = "Paste into this item" + bl_description = "Pastes from the internal clipboard into this item" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('INTERNALCLIPBOARD', 'SMESRC') + + +class CopyFromSmeSrc(CopyToOtherBase): + bl_idname = "maplus.copyfromsmesrc" + bl_label = "Copy from this item" + bl_description = "Copies this item into the internal clipboard" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('SMESRC', 'INTERNALCLIPBOARD') + + +class PasteIntoSmeDest(CopyToOtherBase): + bl_idname = "maplus.pasteintosmedest" + bl_label = "Paste into this item" + bl_description = "Pastes from the internal clipboard into this item" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('INTERNALCLIPBOARD', 'SMEDEST') + + +class CopyFromSmeDest(CopyToOtherBase): + bl_idname = "maplus.copyfromsmedest" + bl_label = "Copy from this item" + bl_description = "Copies this item into the internal clipboard" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('SMEDEST', 'INTERNALCLIPBOARD') + + class DuplicateItemBase(bpy.types.Operator): bl_idname = "maplus.duplicateitembase" bl_label = "Duplicate Item" @@ -8715,6 +8934,17 @@ def draw(self, context): icon='LAMP_HEMI', text="Grab Normal" ) + special_grabs_extra = aln_src_geom_editor.row(align=True) + special_grabs_extra.operator( + "maplus.copyfromalnsrc", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs_extra.operator( + "maplus.pasteintoalnsrc", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) modifier_header = aln_src_geom_editor.row() modifier_header.label("Line Modifiers:") @@ -8961,13 +9191,23 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) - special_grabs = aln_dest_geom_editor.row(align=True) special_grabs.operator( "maplus.quickalngrabnormaldest", icon='LAMP_HEMI', text="Grab Normal" ) + special_grabs_extra = aln_dest_geom_editor.row(align=True) + special_grabs_extra.operator( + "maplus.copyfromalndest", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs_extra.operator( + "maplus.pasteintoalndest", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) modifier_header = aln_dest_geom_editor.row() modifier_header.label("Line Modifiers:") @@ -9199,23 +9439,23 @@ def draw(self, context): if not addon_data.quick_align_planes_auto_grab_src: if not addon_data.quick_apl_show_src_geom: apl_src_geom_top.operator( - "maplus.showhidequickaplsrcgeom", - icon='TRIA_RIGHT', - text="", - emboss=False + "maplus.showhidequickaplsrcgeom", + icon='TRIA_RIGHT', + text="", + emboss=False ) preserve_button_roundedge = apl_src_geom_top.row() preserve_button_roundedge.operator( - "maplus.quickalignplanesgrabsrc", - icon='WORLD', - text="Grab Source" + "maplus.quickalignplanesgrabsrc", + icon='WORLD', + text="Grab Source" ) else: apl_src_geom_top.operator( - "maplus.showhidequickaplsrcgeom", - icon='TRIA_DOWN', - text="", - emboss=False + "maplus.showhidequickaplsrcgeom", + icon='TRIA_DOWN', + text="", + emboss=False ) apl_src_geom_top.label("Source Coordinates") @@ -9231,6 +9471,17 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) + special_grabs = apl_src_geom_editor.row(align=True) + special_grabs.operator( + "maplus.copyfromaplsrc", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs.operator( + "maplus.pasteintoaplsrc", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) apl_src_geom_editor.label("Pt. A:") # plane_a_items = apl_src_geom_editor.split(percentage=.75) @@ -9538,6 +9789,17 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) + special_grabs = apl_dest_geom_editor.row(align=True) + special_grabs.operator( + "maplus.copyfromapldest", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs.operator( + "maplus.pasteintoapldest", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) apl_dest_geom_editor.label("Pt. A:") # plane_a_items = apl_dest_geom_editor.split(percentage=.75) @@ -9919,6 +10181,17 @@ def draw(self, context): icon='LAMP_HEMI', text="Grab Normal" ) + special_grabs_extra = axr_src_geom_editor.row(align=True) + special_grabs_extra.operator( + "maplus.copyfromaxrsrc", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs_extra.operator( + "maplus.pasteintoaxrsrc", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) modifier_header = axr_src_geom_editor.row() modifier_header.label("Line Modifiers:") @@ -10222,6 +10495,17 @@ def draw(self, context): icon='LAMP_HEMI', text="Grab Normal" ) + special_grabs_extra = ds_src_geom_editor.row(align=True) + special_grabs_extra.operator( + "maplus.copyfromdssrc", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs_extra.operator( + "maplus.pasteintodssrc", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) modifier_header = ds_src_geom_editor.row() modifier_header.label("Line Modifiers:") @@ -10532,6 +10816,17 @@ def draw(self, context): icon='LAMP_HEMI', text="Grab Normal" ) + special_grabs_extra = sme_src_geom_editor.row(align=True) + special_grabs_extra.operator( + "maplus.copyfromsmesrc", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs_extra.operator( + "maplus.pasteintosmesrc", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) modifier_header = sme_src_geom_editor.row() modifier_header.label("Line Modifiers:") @@ -10771,6 +11066,17 @@ def draw(self, context): icon='LAMP_HEMI', text="Grab Normal" ) + special_grabs_extra = sme_dest_geom_editor.row(align=True) + special_grabs_extra.operator( + "maplus.copyfromsmedest", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs_extra.operator( + "maplus.pasteintosmedest", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) modifier_header = sme_dest_geom_editor.row() modifier_header.label("Line Modifiers:") From 6c3929480523e18d5801b165bd38d95480e82b21 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Sat, 25 Mar 2017 16:26:57 -0400 Subject: [PATCH 27/56] Started geom editor work for quick calc slots. --- mesh_mesh_align_plus.py | 1201 +++++++++++++++++++++++++++++++-------- 1 file changed, 972 insertions(+), 229 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index bbdace3..57f92ec 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -558,6 +558,20 @@ class MAPlusData(bpy.types.PropertyGroup): ) # Quick Calculation items + quick_calc_show_slot1_geom = bpy.props.BoolProperty( + description=( + "Expand/collapse the slot 1 geometry editor" + " in the calculate/compose panel." + ), + default=False + ) + quick_calc_show_slot2_geom = bpy.props.BoolProperty( + description=( + "Expand/collapse the slot 2 geometry editor" + " in the calculate/compose panel." + ), + default=False + ) quick_calc_result_item = bpy.props.PointerProperty(type=MAPlusPrimitive) quick_calc_result_numeric = bpy.props.FloatProperty( description="Quick Calculation numeric result", @@ -912,10 +926,34 @@ def execute(self, context): addon_data.quick_apl_show_dest_geom = ( not addon_data.quick_apl_show_dest_geom ) + elif self.quick_op_target == "SLOT1": + addon_data.quick_calc_show_slot1_geom = ( + not addon_data.quick_calc_show_slot1_geom + ) + elif self.quick_op_target == "SLOT2": + addon_data.quick_calc_show_slot2_geom = ( + not addon_data.quick_calc_show_slot2_geom + ) return {'FINISHED'} +class ShowHideQuickCalcSlot1Geom(ShowHideQuickGeomBaseClass): + bl_idname = "maplus.showhidequickcalcslot1geom" + bl_label = "Show/hide slot 1 geometry" + bl_description = "Show/hide slot 1 geometry" + bl_options = {'REGISTER', 'UNDO'} + quick_op_target = 'SLOT1' + + +class ShowHideQuickCalcSlot2Geom(ShowHideQuickGeomBaseClass): + bl_idname = "maplus.showhidequickcalcslot2geom" + bl_label = "Show/hide slot 2 geometry" + bl_description = "Show/hide slot 2 geometry" + bl_options = {'REGISTER', 'UNDO'} + quick_op_target = 'SLOT2' + + class ShowHideQuickAptSrcGeom(ShowHideQuickGeomBaseClass): bl_idname = "maplus.showhidequickaptsrcgeom" bl_label = "Show/hide quick align points source geometry" @@ -1233,6 +1271,42 @@ def execute(self, context): return {'FINISHED'} +class PasteIntoSlot1(CopyToOtherBase): + bl_idname = "maplus.pasteintoslot1" + bl_label = "Paste into this item" + bl_description = "Pastes from the internal clipboard into this item" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('INTERNALCLIPBOARD', 'SLOT1') + + +class CopyFromSlot1(CopyToOtherBase): + bl_idname = "maplus.copyfromslot1" + bl_label = "Copy from this item" + bl_description = "Copies this item into the internal clipboard" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('SLOT1', 'INTERNALCLIPBOARD') + + +class PasteIntoSlot2(CopyToOtherBase): + bl_idname = "maplus.pasteintoslot2" + bl_label = "Paste into this item" + bl_description = "Pastes from the internal clipboard into this item" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('INTERNALCLIPBOARD', 'SLOT2') + + +class CopyFromSlot2(CopyToOtherBase): + bl_idname = "maplus.copyfromslot2" + bl_label = "Copy from this item" + bl_description = "Copies this item into the internal clipboard" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('SLOT2', 'INTERNALCLIPBOARD') + + class PasteIntoAptSrc(CopyToOtherBase): bl_idname = "maplus.pasteintoaptsrc" bl_label = "Paste into this item" @@ -1843,6 +1917,11 @@ def execute(self, context): elif self.quick_op_target == "APLDEST": active_item = addon_data.quick_align_planes_dest + elif self.quick_op_target == "SLOT1": + active_item = addon_data.internal_storage_slot_1 + elif self.quick_op_target == "SLOT2": + active_item = addon_data.internal_storage_slot_2 + matrix_multiplier = None if self.multiply_by_world_matrix: matrix_multiplier = bpy.context.active_object.matrix_world @@ -1971,6 +2050,10 @@ def execute(self, context): elif self.quick_op_target == "APLDEST": active_item = addon_data.quick_align_planes_dest + elif self.quick_op_target == "SLOT1": + active_item = addon_data.internal_storage_slot_1 + elif self.quick_op_target == "SLOT2": + active_item = addon_data.internal_storage_slot_2 matrix_multiplier = None if self.multiply_by_world_matrix: matrix_multiplier = bpy.context.active_object.matrix_world @@ -2029,6 +2112,11 @@ def execute(self, context): elif self.quick_op_target == "AXRSRC": active_item = addon_data.quick_axis_rotate_src + + elif self.quick_op_target == "SLOT1": + active_item = addon_data.internal_storage_slot_1 + elif self.quick_op_target == "SLOT2": + active_item = addon_data.internal_storage_slot_2 matrix_multiplier = None if self.multiply_by_world_matrix: @@ -2094,6 +2182,11 @@ def execute(self, context): active_item = addon_data.quick_align_planes_src elif self.quick_op_target == "APLDEST": active_item = addon_data.quick_align_planes_dest + + elif self.quick_op_target == "SLOT1": + active_item = addon_data.internal_storage_slot_1 + elif self.quick_op_target == "SLOT2": + active_item = addon_data.internal_storage_slot_2 else: active_item = prims[addon_data.active_list_item] @@ -2143,6 +2236,12 @@ def execute(self, context): active_item = addon_data.quick_align_planes_src elif self.quick_op_target == "APLDEST": active_item = addon_data.quick_align_planes_dest + + elif self.quick_op_target == "SLOT1": + active_item = addon_data.internal_storage_slot_1 + elif self.quick_op_target == "SLOT2": + active_item = addon_data.internal_storage_slot_2 + else: active_item = prims[addon_data.active_list_item] @@ -2164,6 +2263,17 @@ class GrabAllSlot1(GrabAndSetItemKindBase): target = 'SLOT1' +class GrabAllSlot1Loc(GrabAndSetItemKindBase): + bl_idname = "maplus.graballslot1loc" + bl_label = "Grab Global Coordinates From Selected Vertices" + bl_description = ( + "Grabs global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + multiply_by_world_matrix = False + target = 'SLOT1' + + class GrabAllSlot2(GrabAndSetItemKindBase): bl_idname = "maplus.graballslot2" bl_label = "Grab Global Coordinates From Selected Vertices" @@ -2175,6 +2285,17 @@ class GrabAllSlot2(GrabAndSetItemKindBase): target = 'SLOT2' +class GrabAllSlot2Loc(GrabAndSetItemKindBase): + bl_idname = "maplus.graballslot2loc" + bl_label = "Grab Global Coordinates From Selected Vertices" + bl_description = ( + "Grabs global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + multiply_by_world_matrix = False + target = 'SLOT2' + + class GrabPointFromCursor(GrabFromCursorBase): bl_idname = "maplus.grabpointfromcursor" bl_label = "Grab From Cursor" @@ -2183,6 +2304,24 @@ class GrabPointFromCursor(GrabFromCursorBase): vert_attrib_to_set = 'point' +class Slot1GrabPointFromCursor(GrabFromCursorBase): + bl_idname = "maplus.slot1grabpointfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'point' + quick_op_target = "SLOT1" + + +class Slot2GrabPointFromCursor(GrabFromCursorBase): + bl_idname = "maplus.slot2grabpointfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'point' + quick_op_target = "SLOT2" + + class QuickAptSrcGrabPointFromCursor(GrabFromCursorBase): bl_idname = "maplus.quickaptsrcgrabpointfromcursor" bl_label = "Grab From Cursor" @@ -2223,6 +2362,78 @@ class GrabPointFromActiveGlobal(GrabFromGeometryBase): multiply_by_world_matrix = True +class GrabPointSlot1(GrabFromGeometryBase): + bl_idname = "maplus.grabpointslot1" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('point',) + multiply_by_world_matrix = True + quick_op_target = "SLOT1" + + +class GrabPointSlot1Loc(GrabFromGeometryBase): + bl_idname = "maplus.grabpointslot1loc" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('point',) + multiply_by_world_matrix = False + quick_op_target = "SLOT1" + + +class GrabPointSlot2(GrabFromGeometryBase): + bl_idname = "maplus.grabpointslot2" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('point',) + multiply_by_world_matrix = True + quick_op_target = "SLOT2" + + +class GrabPointSlot2Loc(GrabFromGeometryBase): + bl_idname = "maplus.grabpointslot2loc" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('point',) + multiply_by_world_matrix = False + quick_op_target = "SLOT2" + + +class Slot1PointGrabAvg(GrabAverageLocationBase): + bl_idname = "maplus.slot1pointgrabavg" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('point',) + multiply_by_world_matrix = True + quick_op_target = "SLOT1" + + +class Slot2PointGrabAvg(GrabAverageLocationBase): + bl_idname = "maplus.slot2pointgrabavg" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('point',) + multiply_by_world_matrix = True + quick_op_target = "SLOT2" + + class QuickAptGrabAvgSrc(GrabAverageLocationBase): bl_idname = "maplus.quickaptgrabavgsrc" bl_label = "Grab Average Global Coordinates From Selected Points" @@ -2303,6 +2514,24 @@ class SendPointToCursor(SendCoordToCursorBase): source_coord_attrib = 'point' +class Slot1SendPointToCursor(SendCoordToCursorBase): + bl_idname = "maplus.slot1sendpointtocursor" + bl_label = "Sends Point to Cursor" + bl_description = "Sends Point Coordinates to the 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'point' + quick_op_target = 'SLOT1' + + +class Slot2SendPointToCursor(SendCoordToCursorBase): + bl_idname = "maplus.slot2sendpointtocursor" + bl_label = "Sends Point to Cursor" + bl_description = "Sends Point Coordinates to the 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'point' + quick_op_target = 'SLOT2' + + class QuickAptSrcSendPointToCursor(SendCoordToCursorBase): bl_idname = "maplus.quickaptsrcsendpointtocursor" bl_label = "Sends Point to Cursor" @@ -2329,6 +2558,42 @@ class GrabLineStartFromCursor(GrabFromCursorBase): vert_attrib_to_set = 'line_start' +class Slot1GrabLineStartFromCursor(GrabFromCursorBase): + bl_idname = "maplus.slot1grablinestartfromcursor" + bl_label = "Grab Line Start From Cursor" + bl_description = "Grabs line start coordinates from the 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_start' + quick_op_target = 'SLOT1' + + +class Slot1GrabLineEndFromCursor(GrabFromCursorBase): + bl_idname = "maplus.slot1grablineendfromcursor" + bl_label = "Grab Line Start From Cursor" + bl_description = "Grabs line start coordinates from the 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_end' + quick_op_target = 'SLOT1' + + +class Slot2GrabLineStartFromCursor(GrabFromCursorBase): + bl_idname = "maplus.slot2grablinestartfromcursor" + bl_label = "Grab Line Start From Cursor" + bl_description = "Grabs line start coordinates from the 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_start' + quick_op_target = 'SLOT2' + + +class Slot2GrabLineEndFromCursor(GrabFromCursorBase): + bl_idname = "maplus.slot2grablineendfromcursor" + bl_label = "Grab Line Start From Cursor" + bl_description = "Grabs line start coordinates from the 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_end' + quick_op_target = 'SLOT2' + + class QuickAlnSrcGrabLineStartFromCursor(GrabFromCursorBase): bl_idname = "maplus.quickalnsrcgrablinestartfromcursor" bl_label = "Grab Line Start From Cursor" @@ -2416,104 +2681,112 @@ class GrabLineStartFromActiveGlobal(GrabFromGeometryBase): multiply_by_world_matrix = True -class QuickAlnGrabAvgSrcLineStart(GrabAverageLocationBase): - bl_idname = "maplus.quickalngrabavgsrclinestart" - bl_label = "Grab Average Global Coordinates From Selected Points" +class Slot1GrabLineStartFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.slot1grablinestartfromactivelocal" + bl_label = "Grab Local Coordinate for Line Start From Active Point" bl_description = ( - "Grabs average global coordinates from selected vertices in edit mode" + "Grabs local coordinates for line start from selected vertex" + "in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_start',) - multiply_by_world_matrix = True - quick_op_target = "ALNSRC" + multiply_by_world_matrix = False + quick_op_target = 'SLOT1' -class QuickAlnGrabAvgDestLineStart(GrabAverageLocationBase): - bl_idname = "maplus.quickalngrabavgdestlinestart" - bl_label = "Grab Average Global Coordinates From Selected Points" +class Slot1GrabLineEndFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.slot1grablineendfromactivelocal" + bl_label = "Grab Local Coordinate for Line Start From Active Point" bl_description = ( - "Grabs average global coordinates from selected vertices in edit mode" + "Grabs local coordinates for line start from selected vertex" + "in edit mode" ) bl_options = {'REGISTER', 'UNDO'} - vert_attribs_to_set = ('line_start',) - multiply_by_world_matrix = True - quick_op_target = "ALNDEST" + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = False + quick_op_target = 'SLOT1' -class QuickAlnGrabAvgSrcLineEnd(GrabAverageLocationBase): - bl_idname = "maplus.quickalngrabavgsrclineend" - bl_label = "Grab Average Global Coordinates From Selected Points" +class Slot2GrabLineEndFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.slot2grablineendfromactivelocal" + bl_label = "Grab Local Coordinate for Line Start From Active Point" bl_description = ( - "Grabs average global coordinates from selected vertices in edit mode" + "Grabs local coordinates for line start from selected vertex" + "in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_end',) - multiply_by_world_matrix = True - quick_op_target = "ALNSRC" + multiply_by_world_matrix = False + quick_op_target = 'SLOT2' -class QuickAlnGrabAvgDestLineEnd(GrabAverageLocationBase): - bl_idname = "maplus.quickalngrabavgdestlineend" - bl_label = "Grab Average Global Coordinates From Selected Points" +class Slot1GrabLineEndFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.slot1grablineendfromactiveglobal" + bl_label = "Grab Local Coordinate for Line Start From Active Point" bl_description = ( - "Grabs average global coordinates from selected vertices in edit mode" + "Grabs local coordinates for line start from selected vertex" + "in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_end',) multiply_by_world_matrix = True - quick_op_target = "ALNDEST" + quick_op_target = 'SLOT1' -class QuickAxrGrabAvgSrcLineStart(GrabAverageLocationBase): - bl_idname = "maplus.quickaxrgrabavgsrclinestart" - bl_label = "Grab Average Global Coordinates From Selected Points" +class Slot2GrabLineEndFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.slot2grablineendfromactiveglobal" + bl_label = "Grab Local Coordinate for Line Start From Active Point" bl_description = ( - "Grabs average global coordinates from selected vertices in edit mode" + "Grabs local coordinates for line start from selected vertex" + "in edit mode" ) bl_options = {'REGISTER', 'UNDO'} - vert_attribs_to_set = ('line_start',) + vert_attribs_to_set = ('line_end',) multiply_by_world_matrix = True - quick_op_target = "AXRSRC" + quick_op_target = 'SLOT2' -class QuickAxrGrabAvgSrcLineEnd(GrabAverageLocationBase): - bl_idname = "maplus.quickaxrgrabavgsrclineend" - bl_label = "Grab Average Global Coordinates From Selected Points" +class Slot1GrabLineStartFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.slot1grablinestartfromactiveglobal" + bl_label = "Grab Local Coordinate for Line Start From Active Point" bl_description = ( - "Grabs average global coordinates from selected vertices in edit mode" + "Grabs local coordinates for line start from selected vertex" + "in edit mode" ) bl_options = {'REGISTER', 'UNDO'} - vert_attribs_to_set = ('line_end',) + vert_attribs_to_set = ('line_start',) multiply_by_world_matrix = True - quick_op_target = "AXRSRC" + quick_op_target = 'SLOT1' -class QuickDsGrabAvgSrcLineStart(GrabAverageLocationBase): - bl_idname = "maplus.quickdsgrabavgsrclinestart" - bl_label = "Grab Average Global Coordinates From Selected Points" +class Slot2GrabLineStartFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.slot2grablinestartfromactivelocal" + bl_label = "Grab Local Coordinate for Line Start From Active Point" bl_description = ( - "Grabs average global coordinates from selected vertices in edit mode" + "Grabs local coordinates for line start from selected vertex" + "in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_start',) - multiply_by_world_matrix = True - quick_op_target = "DSSRC" + multiply_by_world_matrix = False + quick_op_target = 'SLOT2' -class QuickDsGrabAvgSrcLineEnd(GrabAverageLocationBase): - bl_idname = "maplus.quickdsgrabavgsrclineend" - bl_label = "Grab Average Global Coordinates From Selected Points" +class Slot2GrabLineStartFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.slot2grablinestartfromactiveglobal" + bl_label = "Grab Local Coordinate for Line Start From Active Point" bl_description = ( - "Grabs average global coordinates from selected vertices in edit mode" + "Grabs local coordinates for line start from selected vertex" + "in edit mode" ) bl_options = {'REGISTER', 'UNDO'} - vert_attribs_to_set = ('line_end',) + vert_attribs_to_set = ('line_start',) multiply_by_world_matrix = True - quick_op_target = "DSSRC" + quick_op_target = 'SLOT2' -class QuickSmeGrabAvgSrcLineStart(GrabAverageLocationBase): - bl_idname = "maplus.quicksmegrabavgsrclinestart" +class Slot1GrabAvgLineStart(GrabAverageLocationBase): + bl_idname = "maplus.slot1grabavglinestart" bl_label = "Grab Average Global Coordinates From Selected Points" bl_description = ( "Grabs average global coordinates from selected vertices in edit mode" @@ -2521,11 +2794,11 @@ class QuickSmeGrabAvgSrcLineStart(GrabAverageLocationBase): bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_start',) multiply_by_world_matrix = True - quick_op_target = "SMESRC" + quick_op_target = "SLOT1" -class QuickSmeGrabAvgDestLineStart(GrabAverageLocationBase): - bl_idname = "maplus.quicksmegrabavgdestlinestart" +class Slot2GrabAvgLineStart(GrabAverageLocationBase): + bl_idname = "maplus.slot2grabavglinestart" bl_label = "Grab Average Global Coordinates From Selected Points" bl_description = ( "Grabs average global coordinates from selected vertices in edit mode" @@ -2533,11 +2806,11 @@ class QuickSmeGrabAvgDestLineStart(GrabAverageLocationBase): bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_start',) multiply_by_world_matrix = True - quick_op_target = "SMEDEST" + quick_op_target = "SLOT2" -class QuickSmeGrabAvgSrcLineEnd(GrabAverageLocationBase): - bl_idname = "maplus.quicksmegrabavgsrclineend" +class Slot1GrabAvgLineEnd(GrabAverageLocationBase): + bl_idname = "maplus.slot1grabavglineend" bl_label = "Grab Average Global Coordinates From Selected Points" bl_description = ( "Grabs average global coordinates from selected vertices in edit mode" @@ -2545,11 +2818,11 @@ class QuickSmeGrabAvgSrcLineEnd(GrabAverageLocationBase): bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_end',) multiply_by_world_matrix = True - quick_op_target = "SMESRC" + quick_op_target = "SLOT1" -class QuickSmeGrabAvgDestLineEnd(GrabAverageLocationBase): - bl_idname = "maplus.quicksmegrabavgdestlineend" +class Slot2GrabAvgLineEnd(GrabAverageLocationBase): + bl_idname = "maplus.slot2grabavglineend" bl_label = "Grab Average Global Coordinates From Selected Points" bl_description = ( "Grabs average global coordinates from selected vertices in edit mode" @@ -2557,7 +2830,151 @@ class QuickSmeGrabAvgDestLineEnd(GrabAverageLocationBase): bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_end',) multiply_by_world_matrix = True - quick_op_target = "SMEDEST" + quick_op_target = "SLOT2" + + +class QuickAlnGrabAvgSrcLineStart(GrabAverageLocationBase): + bl_idname = "maplus.quickalngrabavgsrclinestart" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = "ALNSRC" + + +class QuickAlnGrabAvgDestLineStart(GrabAverageLocationBase): + bl_idname = "maplus.quickalngrabavgdestlinestart" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = "ALNDEST" + + +class QuickAlnGrabAvgSrcLineEnd(GrabAverageLocationBase): + bl_idname = "maplus.quickalngrabavgsrclineend" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = "ALNSRC" + + +class QuickAlnGrabAvgDestLineEnd(GrabAverageLocationBase): + bl_idname = "maplus.quickalngrabavgdestlineend" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = "ALNDEST" + + +class QuickAxrGrabAvgSrcLineStart(GrabAverageLocationBase): + bl_idname = "maplus.quickaxrgrabavgsrclinestart" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = "AXRSRC" + + +class QuickAxrGrabAvgSrcLineEnd(GrabAverageLocationBase): + bl_idname = "maplus.quickaxrgrabavgsrclineend" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = "AXRSRC" + + +class QuickDsGrabAvgSrcLineStart(GrabAverageLocationBase): + bl_idname = "maplus.quickdsgrabavgsrclinestart" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = "DSSRC" + + +class QuickDsGrabAvgSrcLineEnd(GrabAverageLocationBase): + bl_idname = "maplus.quickdsgrabavgsrclineend" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = "DSSRC" + + +class QuickSmeGrabAvgSrcLineStart(GrabAverageLocationBase): + bl_idname = "maplus.quicksmegrabavgsrclinestart" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = "SMESRC" + + +class QuickSmeGrabAvgDestLineStart(GrabAverageLocationBase): + bl_idname = "maplus.quicksmegrabavgdestlinestart" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = "SMEDEST" + + +class QuickSmeGrabAvgSrcLineEnd(GrabAverageLocationBase): + bl_idname = "maplus.quicksmegrabavgsrclineend" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = "SMESRC" + + +class QuickSmeGrabAvgDestLineEnd(GrabAverageLocationBase): + bl_idname = "maplus.quicksmegrabavgdestlineend" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = "SMEDEST" class QuickAlnSrcGrabLineStartFromActiveLocal(GrabFromGeometryBase): @@ -2750,6 +3167,42 @@ class SendLineStartToCursor(SendCoordToCursorBase): source_coord_attrib = 'line_start' +class Slot1SendLineStartToCursor(SendCoordToCursorBase): + bl_idname = "maplus.slot1sendlinestarttocursor" + bl_label = "Sends Line Start to Cursor" + bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_start' + quick_op_target = 'SLOT1' + + +class Slot1SendLineEndToCursor(SendCoordToCursorBase): + bl_idname = "maplus.slot1sendlineendtocursor" + bl_label = "Sends Line Start to Cursor" + bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_end' + quick_op_target = 'SLOT1' + + +class Slot2SendLineStartToCursor(SendCoordToCursorBase): + bl_idname = "maplus.slot2sendlinestarttocursor" + bl_label = "Sends Line Start to Cursor" + bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_start' + quick_op_target = 'SLOT2' + + +class Slot2SendLineEndToCursor(SendCoordToCursorBase): + bl_idname = "maplus.slot2sendlineendtocursor" + bl_label = "Sends Line Start to Cursor" + bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_end' + quick_op_target = 'SLOT2' + + class QuickAlnSrcSendLineStartToCursor(SendCoordToCursorBase): bl_idname = "maplus.quickalnsrcsendlinestarttocursor" bl_label = "Sends Line Start to Cursor" @@ -3179,6 +3632,78 @@ class GrabAllVertsLineGlobal(GrabFromGeometryBase): multiply_by_world_matrix = True +class GrabLineSlot1(GrabFromGeometryBase): + bl_idname = "maplus.grablineslot1" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = True + quick_op_target = "SLOT1" + + +class GrabLineSlot1Loc(GrabFromGeometryBase): + bl_idname = "maplus.grablineslot1loc" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = False + quick_op_target = "SLOT1" + + +class GrabLineSlot2(GrabFromGeometryBase): + bl_idname = "maplus.grablineslot2" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = True + quick_op_target = "SLOT2" + + +class GrabLineSlot2Loc(GrabFromGeometryBase): + bl_idname = "maplus.grablineslot2loc" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = False + quick_op_target = "SLOT2" + + +class Slot1GrabNormal(GrabNormalBase): + bl_idname = "maplus.slot1grabnormal" + bl_label = "Grab Normal Coords from Selected Face" + bl_description = ( + "Grabs normal coordinates from selected face in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = True + quick_op_target = "SLOT1" + + +class Slot2GrabNormal(GrabNormalBase): + bl_idname = "maplus.slot2grabnormal" + bl_label = "Grab Normal Coords from Selected Face" + bl_description = ( + "Grabs normal coordinates from selected face in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = True + quick_op_target = "SLOT2" + + class QuickAlnGrabNormalSrc(GrabNormalBase): bl_idname = "maplus.quickalngrabnormalsrc" bl_label = "Grab Normal Coords from Selected Face" @@ -3936,6 +4461,11 @@ def execute(self, context): active_item = addon_data.quick_align_planes_src elif self.quick_op_target == "APLDEST": active_item = addon_data.quick_align_planes_dest + + elif self.quick_op_target == "SLOT1": + active_item = addon_data.internal_storage_slot_1 + elif self.quick_op_target == "SLOT2": + active_item = addon_data.internal_storage_slot_2 else: active_item = prims[addon_data.active_list_item] @@ -3973,6 +4503,24 @@ class SwapLinePoints(SwapPointsBase): targets = ('line_start', 'line_end') +class Slot1SwapLinePoints(SwapPointsBase): + bl_idname = "maplus.slot1swaplinepoints" + bl_label = "Swap Line Points" + bl_description = "Swap line points" + bl_options = {'REGISTER', 'UNDO'} + targets = ('line_start', 'line_end') + quick_op_target = 'SLOT1' + + +class Slot2SwapLinePoints(SwapPointsBase): + bl_idname = "maplus.slot2swaplinepoints" + bl_label = "Swap Line Points" + bl_description = "Swap line points" + bl_options = {'REGISTER', 'UNDO'} + targets = ('line_start', 'line_end') + quick_op_target = 'SLOT2' + + class QuickAlnSrcSwapLinePoints(SwapPointsBase): bl_idname = "maplus.quickalnsrcswaplinepoints" bl_label = "Swap Line Points" @@ -11296,30 +11844,371 @@ def draw(self, context): addon_data = bpy.context.scene.maplus_data calc_gui = layout.column() - - calc_gui.operator( - "maplus.graballslot1", - icon='WORLD', - text="Grab Slot 1" - ) - calc_gui.operator( - "maplus.graballslot2", - icon='WORLD', - text="Grab Slot 2" - ) - calc_gui.separator() - calcs_and_results_header = calc_gui.row() - calcs_and_results_header.label( - "Result:" - ) - clipboard_row_right = calcs_and_results_header.row() - clipboard_row_right.alignment = 'RIGHT' - clipboard_row_right.prop( - bpy.types.AnyType(maplus_data_ptr), - 'calc_result_to_clipboard', - "Copy to Clipboard" - ) + slot1_geom_top = calc_gui.row(align=True) + if not addon_data.quick_calc_show_slot1_geom: + slot1_geom_top.operator( + "maplus.showhidequickcalcslot1geom", + icon='TRIA_RIGHT', + text="", + emboss=False + ) + preserve_button_roundedge = slot1_geom_top.row() + preserve_button_roundedge.operator( + "maplus.graballslot1", + icon='WORLD', + text="Grab Slot 1" + ) + + else: + slot1_geom_top.operator( + "maplus.showhidequickcalcslot1geom", + icon='TRIA_DOWN', + text="", + emboss=False + ) + slot1_geom_top.label("Slot 1 Coordinates") + slot1_geom_editor = calc_gui.box() + types_row = slot1_geom_editor.row() + types_row.label("Item type:") + types_row.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_1), + 'kind', + "" + ) + + if addon_data.internal_storage_slot_1.kind == 'POINT': + pt_grab_all = slot1_geom_editor.row(align=True) + pt_grab_all.operator( + "maplus.grabpointslot1loc", + icon='VERTEXSEL', + text="Grab All Local" + ) + pt_grab_all.operator( + "maplus.grabpointslot1", + icon='WORLD', + text="Grab All Global" + ) + + modifier_header = slot1_geom_editor.row() + modifier_header.label("Point Modifiers:") + apply_mods = modifier_header.row() + apply_mods.alignment = 'RIGHT' + # apply_mods.operator( + # "maplus.applygeommodifiers", + # text="Apply ModifiersXXXXX" + # ) + item_mods_box = slot1_geom_editor.box() + mods_row_1 = item_mods_box.row() + mods_row_1.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_1), + 'pt_make_unit_vec', + "Set Length Equal to One" + ) + mods_row_1.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_1), + 'pt_flip_direction', + "Flip Direction" + ) + mods_row_2 = item_mods_box.row() + mods_row_2.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_1), + 'pt_multiplier', + "Multiplier" + ) + + slot1_geom_editor.label("Pt. Origin:") + # plane_a_items = slot1_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + pt_items = slot1_geom_editor.row() + typein_and_grab_pt = pt_items.column() + pt_uppers = typein_and_grab_pt.row() + + pt_uppers_leftside = pt_uppers.row(align=True) + pt_uppers_leftside.alignment = 'LEFT' + pt_uppers_leftside.label("Send:") + pt_uppers_leftside.operator( + "maplus.slot1sendpointtocursor", + icon='CURSOR', + text="" + ) + + pt_uppers_rightside = pt_uppers.row(align=True) + pt_uppers_rightside.alignment = 'RIGHT' + pt_uppers_rightside.label("Grab:") + pt_uppers_rightside.operator( + "maplus.slot1grabpointfromcursor", + icon='CURSOR', + text="" + ) + pt_uppers_rightside.operator( + "maplus.grabpointslot1loc", + icon='VERTEXSEL', + text="" + ) + pt_uppers_rightside.operator( + "maplus.grabpointslot1", + icon='WORLD', + text="" + ) + pt_uppers_rightside.operator( + "maplus.slot1pointgrabavg", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_pt.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_1), + 'point', + "" + ) + + elif addon_data.internal_storage_slot_1.kind == 'LINE': + ln_grab_all = slot1_geom_editor.row(align=True) + ln_grab_all.operator( + "maplus.grablineslot1loc", + icon='VERTEXSEL', + text="Grab All Local" + ) + ln_grab_all.operator( + "maplus.grablineslot1", + icon='WORLD', + text="Grab All Global" + ) + + special_grabs = slot1_geom_editor.row(align=True) + special_grabs.operator( + "maplus.slot1grabnormal", + icon='LAMP_HEMI', + text="Grab Normal" + ) + special_grabs_extra = slot1_geom_editor.row(align=True) + special_grabs_extra.operator( + "maplus.copyfromslot1", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs_extra.operator( + "maplus.pasteintoslot1", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) + + modifier_header = slot1_geom_editor.row() + modifier_header.label("Line Modifiers:") + apply_mods = modifier_header.row() + apply_mods.alignment = 'RIGHT' + # apply_mods.operator( + # "maplus.applygeommodifiers", + # text="Apply ModifiersXXXXX" + # ) + item_mods_box = slot1_geom_editor.box() + mods_row_1 = item_mods_box.row() + mods_row_1.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_1), + 'ln_make_unit_vec', + "Set Length Equal to One" + ) + mods_row_1.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_1), + 'ln_flip_direction', + "Flip Direction" + ) + mods_row_2 = item_mods_box.row() + mods_row_2.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_1), + 'ln_multiplier', + "Multiplier" + ) + + slot1_geom_editor.label("Start:") + # plane_a_items = axr_src_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_start_items = slot1_geom_editor.row() + typein_and_grab_start = ln_start_items.column() + ln_start_uppers = typein_and_grab_start.split(percentage=.33) + + ln_start_swap = ln_start_uppers.row(align=True) + ln_start_swap.label("Swap With:") + ln_start_swap.operator( + "maplus.slot1swaplinepoints", + text="End" + ) + + ln_start_uppers_rightside = ln_start_uppers.row(align=True) + ln_start_uppers_rightside.alignment = 'RIGHT' + ln_start_uppers_rightside.label("Send:") + ln_start_uppers_rightside.operator( + "maplus.slot1sendlinestarttocursor", + icon='CURSOR', + text="" + ) + + ln_start_uppers_rightside.label("Grab:") + ln_start_uppers_rightside.operator( + "maplus.slot1grablinestartfromcursor", + icon='CURSOR', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.slot1grablinestartfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.slot1grablinestartfromactiveglobal", + icon='WORLD', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.slot1grabavglinestart", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_start.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_1), + 'line_start', + "" + ) + + # component_changers_plna = plane_a_items.row() + # zero_components_plna = component_changers_plna.column( + # align=True + # ) + # zero_components_plna.label("Set Zeroes:") + # zero_components_plna.operator( + # "maplus.zerootherplanepointax", + # text="X00" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointay", + # text="0Y0" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointaz", + # text="00Z" + # ) + # one_components_plna = component_changers_plna.column( + # align=True + # ) + # one_components_plna.label("Set Ones:") + # one_components_plna.operator( + # "maplus.oneotherplanepointax", + # text="X11" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointay", + # text="1Y1" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointaz", + # text="11Z" + # ) + + slot1_geom_editor.label("End:") + # plane_a_items = slot1_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_end_items = slot1_geom_editor.row() + typein_and_grab_end = ln_end_items.column() + ln_end_uppers = typein_and_grab_end.split(percentage=.33) + + ln_end_swap = ln_end_uppers.row(align=True) + ln_end_swap.label("Swap With:") + ln_end_swap.operator( + "maplus.slot1swaplinepoints", + text="Start" + ) + + ln_end_uppers_rightside = ln_end_uppers.row(align=True) + ln_end_uppers_rightside.alignment = 'RIGHT' + ln_end_uppers_rightside.label("Send:") + ln_end_uppers_rightside.operator( + "maplus.slot1sendlineendtocursor", + icon='CURSOR', + text="" + ) + + ln_end_uppers_rightside.label("Grab:") + ln_end_uppers_rightside.operator( + "maplus.slot1grablineendfromcursor", + icon='CURSOR', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.slot1grablineendfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.slot1grablineendfromactiveglobal", + icon='WORLD', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.slot1grabavglineend", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_end.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_1), + 'line_end', + "" + ) + + # component_changers_plnc = plane_c_items.row() + # zero_components_plnc = component_changers_plnc.column( + # align=True + # ) + # zero_components_plnc.label("Set Zeroes:") + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcx", + # text="X00" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcy", + # text="0Y0" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcz", + # text="00Z" + # ) + # one_components_plnc = component_changers_plnc.column( + # align=True + # ) + # one_components_plnc.label("Set Ones:") + # one_components_plnc.operator( + # "maplus.oneotherplanepointcx", + # text="X11" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcy", + # text="1Y1" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcz", + # text="11Z" + # ) + + if addon_data.quick_calc_show_slot1_geom: + calc_gui.separator() + + calc_gui.operator( + "maplus.graballslot2", + icon='WORLD', + text="Grab Slot 2" + ) + calc_gui.separator() + + calcs_and_results_header = calc_gui.row() + calcs_and_results_header.label( + "Result:" + ) + clipboard_row_right = calcs_and_results_header.row() + clipboard_row_right.alignment = 'RIGHT' + clipboard_row_right.prop( + bpy.types.AnyType(maplus_data_ptr), + 'calc_result_to_clipboard', + "Copy to Clipboard" + ) calc_gui.prop( bpy.types.AnyType(bpy.types.AnyType(addon_data)), 'quick_calc_result_numeric', @@ -11380,152 +12269,6 @@ def draw(self, context): text="Intersect Line/Plane" ) - # slot1_geom_top = calc_gui.row(align=True) - # if not addon_data.quick_calc_show_slot1_geom: - # slot1_geom_top.operator( - # "maplus.showhidequickcalcslot1geom", - # icon='TRIA_RIGHT', - # text="", - # emboss=False - # ) - # preserve_button_roundedge = slot1_geom_top.row() - # preserve_button_roundedge.operator( - # "maplus.quickcalcgrabslot1", - # icon='WORLD', - # text="Grab Source" - # ) - - # else: - # slot1_geom_top.operator( - # "maplus.showhidequickcalcslot1geom", - # icon='TRIA_DOWN', - # text="", - # emboss=False - # ) - # slot1_geom_top.label("Slot 1 Coordinates") - - # if addon_data.quick_calc_result.kind == 'POINT': - # slot1_geom_editor = calc_gui.box() - # pt_grab_all = slot1_geom_editor.row(align=True) - # pt_grab_all.operator( - # "maplus.quickcalcgrabslot1loc", - # icon='VERTEXSEL', - # text="Grab All Local" - # ) - # pt_grab_all.operator( - # "maplus.quickcalcgrabslot1", - # icon='WORLD', - # text="Grab All Global" - # ) - - # modifier_header = slot1_geom_editor.row() - # modifier_header.label("Point Modifiers:") - # apply_mods = modifier_header.row() - # apply_mods.alignment = 'RIGHT' - # # apply_mods.operator( - # # "maplus.applygeommodifiers", - # # text="Apply ModifiersXXXXX" - # # ) - # item_mods_box = slot1_geom_editor.box() - # mods_row_1 = item_mods_box.row() - # mods_row_1.prop( - # bpy.types.AnyType(addon_data.internal_storage_slot_1), - # 'pt_make_unit_vec', - # "Set Length Equal to One" - # ) - # mods_row_1.prop( - # bpy.types.AnyType(addon_data.internal_storage_slot_1), - # 'pt_flip_direction', - # "Flip Direction" - # ) - # mods_row_2 = item_mods_box.row() - # mods_row_2.prop( - # bpy.types.AnyType(addon_data.internal_storage_slot_1), - # 'pt_multiplier', - # "Multiplier" - # ) - - # slot1_geom_editor.label("Pt. Origin:") - # # plane_a_items = slot1_geom_editor.split(percentage=.75) - # # ^ line changed to remove component changers - # pt_items = slot1_geom_editor.row() - # typein_and_grab_pt = pt_items.column() - # pt_uppers = typein_and_grab_pt.row() - - # pt_uppers_leftside = pt_uppers.row(align=True) - # pt_uppers_leftside.alignment = 'LEFT' - # pt_uppers_leftside.label("Send:") - # pt_uppers_leftside.operator( - # "maplus.quickcalcslot1sendpointtocursor", - # icon='CURSOR', - # text="" - # ) - - # pt_uppers_rightside = pt_uppers.row(align=True) - # pt_uppers_rightside.alignment = 'RIGHT' - # pt_uppers_rightside.label("Grab:") - # pt_uppers_rightside.operator( - # "maplus.quickcalcslot1grabpointfromcursor", - # icon='CURSOR', - # text="" - # ) - # pt_uppers_rightside.operator( - # "maplus.quickcalcgrabslot1loc", - # icon='VERTEXSEL', - # text="" - # ) - # pt_uppers_rightside.operator( - # "maplus.quickcalcgrabslot1", - # icon='WORLD', - # text="" - # ) - # pt_uppers_rightside.operator( - # "maplus.quickcalcgrabavgslot1", - # icon='GROUP_VERTEX', - # text="" - # ) - # typein_and_grab_pt.prop( - # bpy.types.AnyType(addon_data.internal_storage_slot_1), - # 'point', - # "" - # ) - - # # component_changers_plna = plane_a_items.row() - # # zero_components_plna = component_changers_plna.column( - # # align=True - # # ) - # # zero_components_plna.label("Set Zeroes:") - # # zero_components_plna.operator( - # # "maplus.zerootherplanepointax", - # # text="X00" - # # ) - # # zero_components_plna.operator( - # # "maplus.zerootherplanepointay", - # # text="0Y0" - # # ) - # # zero_components_plna.operator( - # # "maplus.zerootherplanepointaz", - # # text="00Z" - # # ) - # # one_components_plna = component_changers_plna.column( - # # align=True - # # ) - # # one_components_plna.label("Set Ones:") - # # one_components_plna.operator( - # # "maplus.oneotherplanepointax", - # # text="X11" - # # ) - # # one_components_plna.operator( - # # "maplus.oneotherplanepointay", - # # text="1Y1" - # # ) - # # one_components_plna.operator( - # # "maplus.oneotherplanepointaz", - # # text="11Z" - # # ) - # if addon_data.quick_apt_show_src_geom: - # calc_gui.separator() - def specials_menu_items(self, context): self.layout.separator() From 868ab15354b42b83be10085acb087498cbdb2bc5 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Sat, 25 Mar 2017 17:32:09 -0400 Subject: [PATCH 28/56] Finished initial geom editing implementation on quick calc panel. --- mesh_mesh_align_plus.py | 1574 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 1454 insertions(+), 120 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 57f92ec..7ad38ec 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -3928,6 +3928,60 @@ class GrabPlaneAFromCursor(GrabFromCursorBase): vert_attrib_to_set = 'plane_pt_a' +class Slot1GrabPlaneAFromCursor(GrabFromCursorBase): + bl_idname = "maplus.slot1grabplaneafromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_a' + quick_op_target = 'SLOT1' + + +class Slot1GrabPlaneBFromCursor(GrabFromCursorBase): + bl_idname = "maplus.slot1grabplanebfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_b' + quick_op_target = 'SLOT1' + + +class Slot1GrabPlaneCFromCursor(GrabFromCursorBase): + bl_idname = "maplus.slot1grabplanecfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_c' + quick_op_target = 'SLOT1' + + +class Slot2GrabPlaneAFromCursor(GrabFromCursorBase): + bl_idname = "maplus.slot2grabplaneafromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_a' + quick_op_target = 'SLOT2' + + +class Slot2GrabPlaneBFromCursor(GrabFromCursorBase): + bl_idname = "maplus.slot2grabplanebfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_b' + quick_op_target = 'SLOT2' + + +class Slot2GrabPlaneCFromCursor(GrabFromCursorBase): + bl_idname = "maplus.slot2grabplanecfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_c' + quick_op_target = 'SLOT2' + + class QuickAplSrcGrabPlaneAFromCursor(GrabFromCursorBase): bl_idname = "maplus.quickaplsrcgrabplaneafromcursor" bl_label = "Grab From Cursor" @@ -3968,56 +4022,80 @@ class GrabPlaneAFromActiveGlobal(GrabFromGeometryBase): multiply_by_world_matrix = True -class QuickAplGrabAvgSrcPlaneA(GrabAverageLocationBase): - bl_idname = "maplus.quickaplgrabavgsrcplanea" - bl_label = "Grab Average Global Coordinates From Selected Points" +class Slot1GrabPlaneAFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.slot1grabplaneafromactivelocal" + bl_label = "Grab Local Coordinates From Active Point" bl_description = ( - "Grabs average global coordinates from selected vertices in edit mode" + "Grabs local coordinates from selected vertex in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('plane_pt_a',) - multiply_by_world_matrix = True - quick_op_target = "APLSRC" + multiply_by_world_matrix = False + quick_op_target = 'SLOT1' -class QuickAplGrabAvgDestPlaneA(GrabAverageLocationBase): - bl_idname = "maplus.quickaplgrabavgdestplanea" - bl_label = "Grab Average Global Coordinates From Selected Points" +class Slot1GrabPlaneAFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.slot1grabplaneafromactiveglobal" + bl_label = "Grab Local Coordinates From Active Point" bl_description = ( - "Grabs average global coordinates from selected vertices in edit mode" + "Grabs local coordinates from selected vertex in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('plane_pt_a',) multiply_by_world_matrix = True - quick_op_target = "APLDEST" + quick_op_target = 'SLOT1' -class QuickAplSrcGrabPlaneAFromActiveLocal(GrabFromGeometryBase): - bl_idname = "maplus.quickaplsrcgrabplaneafromactivelocal" +class Slot1GrabPlaneBFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.slot1grabplanebfromactivelocal" bl_label = "Grab Local Coordinates From Active Point" bl_description = ( "Grabs local coordinates from selected vertex in edit mode" ) bl_options = {'REGISTER', 'UNDO'} - vert_attribs_to_set = ('plane_pt_a',) + vert_attribs_to_set = ('plane_pt_b',) multiply_by_world_matrix = False - quick_op_target = 'APLSRC' + quick_op_target = 'SLOT1' -class QuickAplSrcGrabPlaneAFromActiveGlobal(GrabFromGeometryBase): - bl_idname = "maplus.quickaplsrcgrabplaneafromactiveglobal" - bl_label = "Grab Global Coordinates From Active Point" +class Slot1GrabPlaneBFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.slot1grabplanebfromactiveglobal" + bl_label = "Grab Local Coordinates From Active Point" bl_description = ( - "Grabs global coordinates from selected vertex in edit mode" + "Grabs local coordinates from selected vertex in edit mode" ) bl_options = {'REGISTER', 'UNDO'} - vert_attribs_to_set = ('plane_pt_a',) + vert_attribs_to_set = ('plane_pt_b',) multiply_by_world_matrix = True - quick_op_target = 'APLSRC' + quick_op_target = 'SLOT1' -class QuickAplDestGrabPlaneAFromActiveLocal(GrabFromGeometryBase): - bl_idname = "maplus.quickapldestgrabplaneafromactivelocal" +class Slot1GrabPlaneCFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.slot1grabplanecfromactivelocal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = False + quick_op_target = 'SLOT1' + + +class Slot1GrabPlaneCFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.slot1grabplanecfromactiveglobal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = True + quick_op_target = 'SLOT1' + + +class Slot2GrabPlaneAFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.slot2grabplaneafromactivelocal" bl_label = "Grab Local Coordinates From Active Point" bl_description = ( "Grabs local coordinates from selected vertex in edit mode" @@ -4025,97 +4103,119 @@ class QuickAplDestGrabPlaneAFromActiveLocal(GrabFromGeometryBase): bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('plane_pt_a',) multiply_by_world_matrix = False - quick_op_target = 'APLDEST' + quick_op_target = 'SLOT2' -class QuickAplDestGrabPlaneAFromActiveGlobal(GrabFromGeometryBase): - bl_idname = "maplus.quickapldestgrabplaneafromactiveglobal" - bl_label = "Grab Global Coordinates From Active Point" +class Slot2GrabPlaneAFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.slot2grabplaneafromactiveglobal" + bl_label = "Grab Local Coordinates From Active Point" bl_description = ( - "Grabs global coordinates from selected vertex in edit mode" + "Grabs local coordinates from selected vertex in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('plane_pt_a',) multiply_by_world_matrix = True - quick_op_target = 'APLDEST' + quick_op_target = 'SLOT2' -class SendPlaneAToCursor(SendCoordToCursorBase): - bl_idname = "maplus.sendplaneatocursor" - bl_label = "Sends Plane Point A to Cursor" - bl_description = "Sends Plane Point A Coordinates to 3D Cursor" +class Slot2GrabPlaneBFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.slot2grabplanebfromactivelocal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) bl_options = {'REGISTER', 'UNDO'} - source_coord_attrib = 'plane_pt_a' + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = False + quick_op_target = 'SLOT2' -class QuickAplSrcSendPlaneAToCursor(SendCoordToCursorBase): - bl_idname = "maplus.quickaplsrcsendplaneatocursor" - bl_label = "Sends Plane Point A to Cursor" - bl_description = "Sends Plane Point A Coordinates to 3D Cursor" +class Slot2GrabPlaneBFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.slot2grabplanebfromactiveglobal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) bl_options = {'REGISTER', 'UNDO'} - source_coord_attrib = 'plane_pt_a' - quick_op_target = 'APLSRC' + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = True + quick_op_target = 'SLOT2' -class QuickAplDestSendPlaneAToCursor(SendCoordToCursorBase): - bl_idname = "maplus.quickapldestsendplaneatocursor" - bl_label = "Sends Plane Point A to Cursor" - bl_description = "Sends Plane Point A Coordinates to 3D Cursor" +class Slot2GrabPlaneCFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.slot2grabplanecfromactivelocal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) bl_options = {'REGISTER', 'UNDO'} - source_coord_attrib = 'plane_pt_a' - quick_op_target = 'APLDEST' + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = False + quick_op_target = 'SLOT2' -class GrabPlaneBFromCursor(GrabFromCursorBase): - bl_idname = "maplus.grabplanebfromcursor" - bl_label = "Grab From Cursor" - bl_description = "Grabs coordinates from 3D cursor" +class Slot2GrabPlaneCFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.slot2grabplanecfromactiveglobal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) bl_options = {'REGISTER', 'UNDO'} - vert_attrib_to_set = 'plane_pt_b' + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = True + quick_op_target = 'SLOT2' -class QuickAplSrcGrabPlaneBFromCursor(GrabFromCursorBase): - bl_idname = "maplus.quickaplsrcgrabplanebfromcursor" - bl_label = "Grab From Cursor" - bl_description = "Grabs coordinates from 3D cursor" +class Slot1GrabAvgPlaneA(GrabAverageLocationBase): + bl_idname = "maplus.slot1grabavgplanea" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) bl_options = {'REGISTER', 'UNDO'} - vert_attrib_to_set = 'plane_pt_b' - quick_op_target = 'APLSRC' + vert_attribs_to_set = ('plane_pt_a',) + multiply_by_world_matrix = True + quick_op_target = "SLOT1" -class QuickAplDestGrabPlaneBFromCursor(GrabFromCursorBase): - bl_idname = "maplus.quickapldestgrabplanebfromcursor" - bl_label = "Grab From Cursor" - bl_description = "Grabs coordinates from 3D cursor" +class Slot1GrabAvgPlaneB(GrabAverageLocationBase): + bl_idname = "maplus.slot1grabavgplaneb" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) bl_options = {'REGISTER', 'UNDO'} - vert_attrib_to_set = 'plane_pt_b' - quick_op_target = 'APLDEST' + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = True + quick_op_target = "SLOT1" -class GrabPlaneBFromActiveLocal(GrabFromGeometryBase): - bl_idname = "maplus.grabplanebfromactivelocal" - bl_label = "Grab Local Coordinates From Active Point" +class Slot1GrabAvgPlaneC(GrabAverageLocationBase): + bl_idname = "maplus.slot1grabavgplanec" + bl_label = "Grab Average Global Coordinates From Selected Points" bl_description = ( - "Grabs local coordinates from selected vertex in edit mode" + "Grabs average global coordinates from selected vertices in edit mode" ) bl_options = {'REGISTER', 'UNDO'} - vert_attribs_to_set = ('plane_pt_b',) - multiply_by_world_matrix = False + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = True + quick_op_target = "SLOT1" -class GrabPlaneBFromActiveGlobal(GrabFromGeometryBase): - bl_idname = "maplus.grabplanebfromactiveglobal" - bl_label = "Grab Global Coordinates From Active Point" +class Slot2GrabAvgPlaneA(GrabAverageLocationBase): + bl_idname = "maplus.slot2grabavgplanea" + bl_label = "Grab Average Global Coordinates From Selected Points" bl_description = ( - "Grabs global coordinates from selected vertex in edit mode" + "Grabs average global coordinates from selected vertices in edit mode" ) bl_options = {'REGISTER', 'UNDO'} - vert_attribs_to_set = ('plane_pt_b',) + vert_attribs_to_set = ('plane_pt_a',) multiply_by_world_matrix = True + quick_op_target = "SLOT2" -class QuickAplGrabAvgSrcPlaneB(GrabAverageLocationBase): - bl_idname = "maplus.quickaplgrabavgsrcplaneb" +class Slot2GrabAvgPlaneB(GrabAverageLocationBase): + bl_idname = "maplus.slot2grabavgplaneb" bl_label = "Grab Average Global Coordinates From Selected Points" bl_description = ( "Grabs average global coordinates from selected vertices in edit mode" @@ -4123,59 +4223,283 @@ class QuickAplGrabAvgSrcPlaneB(GrabAverageLocationBase): bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('plane_pt_b',) multiply_by_world_matrix = True + quick_op_target = "SLOT2" + + +class Slot2GrabAvgPlaneC(GrabAverageLocationBase): + bl_idname = "maplus.slot2grabavgplanec" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = True + quick_op_target = "SLOT2" + + +class QuickAplGrabAvgSrcPlaneA(GrabAverageLocationBase): + bl_idname = "maplus.quickaplgrabavgsrcplanea" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a',) + multiply_by_world_matrix = True quick_op_target = "APLSRC" -class QuickAplGrabAvgDestPlaneB(GrabAverageLocationBase): - bl_idname = "maplus.quickaplgrabavgdestplaneb" +class QuickAplGrabAvgDestPlaneA(GrabAverageLocationBase): + bl_idname = "maplus.quickaplgrabavgdestplanea" bl_label = "Grab Average Global Coordinates From Selected Points" bl_description = ( "Grabs average global coordinates from selected vertices in edit mode" ) bl_options = {'REGISTER', 'UNDO'} - vert_attribs_to_set = ('plane_pt_b',) + vert_attribs_to_set = ('plane_pt_a',) multiply_by_world_matrix = True quick_op_target = "APLDEST" -class QuickAplSrcGrabPlaneBFromActiveLocal(GrabFromGeometryBase): - bl_idname = "maplus.quickaplsrcgrabplanebfromactivelocal" +class QuickAplSrcGrabPlaneAFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickaplsrcgrabplaneafromactivelocal" bl_label = "Grab Local Coordinates From Active Point" bl_description = ( "Grabs local coordinates from selected vertex in edit mode" ) bl_options = {'REGISTER', 'UNDO'} - vert_attribs_to_set = ('plane_pt_b',) + vert_attribs_to_set = ('plane_pt_a',) multiply_by_world_matrix = False quick_op_target = 'APLSRC' -class QuickAplSrcGrabPlaneBFromActiveGlobal(GrabFromGeometryBase): - bl_idname = "maplus.quickaplsrcgrabplanebfromactiveglobal" +class QuickAplSrcGrabPlaneAFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickaplsrcgrabplaneafromactiveglobal" bl_label = "Grab Global Coordinates From Active Point" bl_description = ( "Grabs global coordinates from selected vertex in edit mode" ) bl_options = {'REGISTER', 'UNDO'} - vert_attribs_to_set = ('plane_pt_b',) + vert_attribs_to_set = ('plane_pt_a',) multiply_by_world_matrix = True quick_op_target = 'APLSRC' -class QuickAplDestGrabPlaneBFromActiveLocal(GrabFromGeometryBase): - bl_idname = "maplus.quickapldestgrabplanebfromactivelocal" +class QuickAplDestGrabPlaneAFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickapldestgrabplaneafromactivelocal" bl_label = "Grab Local Coordinates From Active Point" bl_description = ( "Grabs local coordinates from selected vertex in edit mode" ) bl_options = {'REGISTER', 'UNDO'} - vert_attribs_to_set = ('plane_pt_b',) + vert_attribs_to_set = ('plane_pt_a',) multiply_by_world_matrix = False quick_op_target = 'APLDEST' -class QuickAplDestGrabPlaneBFromActiveGlobal(GrabFromGeometryBase): - bl_idname = "maplus.quickapldestgrabplanebfromactiveglobal" +class QuickAplDestGrabPlaneAFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickapldestgrabplaneafromactiveglobal" + bl_label = "Grab Global Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a',) + multiply_by_world_matrix = True + quick_op_target = 'APLDEST' + + +class SendPlaneAToCursor(SendCoordToCursorBase): + bl_idname = "maplus.sendplaneatocursor" + bl_label = "Sends Plane Point A to Cursor" + bl_description = "Sends Plane Point A Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_a' + + +class Slot1SendPlaneAToCursor(SendCoordToCursorBase): + bl_idname = "maplus.slot1sendplaneatocursor" + bl_label = "Sends Plane Point A to Cursor" + bl_description = "Sends Plane Point A Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_a' + quick_op_target = 'SLOT1' + + +class Slot1SendPlaneBToCursor(SendCoordToCursorBase): + bl_idname = "maplus.slot1sendplanebtocursor" + bl_label = "Sends Plane Point B to Cursor" + bl_description = "Sends Plane Point B Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_b' + quick_op_target = 'SLOT1' + + +class Slot1SendPlaneCToCursor(SendCoordToCursorBase): + bl_idname = "maplus.slot1sendplanectocursor" + bl_label = "Sends Plane Point C to Cursor" + bl_description = "Sends Plane Point C Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_c' + quick_op_target = 'SLOT1' + + +class Slot2SendPlaneAToCursor(SendCoordToCursorBase): + bl_idname = "maplus.slot2sendplaneatocursor" + bl_label = "Sends Plane Point A to Cursor" + bl_description = "Sends Plane Point A Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_a' + quick_op_target = 'SLOT2' + + +class Slot2SendPlaneBToCursor(SendCoordToCursorBase): + bl_idname = "maplus.slot2sendplanebtocursor" + bl_label = "Sends Plane Point B to Cursor" + bl_description = "Sends Plane Point B Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_b' + quick_op_target = 'SLOT2' + + +class Slot2SendPlaneCToCursor(SendCoordToCursorBase): + bl_idname = "maplus.slot2sendplanectocursor" + bl_label = "Sends Plane Point C to Cursor" + bl_description = "Sends Plane Point C Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_c' + quick_op_target = 'SLOT2' + + +class QuickAplSrcSendPlaneAToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickaplsrcsendplaneatocursor" + bl_label = "Sends Plane Point A to Cursor" + bl_description = "Sends Plane Point A Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_a' + quick_op_target = 'APLSRC' + + +class QuickAplDestSendPlaneAToCursor(SendCoordToCursorBase): + bl_idname = "maplus.quickapldestsendplaneatocursor" + bl_label = "Sends Plane Point A to Cursor" + bl_description = "Sends Plane Point A Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_a' + quick_op_target = 'APLDEST' + + +class GrabPlaneBFromCursor(GrabFromCursorBase): + bl_idname = "maplus.grabplanebfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_b' + + +class QuickAplSrcGrabPlaneBFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickaplsrcgrabplanebfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_b' + quick_op_target = 'APLSRC' + + +class QuickAplDestGrabPlaneBFromCursor(GrabFromCursorBase): + bl_idname = "maplus.quickapldestgrabplanebfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_b' + quick_op_target = 'APLDEST' + + +class GrabPlaneBFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.grabplanebfromactivelocal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = False + + +class GrabPlaneBFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.grabplanebfromactiveglobal" + bl_label = "Grab Global Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = True + + +class QuickAplGrabAvgSrcPlaneB(GrabAverageLocationBase): + bl_idname = "maplus.quickaplgrabavgsrcplaneb" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = True + quick_op_target = "APLSRC" + + +class QuickAplGrabAvgDestPlaneB(GrabAverageLocationBase): + bl_idname = "maplus.quickaplgrabavgdestplaneb" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = True + quick_op_target = "APLDEST" + + +class QuickAplSrcGrabPlaneBFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickaplsrcgrabplanebfromactivelocal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = False + quick_op_target = 'APLSRC' + + +class QuickAplSrcGrabPlaneBFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickaplsrcgrabplanebfromactiveglobal" + bl_label = "Grab Global Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = True + quick_op_target = 'APLSRC' + + +class QuickAplDestGrabPlaneBFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.quickapldestgrabplanebfromactivelocal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = False + quick_op_target = 'APLDEST' + + +class QuickAplDestGrabPlaneBFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.quickapldestgrabplanebfromactiveglobal" bl_label = "Grab Global Coordinates From Active Point" bl_description = ( "Grabs global coordinates from selected vertex in edit mode" @@ -4380,6 +4704,54 @@ class GrabAllVertsPlaneGlobal(GrabFromGeometryBase): multiply_by_world_matrix = True +class GrabPlaneSlot1Loc(GrabFromGeometryBase): + bl_idname = "maplus.grabplaneslot1loc" + bl_label = "Grab Plane Global Coordinates from Selected Verts" + bl_description = ( + "Grabs plane global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a', 'plane_pt_b', 'plane_pt_c') + multiply_by_world_matrix = False + quick_op_target = "SLOT1" + + +class GrabPlaneSlot1(GrabFromGeometryBase): + bl_idname = "maplus.grabplaneslot1" + bl_label = "Grab Plane Global Coordinates from Selected Verts" + bl_description = ( + "Grabs plane global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a', 'plane_pt_b', 'plane_pt_c') + multiply_by_world_matrix = True + quick_op_target = "SLOT1" + + +class GrabPlaneSlot2Loc(GrabFromGeometryBase): + bl_idname = "maplus.grabplaneslot2loc" + bl_label = "Grab Plane Global Coordinates from Selected Verts" + bl_description = ( + "Grabs plane global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a', 'plane_pt_b', 'plane_pt_c') + multiply_by_world_matrix = False + quick_op_target = "SLOT2" + + +class GrabPlaneSlot2(GrabFromGeometryBase): + bl_idname = "maplus.grabplaneslot2" + bl_label = "Grab Plane Global Coordinates from Selected Verts" + bl_description = ( + "Grabs plane global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a', 'plane_pt_b', 'plane_pt_c') + multiply_by_world_matrix = True + quick_op_target = "SLOT2" + + class QuickAlignPlanesGrabSrc(GrabFromGeometryBase): bl_idname = "maplus.quickalignplanesgrabsrc" bl_label = "Grab Plane Global Coordinates from Selected Verts" @@ -4599,64 +4971,118 @@ class SwapPlaneBPlaneC(SwapPointsBase): targets = ('plane_pt_b', 'plane_pt_c') -class QuickAplSrcSwapPlaneAPlaneB(SwapPointsBase): - bl_idname = "maplus.quickaplsrcswapplaneaplaneb" +class Slot1SwapPlaneAPlaneB(SwapPointsBase): + bl_idname = "maplus.slot1swapplaneaplaneb" bl_label = "Swap Plane Point A with Plane Point B" bl_description = "Swap plane points A and B" bl_options = {'REGISTER', 'UNDO'} targets = ('plane_pt_a', 'plane_pt_b') - quick_op_target = 'APLSRC' + quick_op_target = 'SLOT1' -class QuickAplSrcSwapPlaneAPlaneC(SwapPointsBase): - bl_idname = "maplus.quickaplsrcswapplaneaplanec" +class Slot1SwapPlaneAPlaneC(SwapPointsBase): + bl_idname = "maplus.slot1swapplaneaplanec" bl_label = "Swap Plane Point A with Plane Point C" bl_description = "Swap plane points A and C" bl_options = {'REGISTER', 'UNDO'} targets = ('plane_pt_a', 'plane_pt_c') - quick_op_target = 'APLSRC' + quick_op_target = 'SLOT1' -class QuickAplSrcSwapPlaneBPlaneC(SwapPointsBase): - bl_idname = "maplus.quickaplsrcswapplanebplanec" +class Slot1SwapPlaneBPlaneC(SwapPointsBase): + bl_idname = "maplus.slot1swapplanebplanec" bl_label = "Swap Plane Point B with Plane Point C" bl_description = "Swap plane points B and C" bl_options = {'REGISTER', 'UNDO'} targets = ('plane_pt_b', 'plane_pt_c') - quick_op_target = 'APLSRC' + quick_op_target = 'SLOT1' -class QuickAplDestSwapPlaneAPlaneB(SwapPointsBase): - bl_idname = "maplus.quickapldestswapplaneaplaneb" +class Slot2SwapPlaneAPlaneB(SwapPointsBase): + bl_idname = "maplus.slot2swapplaneaplaneb" bl_label = "Swap Plane Point A with Plane Point B" bl_description = "Swap plane points A and B" bl_options = {'REGISTER', 'UNDO'} targets = ('plane_pt_a', 'plane_pt_b') - quick_op_target = 'APLDEST' + quick_op_target = 'SLOT2' -class QuickAplDestSwapPlaneAPlaneC(SwapPointsBase): - bl_idname = "maplus.quickapldestswapplaneaplanec" +class Slot2SwapPlaneAPlaneC(SwapPointsBase): + bl_idname = "maplus.slot2swapplaneaplanec" bl_label = "Swap Plane Point A with Plane Point C" bl_description = "Swap plane points A and C" bl_options = {'REGISTER', 'UNDO'} targets = ('plane_pt_a', 'plane_pt_c') - quick_op_target = 'APLDEST' + quick_op_target = 'SLOT2' -class QuickAplDestSwapPlaneBPlaneC(SwapPointsBase): - bl_idname = "maplus.quickapldestswapplanebplanec" +class Slot2SwapPlaneBPlaneC(SwapPointsBase): + bl_idname = "maplus.slot2swapplanebplanec" bl_label = "Swap Plane Point B with Plane Point C" bl_description = "Swap plane points B and C" bl_options = {'REGISTER', 'UNDO'} targets = ('plane_pt_b', 'plane_pt_c') - quick_op_target = 'APLDEST' + quick_op_target = 'SLOT2' -# Every x/y/z coordinate component has these functions on each of the -# geometry primitives (lets users move in one direction easily, etc.) -class SetOtherComponentsBase(bpy.types.Operator): - bl_idname = "maplus.setotherbase" +class QuickAplSrcSwapPlaneAPlaneB(SwapPointsBase): + bl_idname = "maplus.quickaplsrcswapplaneaplaneb" + bl_label = "Swap Plane Point A with Plane Point B" + bl_description = "Swap plane points A and B" + bl_options = {'REGISTER', 'UNDO'} + targets = ('plane_pt_a', 'plane_pt_b') + quick_op_target = 'APLSRC' + + +class QuickAplSrcSwapPlaneAPlaneC(SwapPointsBase): + bl_idname = "maplus.quickaplsrcswapplaneaplanec" + bl_label = "Swap Plane Point A with Plane Point C" + bl_description = "Swap plane points A and C" + bl_options = {'REGISTER', 'UNDO'} + targets = ('plane_pt_a', 'plane_pt_c') + quick_op_target = 'APLSRC' + + +class QuickAplSrcSwapPlaneBPlaneC(SwapPointsBase): + bl_idname = "maplus.quickaplsrcswapplanebplanec" + bl_label = "Swap Plane Point B with Plane Point C" + bl_description = "Swap plane points B and C" + bl_options = {'REGISTER', 'UNDO'} + targets = ('plane_pt_b', 'plane_pt_c') + quick_op_target = 'APLSRC' + + +class QuickAplDestSwapPlaneAPlaneB(SwapPointsBase): + bl_idname = "maplus.quickapldestswapplaneaplaneb" + bl_label = "Swap Plane Point A with Plane Point B" + bl_description = "Swap plane points A and B" + bl_options = {'REGISTER', 'UNDO'} + targets = ('plane_pt_a', 'plane_pt_b') + quick_op_target = 'APLDEST' + + +class QuickAplDestSwapPlaneAPlaneC(SwapPointsBase): + bl_idname = "maplus.quickapldestswapplaneaplanec" + bl_label = "Swap Plane Point A with Plane Point C" + bl_description = "Swap plane points A and C" + bl_options = {'REGISTER', 'UNDO'} + targets = ('plane_pt_a', 'plane_pt_c') + quick_op_target = 'APLDEST' + + +class QuickAplDestSwapPlaneBPlaneC(SwapPointsBase): + bl_idname = "maplus.quickapldestswapplanebplanec" + bl_label = "Swap Plane Point B with Plane Point C" + bl_description = "Swap plane points B and C" + bl_options = {'REGISTER', 'UNDO'} + targets = ('plane_pt_b', 'plane_pt_c') + quick_op_target = 'APLDEST' + + +# Every x/y/z coordinate component has these functions on each of the +# geometry primitives (lets users move in one direction easily, etc.) +class SetOtherComponentsBase(bpy.types.Operator): + bl_idname = "maplus.setotherbase" bl_label = "" bl_description = "" bl_options = {'REGISTER', 'UNDO'} @@ -12187,16 +12613,924 @@ def draw(self, context): # "maplus.oneotherplanepointcz", # text="11Z" # ) + elif addon_data.internal_storage_slot_1.kind == 'PLANE': + plane_grab_all = slot1_geom_editor.row(align=True) + plane_grab_all.operator( + "maplus.grabplaneslot1loc", + icon='VERTEXSEL', + text="Grab All Local" + ) + plane_grab_all.operator( + "maplus.grabplaneslot1", + icon='WORLD', + text="Grab All Global" + ) + special_grabs = slot1_geom_editor.row(align=True) + special_grabs.operator( + "maplus.copyfromslot1", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs.operator( + "maplus.pasteintoslot1", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) - if addon_data.quick_calc_show_slot1_geom: - calc_gui.separator() + slot1_geom_editor.label("Pt. A:") + # plane_a_items = slot1_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + plane_a_items = slot1_geom_editor.row() + typein_and_grab_plna = plane_a_items.column() + plane_a_uppers = typein_and_grab_plna.split(percentage=.33) - calc_gui.operator( - "maplus.graballslot2", - icon='WORLD', - text="Grab Slot 2" - ) - calc_gui.separator() + plane_a_swap = plane_a_uppers.row(align=True) + plane_a_swap.label("Swap With:") + plane_a_swap.operator( + "maplus.slot1swapplaneaplaneb", + text="B" + ) + plane_a_swap.operator( + "maplus.slot1swapplaneaplanec", + text="C" + ) + + plane_a_uppers_rightside = plane_a_uppers.row(align=True) + plane_a_uppers_rightside.alignment = 'RIGHT' + plane_a_uppers_rightside.label("Send:") + plane_a_uppers_rightside.operator( + "maplus.slot1sendplaneatocursor", + icon='CURSOR', + text="" + ) + + plane_a_uppers_rightside.label("Grab:") + plane_a_uppers_rightside.operator( + "maplus.slot1grabplaneafromcursor", + icon='CURSOR', + text="" + ) + plane_a_uppers_rightside.operator( + "maplus.slot1grabplaneafromactivelocal", + icon='VERTEXSEL', + text="" + ) + plane_a_uppers_rightside.operator( + "maplus.slot1grabplaneafromactiveglobal", + icon='WORLD', + text="" + ) + plane_a_uppers_rightside.operator( + "maplus.slot1grabavgplanea", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_plna.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_1), + 'plane_pt_a', + "" + ) + + # component_changers_plna = plane_a_items.row() + # zero_components_plna = component_changers_plna.column( + # align=True + # ) + # zero_components_plna.label("Set Zeroes:") + # zero_components_plna.operator( + # "maplus.zerootherplanepointax", + # text="X00" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointay", + # text="0Y0" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointaz", + # text="00Z" + # ) + # one_components_plna = component_changers_plna.column( + # align=True + # ) + # one_components_plna.label("Set Ones:") + # one_components_plna.operator( + # "maplus.oneotherplanepointax", + # text="X11" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointay", + # text="1Y1" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointaz", + # text="11Z" + # ) + + slot1_geom_editor.label("Pt. B (Pivot):") + # plane_b_items = slot1_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + plane_b_items = slot1_geom_editor.row() + typein_and_grab_plnb = plane_b_items.column() + plane_b_uppers = typein_and_grab_plnb.split(percentage=.33) + plane_b_swap = plane_b_uppers.row(align=True) + plane_b_swap.label("Swap With:") + plane_b_swap.operator( + "maplus.slot1swapplaneaplaneb", + text="A" + ) + plane_b_swap.operator( + "maplus.slot1swapplanebplanec", + text="C" + ) + + plane_b_uppers_rightside = plane_b_uppers.row(align=True) + plane_b_uppers_rightside.alignment = 'RIGHT' + plane_b_uppers_rightside.label("Send:") + plane_b_uppers_rightside.operator( + "maplus.slot1sendplanebtocursor", + icon='CURSOR', + text="" + ) + + plane_b_uppers_rightside.label("Grab:") + plane_b_uppers_rightside.operator( + "maplus.slot1grabplanebfromcursor", + icon='CURSOR', + text="" + ) + plane_b_uppers_rightside.operator( + "maplus.slot1grabplanebfromactivelocal", + icon='VERTEXSEL', + text="" + ) + plane_b_uppers_rightside.operator( + "maplus.slot1grabplanebfromactiveglobal", + icon='WORLD', + text="" + ) + plane_b_uppers_rightside.operator( + "maplus.slot1grabavgplaneb", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_plnb.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_1), + 'plane_pt_b', + "" + ) + + # component_changers_plnb = plane_b_items.row() + # zero_components_plnb = component_changers_plnb.column( + # align=True + # ) + # zero_components_plnb.label("Set Zeroes:") + # zero_components_plnb.operator( + # "maplus.zerootherplanepointbx", + # text="X00" + # ) + # zero_components_plnb.operator( + # "maplus.zerootherplanepointby", + # text="0Y0" + # ) + # zero_components_plnb.operator( + # "maplus.zerootherplanepointbz", + # text="00Z" + # ) + # one_components_plnb = component_changers_plnb.column( + # align=True + # ) + # one_components_plnb.label("Set Ones:") + # one_components_plnb.operator( + # "maplus.oneotherplanepointbx", + # text="X11" + # ) + # one_components_plnb.operator( + # "maplus.oneotherplanepointby", + # text="1Y1" + # ) + # one_components_plnb.operator( + # "maplus.oneotherplanepointbz", + # text="11Z" + # ) + + slot1_geom_editor.label("Pt. C:") + # plane_c_items = slot1_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + plane_c_items = slot1_geom_editor.row() + typein_and_grab_plnc = plane_c_items.column() + plane_c_uppers = typein_and_grab_plnc.split(percentage=.33) + plane_c_swap = plane_c_uppers.row(align=True) + plane_c_swap.label("Swap With:") + plane_c_swap.operator( + "maplus.slot1swapplaneaplanec", + text="A" + ) + plane_c_swap.operator( + "maplus.slot1swapplanebplanec", + text="B" + ) + + plane_c_uppers_rightside = plane_c_uppers.row(align=True) + plane_c_uppers_rightside.alignment = 'RIGHT' + plane_c_uppers_rightside.label("Send:") + plane_c_uppers_rightside.operator( + "maplus.slot1sendplanectocursor", + icon='CURSOR', + text="" + ) + + plane_c_uppers_rightside.label("Grab:") + plane_c_uppers_rightside.operator( + "maplus.slot1grabplanecfromcursor", + icon='CURSOR', + text="" + ) + plane_c_uppers_rightside.operator( + "maplus.slot1grabplanecfromactivelocal", + icon='VERTEXSEL', + text="" + ) + plane_c_uppers_rightside.operator( + "maplus.slot1grabplanecfromactiveglobal", + icon='WORLD', + text="" + ) + plane_c_uppers_rightside.operator( + "maplus.slot1grabavgplanec", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_plnc.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_1), + 'plane_pt_c', + "" + ) + + # component_changers_plnc = plane_c_items.row() + # zero_components_plnc = component_changers_plnc.column( + # align=True + # ) + # zero_components_plnc.label("Set Zeroes:") + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcx", + # text="X00" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcy", + # text="0Y0" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcz", + # text="00Z" + # ) + # one_components_plnc = component_changers_plnc.column( + # align=True + # ) + # one_components_plnc.label("Set Ones:") + # one_components_plnc.operator( + # "maplus.oneotherplanepointcx", + # text="X11" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcy", + # text="1Y1" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcz", + # text="11Z" + # ) + + if addon_data.quick_calc_show_slot1_geom: + calc_gui.separator() + + slot2_geom_top = calc_gui.row(align=True) + if not addon_data.quick_calc_show_slot2_geom: + slot2_geom_top.operator( + "maplus.showhidequickcalcslot2geom", + icon='TRIA_RIGHT', + text="", + emboss=False + ) + preserve_button_roundedge = slot2_geom_top.row() + preserve_button_roundedge.operator( + "maplus.graballslot2", + icon='WORLD', + text="Grab Slot 1" + ) + + else: + slot2_geom_top.operator( + "maplus.showhidequickcalcslot2geom", + icon='TRIA_DOWN', + text="", + emboss=False + ) + slot2_geom_top.label("Slot 1 Coordinates") + slot2_geom_editor = calc_gui.box() + types_row = slot2_geom_editor.row() + types_row.label("Item type:") + types_row.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_2), + 'kind', + "" + ) + + if addon_data.internal_storage_slot_2.kind == 'POINT': + pt_grab_all = slot2_geom_editor.row(align=True) + pt_grab_all.operator( + "maplus.grabpointslot2loc", + icon='VERTEXSEL', + text="Grab All Local" + ) + pt_grab_all.operator( + "maplus.grabpointslot2", + icon='WORLD', + text="Grab All Global" + ) + + modifier_header = slot2_geom_editor.row() + modifier_header.label("Point Modifiers:") + apply_mods = modifier_header.row() + apply_mods.alignment = 'RIGHT' + # apply_mods.operator( + # "maplus.applygeommodifiers", + # text="Apply ModifiersXXXXX" + # ) + item_mods_box = slot2_geom_editor.box() + mods_row_1 = item_mods_box.row() + mods_row_1.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_2), + 'pt_make_unit_vec', + "Set Length Equal to One" + ) + mods_row_1.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_2), + 'pt_flip_direction', + "Flip Direction" + ) + mods_row_2 = item_mods_box.row() + mods_row_2.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_2), + 'pt_multiplier', + "Multiplier" + ) + + slot2_geom_editor.label("Pt. Origin:") + # plane_a_items = slot2_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + pt_items = slot2_geom_editor.row() + typein_and_grab_pt = pt_items.column() + pt_uppers = typein_and_grab_pt.row() + + pt_uppers_leftside = pt_uppers.row(align=True) + pt_uppers_leftside.alignment = 'LEFT' + pt_uppers_leftside.label("Send:") + pt_uppers_leftside.operator( + "maplus.slot2sendpointtocursor", + icon='CURSOR', + text="" + ) + + pt_uppers_rightside = pt_uppers.row(align=True) + pt_uppers_rightside.alignment = 'RIGHT' + pt_uppers_rightside.label("Grab:") + pt_uppers_rightside.operator( + "maplus.slot2grabpointfromcursor", + icon='CURSOR', + text="" + ) + pt_uppers_rightside.operator( + "maplus.grabpointslot2loc", + icon='VERTEXSEL', + text="" + ) + pt_uppers_rightside.operator( + "maplus.grabpointslot2", + icon='WORLD', + text="" + ) + pt_uppers_rightside.operator( + "maplus.slot2pointgrabavg", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_pt.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_2), + 'point', + "" + ) + + elif addon_data.internal_storage_slot_2.kind == 'LINE': + ln_grab_all = slot2_geom_editor.row(align=True) + ln_grab_all.operator( + "maplus.grablineslot2loc", + icon='VERTEXSEL', + text="Grab All Local" + ) + ln_grab_all.operator( + "maplus.grablineslot2", + icon='WORLD', + text="Grab All Global" + ) + + special_grabs = slot2_geom_editor.row(align=True) + special_grabs.operator( + "maplus.slot2grabnormal", + icon='LAMP_HEMI', + text="Grab Normal" + ) + special_grabs_extra = slot2_geom_editor.row(align=True) + special_grabs_extra.operator( + "maplus.copyfromslot2", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs_extra.operator( + "maplus.pasteintoslot2", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) + + modifier_header = slot2_geom_editor.row() + modifier_header.label("Line Modifiers:") + apply_mods = modifier_header.row() + apply_mods.alignment = 'RIGHT' + # apply_mods.operator( + # "maplus.applygeommodifiers", + # text="Apply ModifiersXXXXX" + # ) + item_mods_box = slot2_geom_editor.box() + mods_row_1 = item_mods_box.row() + mods_row_1.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_2), + 'ln_make_unit_vec', + "Set Length Equal to One" + ) + mods_row_1.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_2), + 'ln_flip_direction', + "Flip Direction" + ) + mods_row_2 = item_mods_box.row() + mods_row_2.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_2), + 'ln_multiplier', + "Multiplier" + ) + + slot2_geom_editor.label("Start:") + # plane_a_items = axr_src_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_start_items = slot2_geom_editor.row() + typein_and_grab_start = ln_start_items.column() + ln_start_uppers = typein_and_grab_start.split(percentage=.33) + + ln_start_swap = ln_start_uppers.row(align=True) + ln_start_swap.label("Swap With:") + ln_start_swap.operator( + "maplus.slot2swaplinepoints", + text="End" + ) + + ln_start_uppers_rightside = ln_start_uppers.row(align=True) + ln_start_uppers_rightside.alignment = 'RIGHT' + ln_start_uppers_rightside.label("Send:") + ln_start_uppers_rightside.operator( + "maplus.slot2sendlinestarttocursor", + icon='CURSOR', + text="" + ) + + ln_start_uppers_rightside.label("Grab:") + ln_start_uppers_rightside.operator( + "maplus.slot2grablinestartfromcursor", + icon='CURSOR', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.slot2grablinestartfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.slot2grablinestartfromactiveglobal", + icon='WORLD', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.slot2grabavglinestart", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_start.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_2), + 'line_start', + "" + ) + + # component_changers_plna = plane_a_items.row() + # zero_components_plna = component_changers_plna.column( + # align=True + # ) + # zero_components_plna.label("Set Zeroes:") + # zero_components_plna.operator( + # "maplus.zerootherplanepointax", + # text="X00" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointay", + # text="0Y0" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointaz", + # text="00Z" + # ) + # one_components_plna = component_changers_plna.column( + # align=True + # ) + # one_components_plna.label("Set Ones:") + # one_components_plna.operator( + # "maplus.oneotherplanepointax", + # text="X11" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointay", + # text="1Y1" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointaz", + # text="11Z" + # ) + + slot2_geom_editor.label("End:") + # plane_a_items = slot2_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_end_items = slot2_geom_editor.row() + typein_and_grab_end = ln_end_items.column() + ln_end_uppers = typein_and_grab_end.split(percentage=.33) + + ln_end_swap = ln_end_uppers.row(align=True) + ln_end_swap.label("Swap With:") + ln_end_swap.operator( + "maplus.slot2swaplinepoints", + text="Start" + ) + + ln_end_uppers_rightside = ln_end_uppers.row(align=True) + ln_end_uppers_rightside.alignment = 'RIGHT' + ln_end_uppers_rightside.label("Send:") + ln_end_uppers_rightside.operator( + "maplus.slot2sendlineendtocursor", + icon='CURSOR', + text="" + ) + + ln_end_uppers_rightside.label("Grab:") + ln_end_uppers_rightside.operator( + "maplus.slot2grablineendfromcursor", + icon='CURSOR', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.slot2grablineendfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.slot2grablineendfromactiveglobal", + icon='WORLD', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.slot2grabavglineend", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_end.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_2), + 'line_end', + "" + ) + + # component_changers_plnc = plane_c_items.row() + # zero_components_plnc = component_changers_plnc.column( + # align=True + # ) + # zero_components_plnc.label("Set Zeroes:") + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcx", + # text="X00" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcy", + # text="0Y0" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcz", + # text="00Z" + # ) + # one_components_plnc = component_changers_plnc.column( + # align=True + # ) + # one_components_plnc.label("Set Ones:") + # one_components_plnc.operator( + # "maplus.oneotherplanepointcx", + # text="X11" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcy", + # text="1Y1" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcz", + # text="11Z" + # ) + elif addon_data.internal_storage_slot_2.kind == 'PLANE': + plane_grab_all = slot2_geom_editor.row(align=True) + plane_grab_all.operator( + "maplus.grabplaneslot2loc", + icon='VERTEXSEL', + text="Grab All Local" + ) + plane_grab_all.operator( + "maplus.grabplaneslot2", + icon='WORLD', + text="Grab All Global" + ) + special_grabs = slot2_geom_editor.row(align=True) + special_grabs.operator( + "maplus.copyfromslot2", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs.operator( + "maplus.pasteintoslot2", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) + + slot2_geom_editor.label("Pt. A:") + # plane_a_items = slot2_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + plane_a_items = slot2_geom_editor.row() + typein_and_grab_plna = plane_a_items.column() + plane_a_uppers = typein_and_grab_plna.split(percentage=.33) + + plane_a_swap = plane_a_uppers.row(align=True) + plane_a_swap.label("Swap With:") + plane_a_swap.operator( + "maplus.slot2swapplaneaplaneb", + text="B" + ) + plane_a_swap.operator( + "maplus.slot2swapplaneaplanec", + text="C" + ) + + plane_a_uppers_rightside = plane_a_uppers.row(align=True) + plane_a_uppers_rightside.alignment = 'RIGHT' + plane_a_uppers_rightside.label("Send:") + plane_a_uppers_rightside.operator( + "maplus.slot2sendplaneatocursor", + icon='CURSOR', + text="" + ) + + plane_a_uppers_rightside.label("Grab:") + plane_a_uppers_rightside.operator( + "maplus.slot2grabplaneafromcursor", + icon='CURSOR', + text="" + ) + plane_a_uppers_rightside.operator( + "maplus.slot2grabplaneafromactivelocal", + icon='VERTEXSEL', + text="" + ) + plane_a_uppers_rightside.operator( + "maplus.slot2grabplaneafromactiveglobal", + icon='WORLD', + text="" + ) + plane_a_uppers_rightside.operator( + "maplus.slot2grabavgplanea", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_plna.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_2), + 'plane_pt_a', + "" + ) + + # component_changers_plna = plane_a_items.row() + # zero_components_plna = component_changers_plna.column( + # align=True + # ) + # zero_components_plna.label("Set Zeroes:") + # zero_components_plna.operator( + # "maplus.zerootherplanepointax", + # text="X00" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointay", + # text="0Y0" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointaz", + # text="00Z" + # ) + # one_components_plna = component_changers_plna.column( + # align=True + # ) + # one_components_plna.label("Set Ones:") + # one_components_plna.operator( + # "maplus.oneotherplanepointax", + # text="X11" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointay", + # text="1Y1" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointaz", + # text="11Z" + # ) + + slot2_geom_editor.label("Pt. B (Pivot):") + # plane_b_items = slot2_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + plane_b_items = slot2_geom_editor.row() + typein_and_grab_plnb = plane_b_items.column() + plane_b_uppers = typein_and_grab_plnb.split(percentage=.33) + plane_b_swap = plane_b_uppers.row(align=True) + plane_b_swap.label("Swap With:") + plane_b_swap.operator( + "maplus.slot2swapplaneaplaneb", + text="A" + ) + plane_b_swap.operator( + "maplus.slot2swapplanebplanec", + text="C" + ) + + plane_b_uppers_rightside = plane_b_uppers.row(align=True) + plane_b_uppers_rightside.alignment = 'RIGHT' + plane_b_uppers_rightside.label("Send:") + plane_b_uppers_rightside.operator( + "maplus.slot2sendplanebtocursor", + icon='CURSOR', + text="" + ) + + plane_b_uppers_rightside.label("Grab:") + plane_b_uppers_rightside.operator( + "maplus.slot2grabplanebfromcursor", + icon='CURSOR', + text="" + ) + plane_b_uppers_rightside.operator( + "maplus.slot2grabplanebfromactivelocal", + icon='VERTEXSEL', + text="" + ) + plane_b_uppers_rightside.operator( + "maplus.slot2grabplanebfromactiveglobal", + icon='WORLD', + text="" + ) + plane_b_uppers_rightside.operator( + "maplus.slot2grabavgplaneb", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_plnb.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_2), + 'plane_pt_b', + "" + ) + + # component_changers_plnb = plane_b_items.row() + # zero_components_plnb = component_changers_plnb.column( + # align=True + # ) + # zero_components_plnb.label("Set Zeroes:") + # zero_components_plnb.operator( + # "maplus.zerootherplanepointbx", + # text="X00" + # ) + # zero_components_plnb.operator( + # "maplus.zerootherplanepointby", + # text="0Y0" + # ) + # zero_components_plnb.operator( + # "maplus.zerootherplanepointbz", + # text="00Z" + # ) + # one_components_plnb = component_changers_plnb.column( + # align=True + # ) + # one_components_plnb.label("Set Ones:") + # one_components_plnb.operator( + # "maplus.oneotherplanepointbx", + # text="X11" + # ) + # one_components_plnb.operator( + # "maplus.oneotherplanepointby", + # text="1Y1" + # ) + # one_components_plnb.operator( + # "maplus.oneotherplanepointbz", + # text="11Z" + # ) + + slot2_geom_editor.label("Pt. C:") + # plane_c_items = slot2_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + plane_c_items = slot2_geom_editor.row() + typein_and_grab_plnc = plane_c_items.column() + plane_c_uppers = typein_and_grab_plnc.split(percentage=.33) + plane_c_swap = plane_c_uppers.row(align=True) + plane_c_swap.label("Swap With:") + plane_c_swap.operator( + "maplus.slot2swapplaneaplanec", + text="A" + ) + plane_c_swap.operator( + "maplus.slot2swapplanebplanec", + text="B" + ) + + plane_c_uppers_rightside = plane_c_uppers.row(align=True) + plane_c_uppers_rightside.alignment = 'RIGHT' + plane_c_uppers_rightside.label("Send:") + plane_c_uppers_rightside.operator( + "maplus.slot2sendplanectocursor", + icon='CURSOR', + text="" + ) + + plane_c_uppers_rightside.label("Grab:") + plane_c_uppers_rightside.operator( + "maplus.slot2grabplanecfromcursor", + icon='CURSOR', + text="" + ) + plane_c_uppers_rightside.operator( + "maplus.slot2grabplanecfromactivelocal", + icon='VERTEXSEL', + text="" + ) + plane_c_uppers_rightside.operator( + "maplus.slot2grabplanecfromactiveglobal", + icon='WORLD', + text="" + ) + plane_c_uppers_rightside.operator( + "maplus.slot2grabavgplanec", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_plnc.prop( + bpy.types.AnyType(addon_data.internal_storage_slot_2), + 'plane_pt_c', + "" + ) + + # component_changers_plnc = plane_c_items.row() + # zero_components_plnc = component_changers_plnc.column( + # align=True + # ) + # zero_components_plnc.label("Set Zeroes:") + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcx", + # text="X00" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcy", + # text="0Y0" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcz", + # text="00Z" + # ) + # one_components_plnc = component_changers_plnc.column( + # align=True + # ) + # one_components_plnc.label("Set Ones:") + # one_components_plnc.operator( + # "maplus.oneotherplanepointcx", + # text="X11" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcy", + # text="1Y1" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcz", + # text="11Z" + # ) + if addon_data.quick_calc_show_slot2_geom: + calc_gui.separator() calcs_and_results_header = calc_gui.row() calcs_and_results_header.label( From 7abd865b78a5390180e54ff5b58c9855985189c4 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Sun, 26 Mar 2017 14:30:37 -0400 Subject: [PATCH 29/56] Added geom editing to calc. result, added slot1/2/result point copy/paste. --- mesh_mesh_align_plus.py | 1235 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 1199 insertions(+), 36 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 7ad38ec..2c084ea 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -572,6 +572,13 @@ class MAPlusData(bpy.types.PropertyGroup): ), default=False ) + quick_calc_show_result_geom = bpy.props.BoolProperty( + description=( + "Expand/collapse the calculation result geometry editor" + " in the calculate/compose panel." + ), + default=False + ) quick_calc_result_item = bpy.props.PointerProperty(type=MAPlusPrimitive) quick_calc_result_numeric = bpy.props.FloatProperty( description="Quick Calculation numeric result", @@ -934,6 +941,10 @@ def execute(self, context): addon_data.quick_calc_show_slot2_geom = ( not addon_data.quick_calc_show_slot2_geom ) + elif self.quick_op_target == "CALCRESULT": + addon_data.quick_calc_show_result_geom = ( + not addon_data.quick_calc_show_result_geom + ) return {'FINISHED'} @@ -954,6 +965,14 @@ class ShowHideQuickCalcSlot2Geom(ShowHideQuickGeomBaseClass): quick_op_target = 'SLOT2' +class ShowHideQuickCalcResultGeom(ShowHideQuickGeomBaseClass): + bl_idname = "maplus.showhidequickcalcresultgeom" + bl_label = "Show/hide calculation result geometry" + bl_description = "Show/hide calculation result geometry" + bl_options = {'REGISTER', 'UNDO'} + quick_op_target = 'CALCRESULT' + + class ShowHideQuickAptSrcGeom(ShowHideQuickGeomBaseClass): bl_idname = "maplus.showhidequickaptsrcgeom" bl_label = "Show/hide quick align points source geometry" @@ -1232,6 +1251,15 @@ def execute(self, context): ['POINT', 'LINE', 'PLANE'] else 'POINT' ), + }, + 'CALCRESULT': { + "item": addon_data.quick_calc_result_item, + "geom_mode": ( + addon_data.quick_calc_result_item.kind if + addon_data.quick_calc_result_item.kind in + ['POINT', 'LINE', 'PLANE'] else + 'POINT' + ), } } set_attribs = { @@ -1307,6 +1335,24 @@ class CopyFromSlot2(CopyToOtherBase): source_dest_pair = ('SLOT2', 'INTERNALCLIPBOARD') +class CopyFromCalcResult(CopyToOtherBase): + bl_idname = "maplus.copyfromcalcresult" + bl_label = "Copy from this item" + bl_description = "Copies this item into the internal clipboard" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('CALCRESULT', 'INTERNALCLIPBOARD') + + +class PasteIntoCalcResult(CopyToOtherBase): + bl_idname = "maplus.pasteintocalcresult" + bl_label = "Paste into this item" + bl_description = "Pastes from the internal clipboard into this item" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('INTERNALCLIPBOARD', 'CALCRESULT') + + class PasteIntoAptSrc(CopyToOtherBase): bl_idname = "maplus.pasteintoaptsrc" bl_label = "Paste into this item" @@ -1921,6 +1967,8 @@ def execute(self, context): active_item = addon_data.internal_storage_slot_1 elif self.quick_op_target == "SLOT2": active_item = addon_data.internal_storage_slot_2 + elif self.quick_op_target == "CALCRESULT": + active_item = addon_data.quick_calc_result_item matrix_multiplier = None if self.multiply_by_world_matrix: @@ -1970,6 +2018,8 @@ def execute(self, context): active_item = addon_data.internal_storage_slot_1 elif self.target == "SLOT2": active_item = addon_data.internal_storage_slot_2 + elif self.target == "CALCRESULT": + active_item = addon_data.quick_calc_result_item matrix_multiplier = None if self.multiply_by_world_matrix: @@ -2054,6 +2104,9 @@ def execute(self, context): active_item = addon_data.internal_storage_slot_1 elif self.quick_op_target == "SLOT2": active_item = addon_data.internal_storage_slot_2 + elif self.quick_op_target == "CALCRESULT": + active_item = addon_data.quick_calc_result_item + matrix_multiplier = None if self.multiply_by_world_matrix: matrix_multiplier = bpy.context.active_object.matrix_world @@ -2117,6 +2170,8 @@ def execute(self, context): active_item = addon_data.internal_storage_slot_1 elif self.quick_op_target == "SLOT2": active_item = addon_data.internal_storage_slot_2 + elif self.quick_op_target == "CALCRESULT": + active_item = addon_data.quick_calc_result_item matrix_multiplier = None if self.multiply_by_world_matrix: @@ -2187,6 +2242,9 @@ def execute(self, context): active_item = addon_data.internal_storage_slot_1 elif self.quick_op_target == "SLOT2": active_item = addon_data.internal_storage_slot_2 + elif self.quick_op_target == "CALCRESULT": + active_item = addon_data.quick_calc_result_item + else: active_item = prims[addon_data.active_list_item] @@ -2241,6 +2299,8 @@ def execute(self, context): active_item = addon_data.internal_storage_slot_1 elif self.quick_op_target == "SLOT2": active_item = addon_data.internal_storage_slot_2 + elif self.quick_op_target == "CALCRESULT": + active_item = addon_data.quick_calc_result_item else: active_item = prims[addon_data.active_list_item] @@ -2296,6 +2356,17 @@ class GrabAllSlot2Loc(GrabAndSetItemKindBase): target = 'SLOT2' +class GrabAllCalcResult(GrabAndSetItemKindBase): + bl_idname = "maplus.graballcalcresult" + bl_label = "Grab Global Coordinates From Selected Vertices" + bl_description = ( + "Grabs global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + multiply_by_world_matrix = True + target = 'CALCRESULT' + + class GrabPointFromCursor(GrabFromCursorBase): bl_idname = "maplus.grabpointfromcursor" bl_label = "Grab From Cursor" @@ -2322,6 +2393,15 @@ class Slot2GrabPointFromCursor(GrabFromCursorBase): quick_op_target = "SLOT2" +class CalcResultGrabPointFromCursor(GrabFromCursorBase): + bl_idname = "maplus.calcresultgrabpointfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'point' + quick_op_target = "CALCRESULT" + + class QuickAptSrcGrabPointFromCursor(GrabFromCursorBase): bl_idname = "maplus.quickaptsrcgrabpointfromcursor" bl_label = "Grab From Cursor" @@ -2386,6 +2466,30 @@ class GrabPointSlot1Loc(GrabFromGeometryBase): quick_op_target = "SLOT1" +class GrabPointCalcResult(GrabFromGeometryBase): + bl_idname = "maplus.grabpointcalcresult" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('point',) + multiply_by_world_matrix = True + quick_op_target = "CALCRESULT" + + +class GrabPointCalcResultLoc(GrabFromGeometryBase): + bl_idname = "maplus.grabpointcalcresultloc" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('point',) + multiply_by_world_matrix = False + quick_op_target = "CALCRESULT" + + class GrabPointSlot2(GrabFromGeometryBase): bl_idname = "maplus.grabpointslot2" bl_label = "Grab Local Coordinates From Active Point" @@ -2434,6 +2538,18 @@ class Slot2PointGrabAvg(GrabAverageLocationBase): quick_op_target = "SLOT2" +class CalcResultPointGrabAvg(GrabAverageLocationBase): + bl_idname = "maplus.calcresultpointgrabavg" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('point',) + multiply_by_world_matrix = True + quick_op_target = "CALCRESULT" + + class QuickAptGrabAvgSrc(GrabAverageLocationBase): bl_idname = "maplus.quickaptgrabavgsrc" bl_label = "Grab Average Global Coordinates From Selected Points" @@ -2532,6 +2648,15 @@ class Slot2SendPointToCursor(SendCoordToCursorBase): quick_op_target = 'SLOT2' +class CalcResultSendPointToCursor(SendCoordToCursorBase): + bl_idname = "maplus.calcresultsendpointtocursor" + bl_label = "Sends Point to Cursor" + bl_description = "Sends Point Coordinates to the 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'point' + quick_op_target = 'CALCRESULT' + + class QuickAptSrcSendPointToCursor(SendCoordToCursorBase): bl_idname = "maplus.quickaptsrcsendpointtocursor" bl_label = "Sends Point to Cursor" @@ -2569,8 +2694,8 @@ class Slot1GrabLineStartFromCursor(GrabFromCursorBase): class Slot1GrabLineEndFromCursor(GrabFromCursorBase): bl_idname = "maplus.slot1grablineendfromcursor" - bl_label = "Grab Line Start From Cursor" - bl_description = "Grabs line start coordinates from the 3D cursor" + bl_label = "Grab Line End From Cursor" + bl_description = "Grabs line end coordinates from the 3D cursor" bl_options = {'REGISTER', 'UNDO'} vert_attrib_to_set = 'line_end' quick_op_target = 'SLOT1' @@ -2587,11 +2712,29 @@ class Slot2GrabLineStartFromCursor(GrabFromCursorBase): class Slot2GrabLineEndFromCursor(GrabFromCursorBase): bl_idname = "maplus.slot2grablineendfromcursor" + bl_label = "Grab Line End From Cursor" + bl_description = "Grabs line end coordinates from the 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_end' + quick_op_target = 'SLOT2' + + +class CalcResultGrabLineStartFromCursor(GrabFromCursorBase): + bl_idname = "maplus.calcresultgrablinestartfromcursor" bl_label = "Grab Line Start From Cursor" bl_description = "Grabs line start coordinates from the 3D cursor" bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'line_start' + quick_op_target = 'CALCRESULT' + + +class CalcResultGrabLineEndFromCursor(GrabFromCursorBase): + bl_idname = "maplus.calcresultgrablineendfromcursor" + bl_label = "Grab Line End From Cursor" + bl_description = "Grabs line end coordinates from the 3D cursor" + bl_options = {'REGISTER', 'UNDO'} vert_attrib_to_set = 'line_end' - quick_op_target = 'SLOT2' + quick_op_target = 'CALCRESULT' class QuickAlnSrcGrabLineStartFromCursor(GrabFromCursorBase): @@ -2681,21 +2824,21 @@ class GrabLineStartFromActiveGlobal(GrabFromGeometryBase): multiply_by_world_matrix = True -class Slot1GrabLineStartFromActiveLocal(GrabFromGeometryBase): - bl_idname = "maplus.slot1grablinestartfromactivelocal" +class Slot1GrabLineEndFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.slot1grablineendfromactivelocal" bl_label = "Grab Local Coordinate for Line Start From Active Point" bl_description = ( "Grabs local coordinates for line start from selected vertex" "in edit mode" ) bl_options = {'REGISTER', 'UNDO'} - vert_attribs_to_set = ('line_start',) + vert_attribs_to_set = ('line_end',) multiply_by_world_matrix = False quick_op_target = 'SLOT1' -class Slot1GrabLineEndFromActiveLocal(GrabFromGeometryBase): - bl_idname = "maplus.slot1grablineendfromactivelocal" +class Slot2GrabLineEndFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.slot2grablineendfromactivelocal" bl_label = "Grab Local Coordinate for Line Start From Active Point" bl_description = ( "Grabs local coordinates for line start from selected vertex" @@ -2704,11 +2847,11 @@ class Slot1GrabLineEndFromActiveLocal(GrabFromGeometryBase): bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_end',) multiply_by_world_matrix = False - quick_op_target = 'SLOT1' + quick_op_target = 'SLOT2' -class Slot2GrabLineEndFromActiveLocal(GrabFromGeometryBase): - bl_idname = "maplus.slot2grablineendfromactivelocal" +class CalcResultGrabLineEndFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.calcresultgrablineendfromactivelocal" bl_label = "Grab Local Coordinate for Line Start From Active Point" bl_description = ( "Grabs local coordinates for line start from selected vertex" @@ -2717,14 +2860,14 @@ class Slot2GrabLineEndFromActiveLocal(GrabFromGeometryBase): bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_end',) multiply_by_world_matrix = False - quick_op_target = 'SLOT2' + quick_op_target = 'CALCRESULT' class Slot1GrabLineEndFromActiveGlobal(GrabFromGeometryBase): bl_idname = "maplus.slot1grablineendfromactiveglobal" - bl_label = "Grab Local Coordinate for Line Start From Active Point" + bl_label = "Grab Global Coordinate for Line Start From Active Point" bl_description = ( - "Grabs local coordinates for line start from selected vertex" + "Grabs global coordinates for line start from selected vertex" "in edit mode" ) bl_options = {'REGISTER', 'UNDO'} @@ -2735,9 +2878,9 @@ class Slot1GrabLineEndFromActiveGlobal(GrabFromGeometryBase): class Slot2GrabLineEndFromActiveGlobal(GrabFromGeometryBase): bl_idname = "maplus.slot2grablineendfromactiveglobal" - bl_label = "Grab Local Coordinate for Line Start From Active Point" + bl_label = "Grab Global Coordinate for Line Start From Active Point" bl_description = ( - "Grabs local coordinates for line start from selected vertex" + "Grabs global coordinates for line start from selected vertex" "in edit mode" ) bl_options = {'REGISTER', 'UNDO'} @@ -2746,8 +2889,21 @@ class Slot2GrabLineEndFromActiveGlobal(GrabFromGeometryBase): quick_op_target = 'SLOT2' -class Slot1GrabLineStartFromActiveGlobal(GrabFromGeometryBase): - bl_idname = "maplus.slot1grablinestartfromactiveglobal" +class CalcResultGrabLineEndFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.calcresultgrablineendfromactiveglobal" + bl_label = "Grab Global Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs global coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = 'CALCRESULT' + + +class Slot1GrabLineStartFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.slot1grablinestartfromactivelocal" bl_label = "Grab Local Coordinate for Line Start From Active Point" bl_description = ( "Grabs local coordinates for line start from selected vertex" @@ -2755,6 +2911,19 @@ class Slot1GrabLineStartFromActiveGlobal(GrabFromGeometryBase): ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = False + quick_op_target = 'SLOT1' + + +class Slot1GrabLineStartFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.slot1grablinestartfromactiveglobal" + bl_label = "Grab Global Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs global coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) multiply_by_world_matrix = True quick_op_target = 'SLOT1' @@ -2774,6 +2943,19 @@ class Slot2GrabLineStartFromActiveLocal(GrabFromGeometryBase): class Slot2GrabLineStartFromActiveGlobal(GrabFromGeometryBase): bl_idname = "maplus.slot2grablinestartfromactiveglobal" + bl_label = "Grab Global Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs global coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = 'SLOT2' + + +class CalcResultGrabLineStartFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.calcresultgrablinestartfromactivelocal" bl_label = "Grab Local Coordinate for Line Start From Active Point" bl_description = ( "Grabs local coordinates for line start from selected vertex" @@ -2781,8 +2963,21 @@ class Slot2GrabLineStartFromActiveGlobal(GrabFromGeometryBase): ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = False + quick_op_target = 'CALCRESULT' + + +class CalcResultGrabLineStartFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.calcresultgrablinestartfromactiveglobal" + bl_label = "Grab Global Coordinate for Line Start From Active Point" + bl_description = ( + "Grabs global coordinates for line start from selected vertex" + "in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) multiply_by_world_matrix = True - quick_op_target = 'SLOT2' + quick_op_target = 'CALCRESULT' class Slot1GrabAvgLineStart(GrabAverageLocationBase): @@ -2809,6 +3004,18 @@ class Slot2GrabAvgLineStart(GrabAverageLocationBase): quick_op_target = "SLOT2" +class CalcResultGrabAvgLineStart(GrabAverageLocationBase): + bl_idname = "maplus.calcresultgrabavglinestart" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + quick_op_target = "CALCRESULT" + + class Slot1GrabAvgLineEnd(GrabAverageLocationBase): bl_idname = "maplus.slot1grabavglineend" bl_label = "Grab Average Global Coordinates From Selected Points" @@ -2833,6 +3040,18 @@ class Slot2GrabAvgLineEnd(GrabAverageLocationBase): quick_op_target = "SLOT2" +class CalcResultGrabAvgLineEnd(GrabAverageLocationBase): + bl_idname = "maplus.calcresultgrabavglineend" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + quick_op_target = "CALCRESULT" + + class QuickAlnGrabAvgSrcLineStart(GrabAverageLocationBase): bl_idname = "maplus.quickalngrabavgsrclinestart" bl_label = "Grab Average Global Coordinates From Selected Points" @@ -3203,6 +3422,24 @@ class Slot2SendLineEndToCursor(SendCoordToCursorBase): quick_op_target = 'SLOT2' +class CalcResultSendLineStartToCursor(SendCoordToCursorBase): + bl_idname = "maplus.calcresultsendlinestarttocursor" + bl_label = "Sends Line Start to Cursor" + bl_description = "Sends Line Start Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_start' + quick_op_target = 'CALCRESULT' + + +class CalcResultSendLineEndToCursor(SendCoordToCursorBase): + bl_idname = "maplus.calcresultsendlineendtocursor" + bl_label = "Sends Line End to Cursor" + bl_description = "Sends Line End Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'line_end' + quick_op_target = 'CALCRESULT' + + class QuickAlnSrcSendLineStartToCursor(SendCoordToCursorBase): bl_idname = "maplus.quickalnsrcsendlinestarttocursor" bl_label = "Sends Line Start to Cursor" @@ -3680,6 +3917,30 @@ class GrabLineSlot2Loc(GrabFromGeometryBase): quick_op_target = "SLOT2" +class GrabLineCalcResult(GrabFromGeometryBase): + bl_idname = "maplus.grablinecalcresult" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = True + quick_op_target = "CALCRESULT" + + +class GrabLineCalcResultLoc(GrabFromGeometryBase): + bl_idname = "maplus.grablinecalcresultloc" + bl_label = "Grab Line from Selected Verts" + bl_description = ( + "Grabs line coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = False + quick_op_target = "CALCRESULT" + + class Slot1GrabNormal(GrabNormalBase): bl_idname = "maplus.slot1grabnormal" bl_label = "Grab Normal Coords from Selected Face" @@ -3704,6 +3965,18 @@ class Slot2GrabNormal(GrabNormalBase): quick_op_target = "SLOT2" +class CalcResultGrabNormal(GrabNormalBase): + bl_idname = "maplus.calcresultgrabnormal" + bl_label = "Grab Normal Coords from Selected Face" + bl_description = ( + "Grabs normal coordinates from selected face in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = True + quick_op_target = "CALCRESULT" + + class QuickAlnGrabNormalSrc(GrabNormalBase): bl_idname = "maplus.quickalngrabnormalsrc" bl_label = "Grab Normal Coords from Selected Face" @@ -3982,6 +4255,33 @@ class Slot2GrabPlaneCFromCursor(GrabFromCursorBase): quick_op_target = 'SLOT2' +class CalcResultGrabPlaneAFromCursor(GrabFromCursorBase): + bl_idname = "maplus.calcresultgrabplaneafromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_a' + quick_op_target = 'CALCRESULT' + + +class CalcResultGrabPlaneBFromCursor(GrabFromCursorBase): + bl_idname = "maplus.calcresultgrabplanebfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_b' + quick_op_target = 'CALCRESULT' + + +class CalcResultGrabPlaneCFromCursor(GrabFromCursorBase): + bl_idname = "maplus.calcresultgrabplanecfromcursor" + bl_label = "Grab From Cursor" + bl_description = "Grabs coordinates from 3D cursor" + bl_options = {'REGISTER', 'UNDO'} + vert_attrib_to_set = 'plane_pt_c' + quick_op_target = 'CALCRESULT' + + class QuickAplSrcGrabPlaneAFromCursor(GrabFromCursorBase): bl_idname = "maplus.quickaplsrcgrabplaneafromcursor" bl_label = "Grab From Cursor" @@ -4036,9 +4336,9 @@ class Slot1GrabPlaneAFromActiveLocal(GrabFromGeometryBase): class Slot1GrabPlaneAFromActiveGlobal(GrabFromGeometryBase): bl_idname = "maplus.slot1grabplaneafromactiveglobal" - bl_label = "Grab Local Coordinates From Active Point" + bl_label = "Grab Global Coordinates From Active Point" bl_description = ( - "Grabs local coordinates from selected vertex in edit mode" + "Grabs global coordinates from selected vertex in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('plane_pt_a',) @@ -4060,9 +4360,9 @@ class Slot1GrabPlaneBFromActiveLocal(GrabFromGeometryBase): class Slot1GrabPlaneBFromActiveGlobal(GrabFromGeometryBase): bl_idname = "maplus.slot1grabplanebfromactiveglobal" - bl_label = "Grab Local Coordinates From Active Point" + bl_label = "Grab Global Coordinates From Active Point" bl_description = ( - "Grabs local coordinates from selected vertex in edit mode" + "Grabs global coordinates from selected vertex in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('plane_pt_b',) @@ -4084,9 +4384,9 @@ class Slot1GrabPlaneCFromActiveLocal(GrabFromGeometryBase): class Slot1GrabPlaneCFromActiveGlobal(GrabFromGeometryBase): bl_idname = "maplus.slot1grabplanecfromactiveglobal" - bl_label = "Grab Local Coordinates From Active Point" + bl_label = "Grab Global Coordinates From Active Point" bl_description = ( - "Grabs local coordinates from selected vertex in edit mode" + "Grabs global coordinates from selected vertex in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('plane_pt_c',) @@ -4108,9 +4408,9 @@ class Slot2GrabPlaneAFromActiveLocal(GrabFromGeometryBase): class Slot2GrabPlaneAFromActiveGlobal(GrabFromGeometryBase): bl_idname = "maplus.slot2grabplaneafromactiveglobal" - bl_label = "Grab Local Coordinates From Active Point" + bl_label = "Grab Global Coordinates From Active Point" bl_description = ( - "Grabs local coordinates from selected vertex in edit mode" + "Grabs global coordinates from selected vertex in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('plane_pt_a',) @@ -4132,9 +4432,9 @@ class Slot2GrabPlaneBFromActiveLocal(GrabFromGeometryBase): class Slot2GrabPlaneBFromActiveGlobal(GrabFromGeometryBase): bl_idname = "maplus.slot2grabplanebfromactiveglobal" - bl_label = "Grab Local Coordinates From Active Point" + bl_label = "Grab Global Coordinates From Active Point" bl_description = ( - "Grabs local coordinates from selected vertex in edit mode" + "Grabs global coordinates from selected vertex in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('plane_pt_b',) @@ -4156,14 +4456,86 @@ class Slot2GrabPlaneCFromActiveLocal(GrabFromGeometryBase): class Slot2GrabPlaneCFromActiveGlobal(GrabFromGeometryBase): bl_idname = "maplus.slot2grabplanecfromactiveglobal" + bl_label = "Grab Global Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = True + quick_op_target = 'SLOT2' + + +class CalcResultGrabPlaneAFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.calcresultgrabplaneafromactivelocal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a',) + multiply_by_world_matrix = False + quick_op_target = 'CALCRESULT' + + +class CalcResultGrabPlaneAFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.calcresultgrabplaneafromactiveglobal" + bl_label = "Grab Global Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a',) + multiply_by_world_matrix = True + quick_op_target = 'CALCRESULT' + + +class CalcResultGrabPlaneBFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.calcresultgrabplanebfromactivelocal" bl_label = "Grab Local Coordinates From Active Point" bl_description = ( "Grabs local coordinates from selected vertex in edit mode" ) bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = False + quick_op_target = 'CALCRESULT' + + +class CalcResultGrabPlaneBFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.calcresultgrabplanebfromactiveglobal" + bl_label = "Grab Global Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = True + quick_op_target = 'CALCRESULT' + + +class CalcResultGrabPlaneCFromActiveLocal(GrabFromGeometryBase): + bl_idname = "maplus.calcresultgrabplanecfromactivelocal" + bl_label = "Grab Local Coordinates From Active Point" + bl_description = ( + "Grabs local coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = False + quick_op_target = 'CALCRESULT' + + +class CalcResultGrabPlaneCFromActiveGlobal(GrabFromGeometryBase): + bl_idname = "maplus.calcresultgrabplanecfromactiveglobal" + bl_label = "Grab Global Coordinates From Active Point" + bl_description = ( + "Grabs global coordinates from selected vertex in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('plane_pt_c',) multiply_by_world_matrix = True - quick_op_target = 'SLOT2' + quick_op_target = 'CALCRESULT' class Slot1GrabAvgPlaneA(GrabAverageLocationBase): @@ -4238,6 +4610,42 @@ class Slot2GrabAvgPlaneC(GrabAverageLocationBase): quick_op_target = "SLOT2" +class CalcResultGrabAvgPlaneA(GrabAverageLocationBase): + bl_idname = "maplus.calcresultgrabavgplanea" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a',) + multiply_by_world_matrix = True + quick_op_target = "CALCRESULT" + + +class CalcResultGrabAvgPlaneB(GrabAverageLocationBase): + bl_idname = "maplus.calcresultgrabavgplaneb" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = True + quick_op_target = "CALCRESULT" + + +class CalcResultGrabAvgPlaneC(GrabAverageLocationBase): + bl_idname = "maplus.calcresultgrabavgplanec" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = True + quick_op_target = "CALCRESULT" + + class QuickAplGrabAvgSrcPlaneA(GrabAverageLocationBase): bl_idname = "maplus.quickaplgrabavgsrcplanea" bl_label = "Grab Average Global Coordinates From Selected Points" @@ -4372,6 +4780,33 @@ class Slot2SendPlaneCToCursor(SendCoordToCursorBase): quick_op_target = 'SLOT2' +class CalcResultSendPlaneAToCursor(SendCoordToCursorBase): + bl_idname = "maplus.calcresultsendplaneatocursor" + bl_label = "Sends Plane Point A to Cursor" + bl_description = "Sends Plane Point A Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_a' + quick_op_target = 'CALCRESULT' + + +class CalcResultSendPlaneBToCursor(SendCoordToCursorBase): + bl_idname = "maplus.calcresultsendplanebtocursor" + bl_label = "Sends Plane Point B to Cursor" + bl_description = "Sends Plane Point B Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_b' + quick_op_target = 'CALCRESULT' + + +class CalcResultSendPlaneCToCursor(SendCoordToCursorBase): + bl_idname = "maplus.calcresultsendplanectocursor" + bl_label = "Sends Plane Point C to Cursor" + bl_description = "Sends Plane Point C Coordinates to 3D Cursor" + bl_options = {'REGISTER', 'UNDO'} + source_coord_attrib = 'plane_pt_c' + quick_op_target = 'CALCRESULT' + + class QuickAplSrcSendPlaneAToCursor(SendCoordToCursorBase): bl_idname = "maplus.quickaplsrcsendplaneatocursor" bl_label = "Sends Plane Point A to Cursor" @@ -4706,9 +5141,9 @@ class GrabAllVertsPlaneGlobal(GrabFromGeometryBase): class GrabPlaneSlot1Loc(GrabFromGeometryBase): bl_idname = "maplus.grabplaneslot1loc" - bl_label = "Grab Plane Global Coordinates from Selected Verts" + bl_label = "Grab Plane Local Coordinates from Selected Verts" bl_description = ( - "Grabs plane global coordinates from selected vertices in edit mode" + "Grabs plane local coordinates from selected vertices in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('plane_pt_a', 'plane_pt_b', 'plane_pt_c') @@ -4730,9 +5165,9 @@ class GrabPlaneSlot1(GrabFromGeometryBase): class GrabPlaneSlot2Loc(GrabFromGeometryBase): bl_idname = "maplus.grabplaneslot2loc" - bl_label = "Grab Plane Global Coordinates from Selected Verts" + bl_label = "Grab Plane Local Coordinates from Selected Verts" bl_description = ( - "Grabs plane global coordinates from selected vertices in edit mode" + "Grabs plane local coordinates from selected vertices in edit mode" ) bl_options = {'REGISTER', 'UNDO'} vert_attribs_to_set = ('plane_pt_a', 'plane_pt_b', 'plane_pt_c') @@ -4752,6 +5187,30 @@ class GrabPlaneSlot2(GrabFromGeometryBase): quick_op_target = "SLOT2" +class GrabPlaneCalcResultLoc(GrabFromGeometryBase): + bl_idname = "maplus.grabplanecalcresultloc" + bl_label = "Grab Plane Local Coordinates from Selected Verts" + bl_description = ( + "Grabs plane local coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a', 'plane_pt_b', 'plane_pt_c') + multiply_by_world_matrix = False + quick_op_target = "CALCRESULT" + + +class GrabPlaneCalcResult(GrabFromGeometryBase): + bl_idname = "maplus.grabplanecalcresult" + bl_label = "Grab Plane Global Coordinates from Selected Verts" + bl_description = ( + "Grabs plane global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a', 'plane_pt_b', 'plane_pt_c') + multiply_by_world_matrix = True + quick_op_target = "CALCRESULT" + + class QuickAlignPlanesGrabSrc(GrabFromGeometryBase): bl_idname = "maplus.quickalignplanesgrabsrc" bl_label = "Grab Plane Global Coordinates from Selected Verts" @@ -4838,6 +5297,9 @@ def execute(self, context): active_item = addon_data.internal_storage_slot_1 elif self.quick_op_target == "SLOT2": active_item = addon_data.internal_storage_slot_2 + elif self.quick_op_target == "CALCRESULT": + active_item = addon_data.quick_calc_result_item + else: active_item = prims[addon_data.active_list_item] @@ -4893,6 +5355,15 @@ class Slot2SwapLinePoints(SwapPointsBase): quick_op_target = 'SLOT2' +class CalcResultSwapLinePoints(SwapPointsBase): + bl_idname = "maplus.calcresultswaplinepoints" + bl_label = "Swap Line Points" + bl_description = "Swap line points" + bl_options = {'REGISTER', 'UNDO'} + targets = ('line_start', 'line_end') + quick_op_target = 'CALCRESULT' + + class QuickAlnSrcSwapLinePoints(SwapPointsBase): bl_idname = "maplus.quickalnsrcswaplinepoints" bl_label = "Swap Line Points" @@ -5025,6 +5496,33 @@ class Slot2SwapPlaneBPlaneC(SwapPointsBase): quick_op_target = 'SLOT2' +class CalcResultSwapPlaneAPlaneB(SwapPointsBase): + bl_idname = "maplus.calcresultswapplaneaplaneb" + bl_label = "Swap Plane Point A with Plane Point B" + bl_description = "Swap plane points A and B" + bl_options = {'REGISTER', 'UNDO'} + targets = ('plane_pt_a', 'plane_pt_b') + quick_op_target = 'CALCRESULT' + + +class CalcResultSwapPlaneAPlaneC(SwapPointsBase): + bl_idname = "maplus.calcresultswapplaneaplanec" + bl_label = "Swap Plane Point A with Plane Point C" + bl_description = "Swap plane points A and C" + bl_options = {'REGISTER', 'UNDO'} + targets = ('plane_pt_a', 'plane_pt_c') + quick_op_target = 'CALCRESULT' + + +class CalcResultSwapPlaneBPlaneC(SwapPointsBase): + bl_idname = "maplus.calcresultswapplanebplanec" + bl_label = "Swap Plane Point B with Plane Point C" + bl_description = "Swap plane points B and C" + bl_options = {'REGISTER', 'UNDO'} + targets = ('plane_pt_b', 'plane_pt_c') + quick_op_target = 'CALCRESULT' + + class QuickAplSrcSwapPlaneAPlaneB(SwapPointsBase): bl_idname = "maplus.quickaplsrcswapplaneaplaneb" bl_label = "Swap Plane Point A with Plane Point B" @@ -12315,6 +12813,17 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) + special_grabs = slot1_geom_editor.row(align=True) + special_grabs.operator( + "maplus.copyfromslot1", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs.operator( + "maplus.pasteintoslot1", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) modifier_header = slot1_geom_editor.row() modifier_header.label("Point Modifiers:") @@ -12946,6 +13455,17 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) + special_grabs = slot2_geom_editor.row(align=True) + special_grabs.operator( + "maplus.copyfromslot2", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs.operator( + "maplus.pasteintoslot2", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) modifier_header = slot2_geom_editor.row() modifier_header.label("Point Modifiers:") @@ -13548,8 +14068,651 @@ def draw(self, context): 'quick_calc_result_numeric', "" ) - calc_gui.separator() - + + result_geom_top = calc_gui.row(align=True) + if not addon_data.quick_calc_show_result_geom: + result_geom_top.operator( + "maplus.showhidequickcalcresultgeom", + icon='TRIA_RIGHT', + text="", + emboss=False + ) + preserve_button_roundedge = result_geom_top.row() + preserve_button_roundedge.operator( + "maplus.graballcalcresult", + icon='WORLD', + text="Grab Calc. Result" + ) + + else: + result_geom_top.operator( + "maplus.showhidequickcalcresultgeom", + icon='TRIA_DOWN', + text="", + emboss=False + ) + result_geom_top.label("Calc. Result Coordinates") + calcresult_geom_editor = calc_gui.box() + types_row = calcresult_geom_editor.row() + types_row.label("Item type:") + types_row.prop( + bpy.types.AnyType(addon_data.quick_calc_result_item), + 'kind', + "" + ) + + if addon_data.quick_calc_result_item.kind == 'POINT': + pt_grab_all = calcresult_geom_editor.row(align=True) + pt_grab_all.operator( + "maplus.grabpointcalcresultloc", + icon='VERTEXSEL', + text="Grab All Local" + ) + pt_grab_all.operator( + "maplus.grabpointcalcresult", + icon='WORLD', + text="Grab All Global" + ) + special_grabs = calcresult_geom_editor.row(align=True) + special_grabs.operator( + "maplus.copyfromcalcresult", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs.operator( + "maplus.pasteintocalcresult", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) + + modifier_header = calcresult_geom_editor.row() + modifier_header.label("Point Modifiers:") + apply_mods = modifier_header.row() + apply_mods.alignment = 'RIGHT' + # apply_mods.operator( + # "maplus.applygeommodifiers", + # text="Apply ModifiersXXXXX" + # ) + item_mods_box = calcresult_geom_editor.box() + mods_row_1 = item_mods_box.row() + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_calc_result_item), + 'pt_make_unit_vec', + "Set Length Equal to One" + ) + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_calc_result_item), + 'pt_flip_direction', + "Flip Direction" + ) + mods_row_2 = item_mods_box.row() + mods_row_2.prop( + bpy.types.AnyType(addon_data.quick_calc_result_item), + 'pt_multiplier', + "Multiplier" + ) + + calcresult_geom_editor.label("Pt. Origin:") + # plane_a_items = calcresult_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + pt_items = calcresult_geom_editor.row() + typein_and_grab_pt = pt_items.column() + pt_uppers = typein_and_grab_pt.row() + + pt_uppers_leftside = pt_uppers.row(align=True) + pt_uppers_leftside.alignment = 'LEFT' + pt_uppers_leftside.label("Send:") + pt_uppers_leftside.operator( + "maplus.calcresultsendpointtocursor", + icon='CURSOR', + text="" + ) + + pt_uppers_rightside = pt_uppers.row(align=True) + pt_uppers_rightside.alignment = 'RIGHT' + pt_uppers_rightside.label("Grab:") + pt_uppers_rightside.operator( + "maplus.calcresultgrabpointfromcursor", + icon='CURSOR', + text="" + ) + pt_uppers_rightside.operator( + "maplus.grabpointcalcresultloc", + icon='VERTEXSEL', + text="" + ) + pt_uppers_rightside.operator( + "maplus.grabpointcalcresult", + icon='WORLD', + text="" + ) + pt_uppers_rightside.operator( + "maplus.calcresultpointgrabavg", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_pt.prop( + bpy.types.AnyType(addon_data.quick_calc_result_item), + 'point', + "" + ) + + elif addon_data.quick_calc_result_item.kind == 'LINE': + ln_grab_all = calcresult_geom_editor.row(align=True) + ln_grab_all.operator( + "maplus.grablinecalcresultloc", + icon='VERTEXSEL', + text="Grab All Local" + ) + ln_grab_all.operator( + "maplus.grablinecalcresult", + icon='WORLD', + text="Grab All Global" + ) + + special_grabs = calcresult_geom_editor.row(align=True) + special_grabs.operator( + "maplus.calcresultgrabnormal", + icon='LAMP_HEMI', + text="Grab Normal" + ) + special_grabs_extra = calcresult_geom_editor.row(align=True) + special_grabs_extra.operator( + "maplus.copyfromcalcresult", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs_extra.operator( + "maplus.pasteintocalcresult", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) + + modifier_header = calcresult_geom_editor.row() + modifier_header.label("Line Modifiers:") + apply_mods = modifier_header.row() + apply_mods.alignment = 'RIGHT' + # apply_mods.operator( + # "maplus.applygeommodifiers", + # text="Apply ModifiersXXXXX" + # ) + item_mods_box = calcresult_geom_editor.box() + mods_row_1 = item_mods_box.row() + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_calc_result_item), + 'ln_make_unit_vec', + "Set Length Equal to One" + ) + mods_row_1.prop( + bpy.types.AnyType(addon_data.quick_calc_result_item), + 'ln_flip_direction', + "Flip Direction" + ) + mods_row_2 = item_mods_box.row() + mods_row_2.prop( + bpy.types.AnyType(addon_data.quick_calc_result_item), + 'ln_multiplier', + "Multiplier" + ) + + calcresult_geom_editor.label("Start:") + # plane_a_items = axr_src_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_start_items = calcresult_geom_editor.row() + typein_and_grab_start = ln_start_items.column() + ln_start_uppers = typein_and_grab_start.split(percentage=.33) + + ln_start_swap = ln_start_uppers.row(align=True) + ln_start_swap.label("Swap With:") + ln_start_swap.operator( + "maplus.calcresultswaplinepoints", + text="End" + ) + + ln_start_uppers_rightside = ln_start_uppers.row(align=True) + ln_start_uppers_rightside.alignment = 'RIGHT' + ln_start_uppers_rightside.label("Send:") + ln_start_uppers_rightside.operator( + "maplus.calcresultsendlinestarttocursor", + icon='CURSOR', + text="" + ) + + ln_start_uppers_rightside.label("Grab:") + ln_start_uppers_rightside.operator( + "maplus.calcresultgrablinestartfromcursor", + icon='CURSOR', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.calcresultgrablinestartfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.calcresultgrablinestartfromactiveglobal", + icon='WORLD', + text="" + ) + ln_start_uppers_rightside.operator( + "maplus.calcresultgrabavglinestart", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_start.prop( + bpy.types.AnyType(addon_data.quick_calc_result_item), + 'line_start', + "" + ) + + # component_changers_plna = plane_a_items.row() + # zero_components_plna = component_changers_plna.column( + # align=True + # ) + # zero_components_plna.label("Set Zeroes:") + # zero_components_plna.operator( + # "maplus.zerootherplanepointax", + # text="X00" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointay", + # text="0Y0" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointaz", + # text="00Z" + # ) + # one_components_plna = component_changers_plna.column( + # align=True + # ) + # one_components_plna.label("Set Ones:") + # one_components_plna.operator( + # "maplus.oneotherplanepointax", + # text="X11" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointay", + # text="1Y1" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointaz", + # text="11Z" + # ) + + calcresult_geom_editor.label("End:") + # plane_a_items = calcresult_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + ln_end_items = calcresult_geom_editor.row() + typein_and_grab_end = ln_end_items.column() + ln_end_uppers = typein_and_grab_end.split(percentage=.33) + + ln_end_swap = ln_end_uppers.row(align=True) + ln_end_swap.label("Swap With:") + ln_end_swap.operator( + "maplus.calcresultswaplinepoints", + text="Start" + ) + + ln_end_uppers_rightside = ln_end_uppers.row(align=True) + ln_end_uppers_rightside.alignment = 'RIGHT' + ln_end_uppers_rightside.label("Send:") + ln_end_uppers_rightside.operator( + "maplus.calcresultsendlineendtocursor", + icon='CURSOR', + text="" + ) + + ln_end_uppers_rightside.label("Grab:") + ln_end_uppers_rightside.operator( + "maplus.calcresultgrablineendfromcursor", + icon='CURSOR', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.calcresultgrablineendfromactivelocal", + icon='VERTEXSEL', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.calcresultgrablineendfromactiveglobal", + icon='WORLD', + text="" + ) + ln_end_uppers_rightside.operator( + "maplus.calcresultgrabavglineend", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_end.prop( + bpy.types.AnyType(addon_data.quick_calc_result_item), + 'line_end', + "" + ) + + # component_changers_plnc = plane_c_items.row() + # zero_components_plnc = component_changers_plnc.column( + # align=True + # ) + # zero_components_plnc.label("Set Zeroes:") + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcx", + # text="X00" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcy", + # text="0Y0" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcz", + # text="00Z" + # ) + # one_components_plnc = component_changers_plnc.column( + # align=True + # ) + # one_components_plnc.label("Set Ones:") + # one_components_plnc.operator( + # "maplus.oneotherplanepointcx", + # text="X11" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcy", + # text="1Y1" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcz", + # text="11Z" + # ) + elif addon_data.quick_calc_result_item.kind == 'PLANE': + plane_grab_all = calcresult_geom_editor.row(align=True) + plane_grab_all.operator( + "maplus.grabplanecalcresultloc", + icon='VERTEXSEL', + text="Grab All Local" + ) + plane_grab_all.operator( + "maplus.grabplanecalcresult", + icon='WORLD', + text="Grab All Global" + ) + special_grabs = calcresult_geom_editor.row(align=True) + special_grabs.operator( + "maplus.copyfromcalcresult", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs.operator( + "maplus.pasteintocalcresult", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) + + calcresult_geom_editor.label("Pt. A:") + # plane_a_items = calcresult_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + plane_a_items = calcresult_geom_editor.row() + typein_and_grab_plna = plane_a_items.column() + plane_a_uppers = typein_and_grab_plna.split(percentage=.33) + + plane_a_swap = plane_a_uppers.row(align=True) + plane_a_swap.label("Swap With:") + plane_a_swap.operator( + "maplus.calcresultswapplaneaplaneb", + text="B" + ) + plane_a_swap.operator( + "maplus.calcresultswapplaneaplanec", + text="C" + ) + + plane_a_uppers_rightside = plane_a_uppers.row(align=True) + plane_a_uppers_rightside.alignment = 'RIGHT' + plane_a_uppers_rightside.label("Send:") + plane_a_uppers_rightside.operator( + "maplus.calcresultsendplaneatocursor", + icon='CURSOR', + text="" + ) + + plane_a_uppers_rightside.label("Grab:") + plane_a_uppers_rightside.operator( + "maplus.calcresultgrabplaneafromcursor", + icon='CURSOR', + text="" + ) + plane_a_uppers_rightside.operator( + "maplus.calcresultgrabplaneafromactivelocal", + icon='VERTEXSEL', + text="" + ) + plane_a_uppers_rightside.operator( + "maplus.calcresultgrabplaneafromactiveglobal", + icon='WORLD', + text="" + ) + plane_a_uppers_rightside.operator( + "maplus.calcresultgrabavgplanea", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_plna.prop( + bpy.types.AnyType(addon_data.quick_calc_result_item), + 'plane_pt_a', + "" + ) + + # component_changers_plna = plane_a_items.row() + # zero_components_plna = component_changers_plna.column( + # align=True + # ) + # zero_components_plna.label("Set Zeroes:") + # zero_components_plna.operator( + # "maplus.zerootherplanepointax", + # text="X00" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointay", + # text="0Y0" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointaz", + # text="00Z" + # ) + # one_components_plna = component_changers_plna.column( + # align=True + # ) + # one_components_plna.label("Set Ones:") + # one_components_plna.operator( + # "maplus.oneotherplanepointax", + # text="X11" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointay", + # text="1Y1" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointaz", + # text="11Z" + # ) + + calcresult_geom_editor.label("Pt. B (Pivot):") + # plane_b_items = calcresult_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + plane_b_items = calcresult_geom_editor.row() + typein_and_grab_plnb = plane_b_items.column() + plane_b_uppers = typein_and_grab_plnb.split(percentage=.33) + plane_b_swap = plane_b_uppers.row(align=True) + plane_b_swap.label("Swap With:") + plane_b_swap.operator( + "maplus.calcresultswapplaneaplaneb", + text="A" + ) + plane_b_swap.operator( + "maplus.calcresultswapplanebplanec", + text="C" + ) + + plane_b_uppers_rightside = plane_b_uppers.row(align=True) + plane_b_uppers_rightside.alignment = 'RIGHT' + plane_b_uppers_rightside.label("Send:") + plane_b_uppers_rightside.operator( + "maplus.calcresultsendplanebtocursor", + icon='CURSOR', + text="" + ) + + plane_b_uppers_rightside.label("Grab:") + plane_b_uppers_rightside.operator( + "maplus.calcresultgrabplanebfromcursor", + icon='CURSOR', + text="" + ) + plane_b_uppers_rightside.operator( + "maplus.calcresultgrabplanebfromactivelocal", + icon='VERTEXSEL', + text="" + ) + plane_b_uppers_rightside.operator( + "maplus.calcresultgrabplanebfromactiveglobal", + icon='WORLD', + text="" + ) + plane_b_uppers_rightside.operator( + "maplus.calcresultgrabavgplaneb", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_plnb.prop( + bpy.types.AnyType(addon_data.quick_calc_result_item), + 'plane_pt_b', + "" + ) + + # component_changers_plnb = plane_b_items.row() + # zero_components_plnb = component_changers_plnb.column( + # align=True + # ) + # zero_components_plnb.label("Set Zeroes:") + # zero_components_plnb.operator( + # "maplus.zerootherplanepointbx", + # text="X00" + # ) + # zero_components_plnb.operator( + # "maplus.zerootherplanepointby", + # text="0Y0" + # ) + # zero_components_plnb.operator( + # "maplus.zerootherplanepointbz", + # text="00Z" + # ) + # one_components_plnb = component_changers_plnb.column( + # align=True + # ) + # one_components_plnb.label("Set Ones:") + # one_components_plnb.operator( + # "maplus.oneotherplanepointbx", + # text="X11" + # ) + # one_components_plnb.operator( + # "maplus.oneotherplanepointby", + # text="1Y1" + # ) + # one_components_plnb.operator( + # "maplus.oneotherplanepointbz", + # text="11Z" + # ) + + calcresult_geom_editor.label("Pt. C:") + # plane_c_items = calcresult_geom_editor.split(percentage=.75) + # ^ line changed to remove component changers + plane_c_items = calcresult_geom_editor.row() + typein_and_grab_plnc = plane_c_items.column() + plane_c_uppers = typein_and_grab_plnc.split(percentage=.33) + plane_c_swap = plane_c_uppers.row(align=True) + plane_c_swap.label("Swap With:") + plane_c_swap.operator( + "maplus.calcresultswapplaneaplanec", + text="A" + ) + plane_c_swap.operator( + "maplus.calcresultswapplanebplanec", + text="B" + ) + + plane_c_uppers_rightside = plane_c_uppers.row(align=True) + plane_c_uppers_rightside.alignment = 'RIGHT' + plane_c_uppers_rightside.label("Send:") + plane_c_uppers_rightside.operator( + "maplus.calcresultsendplanectocursor", + icon='CURSOR', + text="" + ) + + plane_c_uppers_rightside.label("Grab:") + plane_c_uppers_rightside.operator( + "maplus.calcresultgrabplanecfromcursor", + icon='CURSOR', + text="" + ) + plane_c_uppers_rightside.operator( + "maplus.calcresultgrabplanecfromactivelocal", + icon='VERTEXSEL', + text="" + ) + plane_c_uppers_rightside.operator( + "maplus.calcresultgrabplanecfromactiveglobal", + icon='WORLD', + text="" + ) + plane_c_uppers_rightside.operator( + "maplus.calcresultgrabavgplanec", + icon='GROUP_VERTEX', + text="" + ) + typein_and_grab_plnc.prop( + bpy.types.AnyType(addon_data.quick_calc_result_item), + 'plane_pt_c', + "" + ) + + # component_changers_plnc = plane_c_items.row() + # zero_components_plnc = component_changers_plnc.column( + # align=True + # ) + # zero_components_plnc.label("Set Zeroes:") + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcx", + # text="X00" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcy", + # text="0Y0" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcz", + # text="00Z" + # ) + # one_components_plnc = component_changers_plnc.column( + # align=True + # ) + # one_components_plnc.label("Set Ones:") + # one_components_plnc.operator( + # "maplus.oneotherplanepointcx", + # text="X11" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcy", + # text="1Y1" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcz", + # text="11Z" + # ) + # if addon_data.quick_calc_show_calcresult_geom: + # calc_gui.separator() + + calc_gui.separator() + + calc_gui.label("Available Calc.'s:") calc_gui.operator( "maplus.quickcalclinelength", text="Line Length" From 9d02f2c9c7ee07f7d87130d608dcb71142395c87 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Tue, 28 Mar 2017 15:57:00 -0400 Subject: [PATCH 30/56] Started initial UI revision work. --- mesh_mesh_align_plus.py | 142 ++++++++++++++++++++++++++-------------- 1 file changed, 94 insertions(+), 48 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 2c084ea..214bef5 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -8808,6 +8808,77 @@ def draw_item(self, layout.label(item.name, icon="MANIPUL") +def layout_coordvec(parent_layout, + coordvec_label, + op_id_cursor_grab, + op_id_avg_grab, + op_id_local_grab, + op_id_global_grab, + coord_prop, + op_id_cursor_send, + op_id_text_tuple_swap_first=None, + op_id_text_tuple_swap_second=None): + coordvec_container = parent_layout.column(align=True) + coordvec_container.label(coordvec_label) + type_or_grab_coords = coordvec_container.column() + + grab_buttons = type_or_grab_coords.row(align=True) + grab_buttons.label("Grab:") + grab_buttons.operator( + op_id_cursor_grab, + icon='CURSOR', + text="" + ) + grab_buttons.operator( + op_id_avg_grab, + icon='GROUP_VERTEX', + text="" + ) + grab_buttons.operator( + op_id_local_grab, + icon='VERTEXSEL', + text="" + ) + grab_buttons.operator( + op_id_global_grab, + icon='WORLD', + text="" + ) + + type_or_grab_coords.prop( + bpy.types.AnyType(coord_prop), + 'line_start', + "" + ) + + coordvec_lowers = type_or_grab_coords.row() + + if op_id_text_tuple_swap_first: + coordvec_lowers.label("Swap:") + if op_id_text_tuple_swap_second: + aligned_swap_buttons = coordvec_lowers.row(align=True) + aligned_swap_buttons.operator( + op_id_text_tuple_swap_first[0], + text=op_id_text_tuple_swap_first[1] + ) + aligned_swap_buttons.operator( + op_id_text_tuple_swap_second[0], + text=op_id_text_tuple_swap_second[1] + ) + else: + coordvec_lowers.operator( + op_id_text_tuple_swap_first[0], + text=op_id_text_tuple_swap_first[1] + ) + + coordvec_lowers.label("Send:") + coordvec_lowers.operator( + op_id_cursor_send, + icon='CURSOR', + text="" + ) + + # Advanced Tools panel class MAPlusGui(bpy.types.Panel): bl_idname = "maplus_advanced_tools" @@ -10708,54 +10779,29 @@ def draw(self, context): "Multiplier" ) - aln_dest_geom_editor.label("Start:") - # plane_a_items = aln_dest_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_start_items = aln_dest_geom_editor.row() - typein_and_grab_start = ln_start_items.column() - ln_start_uppers = typein_and_grab_start.split(percentage=.33) - - ln_start_swap = ln_start_uppers.row(align=True) - ln_start_swap.label("Swap With:") - ln_start_swap.operator( - "maplus.quickalndestswaplinepoints", - text="End" - ) - - ln_start_uppers_rightside = ln_start_uppers.row(align=True) - ln_start_uppers_rightside.alignment = 'RIGHT' - ln_start_uppers_rightside.label("Send:") - ln_start_uppers_rightside.operator( - "maplus.quickalndestsendlinestarttocursor", - icon='CURSOR', - text="" - ) - - ln_start_uppers_rightside.label("Grab:") - ln_start_uppers_rightside.operator( - "maplus.quickalndestgrablinestartfromcursor", - icon='CURSOR', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quickalndestgrablinestartfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quickalndestgrablinestartfromactiveglobal", - icon='WORLD', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quickalngrabavgdestlinestart", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_start.prop( - bpy.types.AnyType(addon_data.quick_align_lines_dest), - 'line_start', - "" + layout_coordvec( + parent_layout=aln_dest_geom_editor, + coordvec_label="Start:", + op_id_cursor_grab=( + "maplus.quickalndestgrablinestartfromcursor" + ), + op_id_avg_grab=( + "maplus.quickalngrabavgdestlinestart" + ), + op_id_local_grab=( + "maplus.quickalndestgrablinestartfromactivelocal" + ), + op_id_global_grab=( + "maplus.quickalndestgrablinestartfromactiveglobal" + ), + coord_prop=addon_data.quick_align_lines_dest, + op_id_cursor_send=( + "maplus.quickalndestsendlinestarttocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quickalndestswaplinepoints", + "End" + ) ) # component_changers_plna = plane_a_items.row() From 9e6d4df66e841c73a32663b9526cbcc8f4a0588c Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Wed, 29 Mar 2017 21:10:01 -0400 Subject: [PATCH 31/56] Revised geom. subpoint coordinate layouts. --- mesh_mesh_align_plus.py | 2602 +++++++++++++-------------------------- 1 file changed, 889 insertions(+), 1713 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 35c2ba7..9adcbe6 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -8814,7 +8814,8 @@ def layout_coordvec(parent_layout, op_id_avg_grab, op_id_local_grab, op_id_global_grab, - coord_prop, + coord_container, + coord_attribute, op_id_cursor_send, op_id_text_tuple_swap_first=None, op_id_text_tuple_swap_second=None): @@ -8846,8 +8847,8 @@ def layout_coordvec(parent_layout, ) type_or_grab_coords.prop( - bpy.types.AnyType(coord_prop), - 'line_start', + bpy.types.AnyType(coord_container), + coord_attribute, "" ) @@ -8874,7 +8875,7 @@ def layout_coordvec(parent_layout, coordvec_lowers.label("Send:") coordvec_lowers.operator( op_id_cursor_send, - icon='CURSOR', + icon='DRIVER', text="" ) @@ -10163,49 +10164,26 @@ def draw(self, context): "Multiplier" ) - apt_src_geom_editor.label("Pt. Origin:") - # plane_a_items = apt_src_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - pt_items = apt_src_geom_editor.row() - typein_and_grab_pt = pt_items.column() - pt_uppers = typein_and_grab_pt.row() - - pt_uppers_leftside = pt_uppers.row(align=True) - pt_uppers_leftside.alignment = 'LEFT' - pt_uppers_leftside.label("Send:") - pt_uppers_leftside.operator( - "maplus.quickaptsrcsendpointtocursor", - icon='CURSOR', - text="" - ) - - pt_uppers_rightside = pt_uppers.row(align=True) - pt_uppers_rightside.alignment = 'RIGHT' - pt_uppers_rightside.label("Grab:") - pt_uppers_rightside.operator( - "maplus.quickaptsrcgrabpointfromcursor", - icon='CURSOR', - text="" - ) - pt_uppers_rightside.operator( - "maplus.quickalignpointsgrabsrcloc", - icon='VERTEXSEL', - text="" - ) - pt_uppers_rightside.operator( - "maplus.quickalignpointsgrabsrc", - icon='WORLD', - text="" - ) - pt_uppers_rightside.operator( - "maplus.quickaptgrabavgsrc", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_pt.prop( - bpy.types.AnyType(addon_data.quick_align_pts_src), - 'point', - "" + layout_coordvec( + parent_layout=apt_src_geom_editor, + coordvec_label="Pt. Origin:", + op_id_cursor_grab=( + "maplus.quickaptsrcgrabpointfromcursor" + ), + op_id_avg_grab=( + "maplus.quickaptgrabavgsrc" + ), + op_id_local_grab=( + "maplus.quickalignpointsgrabsrcloc" + ), + op_id_global_grab=( + "maplus.quickalignpointsgrabsrc" + ), + coord_container=addon_data.quick_align_pts_src, + coord_attribute="point", + op_id_cursor_send=( + "maplus.quickaptsrcsendpointtocursor" + ) ) # component_changers_plna = plane_a_items.row() @@ -10324,49 +10302,26 @@ def draw(self, context): "Multiplier" ) - apt_dest_geom_editor.label("Pt. Origin:") - # plane_a_items = apt_src_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - pt_items = apt_dest_geom_editor.row() - typein_and_grab_pt = pt_items.column() - pt_uppers = typein_and_grab_pt.row() - - pt_uppers_leftside = pt_uppers.row(align=True) - pt_uppers_leftside.alignment = 'LEFT' - pt_uppers_leftside.label("Send:") - pt_uppers_leftside.operator( - "maplus.quickaptdestsendpointtocursor", - icon='CURSOR', - text="" - ) - - pt_uppers_rightside = pt_uppers.row(align=True) - pt_uppers_rightside.alignment = 'RIGHT' - pt_uppers_rightside.label("Grab:") - pt_uppers_rightside.operator( - "maplus.quickaptdestgrabpointfromcursor", - icon='CURSOR', - text="" - ) - pt_uppers_rightside.operator( - "maplus.quickalignpointsgrabdestloc", - icon='VERTEXSEL', - text="" - ) - pt_uppers_rightside.operator( - "maplus.quickalignpointsgrabdest", - icon='WORLD', - text="" - ) - pt_uppers_rightside.operator( - "maplus.quickaptgrabavgdest", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_pt.prop( - bpy.types.AnyType(addon_data.quick_align_pts_dest), - 'point', - "" + layout_coordvec( + parent_layout=apt_dest_geom_editor, + coordvec_label="Pt. Origin:", + op_id_cursor_grab=( + "maplus.quickaptdestgrabpointfromcursor" + ), + op_id_avg_grab=( + "maplus.quickaptgrabavgdest" + ), + op_id_local_grab=( + "maplus.quickalignpointsgrabdestloc" + ), + op_id_global_grab=( + "maplus.quickalignpointsgrabdest" + ), + coord_container=addon_data.quick_align_pts_dest, + coord_attribute="point", + op_id_cursor_send=( + "maplus.quickaptdestsendpointtocursor" + ) ) ######################## @@ -10526,54 +10481,30 @@ def draw(self, context): "Multiplier" ) - aln_src_geom_editor.label("Start:") - # plane_a_items = aln_src_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_start_items = aln_src_geom_editor.row() - typein_and_grab_start = ln_start_items.column() - ln_start_uppers = typein_and_grab_start.split(percentage=.33) - - ln_start_swap = ln_start_uppers.row(align=True) - ln_start_swap.label("Swap With:") - ln_start_swap.operator( - "maplus.quickalnsrcswaplinepoints", - text="End" - ) - - ln_start_uppers_rightside = ln_start_uppers.row(align=True) - ln_start_uppers_rightside.alignment = 'RIGHT' - ln_start_uppers_rightside.label("Send:") - ln_start_uppers_rightside.operator( - "maplus.quickalnsrcsendlinestarttocursor", - icon='CURSOR', - text="" - ) - - ln_start_uppers_rightside.label("Grab:") - ln_start_uppers_rightside.operator( - "maplus.quickalnsrcgrablinestartfromcursor", - icon='CURSOR', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quickalnsrcgrablinestartfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quickalnsrcgrablinestartfromactiveglobal", - icon='WORLD', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quickalngrabavgsrclinestart", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_start.prop( - bpy.types.AnyType(addon_data.quick_align_lines_src), - 'line_start', - "" + layout_coordvec( + parent_layout=aln_src_geom_editor, + coordvec_label="Start:", + op_id_cursor_grab=( + "maplus.quickalnsrcgrablinestartfromcursor" + ), + op_id_avg_grab=( + "maplus.quickalngrabavgsrclinestart" + ), + op_id_local_grab=( + "maplus.quickalnsrcgrablinestartfromactivelocal" + ), + op_id_global_grab=( + "maplus.quickalnsrcgrablinestartfromactiveglobal" + ), + coord_container=addon_data.quick_align_lines_src, + coord_attribute="line_start", + op_id_cursor_send=( + "maplus.quickalnsrcsendlinestarttocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quickalnsrcswaplinepoints", + "End" + ) ) # component_changers_plna = plane_a_items.row() @@ -10609,56 +10540,31 @@ def draw(self, context): # "maplus.oneotherplanepointaz", # text="11Z" # ) - - - aln_src_geom_editor.label("End:") - # plane_a_items = aln_src_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_end_items = aln_src_geom_editor.row() - typein_and_grab_end = ln_end_items.column() - ln_end_uppers = typein_and_grab_end.split(percentage=.33) - - ln_end_swap = ln_end_uppers.row(align=True) - ln_end_swap.label("Swap With:") - ln_end_swap.operator( - "maplus.quickalnsrcswaplinepoints", - text="Start" - ) - - ln_end_uppers_rightside = ln_end_uppers.row(align=True) - ln_end_uppers_rightside.alignment = 'RIGHT' - ln_end_uppers_rightside.label("Send:") - ln_end_uppers_rightside.operator( - "maplus.quickalnsrcsendlineendtocursor", - icon='CURSOR', - text="" - ) - ln_end_uppers_rightside.label("Grab:") - ln_end_uppers_rightside.operator( - "maplus.quickalnsrcgrablineendfromcursor", - icon='CURSOR', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quickalnsrcgrablineendfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quickalnsrcgrablineendfromactiveglobal", - icon='WORLD', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quickalngrabavgsrclineend", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_end.prop( - bpy.types.AnyType(addon_data.quick_align_lines_src), - 'line_end', - "" + layout_coordvec( + parent_layout=aln_src_geom_editor, + coordvec_label="End:", + op_id_cursor_grab=( + "maplus.quickalnsrcgrablineendfromcursor" + ), + op_id_avg_grab=( + "maplus.quickalngrabavgsrclineend" + ), + op_id_local_grab=( + "maplus.quickalnsrcgrablineendfromactivelocal" + ), + op_id_global_grab=( + "maplus.quickalnsrcgrablineendfromactiveglobal" + ), + coord_container=addon_data.quick_align_lines_src, + coord_attribute="line_end", + op_id_cursor_send=( + "maplus.quickalnsrcsendlineendtocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quickalnsrcswaplinepoints", + "Start" + ) ) # component_changers_plnc = plane_c_items.row() @@ -10804,7 +10710,8 @@ def draw(self, context): op_id_global_grab=( "maplus.quickalndestgrablinestartfromactiveglobal" ), - coord_prop=addon_data.quick_align_lines_dest, + coord_container=addon_data.quick_align_lines_dest, + coord_attribute="line_start", op_id_cursor_send=( "maplus.quickalndestsendlinestarttocursor" ), @@ -10848,54 +10755,30 @@ def draw(self, context): # text="11Z" # ) - aln_dest_geom_editor.label("End:") - # plane_a_items = aln_dest_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_end_items = aln_dest_geom_editor.row() - typein_and_grab_end = ln_end_items.column() - ln_end_uppers = typein_and_grab_end.split(percentage=.33) - - ln_end_swap = ln_end_uppers.row(align=True) - ln_end_swap.label("Swap With:") - ln_end_swap.operator( - "maplus.quickalndestswaplinepoints", - text="Start" - ) - - ln_end_uppers_rightside = ln_end_uppers.row(align=True) - ln_end_uppers_rightside.alignment = 'RIGHT' - ln_end_uppers_rightside.label("Send:") - ln_end_uppers_rightside.operator( - "maplus.quickalndestsendlineendtocursor", - icon='CURSOR', - text="" - ) - - ln_end_uppers_rightside.label("Grab:") - ln_end_uppers_rightside.operator( - "maplus.quickalndestgrablineendfromcursor", - icon='CURSOR', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quickalndestgrablineendfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quickalndestgrablineendfromactiveglobal", - icon='WORLD', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quickalngrabavgdestlineend", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_end.prop( - bpy.types.AnyType(addon_data.quick_align_lines_dest), - 'line_end', - "" + layout_coordvec( + parent_layout=aln_dest_geom_editor, + coordvec_label="End:", + op_id_cursor_grab=( + "maplus.quickalndestgrablineendfromcursor" + ), + op_id_avg_grab=( + "maplus.quickalngrabavgdestlineend" + ), + op_id_local_grab=( + "maplus.quickalndestgrablineendfromactivelocal" + ), + op_id_global_grab=( + "maplus.quickalndestgrablineendfromactiveglobal" + ), + coord_container=addon_data.quick_align_lines_dest, + coord_attribute="line_end", + op_id_cursor_send=( + "maplus.quickalndestsendlineendtocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quickalndestswaplinepoints", + "Start" + ) ) ################################### @@ -11011,58 +10894,34 @@ def draw(self, context): text="Paste (From Clipboard)" ) - apl_src_geom_editor.label("Pt. A:") - # plane_a_items = apl_src_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - plane_a_items = apl_src_geom_editor.row() - typein_and_grab_plna = plane_a_items.column() - plane_a_uppers = typein_and_grab_plna.split(percentage=.33) - - plane_a_swap = plane_a_uppers.row(align=True) - plane_a_swap.label("Swap With:") - plane_a_swap.operator( - "maplus.quickaplsrcswapplaneaplaneb", - text="B" - ) - plane_a_swap.operator( - "maplus.quickaplsrcswapplaneaplanec", - text="C" - ) - - plane_a_uppers_rightside = plane_a_uppers.row(align=True) - plane_a_uppers_rightside.alignment = 'RIGHT' - plane_a_uppers_rightside.label("Send:") - plane_a_uppers_rightside.operator( - "maplus.quickaplsrcsendplaneatocursor", - icon='CURSOR', - text="" - ) - - plane_a_uppers_rightside.label("Grab:") - plane_a_uppers_rightside.operator( - "maplus.quickaplsrcgrabplaneafromcursor", - icon='CURSOR', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.quickaplsrcgrabplaneafromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.quickaplsrcgrabplaneafromactiveglobal", - icon='WORLD', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.quickaplgrabavgsrcplanea", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_plna.prop( - bpy.types.AnyType(addon_data.quick_align_planes_src), - 'plane_pt_a', - "" + layout_coordvec( + parent_layout=apl_src_geom_editor, + coordvec_label="Pt. A:", + op_id_cursor_grab=( + "maplus.quickaplsrcgrabplaneafromcursor" + ), + op_id_avg_grab=( + "maplus.quickaplgrabavgsrcplanea" + ), + op_id_local_grab=( + "maplus.quickaplsrcgrabplaneafromactivelocal" + ), + op_id_global_grab=( + "maplus.quickaplsrcgrabplaneafromactiveglobal" + ), + coord_container=addon_data.quick_align_planes_src, + coord_attribute="plane_pt_a", + op_id_cursor_send=( + "maplus.quickaplsrcsendplaneatocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quickaplsrcswapplaneaplaneb", + "B" + ), + op_id_text_tuple_swap_second=( + "maplus.quickaplsrcswapplaneaplanec", + "C" + ) ) # component_changers_plna = plane_a_items.row() @@ -11099,57 +10958,34 @@ def draw(self, context): # text="11Z" # ) - apl_src_geom_editor.label("Pt. B (Pivot):") - # plane_b_items = apl_src_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - plane_b_items = apl_src_geom_editor.row() - typein_and_grab_plnb = plane_b_items.column() - plane_b_uppers = typein_and_grab_plnb.split(percentage=.33) - plane_b_swap = plane_b_uppers.row(align=True) - plane_b_swap.label("Swap With:") - plane_b_swap.operator( - "maplus.quickaplsrcswapplaneaplaneb", - text="A" - ) - plane_b_swap.operator( - "maplus.quickaplsrcswapplanebplanec", - text="C" - ) - - plane_b_uppers_rightside = plane_b_uppers.row(align=True) - plane_b_uppers_rightside.alignment = 'RIGHT' - plane_b_uppers_rightside.label("Send:") - plane_b_uppers_rightside.operator( - "maplus.quickaplsrcsendplanebtocursor", - icon='CURSOR', - text="" - ) - - plane_b_uppers_rightside.label("Grab:") - plane_b_uppers_rightside.operator( - "maplus.quickaplsrcgrabplanebfromcursor", - icon='CURSOR', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.quickaplsrcgrabplanebfromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.quickaplsrcgrabplanebfromactiveglobal", - icon='WORLD', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.quickaplgrabavgsrcplaneb", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_plnb.prop( - bpy.types.AnyType(addon_data.quick_align_planes_src), - 'plane_pt_b', - "" + layout_coordvec( + parent_layout=apl_src_geom_editor, + coordvec_label="Pt. B:", + op_id_cursor_grab=( + "maplus.quickaplsrcgrabplanebfromcursor" + ), + op_id_avg_grab=( + "maplus.quickaplgrabavgsrcplaneb" + ), + op_id_local_grab=( + "maplus.quickaplsrcgrabplanebfromactivelocal" + ), + op_id_global_grab=( + "maplus.quickaplsrcgrabplanebfromactiveglobal" + ), + coord_container=addon_data.quick_align_planes_src, + coord_attribute="plane_pt_b", + op_id_cursor_send=( + "maplus.quickaplsrcsendplanebtocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quickaplsrcswapplaneaplaneb", + "A" + ), + op_id_text_tuple_swap_second=( + "maplus.quickaplsrcswapplanebplanec", + "C" + ) ) # component_changers_plnb = plane_b_items.row() @@ -11186,57 +11022,34 @@ def draw(self, context): # text="11Z" # ) - apl_src_geom_editor.label("Pt. C:") - # plane_c_items = apl_src_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - plane_c_items = apl_src_geom_editor.row() - typein_and_grab_plnc = plane_c_items.column() - plane_c_uppers = typein_and_grab_plnc.split(percentage=.33) - plane_c_swap = plane_c_uppers.row(align=True) - plane_c_swap.label("Swap With:") - plane_c_swap.operator( - "maplus.quickaplsrcswapplaneaplanec", - text="A" - ) - plane_c_swap.operator( - "maplus.quickaplsrcswapplanebplanec", - text="B" - ) - - plane_c_uppers_rightside = plane_c_uppers.row(align=True) - plane_c_uppers_rightside.alignment = 'RIGHT' - plane_c_uppers_rightside.label("Send:") - plane_c_uppers_rightside.operator( - "maplus.quickaplsrcsendplanectocursor", - icon='CURSOR', - text="" - ) - - plane_c_uppers_rightside.label("Grab:") - plane_c_uppers_rightside.operator( - "maplus.quickaplsrcgrabplanecfromcursor", - icon='CURSOR', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.quickaplsrcgrabplanecfromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.quickaplsrcgrabplanecfromactiveglobal", - icon='WORLD', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.quickaplgrabavgsrcplanec", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_plnc.prop( - bpy.types.AnyType(addon_data.quick_align_planes_src), - 'plane_pt_c', - "" + layout_coordvec( + parent_layout=apl_src_geom_editor, + coordvec_label="Pt. C:", + op_id_cursor_grab=( + "maplus.quickaplsrcgrabplanecfromcursor" + ), + op_id_avg_grab=( + "maplus.quickaplgrabavgsrcplanec" + ), + op_id_local_grab=( + "maplus.quickaplsrcgrabplanecfromactivelocal" + ), + op_id_global_grab=( + "maplus.quickaplsrcgrabplanecfromactiveglobal" + ), + coord_container=addon_data.quick_align_planes_src, + coord_attribute="plane_pt_c", + op_id_cursor_send=( + "maplus.quickaplsrcsendplanectocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quickaplsrcswapplaneaplanec", + "A" + ), + op_id_text_tuple_swap_second=( + "maplus.quickaplsrcswapplanebplanec", + "B" + ) ) # component_changers_plnc = plane_c_items.row() @@ -11329,58 +11142,34 @@ def draw(self, context): text="Paste (From Clipboard)" ) - apl_dest_geom_editor.label("Pt. A:") - # plane_a_items = apl_dest_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - plane_a_items = apl_dest_geom_editor.row() - typein_and_grab_plna = plane_a_items.column() - plane_a_uppers = typein_and_grab_plna.split(percentage=.33) - - plane_a_swap = plane_a_uppers.row(align=True) - plane_a_swap.label("Swap With:") - plane_a_swap.operator( - "maplus.quickapldestswapplaneaplaneb", - text="B" - ) - plane_a_swap.operator( - "maplus.quickapldestswapplaneaplanec", - text="C" - ) - - plane_a_uppers_rightside = plane_a_uppers.row(align=True) - plane_a_uppers_rightside.alignment = 'RIGHT' - plane_a_uppers_rightside.label("Send:") - plane_a_uppers_rightside.operator( - "maplus.quickapldestsendplaneatocursor", - icon='CURSOR', - text="" - ) - - plane_a_uppers_rightside.label("Grab:") - plane_a_uppers_rightside.operator( - "maplus.quickapldestgrabplaneafromcursor", - icon='CURSOR', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.quickapldestgrabplaneafromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.quickapldestgrabplaneafromactiveglobal", - icon='WORLD', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.quickaplgrabavgdestplanea", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_plna.prop( - bpy.types.AnyType(addon_data.quick_align_planes_dest), - 'plane_pt_a', - "" + layout_coordvec( + parent_layout=apl_dest_geom_editor, + coordvec_label="Pt. A:", + op_id_cursor_grab=( + "maplus.quickapldestgrabplaneafromcursor" + ), + op_id_avg_grab=( + "maplus.quickaplgrabavgdestplanea" + ), + op_id_local_grab=( + "maplus.quickapldestgrabplaneafromactivelocal" + ), + op_id_global_grab=( + "maplus.quickapldestgrabplaneafromactiveglobal" + ), + coord_container=addon_data.quick_align_planes_dest, + coord_attribute="plane_pt_a", + op_id_cursor_send=( + "maplus.quickapldestsendplaneatocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quickapldestswapplaneaplaneb", + "B" + ), + op_id_text_tuple_swap_second=( + "maplus.quickapldestswapplaneaplanec", + "C" + ) ) # component_changers_plna = plane_a_items.row() @@ -11417,57 +11206,34 @@ def draw(self, context): # text="11Z" # ) - apl_dest_geom_editor.label("Pt. B (Pivot):") - # plane_b_items = apl_dest_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - plane_b_items = apl_dest_geom_editor.row() - typein_and_grab_plnb = plane_b_items.column() - plane_b_uppers = typein_and_grab_plnb.split(percentage=.33) - plane_b_swap = plane_b_uppers.row(align=True) - plane_b_swap.label("Swap With:") - plane_b_swap.operator( - "maplus.quickapldestswapplaneaplaneb", - text="A" - ) - plane_b_swap.operator( - "maplus.quickapldestswapplanebplanec", - text="C" - ) - - plane_b_uppers_rightside = plane_b_uppers.row(align=True) - plane_b_uppers_rightside.alignment = 'RIGHT' - plane_b_uppers_rightside.label("Send:") - plane_b_uppers_rightside.operator( - "maplus.quickapldestsendplanebtocursor", - icon='CURSOR', - text="" - ) - - plane_b_uppers_rightside.label("Grab:") - plane_b_uppers_rightside.operator( - "maplus.quickapldestgrabplanebfromcursor", - icon='CURSOR', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.quickapldestgrabplanebfromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.quickapldestgrabplanebfromactiveglobal", - icon='WORLD', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.quickaplgrabavgdestplaneb", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_plnb.prop( - bpy.types.AnyType(addon_data.quick_align_planes_dest), - 'plane_pt_b', - "" + layout_coordvec( + parent_layout=apl_dest_geom_editor, + coordvec_label="Pt. B (Pivot):", + op_id_cursor_grab=( + "maplus.quickapldestgrabplanebfromcursor" + ), + op_id_avg_grab=( + "maplus.quickaplgrabavgdestplaneb" + ), + op_id_local_grab=( + "maplus.quickapldestgrabplanebfromactivelocal" + ), + op_id_global_grab=( + "maplus.quickapldestgrabplanebfromactiveglobal" + ), + coord_container=addon_data.quick_align_planes_dest, + coord_attribute="plane_pt_b", + op_id_cursor_send=( + "maplus.quickapldestsendplanebtocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quickapldestswapplaneaplaneb", + "A" + ), + op_id_text_tuple_swap_second=( + "maplus.quickapldestswapplanebplanec", + "C" + ) ) # component_changers_plnb = plane_b_items.row() @@ -11504,57 +11270,34 @@ def draw(self, context): # text="11Z" # ) - apl_dest_geom_editor.label("Pt. C:") - # plane_c_items = apl_dest_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - plane_c_items = apl_dest_geom_editor.row() - typein_and_grab_plnc = plane_c_items.column() - plane_c_uppers = typein_and_grab_plnc.split(percentage=.33) - plane_c_swap = plane_c_uppers.row(align=True) - plane_c_swap.label("Swap With:") - plane_c_swap.operator( - "maplus.quickapldestswapplaneaplanec", - text="A" - ) - plane_c_swap.operator( - "maplus.quickapldestswapplanebplanec", - text="B" - ) - - plane_c_uppers_rightside = plane_c_uppers.row(align=True) - plane_c_uppers_rightside.alignment = 'RIGHT' - plane_c_uppers_rightside.label("Send:") - plane_c_uppers_rightside.operator( - "maplus.quickapldestsendplanectocursor", - icon='CURSOR', - text="" - ) - - plane_c_uppers_rightside.label("Grab:") - plane_c_uppers_rightside.operator( - "maplus.quickapldestgrabplanecfromcursor", - icon='CURSOR', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.quickapldestgrabplanecfromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.quickapldestgrabplanecfromactiveglobal", - icon='WORLD', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.quickaplgrabavgdestplanec", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_plnc.prop( - bpy.types.AnyType(addon_data.quick_align_planes_dest), - 'plane_pt_c', - "" + layout_coordvec( + parent_layout=apl_dest_geom_editor, + coordvec_label="Pt. C:", + op_id_cursor_grab=( + "maplus.quickapldestgrabplanecfromcursor" + ), + op_id_avg_grab=( + "maplus.quickaplgrabavgdestplanec" + ), + op_id_local_grab=( + "maplus.quickapldestgrabplanecfromactivelocal" + ), + op_id_global_grab=( + "maplus.quickapldestgrabplanecfromactiveglobal" + ), + coord_container=addon_data.quick_align_planes_dest, + coord_attribute="plane_pt_c", + op_id_cursor_send=( + "maplus.quickapldestsendplanectocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quickapldestswapplaneaplanec", + "A" + ), + op_id_text_tuple_swap_second=( + "maplus.quickapldestswapplanebplanec", + "B" + ) ) # component_changers_plnc = plane_c_items.row() @@ -12063,54 +11806,30 @@ def draw(self, context): "Multiplier" ) - ds_src_geom_editor.label("Start:") - # plane_a_items = ds_src_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_start_items = ds_src_geom_editor.row() - typein_and_grab_start = ln_start_items.column() - ln_start_uppers = typein_and_grab_start.split(percentage=.33) - - ln_start_swap = ln_start_uppers.row(align=True) - ln_start_swap.label("Swap With:") - ln_start_swap.operator( - "maplus.quickdssrcswaplinepoints", - text="End" - ) - - ln_start_uppers_rightside = ln_start_uppers.row(align=True) - ln_start_uppers_rightside.alignment = 'RIGHT' - ln_start_uppers_rightside.label("Send:") - ln_start_uppers_rightside.operator( - "maplus.quickdssrcsendlinestarttocursor", - icon='CURSOR', - text="" - ) - - ln_start_uppers_rightside.label("Grab:") - ln_start_uppers_rightside.operator( - "maplus.quickdssrcgrablinestartfromcursor", - icon='CURSOR', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quickdssrcgrablinestartfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quickdssrcgrablinestartfromactiveglobal", - icon='WORLD', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quickdsgrabavgsrclinestart", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_start.prop( - bpy.types.AnyType(addon_data.quick_directional_slide_src), - 'line_start', - "" + layout_coordvec( + parent_layout=ds_src_geom_editor, + coordvec_label="Start:", + op_id_cursor_grab=( + "maplus.quickdssrcgrablinestartfromcursor" + ), + op_id_avg_grab=( + "maplus.quickdsgrabavgsrclinestart" + ), + op_id_local_grab=( + "maplus.quickdssrcgrablinestartfromactivelocal" + ), + op_id_global_grab=( + "maplus.quickdssrcgrablinestartfromactiveglobal" + ), + coord_container=addon_data.quick_directional_slide_src, + coord_attribute="line_start", + op_id_cursor_send=( + "maplus.quickdssrcsendlinestarttocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quickdssrcswaplinepoints", + "End" + ) ) # component_changers_plna = plane_a_items.row() @@ -12147,54 +11866,30 @@ def draw(self, context): # text="11Z" # ) - ds_src_geom_editor.label("End:") - # plane_a_items = ds_src_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_end_items = ds_src_geom_editor.row() - typein_and_grab_end = ln_end_items.column() - ln_end_uppers = typein_and_grab_end.split(percentage=.33) - - ln_end_swap = ln_end_uppers.row(align=True) - ln_end_swap.label("Swap With:") - ln_end_swap.operator( - "maplus.quickdssrcswaplinepoints", - text="Start" - ) - - ln_end_uppers_rightside = ln_end_uppers.row(align=True) - ln_end_uppers_rightside.alignment = 'RIGHT' - ln_end_uppers_rightside.label("Send:") - ln_end_uppers_rightside.operator( - "maplus.quickdssrcsendlineendtocursor", - icon='CURSOR', - text="" - ) - - ln_end_uppers_rightside.label("Grab:") - ln_end_uppers_rightside.operator( - "maplus.quickdssrcgrablineendfromcursor", - icon='CURSOR', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quickdssrcgrablineendfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quickdssrcgrablineendfromactiveglobal", - icon='WORLD', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quickdsgrabavgsrclineend", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_end.prop( - bpy.types.AnyType(addon_data.quick_directional_slide_src), - 'line_end', - "" + layout_coordvec( + parent_layout=ds_src_geom_editor, + coordvec_label="End:", + op_id_cursor_grab=( + "maplus.quickdssrcgrablineendfromcursor" + ), + op_id_avg_grab=( + "maplus.quickdsgrabavgsrclineend" + ), + op_id_local_grab=( + "maplus.quickdssrcgrablineendfromactivelocal" + ), + op_id_global_grab=( + "maplus.quickdssrcgrablineendfromactiveglobal" + ), + coord_container=addon_data.quick_directional_slide_src, + coord_attribute="line_end", + op_id_cursor_send=( + "maplus.quickdssrcsendlineendtocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quickdssrcswaplinepoints", + "Start" + ) ) # component_changers_plnc = plane_c_items.row() @@ -12384,54 +12079,30 @@ def draw(self, context): "Multiplier" ) - sme_src_geom_editor.label("Start:") - # plane_a_items = sme_src_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_start_items = sme_src_geom_editor.row() - typein_and_grab_start = ln_start_items.column() - ln_start_uppers = typein_and_grab_start.split(percentage=.33) - - ln_start_swap = ln_start_uppers.row(align=True) - ln_start_swap.label("Swap With:") - ln_start_swap.operator( - "maplus.quicksmesrcswaplinepoints", - text="End" - ) - - ln_start_uppers_rightside = ln_start_uppers.row(align=True) - ln_start_uppers_rightside.alignment = 'RIGHT' - ln_start_uppers_rightside.label("Send:") - ln_start_uppers_rightside.operator( - "maplus.quicksmesrcsendlinestarttocursor", - icon='CURSOR', - text="" - ) - - ln_start_uppers_rightside.label("Grab:") - ln_start_uppers_rightside.operator( - "maplus.quicksmesrcgrablinestartfromcursor", - icon='CURSOR', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quicksmesrcgrablinestartfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quicksmesrcgrablinestartfromactiveglobal", - icon='WORLD', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quicksmegrabavgsrclinestart", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_start.prop( - bpy.types.AnyType(addon_data.quick_scale_match_edge_src), - 'line_start', - "" + layout_coordvec( + parent_layout=sme_src_geom_editor, + coordvec_label="Start:", + op_id_cursor_grab=( + "maplus.quicksmesrcgrablinestartfromcursor" + ), + op_id_avg_grab=( + "maplus.quicksmegrabavgsrclinestart" + ), + op_id_local_grab=( + "maplus.quicksmesrcgrablinestartfromactivelocal" + ), + op_id_global_grab=( + "maplus.quicksmesrcgrablinestartfromactiveglobal" + ), + coord_container=addon_data.quick_scale_match_edge_src, + coord_attribute="line_start", + op_id_cursor_send=( + "maplus.quicksmesrcsendlinestarttocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quicksmesrcswaplinepoints", + "End" + ) ) # component_changers_plna = plane_a_items.row() @@ -12468,54 +12139,30 @@ def draw(self, context): # text="11Z" # ) - sme_src_geom_editor.label("End:") - # plane_a_items = sme_src_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_end_items = sme_src_geom_editor.row() - typein_and_grab_end = ln_end_items.column() - ln_end_uppers = typein_and_grab_end.split(percentage=.33) - - ln_end_swap = ln_end_uppers.row(align=True) - ln_end_swap.label("Swap With:") - ln_end_swap.operator( - "maplus.quicksmesrcswaplinepoints", - text="Start" - ) - - ln_end_uppers_rightside = ln_end_uppers.row(align=True) - ln_end_uppers_rightside.alignment = 'RIGHT' - ln_end_uppers_rightside.label("Send:") - ln_end_uppers_rightside.operator( - "maplus.quicksmesrcsendlineendtocursor", - icon='CURSOR', - text="" - ) - - ln_end_uppers_rightside.label("Grab:") - ln_end_uppers_rightside.operator( - "maplus.quicksmesrcgrablineendfromcursor", - icon='CURSOR', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quicksmesrcgrablineendfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quicksmesrcgrablineendfromactiveglobal", - icon='WORLD', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quicksmegrabavgsrclineend", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_end.prop( - bpy.types.AnyType(addon_data.quick_scale_match_edge_src), - 'line_end', - "" + layout_coordvec( + parent_layout=sme_src_geom_editor, + coordvec_label="End:", + op_id_cursor_grab=( + "maplus.quicksmesrcgrablineendfromcursor" + ), + op_id_avg_grab=( + "maplus.quicksmegrabavgsrclineend" + ), + op_id_local_grab=( + "maplus.quicksmesrcgrablineendfromactivelocal" + ), + op_id_global_grab=( + "maplus.quicksmesrcgrablineendfromactiveglobal" + ), + coord_container=addon_data.quick_scale_match_edge_src, + coord_attribute="line_end", + op_id_cursor_send=( + "maplus.quicksmesrcsendlineendtocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quicksmesrcswaplinepoints", + "Start" + ) ) # component_changers_plnc = plane_c_items.row() @@ -12634,54 +12281,30 @@ def draw(self, context): "Multiplier" ) - sme_dest_geom_editor.label("Start:") - # plane_a_items = sme_dest_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_start_items = sme_dest_geom_editor.row() - typein_and_grab_start = ln_start_items.column() - ln_start_uppers = typein_and_grab_start.split(percentage=.33) - - ln_start_swap = ln_start_uppers.row(align=True) - ln_start_swap.label("Swap With:") - ln_start_swap.operator( - "maplus.quicksmedestswaplinepoints", - text="End" - ) - - ln_start_uppers_rightside = ln_start_uppers.row(align=True) - ln_start_uppers_rightside.alignment = 'RIGHT' - ln_start_uppers_rightside.label("Send:") - ln_start_uppers_rightside.operator( - "maplus.quicksmedestsendlinestarttocursor", - icon='CURSOR', - text="" - ) - - ln_start_uppers_rightside.label("Grab:") - ln_start_uppers_rightside.operator( - "maplus.quicksmedestgrablinestartfromcursor", - icon='CURSOR', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quicksmedestgrablinestartfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quicksmedestgrablinestartfromactiveglobal", - icon='WORLD', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quicksmegrabavgdestlinestart", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_start.prop( - bpy.types.AnyType(addon_data.quick_scale_match_edge_dest), - 'line_start', - "" + layout_coordvec( + parent_layout=sme_dest_geom_editor, + coordvec_label="Start:", + op_id_cursor_grab=( + "maplus.quicksmedestgrablinestartfromcursor" + ), + op_id_avg_grab=( + "maplus.quicksmegrabavgdestlinestart" + ), + op_id_local_grab=( + "maplus.quicksmedestgrablinestartfromactivelocal" + ), + op_id_global_grab=( + "maplus.quicksmedestgrablinestartfromactiveglobal" + ), + coord_container=addon_data.quick_scale_match_edge_dest, + coord_attribute="line_start", + op_id_cursor_send=( + "maplus.quicksmedestsendlinestarttocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quicksmedestswaplinepoints", + "End" + ) ) # component_changers_plna = plane_a_items.row() @@ -12718,54 +12341,30 @@ def draw(self, context): # text="11Z" # ) - sme_dest_geom_editor.label("End:") - # plane_a_items = sme_dest_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_end_items = sme_dest_geom_editor.row() - typein_and_grab_end = ln_end_items.column() - ln_end_uppers = typein_and_grab_end.split(percentage=.33) - - ln_end_swap = ln_end_uppers.row(align=True) - ln_end_swap.label("Swap With:") - ln_end_swap.operator( - "maplus.quicksmedestswaplinepoints", - text="Start" - ) - - ln_end_uppers_rightside = ln_end_uppers.row(align=True) - ln_end_uppers_rightside.alignment = 'RIGHT' - ln_end_uppers_rightside.label("Send:") - ln_end_uppers_rightside.operator( - "maplus.quicksmedestsendlineendtocursor", - icon='CURSOR', - text="" - ) - - ln_end_uppers_rightside.label("Grab:") - ln_end_uppers_rightside.operator( - "maplus.quicksmedestgrablineendfromcursor", - icon='CURSOR', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quicksmedestgrablineendfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quicksmedestgrablineendfromactiveglobal", - icon='WORLD', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quicksmegrabavgdestlineend", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_end.prop( - bpy.types.AnyType(addon_data.quick_scale_match_edge_dest), - 'line_end', - "" + layout_coordvec( + parent_layout=sme_dest_geom_editor, + coordvec_label="End:", + op_id_cursor_grab=( + "maplus.quicksmedestgrablineendfromcursor" + ), + op_id_avg_grab=( + "maplus.quicksmegrabavgdestlineend" + ), + op_id_local_grab=( + "maplus.quicksmedestgrablineendfromactivelocal" + ), + op_id_global_grab=( + "maplus.quicksmedestgrablineendfromactiveglobal" + ), + coord_container=addon_data.quick_scale_match_edge_dest, + coord_attribute="line_end", + op_id_cursor_send=( + "maplus.quicksmedestsendlineendtocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quicksmedestswaplinepoints", + "Start" + ) ) sme_apply_header = sme_gui.row() @@ -12909,49 +12508,26 @@ def draw(self, context): "Multiplier" ) - slot1_geom_editor.label("Pt. Origin:") - # plane_a_items = slot1_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - pt_items = slot1_geom_editor.row() - typein_and_grab_pt = pt_items.column() - pt_uppers = typein_and_grab_pt.row() - - pt_uppers_leftside = pt_uppers.row(align=True) - pt_uppers_leftside.alignment = 'LEFT' - pt_uppers_leftside.label("Send:") - pt_uppers_leftside.operator( - "maplus.slot1sendpointtocursor", - icon='CURSOR', - text="" - ) - - pt_uppers_rightside = pt_uppers.row(align=True) - pt_uppers_rightside.alignment = 'RIGHT' - pt_uppers_rightside.label("Grab:") - pt_uppers_rightside.operator( - "maplus.slot1grabpointfromcursor", - icon='CURSOR', - text="" - ) - pt_uppers_rightside.operator( - "maplus.grabpointslot1loc", - icon='VERTEXSEL', - text="" - ) - pt_uppers_rightside.operator( - "maplus.grabpointslot1", - icon='WORLD', - text="" - ) - pt_uppers_rightside.operator( - "maplus.slot1pointgrabavg", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_pt.prop( - bpy.types.AnyType(addon_data.internal_storage_slot_1), - 'point', - "" + layout_coordvec( + parent_layout=slot1_geom_editor, + coordvec_label="Pt. Origin:", + op_id_cursor_grab=( + "maplus.slot1grabpointfromcursor" + ), + op_id_avg_grab=( + "maplus.slot1pointgrabavg" + ), + op_id_local_grab=( + "maplus.grabpointslot1loc" + ), + op_id_global_grab=( + "maplus.grabpointslot1" + ), + coord_container=addon_data.internal_storage_slot_1, + coord_attribute="point", + op_id_cursor_send=( + "maplus.slot1sendpointtocursor" + ) ) elif addon_data.internal_storage_slot_1.kind == 'LINE': @@ -13012,54 +12588,30 @@ def draw(self, context): "Multiplier" ) - slot1_geom_editor.label("Start:") - # plane_a_items = axr_src_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_start_items = slot1_geom_editor.row() - typein_and_grab_start = ln_start_items.column() - ln_start_uppers = typein_and_grab_start.split(percentage=.33) - - ln_start_swap = ln_start_uppers.row(align=True) - ln_start_swap.label("Swap With:") - ln_start_swap.operator( - "maplus.slot1swaplinepoints", - text="End" - ) - - ln_start_uppers_rightside = ln_start_uppers.row(align=True) - ln_start_uppers_rightside.alignment = 'RIGHT' - ln_start_uppers_rightside.label("Send:") - ln_start_uppers_rightside.operator( - "maplus.slot1sendlinestarttocursor", - icon='CURSOR', - text="" - ) - - ln_start_uppers_rightside.label("Grab:") - ln_start_uppers_rightside.operator( - "maplus.slot1grablinestartfromcursor", - icon='CURSOR', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.slot1grablinestartfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.slot1grablinestartfromactiveglobal", - icon='WORLD', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.slot1grabavglinestart", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_start.prop( - bpy.types.AnyType(addon_data.internal_storage_slot_1), - 'line_start', - "" + layout_coordvec( + parent_layout=slot1_geom_editor, + coordvec_label="Start:", + op_id_cursor_grab=( + "maplus.slot1grablinestartfromcursor" + ), + op_id_avg_grab=( + "maplus.slot1grabavglinestart" + ), + op_id_local_grab=( + "maplus.slot1grablinestartfromactivelocal" + ), + op_id_global_grab=( + "maplus.slot1grablinestartfromactiveglobal" + ), + coord_container=addon_data.internal_storage_slot_1, + coord_attribute="line_start", + op_id_cursor_send=( + "maplus.slot1sendlinestarttocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.slot1swaplinepoints", + "End" + ) ) # component_changers_plna = plane_a_items.row() @@ -13096,54 +12648,30 @@ def draw(self, context): # text="11Z" # ) - slot1_geom_editor.label("End:") - # plane_a_items = slot1_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_end_items = slot1_geom_editor.row() - typein_and_grab_end = ln_end_items.column() - ln_end_uppers = typein_and_grab_end.split(percentage=.33) - - ln_end_swap = ln_end_uppers.row(align=True) - ln_end_swap.label("Swap With:") - ln_end_swap.operator( - "maplus.slot1swaplinepoints", - text="Start" - ) - - ln_end_uppers_rightside = ln_end_uppers.row(align=True) - ln_end_uppers_rightside.alignment = 'RIGHT' - ln_end_uppers_rightside.label("Send:") - ln_end_uppers_rightside.operator( - "maplus.slot1sendlineendtocursor", - icon='CURSOR', - text="" - ) - - ln_end_uppers_rightside.label("Grab:") - ln_end_uppers_rightside.operator( - "maplus.slot1grablineendfromcursor", - icon='CURSOR', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.slot1grablineendfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.slot1grablineendfromactiveglobal", - icon='WORLD', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.slot1grabavglineend", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_end.prop( - bpy.types.AnyType(addon_data.internal_storage_slot_1), - 'line_end', - "" + layout_coordvec( + parent_layout=slot1_geom_editor, + coordvec_label="End:", + op_id_cursor_grab=( + "maplus.slot1grablineendfromcursor" + ), + op_id_avg_grab=( + "maplus.slot1grabavglineend" + ), + op_id_local_grab=( + "maplus.slot1grablineendfromactivelocal" + ), + op_id_global_grab=( + "maplus.slot1grablineendfromactiveglobal" + ), + coord_container=addon_data.internal_storage_slot_1, + coord_attribute="line_end", + op_id_cursor_send=( + "maplus.slot1sendlineendtocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.slot1swaplinepoints", + "Start" + ) ) # component_changers_plnc = plane_c_items.row() @@ -13203,58 +12731,34 @@ def draw(self, context): text="Paste (From Clipboard)" ) - slot1_geom_editor.label("Pt. A:") - # plane_a_items = slot1_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - plane_a_items = slot1_geom_editor.row() - typein_and_grab_plna = plane_a_items.column() - plane_a_uppers = typein_and_grab_plna.split(percentage=.33) - - plane_a_swap = plane_a_uppers.row(align=True) - plane_a_swap.label("Swap With:") - plane_a_swap.operator( - "maplus.slot1swapplaneaplaneb", - text="B" - ) - plane_a_swap.operator( - "maplus.slot1swapplaneaplanec", - text="C" - ) - - plane_a_uppers_rightside = plane_a_uppers.row(align=True) - plane_a_uppers_rightside.alignment = 'RIGHT' - plane_a_uppers_rightside.label("Send:") - plane_a_uppers_rightside.operator( - "maplus.slot1sendplaneatocursor", - icon='CURSOR', - text="" - ) - - plane_a_uppers_rightside.label("Grab:") - plane_a_uppers_rightside.operator( - "maplus.slot1grabplaneafromcursor", - icon='CURSOR', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.slot1grabplaneafromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.slot1grabplaneafromactiveglobal", - icon='WORLD', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.slot1grabavgplanea", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_plna.prop( - bpy.types.AnyType(addon_data.internal_storage_slot_1), - 'plane_pt_a', - "" + layout_coordvec( + parent_layout=slot1_geom_editor, + coordvec_label="Pt. A:", + op_id_cursor_grab=( + "maplus.slot1grabplaneafromcursor" + ), + op_id_avg_grab=( + "maplus.slot1grabavgplanea" + ), + op_id_local_grab=( + "maplus.slot1grabplaneafromactivelocal" + ), + op_id_global_grab=( + "maplus.slot1grabplaneafromactiveglobal" + ), + coord_container=addon_data.internal_storage_slot_1, + coord_attribute="plane_pt_a", + op_id_cursor_send=( + "maplus.slot1sendplaneatocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.slot1swapplaneaplaneb", + "B" + ), + op_id_text_tuple_swap_second=( + "maplus.slot1swapplaneaplanec", + "C" + ) ) # component_changers_plna = plane_a_items.row() @@ -13291,57 +12795,34 @@ def draw(self, context): # text="11Z" # ) - slot1_geom_editor.label("Pt. B (Pivot):") - # plane_b_items = slot1_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - plane_b_items = slot1_geom_editor.row() - typein_and_grab_plnb = plane_b_items.column() - plane_b_uppers = typein_and_grab_plnb.split(percentage=.33) - plane_b_swap = plane_b_uppers.row(align=True) - plane_b_swap.label("Swap With:") - plane_b_swap.operator( - "maplus.slot1swapplaneaplaneb", - text="A" - ) - plane_b_swap.operator( - "maplus.slot1swapplanebplanec", - text="C" - ) - - plane_b_uppers_rightside = plane_b_uppers.row(align=True) - plane_b_uppers_rightside.alignment = 'RIGHT' - plane_b_uppers_rightside.label("Send:") - plane_b_uppers_rightside.operator( - "maplus.slot1sendplanebtocursor", - icon='CURSOR', - text="" - ) - - plane_b_uppers_rightside.label("Grab:") - plane_b_uppers_rightside.operator( - "maplus.slot1grabplanebfromcursor", - icon='CURSOR', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.slot1grabplanebfromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.slot1grabplanebfromactiveglobal", - icon='WORLD', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.slot1grabavgplaneb", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_plnb.prop( - bpy.types.AnyType(addon_data.internal_storage_slot_1), - 'plane_pt_b', - "" + layout_coordvec( + parent_layout=slot1_geom_editor, + coordvec_label="Pt. B (Pivot):", + op_id_cursor_grab=( + "maplus.slot1grabplanebfromcursor" + ), + op_id_avg_grab=( + "maplus.slot1grabavgplaneb" + ), + op_id_local_grab=( + "maplus.slot1grabplanebfromactivelocal" + ), + op_id_global_grab=( + "maplus.slot1grabplanebfromactiveglobal" + ), + coord_container=addon_data.internal_storage_slot_1, + coord_attribute="plane_pt_b", + op_id_cursor_send=( + "maplus.slot1sendplanebtocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.slot1swapplaneaplaneb", + "A" + ), + op_id_text_tuple_swap_second=( + "maplus.slot1swapplanebplanec", + "C" + ) ) # component_changers_plnb = plane_b_items.row() @@ -13378,57 +12859,34 @@ def draw(self, context): # text="11Z" # ) - slot1_geom_editor.label("Pt. C:") - # plane_c_items = slot1_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - plane_c_items = slot1_geom_editor.row() - typein_and_grab_plnc = plane_c_items.column() - plane_c_uppers = typein_and_grab_plnc.split(percentage=.33) - plane_c_swap = plane_c_uppers.row(align=True) - plane_c_swap.label("Swap With:") - plane_c_swap.operator( - "maplus.slot1swapplaneaplanec", - text="A" - ) - plane_c_swap.operator( - "maplus.slot1swapplanebplanec", - text="B" - ) - - plane_c_uppers_rightside = plane_c_uppers.row(align=True) - plane_c_uppers_rightside.alignment = 'RIGHT' - plane_c_uppers_rightside.label("Send:") - plane_c_uppers_rightside.operator( - "maplus.slot1sendplanectocursor", - icon='CURSOR', - text="" - ) - - plane_c_uppers_rightside.label("Grab:") - plane_c_uppers_rightside.operator( - "maplus.slot1grabplanecfromcursor", - icon='CURSOR', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.slot1grabplanecfromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.slot1grabplanecfromactiveglobal", - icon='WORLD', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.slot1grabavgplanec", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_plnc.prop( - bpy.types.AnyType(addon_data.internal_storage_slot_1), - 'plane_pt_c', - "" + layout_coordvec( + parent_layout=slot1_geom_editor, + coordvec_label="Pt. C:", + op_id_cursor_grab=( + "maplus.slot1grabplanecfromcursor" + ), + op_id_avg_grab=( + "maplus.slot1grabavgplanec" + ), + op_id_local_grab=( + "maplus.slot1grabplanecfromactivelocal" + ), + op_id_global_grab=( + "maplus.slot1grabplanecfromactiveglobal" + ), + coord_container=addon_data.internal_storage_slot_1, + coord_attribute="plane_pt_c", + op_id_cursor_send=( + "maplus.slot1sendplanectocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.slot1swapplaneaplanec", + "A" + ), + op_id_text_tuple_swap_second=( + "maplus.slot1swapplanebplanec", + "B" + ) ) # component_changers_plnc = plane_c_items.row() @@ -13480,7 +12938,7 @@ def draw(self, context): preserve_button_roundedge.operator( "maplus.graballslot2", icon='WORLD', - text="Grab Slot 1" + text="Grab Slot 2" ) else: @@ -13490,7 +12948,7 @@ def draw(self, context): text="", emboss=False ) - slot2_geom_top.label("Slot 1 Coordinates") + slot2_geom_top.label("Slot 2 Coordinates") slot2_geom_editor = calc_gui.box() types_row = slot2_geom_editor.row() types_row.label("Item type:") @@ -13551,49 +13009,26 @@ def draw(self, context): "Multiplier" ) - slot2_geom_editor.label("Pt. Origin:") - # plane_a_items = slot2_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - pt_items = slot2_geom_editor.row() - typein_and_grab_pt = pt_items.column() - pt_uppers = typein_and_grab_pt.row() - - pt_uppers_leftside = pt_uppers.row(align=True) - pt_uppers_leftside.alignment = 'LEFT' - pt_uppers_leftside.label("Send:") - pt_uppers_leftside.operator( - "maplus.slot2sendpointtocursor", - icon='CURSOR', - text="" - ) - - pt_uppers_rightside = pt_uppers.row(align=True) - pt_uppers_rightside.alignment = 'RIGHT' - pt_uppers_rightside.label("Grab:") - pt_uppers_rightside.operator( - "maplus.slot2grabpointfromcursor", - icon='CURSOR', - text="" - ) - pt_uppers_rightside.operator( - "maplus.grabpointslot2loc", - icon='VERTEXSEL', - text="" - ) - pt_uppers_rightside.operator( - "maplus.grabpointslot2", - icon='WORLD', - text="" - ) - pt_uppers_rightside.operator( - "maplus.slot2pointgrabavg", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_pt.prop( - bpy.types.AnyType(addon_data.internal_storage_slot_2), - 'point', - "" + layout_coordvec( + parent_layout=slot2_geom_editor, + coordvec_label="Pt. Origin:", + op_id_cursor_grab=( + "maplus.slot2grabpointfromcursor" + ), + op_id_avg_grab=( + "maplus.slot2pointgrabavg" + ), + op_id_local_grab=( + "maplus.grabpointslot2loc" + ), + op_id_global_grab=( + "maplus.grabpointslot2" + ), + coord_container=addon_data.internal_storage_slot_2, + coord_attribute="point", + op_id_cursor_send=( + "maplus.slot2sendpointtocursor" + ) ) elif addon_data.internal_storage_slot_2.kind == 'LINE': @@ -13654,54 +13089,30 @@ def draw(self, context): "Multiplier" ) - slot2_geom_editor.label("Start:") - # plane_a_items = axr_src_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_start_items = slot2_geom_editor.row() - typein_and_grab_start = ln_start_items.column() - ln_start_uppers = typein_and_grab_start.split(percentage=.33) - - ln_start_swap = ln_start_uppers.row(align=True) - ln_start_swap.label("Swap With:") - ln_start_swap.operator( - "maplus.slot2swaplinepoints", - text="End" - ) - - ln_start_uppers_rightside = ln_start_uppers.row(align=True) - ln_start_uppers_rightside.alignment = 'RIGHT' - ln_start_uppers_rightside.label("Send:") - ln_start_uppers_rightside.operator( - "maplus.slot2sendlinestarttocursor", - icon='CURSOR', - text="" - ) - - ln_start_uppers_rightside.label("Grab:") - ln_start_uppers_rightside.operator( - "maplus.slot2grablinestartfromcursor", - icon='CURSOR', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.slot2grablinestartfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.slot2grablinestartfromactiveglobal", - icon='WORLD', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.slot2grabavglinestart", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_start.prop( - bpy.types.AnyType(addon_data.internal_storage_slot_2), - 'line_start', - "" + layout_coordvec( + parent_layout=slot2_geom_editor, + coordvec_label="Start:", + op_id_cursor_grab=( + "maplus.slot2grablinestartfromcursor" + ), + op_id_avg_grab=( + "maplus.slot2grabavglinestart" + ), + op_id_local_grab=( + "maplus.slot2grablinestartfromactivelocal" + ), + op_id_global_grab=( + "maplus.slot2grablinestartfromactiveglobal" + ), + coord_container=addon_data.internal_storage_slot_2, + coord_attribute="line_start", + op_id_cursor_send=( + "maplus.slot2sendlinestarttocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.slot2swaplinepoints", + "End" + ) ) # component_changers_plna = plane_a_items.row() @@ -13738,54 +13149,30 @@ def draw(self, context): # text="11Z" # ) - slot2_geom_editor.label("End:") - # plane_a_items = slot2_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_end_items = slot2_geom_editor.row() - typein_and_grab_end = ln_end_items.column() - ln_end_uppers = typein_and_grab_end.split(percentage=.33) - - ln_end_swap = ln_end_uppers.row(align=True) - ln_end_swap.label("Swap With:") - ln_end_swap.operator( - "maplus.slot2swaplinepoints", - text="Start" - ) - - ln_end_uppers_rightside = ln_end_uppers.row(align=True) - ln_end_uppers_rightside.alignment = 'RIGHT' - ln_end_uppers_rightside.label("Send:") - ln_end_uppers_rightside.operator( - "maplus.slot2sendlineendtocursor", - icon='CURSOR', - text="" - ) - - ln_end_uppers_rightside.label("Grab:") - ln_end_uppers_rightside.operator( - "maplus.slot2grablineendfromcursor", - icon='CURSOR', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.slot2grablineendfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.slot2grablineendfromactiveglobal", - icon='WORLD', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.slot2grabavglineend", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_end.prop( - bpy.types.AnyType(addon_data.internal_storage_slot_2), - 'line_end', - "" + layout_coordvec( + parent_layout=slot2_geom_editor, + coordvec_label="End:", + op_id_cursor_grab=( + "maplus.slot2grablineendfromcursor" + ), + op_id_avg_grab=( + "maplus.slot2grabavglineend" + ), + op_id_local_grab=( + "maplus.slot2grablineendfromactivelocal" + ), + op_id_global_grab=( + "maplus.slot2grablineendfromactiveglobal" + ), + coord_container=addon_data.internal_storage_slot_2, + coord_attribute="line_end", + op_id_cursor_send=( + "maplus.slot2sendlineendtocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.slot2swaplinepoints", + "Start" + ) ) # component_changers_plnc = plane_c_items.row() @@ -13845,58 +13232,34 @@ def draw(self, context): text="Paste (From Clipboard)" ) - slot2_geom_editor.label("Pt. A:") - # plane_a_items = slot2_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - plane_a_items = slot2_geom_editor.row() - typein_and_grab_plna = plane_a_items.column() - plane_a_uppers = typein_and_grab_plna.split(percentage=.33) - - plane_a_swap = plane_a_uppers.row(align=True) - plane_a_swap.label("Swap With:") - plane_a_swap.operator( - "maplus.slot2swapplaneaplaneb", - text="B" - ) - plane_a_swap.operator( - "maplus.slot2swapplaneaplanec", - text="C" - ) - - plane_a_uppers_rightside = plane_a_uppers.row(align=True) - plane_a_uppers_rightside.alignment = 'RIGHT' - plane_a_uppers_rightside.label("Send:") - plane_a_uppers_rightside.operator( - "maplus.slot2sendplaneatocursor", - icon='CURSOR', - text="" - ) - - plane_a_uppers_rightside.label("Grab:") - plane_a_uppers_rightside.operator( - "maplus.slot2grabplaneafromcursor", - icon='CURSOR', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.slot2grabplaneafromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.slot2grabplaneafromactiveglobal", - icon='WORLD', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.slot2grabavgplanea", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_plna.prop( - bpy.types.AnyType(addon_data.internal_storage_slot_2), - 'plane_pt_a', - "" + layout_coordvec( + parent_layout=slot2_geom_editor, + coordvec_label="Pt. A:", + op_id_cursor_grab=( + "maplus.slot2grabplaneafromcursor" + ), + op_id_avg_grab=( + "maplus.slot2grabavgplanea" + ), + op_id_local_grab=( + "maplus.slot2grabplaneafromactivelocal" + ), + op_id_global_grab=( + "maplus.slot2grabplaneafromactiveglobal" + ), + coord_container=addon_data.internal_storage_slot_2, + coord_attribute="plane_pt_a", + op_id_cursor_send=( + "maplus.slot2sendplaneatocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.slot2swapplaneaplaneb", + "B" + ), + op_id_text_tuple_swap_second=( + "maplus.slot2swapplaneaplanec", + "C" + ) ) # component_changers_plna = plane_a_items.row() @@ -13933,57 +13296,34 @@ def draw(self, context): # text="11Z" # ) - slot2_geom_editor.label("Pt. B (Pivot):") - # plane_b_items = slot2_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - plane_b_items = slot2_geom_editor.row() - typein_and_grab_plnb = plane_b_items.column() - plane_b_uppers = typein_and_grab_plnb.split(percentage=.33) - plane_b_swap = plane_b_uppers.row(align=True) - plane_b_swap.label("Swap With:") - plane_b_swap.operator( - "maplus.slot2swapplaneaplaneb", - text="A" - ) - plane_b_swap.operator( - "maplus.slot2swapplanebplanec", - text="C" - ) - - plane_b_uppers_rightside = plane_b_uppers.row(align=True) - plane_b_uppers_rightside.alignment = 'RIGHT' - plane_b_uppers_rightside.label("Send:") - plane_b_uppers_rightside.operator( - "maplus.slot2sendplanebtocursor", - icon='CURSOR', - text="" - ) - - plane_b_uppers_rightside.label("Grab:") - plane_b_uppers_rightside.operator( - "maplus.slot2grabplanebfromcursor", - icon='CURSOR', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.slot2grabplanebfromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.slot2grabplanebfromactiveglobal", - icon='WORLD', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.slot2grabavgplaneb", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_plnb.prop( - bpy.types.AnyType(addon_data.internal_storage_slot_2), - 'plane_pt_b', - "" + layout_coordvec( + parent_layout=slot2_geom_editor, + coordvec_label="Pt. B (Pivot):", + op_id_cursor_grab=( + "maplus.slot2grabplanebfromcursor" + ), + op_id_avg_grab=( + "maplus.slot2grabavgplaneb" + ), + op_id_local_grab=( + "maplus.slot2grabplanebfromactivelocal" + ), + op_id_global_grab=( + "maplus.slot2grabplanebfromactiveglobal" + ), + coord_container=addon_data.internal_storage_slot_2, + coord_attribute="plane_pt_b", + op_id_cursor_send=( + "maplus.slot2sendplanebtocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.slot2swapplaneaplaneb", + "A" + ), + op_id_text_tuple_swap_second=( + "maplus.slot2swapplanebplanec", + "C" + ) ) # component_changers_plnb = plane_b_items.row() @@ -14020,57 +13360,34 @@ def draw(self, context): # text="11Z" # ) - slot2_geom_editor.label("Pt. C:") - # plane_c_items = slot2_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - plane_c_items = slot2_geom_editor.row() - typein_and_grab_plnc = plane_c_items.column() - plane_c_uppers = typein_and_grab_plnc.split(percentage=.33) - plane_c_swap = plane_c_uppers.row(align=True) - plane_c_swap.label("Swap With:") - plane_c_swap.operator( - "maplus.slot2swapplaneaplanec", - text="A" - ) - plane_c_swap.operator( - "maplus.slot2swapplanebplanec", - text="B" - ) - - plane_c_uppers_rightside = plane_c_uppers.row(align=True) - plane_c_uppers_rightside.alignment = 'RIGHT' - plane_c_uppers_rightside.label("Send:") - plane_c_uppers_rightside.operator( - "maplus.slot2sendplanectocursor", - icon='CURSOR', - text="" - ) - - plane_c_uppers_rightside.label("Grab:") - plane_c_uppers_rightside.operator( - "maplus.slot2grabplanecfromcursor", - icon='CURSOR', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.slot2grabplanecfromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.slot2grabplanecfromactiveglobal", - icon='WORLD', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.slot2grabavgplanec", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_plnc.prop( - bpy.types.AnyType(addon_data.internal_storage_slot_2), - 'plane_pt_c', - "" + layout_coordvec( + parent_layout=slot2_geom_editor, + coordvec_label="Pt. C:", + op_id_cursor_grab=( + "maplus.slot2grabplanecfromcursor" + ), + op_id_avg_grab=( + "maplus.slot2grabavgplanec" + ), + op_id_local_grab=( + "maplus.slot2grabplanecfromactivelocal" + ), + op_id_global_grab=( + "maplus.slot2grabplanecfromactiveglobal" + ), + coord_container=addon_data.internal_storage_slot_2, + coord_attribute="plane_pt_c", + op_id_cursor_send=( + "maplus.slot2sendplanectocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.slot2swapplaneaplanec", + "A" + ), + op_id_text_tuple_swap_second=( + "maplus.slot2swapplanebplanec", + "B" + ) ) # component_changers_plnc = plane_c_items.row() @@ -14209,49 +13526,26 @@ def draw(self, context): "Multiplier" ) - calcresult_geom_editor.label("Pt. Origin:") - # plane_a_items = calcresult_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - pt_items = calcresult_geom_editor.row() - typein_and_grab_pt = pt_items.column() - pt_uppers = typein_and_grab_pt.row() - - pt_uppers_leftside = pt_uppers.row(align=True) - pt_uppers_leftside.alignment = 'LEFT' - pt_uppers_leftside.label("Send:") - pt_uppers_leftside.operator( - "maplus.calcresultsendpointtocursor", - icon='CURSOR', - text="" - ) - - pt_uppers_rightside = pt_uppers.row(align=True) - pt_uppers_rightside.alignment = 'RIGHT' - pt_uppers_rightside.label("Grab:") - pt_uppers_rightside.operator( - "maplus.calcresultgrabpointfromcursor", - icon='CURSOR', - text="" - ) - pt_uppers_rightside.operator( - "maplus.grabpointcalcresultloc", - icon='VERTEXSEL', - text="" - ) - pt_uppers_rightside.operator( - "maplus.grabpointcalcresult", - icon='WORLD', - text="" - ) - pt_uppers_rightside.operator( - "maplus.calcresultpointgrabavg", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_pt.prop( - bpy.types.AnyType(addon_data.quick_calc_result_item), - 'point', - "" + layout_coordvec( + parent_layout=calcresult_geom_editor, + coordvec_label="Pt. Origin:", + op_id_cursor_grab=( + "maplus.calcresultgrabpointfromcursor" + ), + op_id_avg_grab=( + "maplus.calcresultpointgrabavg" + ), + op_id_local_grab=( + "maplus.grabpointcalcresultloc" + ), + op_id_global_grab=( + "maplus.grabpointcalcresult" + ), + coord_container=addon_data.quick_calc_result_item, + coord_attribute="point", + op_id_cursor_send=( + "maplus.calcresultsendpointtocursor" + ) ) elif addon_data.quick_calc_result_item.kind == 'LINE': @@ -14312,54 +13606,30 @@ def draw(self, context): "Multiplier" ) - calcresult_geom_editor.label("Start:") - # plane_a_items = axr_src_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_start_items = calcresult_geom_editor.row() - typein_and_grab_start = ln_start_items.column() - ln_start_uppers = typein_and_grab_start.split(percentage=.33) - - ln_start_swap = ln_start_uppers.row(align=True) - ln_start_swap.label("Swap With:") - ln_start_swap.operator( - "maplus.calcresultswaplinepoints", - text="End" - ) - - ln_start_uppers_rightside = ln_start_uppers.row(align=True) - ln_start_uppers_rightside.alignment = 'RIGHT' - ln_start_uppers_rightside.label("Send:") - ln_start_uppers_rightside.operator( - "maplus.calcresultsendlinestarttocursor", - icon='CURSOR', - text="" - ) - - ln_start_uppers_rightside.label("Grab:") - ln_start_uppers_rightside.operator( - "maplus.calcresultgrablinestartfromcursor", - icon='CURSOR', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.calcresultgrablinestartfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.calcresultgrablinestartfromactiveglobal", - icon='WORLD', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.calcresultgrabavglinestart", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_start.prop( - bpy.types.AnyType(addon_data.quick_calc_result_item), - 'line_start', - "" + layout_coordvec( + parent_layout=calcresult_geom_editor, + coordvec_label="Start:", + op_id_cursor_grab=( + "maplus.calcresultgrablinestartfromcursor" + ), + op_id_avg_grab=( + "maplus.calcresultgrabavglinestart" + ), + op_id_local_grab=( + "maplus.calcresultgrablinestartfromactivelocal" + ), + op_id_global_grab=( + "maplus.calcresultgrablinestartfromactiveglobal" + ), + coord_container=addon_data.quick_calc_result_item, + coord_attribute="line_start", + op_id_cursor_send=( + "maplus.calcresultsendlinestarttocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.calcresultswaplinepoints", + "End" + ) ) # component_changers_plna = plane_a_items.row() @@ -14396,54 +13666,30 @@ def draw(self, context): # text="11Z" # ) - calcresult_geom_editor.label("End:") - # plane_a_items = calcresult_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_end_items = calcresult_geom_editor.row() - typein_and_grab_end = ln_end_items.column() - ln_end_uppers = typein_and_grab_end.split(percentage=.33) - - ln_end_swap = ln_end_uppers.row(align=True) - ln_end_swap.label("Swap With:") - ln_end_swap.operator( - "maplus.calcresultswaplinepoints", - text="Start" - ) - - ln_end_uppers_rightside = ln_end_uppers.row(align=True) - ln_end_uppers_rightside.alignment = 'RIGHT' - ln_end_uppers_rightside.label("Send:") - ln_end_uppers_rightside.operator( - "maplus.calcresultsendlineendtocursor", - icon='CURSOR', - text="" - ) - - ln_end_uppers_rightside.label("Grab:") - ln_end_uppers_rightside.operator( - "maplus.calcresultgrablineendfromcursor", - icon='CURSOR', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.calcresultgrablineendfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.calcresultgrablineendfromactiveglobal", - icon='WORLD', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.calcresultgrabavglineend", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_end.prop( - bpy.types.AnyType(addon_data.quick_calc_result_item), - 'line_end', - "" + layout_coordvec( + parent_layout=calcresult_geom_editor, + coordvec_label="End:", + op_id_cursor_grab=( + "maplus.calcresultgrablineendfromcursor" + ), + op_id_avg_grab=( + "maplus.calcresultgrabavglineend" + ), + op_id_local_grab=( + "maplus.calcresultgrablineendfromactivelocal" + ), + op_id_global_grab=( + "maplus.calcresultgrablineendfromactiveglobal" + ), + coord_container=addon_data.quick_calc_result_item, + coord_attribute="line_end", + op_id_cursor_send=( + "maplus.calcresultsendlineendtocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.calcresultswaplinepoints", + "Start" + ) ) # component_changers_plnc = plane_c_items.row() @@ -14503,58 +13749,34 @@ def draw(self, context): text="Paste (From Clipboard)" ) - calcresult_geom_editor.label("Pt. A:") - # plane_a_items = calcresult_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - plane_a_items = calcresult_geom_editor.row() - typein_and_grab_plna = plane_a_items.column() - plane_a_uppers = typein_and_grab_plna.split(percentage=.33) - - plane_a_swap = plane_a_uppers.row(align=True) - plane_a_swap.label("Swap With:") - plane_a_swap.operator( - "maplus.calcresultswapplaneaplaneb", - text="B" - ) - plane_a_swap.operator( - "maplus.calcresultswapplaneaplanec", - text="C" - ) - - plane_a_uppers_rightside = plane_a_uppers.row(align=True) - plane_a_uppers_rightside.alignment = 'RIGHT' - plane_a_uppers_rightside.label("Send:") - plane_a_uppers_rightside.operator( - "maplus.calcresultsendplaneatocursor", - icon='CURSOR', - text="" - ) - - plane_a_uppers_rightside.label("Grab:") - plane_a_uppers_rightside.operator( - "maplus.calcresultgrabplaneafromcursor", - icon='CURSOR', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.calcresultgrabplaneafromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.calcresultgrabplaneafromactiveglobal", - icon='WORLD', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.calcresultgrabavgplanea", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_plna.prop( - bpy.types.AnyType(addon_data.quick_calc_result_item), - 'plane_pt_a', - "" + layout_coordvec( + parent_layout=calcresult_geom_editor, + coordvec_label="Pt. A:", + op_id_cursor_grab=( + "maplus.calcresultgrabplaneafromcursor" + ), + op_id_avg_grab=( + "maplus.calcresultgrabavgplanea" + ), + op_id_local_grab=( + "maplus.calcresultgrabplaneafromactivelocal" + ), + op_id_global_grab=( + "maplus.calcresultgrabplaneafromactiveglobal" + ), + coord_container=addon_data.quick_calc_result_item, + coord_attribute="plane_pt_a", + op_id_cursor_send=( + "maplus.calcresultsendplaneatocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.calcresultswapplaneaplaneb", + "B" + ), + op_id_text_tuple_swap_second=( + "maplus.calcresultswapplaneaplanec", + "C" + ) ) # component_changers_plna = plane_a_items.row() @@ -14591,57 +13813,34 @@ def draw(self, context): # text="11Z" # ) - calcresult_geom_editor.label("Pt. B (Pivot):") - # plane_b_items = calcresult_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - plane_b_items = calcresult_geom_editor.row() - typein_and_grab_plnb = plane_b_items.column() - plane_b_uppers = typein_and_grab_plnb.split(percentage=.33) - plane_b_swap = plane_b_uppers.row(align=True) - plane_b_swap.label("Swap With:") - plane_b_swap.operator( - "maplus.calcresultswapplaneaplaneb", - text="A" - ) - plane_b_swap.operator( - "maplus.calcresultswapplanebplanec", - text="C" - ) - - plane_b_uppers_rightside = plane_b_uppers.row(align=True) - plane_b_uppers_rightside.alignment = 'RIGHT' - plane_b_uppers_rightside.label("Send:") - plane_b_uppers_rightside.operator( - "maplus.calcresultsendplanebtocursor", - icon='CURSOR', - text="" - ) - - plane_b_uppers_rightside.label("Grab:") - plane_b_uppers_rightside.operator( - "maplus.calcresultgrabplanebfromcursor", - icon='CURSOR', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.calcresultgrabplanebfromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.calcresultgrabplanebfromactiveglobal", - icon='WORLD', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.calcresultgrabavgplaneb", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_plnb.prop( - bpy.types.AnyType(addon_data.quick_calc_result_item), - 'plane_pt_b', - "" + layout_coordvec( + parent_layout=calcresult_geom_editor, + coordvec_label="Pt. B:", + op_id_cursor_grab=( + "maplus.calcresultgrabplanebfromcursor" + ), + op_id_avg_grab=( + "maplus.calcresultgrabavgplaneb" + ), + op_id_local_grab=( + "maplus.calcresultgrabplanebfromactivelocal" + ), + op_id_global_grab=( + "maplus.calcresultgrabplanebfromactiveglobal" + ), + coord_container=addon_data.quick_calc_result_item, + coord_attribute="plane_pt_b", + op_id_cursor_send=( + "maplus.calcresultsendplanebtocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.calcresultswapplaneaplaneb", + "A" + ), + op_id_text_tuple_swap_second=( + "maplus.calcresultswapplanebplanec", + "C" + ) ) # component_changers_plnb = plane_b_items.row() @@ -14678,57 +13877,34 @@ def draw(self, context): # text="11Z" # ) - calcresult_geom_editor.label("Pt. C:") - # plane_c_items = calcresult_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - plane_c_items = calcresult_geom_editor.row() - typein_and_grab_plnc = plane_c_items.column() - plane_c_uppers = typein_and_grab_plnc.split(percentage=.33) - plane_c_swap = plane_c_uppers.row(align=True) - plane_c_swap.label("Swap With:") - plane_c_swap.operator( - "maplus.calcresultswapplaneaplanec", - text="A" - ) - plane_c_swap.operator( - "maplus.calcresultswapplanebplanec", - text="B" - ) - - plane_c_uppers_rightside = plane_c_uppers.row(align=True) - plane_c_uppers_rightside.alignment = 'RIGHT' - plane_c_uppers_rightside.label("Send:") - plane_c_uppers_rightside.operator( - "maplus.calcresultsendplanectocursor", - icon='CURSOR', - text="" - ) - - plane_c_uppers_rightside.label("Grab:") - plane_c_uppers_rightside.operator( - "maplus.calcresultgrabplanecfromcursor", - icon='CURSOR', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.calcresultgrabplanecfromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.calcresultgrabplanecfromactiveglobal", - icon='WORLD', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.calcresultgrabavgplanec", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_plnc.prop( - bpy.types.AnyType(addon_data.quick_calc_result_item), - 'plane_pt_c', - "" + layout_coordvec( + parent_layout=calcresult_geom_editor, + coordvec_label="Pt. C:", + op_id_cursor_grab=( + "maplus.calcresultgrabplanecfromcursor" + ), + op_id_avg_grab=( + "maplus.calcresultgrabavgplanec" + ), + op_id_local_grab=( + "maplus.calcresultgrabplanecfromactivelocal" + ), + op_id_global_grab=( + "maplus.calcresultgrabplanecfromactiveglobal" + ), + coord_container=addon_data.quick_calc_result_item, + coord_attribute="plane_pt_c", + op_id_cursor_send=( + "maplus.calcresultsendplanectocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.calcresultswapplaneaplanec", + "A" + ), + op_id_text_tuple_swap_second=( + "maplus.calcresultswapplanebplanec", + "B" + ) ) # component_changers_plnc = plane_c_items.row() From 232d6aace8f71883f6428bfd7b6118277d4ec3ad Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Wed, 29 Mar 2017 21:55:58 -0400 Subject: [PATCH 32/56] Revised/added icons for geom grabbing/editing in quick tools. --- mesh_mesh_align_plus.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 9adcbe6..c33ddd9 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -10095,7 +10095,7 @@ def draw(self, context): preserve_button_roundedge = apt_src_geom_top.row() preserve_button_roundedge.operator( "maplus.quickalignpointsgrabsrc", - icon='WORLD', + icon='LAYER_ACTIVE', text="Grab Source" ) preserve_button_roundedge.operator( @@ -10111,7 +10111,7 @@ def draw(self, context): text="", emboss=False ) - apt_src_geom_top.label("Source Coordinates") + apt_src_geom_top.label("Source Coordinates", icon="LAYER_ACTIVE") apt_src_geom_editor = apt_grab_col.box() pt_grab_all = apt_src_geom_editor.row(align=True) @@ -10233,7 +10233,7 @@ def draw(self, context): preserve_button_roundedge = apt_dest_geom_top.row() preserve_button_roundedge.operator( "maplus.quickalignpointsgrabdest", - icon='WORLD', + icon='LAYER_ACTIVE', text="Grab Destination" ) preserve_button_roundedge.operator( @@ -10249,7 +10249,7 @@ def draw(self, context): text="", emboss=False ) - apt_dest_geom_top.label("Destination Coordinates") + apt_dest_geom_top.label("Destination Coordinates", icon="LAYER_ACTIVE") apt_dest_geom_editor = apt_grab_col.box() pt_grab_all = apt_dest_geom_editor.row(align=True) @@ -10407,7 +10407,7 @@ def draw(self, context): preserve_button_roundedge = aln_src_geom_top.row() preserve_button_roundedge.operator( "maplus.quickalignlinesgrabsrc", - icon='WORLD', + icon='MAN_TRANS', text="Grab Source" ) preserve_button_roundedge.operator( @@ -10422,7 +10422,7 @@ def draw(self, context): text="", emboss=False ) - aln_src_geom_top.label("Source Coordinates") + aln_src_geom_top.label("Source Coordinates", icon="MAN_TRANS") aln_src_geom_editor = aln_grab_col.box() ln_grab_all = aln_src_geom_editor.row(align=True) @@ -10621,7 +10621,7 @@ def draw(self, context): preserve_button_roundedge = aln_dest_geom_top.row() preserve_button_roundedge.operator( "maplus.quickalignlinesgrabdest", - icon='WORLD', + icon='MAN_TRANS', text="Grab Destination" ) preserve_button_roundedge.operator( @@ -10636,7 +10636,7 @@ def draw(self, context): text="", emboss=False ) - aln_dest_geom_top.label("Destination Coordinates") + aln_dest_geom_top.label("Destination Coordinates", icon="MAN_TRANS") aln_dest_geom_editor = aln_grab_col.box() ln_grab_all = aln_dest_geom_editor.row(align=True) @@ -10858,7 +10858,7 @@ def draw(self, context): preserve_button_roundedge = apl_src_geom_top.row() preserve_button_roundedge.operator( "maplus.quickalignplanesgrabsrc", - icon='WORLD', + icon='OUTLINER_OB_MESH', text="Grab Source" ) else: @@ -10868,7 +10868,7 @@ def draw(self, context): text="", emboss=False ) - apl_src_geom_top.label("Source Coordinates") + apl_src_geom_top.label("Source Coordinates", icon="OUTLINER_OB_MESH") apl_src_geom_editor = apl_grab_col.box() plane_grab_all = apl_src_geom_editor.row(align=True) @@ -11106,7 +11106,7 @@ def draw(self, context): preserve_button_roundedge = apl_dest_geom_top.row() preserve_button_roundedge.operator( "maplus.quickalignplanesgrabdest", - icon='WORLD', + icon='OUTLINER_OB_MESH', text="Grab Destination" ) else: @@ -11116,7 +11116,7 @@ def draw(self, context): text="", emboss=False ) - apl_dest_geom_top.label("Destination Coordinates") + apl_dest_geom_top.label("Destination Coordinates", icon="OUTLINER_OB_MESH") apl_dest_geom_editor = apl_grab_col.box() plane_grab_all = apl_dest_geom_editor.row(align=True) @@ -11416,7 +11416,7 @@ def draw(self, context): preserve_button_roundedge = axr_src_geom_top.row() preserve_button_roundedge.operator( "maplus.quickaxisrotategrabsrc", - icon='WORLD', + icon='MAN_TRANS', text="Grab Axis" ) preserve_button_roundedge.operator( @@ -11431,7 +11431,7 @@ def draw(self, context): text="", emboss=False ) - axr_src_geom_top.label("Source Coordinates") + axr_src_geom_top.label("Source Coordinates", icon="MAN_TRANS") axr_src_geom_editor = axr_grab_col.box() ln_grab_all = axr_src_geom_editor.row(align=True) @@ -11731,7 +11731,7 @@ def draw(self, context): preserve_button_roundedge = ds_src_geom_top.row() preserve_button_roundedge.operator( "maplus.quickdirectionalslidegrabsrc", - icon='WORLD', + icon='MAN_TRANS', text="Grab Source" ) preserve_button_roundedge.operator( @@ -11747,7 +11747,7 @@ def draw(self, context): text="", emboss=False ) - ds_src_geom_top.label("Source Coordinates") + ds_src_geom_top.label("Source Coordinates", icon="MAN_TRANS") ds_src_geom_editor = ds_grab_col.box() ln_grab_all = ds_src_geom_editor.row(align=True) @@ -12009,7 +12009,7 @@ def draw(self, context): preserve_button_roundedge = sme_src_geom_top.row() preserve_button_roundedge.operator( "maplus.quickscalematchedgegrabsrc", - icon='WORLD', + icon='MAN_TRANS', text="Grab Source" ) else: @@ -12019,7 +12019,7 @@ def draw(self, context): text="", emboss=False ) - sme_src_geom_top.label("Source Coordinates") + sme_src_geom_top.label("Source Coordinates", icon="MAN_TRANS") sme_src_geom_editor = sme_grab_col.box() ln_grab_all = sme_src_geom_editor.row(align=True) @@ -12212,7 +12212,7 @@ def draw(self, context): preserve_button_roundedge = sme_dest_geom_top.row() preserve_button_roundedge.operator( "maplus.quickscalematchedgegrabdest", - icon='WORLD', + icon='MAN_TRANS', text="Grab Destination" ) else: @@ -12222,7 +12222,7 @@ def draw(self, context): text="", emboss=False ) - sme_dest_geom_top.label("Destination Coordinates") + sme_dest_geom_top.label("Destination Coordinates", icon="MAN_TRANS") sme_dest_geom_editor = sme_grab_col.box() ln_grab_all = sme_dest_geom_editor.row(align=True) From 19eecdb54c69a01692973c16f1c3f1cce4f83335 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Wed, 29 Mar 2017 22:17:21 -0400 Subject: [PATCH 33/56] Added visual indicator/icon for quick op settings. --- mesh_mesh_align_plus.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index c33ddd9..96959b3 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -10326,7 +10326,7 @@ def draw(self, context): ######################## - align_pts_gui.label("Operator settings:") + align_pts_gui.label("Operator settings:", icon="SCRIPTWIN") apt_mods = align_pts_gui.box() apt_box_row1 = apt_mods.row() apt_box_row1.prop( @@ -10788,7 +10788,7 @@ def draw(self, context): ################################### ################################### - aln_gui.label("Operator settings:") + aln_gui.label("Operator settings:", icon="SCRIPTWIN") aln_mods = aln_gui.box() aln_mods_row1 = aln_mods.row() aln_mods_row1.prop( @@ -11341,7 +11341,7 @@ def draw(self, context): ################################### ################################### - apl_gui.label("Operator settings:") + apl_gui.label("Operator settings:", icon="SCRIPTWIN") apl_mods = apl_gui.box() apl_mods_row1 = apl_mods.row() apl_mods_row1.prop( @@ -11661,7 +11661,7 @@ def draw(self, context): if addon_data.quick_axr_show_src_geom: axr_grab_col.separator() - axr_gui.label("Operator settings:") + axr_gui.label("Operator settings:", icon="SCRIPTWIN") axr_mods = axr_gui.box() axr_mods_row1 = axr_mods.row() axr_mods_row1.prop( @@ -11928,7 +11928,7 @@ def draw(self, context): if addon_data.quick_ds_show_src_geom: ds_grab_col.separator() - ds_gui.label("Operator settings:") + ds_gui.label("Operator settings:", icon="SCRIPTWIN") ds_mods = ds_gui.box() ds_box_row1 = ds_mods.row() ds_box_row1.prop( From 26b9c0535ca28925eb1790fb96effe4799720e99 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Wed, 29 Mar 2017 22:28:53 -0400 Subject: [PATCH 34/56] Corrected axis rotate operator subpoint layouts. --- mesh_mesh_align_plus.py | 144 ++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 96 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 96959b3..3fabd3a 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -11491,54 +11491,30 @@ def draw(self, context): "Multiplier" ) - axr_src_geom_editor.label("Start:") - # plane_a_items = axr_src_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_start_items = axr_src_geom_editor.row() - typein_and_grab_start = ln_start_items.column() - ln_start_uppers = typein_and_grab_start.split(percentage=.33) - - ln_start_swap = ln_start_uppers.row(align=True) - ln_start_swap.label("Swap With:") - ln_start_swap.operator( - "maplus.quickaxrsrcswaplinepoints", - text="End" - ) - - ln_start_uppers_rightside = ln_start_uppers.row(align=True) - ln_start_uppers_rightside.alignment = 'RIGHT' - ln_start_uppers_rightside.label("Send:") - ln_start_uppers_rightside.operator( - "maplus.quickaxrsrcsendlinestarttocursor", - icon='CURSOR', - text="" - ) - - ln_start_uppers_rightside.label("Grab:") - ln_start_uppers_rightside.operator( - "maplus.quickaxrsrcgrablinestartfromcursor", - icon='CURSOR', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quickaxrsrcgrablinestartfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quickaxrsrcgrablinestartfromactiveglobal", - icon='WORLD', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.quickaxrgrabavgsrclinestart", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_start.prop( - bpy.types.AnyType(addon_data.quick_axis_rotate_src), - 'line_start', - "" + layout_coordvec( + parent_layout=axr_src_geom_editor, + coordvec_label="Start:", + op_id_cursor_grab=( + "maplus.quickaxrsrcgrablinestartfromcursor" + ), + op_id_avg_grab=( + "maplus.quickaxrgrabavgsrclinestart" + ), + op_id_local_grab=( + "maplus.quickaxrsrcgrablinestartfromactivelocal" + ), + op_id_global_grab=( + "maplus.quickaxrsrcgrablinestartfromactiveglobal" + ), + coord_container=addon_data.quick_axis_rotate_src, + coord_attribute="line_start", + op_id_cursor_send=( + "maplus.quickaxrsrcsendlinestarttocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quickaxrsrcswaplinepoints", + "End" + ) ) # component_changers_plna = plane_a_items.row() @@ -11575,54 +11551,30 @@ def draw(self, context): # text="11Z" # ) - axr_src_geom_editor.label("End:") - # plane_a_items = axr_src_geom_editor.split(percentage=.75) - # ^ line changed to remove component changers - ln_end_items = axr_src_geom_editor.row() - typein_and_grab_end = ln_end_items.column() - ln_end_uppers = typein_and_grab_end.split(percentage=.33) - - ln_end_swap = ln_end_uppers.row(align=True) - ln_end_swap.label("Swap With:") - ln_end_swap.operator( - "maplus.quickaxrsrcswaplinepoints", - text="Start" - ) - - ln_end_uppers_rightside = ln_end_uppers.row(align=True) - ln_end_uppers_rightside.alignment = 'RIGHT' - ln_end_uppers_rightside.label("Send:") - ln_end_uppers_rightside.operator( - "maplus.quickaxrsrcsendlineendtocursor", - icon='CURSOR', - text="" - ) - - ln_end_uppers_rightside.label("Grab:") - ln_end_uppers_rightside.operator( - "maplus.quickaxrsrcgrablineendfromcursor", - icon='CURSOR', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quickaxrsrcgrablineendfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quickaxrsrcgrablineendfromactiveglobal", - icon='WORLD', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.quickaxrgrabavgsrclineend", - icon='GROUP_VERTEX', - text="" - ) - typein_and_grab_end.prop( - bpy.types.AnyType(addon_data.quick_axis_rotate_src), - 'line_end', - "" + layout_coordvec( + parent_layout=axr_src_geom_editor, + coordvec_label="End:", + op_id_cursor_grab=( + "maplus.quickaxrsrcgrablineendfromcursor" + ), + op_id_avg_grab=( + "maplus.quickaxrgrabavgsrclineend" + ), + op_id_local_grab=( + "maplus.quickaxrsrcgrablineendfromactivelocal" + ), + op_id_global_grab=( + "maplus.quickaxrsrcgrablineendfromactiveglobal" + ), + coord_container=addon_data.quick_axis_rotate_src, + coord_attribute="line_end", + op_id_cursor_send=( + "maplus.quickaxrsrcsendlineendtocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.quickaxrsrcswaplinepoints", + "Start" + ) ) # component_changers_plnc = plane_c_items.row() From 84967b62e8ff56c0d1b04de1f69f8156a092a0b5 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Sun, 2 Apr 2017 16:49:17 -0400 Subject: [PATCH 35/56] Added type checking for quick calculations. --- mesh_mesh_align_plus.py | 235 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 228 insertions(+), 7 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 3fabd3a..e4dcf24 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -556,8 +556,17 @@ class MAPlusData(bpy.types.PropertyGroup): ), default=True ) - + # Quick Calculation items + quick_calc_check_types = bpy.props.BoolProperty( + description=( + "Check/verify slot types and disable operations that do not" + " match the type(s) of the current geometry item slots." + " Uncheck to silently allow calculations on slot data that is" + " not currently displayed in the interface." + ), + default=True + ) quick_calc_show_slot1_geom = bpy.props.BoolProperty( description=( "Expand/collapse the slot 1 geometry editor" @@ -7989,6 +7998,14 @@ def execute(self, context): ' a line') ) return {'CANCELLED'} + if hasattr(self, 'quick_calc_target'): + if calc_target_item.kind != 'LINE': + self.report( + {'WARNING'}, + ('Operand type warning: Slot 1 (the target) is not' + ' explicitly using the correct type for this' + ' calculation (type should be set to "Line").') + ) src_global_data = get_modified_global_coords( geometry=calc_target_item, @@ -8013,10 +8030,21 @@ class CalcLineLength(CalcLineLengthBase): class QuickCalcLineLength(CalcLineLengthBase): bl_idname = "maplus.quickcalclinelength" bl_label = "Calculate Line Length" - bl_description = "Calculates the length of the targeted line item" + bl_description = ( + "Calculates the length of the line item in Slot 1" + ) bl_options = {'REGISTER', 'UNDO'} quick_calc_target = True + @classmethod + def poll(cls, context): + addon_data = bpy.context.scene.maplus_data + + if (addon_data.quick_calc_check_types and + addon_data.internal_storage_slot_1.kind != 'LINE'): + return False + return True + class CalcRotationalDiffBase(bpy.types.Operator): bl_idname = "maplus.calcrotationaldiffbase" @@ -8048,6 +8076,16 @@ def execute(self, context): ' only operate on two lines') ) return {'CANCELLED'} + if hasattr(self, 'quick_calc_target'): + if calc_target_one.kind != 'LINE' or calc_target_two.kind != 'LINE': + self.report( + {'WARNING'}, + ('Operand type warning: Slot 1 and/or Slot 2 are not' + ' explicitly using the correct types for this' + ' calculation (item type for both should be' + ' set to "Line").') + ) + src_global_data = get_modified_global_coords( geometry=calc_target_one, @@ -8094,6 +8132,16 @@ class QuickCalcRotationalDiff(CalcRotationalDiffBase): bl_options = {'REGISTER', 'UNDO'} quick_calc_target = True + @classmethod + def poll(cls, context): + addon_data = bpy.context.scene.maplus_data + + if (addon_data.quick_calc_check_types and + (addon_data.internal_storage_slot_1.kind != 'LINE' or + addon_data.internal_storage_slot_2.kind != 'LINE')): + return False + return True + class ComposeNewLineFromOriginBase(bpy.types.Operator): bl_idname = "maplus.composenewlinefromoriginbase" @@ -8121,6 +8169,14 @@ def execute(self, context): ' only operate on a line') ) return {'CANCELLED'} + if hasattr(self, 'quick_calc_target'): + if calc_target_item.kind != 'LINE': + self.report( + {'WARNING'}, + ('Operand type warning: Slot 1 (the target) is not' + ' explicitly using the correct type for this' + ' calculation (type should be set to "Line").') + ) start_loc = mathutils.Vector((0, 0, 0)) src_global_data = get_modified_global_coords( @@ -8129,6 +8185,7 @@ def execute(self, context): ) src_line = src_global_data[1] - src_global_data[0] + result_item.kind = 'LINE' result_item.line_start = start_loc result_item.line_end = ( start_loc + src_line @@ -8162,6 +8219,15 @@ class QuickComposeNewLineFromOrigin(ComposeNewLineFromOriginBase): bl_options = {'REGISTER', 'UNDO'} quick_calc_target = True + @classmethod + def poll(cls, context): + addon_data = bpy.context.scene.maplus_data + + if (addon_data.quick_calc_check_types and + addon_data.internal_storage_slot_1.kind != 'LINE'): + return False + return True + class ComposeNormalFromPlaneBase(bpy.types.Operator): bl_idname = "maplus.composenormalfromplanebase" @@ -8189,6 +8255,14 @@ def execute(self, context): ' a plane') ) return {'CANCELLED'} + if hasattr(self, 'quick_calc_target'): + if calc_target_item.kind != 'PLANE': + self.report( + {'WARNING'}, + ('Operand type warning: Slot 1 (the target) is not' + ' explicitly using the correct type for this' + ' calculation (type should be set to "Plane").') + ) src_global_data = get_modified_global_coords( geometry=calc_target_item, @@ -8208,6 +8282,7 @@ def execute(self, context): calc_target_item.plane_pt_b[0:3] ) + result_item.kind = 'LINE' result_item.line_start = start_loc result_item.line_end = start_loc + normal if addon_data.calc_result_to_clipboard: @@ -8239,6 +8314,15 @@ class QuickComposeNormalFromPlane(ComposeNormalFromPlaneBase): bl_options = {'REGISTER', 'UNDO'} quick_calc_target = True + @classmethod + def poll(cls, context): + addon_data = bpy.context.scene.maplus_data + + if (addon_data.quick_calc_check_types and + addon_data.internal_storage_slot_1.kind != 'PLANE'): + return False + return True + class ComposeNewLineFromPointBase(bpy.types.Operator): bl_idname = "maplus.composenewlinefrompointbase" @@ -8269,6 +8353,14 @@ def execute(self, context): ' only operate on a point') ) return {'CANCELLED'} + if hasattr(self, 'quick_calc_target'): + if calc_target_item.kind != 'POINT': + self.report( + {'WARNING'}, + ('Operand type warning: Slot 1 (the target) is not' + ' explicitly using the correct type for this' + ' calculation (type should be set to "Point").') + ) start_loc = mathutils.Vector((0, 0, 0)) @@ -8277,6 +8369,7 @@ def execute(self, context): kind='POINT' ) + result_item.kind = 'LINE' result_item.line_start = start_loc result_item.line_end = src_global_data[0] if addon_data.calc_result_to_clipboard: @@ -8314,6 +8407,15 @@ class QuickComposeNewLineFromPoint(bpy.types.Operator): bl_options = {'REGISTER', 'UNDO'} quick_calc_target = True + @classmethod + def poll(cls, context): + addon_data = bpy.context.scene.maplus_data + + if (addon_data.quick_calc_check_types and + addon_data.internal_storage_slot_1.kind != 'POINT'): + return False + return True + class ComposeNewLineAtPointLocationBase(bpy.types.Operator): bl_idname = "maplus.composenewlineatpointlocationbase" @@ -8339,11 +8441,11 @@ def execute(self, context): item.kind: item for item in [calc_target_one, calc_target_two] } - if (not hasattr(self, 'quick_calc_target')) and not ('POINT' in targets_by_kind and 'LINE' in targets_by_kind): + if not ('POINT' in targets_by_kind and 'LINE' in targets_by_kind): self.report( {'ERROR'}, - ('Wrong operand: "Compose New Line at Point" can' - ' only operate on a line') + ('Wrong operand(s): "Compose New Line at Point" can' + ' only operate with both a line and a point') ) return {'CANCELLED'} @@ -8358,6 +8460,7 @@ def execute(self, context): start_loc = pt_global_data[0] src_line = line_global_data[1] - line_global_data[0] + result_item.kind = 'LINE' result_item.line_start = start_loc result_item.line_end = start_loc + src_line if addon_data.calc_result_to_clipboard: @@ -8389,6 +8492,22 @@ class QuickComposeNewLineAtPointLocation(ComposeNewLineAtPointLocationBase): bl_options = {'REGISTER', 'UNDO'} quick_calc_target = True + @classmethod + def poll(cls, context): + addon_data = bpy.context.scene.maplus_data + + slot_kinds = set( + [item.kind for item in [ + addon_data.internal_storage_slot_1, + addon_data.internal_storage_slot_2 + ] + ] + ) + if (addon_data.quick_calc_check_types and + ('POINT' not in slot_kinds or 'LINE' not in slot_kinds)): + return False + return True + class CalcDistanceBetweenPointsBase(bpy.types.Operator): bl_idname = "maplus.calcdistancebetweenpointsbase" @@ -8418,6 +8537,15 @@ def execute(self, context): ' only operate on two points') ) return {'CANCELLED'} + if hasattr(self, 'quick_calc_target'): + if calc_target_one.kind != 'POINT' or calc_target_two.kind != 'POINT': + self.report( + {'WARNING'}, + ('Operand type warning: Slot 1 and/or Slot 2 are not' + ' explicitly using the correct types for this' + ' calculation (item type for both should be' + ' set to "Point").') + ) src_global_data = get_modified_global_coords( geometry=calc_target_one, @@ -8452,6 +8580,16 @@ class QuickCalcDistanceBetweenPoints(CalcDistanceBetweenPointsBase): bl_options = {'REGISTER', 'UNDO'} quick_calc_target = True + @classmethod + def poll(cls, context): + addon_data = bpy.context.scene.maplus_data + + if (addon_data.quick_calc_check_types and + (addon_data.internal_storage_slot_1.kind != 'POINT' or + addon_data.internal_storage_slot_2.kind != 'POINT')): + return False + return True + class ComposeNewLineFromPointsBase(bpy.types.Operator): bl_idname = "maplus.composenewlinefrompointsbase" @@ -8482,6 +8620,15 @@ def execute(self, context): ' only operate on two points') ) return {'CANCELLED'} + if hasattr(self, 'quick_calc_target'): + if calc_target_one.kind != 'POINT' or calc_target_two.kind != 'POINT': + self.report( + {'WARNING'}, + ('Operand type warning: Slot 1 and/or Slot 2 are not' + ' explicitly using the correct types for this' + ' calculation (item type for both should be' + ' set to "Point").') + ) src_global_data = get_modified_global_coords( geometry=calc_target_one, @@ -8494,6 +8641,7 @@ def execute(self, context): src_pt = src_global_data[0] dest_pt = dest_global_data[0] + result_item.kind = 'LINE' result_item.line_start = src_pt result_item.line_end = dest_pt if addon_data.calc_result_to_clipboard: @@ -8525,6 +8673,16 @@ class QuickComposeNewLineFromPoints(ComposeNewLineFromPointsBase): bl_options = {'REGISTER', 'UNDO'} quick_calc_target = True + @classmethod + def poll(cls, context): + addon_data = bpy.context.scene.maplus_data + + if (addon_data.quick_calc_check_types and + (addon_data.internal_storage_slot_1.kind != 'POINT' or + addon_data.internal_storage_slot_2.kind != 'POINT')): + return False + return True + class ComposeNewLineVectorAdditionBase(bpy.types.Operator): bl_idname = "maplus.composenewlinevectoradditionbase" @@ -8555,6 +8713,15 @@ def execute(self, context): ' two lines') ) return {'CANCELLED'} + if hasattr(self, 'quick_calc_target'): + if calc_target_one.kind != 'LINE' or calc_target_two.kind != 'LINE': + self.report( + {'WARNING'}, + ('Operand type warning: Slot 1 and/or Slot 2 are not' + ' explicitly using the correct types for this' + ' calculation (item type for both should be' + ' set to "Line").') + ) start_loc = mathutils.Vector((0, 0, 0)) @@ -8569,6 +8736,7 @@ def execute(self, context): src_line = src_global_data[1] - src_global_data[0] dest_line = dest_global_data[1] - dest_global_data[0] + result_item.kind = 'LINE' result_item.line_start = start_loc result_item.line_end = src_line + dest_line if addon_data.calc_result_to_clipboard: @@ -8600,6 +8768,16 @@ class QuickComposeNewLineVectorAddition(ComposeNewLineVectorAdditionBase): bl_options = {'REGISTER', 'UNDO'} quick_calc_target = True + @classmethod + def poll(cls, context): + addon_data = bpy.context.scene.maplus_data + + if (addon_data.quick_calc_check_types and + (addon_data.internal_storage_slot_1.kind != 'POINT' or + addon_data.internal_storage_slot_2.kind != 'POINT')): + return False + return True + class ComposeNewLineVectorSubtractionBase(bpy.types.Operator): bl_idname = "maplus.composenewlinevectorsubtractionbase" @@ -8633,6 +8811,15 @@ def execute(self, context): ' two lines') ) return {'CANCELLED'} + if hasattr(self, 'quick_calc_target'): + if calc_target_one.kind != 'LINE' or calc_target_two.kind != 'LINE': + self.report( + {'WARNING'}, + ('Operand type warning: Slot 1 and/or Slot 2 are not' + ' explicitly using the correct types for this' + ' calculation (item type for both should be' + ' set to "Line").') + ) start_loc = mathutils.Vector((0, 0, 0)) @@ -8647,6 +8834,7 @@ def execute(self, context): src_line = src_global_data[1] - src_global_data[0] dest_line = dest_global_data[1] - dest_global_data[0] + result_item.kind = 'LINE' result_item.line_start = start_loc result_item.line_end = src_line - dest_line if addon_data.calc_result_to_clipboard: @@ -8684,6 +8872,16 @@ class QuickComposeNewLineVectorSubtraction(ComposeNewLineVectorSubtractionBase): bl_options = {'REGISTER', 'UNDO'} quick_calc_target = True + @classmethod + def poll(cls, context): + addon_data = bpy.context.scene.maplus_data + + if (addon_data.quick_calc_check_types and + (addon_data.internal_storage_slot_1.kind != 'POINT' or + addon_data.internal_storage_slot_2.kind != 'POINT')): + return False + return True + class ComposePointIntersectingLinePlaneBase(bpy.types.Operator): bl_idname = "maplus.composepointintersectinglineplanebase" @@ -8711,7 +8909,7 @@ def execute(self, context): item.kind: item for item in [calc_target_one, calc_target_two] } - if (not hasattr(self, 'quick_calc_target')) and not ('LINE' in targets_by_kind and 'PLANE' in targets_by_kind): + if not ('LINE' in targets_by_kind and 'PLANE' in targets_by_kind): self.report( {'ERROR'}, ('Wrong operand: "Intersect Line/Plane" can' @@ -8739,6 +8937,7 @@ def execute(self, context): ) if intersection: + result_item.kind = 'POINT' result_item.point = intersection if addon_data.calc_result_to_clipboard: addon_data.internal_storage_clipboard.kind = 'POINT' @@ -8778,6 +8977,22 @@ class QuickComposePointIntersectingLinePlane(ComposePointIntersectingLinePlaneBa bl_options = {'REGISTER', 'UNDO'} quick_calc_target = True + @classmethod + def poll(cls, context): + addon_data = bpy.context.scene.maplus_data + + slot_kinds = set( + [item.kind for item in [ + addon_data.internal_storage_slot_1, + addon_data.internal_storage_slot_2 + ] + ] + ) + if (addon_data.quick_calc_check_types and + ('LINE' not in slot_kinds or 'PLANE' not in slot_kinds)): + return False + return True + # Custom list, for displaying combined list of all primitives (Used at top # of main panel and for item pointers in transformation primitives @@ -13897,7 +14112,13 @@ def draw(self, context): calc_gui.separator() - calc_gui.label("Available Calc.'s:") + ops_header = calc_gui.row() + ops_header.label("Available Calc.'s:") + ops_header.prop( + bpy.types.AnyType(addon_data), + 'quick_calc_check_types', + "Check/Verify Types" + ) calc_gui.operator( "maplus.quickcalclinelength", text="Line Length" From 9dd32f4d345cca386234bc3ed40a7a44812d54eb Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Mon, 3 Apr 2017 16:23:18 -0400 Subject: [PATCH 36/56] Added 'numeric input' mode to Scale Match Edge op. This is a convenience feature that uses its own geom/data. --- mesh_mesh_align_plus.py | 114 +++++++++++++++++++++++++++++++++++----- 1 file changed, 101 insertions(+), 13 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index e4dcf24..41996d1 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -461,6 +461,25 @@ class MAPlusData(bpy.types.PropertyGroup): quick_scale_match_edge_transf = bpy.props.PointerProperty( type=MAPlusPrimitive ) + # Scale Match Edge numeric mode items + quick_sme_numeric_mode = bpy.props.BoolProperty( + description=( + 'Use alternate "Numeric Input" mode to type a target edge' + ' length in directly.' + ), + default=False + ) + quick_sme_numeric_length = bpy.props.FloatProperty( + description="Desired length for the target edge", + default=1, + precision=6 + ) + quick_sme_numeric_src = bpy.props.PointerProperty( + type=MAPlusPrimitive + ) + quick_sme_numeric_dest = bpy.props.PointerProperty( + type=MAPlusPrimitive + ) quick_align_lines_show = bpy.props.BoolProperty( description=( @@ -6097,11 +6116,13 @@ def execute(self, context): bpy.ops.object.editmode_toggle() # Get global coordinate data for each geometry item, with - # modifiers applied. Grab either directly from the scene data - # (for quick ops), or from the MAPlus primitives - # CollectionProperty on the scene data (for advanced tools) + # applicable modifiers applied. Grab either (A) directly from + # the scene data (for quick ops), (B) from the MAPlus primitives + # CollectionProperty on the scene data (for advanced tools), or + # (C) from the selected verts directly for numeric input mode if hasattr(self, "quick_op_target"): - if addon_data.quick_scale_match_edge_auto_grab_src: + # Numeric mode is part of this op's quick tools + if addon_data.quick_sme_numeric_mode: vert_attribs_to_set = ('line_start', 'line_end') try: vert_data = return_selected_verts( @@ -6119,21 +6140,67 @@ def execute(self, context): ) return {'CANCELLED'} + addon_data.quick_sme_numeric_dest.ln_make_unit_vec = ( + True + ) + addon_data.quick_sme_numeric_dest.ln_multiplier = ( + addon_data.quick_sme_numeric_length + ) set_item_coords( - addon_data.quick_scale_match_edge_src, + addon_data.quick_sme_numeric_src, vert_attribs_to_set, vert_data ) + set_item_coords( + addon_data.quick_sme_numeric_dest, + vert_attribs_to_set, + vert_data + ) + src_global_data = get_modified_global_coords( + geometry=addon_data.quick_sme_numeric_src, + kind='LINE' + ) + dest_global_data = get_modified_global_coords( + geometry=addon_data.quick_sme_numeric_dest, + kind='LINE' + ) - src_global_data = get_modified_global_coords( - geometry=addon_data.quick_scale_match_edge_src, - kind='LINE' - ) - dest_global_data = get_modified_global_coords( - geometry=addon_data.quick_scale_match_edge_dest, - kind='LINE' - ) + # Non-numeric (normal quick op) mode + else: + if addon_data.quick_scale_match_edge_auto_grab_src: + vert_attribs_to_set = ('line_start', 'line_end') + try: + vert_data = return_selected_verts( + bpy.context.active_object, + len(vert_attribs_to_set), + bpy.context.active_object.matrix_world + ) + except InsufficientSelectionError: + self.report({'ERROR'}, 'Not enough vertices selected.') + return {'CANCELLED'} + except NonMeshGrabError: + self.report( + {'ERROR'}, + 'Cannot grab coords: non-mesh or no active object.' + ) + return {'CANCELLED'} + set_item_coords( + addon_data.quick_scale_match_edge_src, + vert_attribs_to_set, + vert_data + ) + + src_global_data = get_modified_global_coords( + geometry=addon_data.quick_scale_match_edge_src, + kind='LINE' + ) + dest_global_data = get_modified_global_coords( + geometry=addon_data.quick_scale_match_edge_dest, + kind='LINE' + ) + + # Else, operate on data from the advanced tools else: src_global_data = get_modified_global_coords( geometry=prims[active_item.sme_edge_one], @@ -12534,6 +12601,27 @@ def draw(self, context): ) ) + numeric_gui = sme_gui.column(align=True) + numeric_gui.prop( + addon_data, + 'quick_sme_numeric_mode', + 'Numeric Input Mode' + ) + numeric_settings = numeric_gui.row() + numeric_settings.prop( + addon_data, + 'quick_sme_numeric_length', + 'Target Length' + ) + + # Disable relevant items depending on whether numeric mode + # is enabled or not + if addon_data.quick_sme_numeric_mode: + sme_grab_col.enabled = False + else: + numeric_settings.enabled = False + + sme_apply_header = sme_gui.row() sme_apply_header.label("Apply to:") sme_apply_header.prop( From 90d110d3aca59e4145ba911447d7128cef12a1e5 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Mon, 3 Apr 2017 19:31:25 -0400 Subject: [PATCH 37/56] Added manual grabbing to Numeric Mode for Scale Match Edge. --- mesh_mesh_align_plus.py | 122 +++++++++++++++++++++++++++++++--------- 1 file changed, 95 insertions(+), 27 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 41996d1..60eac87 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -469,6 +469,12 @@ class MAPlusData(bpy.types.PropertyGroup): ), default=False ) + quick_sme_numeric_auto = bpy.props.BoolProperty( + description=( + "Automatically grab source line from selected geometry" + ), + default=True + ) quick_sme_numeric_length = bpy.props.FloatProperty( description="Desired length for the target edge", default=1, @@ -2022,6 +2028,56 @@ def execute(self, context): return {'FINISHED'} +class GrabSmeNumeric(bpy.types.Operator): + bl_idname = "maplus.grabsmenumeric" + bl_label = "Grab Target" + bl_description = ( + "Grab target for scale match edge numeric mode." + ) + bl_options = {'REGISTER', 'UNDO'} + # For grabbing global coords + multiply_by_world_matrix = True + # A tuple of attribute names (strings) that should be set on the maplus + # primitive (point, line or plane item). The length of this tuple + # determines how many verts will be grabbed. + vert_attribs_to_set = ('line_start', 'line_end') + + def execute(self, context): + addon_data = bpy.context.scene.maplus_data + + matrix_multiplier = None + if self.multiply_by_world_matrix: + matrix_multiplier = bpy.context.active_object.matrix_world + try: + vert_data = return_selected_verts( + bpy.context.active_object, + len(self.vert_attribs_to_set), + matrix_multiplier + ) + except InsufficientSelectionError: + self.report({'ERROR'}, 'Not enough vertices selected.') + return {'CANCELLED'} + except NonMeshGrabError: + self.report( + {'ERROR'}, + 'Cannot grab coords: non-mesh or no active object.' + ) + return {'CANCELLED'} + + set_item_coords( + addon_data.quick_sme_numeric_src, + self.vert_attribs_to_set, + vert_data + ) + set_item_coords( + addon_data.quick_sme_numeric_dest, + self.vert_attribs_to_set, + vert_data + ) + + return {'FINISHED'} + + class GrabAndSetItemKindBase(bpy.types.Operator): bl_idname = "maplus.grabandsetitemkindbase" bl_label = "Grab and Set Item Base Class" @@ -6123,22 +6179,34 @@ def execute(self, context): if hasattr(self, "quick_op_target"): # Numeric mode is part of this op's quick tools if addon_data.quick_sme_numeric_mode: - vert_attribs_to_set = ('line_start', 'line_end') - try: - vert_data = return_selected_verts( - bpy.context.active_object, - len(vert_attribs_to_set), - bpy.context.active_object.matrix_world + if addon_data.quick_sme_numeric_auto: + vert_attribs_to_set = ('line_start', 'line_end') + try: + vert_data = return_selected_verts( + bpy.context.active_object, + len(vert_attribs_to_set), + bpy.context.active_object.matrix_world + ) + except InsufficientSelectionError: + self.report({'ERROR'}, 'Not enough vertices selected.') + return {'CANCELLED'} + except NonMeshGrabError: + self.report( + {'ERROR'}, + 'Cannot grab coords: non-mesh or no active object.' + ) + return {'CANCELLED'} + + set_item_coords( + addon_data.quick_sme_numeric_src, + vert_attribs_to_set, + vert_data ) - except InsufficientSelectionError: - self.report({'ERROR'}, 'Not enough vertices selected.') - return {'CANCELLED'} - except NonMeshGrabError: - self.report( - {'ERROR'}, - 'Cannot grab coords: non-mesh or no active object.' + set_item_coords( + addon_data.quick_sme_numeric_dest, + vert_attribs_to_set, + vert_data ) - return {'CANCELLED'} addon_data.quick_sme_numeric_dest.ln_make_unit_vec = ( True @@ -6146,16 +6214,7 @@ def execute(self, context): addon_data.quick_sme_numeric_dest.ln_multiplier = ( addon_data.quick_sme_numeric_length ) - set_item_coords( - addon_data.quick_sme_numeric_src, - vert_attribs_to_set, - vert_data - ) - set_item_coords( - addon_data.quick_sme_numeric_dest, - vert_attribs_to_set, - vert_data - ) + src_global_data = get_modified_global_coords( geometry=addon_data.quick_sme_numeric_src, kind='LINE' @@ -12601,13 +12660,23 @@ def draw(self, context): ) ) - numeric_gui = sme_gui.column(align=True) + numeric_gui = sme_gui.column() numeric_gui.prop( addon_data, 'quick_sme_numeric_mode', 'Numeric Input Mode' ) - numeric_settings = numeric_gui.row() + numeric_settings = numeric_gui.box() + numeric_grabs = numeric_settings.row() + numeric_grabs.prop( + addon_data, + 'quick_sme_numeric_auto', + 'Auto Grab Target' + ) + if not addon_data.quick_sme_numeric_auto: + numeric_grabs.operator( + "maplus.grabsmenumeric" + ) numeric_settings.prop( addon_data, 'quick_sme_numeric_length', @@ -12620,7 +12689,6 @@ def draw(self, context): sme_grab_col.enabled = False else: numeric_settings.enabled = False - sme_apply_header = sme_gui.row() sme_apply_header.label("Apply to:") From 4a59b70220bae7e613c08b8b811d38ed79907326 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Mon, 3 Apr 2017 21:01:58 -0400 Subject: [PATCH 38/56] Modified tooltip for numeric auto grab checkbox. --- mesh_mesh_align_plus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 60eac87..0674ad0 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -471,7 +471,7 @@ class MAPlusData(bpy.types.PropertyGroup): ) quick_sme_numeric_auto = bpy.props.BoolProperty( description=( - "Automatically grab source line from selected geometry" + "Automatically grab target line from selected geometry" ), default=True ) From d182740fd9e48c7a9589f3c09499d19b158c38bc Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Sun, 28 May 2017 14:56:13 -0400 Subject: [PATCH 39/56] Fixed type checking on vector addition/subtraction quick ops. --- mesh_mesh_align_plus.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 0674ad0..d7ef2cb 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -8899,8 +8899,8 @@ def poll(cls, context): addon_data = bpy.context.scene.maplus_data if (addon_data.quick_calc_check_types and - (addon_data.internal_storage_slot_1.kind != 'POINT' or - addon_data.internal_storage_slot_2.kind != 'POINT')): + (addon_data.internal_storage_slot_1.kind != 'LINE' or + addon_data.internal_storage_slot_2.kind != 'LINE')): return False return True @@ -9003,8 +9003,8 @@ def poll(cls, context): addon_data = bpy.context.scene.maplus_data if (addon_data.quick_calc_check_types and - (addon_data.internal_storage_slot_1.kind != 'POINT' or - addon_data.internal_storage_slot_2.kind != 'POINT')): + (addon_data.internal_storage_slot_1.kind != 'LINE' or + addon_data.internal_storage_slot_2.kind != 'LINE')): return False return True From cef76412791867c976a78547fba8b4aa083d3ca0 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Sun, 28 May 2017 20:37:15 -0400 Subject: [PATCH 40/56] Moved adv. tools geom items to new coord layout. Feature regression: "Set other component" buttons removed. --- mesh_mesh_align_plus.py | 840 +++++++++++++++++++--------------------- 1 file changed, 404 insertions(+), 436 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index d7ef2cb..623209d 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -2598,6 +2598,72 @@ class GrabPointSlot2Loc(GrabFromGeometryBase): quick_op_target = "SLOT2" +class PointGrabAvg(GrabAverageLocationBase): + bl_idname = "maplus.pointgrabavg" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('point',) + multiply_by_world_matrix = True + + +class LineStartGrabAvg(GrabAverageLocationBase): + bl_idname = "maplus.linestartgrabavg" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start',) + multiply_by_world_matrix = True + + +class LineEndGrabAvg(GrabAverageLocationBase): + bl_idname = "maplus.lineendgrabavg" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_end',) + multiply_by_world_matrix = True + + +class PlaneAGrabAvg(GrabAverageLocationBase): + bl_idname = "maplus.planeagrabavg" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_a',) + multiply_by_world_matrix = True + + +class PlaneBGrabAvg(GrabAverageLocationBase): + bl_idname = "maplus.planebgrabavg" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_b',) + multiply_by_world_matrix = True + + +class PlaneCGrabAvg(GrabAverageLocationBase): + bl_idname = "maplus.planecgrabavg" + bl_label = "Grab Average Global Coordinates From Selected Points" + bl_description = ( + "Grabs average global coordinates from selected vertices in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('plane_pt_c',) + multiply_by_world_matrix = True + + class Slot1PointGrabAvg(GrabAverageLocationBase): bl_idname = "maplus.slot1pointgrabavg" bl_label = "Grab Average Global Coordinates From Selected Points" @@ -9361,73 +9427,57 @@ def draw(self, context): ) item_info_col.separator() - item_info_col.label('Pt. Origin:') - pt_coord_items = item_info_col.split(percentage=.75) - typein_and_grab = pt_coord_items.column() - pt_coord_uppers = typein_and_grab.row() - - pt_coord_uppers_leftside = pt_coord_uppers.row(align=True) - pt_coord_uppers_leftside.alignment = 'LEFT' - pt_coord_uppers_leftside.label("Send:") - pt_coord_uppers_leftside.operator( - "maplus.sendpointtocursor", - icon='CURSOR', - text="" - ) - - pt_coord_uppers_rightside = pt_coord_uppers.row(align=True) - pt_coord_uppers_rightside.alignment = 'RIGHT' - pt_coord_uppers_rightside.label("Grab:") - pt_coord_uppers_rightside.operator( - "maplus.grabpointfromcursor", - icon='CURSOR', - text="" - ) - pt_coord_uppers_rightside.operator( - "maplus.grabpointfromactivelocal", - icon='VERTEXSEL', - text="" - ) - pt_coord_uppers_rightside.operator( - "maplus.grabpointfromactiveglobal", - icon='WORLD', - text="" - ) - typein_and_grab.prop( - bpy.types.AnyType(active_item), - 'point', - "" + layout_coordvec( + parent_layout=item_info_col, + coordvec_label="Point Coordinates:", + op_id_cursor_grab=( + "maplus.grabpointfromcursor" + ), + op_id_avg_grab=( + "maplus.pointgrabavg" + ), + op_id_local_grab=( + "maplus.grabpointfromactivelocal" + ), + op_id_global_grab=( + "maplus.grabpointfromactiveglobal" + ), + coord_container=active_item, + coord_attribute="point", + op_id_cursor_send=( + "maplus.sendpointtocursor" + ) ) - component_changers = pt_coord_items.row() - zero_components = component_changers.column(align=True) - zero_components.label("Set Zeroes:") - zero_components.operator( - "maplus.zerootherpointx", - text="X00" - ) - zero_components.operator( - "maplus.zerootherpointy", - text="0Y0" - ) - zero_components.operator( - "maplus.zerootherpointz", - text="00Z" - ) - one_components = component_changers.column(align=True) - one_components.label("Set Ones:") - one_components.operator( - "maplus.oneotherpointx", - text="X11" - ) - one_components.operator( - "maplus.oneotherpointy", - text="1Y1" - ) - one_components.operator( - "maplus.oneotherpointz", - text="11Z" - ) + # component_changers = pt_coord_items.row() + # zero_components = component_changers.column(align=True) + # zero_components.label("Set Zeroes:") + # zero_components.operator( + # "maplus.zerootherpointx", + # text="X00" + # ) + # zero_components.operator( + # "maplus.zerootherpointy", + # text="0Y0" + # ) + # zero_components.operator( + # "maplus.zerootherpointz", + # text="00Z" + # ) + # one_components = component_changers.column(align=True) + # one_components.label("Set Ones:") + # one_components.operator( + # "maplus.oneotherpointx", + # text="X11" + # ) + # one_components.operator( + # "maplus.oneotherpointy", + # text="1Y1" + # ) + # one_components.operator( + # "maplus.oneotherpointz", + # text="11Z" + # ) item_info_col.separator() item_info_col.operator( "maplus.duplicateitembase", @@ -9477,151 +9527,118 @@ def draw(self, context): ) item_info_col.separator() - item_info_col.label("Start:") - ln_start_items = item_info_col.split(percentage=.75) - typein_and_grab_start = ln_start_items.column() - ln_start_uppers = typein_and_grab_start.split(percentage=.33) - ln_start_swap = ln_start_uppers.row(align=True) - ln_start_swap.label("Swap:") - ln_start_swap.operator( - "maplus.swaplinepoints", - text="End" - ) - - ln_start_uppers_rightside = ln_start_uppers.row(align=True) - ln_start_uppers_rightside.alignment = 'RIGHT' - - ln_start_uppers_rightside.label("Send:") - ln_start_uppers_rightside.operator( - "maplus.sendlinestarttocursor", - icon='CURSOR', - text="" - ) - - ln_start_uppers_rightside.label("Grab:") - ln_start_uppers_rightside.operator( - "maplus.grablinestartfromcursor", - icon='CURSOR', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.grablinestartfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_start_uppers_rightside.operator( - "maplus.grablinestartfromactiveglobal", - icon='WORLD', - text="" - ) - typein_and_grab_start.prop( - bpy.types.AnyType(active_item), - 'line_start', - "" + layout_coordvec( + parent_layout=item_info_col, + coordvec_label="Start:", + op_id_cursor_grab=( + "maplus.grablinestartfromcursor" + ), + op_id_avg_grab=( + "maplus.linestartgrabavg" + ), + op_id_local_grab=( + "maplus.grablinestartfromactivelocal" + ), + op_id_global_grab=( + "maplus.grablinestartfromactiveglobal" + ), + coord_container=active_item, + coord_attribute="line_start", + op_id_cursor_send=( + "maplus.sendlinestarttocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.swaplinepoints", + "End" + ) ) item_info_col.separator() - component_changers_start = ln_start_items.row() - zero_components = component_changers_start.column(align=True) - zero_components.label("Set Zeroes:") - zero_components.operator( - "maplus.zerootherlinestartx", - text="X00" - ) - zero_components.operator( - "maplus.zerootherlinestarty", - text="0Y0" - ) - zero_components.operator( - "maplus.zerootherlinestartz", - text="00Z" - ) - one_components = component_changers_start.column(align=True) - one_components.label("Set Ones:") - one_components.operator( - "maplus.oneotherlinestartx", - text="X11" - ) - one_components.operator( - "maplus.oneotherlinestarty", - text="1Y1" - ) - one_components.operator( - "maplus.oneotherlinestartz", - text="11Z" - ) - - item_info_col.label("End:") - ln_end_items = item_info_col.split(percentage=.75) - typein_and_grab_end = ln_end_items.column() - ln_end_uppers = typein_and_grab_end.split(percentage=.33) - ln_end_swap = ln_end_uppers.row(align=True) - ln_end_swap.label("Swap:") - ln_end_swap.operator( - "maplus.swaplinepoints", - text="Start" - ) - - ln_end_uppers_rightside = ln_end_uppers.row(align=True) - ln_end_uppers_rightside.alignment = 'RIGHT' - ln_end_uppers_rightside.label("Send:") - ln_end_uppers_rightside.operator( - "maplus.sendlineendtocursor", - icon='CURSOR', - text="" - ) + # component_changers_start = ln_start_items.row() + # zero_components = component_changers_start.column(align=True) + # zero_components.label("Set Zeroes:") + # zero_components.operator( + # "maplus.zerootherlinestartx", + # text="X00" + # ) + # zero_components.operator( + # "maplus.zerootherlinestarty", + # text="0Y0" + # ) + # zero_components.operator( + # "maplus.zerootherlinestartz", + # text="00Z" + # ) + # one_components = component_changers_start.column(align=True) + # one_components.label("Set Ones:") + # one_components.operator( + # "maplus.oneotherlinestartx", + # text="X11" + # ) + # one_components.operator( + # "maplus.oneotherlinestarty", + # text="1Y1" + # ) + # one_components.operator( + # "maplus.oneotherlinestartz", + # text="11Z" + # ) - ln_end_uppers_rightside.label("Grab:") - ln_end_uppers_rightside.operator( - "maplus.grablineendfromcursor", - icon='CURSOR', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.grablineendfromactivelocal", - icon='VERTEXSEL', - text="" - ) - ln_end_uppers_rightside.operator( - "maplus.grablineendfromactiveglobal", - icon='WORLD', - text="" - ) - typein_and_grab_end.prop( - bpy.types.AnyType(active_item), - 'line_end', - "" + layout_coordvec( + parent_layout=item_info_col, + coordvec_label="End:", + op_id_cursor_grab=( + "maplus.grablineendfromcursor" + ), + op_id_avg_grab=( + "maplus.lineendgrabavg" + ), + op_id_local_grab=( + "maplus.grablineendfromactivelocal" + ), + op_id_global_grab=( + "maplus.grablineendfromactiveglobal" + ), + coord_container=active_item, + coord_attribute="line_end", + op_id_cursor_send=( + "maplus.sendlineendtocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.swaplinepoints", + "Start" + ) ) - component_changers_end = ln_end_items.row() - zero_components = component_changers_end.column(align=True) - zero_components.label("Set Zeroes:") - zero_components.operator( - "maplus.zerootherlineendx", - text="X00" - ) - zero_components.operator( - "maplus.zerootherlineendy", - text="0Y0" - ) - zero_components.operator( - "maplus.zerootherlineendz", - text="00Z" - ) - one_components = component_changers_end.column(align=True) - one_components.label("Set Ones:") - one_components.operator( - "maplus.oneotherlineendx", - text="X11" - ) - one_components.operator( - "maplus.oneotherlineendy", - text="1Y1" - ) - one_components.operator( - "maplus.oneotherlineendz", - text="11Z" - ) + # component_changers_end = ln_end_items.row() + # zero_components = component_changers_end.column(align=True) + # zero_components.label("Set Zeroes:") + # zero_components.operator( + # "maplus.zerootherlineendx", + # text="X00" + # ) + # zero_components.operator( + # "maplus.zerootherlineendy", + # text="0Y0" + # ) + # zero_components.operator( + # "maplus.zerootherlineendz", + # text="00Z" + # ) + # one_components = component_changers_end.column(align=True) + # one_components.label("Set Ones:") + # one_components.operator( + # "maplus.oneotherlineendx", + # text="X11" + # ) + # one_components.operator( + # "maplus.oneotherlineendy", + # text="1Y1" + # ) + # one_components.operator( + # "maplus.oneotherlineendz", + # text="11Z" + # ) item_info_col.separator() item_info_col.operator( "maplus.duplicateitembase", @@ -9643,248 +9660,199 @@ def draw(self, context): ) item_info_col.separator() - item_info_col.label("Pt. A:") - plane_a_items = item_info_col.split(percentage=.75) - typein_and_grab_plna = plane_a_items.column() - plane_a_uppers = typein_and_grab_plna.split(percentage=.33) - - plane_a_swap = plane_a_uppers.row(align=True) - plane_a_swap.label("Swap With:") - plane_a_swap.operator( - "maplus.swapplaneaplaneb", - text="B" - ) - plane_a_swap.operator( - "maplus.swapplaneaplanec", - text="C" - ) - - plane_a_uppers_rightside = plane_a_uppers.row(align=True) - plane_a_uppers_rightside.alignment = 'RIGHT' - plane_a_uppers_rightside.label("Send:") - plane_a_uppers_rightside.operator( - "maplus.sendplaneatocursor", - icon='CURSOR', - text="" - ) - - plane_a_uppers_rightside.label("Grab:") - plane_a_uppers_rightside.operator( - "maplus.grabplaneafromcursor", - icon='CURSOR', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.grabplaneafromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_a_uppers_rightside.operator( - "maplus.grabplaneafromactiveglobal", - icon='WORLD', - text="" - ) - typein_and_grab_plna.prop( - bpy.types.AnyType(active_item), - 'plane_pt_a', - "" + layout_coordvec( + parent_layout=item_info_col, + coordvec_label="Pt. A:", + op_id_cursor_grab=( + "maplus.grabplaneafromcursor" + ), + op_id_avg_grab=( + "maplus.planeagrabavg" + ), + op_id_local_grab=( + "maplus.grabplaneafromactivelocal" + ), + op_id_global_grab=( + "maplus.grabplaneafromactiveglobal" + ), + coord_container=active_item, + coord_attribute="plane_pt_a", + op_id_cursor_send=( + "maplus.sendplaneatocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.swapplaneaplaneb", + "B" + ), + op_id_text_tuple_swap_second=( + "maplus.swapplaneaplanec", + "C" + ) ) item_info_col.separator() - component_changers_plna = plane_a_items.row() - zero_components_plna = component_changers_plna.column( - align=True - ) - zero_components_plna.label("Set Zeroes:") - zero_components_plna.operator( - "maplus.zerootherplanepointax", - text="X00" - ) - zero_components_plna.operator( - "maplus.zerootherplanepointay", - text="0Y0" - ) - zero_components_plna.operator( - "maplus.zerootherplanepointaz", - text="00Z" - ) - one_components_plna = component_changers_plna.column( - align=True - ) - one_components_plna.label("Set Ones:") - one_components_plna.operator( - "maplus.oneotherplanepointax", - text="X11" - ) - one_components_plna.operator( - "maplus.oneotherplanepointay", - text="1Y1" - ) - one_components_plna.operator( - "maplus.oneotherplanepointaz", - text="11Z" - ) - - item_info_col.label("Pt. B (Pivot):") - plane_b_items = item_info_col.split(percentage=.75) - typein_and_grab_plnb = plane_b_items.column() - plane_b_uppers = typein_and_grab_plnb.split(percentage=.33) - plane_b_swap = plane_b_uppers.row(align=True) - plane_b_swap.label("Swap With:") - plane_b_swap.operator( - "maplus.swapplaneaplaneb", - text="A" - ) - plane_b_swap.operator( - "maplus.swapplanebplanec", - text="C" - ) - - plane_b_uppers_rightside = plane_b_uppers.row(align=True) - plane_b_uppers_rightside.alignment = 'RIGHT' - plane_b_uppers_rightside.label("Send:") - plane_b_uppers_rightside.operator( - "maplus.sendplanebtocursor", - icon='CURSOR', - text="" - ) + # component_changers_plna = plane_a_items.row() + # zero_components_plna = component_changers_plna.column( + # align=True + # ) + # zero_components_plna.label("Set Zeroes:") + # zero_components_plna.operator( + # "maplus.zerootherplanepointax", + # text="X00" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointay", + # text="0Y0" + # ) + # zero_components_plna.operator( + # "maplus.zerootherplanepointaz", + # text="00Z" + # ) + # one_components_plna = component_changers_plna.column( + # align=True + # ) + # one_components_plna.label("Set Ones:") + # one_components_plna.operator( + # "maplus.oneotherplanepointax", + # text="X11" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointay", + # text="1Y1" + # ) + # one_components_plna.operator( + # "maplus.oneotherplanepointaz", + # text="11Z" + # ) - plane_b_uppers_rightside.label("Grab:") - plane_b_uppers_rightside.operator( - "maplus.grabplanebfromcursor", - icon='CURSOR', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.grabplanebfromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_b_uppers_rightside.operator( - "maplus.grabplanebfromactiveglobal", - icon='WORLD', - text="" - ) - typein_and_grab_plnb.prop( - bpy.types.AnyType(active_item), - 'plane_pt_b', - "" + layout_coordvec( + parent_layout=item_info_col, + coordvec_label="Pt. B:", + op_id_cursor_grab=( + "maplus.grabplanebfromcursor" + ), + op_id_avg_grab=( + "maplus.planebgrabavg" + ), + op_id_local_grab=( + "maplus.grabplanebfromactivelocal" + ), + op_id_global_grab=( + "maplus.grabplanebfromactiveglobal" + ), + coord_container=active_item, + coord_attribute="plane_pt_b", + op_id_cursor_send=( + "maplus.sendplanebtocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.swapplaneaplaneb", + "A" + ), + op_id_text_tuple_swap_second=( + "maplus.swapplanebplanec", + "C" + ) ) item_info_col.separator() - component_changers_plnb = plane_b_items.row() - zero_components_plnb = component_changers_plnb.column( - align=True - ) - zero_components_plnb.label("Set Zeroes:") - zero_components_plnb.operator( - "maplus.zerootherplanepointbx", - text="X00" - ) - zero_components_plnb.operator( - "maplus.zerootherplanepointby", - text="0Y0" - ) - zero_components_plnb.operator( - "maplus.zerootherplanepointbz", - text="00Z" - ) - one_components_plnb = component_changers_plnb.column( - align=True - ) - one_components_plnb.label("Set Ones:") - one_components_plnb.operator( - "maplus.oneotherplanepointbx", - text="X11" - ) - one_components_plnb.operator( - "maplus.oneotherplanepointby", - text="1Y1" - ) - one_components_plnb.operator( - "maplus.oneotherplanepointbz", - text="11Z" - ) - - item_info_col.label("Pt. C:") - plane_c_items = item_info_col.split(percentage=.75) - typein_and_grab_plnc = plane_c_items.column() - plane_c_uppers = typein_and_grab_plnc.split(percentage=.33) - plane_c_swap = plane_c_uppers.row(align=True) - plane_c_swap.label("Swap With:") - plane_c_swap.operator( - "maplus.swapplaneaplanec", - text="A" - ) - plane_c_swap.operator( - "maplus.swapplanebplanec", - text="B" - ) - - plane_c_uppers_rightside = plane_c_uppers.row(align=True) - plane_c_uppers_rightside.alignment = 'RIGHT' - plane_c_uppers_rightside.label("Send:") - plane_c_uppers_rightside.operator( - "maplus.sendplanectocursor", - icon='CURSOR', - text="" - ) + # component_changers_plnb = plane_b_items.row() + # zero_components_plnb = component_changers_plnb.column( + # align=True + # ) + # zero_components_plnb.label("Set Zeroes:") + # zero_components_plnb.operator( + # "maplus.zerootherplanepointbx", + # text="X00" + # ) + # zero_components_plnb.operator( + # "maplus.zerootherplanepointby", + # text="0Y0" + # ) + # zero_components_plnb.operator( + # "maplus.zerootherplanepointbz", + # text="00Z" + # ) + # one_components_plnb = component_changers_plnb.column( + # align=True + # ) + # one_components_plnb.label("Set Ones:") + # one_components_plnb.operator( + # "maplus.oneotherplanepointbx", + # text="X11" + # ) + # one_components_plnb.operator( + # "maplus.oneotherplanepointby", + # text="1Y1" + # ) + # one_components_plnb.operator( + # "maplus.oneotherplanepointbz", + # text="11Z" + # ) - plane_c_uppers_rightside.label("Grab:") - plane_c_uppers_rightside.operator( - "maplus.grabplanecfromcursor", - icon='CURSOR', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.grabplanecfromactivelocal", - icon='VERTEXSEL', - text="" - ) - plane_c_uppers_rightside.operator( - "maplus.grabplanecfromactiveglobal", - icon='WORLD', - text="" - ) - typein_and_grab_plnc.prop( - bpy.types.AnyType(active_item), - 'plane_pt_c', - "" + layout_coordvec( + parent_layout=item_info_col, + coordvec_label="Pt. C:", + op_id_cursor_grab=( + "maplus.grabplanecfromcursor" + ), + op_id_avg_grab=( + "maplus.planecgrabavg" + ), + op_id_local_grab=( + "maplus.grabplanecfromactivelocal" + ), + op_id_global_grab=( + "maplus.grabplanecfromactiveglobal" + ), + coord_container=active_item, + coord_attribute="plane_pt_c", + op_id_cursor_send=( + "maplus.sendplanectocursor" + ), + op_id_text_tuple_swap_first=( + "maplus.swapplaneaplanec", + "A" + ), + op_id_text_tuple_swap_second=( + "maplus.swapplanebplanec", + "B" + ) ) - component_changers_plnc = plane_c_items.row() - zero_components_plnc = component_changers_plnc.column( - align=True - ) - zero_components_plnc.label("Set Zeroes:") - zero_components_plnc.operator( - "maplus.zerootherplanepointcx", - text="X00" - ) - zero_components_plnc.operator( - "maplus.zerootherplanepointcy", - text="0Y0" - ) - zero_components_plnc.operator( - "maplus.zerootherplanepointcz", - text="00Z" - ) - one_components_plnc = component_changers_plnc.column( - align=True - ) - one_components_plnc.label("Set Ones:") - one_components_plnc.operator( - "maplus.oneotherplanepointcx", - text="X11" - ) - one_components_plnc.operator( - "maplus.oneotherplanepointcy", - text="1Y1" - ) - one_components_plnc.operator( - "maplus.oneotherplanepointcz", - text="11Z" - ) + # component_changers_plnc = plane_c_items.row() + # zero_components_plnc = component_changers_plnc.column( + # align=True + # ) + # zero_components_plnc.label("Set Zeroes:") + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcx", + # text="X00" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcy", + # text="0Y0" + # ) + # zero_components_plnc.operator( + # "maplus.zerootherplanepointcz", + # text="00Z" + # ) + # one_components_plnc = component_changers_plnc.column( + # align=True + # ) + # one_components_plnc.label("Set Ones:") + # one_components_plnc.operator( + # "maplus.oneotherplanepointcx", + # text="X11" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcy", + # text="1Y1" + # ) + # one_components_plnc.operator( + # "maplus.oneotherplanepointcz", + # text="11Z" + # ) item_info_col.separator() item_info_col.operator( "maplus.duplicateitembase", From 4c6ca310ceef9bc4a8b60b62a0d18e9365ec4270 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Sun, 28 May 2017 22:04:36 -0400 Subject: [PATCH 41/56] Added geom copy/paste on adv. tools. --- mesh_mesh_align_plus.py | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 623209d..a2d045e 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -1333,6 +1333,24 @@ def execute(self, context): return {'FINISHED'} +class PasteIntoAdvToolsActive(CopyToOtherBase): + bl_idname = "maplus.pasteintoadvtoolsactive" + bl_label = "Paste into this item" + bl_description = "Pastes from the internal clipboard into this item" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('INTERNALCLIPBOARD', 'ADVTOOLSACTIVE') + + +class CopyFromAdvToolsActive(CopyToOtherBase): + bl_idname = "maplus.copyfromadvtoolsactive" + bl_label = "Copy from this item" + bl_description = "Copies this item into the internal clipboard" + bl_options = {'REGISTER', 'UNDO'} + # A tuple of strings indicating the source and destination + source_dest_pair = ('ADVTOOLSACTIVE', 'INTERNALCLIPBOARD') + + class PasteIntoSlot1(CopyToOtherBase): bl_idname = "maplus.pasteintoslot1" bl_label = "Paste into this item" @@ -9426,6 +9444,18 @@ def draw(self, context): text="Grab All Global" ) item_info_col.separator() + special_grabs = item_info_col.row(align=True) + special_grabs.operator( + "maplus.copyfromadvtoolsactive", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs.operator( + "maplus.pasteintoadvtoolsactive", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) + item_info_col.separator() layout_coordvec( parent_layout=item_info_col, @@ -9526,6 +9556,18 @@ def draw(self, context): text="Grab All Global" ) item_info_col.separator() + special_grabs = item_info_col.row(align=True) + special_grabs.operator( + "maplus.copyfromadvtoolsactive", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs.operator( + "maplus.pasteintoadvtoolsactive", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) + item_info_col.separator() layout_coordvec( parent_layout=item_info_col, @@ -9659,6 +9701,18 @@ def draw(self, context): text="Grab All Global" ) item_info_col.separator() + special_grabs = item_info_col.row(align=True) + special_grabs.operator( + "maplus.copyfromadvtoolsactive", + icon='COPYDOWN', + text="Copy (To Clipboard)" + ) + special_grabs.operator( + "maplus.pasteintoadvtoolsactive", + icon='PASTEDOWN', + text="Paste (From Clipboard)" + ) + item_info_col.separator() layout_coordvec( parent_layout=item_info_col, From 60143142387ea81fe05cae1a8d5b63e5afe54b3e Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Sun, 28 May 2017 22:25:00 -0400 Subject: [PATCH 42/56] Added normal grabbing to adv. tools. --- mesh_mesh_align_plus.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index a2d045e..0f83cca 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -4109,6 +4109,17 @@ class GrabLineCalcResultLoc(GrabFromGeometryBase): quick_op_target = "CALCRESULT" +class GrabNormal(GrabNormalBase): + bl_idname = "maplus.grabnormal" + bl_label = "Grab Normal Coords from Selected Face" + bl_description = ( + "Grabs normal coordinates from selected face in edit mode" + ) + bl_options = {'REGISTER', 'UNDO'} + vert_attribs_to_set = ('line_start', 'line_end') + multiply_by_world_matrix = True + + class Slot1GrabNormal(GrabNormalBase): bl_idname = "maplus.slot1grabnormal" bl_label = "Grab Normal Coords from Selected Face" @@ -9558,11 +9569,18 @@ def draw(self, context): item_info_col.separator() special_grabs = item_info_col.row(align=True) special_grabs.operator( + "maplus.grabnormal", + icon='LAMP_HEMI', + text="Grab Normal" + ) + item_info_col.separator() + special_grabs_extra = item_info_col.row(align=True) + special_grabs_extra.operator( "maplus.copyfromadvtoolsactive", icon='COPYDOWN', text="Copy (To Clipboard)" ) - special_grabs.operator( + special_grabs_extra.operator( "maplus.pasteintoadvtoolsactive", icon='PASTEDOWN', text="Paste (From Clipboard)" From 551f132727fc13eb6c45648c335832837639aa64 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Wed, 21 Jun 2017 19:18:43 -0400 Subject: [PATCH 43/56] Added new label and icon to super special calculation slot set grabs. --- mesh_mesh_align_plus.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 0f83cca..9a95ac2 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -12799,8 +12799,8 @@ def draw(self, context): preserve_button_roundedge = slot1_geom_top.row() preserve_button_roundedge.operator( "maplus.graballslot1", - icon='WORLD', - text="Grab Slot 1" + icon='SOLO_ON', + text="S. Grab Slot 1" ) else: @@ -13300,8 +13300,8 @@ def draw(self, context): preserve_button_roundedge = slot2_geom_top.row() preserve_button_roundedge.operator( "maplus.graballslot2", - icon='WORLD', - text="Grab Slot 2" + icon='SOLO_ON', + text="S. Grab Slot 2" ) else: From 688561f9119b043e227df06c9bde33d33eed9fbe Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Sun, 25 Jun 2017 10:17:53 -0400 Subject: [PATCH 44/56] Updated quick calc clipboard tooltip and result slot label/icon. --- mesh_mesh_align_plus.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 9a95ac2..a64a49b 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -577,7 +577,9 @@ class MAPlusData(bpy.types.PropertyGroup): # Calculation global settings calc_result_to_clipboard = bpy.props.BoolProperty( description=( - "Copy numeric calculations to clipboard" + "Copy calculation results (new reference locations or" + " numeric calculations) to the addon clipboard or the" + " system clipboard, respectively." ), default=True ) @@ -13817,8 +13819,8 @@ def draw(self, context): preserve_button_roundedge = result_geom_top.row() preserve_button_roundedge.operator( "maplus.graballcalcresult", - icon='WORLD', - text="Grab Calc. Result" + icon='SOLO_ON', + text="S. Grab Result" ) else: From 9eedb322c6aada7dc059b20e4293672e8d38829b Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Wed, 28 Jun 2017 20:18:11 -0400 Subject: [PATCH 45/56] Proper error messages for operators when there's no active object. --- mesh_mesh_align_plus.py | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index a64a49b..0093f40 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -6239,6 +6239,12 @@ class ScaleMatchEdgeBase(bpy.types.Operator): target = None def execute(self, context): + if not bpy.context.active_object: + self.report( + {'ERROR'}, + 'Cannot complete: no active object.' + ) + return {'CANCELLED'} addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list previous_mode = bpy.context.active_object.mode @@ -6614,6 +6620,12 @@ class AlignPointsBase(bpy.types.Operator): target = None def execute(self, context): + if not bpy.context.active_object: + self.report( + {'ERROR'}, + 'Cannot complete: no active object.' + ) + return {'CANCELLED'} addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list previous_mode = bpy.context.active_object.mode @@ -6884,6 +6896,12 @@ class DirectionalSlideBase(bpy.types.Operator): bl_options = {'REGISTER', 'UNDO'} def execute(self, context): + if not bpy.context.active_object: + self.report( + {'ERROR'}, + 'Cannot complete: no active object.' + ) + return {'CANCELLED'} addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list previous_mode = bpy.context.active_object.mode @@ -7160,6 +7178,12 @@ class AxisRotateBase(bpy.types.Operator): target = None def execute(self, context): + if not bpy.context.active_object: + self.report( + {'ERROR'}, + 'Cannot complete: no active object.' + ) + return {'CANCELLED'} addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list previous_mode = bpy.context.active_object.mode @@ -7457,6 +7481,12 @@ class AlignLinesBase(bpy.types.Operator): target = None def execute(self, context): + if not bpy.context.active_object: + self.report( + {'ERROR'}, + 'Cannot complete: no active object.' + ) + return {'CANCELLED'} addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list previous_mode = bpy.context.active_object.mode @@ -7772,6 +7802,12 @@ class AlignPlanesBase(bpy.types.Operator): bl_options = {'REGISTER', 'UNDO'} def execute(self, context): + if not bpy.context.active_object: + self.report( + {'ERROR'}, + 'Cannot complete: no active object.' + ) + return {'CANCELLED'} addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list previous_mode = bpy.context.active_object.mode @@ -8164,6 +8200,12 @@ class QuickAlignObjects(bpy.types.Operator): bl_options = {'REGISTER', 'UNDO'} def execute(self, context): + if not bpy.context.active_object: + self.report( + {'ERROR'}, + 'Cannot complete: no active object.' + ) + return {'CANCELLED'} addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list previous_mode = bpy.context.active_object.mode From f727f0b9917fc619080c6b57dd7f1ce26e236018 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Mon, 3 Jul 2017 16:06:48 -0400 Subject: [PATCH 46/56] Update README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 19f37bc..f8eef3d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ # Mesh Align Plus (Blender Addon) -Mesh Align Plus is a precision modeling addon that lets you move mesh parts and objects around, by picking points of interest and using them as targets for alignments, rotations and other types of transformations. +Mesh Align Plus helps you move things around, precisely: arrange objects in your scene, align mesh parts to each other while you're modeling, and create complex custom transformations using measurements from your models. -For example: rest a plane against the tips of three separate pyramid objects...or select an edge and rotate part of your mesh around it (or even take that axis and shift it to a new location, then rotate from there). +In short: you choose from a basic set of operations, pick reference points, and apply custom transformations to a variety of targets. Flexible reference picking and a depth of customization enable sophisticated results. -The complete manual/wiki is here currently (visit for more info, including contact information): https://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Modeling/Mesh_Align_Plus +For example: Grab an edge, then rotate an object around it. Or, stick a flat surface from one object against a flat surface on another object. Measure the rotational difference between two edges, then rotate a mesh piece to match that angle on a completely unrelated object. Align something to an invisible axis, or shift that axis to a new location first and then rotate around it. + +The complete manual/wiki is here currently (visit for more info, including contact information): https://github.com/egtwobits/mesh-align-plus/wiki See the simple demo clips below for a general sense of what the addon can do, or watch the full 30 minute demo video on YouTube (Link). From a3f3ba94392417bc6a4dd46fbf279590452cb254 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Mon, 3 Jul 2017 20:26:28 -0400 Subject: [PATCH 47/56] Update README.md --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f8eef3d..7fdce80 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ # Mesh Align Plus (Blender Addon) Mesh Align Plus helps you move things around, precisely: arrange objects in your scene, align mesh parts to each other while you're modeling, and create complex custom transformations using measurements from your models. -In short: you choose from a basic set of operations, pick reference points, and apply custom transformations to a variety of targets. Flexible reference picking and a depth of customization enable sophisticated results. +In short: You choose from a basic set of operations, pick reference points, and apply custom transformations to a variety of targets. Flexible reference picking and a depth of customization enable sophisticated results. -For example: Grab an edge, then rotate an object around it. Or, stick a flat surface from one object against a flat surface on another object. Measure the rotational difference between two edges, then rotate a mesh piece to match that angle on a completely unrelated object. Align something to an invisible axis, or shift that axis to a new location first and then rotate around it. - -The complete manual/wiki is here currently (visit for more info, including contact information): https://github.com/egtwobits/mesh-align-plus/wiki +Some concrete examples of things you can do with the addon: +* Grab an edge, then rotate an object around it +* Stick a flat surface from one object against a flat surface on another object +* Align something to an invisible axis, or shift that axis to a new location first and then rotate around it. See the simple demo clips below for a general sense of what the addon can do, or watch the full 30 minute demo video on YouTube (Link). From 0a51a6e230b46f3bdbaae74f228dc7f1bb4940b3 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Tue, 4 Jul 2017 19:31:29 -0400 Subject: [PATCH 48/56] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7fdce80..1413781 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Some concrete examples of things you can do with the addon: * Stick a flat surface from one object against a flat surface on another object * Align something to an invisible axis, or shift that axis to a new location first and then rotate around it. -See the simple demo clips below for a general sense of what the addon can do, or watch the full 30 minute demo video on YouTube (Link). +See the simple demo clips below for a general sense of what the addon can do, read the Wiki above, or watch the full 30 minute demo video on YouTube (Link).
From d74b7bdfa7038ba3ee5ae3b92cc9d57d7e0a3ead Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Sat, 8 Jul 2017 09:22:34 -0400 Subject: [PATCH 49/56] Update README.md --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1413781..c337799 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,7 @@ Some concrete examples of things you can do with the addon: See the simple demo clips below for a general sense of what the addon can do, read the Wiki above, or watch the full 30 minute demo video on YouTube (Link). -
-
-
-
-
-
+![alt](http://i.imgur.com/hro9YEB.gif) +![alt](http://i.imgur.com/VSkjGdN.gif) +![alt](http://i.imgur.com/qlUZwPC.gif) +![alt](http://i.imgur.com/JOa7Fcd.gif) From 6f89b1cd0fa877740515f25ba74f6b1051c55456 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Sat, 8 Jul 2017 09:34:01 -0400 Subject: [PATCH 50/56] Added missing pivot label to apl src and calc result pt b. --- mesh_mesh_align_plus.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 0093f40..a516b4f 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -11385,7 +11385,7 @@ def draw(self, context): layout_coordvec( parent_layout=apl_src_geom_editor, - coordvec_label="Pt. B:", + coordvec_label="Pt. B (Pivot):", op_id_cursor_grab=( "maplus.quickaplsrcgrabplanebfromcursor" ), @@ -14222,7 +14222,7 @@ def draw(self, context): layout_coordvec( parent_layout=calcresult_geom_editor, - coordvec_label="Pt. B:", + coordvec_label="Pt. B (Pivot):", op_id_cursor_grab=( "maplus.calcresultgrabplanebfromcursor" ), From 83677dfd36586afd0679ed937a80964e4a9a047d Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Tue, 11 Jul 2017 20:29:33 -0400 Subject: [PATCH 51/56] Added an error/proper reporting when no active + selected object is present. --- mesh_mesh_align_plus.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index a516b4f..4f7d3c4 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -6239,10 +6239,10 @@ class ScaleMatchEdgeBase(bpy.types.Operator): target = None def execute(self, context): - if not bpy.context.active_object: + if not (bpy.context.active_object and bpy.context.active_object.select): self.report( {'ERROR'}, - 'Cannot complete: no active object.' + 'Cannot complete: need at least one active (and selected) object.' ) return {'CANCELLED'} addon_data = bpy.context.scene.maplus_data @@ -6620,10 +6620,10 @@ class AlignPointsBase(bpy.types.Operator): target = None def execute(self, context): - if not bpy.context.active_object: + if not (bpy.context.active_object and bpy.context.active_object.select): self.report( {'ERROR'}, - 'Cannot complete: no active object.' + 'Cannot complete: need at least one active (and selected) object.' ) return {'CANCELLED'} addon_data = bpy.context.scene.maplus_data @@ -6896,10 +6896,10 @@ class DirectionalSlideBase(bpy.types.Operator): bl_options = {'REGISTER', 'UNDO'} def execute(self, context): - if not bpy.context.active_object: + if not (bpy.context.active_object and bpy.context.active_object.select): self.report( {'ERROR'}, - 'Cannot complete: no active object.' + 'Cannot complete: need at least one active (and selected) object.' ) return {'CANCELLED'} addon_data = bpy.context.scene.maplus_data @@ -7178,10 +7178,10 @@ class AxisRotateBase(bpy.types.Operator): target = None def execute(self, context): - if not bpy.context.active_object: + if not (bpy.context.active_object and bpy.context.active_object.select): self.report( {'ERROR'}, - 'Cannot complete: no active object.' + 'Cannot complete: need at least one active (and selected) object.' ) return {'CANCELLED'} addon_data = bpy.context.scene.maplus_data @@ -7481,10 +7481,10 @@ class AlignLinesBase(bpy.types.Operator): target = None def execute(self, context): - if not bpy.context.active_object: + if not (bpy.context.active_object and bpy.context.active_object.select): self.report( {'ERROR'}, - 'Cannot complete: no active object.' + 'Cannot complete: need at least one active (and selected) object.' ) return {'CANCELLED'} addon_data = bpy.context.scene.maplus_data @@ -7802,10 +7802,10 @@ class AlignPlanesBase(bpy.types.Operator): bl_options = {'REGISTER', 'UNDO'} def execute(self, context): - if not bpy.context.active_object: + if not (bpy.context.active_object and bpy.context.active_object.select): self.report( {'ERROR'}, - 'Cannot complete: no active object.' + 'Cannot complete: need at least one active (and selected) object.' ) return {'CANCELLED'} addon_data = bpy.context.scene.maplus_data From 46eeb60a59930d596a8467257b1f136acf939463 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Tue, 11 Jul 2017 21:26:31 -0400 Subject: [PATCH 52/56] Updated bl_info metadata (version number, wiki link etc). --- mesh_mesh_align_plus.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index 4f7d3c4..b0b7abc 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -18,7 +18,7 @@ # # ##### END GPL LICENSE BLOCK ##### # -# +# # Blender requires addons to provide this information. @@ -29,7 +29,7 @@ "based on geometry and measurements from your scene." ), "author": "Eric Gentry", - "version": (0, 3, 0), + "version": (0, 4, 0), "blender": (2, 69, 0), "location": ( "3D View > Tools, and Properties -> Scene -> Mesh Align Plus" @@ -39,8 +39,7 @@ "not currently supported." ), "wiki_url": ( - "https://wiki.blender.org/index.php/Extensions:2.6/Py/" - "Scripts/Modeling/Mesh_Align_Plus" + "https://github.com/egtwobits/mesh-align-plus/wiki" ), "support": "COMMUNITY", "category": "Mesh" From fed51dd415d25d53fad0eea49f14b00956b12c83 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Tue, 11 Jul 2017 21:35:34 -0400 Subject: [PATCH 53/56] Code cleanup, removed old/unneeded code leftover from advanced tools. --- mesh_mesh_align_plus.py | 1176 +-------------------------------------- 1 file changed, 10 insertions(+), 1166 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index b0b7abc..d71caba 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -10565,10 +10565,7 @@ def draw(self, context): modifier_header.label("Point Modifiers:") apply_mods = modifier_header.row() apply_mods.alignment = 'RIGHT' - # apply_mods.operator( - # "maplus.applygeommodifiers", - # text="Apply ModifiersXXXXX" - # ) + item_mods_box = apt_src_geom_editor.box() mods_row_1 = item_mods_box.row() mods_row_1.prop( @@ -10610,39 +10607,6 @@ def draw(self, context): ) ) - # component_changers_plna = plane_a_items.row() - # zero_components_plna = component_changers_plna.column( - # align=True - # ) - # zero_components_plna.label("Set Zeroes:") - # zero_components_plna.operator( - # "maplus.zerootherplanepointax", - # text="X00" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointay", - # text="0Y0" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointaz", - # text="00Z" - # ) - # one_components_plna = component_changers_plna.column( - # align=True - # ) - # one_components_plna.label("Set Ones:") - # one_components_plna.operator( - # "maplus.oneotherplanepointax", - # text="X11" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointay", - # text="1Y1" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointaz", - # text="11Z" - # ) if addon_data.quick_apt_show_src_geom: apt_grab_col.separator() @@ -10703,10 +10667,7 @@ def draw(self, context): modifier_header.label("Point Modifiers:") apply_mods = modifier_header.row() apply_mods.alignment = 'RIGHT' - # apply_mods.operator( - # "maplus.applygeommodifiers", - # text="Apply ModifiersXXXXX" - # ) + item_mods_box = apt_dest_geom_editor.box() mods_row_1 = item_mods_box.row() mods_row_1.prop( @@ -10748,8 +10709,6 @@ def draw(self, context): ) ) - ######################## - align_pts_gui.label("Operator settings:", icon="SCRIPTWIN") apt_mods = align_pts_gui.box() apt_box_row1 = apt_mods.row() @@ -10882,10 +10841,7 @@ def draw(self, context): modifier_header.label("Line Modifiers:") apply_mods = modifier_header.row() apply_mods.alignment = 'RIGHT' - # apply_mods.operator( - # "maplus.applygeommodifiers", - # text="Apply ModifiersXXXXX" - # ) + item_mods_box = aln_src_geom_editor.box() mods_row_1 = item_mods_box.row() mods_row_1.prop( @@ -10931,40 +10887,6 @@ def draw(self, context): ) ) - # component_changers_plna = plane_a_items.row() - # zero_components_plna = component_changers_plna.column( - # align=True - # ) - # zero_components_plna.label("Set Zeroes:") - # zero_components_plna.operator( - # "maplus.zerootherplanepointax", - # text="X00" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointay", - # text="0Y0" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointaz", - # text="00Z" - # ) - # one_components_plna = component_changers_plna.column( - # align=True - # ) - # one_components_plna.label("Set Ones:") - # one_components_plna.operator( - # "maplus.oneotherplanepointax", - # text="X11" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointay", - # text="1Y1" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointaz", - # text="11Z" - # ) - layout_coordvec( parent_layout=aln_src_geom_editor, coordvec_label="End:", @@ -10991,49 +10913,9 @@ def draw(self, context): ) ) - # component_changers_plnc = plane_c_items.row() - # zero_components_plnc = component_changers_plnc.column( - # align=True - # ) - # zero_components_plnc.label("Set Zeroes:") - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcx", - # text="X00" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcy", - # text="0Y0" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcz", - # text="00Z" - # ) - # one_components_plnc = component_changers_plnc.column( - # align=True - # ) - # one_components_plnc.label("Set Ones:") - # one_components_plnc.operator( - # "maplus.oneotherplanepointcx", - # text="X11" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcy", - # text="1Y1" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcz", - # text="11Z" - # ) if addon_data.quick_aln_show_src_geom: aln_grab_col.separator() - # apl_dest_geom = apl_grab_col.row() - # apl_grab_col.operator( - # "maplus.quickalignplanesgrabdest", - # icon='WORLD', - # text="Grab Destination" - # ) - aln_dest_geom_top = aln_grab_col.row(align=True) if not addon_data.quick_aln_show_dest_geom: aln_dest_geom_top.operator( @@ -11096,10 +10978,7 @@ def draw(self, context): modifier_header.label("Line Modifiers:") apply_mods = modifier_header.row() apply_mods.alignment = 'RIGHT' - # apply_mods.operator( - # "maplus.applygeommodifiers", - # text="Apply ModifiersXXXXX" - # ) + item_mods_box = aln_dest_geom_editor.box() mods_row_1 = item_mods_box.row() mods_row_1.prop( @@ -11145,40 +11024,6 @@ def draw(self, context): ) ) - # component_changers_plna = plane_a_items.row() - # zero_components_plna = component_changers_plna.column( - # align=True - # ) - # zero_components_plna.label("Set Zeroes:") - # zero_components_plna.operator( - # "maplus.zerootherplanepointax", - # text="X00" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointay", - # text="0Y0" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointaz", - # text="00Z" - # ) - # one_components_plna = component_changers_plna.column( - # align=True - # ) - # one_components_plna.label("Set Ones:") - # one_components_plna.operator( - # "maplus.oneotherplanepointax", - # text="X11" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointay", - # text="1Y1" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointaz", - # text="11Z" - # ) - layout_coordvec( parent_layout=aln_dest_geom_editor, coordvec_label="End:", @@ -11205,13 +11050,6 @@ def draw(self, context): ) ) - ################################### - ################################### - - - ################################### - ################################### - aln_gui.label("Operator settings:", icon="SCRIPTWIN") aln_mods = aln_gui.box() aln_mods_row1 = aln_mods.row() @@ -11348,40 +11186,6 @@ def draw(self, context): ) ) - # component_changers_plna = plane_a_items.row() - # zero_components_plna = component_changers_plna.column( - # align=True - # ) - # zero_components_plna.label("Set Zeroes:") - # zero_components_plna.operator( - # "maplus.zerootherplanepointax", - # text="X00" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointay", - # text="0Y0" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointaz", - # text="00Z" - # ) - # one_components_plna = component_changers_plna.column( - # align=True - # ) - # one_components_plna.label("Set Ones:") - # one_components_plna.operator( - # "maplus.oneotherplanepointax", - # text="X11" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointay", - # text="1Y1" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointaz", - # text="11Z" - # ) - layout_coordvec( parent_layout=apl_src_geom_editor, coordvec_label="Pt. B (Pivot):", @@ -11412,40 +11216,6 @@ def draw(self, context): ) ) - # component_changers_plnb = plane_b_items.row() - # zero_components_plnb = component_changers_plnb.column( - # align=True - # ) - # zero_components_plnb.label("Set Zeroes:") - # zero_components_plnb.operator( - # "maplus.zerootherplanepointbx", - # text="X00" - # ) - # zero_components_plnb.operator( - # "maplus.zerootherplanepointby", - # text="0Y0" - # ) - # zero_components_plnb.operator( - # "maplus.zerootherplanepointbz", - # text="00Z" - # ) - # one_components_plnb = component_changers_plnb.column( - # align=True - # ) - # one_components_plnb.label("Set Ones:") - # one_components_plnb.operator( - # "maplus.oneotherplanepointbx", - # text="X11" - # ) - # one_components_plnb.operator( - # "maplus.oneotherplanepointby", - # text="1Y1" - # ) - # one_components_plnb.operator( - # "maplus.oneotherplanepointbz", - # text="11Z" - # ) - layout_coordvec( parent_layout=apl_src_geom_editor, coordvec_label="Pt. C:", @@ -11476,49 +11246,9 @@ def draw(self, context): ) ) - # component_changers_plnc = plane_c_items.row() - # zero_components_plnc = component_changers_plnc.column( - # align=True - # ) - # zero_components_plnc.label("Set Zeroes:") - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcx", - # text="X00" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcy", - # text="0Y0" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcz", - # text="00Z" - # ) - # one_components_plnc = component_changers_plnc.column( - # align=True - # ) - # one_components_plnc.label("Set Ones:") - # one_components_plnc.operator( - # "maplus.oneotherplanepointcx", - # text="X11" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcy", - # text="1Y1" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcz", - # text="11Z" - # ) if addon_data.quick_apl_show_src_geom: apl_grab_col.separator() - # apl_dest_geom = apl_grab_col.row() - # apl_grab_col.operator( - # "maplus.quickalignplanesgrabdest", - # icon='WORLD', - # text="Grab Destination" - # ) - apl_dest_geom_top = apl_grab_col.row(align=True) if not addon_data.quick_apl_show_dest_geom: apl_dest_geom_top.operator( @@ -11596,40 +11326,6 @@ def draw(self, context): ) ) - # component_changers_plna = plane_a_items.row() - # zero_components_plna = component_changers_plna.column( - # align=True - # ) - # zero_components_plna.label("Set Zeroes:") - # zero_components_plna.operator( - # "maplus.zerootherplanepointax", - # text="X00" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointay", - # text="0Y0" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointaz", - # text="00Z" - # ) - # one_components_plna = component_changers_plna.column( - # align=True - # ) - # one_components_plna.label("Set Ones:") - # one_components_plna.operator( - # "maplus.oneotherplanepointax", - # text="X11" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointay", - # text="1Y1" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointaz", - # text="11Z" - # ) - layout_coordvec( parent_layout=apl_dest_geom_editor, coordvec_label="Pt. B (Pivot):", @@ -11660,40 +11356,6 @@ def draw(self, context): ) ) - # component_changers_plnb = plane_b_items.row() - # zero_components_plnb = component_changers_plnb.column( - # align=True - # ) - # zero_components_plnb.label("Set Zeroes:") - # zero_components_plnb.operator( - # "maplus.zerootherplanepointbx", - # text="X00" - # ) - # zero_components_plnb.operator( - # "maplus.zerootherplanepointby", - # text="0Y0" - # ) - # zero_components_plnb.operator( - # "maplus.zerootherplanepointbz", - # text="00Z" - # ) - # one_components_plnb = component_changers_plnb.column( - # align=True - # ) - # one_components_plnb.label("Set Ones:") - # one_components_plnb.operator( - # "maplus.oneotherplanepointbx", - # text="X11" - # ) - # one_components_plnb.operator( - # "maplus.oneotherplanepointby", - # text="1Y1" - # ) - # one_components_plnb.operator( - # "maplus.oneotherplanepointbz", - # text="11Z" - # ) - layout_coordvec( parent_layout=apl_dest_geom_editor, coordvec_label="Pt. C:", @@ -11724,47 +11386,6 @@ def draw(self, context): ) ) - # component_changers_plnc = plane_c_items.row() - # zero_components_plnc = component_changers_plnc.column( - # align=True - # ) - # zero_components_plnc.label("Set Zeroes:") - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcx", - # text="X00" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcy", - # text="0Y0" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcz", - # text="00Z" - # ) - # one_components_plnc = component_changers_plnc.column( - # align=True - # ) - # one_components_plnc.label("Set Ones:") - # one_components_plnc.operator( - # "maplus.oneotherplanepointcx", - # text="X11" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcy", - # text="1Y1" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcz", - # text="11Z" - # ) - - ################################### - ################################### - - - ################################### - ################################### - apl_gui.label("Operator settings:", icon="SCRIPTWIN") apl_mods = apl_gui.box() apl_mods_row1 = apl_mods.row() @@ -11892,10 +11513,7 @@ def draw(self, context): modifier_header.label("Line Modifiers:") apply_mods = modifier_header.row() apply_mods.alignment = 'RIGHT' - # apply_mods.operator( - # "maplus.applygeommodifiers", - # text="Apply ModifiersXXXXX" - # ) + item_mods_box = axr_src_geom_editor.box() mods_row_1 = item_mods_box.row() mods_row_1.prop( @@ -11941,40 +11559,6 @@ def draw(self, context): ) ) - # component_changers_plna = plane_a_items.row() - # zero_components_plna = component_changers_plna.column( - # align=True - # ) - # zero_components_plna.label("Set Zeroes:") - # zero_components_plna.operator( - # "maplus.zerootherplanepointax", - # text="X00" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointay", - # text="0Y0" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointaz", - # text="00Z" - # ) - # one_components_plna = component_changers_plna.column( - # align=True - # ) - # one_components_plna.label("Set Ones:") - # one_components_plna.operator( - # "maplus.oneotherplanepointax", - # text="X11" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointay", - # text="1Y1" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointaz", - # text="11Z" - # ) - layout_coordvec( parent_layout=axr_src_geom_editor, coordvec_label="End:", @@ -12001,39 +11585,6 @@ def draw(self, context): ) ) - # component_changers_plnc = plane_c_items.row() - # zero_components_plnc = component_changers_plnc.column( - # align=True - # ) - # zero_components_plnc.label("Set Zeroes:") - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcx", - # text="X00" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcy", - # text="0Y0" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcz", - # text="00Z" - # ) - # one_components_plnc = component_changers_plnc.column( - # align=True - # ) - # one_components_plnc.label("Set Ones:") - # one_components_plnc.operator( - # "maplus.oneotherplanepointcx", - # text="X11" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcy", - # text="1Y1" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcz", - # text="11Z" - # ) if addon_data.quick_axr_show_src_geom: axr_grab_col.separator() @@ -12159,10 +11710,7 @@ def draw(self, context): modifier_header.label("Line Modifiers:") apply_mods = modifier_header.row() apply_mods.alignment = 'RIGHT' - # apply_mods.operator( - # "maplus.applygeommodifiers", - # text="Apply ModifiersXXXXX" - # ) + item_mods_box = ds_src_geom_editor.box() mods_row_1 = item_mods_box.row() mods_row_1.prop( @@ -12208,40 +11756,6 @@ def draw(self, context): ) ) - # component_changers_plna = plane_a_items.row() - # zero_components_plna = component_changers_plna.column( - # align=True - # ) - # zero_components_plna.label("Set Zeroes:") - # zero_components_plna.operator( - # "maplus.zerootherplanepointax", - # text="X00" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointay", - # text="0Y0" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointaz", - # text="00Z" - # ) - # one_components_plna = component_changers_plna.column( - # align=True - # ) - # one_components_plna.label("Set Ones:") - # one_components_plna.operator( - # "maplus.oneotherplanepointax", - # text="X11" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointay", - # text="1Y1" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointaz", - # text="11Z" - # ) - layout_coordvec( parent_layout=ds_src_geom_editor, coordvec_label="End:", @@ -12268,39 +11782,6 @@ def draw(self, context): ) ) - # component_changers_plnc = plane_c_items.row() - # zero_components_plnc = component_changers_plnc.column( - # align=True - # ) - # zero_components_plnc.label("Set Zeroes:") - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcx", - # text="X00" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcy", - # text="0Y0" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcz", - # text="00Z" - # ) - # one_components_plnc = component_changers_plnc.column( - # align=True - # ) - # one_components_plnc.label("Set Ones:") - # one_components_plnc.operator( - # "maplus.oneotherplanepointcx", - # text="X11" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcy", - # text="1Y1" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcz", - # text="11Z" - # ) if addon_data.quick_ds_show_src_geom: ds_grab_col.separator() @@ -12432,10 +11913,7 @@ def draw(self, context): modifier_header.label("Line Modifiers:") apply_mods = modifier_header.row() apply_mods.alignment = 'RIGHT' - # apply_mods.operator( - # "maplus.applygeommodifiers", - # text="Apply ModifiersXXXXX" - # ) + item_mods_box = sme_src_geom_editor.box() mods_row_1 = item_mods_box.row() mods_row_1.prop( @@ -12481,40 +11959,6 @@ def draw(self, context): ) ) - # component_changers_plna = plane_a_items.row() - # zero_components_plna = component_changers_plna.column( - # align=True - # ) - # zero_components_plna.label("Set Zeroes:") - # zero_components_plna.operator( - # "maplus.zerootherplanepointax", - # text="X00" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointay", - # text="0Y0" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointaz", - # text="00Z" - # ) - # one_components_plna = component_changers_plna.column( - # align=True - # ) - # one_components_plna.label("Set Ones:") - # one_components_plna.operator( - # "maplus.oneotherplanepointax", - # text="X11" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointay", - # text="1Y1" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointaz", - # text="11Z" - # ) - layout_coordvec( parent_layout=sme_src_geom_editor, coordvec_label="End:", @@ -12541,39 +11985,6 @@ def draw(self, context): ) ) - # component_changers_plnc = plane_c_items.row() - # zero_components_plnc = component_changers_plnc.column( - # align=True - # ) - # zero_components_plnc.label("Set Zeroes:") - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcx", - # text="X00" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcy", - # text="0Y0" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcz", - # text="00Z" - # ) - # one_components_plnc = component_changers_plnc.column( - # align=True - # ) - # one_components_plnc.label("Set Ones:") - # one_components_plnc.operator( - # "maplus.oneotherplanepointcx", - # text="X11" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcy", - # text="1Y1" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcz", - # text="11Z" - # ) if addon_data.quick_sme_show_src_geom: sme_grab_col.separator() @@ -12634,10 +12045,7 @@ def draw(self, context): modifier_header.label("Line Modifiers:") apply_mods = modifier_header.row() apply_mods.alignment = 'RIGHT' - # apply_mods.operator( - # "maplus.applygeommodifiers", - # text="Apply ModifiersXXXXX" - # ) + item_mods_box = sme_dest_geom_editor.box() mods_row_1 = item_mods_box.row() mods_row_1.prop( @@ -12683,40 +12091,6 @@ def draw(self, context): ) ) - # component_changers_plna = plane_a_items.row() - # zero_components_plna = component_changers_plna.column( - # align=True - # ) - # zero_components_plna.label("Set Zeroes:") - # zero_components_plna.operator( - # "maplus.zerootherplanepointax", - # text="X00" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointay", - # text="0Y0" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointaz", - # text="00Z" - # ) - # one_components_plna = component_changers_plna.column( - # align=True - # ) - # one_components_plna.label("Set Ones:") - # one_components_plna.operator( - # "maplus.oneotherplanepointax", - # text="X11" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointay", - # text="1Y1" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointaz", - # text="11Z" - # ) - layout_coordvec( parent_layout=sme_dest_geom_editor, coordvec_label="End:", @@ -12891,10 +12265,7 @@ def draw(self, context): modifier_header.label("Point Modifiers:") apply_mods = modifier_header.row() apply_mods.alignment = 'RIGHT' - # apply_mods.operator( - # "maplus.applygeommodifiers", - # text="Apply ModifiersXXXXX" - # ) + item_mods_box = slot1_geom_editor.box() mods_row_1 = item_mods_box.row() mods_row_1.prop( @@ -12971,10 +12342,7 @@ def draw(self, context): modifier_header.label("Line Modifiers:") apply_mods = modifier_header.row() apply_mods.alignment = 'RIGHT' - # apply_mods.operator( - # "maplus.applygeommodifiers", - # text="Apply ModifiersXXXXX" - # ) + item_mods_box = slot1_geom_editor.box() mods_row_1 = item_mods_box.row() mods_row_1.prop( @@ -13020,40 +12388,6 @@ def draw(self, context): ) ) - # component_changers_plna = plane_a_items.row() - # zero_components_plna = component_changers_plna.column( - # align=True - # ) - # zero_components_plna.label("Set Zeroes:") - # zero_components_plna.operator( - # "maplus.zerootherplanepointax", - # text="X00" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointay", - # text="0Y0" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointaz", - # text="00Z" - # ) - # one_components_plna = component_changers_plna.column( - # align=True - # ) - # one_components_plna.label("Set Ones:") - # one_components_plna.operator( - # "maplus.oneotherplanepointax", - # text="X11" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointay", - # text="1Y1" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointaz", - # text="11Z" - # ) - layout_coordvec( parent_layout=slot1_geom_editor, coordvec_label="End:", @@ -13080,39 +12414,6 @@ def draw(self, context): ) ) - # component_changers_plnc = plane_c_items.row() - # zero_components_plnc = component_changers_plnc.column( - # align=True - # ) - # zero_components_plnc.label("Set Zeroes:") - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcx", - # text="X00" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcy", - # text="0Y0" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcz", - # text="00Z" - # ) - # one_components_plnc = component_changers_plnc.column( - # align=True - # ) - # one_components_plnc.label("Set Ones:") - # one_components_plnc.operator( - # "maplus.oneotherplanepointcx", - # text="X11" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcy", - # text="1Y1" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcz", - # text="11Z" - # ) elif addon_data.internal_storage_slot_1.kind == 'PLANE': plane_grab_all = slot1_geom_editor.row(align=True) plane_grab_all.operator( @@ -13167,40 +12468,6 @@ def draw(self, context): ) ) - # component_changers_plna = plane_a_items.row() - # zero_components_plna = component_changers_plna.column( - # align=True - # ) - # zero_components_plna.label("Set Zeroes:") - # zero_components_plna.operator( - # "maplus.zerootherplanepointax", - # text="X00" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointay", - # text="0Y0" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointaz", - # text="00Z" - # ) - # one_components_plna = component_changers_plna.column( - # align=True - # ) - # one_components_plna.label("Set Ones:") - # one_components_plna.operator( - # "maplus.oneotherplanepointax", - # text="X11" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointay", - # text="1Y1" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointaz", - # text="11Z" - # ) - layout_coordvec( parent_layout=slot1_geom_editor, coordvec_label="Pt. B (Pivot):", @@ -13231,40 +12498,6 @@ def draw(self, context): ) ) - # component_changers_plnb = plane_b_items.row() - # zero_components_plnb = component_changers_plnb.column( - # align=True - # ) - # zero_components_plnb.label("Set Zeroes:") - # zero_components_plnb.operator( - # "maplus.zerootherplanepointbx", - # text="X00" - # ) - # zero_components_plnb.operator( - # "maplus.zerootherplanepointby", - # text="0Y0" - # ) - # zero_components_plnb.operator( - # "maplus.zerootherplanepointbz", - # text="00Z" - # ) - # one_components_plnb = component_changers_plnb.column( - # align=True - # ) - # one_components_plnb.label("Set Ones:") - # one_components_plnb.operator( - # "maplus.oneotherplanepointbx", - # text="X11" - # ) - # one_components_plnb.operator( - # "maplus.oneotherplanepointby", - # text="1Y1" - # ) - # one_components_plnb.operator( - # "maplus.oneotherplanepointbz", - # text="11Z" - # ) - layout_coordvec( parent_layout=slot1_geom_editor, coordvec_label="Pt. C:", @@ -13295,40 +12528,6 @@ def draw(self, context): ) ) - # component_changers_plnc = plane_c_items.row() - # zero_components_plnc = component_changers_plnc.column( - # align=True - # ) - # zero_components_plnc.label("Set Zeroes:") - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcx", - # text="X00" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcy", - # text="0Y0" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcz", - # text="00Z" - # ) - # one_components_plnc = component_changers_plnc.column( - # align=True - # ) - # one_components_plnc.label("Set Ones:") - # one_components_plnc.operator( - # "maplus.oneotherplanepointcx", - # text="X11" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcy", - # text="1Y1" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcz", - # text="11Z" - # ) - if addon_data.quick_calc_show_slot1_geom: calc_gui.separator() @@ -13392,10 +12591,6 @@ def draw(self, context): modifier_header.label("Point Modifiers:") apply_mods = modifier_header.row() apply_mods.alignment = 'RIGHT' - # apply_mods.operator( - # "maplus.applygeommodifiers", - # text="Apply ModifiersXXXXX" - # ) item_mods_box = slot2_geom_editor.box() mods_row_1 = item_mods_box.row() mods_row_1.prop( @@ -13472,10 +12667,6 @@ def draw(self, context): modifier_header.label("Line Modifiers:") apply_mods = modifier_header.row() apply_mods.alignment = 'RIGHT' - # apply_mods.operator( - # "maplus.applygeommodifiers", - # text="Apply ModifiersXXXXX" - # ) item_mods_box = slot2_geom_editor.box() mods_row_1 = item_mods_box.row() mods_row_1.prop( @@ -13521,40 +12712,6 @@ def draw(self, context): ) ) - # component_changers_plna = plane_a_items.row() - # zero_components_plna = component_changers_plna.column( - # align=True - # ) - # zero_components_plna.label("Set Zeroes:") - # zero_components_plna.operator( - # "maplus.zerootherplanepointax", - # text="X00" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointay", - # text="0Y0" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointaz", - # text="00Z" - # ) - # one_components_plna = component_changers_plna.column( - # align=True - # ) - # one_components_plna.label("Set Ones:") - # one_components_plna.operator( - # "maplus.oneotherplanepointax", - # text="X11" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointay", - # text="1Y1" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointaz", - # text="11Z" - # ) - layout_coordvec( parent_layout=slot2_geom_editor, coordvec_label="End:", @@ -13581,39 +12738,6 @@ def draw(self, context): ) ) - # component_changers_plnc = plane_c_items.row() - # zero_components_plnc = component_changers_plnc.column( - # align=True - # ) - # zero_components_plnc.label("Set Zeroes:") - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcx", - # text="X00" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcy", - # text="0Y0" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcz", - # text="00Z" - # ) - # one_components_plnc = component_changers_plnc.column( - # align=True - # ) - # one_components_plnc.label("Set Ones:") - # one_components_plnc.operator( - # "maplus.oneotherplanepointcx", - # text="X11" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcy", - # text="1Y1" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcz", - # text="11Z" - # ) elif addon_data.internal_storage_slot_2.kind == 'PLANE': plane_grab_all = slot2_geom_editor.row(align=True) plane_grab_all.operator( @@ -13668,40 +12792,6 @@ def draw(self, context): ) ) - # component_changers_plna = plane_a_items.row() - # zero_components_plna = component_changers_plna.column( - # align=True - # ) - # zero_components_plna.label("Set Zeroes:") - # zero_components_plna.operator( - # "maplus.zerootherplanepointax", - # text="X00" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointay", - # text="0Y0" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointaz", - # text="00Z" - # ) - # one_components_plna = component_changers_plna.column( - # align=True - # ) - # one_components_plna.label("Set Ones:") - # one_components_plna.operator( - # "maplus.oneotherplanepointax", - # text="X11" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointay", - # text="1Y1" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointaz", - # text="11Z" - # ) - layout_coordvec( parent_layout=slot2_geom_editor, coordvec_label="Pt. B (Pivot):", @@ -13732,40 +12822,6 @@ def draw(self, context): ) ) - # component_changers_plnb = plane_b_items.row() - # zero_components_plnb = component_changers_plnb.column( - # align=True - # ) - # zero_components_plnb.label("Set Zeroes:") - # zero_components_plnb.operator( - # "maplus.zerootherplanepointbx", - # text="X00" - # ) - # zero_components_plnb.operator( - # "maplus.zerootherplanepointby", - # text="0Y0" - # ) - # zero_components_plnb.operator( - # "maplus.zerootherplanepointbz", - # text="00Z" - # ) - # one_components_plnb = component_changers_plnb.column( - # align=True - # ) - # one_components_plnb.label("Set Ones:") - # one_components_plnb.operator( - # "maplus.oneotherplanepointbx", - # text="X11" - # ) - # one_components_plnb.operator( - # "maplus.oneotherplanepointby", - # text="1Y1" - # ) - # one_components_plnb.operator( - # "maplus.oneotherplanepointbz", - # text="11Z" - # ) - layout_coordvec( parent_layout=slot2_geom_editor, coordvec_label="Pt. C:", @@ -13796,39 +12852,6 @@ def draw(self, context): ) ) - # component_changers_plnc = plane_c_items.row() - # zero_components_plnc = component_changers_plnc.column( - # align=True - # ) - # zero_components_plnc.label("Set Zeroes:") - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcx", - # text="X00" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcy", - # text="0Y0" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcz", - # text="00Z" - # ) - # one_components_plnc = component_changers_plnc.column( - # align=True - # ) - # one_components_plnc.label("Set Ones:") - # one_components_plnc.operator( - # "maplus.oneotherplanepointcx", - # text="X11" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcy", - # text="1Y1" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcz", - # text="11Z" - # ) if addon_data.quick_calc_show_slot2_geom: calc_gui.separator() @@ -13909,10 +12932,6 @@ def draw(self, context): modifier_header.label("Point Modifiers:") apply_mods = modifier_header.row() apply_mods.alignment = 'RIGHT' - # apply_mods.operator( - # "maplus.applygeommodifiers", - # text="Apply ModifiersXXXXX" - # ) item_mods_box = calcresult_geom_editor.box() mods_row_1 = item_mods_box.row() mods_row_1.prop( @@ -13989,10 +13008,6 @@ def draw(self, context): modifier_header.label("Line Modifiers:") apply_mods = modifier_header.row() apply_mods.alignment = 'RIGHT' - # apply_mods.operator( - # "maplus.applygeommodifiers", - # text="Apply ModifiersXXXXX" - # ) item_mods_box = calcresult_geom_editor.box() mods_row_1 = item_mods_box.row() mods_row_1.prop( @@ -14038,40 +13053,6 @@ def draw(self, context): ) ) - # component_changers_plna = plane_a_items.row() - # zero_components_plna = component_changers_plna.column( - # align=True - # ) - # zero_components_plna.label("Set Zeroes:") - # zero_components_plna.operator( - # "maplus.zerootherplanepointax", - # text="X00" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointay", - # text="0Y0" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointaz", - # text="00Z" - # ) - # one_components_plna = component_changers_plna.column( - # align=True - # ) - # one_components_plna.label("Set Ones:") - # one_components_plna.operator( - # "maplus.oneotherplanepointax", - # text="X11" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointay", - # text="1Y1" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointaz", - # text="11Z" - # ) - layout_coordvec( parent_layout=calcresult_geom_editor, coordvec_label="End:", @@ -14098,39 +13079,6 @@ def draw(self, context): ) ) - # component_changers_plnc = plane_c_items.row() - # zero_components_plnc = component_changers_plnc.column( - # align=True - # ) - # zero_components_plnc.label("Set Zeroes:") - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcx", - # text="X00" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcy", - # text="0Y0" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcz", - # text="00Z" - # ) - # one_components_plnc = component_changers_plnc.column( - # align=True - # ) - # one_components_plnc.label("Set Ones:") - # one_components_plnc.operator( - # "maplus.oneotherplanepointcx", - # text="X11" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcy", - # text="1Y1" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcz", - # text="11Z" - # ) elif addon_data.quick_calc_result_item.kind == 'PLANE': plane_grab_all = calcresult_geom_editor.row(align=True) plane_grab_all.operator( @@ -14185,40 +13133,6 @@ def draw(self, context): ) ) - # component_changers_plna = plane_a_items.row() - # zero_components_plna = component_changers_plna.column( - # align=True - # ) - # zero_components_plna.label("Set Zeroes:") - # zero_components_plna.operator( - # "maplus.zerootherplanepointax", - # text="X00" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointay", - # text="0Y0" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointaz", - # text="00Z" - # ) - # one_components_plna = component_changers_plna.column( - # align=True - # ) - # one_components_plna.label("Set Ones:") - # one_components_plna.operator( - # "maplus.oneotherplanepointax", - # text="X11" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointay", - # text="1Y1" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointaz", - # text="11Z" - # ) - layout_coordvec( parent_layout=calcresult_geom_editor, coordvec_label="Pt. B (Pivot):", @@ -14249,40 +13163,6 @@ def draw(self, context): ) ) - # component_changers_plnb = plane_b_items.row() - # zero_components_plnb = component_changers_plnb.column( - # align=True - # ) - # zero_components_plnb.label("Set Zeroes:") - # zero_components_plnb.operator( - # "maplus.zerootherplanepointbx", - # text="X00" - # ) - # zero_components_plnb.operator( - # "maplus.zerootherplanepointby", - # text="0Y0" - # ) - # zero_components_plnb.operator( - # "maplus.zerootherplanepointbz", - # text="00Z" - # ) - # one_components_plnb = component_changers_plnb.column( - # align=True - # ) - # one_components_plnb.label("Set Ones:") - # one_components_plnb.operator( - # "maplus.oneotherplanepointbx", - # text="X11" - # ) - # one_components_plnb.operator( - # "maplus.oneotherplanepointby", - # text="1Y1" - # ) - # one_components_plnb.operator( - # "maplus.oneotherplanepointbz", - # text="11Z" - # ) - layout_coordvec( parent_layout=calcresult_geom_editor, coordvec_label="Pt. C:", @@ -14313,42 +13193,6 @@ def draw(self, context): ) ) - # component_changers_plnc = plane_c_items.row() - # zero_components_plnc = component_changers_plnc.column( - # align=True - # ) - # zero_components_plnc.label("Set Zeroes:") - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcx", - # text="X00" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcy", - # text="0Y0" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcz", - # text="00Z" - # ) - # one_components_plnc = component_changers_plnc.column( - # align=True - # ) - # one_components_plnc.label("Set Ones:") - # one_components_plnc.operator( - # "maplus.oneotherplanepointcx", - # text="X11" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcy", - # text="1Y1" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcz", - # text="11Z" - # ) - # if addon_data.quick_calc_show_calcresult_geom: - # calc_gui.separator() - calc_gui.separator() ops_header = calc_gui.row() From adf13f3434740bd20f642a430020af08181dd9f3 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Tue, 11 Jul 2017 21:43:56 -0400 Subject: [PATCH 54/56] Code cleanup, minor formatting corrections. --- mesh_mesh_align_plus.py | 199 +--------------------------------------- 1 file changed, 5 insertions(+), 194 deletions(-) diff --git a/mesh_mesh_align_plus.py b/mesh_mesh_align_plus.py index d71caba..2e38ffe 100644 --- a/mesh_mesh_align_plus.py +++ b/mesh_mesh_align_plus.py @@ -2268,7 +2268,7 @@ def execute(self, context): elif self.quick_op_target == "AXRSRC": active_item = addon_data.quick_axis_rotate_src - + elif self.quick_op_target == "SLOT1": active_item = addon_data.internal_storage_slot_1 elif self.quick_op_target == "SLOT2": @@ -6275,7 +6275,7 @@ def execute(self, context): # Get global coordinate data for each geometry item, with # applicable modifiers applied. Grab either (A) directly from - # the scene data (for quick ops), (B) from the MAPlus primitives + # the scene data (for quick ops), (B) from the MAPlus primitives # CollectionProperty on the scene data (for advanced tools), or # (C) from the selected verts directly for numeric input mode if hasattr(self, "quick_op_target"): @@ -6298,7 +6298,7 @@ def execute(self, context): 'Cannot grab coords: non-mesh or no active object.' ) return {'CANCELLED'} - + set_item_coords( addon_data.quick_sme_numeric_src, vert_attribs_to_set, @@ -8370,7 +8370,7 @@ def execute(self, context): result = angle else: result = math.degrees(angle) - + setattr(active_calculation, result_attrib, result) if addon_data.calc_result_to_clipboard: bpy.context.window_manager.clipboard = str(result) @@ -9533,35 +9533,6 @@ def draw(self, context): ) ) - # component_changers = pt_coord_items.row() - # zero_components = component_changers.column(align=True) - # zero_components.label("Set Zeroes:") - # zero_components.operator( - # "maplus.zerootherpointx", - # text="X00" - # ) - # zero_components.operator( - # "maplus.zerootherpointy", - # text="0Y0" - # ) - # zero_components.operator( - # "maplus.zerootherpointz", - # text="00Z" - # ) - # one_components = component_changers.column(align=True) - # one_components.label("Set Ones:") - # one_components.operator( - # "maplus.oneotherpointx", - # text="X11" - # ) - # one_components.operator( - # "maplus.oneotherpointy", - # text="1Y1" - # ) - # one_components.operator( - # "maplus.oneotherpointz", - # text="11Z" - # ) item_info_col.separator() item_info_col.operator( "maplus.duplicateitembase", @@ -9657,36 +9628,6 @@ def draw(self, context): ) item_info_col.separator() - # component_changers_start = ln_start_items.row() - # zero_components = component_changers_start.column(align=True) - # zero_components.label("Set Zeroes:") - # zero_components.operator( - # "maplus.zerootherlinestartx", - # text="X00" - # ) - # zero_components.operator( - # "maplus.zerootherlinestarty", - # text="0Y0" - # ) - # zero_components.operator( - # "maplus.zerootherlinestartz", - # text="00Z" - # ) - # one_components = component_changers_start.column(align=True) - # one_components.label("Set Ones:") - # one_components.operator( - # "maplus.oneotherlinestartx", - # text="X11" - # ) - # one_components.operator( - # "maplus.oneotherlinestarty", - # text="1Y1" - # ) - # one_components.operator( - # "maplus.oneotherlinestartz", - # text="11Z" - # ) - layout_coordvec( parent_layout=item_info_col, coordvec_label="End:", @@ -9713,35 +9654,6 @@ def draw(self, context): ) ) - # component_changers_end = ln_end_items.row() - # zero_components = component_changers_end.column(align=True) - # zero_components.label("Set Zeroes:") - # zero_components.operator( - # "maplus.zerootherlineendx", - # text="X00" - # ) - # zero_components.operator( - # "maplus.zerootherlineendy", - # text="0Y0" - # ) - # zero_components.operator( - # "maplus.zerootherlineendz", - # text="00Z" - # ) - # one_components = component_changers_end.column(align=True) - # one_components.label("Set Ones:") - # one_components.operator( - # "maplus.oneotherlineendx", - # text="X11" - # ) - # one_components.operator( - # "maplus.oneotherlineendy", - # text="1Y1" - # ) - # one_components.operator( - # "maplus.oneotherlineendz", - # text="11Z" - # ) item_info_col.separator() item_info_col.operator( "maplus.duplicateitembase", @@ -9806,40 +9718,6 @@ def draw(self, context): ) item_info_col.separator() - # component_changers_plna = plane_a_items.row() - # zero_components_plna = component_changers_plna.column( - # align=True - # ) - # zero_components_plna.label("Set Zeroes:") - # zero_components_plna.operator( - # "maplus.zerootherplanepointax", - # text="X00" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointay", - # text="0Y0" - # ) - # zero_components_plna.operator( - # "maplus.zerootherplanepointaz", - # text="00Z" - # ) - # one_components_plna = component_changers_plna.column( - # align=True - # ) - # one_components_plna.label("Set Ones:") - # one_components_plna.operator( - # "maplus.oneotherplanepointax", - # text="X11" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointay", - # text="1Y1" - # ) - # one_components_plna.operator( - # "maplus.oneotherplanepointaz", - # text="11Z" - # ) - layout_coordvec( parent_layout=item_info_col, coordvec_label="Pt. B:", @@ -9871,40 +9749,6 @@ def draw(self, context): ) item_info_col.separator() - # component_changers_plnb = plane_b_items.row() - # zero_components_plnb = component_changers_plnb.column( - # align=True - # ) - # zero_components_plnb.label("Set Zeroes:") - # zero_components_plnb.operator( - # "maplus.zerootherplanepointbx", - # text="X00" - # ) - # zero_components_plnb.operator( - # "maplus.zerootherplanepointby", - # text="0Y0" - # ) - # zero_components_plnb.operator( - # "maplus.zerootherplanepointbz", - # text="00Z" - # ) - # one_components_plnb = component_changers_plnb.column( - # align=True - # ) - # one_components_plnb.label("Set Ones:") - # one_components_plnb.operator( - # "maplus.oneotherplanepointbx", - # text="X11" - # ) - # one_components_plnb.operator( - # "maplus.oneotherplanepointby", - # text="1Y1" - # ) - # one_components_plnb.operator( - # "maplus.oneotherplanepointbz", - # text="11Z" - # ) - layout_coordvec( parent_layout=item_info_col, coordvec_label="Pt. C:", @@ -9935,39 +9779,6 @@ def draw(self, context): ) ) - # component_changers_plnc = plane_c_items.row() - # zero_components_plnc = component_changers_plnc.column( - # align=True - # ) - # zero_components_plnc.label("Set Zeroes:") - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcx", - # text="X00" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcy", - # text="0Y0" - # ) - # zero_components_plnc.operator( - # "maplus.zerootherplanepointcz", - # text="00Z" - # ) - # one_components_plnc = component_changers_plnc.column( - # align=True - # ) - # one_components_plnc.label("Set Ones:") - # one_components_plnc.operator( - # "maplus.oneotherplanepointcx", - # text="X11" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcy", - # text="1Y1" - # ) - # one_components_plnc.operator( - # "maplus.oneotherplanepointcz", - # text="11Z" - # ) item_info_col.separator() item_info_col.operator( "maplus.duplicateitembase", @@ -11890,7 +11701,7 @@ def draw(self, context): icon='WORLD', text="Grab All Global" ) - + special_grabs = sme_src_geom_editor.row(align=True) special_grabs.operator( "maplus.quicksmegrabnormalsrc", From 715f83b266bc25a2e6df843cda467ecb944ccbd4 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Tue, 11 Jul 2017 22:06:55 -0400 Subject: [PATCH 55/56] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c337799..156112a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Some concrete examples of things you can do with the addon: * Stick a flat surface from one object against a flat surface on another object * Align something to an invisible axis, or shift that axis to a new location first and then rotate around it. -See the simple demo clips below for a general sense of what the addon can do, read the Wiki above, or watch the full 30 minute demo video on YouTube (Link). +See the simple demo clips below for a general sense of what the addon can do, read the Wiki above, or watch video tutorial on YouTube (Link). ![alt](http://i.imgur.com/hro9YEB.gif) ![alt](http://i.imgur.com/VSkjGdN.gif) From 9d087199c3a2717f2b7c0eb5c827fb87506021e6 Mon Sep 17 00:00:00 2001 From: Eric Gentry Date: Tue, 11 Jul 2017 22:07:35 -0400 Subject: [PATCH 56/56] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 156112a..17e3229 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Some concrete examples of things you can do with the addon: * Stick a flat surface from one object against a flat surface on another object * Align something to an invisible axis, or shift that axis to a new location first and then rotate around it. -See the simple demo clips below for a general sense of what the addon can do, read the Wiki above, or watch video tutorial on YouTube (Link). +See the simple demo clips below for a general sense of what the addon can do, read the Wiki above, or watch the video tutorial on YouTube (Link). ![alt](http://i.imgur.com/hro9YEB.gif) ![alt](http://i.imgur.com/VSkjGdN.gif)