New feature to only apply section planes to specific objects

This commit is contained in:
Dion Moult
2020-04-25 19:17:47 +10:00
parent 82e38e3abe
commit 3d45f9afeb
3 changed files with 11 additions and 1 deletions
@@ -1927,7 +1927,12 @@ class AddSectionPlane(bpy.types.Operator):
material = bpy.data.materials.new('Section Override')
material.use_nodes = True
for obj in bpy.context.visible_objects:
if bpy.context.scene.BIMProperties.should_section_selected_objects:
objects = bpy.context.selected_objects
else:
objects = bpy.context.visible_objects
for obj in objects:
if not (obj.data \
and hasattr(obj.data, 'materials') \
and obj.data.materials \
@@ -849,6 +849,7 @@ class BIMProperties(PropertyGroup):
property_set_templates: EnumProperty(items=getPropertySetTemplates, name="Pset Template Files")
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)
class BCFProperties(PropertyGroup):
@@ -449,6 +449,10 @@ class BIM_PT_section_plane(Panel):
def draw(self, context):
layout = self.layout
layout.use_property_split = True
props = bpy.context.scene.BIMProperties
row = layout.row()
row.prop(props, 'should_section_selected_objects')
row = layout.row(align=True)
row.operator('bim.add_section_plane')