So here is the setup:
My addon requires very specific collection structures and naming conventions. I need to be able to detect if the user has made a change to the scene collection structure, then run some kind of checker.py script with an execute function.
I've seen questions out there like this one, however they only talk about detecting switching between scenes, not changes within a scene's collection structure: How can i detect a scene change from python?
My initial approach within a menu panel looks something like this:
class BMNFTS_PT_MainPanel(bpy.types.Panel):
bl_label = "Blend_My_NFTs"
bl_idname = "PT_MainPanel"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = 'Blend_My_NFTs'
def draw(self, context): [...]
def execute(self, context):
magic_scene_detection = bpy. # Some magic scene change detection
if magic_scene_detection:
checker()
magic_scene_detection = False
return {'FINISHED'}
My thinking is that the magic_scene_detection
variable would somehow equal True
if bpy.ops.outliner
was called and if any of the ops in this page were used:
With that said, I sort of have two questions:
- How do you actively check if a change was made to a the scene (i.e a collection was created, an object was moved, the name of a collection was changed, etc.)? What goes into that
magic_scene_detection
variable? - Is this the proper approach for a repeatable 'active' checker system? Or is there some other method with
invoke
I'm unaware of?
Thank you, I appreciate your time