Let user control section plane colour

This commit is contained in:
Dion Moult
2020-04-27 09:33:00 +10:00
parent 9f5ef32173
commit 01cd5d1d79
3 changed files with 6 additions and 1 deletions
@@ -1877,7 +1877,7 @@ class AddSectionPlane(bpy.types.Operator):
backfacing = group.nodes.new(type='ShaderNodeNewGeometry')
backfacing_mix = group.nodes.new(type='ShaderNodeMixShader')
emission = group.nodes.new(type='ShaderNodeEmission')
emission.inputs['Color'].default_value = (1, 0, 0, 1)
emission.inputs['Color'].default_value = list(bpy.context.scene.BIMProperties.section_plane_colour) + [1]
group.links.new(backfacing.outputs['Backfacing'], backfacing_mix.inputs['Fac'])
group.links.new(group_input.outputs[''], backfacing_mix.inputs[1])
@@ -17,6 +17,7 @@ from bpy.props import (
BoolProperty,
IntProperty,
FloatProperty,
FloatVectorProperty,
CollectionProperty
)
@@ -851,6 +852,7 @@ class BIMProperties(PropertyGroup):
active_property_set_template: PointerProperty(type=PropertySetTemplate)
property_templates: CollectionProperty(name='Property Templates', type=PropertyTemplate)
should_section_selected_objects: BoolProperty(name="Section Selected Objects", default=False)
section_plane_colour: FloatVectorProperty(name='Section Plane Colour', subtype='COLOR', default=(1, 0, 0), min=0.0, max=1.0)
ifc_selector: StringProperty(default='', name='IFC Selector')
csv_attributes: CollectionProperty(name='CSV Attributes', type=StrProperty)
@@ -454,6 +454,9 @@ class BIM_PT_section_plane(Panel):
row = layout.row()
row.prop(props, 'should_section_selected_objects')
row = layout.row()
row.prop(props, 'section_plane_colour')
row = layout.row(align=True)
row.operator('bim.add_section_plane')
row.operator('bim.remove_section_plane')