The goal here is to simplify working with the common pattern where a Menu Switch node is followed by an Index Switch node. This is achieved by detecting this pattern and drawing the item names from the menu switch node in the index switch node. This slightly refactors the custom socket drawing callback to make it easier for it indirectly call the default drawing function. Pull Request: https://projects.blender.org/blender/blender/pulls/145710
52 lines
1.9 KiB
C++
52 lines
1.9 KiB
C++
/* SPDX-FileCopyrightText: 2025 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
#include "BKE_compute_context_cache_fwd.hh"
|
|
|
|
#include "BLI_compute_context.hh"
|
|
|
|
#include "DNA_node_types.h"
|
|
|
|
#include "NOD_geometry_nodes_bundle_signature.hh"
|
|
#include "NOD_geometry_nodes_closure_location.hh"
|
|
#include "NOD_geometry_nodes_closure_signature.hh"
|
|
#include "NOD_node_in_compute_context.hh"
|
|
|
|
namespace blender::nodes {
|
|
|
|
/**
|
|
* Attempts to find a compute context that the closure is evaluated in. If none is found, null is
|
|
* returned. If multiple are found, it currently picks the first one it finds which is somewhat
|
|
* arbitrary.
|
|
*/
|
|
[[nodiscard]] const ComputeContext *compute_context_for_closure_evaluation(
|
|
const ComputeContext *closure_socket_context,
|
|
const bNodeSocket &closure_socket,
|
|
bke::ComputeContextCache &compute_context_cache,
|
|
const std::optional<ClosureSourceLocation> &source_location);
|
|
|
|
LinkedBundleSignatures gather_linked_target_bundle_signatures(
|
|
const ComputeContext *bundle_socket_context,
|
|
const bNodeSocket &bundle_socket,
|
|
bke::ComputeContextCache &compute_context_cache);
|
|
LinkedBundleSignatures gather_linked_origin_bundle_signatures(
|
|
const ComputeContext *bundle_socket_context,
|
|
const bNodeSocket &bundle_socket,
|
|
bke::ComputeContextCache &compute_context_cache);
|
|
LinkedClosureSignatures gather_linked_target_closure_signatures(
|
|
const ComputeContext *closure_socket_context,
|
|
const bNodeSocket &closure_socket,
|
|
bke::ComputeContextCache &compute_context_cache);
|
|
LinkedClosureSignatures gather_linked_origin_closure_signatures(
|
|
const ComputeContext *closure_socket_context,
|
|
const bNodeSocket &closure_socket,
|
|
bke::ComputeContextCache &compute_context_cache);
|
|
|
|
std::optional<NodeInContext> find_origin_index_menu_switch(
|
|
const SocketInContext &socket, bke::ComputeContextCache &compute_context_cache);
|
|
|
|
} // namespace blender::nodes
|