Browse Source

UI: New N-Panel menu for Mantis

Joseph Brandenburg 4 tháng trước cách đây
mục cha
commit
a7b445bec1
2 tập tin đã thay đổi với 37 bổ sung0 xóa
  1. 2 0
      __init__.py
  2. 35 0
      menu_classes.py

+ 2 - 0
__init__.py

@@ -9,6 +9,7 @@ from . import ( ops_nodegroup,
                 math_definitions,
                 i_o,
                 schema_definitions,
+                menu_classes,
               )
 from .ops_generate_tree import GenerateMantisTree
 
@@ -30,6 +31,7 @@ classLists = [module.TellClasses() for module in [
  i_o,
  schema_definitions,
  base_definitions,
+ menu_classes,
 ]]
 classLists.append( [GenerateMantisTree] )
 #

+ 35 - 0
menu_classes.py

@@ -0,0 +1,35 @@
+from bpy.types import Panel
+
+def TellClasses():
+    return [
+        MantisActiveTreePanel,
+    ]
+
+class MantisActiveTreePanel(Panel):
+    """N-Panel menu for Mantis"""
+    bl_label = "Active Tree"
+    bl_idname = "MANTIS_PT_active_tree"
+    bl_space_type = 'NODE_EDITOR'
+    bl_region_type = 'UI'
+    bl_category = "Mantis"
+    bl_context = "scene"
+    
+    @classmethod
+    def poll(cls, context):
+        area = context.area
+        if not area: return False
+        if not area.spaces: return False
+        spc = area.spaces[0]
+        if spc.type != "NODE_EDITOR":
+            return False
+        if spc.node_tree.bl_idname != "MantisTree":
+            return False
+        return True
+    
+    def draw(self, context):
+        area = context.area
+        spc = area.spaces[0]
+        nt = spc.node_tree
+        layout = self.layout
+        layout.prop(nt, "do_live_update", text='Live Updates',)
+        layout.operator("mantis.execute_node_tree")