menu_classes.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. from bpy.types import Panel, Menu
  2. def TellClasses():
  3. return [
  4. MantisActiveTreePanel,
  5. ]
  6. class MantisActiveTreePanel(Panel):
  7. """N-Panel menu for Mantis"""
  8. bl_label = "Active Tree"
  9. bl_idname = "MANTIS_PT_active_tree"
  10. bl_space_type = 'NODE_EDITOR'
  11. bl_region_type = 'UI'
  12. bl_category = "Mantis"
  13. bl_context = "scene"
  14. @classmethod
  15. def poll(cls, context):
  16. area = context.area
  17. if not area: return False
  18. if not area.spaces: return False
  19. spc = area.spaces[0]
  20. if spc.type != "NODE_EDITOR":
  21. return False
  22. if spc.node_tree.bl_idname != "MantisTree":
  23. return False
  24. return True
  25. def draw(self, context):
  26. area = context.area
  27. spc = area.spaces[0]
  28. nt = spc.node_tree
  29. layout = self.layout
  30. layout.label(text=f"Tree Hash: {nt.hash}")
  31. layout.prop(nt, "do_live_update", text='Live Updates',)
  32. layout.operator("mantis.invalidate_node_tree")
  33. layout.operator("mantis.execute_node_tree")
  34. layout.operator("mantis.force_display_update", text='Force Display Update')