diff --git a/src/blenderbim/blenderbim/bim/handler.py b/src/blenderbim/blenderbim/bim/handler.py index 743fb0797d..0f6a3707fa 100644 --- a/src/blenderbim/blenderbim/bim/handler.py +++ b/src/blenderbim/blenderbim/bim/handler.py @@ -280,8 +280,7 @@ if getattr(bpy.types, "SCENE_PT_scene"): @classmethod def poll(cls, context): - aprops = tool.Blender.get_area_properties(context) - return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter + return tool.Blender.is_tab(context, "BLENDER") if getattr(bpy.types, "SCENE_PT_unit"): @@ -291,8 +290,7 @@ if getattr(bpy.types, "SCENE_PT_unit"): @classmethod def poll(cls, context): - aprops = tool.Blender.get_area_properties(context) - return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter + return tool.Blender.is_tab(context, "BLENDER") if getattr(bpy.types, "SCENE_PT_physics"): @@ -302,8 +300,7 @@ if getattr(bpy.types, "SCENE_PT_physics"): @classmethod def poll(cls, context): - aprops = tool.Blender.get_area_properties(context) - return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter + return tool.Blender.is_tab(context, "BLENDER") if getattr(bpy.types, "SCENE_PT_rigid_body_world"): @@ -313,8 +310,7 @@ if getattr(bpy.types, "SCENE_PT_rigid_body_world"): @classmethod def poll(cls, context): - aprops = tool.Blender.get_area_properties(context) - return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter + return tool.Blender.is_tab(context, "BLENDER") if getattr(bpy.types, "SCENE_PT_audio"): @@ -324,8 +320,7 @@ if getattr(bpy.types, "SCENE_PT_audio"): @classmethod def poll(cls, context): - aprops = tool.Blender.get_area_properties(context) - return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter + return tool.Blender.is_tab(context, "BLENDER") if getattr(bpy.types, "SCENE_PT_keying_sets"): @@ -335,8 +330,7 @@ if getattr(bpy.types, "SCENE_PT_keying_sets"): @classmethod def poll(cls, context): - aprops = tool.Blender.get_area_properties(context) - return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter + return tool.Blender.is_tab(context, "BLENDER") if getattr(bpy.types, "SCENE_PT_custom_props"): @@ -346,8 +340,7 @@ if getattr(bpy.types, "SCENE_PT_custom_props"): @classmethod def poll(cls, context): - aprops = tool.Blender.get_area_properties(context) - return aprops.tab == "BLENDER" or context.area.spaces.active.search_filter + return tool.Blender.is_tab(context, "BLENDER") @persistent diff --git a/src/blenderbim/blenderbim/bim/operator.py b/src/blenderbim/blenderbim/bim/operator.py index fb10036b9d..75a8875c5e 100644 --- a/src/blenderbim/blenderbim/bim/operator.py +++ b/src/blenderbim/blenderbim/bim/operator.py @@ -47,7 +47,9 @@ class SwitchTab(bpy.types.Operator): bl_description = "Switches to the last used tab" def execute(self, context): - aprops = tool.Blender.get_area_properties(context) + if context.area.spaces.active.search_filter: + return {"FINISHED"} + aprops = context.screen.BIMAreaProperties[context.screen.areas[:].index(context.area)] aprops.tab = aprops.alt_tab return {"FINISHED"}