Fix registration bug that created hundreds of workspaces due to continuous triggering of the depsgraph_update.

Use an is_registering check to only run the on_register once.

Rename setDefaultProperties to load_post to better reflect what handler it is.

Unregister our custom scene panels upon addon activation.

Move aprops getting to tool.Blender because it is a bit complex. Also, aprops may not be setup until load_post is called, so the len() check protects against that.
This commit is contained in:
Dion Moult
2023-07-11 17:40:13 +10:00
parent 86dd79daa6
commit 8689164769
6 changed files with 66 additions and 52 deletions
@@ -167,8 +167,7 @@ class BIM_PT_drawings(Panel):
@classmethod
def poll(cls, context):
aprops = tool.Blender.get_area_properties(context)
return (aprops.tab == "DRAWINGS" or context.area.spaces.active.search_filter) and tool.Ifc.get()
return tool.Blender.is_tab(context, "DRAWINGS") and tool.Ifc.get()
def draw(self, context):
if not DrawingsData.is_loaded:
@@ -236,8 +235,7 @@ class BIM_PT_schedules(Panel):
@classmethod
def poll(cls, context):
aprops = tool.Blender.get_area_properties(context)
return (aprops.tab == "DRAWINGS" or context.area.spaces.active.search_filter) and tool.Ifc.get()
return tool.Blender.is_tab(context, "DRAWINGS") and tool.Ifc.get()
def draw(self, context):
if not DocumentsData.is_loaded:
@@ -292,8 +290,7 @@ class BIM_PT_references(Panel):
@classmethod
def poll(cls, context):
aprops = tool.Blender.get_area_properties(context)
return (aprops.tab == "DRAWINGS" or context.area.spaces.active.search_filter) and tool.Ifc.get()
return tool.Blender.is_tab(context, "DRAWINGS") and tool.Ifc.get()
def draw(self, context):
if not DocumentsData.is_loaded:
@@ -337,8 +334,7 @@ class BIM_PT_sheets(Panel):
@classmethod
def poll(cls, context):
aprops = tool.Blender.get_area_properties(context)
return (aprops.tab == "DRAWINGS" or context.area.spaces.active.search_filter) and tool.Ifc.get()
return tool.Blender.is_tab(context, "DRAWINGS") and tool.Ifc.get()
def draw(self, context):
if not SheetsData.is_loaded: