mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +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
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "BLENDER"
|
return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter
|
||||||
|
|
||||||
|
|
||||||
if getattr(bpy.types, "SCENE_PT_unit"):
|
if getattr(bpy.types, "SCENE_PT_unit"):
|
||||||
@@ -291,8 +291,8 @@ if getattr(bpy.types, "SCENE_PT_unit"):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "BLENDER"
|
return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter
|
||||||
|
|
||||||
|
|
||||||
if getattr(bpy.types, "SCENE_PT_physics"):
|
if getattr(bpy.types, "SCENE_PT_physics"):
|
||||||
@@ -302,8 +302,8 @@ if getattr(bpy.types, "SCENE_PT_physics"):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "BLENDER"
|
return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter
|
||||||
|
|
||||||
|
|
||||||
if getattr(bpy.types, "SCENE_PT_rigid_body_world"):
|
if getattr(bpy.types, "SCENE_PT_rigid_body_world"):
|
||||||
@@ -313,8 +313,8 @@ if getattr(bpy.types, "SCENE_PT_rigid_body_world"):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "BLENDER"
|
return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter
|
||||||
|
|
||||||
|
|
||||||
if getattr(bpy.types, "SCENE_PT_audio"):
|
if getattr(bpy.types, "SCENE_PT_audio"):
|
||||||
@@ -324,8 +324,8 @@ if getattr(bpy.types, "SCENE_PT_audio"):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "BLENDER"
|
return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter
|
||||||
|
|
||||||
|
|
||||||
if getattr(bpy.types, "SCENE_PT_keying_sets"):
|
if getattr(bpy.types, "SCENE_PT_keying_sets"):
|
||||||
@@ -335,8 +335,8 @@ if getattr(bpy.types, "SCENE_PT_keying_sets"):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "BLENDER"
|
return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter
|
||||||
|
|
||||||
|
|
||||||
if getattr(bpy.types, "SCENE_PT_custom_props"):
|
if getattr(bpy.types, "SCENE_PT_custom_props"):
|
||||||
@@ -346,8 +346,8 @@ if getattr(bpy.types, "SCENE_PT_custom_props"):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "BLENDER"
|
return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter
|
||||||
|
|
||||||
|
|
||||||
@persistent
|
@persistent
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ class BIM_PT_brickschema(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "OTHER"
|
return aprops.tab == "OTHER" or context.area.spaces.active.search_filter
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not BrickschemaData.is_loaded:
|
if not BrickschemaData.is_loaded:
|
||||||
|
|||||||
@@ -167,8 +167,8 @@ class BIM_PT_drawings(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "DRAWINGS" and tool.Ifc.get()
|
return (aprops.tab == "DRAWINGS" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not DrawingsData.is_loaded:
|
if not DrawingsData.is_loaded:
|
||||||
@@ -236,8 +236,8 @@ class BIM_PT_schedules(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "DRAWINGS" and tool.Ifc.get()
|
return (aprops.tab == "DRAWINGS" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not DocumentsData.is_loaded:
|
if not DocumentsData.is_loaded:
|
||||||
@@ -292,8 +292,8 @@ class BIM_PT_references(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "DRAWINGS" and tool.Ifc.get()
|
return (aprops.tab == "DRAWINGS" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not DocumentsData.is_loaded:
|
if not DocumentsData.is_loaded:
|
||||||
@@ -337,8 +337,8 @@ class BIM_PT_sheets(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "DRAWINGS" and tool.Ifc.get()
|
return (aprops.tab == "DRAWINGS" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
if not SheetsData.is_loaded:
|
if not SheetsData.is_loaded:
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class SwitchTab(bpy.types.Operator):
|
|||||||
bl_description = "Switches to the last used tab"
|
bl_description = "Switches to the last used tab"
|
||||||
|
|
||||||
def execute(self, context):
|
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
|
aprops.tab = aprops.alt_tab
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ class BIM_PT_root(Panel):
|
|||||||
bl_options = {"HIDE_HEADER"}
|
bl_options = {"HIDE_HEADER"}
|
||||||
|
|
||||||
def draw(self, context):
|
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 = self.layout.row(align=True)
|
||||||
row.prop(aprops, "tab", text="")
|
row.prop(aprops, "tab", text="")
|
||||||
row.operator("bim.switch_tab", text="", icon="UV_SYNC_SELECT")
|
row.operator("bim.switch_tab", text="", icon="UV_SYNC_SELECT")
|
||||||
@@ -292,8 +292,8 @@ class BIM_PT_project_info(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "PROJECT"
|
return aprops.tab == "PROJECT" or context.area.spaces.active.search_filter
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
pass
|
pass
|
||||||
@@ -308,8 +308,8 @@ class BIM_PT_project_setup(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "PROJECT"
|
return aprops.tab == "PROJECT" or context.area.spaces.active.search_filter
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
pass
|
pass
|
||||||
@@ -324,8 +324,8 @@ class BIM_PT_collaboration(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "OTHER"
|
return aprops.tab == "OTHER" or context.area.spaces.active.search_filter
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
pass
|
pass
|
||||||
@@ -340,8 +340,8 @@ class BIM_PT_selection(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "PROJECT" and tool.Ifc.get()
|
return (aprops.tab == "PROJECT" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
pass
|
pass
|
||||||
@@ -356,8 +356,8 @@ class BIM_PT_geometry(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "PROJECT" and tool.Ifc.get()
|
return (aprops.tab == "PROJECT" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
pass
|
pass
|
||||||
@@ -372,8 +372,8 @@ class BIM_PT_4D5D(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "SCHEDULING" and tool.Ifc.get()
|
return (aprops.tab == "SCHEDULING" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
pass
|
pass
|
||||||
@@ -388,8 +388,8 @@ class BIM_PT_structural(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "STRUCTURE" and tool.Ifc.get()
|
return (aprops.tab == "STRUCTURE" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
pass
|
pass
|
||||||
@@ -404,8 +404,8 @@ class BIM_PT_services(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "SERVICES" and tool.Ifc.get()
|
return (aprops.tab == "SERVICES" or context.area.spaces.active.search_filter) and tool.Ifc.get()
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
pass
|
pass
|
||||||
@@ -420,8 +420,8 @@ class BIM_PT_quality_control(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "OTHER"
|
return aprops.tab == "OTHER" or context.area.spaces.active.search_filter
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
pass
|
pass
|
||||||
@@ -436,8 +436,8 @@ class BIM_PT_integrations(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)]
|
aprops = tool.Blender.get_area_properties(context)
|
||||||
return aprops.tab == "OTHER"
|
return aprops.tab == "OTHER" or context.area.spaces.active.search_filter
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -151,6 +151,18 @@ class Blender:
|
|||||||
for attr in VIEWPORT_ATTRIBUTES:
|
for attr in VIEWPORT_ATTRIBUTES:
|
||||||
setattr(region_3d, attr, data[attr])
|
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
|
@classmethod
|
||||||
def get_shader_editor_context(cls):
|
def get_shader_editor_context(cls):
|
||||||
for screen in bpy.data.screens:
|
for screen in bpy.data.screens:
|
||||||
|
|||||||
Reference in New Issue
Block a user