Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-09-19 19:57:10 +0300
committerHans Goudey <h.goudey@me.com>2022-09-19 19:57:10 +0300
commitbdb57541475f20ccc4f6e5f8fc075ac424becc19 (patch)
treeb09f860cedf50ccbf6b1234d0b1d414944ff1525 /release
parent862de9187f1b914358c33dd9700e338f0174bbf0 (diff)
Nodes: Add node group assets to search menus
Currently node group assets are supported, but using them by dragging from the asset browser is cumbersome. This patch adds all node group assets from user asset libraries and the current file libraries to the add node search menu and the link drag search menu. Node groups added through the search will have their "options" hidden, meaning the data-block selector is displayed. This helps keep the UI clean, and the selector shouldn't be necessary anyway. To make that possible, metadata like the node tree type and its inputs and outputs has to be saved in the file. This requires re-saving the files that contain the assets with the patch applied. The node add search operator is moved from Python to C++ to ease development and allow more flexibility. It supports a tooltip that gives the description of assets. Currently the node groups are added with the asset system's existing "Append & Reuse" behavior. It's likely that linking should be possible in the future too, but for now the idea is to use the more foolproof option that doesn't create dependencies between files. Because loading assets can potentially take a long time, the search menu refreshes its items as new assets are loaded. However, changing the search field is necessary to see the update. Differential Revision: https://developer.blender.org/D15568
Diffstat (limited to 'release')
-rw-r--r--release/scripts/startup/bl_operators/node.py73
1 files changed, 0 insertions, 73 deletions
diff --git a/release/scripts/startup/bl_operators/node.py b/release/scripts/startup/bl_operators/node.py
index ff9b5a06fb7..5cc9c850ebe 100644
--- a/release/scripts/startup/bl_operators/node.py
+++ b/release/scripts/startup/bl_operators/node.py
@@ -149,78 +149,6 @@ class NODE_OT_add_node(NodeAddOperator, Operator):
bl_options = {'REGISTER', 'UNDO'}
-class NODE_OT_add_search(NodeAddOperator, Operator):
- '''Add a node to the active tree'''
- bl_idname = "node.add_search"
- bl_label = "Search and Add Node"
- bl_options = {'REGISTER', 'UNDO'}
- bl_property = "node_item"
-
- _enum_item_hack = []
-
- # Create an enum list from node items
- def node_enum_items(self, context):
- import nodeitems_utils
-
- enum_items = NODE_OT_add_search._enum_item_hack
- enum_items.clear()
-
- for index, item in enumerate(nodeitems_utils.node_items_iter(context)):
- if isinstance(item, nodeitems_utils.NodeItem):
- enum_items.append(
- (str(index),
- item.label,
- "",
- index,
- ))
- return enum_items
-
- # Look up the item based on index
- def find_node_item(self, context):
- import nodeitems_utils
-
- node_item = int(self.node_item)
- for index, item in enumerate(nodeitems_utils.node_items_iter(context)):
- if index == node_item:
- return item
- return None
-
- node_item: EnumProperty(
- name="Node Type",
- description="Node type",
- items=NODE_OT_add_search.node_enum_items,
- )
-
- def execute(self, context):
- item = self.find_node_item(context)
-
- # no need to keep
- self._enum_item_hack.clear()
-
- if item:
- # apply settings from the node item
- for setting in item.settings.items():
- ops = self.settings.add()
- ops.name = setting[0]
- ops.value = setting[1]
-
- self.create_node(context, item.nodetype)
-
- if self.use_transform:
- bpy.ops.node.translate_attach_remove_on_cancel(
- 'INVOKE_DEFAULT')
-
- return {'FINISHED'}
- else:
- return {'CANCELLED'}
-
- def invoke(self, context, event):
- self.store_mouse_cursor(context, event)
- # Delayed execution in the search popup
- context.window_manager.invoke_search_popup(self)
- return {'CANCELLED'}
-
-
class NODE_OT_collapse_hide_unused_toggle(Operator):
'''Toggle collapsed nodes and hide unused sockets'''
bl_idname = "node.collapse_hide_unused_toggle"
@@ -276,7 +204,6 @@ classes = (
NodeSetting,
NODE_OT_add_node,
- NODE_OT_add_search,
NODE_OT_collapse_hide_unused_toggle,
NODE_OT_tree_path_parent,
)