From 5eaddb04a1726a55c5e148b29291fe3aa593e6a6 Mon Sep 17 00:00:00 2001 From: GiangM9 Date: Tue, 7 Jan 2020 13:30:01 +0700 Subject: [PATCH 1/3] for blender 2.81 --- __init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/__init__.py b/__init__.py index a5a4006..7e68ce7 100644 --- a/__init__.py +++ b/__init__.py @@ -2,7 +2,7 @@ "name": "Object Bounding Box", "author": "Patrick R. Moore", "version": (0, 1), - "blender": (2, 7, 3), + "blender": (2, 8, 1), "location": "View3D > Add > Mesh > New Object", "description": "Adds new cube which is minumum bounding box!", "warning": "", @@ -23,9 +23,9 @@ def bbox_orient(bme_verts, mx): takes a lsit of BMverts ora list of vectors ''' if hasattr(bme_verts[0], 'co'): - verts = [mx * v.co for v in bme_verts] + verts = [mx @ v.co for v in bme_verts] else: - verts = [mx * v for v in bme_verts] + verts = [mx @ v for v in bme_verts] xs = [v[0] for v in verts] ys = [v[1] for v in verts] @@ -124,9 +124,9 @@ def main(context, rand_sample, spin_res, make_sphere): box_verts = box_cords(min_box) bpy.ops.mesh.primitive_cube_add() - fmx = tr_mx * r_mx * min_mx.inverted() * sc_mx + fmx = tr_mx @ r_mx @ min_mx.inverted() @ sc_mx context.object.matrix_world = fmx - context.object.draw_type = 'BOUNDS' + context.object.display_type = 'BOUNDS' for i, v in enumerate(box_verts): context.object.data.vertices[i].co = v @@ -253,7 +253,7 @@ def main_SVD(context, down_sample, method, spin_res, make_box): bpy.ops.mesh.primitive_cube_add() context.object.matrix_world =rmx.transposed().inverted() * world_mx - context.object.draw_type = 'BOUNDS' + context.object.display_type = 'BOUNDS' for i, v in enumerate(box_verts): context.object.data.vertices[i].co = v @@ -265,10 +265,10 @@ def main_SVD(context, down_sample, method, spin_res, make_box): box_verts = box_cords(min_box) bpy.ops.mesh.primitive_cube_add() #FinalMatrix = TranslationMatrix * RotationMatrix * ScaleMatrix - fmx = tr_mx * r_mx * min_mx.inverted() * sc_mx + fmx = tr_mx @ r_mx @ min_mx.inverted() @ sc_mx context.object.matrix_world = fmx - context.object.draw_type = 'BOUNDS' + context.object.display_type = 'BOUNDS' for i, v in enumerate(box_verts): context.object.data.vertices[i].co = v From c2b28c4952693e74ba3e33f4718549aa129ad536 Mon Sep 17 00:00:00 2001 From: germanmitish <42450658+germanmitish@users.noreply.github.com> Date: Fri, 2 Jul 2021 23:00:30 +0300 Subject: [PATCH 2/3] Update __init__.py Fixed blender version line --- __init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index 7e68ce7..043734c 100644 --- a/__init__.py +++ b/__init__.py @@ -2,7 +2,7 @@ "name": "Object Bounding Box", "author": "Patrick R. Moore", "version": (0, 1), - "blender": (2, 8, 1), + "blender": (2, 80, 1), "location": "View3D > Add > Mesh > New Object", "description": "Adds new cube which is minumum bounding box!", "warning": "", From 7d77a0643c881ab57eed5dd66cbb2c37e3e399d9 Mon Sep 17 00:00:00 2001 From: germanmitish <42450658+germanmitish@users.noreply.github.com> Date: Sat, 3 Jul 2021 00:55:26 +0300 Subject: [PATCH 3/3] Parameter type annotations --- __init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/__init__.py b/__init__.py index 043734c..a680239 100644 --- a/__init__.py +++ b/__init__.py @@ -2,7 +2,7 @@ "name": "Object Bounding Box", "author": "Patrick R. Moore", "version": (0, 1), - "blender": (2, 80, 1), + "blender": (2, 80, 3), "location": "View3D > Add > Mesh > New Object", "description": "Adds new cube which is minumum bounding box!", "warning": "", @@ -280,22 +280,22 @@ class ObjectMinBoundBox(bpy.types.Operator): bl_label = "Min Bounding Box" # generic transform props - sample_vis = BoolProperty( + sample_vis: BoolProperty( name="Visualize Sample", description = 'add a sphere to the scene showing random direction sample', default=False, ) - make_box = BoolProperty( + make_box: BoolProperty( name="Visualize Boxes", description = 'add a cube for all bounding boxes tried. VERY MESS!', default=False, ) - area_sample = IntProperty( + area_sample: IntProperty( name="Direction Samples", description = 'number of random directions to test calipers in', default = 200) - angular_sample = IntProperty( + angular_sample: IntProperty( name="Direction samples", description = 'angular step to rotate calipers 90 = 1 degree steps, 180 = 1/2 degree steps', default = 50) @@ -306,7 +306,7 @@ class ObjectMinBoundBox(bpy.types.Operator): ('pca_x', 'PCAX', 'Good for flat objects'), ('pca_z', 'PCAZ', 'Good for some things')] - method = bpy.props.EnumProperty( + method: bpy.props.EnumProperty( name="Method", description="Min BBox method to use", items=method_enum,