From 9bdb94380fca0d122b4c12a0fc2829f8cbc9c728 Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Sun, 4 Feb 2024 11:00:53 -0600 Subject: [PATCH] calculate quantities based on either object mode or edit mode --- src/blenderbim/blenderbim/bim/module/qto/helper.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/qto/helper.py b/src/blenderbim/blenderbim/bim/module/qto/helper.py index 6290331b58..d495a152eb 100644 --- a/src/blenderbim/blenderbim/bim/module/qto/helper.py +++ b/src/blenderbim/blenderbim/bim/module/qto/helper.py @@ -25,11 +25,18 @@ def calculate_height(obj): def calculate_edges_lengths(objs, context): - return calculate_mesh_quantity(objs, context, lambda bm: sum((e.calc_length() for e in bm.edges))) + if bpy.context.mode == 'OBJECT': + return calculate_mesh_quantity(objs, context, lambda bm: sum((e.calc_length() for e in bm.edges))) + elif bpy.context.mode == 'EDIT_MESH': + return calculate_mesh_quantity(objs, context, lambda bm: sum((e.calc_length() for e in bm.edges if e.select))) + def calculate_faces_areas(objs, context): - return calculate_mesh_quantity(objs, context, lambda bm: sum((f.calc_area() for f in bm.faces))) + if bpy.context.mode == 'OBJECT': + return calculate_mesh_quantity(objs, context, lambda bm: sum((f.calc_area() for f in bm.faces))) + elif bpy.context.mode == 'EDIT_MESH': + return calculate_mesh_quantity(objs, context, lambda bm: sum((f.calc_area() for f in bm.faces if f.select))) def calculate_volumes(objs, context):