Blender V5.3
link_drag_search.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
8
9#include "AS_asset_library.hh"
11
12#include "BLI_listbase.hh"
13#include "BLI_string_utf8.hh"
14
15#include "DNA_space_types.h"
16
17#include "BKE_asset.hh"
18#include "BKE_context.hh"
19#include "BKE_idprop.hh"
20#include "BKE_lib_id.hh"
22#include "BKE_node_runtime.hh"
24#include "BKE_screen.hh"
25
26#include "UI_string_search.hh"
27
28#include "NOD_socket.hh"
30
31#include "BLT_translation.hh"
32
33#include "WM_api.hh"
34
36
37#include "ED_asset.hh"
38#include "ED_node.hh"
39#include "ED_screen.hh"
40
41#include "RNA_access.hh"
42#include "RNA_define.hh"
43#include "RNA_prototypes.hh"
44
45#include "node_intern.hh"
46
47namespace blender {
48
50
51namespace ed::space_node {
52
66
67static void link_drag_search_listen_fn(const wmRegionListenerParams *params, void *arg)
68{
70 const wmNotifier *wmn = params->notifier;
71
72 switch (wmn->category) {
73 case NC_ASSET:
74 if (wmn->data == ND_ASSET_LIST_READING) {
75 storage.update_items_tag = true;
76 }
77 break;
78 }
79}
80
82{
83 bNode &reroute = params.add_node("NodeReroute"_ustr);
84 if (params.socket.in_out == SOCK_IN) {
86 params.node_tree, reroute, *reroute.outputs.first(), params.node, params.socket);
87 }
88 else {
90 params.node_tree, params.node, params.socket, reroute, *reroute.inputs.first());
91 }
92}
93
95{
96 /* Add a group input based on the connected socket, and add a new group input node. */
98 params.node_tree, params.node, params.socket, params.socket.name);
99
100 params.node_tree.tree_interface.foreach_item([&](bNodeTreeInterfaceItem &item) {
101 item.set_selected(false);
102 return true;
103 });
104
105 params.node_tree.tree_interface.active_item_set(&socket_iface->item);
106
107 bNode &group_input = params.add_node("NodeGroupInput"_ustr);
108
109 /* This is necessary to create the new sockets in the other input nodes. */
111
112 /* Hide the new input in all other group input nodes, to avoid making them taller. */
113 for (bNode *node : params.node_tree.all_nodes()) {
114 if (node->is_group_input()) {
115 bNodeSocket *new_group_input_socket = bke::node_find_socket(
116 *node, SOCK_OUT, UString(socket_iface->identifier));
117 if (new_group_input_socket) {
118 new_group_input_socket->flag |= SOCK_HIDDEN;
119 }
120 }
121 }
122
123 /* Hide all existing inputs in the new group input node, to only display the new one. */
124 for (bNodeSocket &socket : group_input.outputs) {
125 socket.flag |= SOCK_HIDDEN;
126 }
127
129 group_input, SOCK_OUT, UString(socket_iface->identifier));
130 if (socket) {
131 /* Unhide the socket for the new input in the new node and make a connection to it. */
132 socket->flag &= ~SOCK_HIDDEN;
133 bke::node_add_link(params.node_tree, group_input, *socket, params.node, params.socket);
134
136 *CTX_data_main(&params.C), params.node_tree, params.socket, *socket);
137 }
138}
139
141 const bNodeTreeInterfaceSocket &interface_socket)
142{
143 const eNodeSocketInOut in_out = eNodeSocketInOut(params.socket.in_out);
147
148 bNode &group_input = params.add_node("NodeGroupInput"_ustr);
149
150 for (bNodeSocket &socket : group_input.outputs) {
151 socket.flag |= SOCK_HIDDEN;
152 }
153
155 group_input, SOCK_OUT, UString(interface_socket.identifier));
156 if (socket != nullptr) {
157 socket->flag &= ~SOCK_HIDDEN;
158 bke::node_add_link(params.node_tree, group_input, *socket, params.node, params.socket);
159 }
160}
161
168 const bNodeSocket &socket,
170 Vector<SocketLinkOperation> &search_link_ops)
171{
172 const AssetMetaData &asset_data = asset.get_metadata();
173 const StringRef asset_name = asset.get_name();
174 const IDProperty *tree_type = BKE_asset_metadata_idprop_find(&asset_data, "type");
175 if (tree_type == nullptr || IDP_int_get(tree_type) != node_tree.type) {
176 return;
177 }
178
179 const bke::bNodeTreeType &node_tree_type = *node_tree.typeinfo;
180 const eNodeSocketInOut in_out = socket.in_out == SOCK_OUT ? SOCK_IN : SOCK_OUT;
181
182 const IDProperty *properties = BKE_asset_metadata_idprop_find(&asset_data, "properties");
183 if (!properties || properties->type != IDP_GROUP) {
184 return;
185 }
186 const IDProperty *sockets = IDP_GetPropertyFromGroup(
187 properties, in_out == SOCK_IN ? "inputs" : "output_sockets");
188 if (!sockets || sockets->type != IDP_GROUP) {
189 return;
190 }
191
192 int weight = -1;
193 Set<StringRef> socket_names;
194 for (IDProperty &socket_property : sockets->data.group) {
195 if (socket_property.type != IDP_GROUP) {
196 continue;
197 }
198 const std::optional<int> type = IDP_group_lookup_int(socket_property, "type");
199 if (!type) {
200 continue;
201 }
202 eNodeSocketDatatype from = socket.type;
204 if (socket.in_out == SOCK_OUT) {
205 std::swap(from, to);
206 }
207 if (node_tree_type.validate_link && !node_tree_type.validate_link(from, to)) {
208 continue;
209 }
210 const StringRefNull identifier = socket_property.name;
211 const StringRefNull name =
212 IDP_group_lookup_string(socket_property, "name").value_or(identifier);
213 if (!socket_names.add(name)) {
214 /* See comment in #search_link_ops_for_declarations. */
215 continue;
216 }
217
218 search_link_ops.append(
219 {asset_name + " " + UI_MENU_ARROW_SEP + name,
220 [&asset, name, in_out](nodes::LinkSearchOpParams &params) {
221 Main &bmain = *CTX_data_main(&params.C);
222
223 bNodeTree *group = reinterpret_cast<bNodeTree *>(
225 if (!group) {
226 return;
227 }
228 bNode &node = params.add_node(params.node_tree.typeinfo->group_idname);
229 STRNCPY_UTF8(node.name, BKE_id_name(group->id));
230 bke::node_unique_name(params.node_tree, node);
231 node.id = &group->id;
232 id_us_plus(node.id);
233 BKE_ntree_update_tag_node_property(&params.node_tree, &node);
235
236 node.flag &= ~NODE_OPTIONS;
237 node.width = group->default_group_node_width;
238
239 /* Create the inputs and outputs on the new node. */
241
242 bNodeSocket *new_node_socket = bke::node_find_enabled_socket(node, in_out, name);
243 if (new_node_socket != nullptr) {
244 /* Rely on the way #node_add_link switches in/out if necessary. */
246 params.node_tree, params.node, params.socket, node, *new_node_socket);
247 }
248 },
249 weight});
250
251 weight--;
252 }
253}
254
256 const bNodeTree &node_tree,
257 const bNodeSocket &socket,
258 Vector<SocketLinkOperation> &search_link_ops)
259{
261 asset::AssetFilterSettings filter_settings{};
262 filter_settings.id_types = FILTER_ID_NT;
263
264 asset::list::storage_fetch(&library_ref, &C);
266 if (!asset::filter_matches_asset(&filter_settings, asset)) {
267 return true;
268 }
269 search_link_ops_for_asset_metadata(node_tree, socket, asset, search_link_ops);
270 return true;
271 });
272}
273
280 bNodeTree &node_tree,
281 const bNodeSocket &socket,
282 Vector<SocketLinkOperation> &search_link_ops)
283{
284 const SpaceNode &snode = *CTX_wm_space_node(&C);
285 for (const bke::bNodeType *node_type : bke::node_types_get()) {
286 const char *disabled_hint;
287 if (node_type->poll && !node_type->poll(node_type, &node_tree, &disabled_hint)) {
288 continue;
289 }
290 if (node_type->add_ui_poll && !node_type->add_ui_poll(&C)) {
291 continue;
292 }
293 if (StringRefNull(node_type->ui_name).endswith("(Legacy)")) {
294 continue;
295 }
296 if (node_type->gather_link_search_ops) {
298 *node_type, snode, node_tree, socket, search_link_ops};
299 node_type->gather_link_search_ops(params);
300 }
301 }
302
303 search_link_ops.append({IFACE_("Reroute"), add_reroute_node_fn});
304
305 const bool is_node_group = !(node_tree.id.flag & ID_FLAG_EMBEDDED_DATA);
306
307 if (is_node_group && socket.in_out == SOCK_IN) {
308 search_link_ops.append({IFACE_("Group Input"), add_group_input_node_fn});
309
310 int weight = -1;
311 node_tree.tree_interface.foreach_item([&](const bNodeTreeInterfaceItem &item) {
313 return true;
314 }
315 const bNodeTreeInterfaceSocket &interface_socket =
316 reinterpret_cast<const bNodeTreeInterfaceSocket &>(item);
317 if (!(interface_socket.flag & NODE_INTERFACE_SOCKET_INPUT)) {
318 return true;
319 }
320 {
322 interface_socket.socket_type);
323 const eNodeSocketDatatype from = from_typeinfo ? from_typeinfo->type : SOCK_CUSTOM;
324 const eNodeSocketDatatype to = socket.typeinfo->type;
325 if (node_tree.typeinfo->validate_link && !node_tree.typeinfo->validate_link(from, to)) {
326 return true;
327 }
328 }
329 search_link_ops.append(
330 {std::string(IFACE_("Group Input")) + " " + UI_MENU_ARROW_SEP + interface_socket.name(),
331 [interface_socket](nodes::LinkSearchOpParams &params) {
332 add_existing_group_input_fn(params, interface_socket);
333 },
334 weight});
335 weight--;
336 return true;
337 });
338 }
339
340 gather_search_link_ops_for_all_assets(C, node_tree, socket, search_link_ops);
341}
342
344 const bContext *C, void *arg, const char *str, ui::SearchItems *items, const bool is_first)
345{
347 if (storage.update_items_tag) {
348 bNodeTree *node_tree = CTX_wm_space_node(C)->edittree;
349 storage.search_link_ops.clear();
350 gather_socket_link_operations(*C, *node_tree, storage.from_socket, storage.search_link_ops);
351 storage.update_items_tag = false;
352 }
353
356
357 for (SocketLinkOperation &op : storage.search_link_ops) {
358 search.add(op.name, &op, op.weight);
359 }
360
361 /* Don't filter when the menu is first opened, but still run the search
362 * so the items are in the same order they will appear in while searching. */
363 const char *string = is_first ? "" : str;
364 const Vector<SocketLinkOperation *> filtered_items = search.query(string);
365
366 for (SocketLinkOperation *item : filtered_items) {
367 if (!search_item_add(items, item->name, item, ICON_NONE, 0, 0)) {
368 break;
369 }
370 }
371}
372
373static bNode *get_new_linked_node(bNodeSocket &socket, const Span<bNode *> new_nodes)
374{
375 for (const bNodeLink *link : socket.directly_linked_links()) {
376 if (new_nodes.contains(link->fromnode)) {
377 return link->fromnode;
378 }
379 if (new_nodes.contains(link->tonode)) {
380 return link->tonode;
381 }
382 }
383 return nullptr;
384}
385
386static void link_drag_search_exec_fn(bContext *C, void *arg1, void *arg2)
387{
388 Main &bmain = *CTX_data_main(C);
389 SpaceNode &snode = *CTX_wm_space_node(C);
390 bNodeTree &node_tree = *snode.edittree;
391 LinkDragSearchStorage &storage = *static_cast<LinkDragSearchStorage *>(arg1);
392 SocketLinkOperation *item = static_cast<SocketLinkOperation *>(arg2);
393 if (item == nullptr) {
394 return;
395 }
396
397 node_deselect_all(node_tree);
398
399 Vector<bNode *> new_nodes;
401 *C, node_tree, storage.from_node, storage.from_socket, new_nodes};
402 item->fn(params);
403 if (new_nodes.is_empty()) {
404 return;
405 }
406
407 /* Used to position the new nodes where the cursor is. */
408 const float2 cursor_offset = (storage.cursor / UI_SCALE_FAC) + float2(0.0f, 20.0f);
409
410 /* Used to position the new nodes so that the newly linked socket is aligned to the cursor. */
411 float2 link_offset{};
412 node_tree.ensure_topology_cache();
413 if (bNode *new_directly_linked_node = get_new_linked_node(storage.from_socket, new_nodes)) {
414 link_offset -= new_directly_linked_node->location;
415 if (storage.in_out() == SOCK_IN) {
416 link_offset.x -= new_directly_linked_node->width;
417 }
418 }
419
420 const float2 offset_in_tree = cursor_offset + link_offset;
421 for (bNode *new_node : new_nodes) {
422 /* The node may have an initial offset already, so use +=. */
423 new_node->location[0] += offset_in_tree.x;
424 new_node->location[1] += offset_in_tree.y;
425 bke::node_set_selected(*new_node, true);
426 }
427 bke::node_set_active(node_tree, *new_nodes[0]);
428
429 /* Ideally it would be possible to tag the node tree in some way so it updates only after the
430 * translate operation is finished, but normally moving nodes around doesn't cause updates. */
431 BKE_main_ensure_invariants(bmain, node_tree.id);
432
433 /* Start translation operator with the new node. */
434 wmOperatorType *ot = WM_operatortype_find("NODE_OT_translate_attach_remove_on_cancel", true);
435 BLI_assert(ot);
439}
440
441static void link_drag_search_free_fn(void *arg)
442{
444 delete storage;
445}
446
447static ui::Block *create_search_popup_block(bContext *C, ARegion *region, void *arg_op)
448{
449 LinkDragSearchStorage &storage = *static_cast<LinkDragSearchStorage *>(arg_op);
450
451 ui::Block *block = block_begin(C, region, "_popup", ui::EmbossType::Emboss);
453 block_theme_style_set(block, ui::BLOCK_THEME_STYLE_POPUP);
454
455 ui::Button *but = uiDefSearchBut(block,
456 storage.search,
457 ICON_VIEWZOOM,
458 sizeof(storage.search),
459 storage.in_out() == SOCK_OUT ? 10 : 10 - ui::searchbox_size_x(),
460 0,
462 UI_UNIT_Y,
463 "");
464 button_func_search_set_sep_string(but, UI_MENU_ARROW_SEP);
465 button_func_search_set_listen(but, link_drag_search_listen_fn);
466 button_func_search_set(but,
467 nullptr,
469 &storage,
470 false,
473 nullptr);
474 button_flag_enable(but, ui::BUT_ACTIVATE_ON_INIT);
475
476 /* Fake button to hold space for the search items. */
477 uiDefBut(block,
479 "",
480 storage.in_out() == SOCK_OUT ? 10 : 10 - ui::searchbox_size_x(),
484 nullptr,
485 0,
486 0,
487 std::nullopt);
488
489 const int2 offset = {0, -UI_UNIT_Y};
490 block_bounds_set_popup(block, 0.3f * U.widget_unit, offset);
491 return block;
492}
493
495 bNode &node,
496 bNodeSocket &socket,
497 const float2 &cursor)
498{
500 /* Use the "_ex" variant with `can_refresh` false to avoid a double free when closing Blender. */
501 popup_block_invoke_ex(&C, create_search_popup_block, storage, nullptr, false);
502}
503
505{
507 return false;
508 }
509 PointerRNA socket_ptr = CTX_data_pointer_get_type(C, "socket", RNA_NodeSocket);
510 if (!socket_ptr) {
511 return false;
512 }
513 return true;
514}
515
517{
518 SpaceNode &snode = *CTX_wm_space_node(C);
519 if (!snode.edittree) {
520 return OPERATOR_CANCELLED;
521 }
522 bNodeTree &ntree = *snode.edittree;
523 PointerRNA socket_ptr = CTX_data_pointer_get_type(C, "socket", RNA_NodeSocket);
524 if (!socket_ptr) {
525 return OPERATOR_CANCELLED;
526 }
527 bNodeSocket &socket = *socket_ptr.data_as<bNodeSocket>();
528
529 Vector<SocketLinkOperation> search_link_ops;
530 gather_socket_link_operations(*C, ntree, socket, search_link_ops);
531
532 if (RNA_boolean_get(op->ptr, "find_link_operations")) {
533 IDProperty *idprops = IDP_EnsureProperties(&ntree.id);
534 IDProperty *idp_link_ops_array = IDP_NewIDPArray("link_operation_names");
535 IDP_ResizeIDPArray(idp_link_ops_array, search_link_ops.size());
536 for (const int i : search_link_ops.index_range()) {
537 const SocketLinkOperation &link_op = search_link_ops[i];
538 IDProperty *idp_link_op_name = IDP_NewString(link_op.name.c_str(), "name");
539 IDP_SetIndexArray(idp_link_ops_array, i, idp_link_op_name);
540 /* IDP_SetIndexArray makes a shallow copy. */
541 MEM_delete(idp_link_op_name);
542 }
543 IDP_ReplaceInGroup(idprops, idp_link_ops_array);
544 return OPERATOR_FINISHED;
545 }
546
547 const int link_op_index = RNA_int_get(op->ptr, "link_operation_index");
548 if (!search_link_ops.index_range().contains(link_op_index)) {
549 BKE_report(op->reports, RPT_ERROR_INVALID_INPUT, "Link operation index out of range");
550 return OPERATOR_CANCELLED;
551 }
552
553 const SocketLinkOperation &link_op = search_link_ops[link_op_index];
554 Vector<bNode *> added_nodes;
555 nodes::LinkSearchOpParams params{*C, ntree, socket.owner_node(), socket, added_nodes};
556 link_op.fn(params);
557 // const std::string msg = fmt::format(
558 // "Link operation \"{}\" added {} nodes", link_op.name, added_nodes.size());
559 // BKE_report(op->reports, RPT_INFO, msg.c_str());
560
561 /* Select only added nodes. */
562 for (bNode &node : ntree.nodes) {
564 }
565 for (bNode *node : added_nodes) {
567 }
568
569 return OPERATOR_FINISHED;
570}
571
573{
574 ot->name = "Link Drag Operation Test";
575 ot->idname = "NODE_OT_link_drag_operation_test";
576 ot->description = "Run a node link-drag operation for testing";
577
580
581 ot->flag = OPTYPE_INTERNAL;
582
584 "find_link_operations",
585 false,
586 "Find Link Operations",
587 "Write link operation names for the context socket the \"link_operation_names\" "
588 "property of the node tree");
589 RNA_def_int(ot->srna,
590 "link_operation_index",
591 -1,
592 -1,
593 INT_MAX,
594 "Link Operation Index",
595 "Link operation to execute on the context socket",
596 0,
597 INT_MAX);
598}
599
600} // namespace ed::space_node
601
602} // namespace blender
Main runtime representation of an asset.
#define IDP_int_get(prop)
#define STRNCPY_UTF8(dst, src)
#define IFACE_(msgid)
#define FILTER_ID_NT
Definition DNA_ID.h:1215
#define UI_SCALE_FAC
#define C
Definition RandGen.cpp:29
#define UI_UNIT_Y
#define ND_ASSET_LIST_READING
Definition WM_types.hh:593
#define NC_ASSET
Definition WM_types.hh:417
#define SET_FLAG_FROM_TEST(value, test, flag)
bool add(const Key &key)
Definition BLI_set.hh:248
constexpr bool contains(const T &value) const
Definition BLI_span.hh:281
constexpr StringRefNull()
UString()=default
void append(const T &value)
bool is_empty() const
void add(const StringRef str, T *user_data, const int weight=0)
Vector< T * > query(const StringRef query) const
#define str(s)
#define INT_MAX
#define storage(slot, qualifiers)
AssetLibraryReference all_library_reference()
bNodeTreeInterfaceSocket * add_interface_socket_from_node(bNodeTree &ntree, const bNode &from_node, const bNodeSocket &from_sock, std::optional< StringRef > name=std::nullopt, std::optional< eNodeSocketInOut > in_out=std::nullopt)
Span< bNodeType * > node_types_get()
Definition node.cc:2951
bool node_set_selected(bNode &node, bool select)
Definition node.cc:5455
bNodeSocketType * node_socket_type_find(StringRef idname)
Definition node.cc:2966
bNodeLink & node_add_link(bNodeTree &ntree, bNode &fromnode, bNodeSocket &fromsock, bNode &tonode, bNodeSocket &tosock)
Definition node.cc:4638
bNodeSocket * node_find_enabled_socket(bNode &node, eNodeSocketInOut in_out, StringRef name)
Definition node.cc:3055
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, UString identifier)
Definition node.cc:3036
void node_set_active(bNodeTree &ntree, bNode &node)
Definition node.cc:5484
void node_socket_move_default_value(Main &bmain, bNodeTree &tree, bNodeSocket &src, bNodeSocket &dst)
Definition node.cc:4534
void node_unique_name(bNodeTree &ntree, bNode &node)
Definition node.cc:4238
void storage_fetch(const AssetLibraryReference *library_reference, const bContext *C)
void iterate(const AssetLibraryReference &library_reference, AssetListIterFn fn)
bool filter_matches_asset(const AssetFilterSettings *filter, const asset_system::AssetRepresentation &asset)
ID * asset_local_id_ensure_imported(Main &bmain, const asset_system::AssetRepresentation &asset, int flags=0, const std::optional< eAssetImportMethod > import_method=std::nullopt, const std::optional< ImportInstantiateContext > instantiate_context=std::nullopt, ReportList *reports=nullptr)
void invoke_node_link_drag_add_menu(bContext &C, bNode &node, bNodeSocket &socket, const float2 &cursor)
bool node_deselect_all(bNodeTree &node_tree)
static bNode * get_new_linked_node(bNodeSocket &socket, const Span< bNode * > new_nodes)
static void add_reroute_node_fn(nodes::LinkSearchOpParams &params)
static ui::Block * create_search_popup_block(bContext *C, ARegion *region, void *arg_op)
static void link_drag_search_free_fn(void *arg)
static void gather_search_link_ops_for_all_assets(const bContext &C, const bNodeTree &node_tree, const bNodeSocket &socket, Vector< SocketLinkOperation > &search_link_ops)
static void add_existing_group_input_fn(nodes::LinkSearchOpParams &params, const bNodeTreeInterfaceSocket &interface_socket)
static void add_group_input_node_fn(nodes::LinkSearchOpParams &params)
static void link_drag_search_listen_fn(const wmRegionListenerParams *params, void *arg)
static void link_drag_search_exec_fn(bContext *C, void *arg1, void *arg2)
void NODE_OT_link_drag_operation_test(wmOperatorType *ot)
static wmOperatorStatus link_drag_operation_test_exec(bContext *C, wmOperator *op)
static void gather_socket_link_operations(const bContext &C, bNodeTree &node_tree, const bNodeSocket &socket, Vector< SocketLinkOperation > &search_link_ops)
static void search_link_ops_for_asset_metadata(const bNodeTree &node_tree, const bNodeSocket &socket, const asset_system::AssetRepresentation &asset, Vector< SocketLinkOperation > &search_link_ops)
static bool link_drag_operation_test_poll(bContext *C)
static void link_drag_search_update_fn(const bContext *C, void *arg, const char *str, ui::SearchItems *items, const bool is_first)
void update_node_declaration_and_sockets(bNodeTree &ntree, bNode &node, Main *bmain)
BMesh Iterators.
UserDef U
Definition blender.cc:58
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop) ATTR_NONNULL()
Definition idprop.cc:737
@ RPT_ERROR_INVALID_INPUT
Definition BKE_report.hh:42
void id_us_plus(ID *id)
Definition lib_id.cc:433
void WM_operator_properties_free(PointerRNA *ptr)
IDProperty * IDP_GetPropertyFromGroup(const IDProperty *prop, StringRef name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition idprop.cc:818
PointerRNA WM_operator_properties_create_ptr(wmOperatorType *ot)
bool ED_operator_node_editable(bContext *C)
int RNA_int_get(PointerRNA *ptr, const char *name)
std::optional< int > IDP_group_lookup_int(const IDProperty &group, StringRef name)
Definition idprop.cc:880
const char * BKE_id_name(const ID &id)
IDProperty * IDP_NewString(const char *st, StringRef name, eIDPropertyFlag flags={}) ATTR_WARN_UNUSED_RESULT
Definition idprop.cc:443
std::optional< StringRefNull > IDP_group_lookup_string(const IDProperty &group, StringRef name)
Definition idprop.cc:862
void IDP_ResizeIDPArray(IDProperty *prop, int newlen)
Definition idprop.cc:203
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:162
void BKE_main_ensure_invariants(Main &bmain, std::optional< Span< ID * > > modified_ids=std::nullopt)
void IDP_SetIndexArray(IDProperty *prop, int index, IDProperty *item) ATTR_NONNULL()
Definition idprop.cc:149
IDProperty * BKE_asset_metadata_idprop_find(const AssetMetaData *asset_data, const char *name) ATTR_WARN_UNUSED_RESULT
Definition asset.cc:183
SpaceNode * CTX_wm_space_node(const bContext *C)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void BKE_ntree_update_tag_node_property(bNodeTree *ntree, bNode *node)
Main * CTX_data_main(const bContext *C)
wmOperatorStatus WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
IDProperty * IDP_EnsureProperties(ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition idprop.cc:1005
void DEG_relations_tag_update(Main *bmain)
@ ID_FLAG_EMBEDDED_DATA
Definition DNA_ID.h:775
@ OPTYPE_INTERNAL
Definition WM_types.hh:210
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
IDProperty * IDP_NewIDPArray(StringRef name) ATTR_WARN_UNUSED_RESULT
Definition idprop.cc:104
#define UI_MENU_ARROW_SEP
The meta-data of an asset. By creating and giving this for a data-block (ID.asset_data),...
ListBaseT< struct IDProperty > group
Definition DNA_ID.h:133
eIDPropertyType type
Definition DNA_ID.h:145
IDPropertyData data
Definition DNA_ID.h:157
short flag
Definition DNA_ID.h:439
T * data_as() const
Definition RNA_types.hh:139
struct bNodeTree * edittree
bke::bNodeSocketType * typeinfo
eNodeSocketDatatype type
eNodeSocketInOut in_out
bke::bNodeTreeType * typeinfo
bNodeTreeInterface tree_interface
eNodeTree_Type type
ListBaseT< bNode > nodes
ListBaseT< bNodeSocket > outputs
ListBaseT< bNodeSocket > inputs
Defines a socket type.
Definition BKE_node.hh:163
eNodeSocketDatatype type
Definition BKE_node.hh:198
bool(*) validate_link(eNodeSocketDatatype from, eNodeSocketDatatype to)
Definition BKE_node.hh:566
Defines a node type.
Definition BKE_node.hh:265
unsigned int category
Definition WM_types.hh:371
unsigned int data
Definition WM_types.hh:371
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1125
const char * description
Definition WM_types.hh:1115
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1165
struct ReportList * reports