mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
fixed properties search after 949a2bb and fixed console errors on search
1) When you search not from the SCENE properties blender creates some kind of phantom area to check search results. As this area is not present in `context.screen.areas` it was resulting in the error below.
2) After 949a2bb search in scene properties was limited to currently selected tab. Given the amount of tools we have in properties and native blender approach for searching across all available sections in properties, it seems reasonable to make search work across all tabs.
Console error was:
The error was
Python: Traceback (most recent call last):
File "\3.6\scripts\addons\blenderbim\bim\ui.py", line 281, in draw
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
ValueError: bpy.data.screens['Layout.001']...Area is not in list
This commit is contained in:
@@ -280,8 +280,8 @@ if getattr(bpy.types, "SCENE_PT_scene"):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "BLENDER"
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter
|
||||
|
||||
|
||||
if getattr(bpy.types, "SCENE_PT_unit"):
|
||||
@@ -291,8 +291,8 @@ if getattr(bpy.types, "SCENE_PT_unit"):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "BLENDER"
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter
|
||||
|
||||
|
||||
if getattr(bpy.types, "SCENE_PT_physics"):
|
||||
@@ -302,8 +302,8 @@ if getattr(bpy.types, "SCENE_PT_physics"):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "BLENDER"
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter
|
||||
|
||||
|
||||
if getattr(bpy.types, "SCENE_PT_rigid_body_world"):
|
||||
@@ -313,8 +313,8 @@ if getattr(bpy.types, "SCENE_PT_rigid_body_world"):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "BLENDER"
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter
|
||||
|
||||
|
||||
if getattr(bpy.types, "SCENE_PT_audio"):
|
||||
@@ -324,8 +324,8 @@ if getattr(bpy.types, "SCENE_PT_audio"):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "BLENDER"
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter
|
||||
|
||||
|
||||
if getattr(bpy.types, "SCENE_PT_keying_sets"):
|
||||
@@ -335,8 +335,8 @@ if getattr(bpy.types, "SCENE_PT_keying_sets"):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "BLENDER"
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter
|
||||
|
||||
|
||||
if getattr(bpy.types, "SCENE_PT_custom_props"):
|
||||
@@ -346,8 +346,8 @@ if getattr(bpy.types, "SCENE_PT_custom_props"):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "BLENDER"
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter
|
||||
|
||||
|
||||
@persistent
|
||||
|
||||
@@ -32,8 +32,8 @@ class BIM_PT_brickschema(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "OTHER"
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return aprops.tab == "OTHER" or context.area.spaces.active.search_filter
|
||||
|
||||
def draw(self, context):
|
||||
if not BrickschemaData.is_loaded:
|
||||
|
||||
@@ -167,8 +167,8 @@ class BIM_PT_drawings(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "DRAWINGS" and tool.Ifc.get()
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return (aprops.tab == "DRAWINGS" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||
|
||||
def draw(self, context):
|
||||
if not DrawingsData.is_loaded:
|
||||
@@ -236,8 +236,8 @@ class BIM_PT_schedules(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "DRAWINGS" and tool.Ifc.get()
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return (aprops.tab == "DRAWINGS" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||
|
||||
def draw(self, context):
|
||||
if not DocumentsData.is_loaded:
|
||||
@@ -292,8 +292,8 @@ class BIM_PT_references(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "DRAWINGS" and tool.Ifc.get()
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return (aprops.tab == "DRAWINGS" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||
|
||||
def draw(self, context):
|
||||
if not DocumentsData.is_loaded:
|
||||
@@ -337,8 +337,8 @@ class BIM_PT_sheets(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "DRAWINGS" and tool.Ifc.get()
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return (aprops.tab == "DRAWINGS" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||
|
||||
def draw(self, context):
|
||||
if not SheetsData.is_loaded:
|
||||
|
||||
@@ -47,7 +47,7 @@ class SwitchTab(bpy.types.Operator):
|
||||
bl_description = "Switches to the last used tab"
|
||||
|
||||
def execute(self, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
aprops.tab = aprops.alt_tab
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ class BIM_PT_root(Panel):
|
||||
bl_options = {"HIDE_HEADER"}
|
||||
|
||||
def draw(self, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
row = self.layout.row(align=True)
|
||||
row.prop(aprops, "tab", text="")
|
||||
row.operator("bim.switch_tab", text="", icon="UV_SYNC_SELECT")
|
||||
@@ -292,8 +292,8 @@ class BIM_PT_project_info(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "PROJECT"
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return aprops.tab == "PROJECT" or context.area.spaces.active.search_filter
|
||||
|
||||
def draw(self, context):
|
||||
pass
|
||||
@@ -308,8 +308,8 @@ class BIM_PT_project_setup(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "PROJECT"
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return aprops.tab == "PROJECT" or context.area.spaces.active.search_filter
|
||||
|
||||
def draw(self, context):
|
||||
pass
|
||||
@@ -324,8 +324,8 @@ class BIM_PT_collaboration(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "OTHER"
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return aprops.tab == "OTHER" or context.area.spaces.active.search_filter
|
||||
|
||||
def draw(self, context):
|
||||
pass
|
||||
@@ -340,8 +340,8 @@ class BIM_PT_selection(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "PROJECT" and tool.Ifc.get()
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return (aprops.tab == "PROJECT" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||
|
||||
def draw(self, context):
|
||||
pass
|
||||
@@ -356,8 +356,8 @@ class BIM_PT_geometry(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "PROJECT" and tool.Ifc.get()
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return (aprops.tab == "PROJECT" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||
|
||||
def draw(self, context):
|
||||
pass
|
||||
@@ -372,8 +372,8 @@ class BIM_PT_4D5D(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "SCHEDULING" and tool.Ifc.get()
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return (aprops.tab == "SCHEDULING" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||
|
||||
def draw(self, context):
|
||||
pass
|
||||
@@ -388,8 +388,8 @@ class BIM_PT_structural(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "STRUCTURE" and tool.Ifc.get()
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return (aprops.tab == "STRUCTURE" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||
|
||||
def draw(self, context):
|
||||
pass
|
||||
@@ -404,8 +404,8 @@ class BIM_PT_services(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "SERVICES" and tool.Ifc.get()
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return (aprops.tab == "SERVICES" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||
|
||||
def draw(self, context):
|
||||
pass
|
||||
@@ -420,8 +420,8 @@ class BIM_PT_quality_control(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "OTHER"
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return aprops.tab == "OTHER" or context.area.spaces.active.search_filter
|
||||
|
||||
def draw(self, context):
|
||||
pass
|
||||
@@ -436,8 +436,8 @@ class BIM_PT_integrations(Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
||||
return aprops.tab == "OTHER"
|
||||
aprops = tool.Blender.get_area_properties(context)
|
||||
return aprops.tab == "OTHER" or context.area.spaces.active.search_filter
|
||||
|
||||
def draw(self, context):
|
||||
pass
|
||||
|
||||
@@ -151,6 +151,18 @@ class Blender:
|
||||
for attr in VIEWPORT_ATTRIBUTES:
|
||||
setattr(region_3d, attr, data[attr])
|
||||
|
||||
@classmethod
|
||||
def get_area_properties(cls, context):
|
||||
areas = context.screen.areas[:]
|
||||
current_area = context.area
|
||||
# if user is using search from different properties tab (not SCENE)
|
||||
# it will create new area that's not present in context.screen.areas
|
||||
if current_area not in areas:
|
||||
current_area = next(a for a in context.screen.areas if a.x == current_area.x and a.y == current_area.y)
|
||||
area_i = areas.index(current_area)
|
||||
|
||||
return context.screen.BIMAreaProperties[area_i]
|
||||
|
||||
@classmethod
|
||||
def get_shader_editor_context(cls):
|
||||
for screen in bpy.data.screens:
|
||||
|
||||
Reference in New Issue
Block a user