diff --git a/src/blenderbim/blenderbim/bim/__init__.py b/src/blenderbim/blenderbim/bim/__init__.py index bfece71d73..529fc28676 100644 --- a/src/blenderbim/blenderbim/bim/__init__.py +++ b/src/blenderbim/blenderbim/bim/__init__.py @@ -170,7 +170,6 @@ def register(): bpy.types.Curve.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties) bpy.types.Camera.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties) bpy.types.PointLight.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties) - bpy.types.SCENE_PT_unit.append(ui.ifc_units) if hasattr(bpy.types, "UI_MT_button_context_menu"): bpy.types.UI_MT_button_context_menu.append(ui.draw_custom_context_menu) bpy.types.STATUSBAR_HT_header.append(ui.draw_statusbar) @@ -198,7 +197,6 @@ def unregister(): del bpy.types.Curve.BIMMeshProperties del bpy.types.Camera.BIMMeshProperties del bpy.types.PointLight.BIMMeshProperties - bpy.types.SCENE_PT_unit.remove(ui.ifc_units) if hasattr(bpy.types, "UI_MT_button_context_menu"): bpy.types.UI_MT_button_context_menu.remove(ui.draw_custom_context_menu) bpy.types.STATUSBAR_HT_header.remove(ui.draw_statusbar) diff --git a/src/blenderbim/blenderbim/bim/module/drawing/ui.py b/src/blenderbim/blenderbim/bim/module/drawing/ui.py index 2aa75e30b5..432d3c0daa 100644 --- a/src/blenderbim/blenderbim/bim/module/drawing/ui.py +++ b/src/blenderbim/blenderbim/bim/module/drawing/ui.py @@ -161,13 +161,14 @@ class BIM_PT_drawing_underlay(Panel): class BIM_PT_drawings(Panel): bl_label = "Drawings" bl_idname = "BIM_PT_drawings" - bl_space_type = "VIEW_3D" - bl_region_type = "UI" - bl_category = "BIM Documentation" + bl_space_type = "PROPERTIES" + bl_region_type = "WINDOW" + bl_context = "scene" @classmethod def poll(cls, context): - return tool.Ifc.get() + aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)] + return aprops.tab == "DRAWINGS" and tool.Ifc.get() def draw(self, context): if not DrawingsData.is_loaded: @@ -229,13 +230,14 @@ class BIM_PT_drawings(Panel): class BIM_PT_schedules(Panel): bl_label = "Schedules" bl_idname = "BIM_PT_schedules" - bl_space_type = "VIEW_3D" - bl_region_type = "UI" - bl_category = "BIM Documentation" + bl_space_type = "PROPERTIES" + bl_region_type = "WINDOW" + bl_context = "scene" @classmethod def poll(cls, context): - return tool.Ifc.get() + aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)] + return aprops.tab == "DRAWINGS" and tool.Ifc.get() def draw(self, context): if not DocumentsData.is_loaded: @@ -284,13 +286,14 @@ def draw_project_not_saved_ui(self): class BIM_PT_references(Panel): bl_label = "References" bl_idname = "BIM_PT_references" - bl_space_type = "VIEW_3D" - bl_region_type = "UI" - bl_category = "BIM Documentation" + bl_space_type = "PROPERTIES" + bl_region_type = "WINDOW" + bl_context = "scene" @classmethod def poll(cls, context): - return tool.Ifc.get() + aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)] + return aprops.tab == "DRAWINGS" and tool.Ifc.get() def draw(self, context): if not DocumentsData.is_loaded: @@ -328,13 +331,14 @@ class BIM_PT_references(Panel): class BIM_PT_sheets(Panel): bl_label = "Sheets" bl_idname = "BIM_PT_sheets" - bl_space_type = "VIEW_3D" - bl_region_type = "UI" - bl_category = "BIM Documentation" + bl_space_type = "PROPERTIES" + bl_region_type = "WINDOW" + bl_context = "scene" @classmethod def poll(cls, context): - return tool.Ifc.get() + aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)] + return aprops.tab == "DRAWINGS" and tool.Ifc.get() def draw(self, context): if not SheetsData.is_loaded: diff --git a/src/blenderbim/blenderbim/bim/ui.py b/src/blenderbim/blenderbim/bim/ui.py index fa45fef756..edb9860337 100644 --- a/src/blenderbim/blenderbim/bim/ui.py +++ b/src/blenderbim/blenderbim/bim/ui.py @@ -268,18 +268,6 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences): row.operator("bim.configure_visibility") -def ifc_units(self, context): - scene = context.scene - props = scene.BIMProperties - layout = self.layout - layout.use_property_decorate = False - layout.use_property_split = True - row = layout.row() - row.prop(props, "area_unit") - row = layout.row() - row.prop(props, "volume_unit") - - # Scene panel groups class BIM_PT_root(Panel): bl_label = "BlenderBIM Add-on" diff --git a/src/blenderbim/blenderbim/tool/drawing.py b/src/blenderbim/blenderbim/tool/drawing.py index d1a000fcec..0d96881252 100644 --- a/src/blenderbim/blenderbim/tool/drawing.py +++ b/src/blenderbim/blenderbim/tool/drawing.py @@ -1493,19 +1493,14 @@ class Drawing(blenderbim.core.tool.Drawing): # Sync viewport objects visibility with selectors from EPset_Drawing/Include and /Exclude drawing = tool.Ifc.get_entity(camera) - # Running operators is much more efficient in this scenario than looping through each element - if not bpy.app.background: - bpy.ops.object.hide_view_clear() - filtered_elements = cls.get_drawing_elements(drawing) | cls.get_drawing_spaces(drawing) - for visible_obj in bpy.context.visible_objects: - element = tool.Ifc.get_entity(visible_obj) + for view_layer_object in bpy.context.view_layer.objects: + element = tool.Ifc.get_entity(view_layer_object) if not element: continue hide = element not in filtered_elements - if bpy.context.view_layer.objects.get(visible_obj.name): - visible_obj.hide_set(hide) - visible_obj.hide_render = hide + view_layer_object.hide_set(hide) + view_layer_object.hide_render = hide subcontexts = [] target_view = cls.get_drawing_target_view(drawing)