You can now toggle flat shading when showing colourschemes

This commit is contained in:
Dion Moult
2024-08-21 20:55:30 +10:00
parent d2dc8b519f
commit 7c00021aaa
3 changed files with 20 additions and 2 deletions
@@ -305,7 +305,7 @@ class ColourByProperty(Operator):
obj.color = (0, 0, 0, 1)
if not is_qualitative:
steps = 10
steps = 10 if max_value is not None and min_value is not None else 0
step_size = (max_value - min_value) / (steps - 1)
values = []
for i in range(steps):
+17 -1
View File
@@ -87,6 +87,21 @@ def update_is_container_selected(self, context):
new.obj = obj
def update_show_flat_colours(self, context):
if self.show_flat_colours:
space = tool.Blender.get_view3d_space()
space.shading.light = "FLAT"
space.shading.color_type = "OBJECT"
space.shading.show_object_outline = True
space.shading.show_cavity = True
else:
space = tool.Blender.get_view3d_space()
space.shading.type = "SOLID"
space.shading.light = "STUDIO"
space.shading.show_object_outline = True
space.shading.show_cavity = False
class BIMFilterClasses(PropertyGroup):
name: StringProperty(name="Name")
is_selected: BoolProperty(name="Is Selected", default=True, update=update_is_class_selected)
@@ -163,7 +178,7 @@ class BIMSearchProperties(PropertyGroup):
],
name="Max Mode",
)
min_value: FloatProperty(name="Min Value", default=100)
min_value: FloatProperty(name="Min Value", default=0)
max_value: FloatProperty(name="Max Value", default=100)
colourscheme: CollectionProperty(type=BIMColour)
active_colourscheme_index: IntProperty(name="Active Colourscheme Index")
@@ -172,6 +187,7 @@ class BIMSearchProperties(PropertyGroup):
filter_classes_index: IntProperty(name="Filter Classes Index")
filter_container: CollectionProperty(type=BIMFilterBuildingStoreys, name="Filter Level")
filter_container_index: IntProperty(name="Filter Level Index")
show_flat_colours: BoolProperty(name="Flat Colours", default=False, update=update_show_flat_colours)
def get_classes(self, ifc_product):
@@ -102,9 +102,11 @@ class BIM_PT_colour_by_property(Panel):
if props.max_mode == "MANUAL":
row.prop(props, "max_value", text="")
row = self.layout.row(align=True)
row.operator("bim.colour_by_property", icon="BRUSH_DATA")
row.operator("bim.reset_object_colours")
row.prop(props, "show_flat_colours", icon="SHADING_RENDERED", text="")
row.operator("bim.select_by_property", icon="RESTRICT_SELECT_OFF", text="")
if len(props.colourscheme):