Blender V4.3
node_geometry_util.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
6#include "node_util.hh"
7
8#include "DNA_space_types.h"
9
10#include "BKE_node.hh"
11
12#include "NOD_rna_define.hh"
13#include "NOD_socket.hh"
15
16#include "RNA_access.hh"
17#include "RNA_enum_types.hh"
18
19namespace blender::nodes {
20
22{
23 if (!params.user_data()->call_data->operator_data) {
24 params.error_message_add(NodeWarningType::Error, TIP_("Node must be run as tool"));
25 params.set_default_remaining_outputs();
26 return false;
27 }
28 return true;
29}
30
37
44
46{
47 if (U.experimental.use_new_file_import_nodes) {
49 }
50}
51
52namespace enums {
53
55 PointerRNA * /*ptr*/,
56 PropertyRNA * /*prop*/,
57 bool *r_free)
58{
59 *r_free = true;
60 return enum_items_filter(
61 rna_enum_attribute_type_items, [](const EnumPropertyItem &item) -> bool {
64 });
65}
66
81
82} // namespace enums
83
85{
86 if (const std::optional<eNodeSocketDatatype> socket_type = bke::custom_data_type_to_socket_type(
87 data_type))
88 {
89 return socket_type_supports_grids(*socket_type);
90 }
91 return false;
92}
93
95 PointerRNA * /*ptr*/,
96 PropertyRNA * /*prop*/,
97 bool *r_free)
98{
99 *r_free = true;
101 [](const EnumPropertyItem &item) -> bool {
103 });
104}
105
107 PointerRNA * /*ptr*/,
108 PropertyRNA * /*prop*/,
109 bool *r_free)
110{
111 *r_free = true;
113 [](const EnumPropertyItem &item) -> bool {
115 });
116}
117
119{
120 params.set_default_remaining_outputs();
121 params.error_message_add(NodeWarningType::Error,
122 TIP_("Disabled, Blender was compiled without OpenVDB"));
123}
124
125} // namespace blender::nodes
126
128 const bNodeTree *ntree,
129 const char **r_disabled_hint)
130{
131 if (!STREQ(ntree->idname, "GeometryNodeTree")) {
132 *r_disabled_hint = RPT_("Not a geometry node tree");
133 return false;
134 }
135 return true;
136}
137
138void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
139{
140 blender::bke::node_type_base(ntype, type, name, nclass);
144}
#define ELEM(...)
#define STREQ(a, b)
#define RPT_(msgid)
#define TIP_(msgid)
@ CD_PROP_BYTE_COLOR
@ CD_PROP_FLOAT
@ CD_PROP_FLOAT3
@ CD_PROP_COLOR
@ CD_PROP_QUATERNION
@ CD_PROP_INT32
@ CD_PROP_FLOAT2
@ CD_PROP_FLOAT4X4
eNodeSocketDatatype
@ SNODE_GEOMETRY_TOOL
unsigned int U
Definition btGjkEpa3.h:78
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
std::optional< eNodeSocketDatatype > custom_data_type_to_socket_type(eCustomDataType type)
Definition node.cc:4403
void node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
Definition node.cc:4325
bool generic_attribute_type_supported(const EnumPropertyItem &item)
const EnumPropertyItem * attribute_type_type_with_socket_fn(bContext *, PointerRNA *, PropertyRNA *, bool *r_free)
bool custom_data_type_supports_grids(const eCustomDataType data_type)
void search_link_ops_for_tool_node(GatherLinkSearchOpParams &params)
void search_link_ops_for_basic_node(GatherLinkSearchOpParams &params)
bool check_tool_context_and_error(GeoNodeExecParams &params)
void search_link_ops_for_import_node(GatherLinkSearchOpParams &params)
const EnumPropertyItem * grid_custom_data_type_items_filter_fn(bContext *, PointerRNA *, PropertyRNA *, bool *r_free)
const EnumPropertyItem * grid_socket_type_items_filter_fn(bContext *, PointerRNA *, PropertyRNA *, bool *r_free)
void search_link_ops_for_volume_grid_node(GatherLinkSearchOpParams &params)
void node_geo_exec_with_missing_openvdb(GeoNodeExecParams &params)
bool socket_type_supports_grids(const eNodeSocketDatatype socket_type)
const EnumPropertyItem * enum_items_filter(const EnumPropertyItem *original_item_array, FunctionRef< bool(const EnumPropertyItem &item)> fn)
void geo_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
bool geo_node_poll_default(const blender::bke::bNodeType *, const bNodeTree *ntree, const char **r_disabled_hint)
bool node_insert_link_default(bNodeTree *, bNode *, bNodeLink *)
Definition node_util.cc:281
const EnumPropertyItem rna_enum_attribute_type_items[]
const EnumPropertyItem rna_enum_node_socket_data_type_items[]
char idname[64]
Defines a node type.
Definition BKE_node.hh:218
bool(* poll)(const bNodeType *ntype, const bNodeTree *nodetree, const char **r_disabled_hint)
Definition BKE_node.hh:299
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
Definition BKE_node.hh:363
bool(* insert_link)(bNodeTree *ntree, bNode *node, bNodeLink *link)
Definition BKE_node.hh:309