[Bf-blender-cvs] [02765a86cca] functions: create pack list node if certain type from search

Jacques Lucke noreply at git.blender.org
Mon Apr 1 10:33:18 CEST 2019


Commit: 02765a86ccaa21f551751bfa2d2ba15e7425ec77
Author: Jacques Lucke
Date:   Mon Apr 1 10:20:19 2019 +0200
Branches: functions
https://developer.blender.org/rB02765a86ccaa21f551751bfa2d2ba15e7425ec77

create pack list node if certain type from search

===================================================================

M	release/scripts/startup/function_nodes/base.py
M	release/scripts/startup/function_nodes/nodes/pack_list.py
M	release/scripts/startup/function_nodes/types_base.py

===================================================================

diff --git a/release/scripts/startup/function_nodes/base.py b/release/scripts/startup/function_nodes/base.py
index 1f697fdd4a2..b8402efa239 100644
--- a/release/scripts/startup/function_nodes/base.py
+++ b/release/scripts/startup/function_nodes/base.py
@@ -118,9 +118,15 @@ class BaseNode:
         for decl in self.decl_map.iter_decls():
             decl.draw_node(layout)
 
+    def draw_buttons_ext(self, context, layout):
+        self.draw_advanced(layout)
+
     def draw(self, layout):
         pass
 
+    def draw_advanced(self, layout):
+        pass
+
     def invoke_function(self,
             layout, function_name, text,
             *, icon="NONE", settings=tuple()):
diff --git a/release/scripts/startup/function_nodes/nodes/pack_list.py b/release/scripts/startup/function_nodes/nodes/pack_list.py
index eaff15ee9c3..8b4aaacbd37 100644
--- a/release/scripts/startup/function_nodes/nodes/pack_list.py
+++ b/release/scripts/startup/function_nodes/nodes/pack_list.py
@@ -18,8 +18,14 @@ class PackListNode(bpy.types.Node, FunctionNode):
         builder.pack_list_input("inputs", "variadic", self.active_type)
         builder.fixed_output("output", "List", type_infos.to_list(self.active_type))
 
-    def draw(self, layout):
+    def draw_advanced(self, layout):
         self.invoke_type_selection(layout, "set_type", "Change Type", mode="BASE")
 
     def set_type(self, data_type):
-        self.active_type = data_type
\ No newline at end of file
+        self.active_type = data_type
+
+    @classmethod
+    def get_search_terms(cls):
+        for list_type in type_infos.iter_list_types():
+            base_type = type_infos.to_base(list_type)
+            yield ("Pack " + list_type, {"active_type" : base_type})
\ No newline at end of file
diff --git a/release/scripts/startup/function_nodes/types_base.py b/release/scripts/startup/function_nodes/types_base.py
index 962d7575953..b5e990593e0 100644
--- a/release/scripts/startup/function_nodes/types_base.py
+++ b/release/scripts/startup/function_nodes/types_base.py
@@ -87,7 +87,7 @@ class DataTypesInfo:
 
     def get_base_type_items(self):
         items = []
-        for data_type in self.list_by_base.keys():
+        for data_type in self.iter_base_types():
             items.append((data_type, data_type, ""))
         return items
 
@@ -112,6 +112,12 @@ class DataTypesInfo:
     def is_implicitly_convertable(self, from_type, to_type):
         return ImplicitConversion(from_type, to_type) in self.implicit_conversions
 
+    def iter_list_types(self):
+        yield from self.base_by_list.keys()
+
+    def iter_base_types(self):
+        yield from self.list_by_base.keys()
+
 
 # Data Socket Builders
 ##################################3



More information about the Bf-blender-cvs mailing list