Skip to content

Commit

Permalink
Merge branch 'release-v0.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
egtwobits committed Jul 13, 2022
2 parents c6b39f4 + a3b79df commit 0133583
Show file tree
Hide file tree
Showing 13 changed files with 860 additions and 69 deletions.
2 changes: 1 addition & 1 deletion mesh_mesh_align_plus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"based on geometry and measurements from your scene."
),
"author": "Eric Gentry",
"version": (0, 6, 1),
"version": (0, 7, 0),
"blender": (2, 80, 0),
"location": (
"3D View > N Panel > Mesh Align Plus tab, and"
Expand Down
20 changes: 10 additions & 10 deletions mesh_mesh_align_plus/advanced_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def draw_item(self,
if item.kind == 'POINT':
layout.label(text=item.name, icon="LAYER_ACTIVE")
elif item.kind == 'LINE':
layout.label(text=item.name, icon="LIGHT_SUN")
layout.label(text=item.name, icon="CURVE_PATH")
elif item.kind == 'PLANE':
layout.label(text=item.name, icon="OUTLINER_OB_MESH")
elif item.kind == 'CALCULATION':
Expand Down Expand Up @@ -617,7 +617,7 @@ def draw(self, context):
)
add_new_items.operator(
"maplus.addnewline",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text=""
)
add_new_items.operator(
Expand Down Expand Up @@ -1053,7 +1053,7 @@ def draw(self, context):
if calc_target.kind == 'POINT':
item_info_col.operator(
"maplus.composenewlinefrompoint",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="New Line from Point"
)
elif calc_target.kind == 'LINE':
Expand All @@ -1063,13 +1063,13 @@ def draw(self, context):
)
item_info_col.operator(
"maplus.composenewlinefromorigin",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="New Line from Origin"
)
elif calc_target.kind == 'PLANE':
item_info_col.operator(
"maplus.composenormalfromplane",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="Get Plane Normal (Normalized)"
)
elif active_item.calc_type == 'MULTIITEM':
Expand Down Expand Up @@ -1129,7 +1129,7 @@ def draw(self, context):
calc_target_two.kind == 'POINT'):
item_info_col.operator(
"maplus.composenewlinefrompoints",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="New Line from Points"
)
item_info_col.operator(
Expand All @@ -1144,18 +1144,18 @@ def draw(self, context):
)
item_info_col.operator(
"maplus.composenewlinevectoraddition",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="Add Lines"
)
item_info_col.operator(
"maplus.composenewlinevectorsubtraction",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="Subtract Lines"
)
elif 'POINT' in type_combo and 'LINE' in type_combo:
item_info_col.operator(
"maplus.composenewlineatpointlocation",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="New Line at Point"
)
elif 'LINE' in type_combo and 'PLANE' in type_combo:
Expand All @@ -1180,7 +1180,7 @@ def draw(self, context):
)
transf_types.operator(
"maplus.changetransftoalignplanes",
icon='MOD_ARRAY',
icon='FACESEL',
text="Align Planes"
)
transf_types.operator(
Expand Down
8 changes: 4 additions & 4 deletions mesh_mesh_align_plus/align_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def draw(self, context):
preserve_button_roundedge = aln_src_geom_top.row()
preserve_button_roundedge.operator(
"maplus.quickalignlinesgrabsrc",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="Grab Source"
)
preserve_button_roundedge.operator(
Expand All @@ -434,7 +434,7 @@ def draw(self, context):
)
aln_src_geom_top.label(
text="Source Coordinates",
icon="LIGHT_SUN"
icon="CURVE_PATH"
)

aln_src_geom_editor = aln_grab_col.box()
Expand Down Expand Up @@ -557,7 +557,7 @@ def draw(self, context):
preserve_button_roundedge = aln_dest_geom_top.row()
preserve_button_roundedge.operator(
"maplus.quickalignlinesgrabdest",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="Grab Destination"
)
preserve_button_roundedge.operator(
Expand All @@ -574,7 +574,7 @@ def draw(self, context):
)
aln_dest_geom_top.label(
text="Destination Coordinates",
icon="LIGHT_SUN"
icon="CURVE_PATH"
)

aln_dest_geom_editor = aln_grab_col.box()
Expand Down
1 change: 0 additions & 1 deletion mesh_mesh_align_plus/align_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class MAPLUS_PT_QuickAlignObjectsGUI(bpy.types.Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "Mesh Align Plus"
bl_category = "Mesh Align Plus"
bl_options = {"DEFAULT_CLOSED"}

def draw(self, context):
Expand Down
99 changes: 61 additions & 38 deletions mesh_mesh_align_plus/align_planes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Align Planes tool, internals & UI."""


import traceback

import bmesh
import bpy
import mathutils
Expand Down Expand Up @@ -181,42 +183,58 @@ def execute(self, context):
dest_pln_ln_BA
)

# Create custom transform orientation, for sliding the user's
# target along the destination face after it has been aligned.
# We do this by making a basis matrix out of the dest plane
# leading edge vector, the dest normal vector, and the cross
# of those two (each vector is normalized first)
vdest = dest_pln_ln_BA.copy()
vdest.normalize()
vnorm = dest_normal.copy()
vnorm.normalize()
# vnorm.negate()
vcross = vdest.cross(vnorm)
vcross.normalize()
vcross.negate()
orthonormal_basis_matrix = mathutils.Matrix(
[
[vcross[0], vnorm[0], vdest[0]],
[vcross[1], vnorm[1], vdest[1]],
[vcross[2], vnorm[2], vdest[2]]
]
)
bpy.ops.transform.create_orientation(
name='MAPlus',
use=active_item.apl_use_custom_orientation,
overwrite=True
)
bpy.context.view_layer.update()
orient_slot = [
slot for slot in
bpy.context.scene.transform_orientation_slots
if slot.custom_orientation
and slot.custom_orientation.name == 'MAPlus'
]
if orient_slot:
orient_slot[0].custom_orientation.matrix = orthonormal_basis_matrix
else:
print('Error: Could not find MAPlus transform orientation...')
# # ############################################################
# # TODO: Create custom transform orientation for destination
# # plane. This is disabled until a solution can be found.
# # ############################################################
# # Create custom transform orientation, for sliding the user's
# # target along the destination face after it has been aligned.
# # We do this by making a basis matrix out of the dest plane
# # leading edge vector, the dest normal vector, and the cross
# # of those two (each vector is normalized first)
# vdest = dest_pln_ln_BA.copy()
# vdest.normalize()
# vnorm = dest_normal.copy()
# vnorm.normalize()
# # vnorm.negate()
# vcross = vdest.cross(vnorm)
# vcross.normalize()
# vcross.negate()
# orthonormal_basis_matrix = mathutils.Matrix(
# [
# [vcross[0], vnorm[0], vdest[0]],
# [vcross[1], vnorm[1], vdest[1]],
# [vcross[2], vnorm[2], vdest[2]]
# ]
# )
# try:
# bpy.ops.transform.create_orientation(
# name='MAPlus',
# use=active_item.apl_use_custom_orientation,
# overwrite=True
# )
# bpy.context.view_layer.update()
# orient_slot = [
# slot for slot in
# bpy.context.scene.transform_orientation_slots
# if slot.custom_orientation
# and slot.custom_orientation.name == 'MAPlus'
# ]
# if orient_slot:
# orient_slot[0].custom_orientation.matrix = orthonormal_basis_matrix
# else:
# print('Error: Could not find MAPlus transform orientation...')
# self.report(
# {'WARNING'},
# ('Warning: Failed to create orientation for destination plane!')
# )
# except RuntimeError:
# traceback.print_exc()
# print('\nError: Runtime error creating transform orientation (see above)...')
# self.report(
# {'WARNING'},
# ('Warning: Failed to create orientation for destination plane!')
# )

if hasattr(self, 'quick_op_target') and addon_data.quick_align_planes_set_origin_mode:
# TODO: Refactor this feature or possibly make it a new full operator
Expand Down Expand Up @@ -703,7 +721,7 @@ def draw(self, context):
apl_gui = layout.box()
apl_top.label(
text="Align Planes",
icon="MOD_ARRAY"
icon="FACESEL",
)
apl_grab_col = apl_gui.column()
apl_grab_col.prop(
Expand Down Expand Up @@ -1004,11 +1022,16 @@ def draw(self, context):
'apl_flip_normal',
text='Flip Normal'
)
apl_mods_row1.prop(
# Pop the trans. orientation checkbox into its
# own sublayout and disable it (either fix and
# re-enable or remove this if no longer supported)
transf_orientation_area = apl_mods_row1.row()
transf_orientation_area.prop(
addon_data.quick_align_planes_transf,
'apl_use_custom_orientation',
text='Use Transf. Orientation'
)
transf_orientation_area.enabled = False
apl_mods_row2 = apl_mods.row()
apl_mods_row2.prop(
addon_data.quick_align_planes_transf,
Expand Down
4 changes: 2 additions & 2 deletions mesh_mesh_align_plus/axis_rotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def draw(self, context):
preserve_button_roundedge = axr_src_geom_top.row()
preserve_button_roundedge.operator(
"maplus.quickaxisrotategrabsrc",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="Grab Axis"
)
preserve_button_roundedge.operator(
Expand All @@ -416,7 +416,7 @@ def draw(self, context):
)
axr_src_geom_top.label(
text="Source Coordinates",
icon="LIGHT_SUN"
icon="CURVE_PATH"
)

axr_src_geom_editor = axr_grab_col.box()
Expand Down
14 changes: 7 additions & 7 deletions mesh_mesh_align_plus/calculate_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -2068,17 +2068,17 @@ def draw(self, context):
)
calc_gui.operator(
"maplus.quickcomposenewlinefromorigin",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="New Line from Origin"
)
calc_gui.operator(
"maplus.quickcomposenormalfromplane",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="Get Plane Normal (Normalized)"
)
calc_gui.operator(
"maplus.quickcomposenewlinefrompoint",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="New Line from Point"
)
calc_gui.operator(
Expand All @@ -2087,22 +2087,22 @@ def draw(self, context):
)
calc_gui.operator(
"maplus.quickcomposenewlineatpointlocation",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="New Line at Point"
)
calc_gui.operator(
"maplus.quickcomposenewlinefrompoints",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="New Line from Points"
)
calc_gui.operator(
"maplus.quickcomposenewlinevectoraddition",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="Add Lines"
)
calc_gui.operator(
"maplus.quickcomposenewlinevectorsubtraction",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="Subtract Lines"
)
calc_gui.operator(
Expand Down
4 changes: 2 additions & 2 deletions mesh_mesh_align_plus/directional_slide.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def draw(self, context):
preserve_button_roundedge = ds_src_geom_top.row()
preserve_button_roundedge.operator(
"maplus.quickdirectionalslidegrabsrc",
icon='LIGHT_SUN',
icon='CURVE_PATH',
text="Grab Source"
)
preserve_button_roundedge.operator(
Expand All @@ -375,7 +375,7 @@ def draw(self, context):
)
ds_src_geom_top.label(
text="Source Coordinates",
icon="LIGHT_SUN"
icon="CURVE_PATH"
)

ds_src_geom_editor = ds_grab_col.box()
Expand Down
Loading

0 comments on commit 0133583

Please sign in to comment.