Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-11-20 21:59:05 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-11-20 22:01:15 +0400
commit258c32a95672b532bd383fc6ca464127381ae651 (patch)
tree8a43f5ad6d6d9ede6ca719db80b5e4761da53929 /object_print3d_utils/operators.py
parentdf1ee41c55a733c3a2e4241a4c154f49baf9c22e (diff)
Fix T37555: Update 3D toolbox for changes to the BMesh API.
Diffstat (limited to 'object_print3d_utils/operators.py')
-rw-r--r--object_print3d_utils/operators.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/object_print3d_utils/operators.py b/object_print3d_utils/operators.py
index 7548d165..7ebf5956 100644
--- a/object_print3d_utils/operators.py
+++ b/object_print3d_utils/operators.py
@@ -543,6 +543,10 @@ class Print3DScaleToVolume(Operator):
volume = sum(calc_volume(obj) for obj in context.selected_editable_objects
if obj.type == 'MESH')
+ if volume == 0.0:
+ self.report({'WARNING'}, "Object has zero volume")
+ return {'CANCELLED'}
+
self.volume_init = self.volume = abs(volume)
wm = context.window_manager
@@ -582,12 +586,17 @@ class Print3DScaleToBounds(Operator):
if context.mode == 'EDIT_MESH':
length, axis = calc_length([Vector(v) * obj.matrix_world
- for v in context.edit_object.bound_box])
+ for obj in [context.edit_object]
+ for v in obj.bound_box])
else:
length, axis = calc_length([Vector(v) * obj.matrix_world
for obj in context.selected_editable_objects
if obj.type == 'MESH' for v in obj.bound_box])
+ if length == 0.0:
+ self.report({'WARNING'}, "Object has zero bounds")
+ return {'CANCELLED'}
+
self.length_init = self.length = length
self.axis_init = axis