From d6dab756531db4e0dd332796392f93aa436036af Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sun, 14 Jul 2024 16:39:29 +1000 Subject: [PATCH] Allow warning and background decorator colours to be configurable --- .../blenderbim/bim/module/model/decorator.py | 14 +++++------ src/blenderbim/blenderbim/bim/ui.py | 24 ++++++++++++++++++- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/model/decorator.py b/src/blenderbim/blenderbim/bim/module/model/decorator.py index d5da1ed2e8..2bc9ceb608 100644 --- a/src/blenderbim/blenderbim/bim/module/model/decorator.py +++ b/src/blenderbim/blenderbim/bim/module/model/decorator.py @@ -26,10 +26,6 @@ from gpu_extras.batch import batch_for_shader from typing import Union -ERROR_ELEMENTS_COLOR = (1, 0.2, 0.322, 1) # RED -UNSPECIAL_ELEMENT_COLOR = (0.2, 0.2, 0.2, 1) # GREY - - def transparent_color(color, alpha=0.1): color = [i for i in color] color[3] = alpha @@ -82,6 +78,8 @@ class ProfileDecorator: selected_elements_color = self.addon_prefs.decorator_color_selected unselected_elements_color = self.addon_prefs.decorator_color_unselected special_elements_color = self.addon_prefs.decorator_color_special + error_elements_color = self.addon_prefs.decorator_color_error + background_elements_color = self.addon_prefs.decorator_color_background obj = context.active_object @@ -200,12 +198,12 @@ class ProfileDecorator: self.draw_batch("LINES", all_vertices, transparent_color(unselected_elements_color), unselected_edges) self.draw_batch("LINES", all_vertices, selected_elements_color, selected_edges) - self.draw_batch("LINES", all_vertices, UNSPECIAL_ELEMENT_COLOR, arc_edges) + self.draw_batch("LINES", all_vertices, background_elements_color, arc_edges) self.draw_batch("LINES", all_vertices, special_elements_color, preview_edges) self.draw_batch("LINES", all_vertices, special_elements_color, roof_angle_edges) self.draw_batch("POINTS", unselected_vertices, transparent_color(unselected_elements_color, 0.5)) - self.draw_batch("POINTS", error_vertices, ERROR_ELEMENTS_COLOR) + self.draw_batch("POINTS", error_vertices, error_elements_color) self.draw_batch("POINTS", special_vertices, special_elements_color) self.draw_batch("POINTS", selected_vertices, selected_elements_color) @@ -232,7 +230,7 @@ class ProfileDecorator: arc_centroids.append(tuple(centroid)) arc_segments.append(tool.Cad.create_arc_segments(pts=points, num_verts=17, make_edges=True)) - self.draw_batch("POINTS", arc_centroids, UNSPECIAL_ELEMENT_COLOR) + self.draw_batch("POINTS", arc_centroids, background_elements_color) for verts, edges in arc_segments: self.draw_batch("LINES", verts, special_elements_color, edges) @@ -253,7 +251,7 @@ class ProfileDecorator: segments = [[list(matrix @ Vector(v)) for v in segments[0]], segments[1]] circle_segments.append(segments) - self.draw_batch("POINTS", circle_centroids, UNSPECIAL_ELEMENT_COLOR) + self.draw_batch("POINTS", circle_centroids, background_elements_color) for verts, edges in circle_segments: self.draw_batch("LINES", verts, special_elements_color, edges) diff --git a/src/blenderbim/blenderbim/bim/ui.py b/src/blenderbim/blenderbim/bim/ui.py index 03994515b3..154677687f 100644 --- a/src/blenderbim/blenderbim/bim/ui.py +++ b/src/blenderbim/blenderbim/bim/ui.py @@ -240,7 +240,25 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences): min=0.0, max=1.0, size=4, - description="Color of special selected verts/edges (openings, preview verts/edges in roof editing, verts with arcs/circles in profile editing)", + description="Color of derived, parametric, or invisible geometry", + ) + decorator_color_error: bpy.props.FloatVectorProperty( + name="Warning Elements Color", + subtype="COLOR", + default=(1, 0.2, 0.322, 1), # red + min=0.0, + max=1.0, + size=4, + description="Color of warning, error, or problem overlays", + ) + decorator_color_background: bpy.props.FloatVectorProperty( + name="Background Elements Color", + subtype="COLOR", + default=(0.2, 0.2, 0.2, 1), # grey + min=0.0, + max=1.0, + size=4, + description="Color of background overlays", ) def draw(self, context): @@ -315,6 +333,10 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences): row.prop(self, "decorator_color_unselected") row = self.layout.row() row.prop(self, "decorator_color_special") + row = self.layout.row() + row.prop(self, "decorator_color_error") + row = self.layout.row() + row.prop(self, "decorator_color_background") row = self.layout.row(align=True) row.prop(context.scene.BIMProperties, "schema_dir")