black formating

This commit is contained in:
falken10
2025-05-20 15:57:03 +02:00
committed by Bruno Perdigão
parent 2c16247943
commit b26890f74b
4 changed files with 27 additions and 15 deletions
+1 -1
View File
@@ -533,7 +533,7 @@ class BIM_PT_derived_coordinates(Panel):
area_3d = next((area for area in context.screen.areas if area.type == "VIEW_3D"), None) area_3d = next((area for area in context.screen.areas if area.type == "VIEW_3D"), None)
space_3d = next((space for space in area_3d.spaces if space.type == "VIEW_3D"), None) space_3d = next((space for space in area_3d.spaces if space.type == "VIEW_3D"), None)
if bpy.context.scene.BIMModelProperties.measure_xyz_dimensions: if bpy.context.scene.BIMModelProperties.measure_xyz_dimensions:
for axis, icon, idx in [("X", "STRIP_COLOR_01", 0), ("Y", "STRIP_COLOR_04", 1), ("Z", "STRIP_COLOR_05", 2)]: for axis, icon, idx in [("X", "STRIP_COLOR_01", 0), ("Y", "STRIP_COLOR_04", 1), ("Z", "STRIP_COLOR_05", 2)]:
row.label(text="", icon=icon) row.label(text="", icon=icon)
row.prop(context.active_object, "dimensions", text=axis, index=idx) row.prop(context.active_object, "dimensions", text=axis, index=idx)
@@ -1124,6 +1124,7 @@ class FaceAreaDecorator:
self.draw_batch("LINES", data["verts"], decorator_color, data["edges"]) self.draw_batch("LINES", data["verts"], decorator_color, data["edges"])
self.draw_batch("TRIS", data["verts"], transparent_color(decorator_color, alpha=0.5), data["tris"]) self.draw_batch("TRIS", data["verts"], transparent_color(decorator_color, alpha=0.5), data["tris"])
class BoundingBoxDecorator: class BoundingBoxDecorator:
is_installed = False is_installed = False
handlers = [] handlers = []
@@ -1143,7 +1144,9 @@ class BoundingBoxDecorator:
cls.uninstall() cls.uninstall()
handler = cls() handler = cls()
cls.handlers.append( cls.handlers.append(
bpy.types.SpaceView3D.draw_handler_add(handler.draw_bounding_box_wire_cube, (context,), "WINDOW", "POST_VIEW") bpy.types.SpaceView3D.draw_handler_add(
handler.draw_bounding_box_wire_cube, (context,), "WINDOW", "POST_VIEW"
)
) )
cls.handlers.append( cls.handlers.append(
bpy.types.SpaceView3D.draw_handler_add(handler.draw_dimension_text, (context,), "WINDOW", "POST_PIXEL") bpy.types.SpaceView3D.draw_handler_add(handler.draw_dimension_text, (context,), "WINDOW", "POST_PIXEL")
@@ -1163,6 +1166,7 @@ class BoundingBoxDecorator:
@staticmethod @staticmethod
def get_combined_bounding_box_corners(objects): def get_combined_bounding_box_corners(objects):
import mathutils import mathutils
if not objects: if not objects:
return None, None, None return None, None, None
if len(objects) == 1: if len(objects) == 1:
@@ -1190,9 +1194,18 @@ class BoundingBoxDecorator:
mathutils.Vector((max_corner.x, max_corner.y, min_corner.z)), mathutils.Vector((max_corner.x, max_corner.y, min_corner.z)),
] ]
edges = [ edges = [
(0, 1, "Z"), (1, 2, "Y"), (2, 3, "Z"), (3, 0, "Y"), (0, 1, "Z"),
(4, 5, "Z"), (5, 6, "Y"), (6, 7, "Z"), (7, 4, "Y"), (1, 2, "Y"),
(0, 4, "X"), (1, 5, "X"), (2, 6, "X"), (3, 7, "X"), (2, 3, "Z"),
(3, 0, "Y"),
(4, 5, "Z"),
(5, 6, "Y"),
(6, 7, "Z"),
(7, 4, "Y"),
(0, 4, "X"),
(1, 5, "X"),
(2, 6, "X"),
(3, 7, "X"),
] ]
axis_colors = { axis_colors = {
"X": (0.956, 0.282, 0.322, 1), "X": (0.956, 0.282, 0.322, 1),
@@ -1204,6 +1217,7 @@ class BoundingBoxDecorator:
@staticmethod @staticmethod
def find_closest_trihedron(corners, edges, region, rv3d): def find_closest_trihedron(corners, edges, region, rv3d):
from bpy_extras.view3d_utils import location_3d_to_region_2d from bpy_extras.view3d_utils import location_3d_to_region_2d
min_y = float("inf") min_y = float("inf")
best_origin = None best_origin = None
for idx, corner in enumerate(corners): for idx, corner in enumerate(corners):
@@ -1281,7 +1295,6 @@ class BoundingBoxDecorator:
self.line_shader.uniform_float("viewportSize", (context.region.width, context.region.height)) self.line_shader.uniform_float("viewportSize", (context.region.width, context.region.height))
self.shader = gpu.shader.from_builtin("UNIFORM_COLOR") self.shader = gpu.shader.from_builtin("UNIFORM_COLOR")
selected_objects = [obj for obj in bpy.context.selected_objects if hasattr(obj, "bound_box")] selected_objects = [obj for obj in bpy.context.selected_objects if hasattr(obj, "bound_box")]
if not selected_objects: if not selected_objects:
return return
+4 -6
View File
@@ -146,6 +146,8 @@ def update_measure_xyz(self: "BIMModelProperties", context: bpy.types.Context) -
space_3d.show_gizmo_object_translate = prev_gizmo space_3d.show_gizmo_object_translate = prev_gizmo
self.prev_show_gizmo_object_translate = False self.prev_show_gizmo_object_translate = False
def update_cut_decorator(self: "BIMModelProperties", context: bpy.types.Context) -> None: def update_cut_decorator(self: "BIMModelProperties", context: bpy.types.Context) -> None:
if self.show_cut_decorator: if self.show_cut_decorator:
CutDecorator.install(bpy.context) CutDecorator.install(bpy.context)
@@ -281,12 +283,8 @@ class BIMModelProperties(PropertyGroup):
update=update_slab_direction_decorator, update=update_slab_direction_decorator,
) )
prev_transform_orientation_slot_type: bpy.props.StringProperty( prev_transform_orientation_slot_type: bpy.props.StringProperty(name="Previous Gizmo Orientation Type")
name="Previous Gizmo Orientation Type" prev_show_gizmo_object_translate: bpy.props.BoolProperty(name="Previous Gizmo Translate")
)
prev_show_gizmo_object_translate: bpy.props.BoolProperty(
name="Previous Gizmo Translate"
)
measure_xyz_dimensions: bpy.props.BoolProperty( measure_xyz_dimensions: bpy.props.BoolProperty(
name="Measure XYZ Dimensions", name="Measure XYZ Dimensions",
@@ -2787,6 +2787,7 @@ class MeasureFaceAreaTool(bpy.types.Operator, PolylineOperator):
FaceAreaDecorator.install(context) FaceAreaDecorator.install(context)
return {"RUNNING_MODAL"} return {"RUNNING_MODAL"}
class ClearMeasurement(bpy.types.Operator): class ClearMeasurement(bpy.types.Operator):
bl_idname = "bim.clear_measurement" bl_idname = "bim.clear_measurement"
bl_label = "Clear measurement from the screen" bl_label = "Clear measurement from the screen"