mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 14:06:26 +00:00
Allow warning and background decorator colours to be configurable
This commit is contained in:
@@ -26,10 +26,6 @@ from gpu_extras.batch import batch_for_shader
|
|||||||
from typing import Union
|
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):
|
def transparent_color(color, alpha=0.1):
|
||||||
color = [i for i in color]
|
color = [i for i in color]
|
||||||
color[3] = alpha
|
color[3] = alpha
|
||||||
@@ -82,6 +78,8 @@ class ProfileDecorator:
|
|||||||
selected_elements_color = self.addon_prefs.decorator_color_selected
|
selected_elements_color = self.addon_prefs.decorator_color_selected
|
||||||
unselected_elements_color = self.addon_prefs.decorator_color_unselected
|
unselected_elements_color = self.addon_prefs.decorator_color_unselected
|
||||||
special_elements_color = self.addon_prefs.decorator_color_special
|
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
|
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, transparent_color(unselected_elements_color), unselected_edges)
|
||||||
self.draw_batch("LINES", all_vertices, selected_elements_color, selected_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, preview_edges)
|
||||||
self.draw_batch("LINES", all_vertices, special_elements_color, roof_angle_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", 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", special_vertices, special_elements_color)
|
||||||
self.draw_batch("POINTS", selected_vertices, selected_elements_color)
|
self.draw_batch("POINTS", selected_vertices, selected_elements_color)
|
||||||
|
|
||||||
@@ -232,7 +230,7 @@ class ProfileDecorator:
|
|||||||
arc_centroids.append(tuple(centroid))
|
arc_centroids.append(tuple(centroid))
|
||||||
arc_segments.append(tool.Cad.create_arc_segments(pts=points, num_verts=17, make_edges=True))
|
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:
|
for verts, edges in arc_segments:
|
||||||
self.draw_batch("LINES", verts, special_elements_color, edges)
|
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]]
|
segments = [[list(matrix @ Vector(v)) for v in segments[0]], segments[1]]
|
||||||
circle_segments.append(segments)
|
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:
|
for verts, edges in circle_segments:
|
||||||
self.draw_batch("LINES", verts, special_elements_color, edges)
|
self.draw_batch("LINES", verts, special_elements_color, edges)
|
||||||
|
|
||||||
|
|||||||
@@ -240,7 +240,25 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
|
|||||||
min=0.0,
|
min=0.0,
|
||||||
max=1.0,
|
max=1.0,
|
||||||
size=4,
|
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):
|
def draw(self, context):
|
||||||
@@ -315,6 +333,10 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
|
|||||||
row.prop(self, "decorator_color_unselected")
|
row.prop(self, "decorator_color_unselected")
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
row.prop(self, "decorator_color_special")
|
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 = self.layout.row(align=True)
|
||||||
row.prop(context.scene.BIMProperties, "schema_dir")
|
row.prop(context.scene.BIMProperties, "schema_dir")
|
||||||
|
|||||||
Reference in New Issue
Block a user