55#include "RNA_prototypes.hh"
74 bNodeTreePath *path = MEM_cnew<bNodeTreePath>(
"node tree path");
107 bNodeTreePath *path = MEM_cnew<bNodeTreePath>(
"node tree path");
185 length += strlen(path->display_name);
197 const char *value_orig = value;
201 const int len = strlen(path->display_name);
205 memcpy(value, path->display_name,
len);
245 if (path && path->
prev) {
253 for (
const bNode *node : ntree.group_nodes()) {
254 if (node->name == name) {
265 std::optional<int32_t> id_in_node;
266 const char *group_node_name =
nullptr;
267 const bNode *node = &query_node;
270 ntree->ensure_topology_cache();
271 if (group_node_name) {
275 for (
const bNestedNodeRef &ref : ntree->nested_node_refs_span()) {
276 if (node->is_group()) {
277 if (ref.path.node_id == node->identifier && ref.path.id_in_node == id_in_node) {
278 group_node_name = path->node_name;
284 else if (ref.path.node_id == node->identifier) {
285 group_node_name = path->node_name;
300 if (snode.
id ==
nullptr) {
333 if (used_modifier ==
nullptr) {
352 const char *group_node_name = tree_path[i + 1]->node_name;
354 if (group_node ==
nullptr) {
358 if (tree_zones ==
nullptr) {
364 switch (zone->output_node->type) {
371 zone->output_node->storage);
373 storage.inspection_index);
378 zone->output_node->storage);
380 *zone->output_node, storage.inspection_index);
394 SpaceNode *snode = MEM_cnew<SpaceNode>(
"initnode");
412 ARegion *region = MEM_cnew<ARegion>(
"header for node");
419 region = MEM_cnew<ARegion>(
"buttons for node");
426 region = MEM_cnew<ARegion>(
"node tools");
435 region = MEM_cnew<ARegion>(
"main region for node");
440 region->v2d.tot.xmin = -12.8f *
U.widget_unit;
441 region->v2d.tot.ymin = -12.8f *
U.widget_unit;
442 region->v2d.tot.xmax = 38.4f *
U.widget_unit;
443 region->v2d.tot.ymax = 38.4f *
U.widget_unit;
445 region->v2d.cur = region->v2d.tot;
447 region->v2d.min[0] = 1.0f;
448 region->v2d.min[1] = 1.0f;
450 region->v2d.max[0] = 32000.0f;
451 region->v2d.max[1] = 32000.0f;
453 region->v2d.minzoom = 0.05f;
454 region->v2d.maxzoom = 2.31f;
458 region->v2d.keeptot = 0;
475 if (snode->
runtime ==
nullptr) {
476 snode->
runtime = MEM_new<SpaceNode_Runtime>(__func__);
491 if (
ELEM(
nullptr, ntree,
id)) {
494 for (
const bNode *node : ntree->all_nodes()) {
495 if (node->id ==
id) {
537 if (region && path) {
704 if (scene->use_nodes) {
725 snoden->
runtime = MEM_new<SpaceNode_Runtime>(__func__);
911 "NODE_OT_add_object",
917 "NODE_OT_add_collection",
941 "NODE_OT_add_material",
1046 "selected_nodes",
"active_node",
"light",
"material",
"world",
nullptr};
1125 if (snode->
id == old_id) {
1133 snode->
from =
nullptr;
1138 if (snode->
from == old_id) {
1139 if (new_id ==
nullptr) {
1140 snode->
flag &= ~SNODE_PIN;
1142 snode->
from = new_id;
1146 if ((
ID *)snode->
gpd == old_id) {
1177 for (; path; path = path_next) {
1178 path_next = path->
next;
1211 mappings.
iter([&](
ID *old_id,
ID *new_id) {
1222 bool is_embedded_nodetree = snode->
id !=
nullptr && allow_pointer_access &&
1231 if (is_embedded_nodetree) {
1233 if (path !=
nullptr) {
1242 if (path !=
nullptr) {
1250 if (path !=
nullptr) {
1268 if (!is_readonly && snode->
id && !snode->
nodetree) {
1269 is_embedded_nodetree =
true;
1271 if (path !=
nullptr) {
1276 if (path !=
nullptr) {
1277 for (path = path->
next; path !=
nullptr; path = path->
next) {
1279 if (allow_pointer_access) {
1290 path_next = path->
next;
1389 std::unique_ptr<SpaceType> st = std::make_unique<SpaceType>();
1395 st->create = node_create;
1396 st->free = node_free;
1397 st->init = node_init;
1398 st->exit = node_exit;
1399 st->duplicate = node_duplicate;
1400 st->operatortypes = node_operatortypes;
1401 st->keymap = node_keymap;
1402 st->listener = node_area_listener;
1403 st->refresh = node_area_refresh;
1404 st->context = node_context;
1405 st->dropboxes = node_dropboxes;
1406 st->gizmos = node_widgets;
1407 st->id_remap = node_id_remap;
1408 st->foreach_id = node_foreach_id;
1409 st->space_subtype_item_extend = node_space_subtype_item_extend;
1410 st->space_subtype_get = node_space_subtype_get;
1411 st->space_subtype_set = node_space_subtype_set;
1412 st->space_name_get = node_space_name_get;
1413 st->space_icon_get = node_space_icon_get;
1414 st->blend_read_data = node_space_blend_read_data;
1415 st->blend_read_after_liblink =
nullptr;
1416 st->blend_write = node_space_blend_write;
1419 art = MEM_cnew<ARegionType>(
"spacetype node region");
1421 art->
init = node_main_region_init;
1422 art->
draw = node_main_region_draw;
1425 art->
listener = node_region_listener;
1426 art->
cursor = node_cursor;
1434 art = MEM_cnew<ARegionType>(
"spacetype node region");
1438 art->
listener = node_region_listener;
1439 art->
init = node_header_region_init;
1440 art->
draw = node_header_region_draw;
1445 art = MEM_cnew<ARegionType>(
"spacetype node region");
1449 art->
listener = node_region_listener;
1451 art->
init = node_buttons_region_init;
1452 art->
draw = node_buttons_region_draw;
1456 art = MEM_cnew<ARegionType>(
"spacetype view3d tools region");
1461 art->
listener = node_region_listener;
1464 art->
init = node_toolbar_region_init;
1465 art->
draw = node_toolbar_region_draw;
1468 WM_menutype_add(MEM_cnew<MenuType>(__func__, add_catalog_assets_menu_type()));
1469 WM_menutype_add(MEM_cnew<MenuType>(__func__, add_unassigned_assets_menu_type()));
1470 WM_menutype_add(MEM_cnew<MenuType>(__func__, add_root_catalogs_menu_type()));
Main runtime representation of an asset.
IDProperty * BKE_asset_metadata_idprop_find(const AssetMetaData *asset_data, const char *name) ATTR_WARN_UNUSED_RESULT
void CTX_data_dir_set(bContextDataResult *result, const char **dir)
bool CTX_data_equals(const char *member, const char *str)
void CTX_data_pointer_set(bContextDataResult *result, ID *id, StructRNA *type, void *data)
bool CTX_data_dir(const char *member)
void CTX_data_id_pointer_set(bContextDataResult *result, ID *id)
SpaceNode * CTX_wm_space_node(const bContext *C)
@ CTX_RESULT_MEMBER_NOT_FOUND
void CTX_data_list_add(bContextDataResult *result, ID *id, StructRNA *type, void *data)
@ CTX_DATA_TYPE_COLLECTION
wmWindowManager * CTX_wm_manager(const bContext *C)
void CTX_data_type_set(bContextDataResult *result, short type)
void BKE_gpencil_blend_read_data(struct BlendDataReader *reader, struct bGPdata *gpd)
void id_us_ensure_real(ID *id)
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_)
@ IDWALK_CB_EMBEDDED_NOT_OWNING
@ IDWALK_CB_DIRECT_WEAK_LINK
int BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
@ IDWALK_NO_ORIG_POINTERS_ACCESS
#define BKE_LIB_FOREACHID_PROCESS_ID(data_, id_, cb_flag_)
#define GEO_NODE_FOREACH_GEOMETRY_ELEMENT_OUTPUT
#define GEO_NODE_SIMULATION_OUTPUT
#define NODE_TREE_TYPES_BEGIN(ntype)
#define NODE_TREE_TYPES_END
#define GEO_NODE_REPEAT_OUTPUT
void BKE_spacetype_register(std::unique_ptr< SpaceType > st)
ARegion * BKE_area_find_region_type(const ScrArea *area, int region_type)
void BLI_kdtree_nd_ free(KDTree *tree)
void BLI_addhead(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
#define LISTBASE_FOREACH_BACKWARD(type, var, list)
void void void void void void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src) ATTR_NONNULL(1
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE void copy_v2_v2(float r[2], const float a[2])
#define STRNCPY(dst, src)
#define BLO_write_struct(writer, struct_name, data_ptr)
#define BLO_read_struct_list(reader, struct_name, list)
#define BLO_read_struct(reader, struct_name, ptr_p)
void DEG_id_tag_update(ID *id, unsigned int flags)
ID and Library types, which are fundamental for SDNA.
Object is a sort of wrapper for general info.
@ SN_OVERLAY_SHOW_PREVIEWS
@ SN_OVERLAY_SHOW_WIRE_COLORS
@ SN_OVERLAY_SHOW_OVERLAYS
Image * ED_space_image(const SpaceImage *sima)
void ED_node_set_tree_type(SpaceNode *snode, blender::bke::bNodeTreeType *typeinfo)
bool ED_node_is_compositor(const SpaceNode *snode)
bool ED_node_is_shader(SpaceNode *snode)
void ED_node_composite_job(const bContext *C, bNodeTree *nodetree, Scene *scene_owner)
bool ED_node_is_geometry(SpaceNode *snode)
bool ED_node_is_texture(SpaceNode *snode)
void ED_area_tag_redraw(ScrArea *area)
void ED_area_do_mgs_subscribe_for_tool_ui(const wmRegionMessageSubscribeParams *params)
void ED_region_panels(const bContext *C, ARegion *region)
void ED_region_header(const bContext *C, ARegion *region)
void ED_region_header_init(ARegion *region)
int ED_region_generic_tools_region_snap_size(const ARegion *region, int size, int axis)
void ED_area_tag_refresh(ScrArea *area)
void ED_region_generic_tools_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
void ED_region_panels_init(wmWindowManager *wm, ARegion *region)
void ED_region_tag_redraw(ARegion *region)
Read Guarded memory(de)allocation.
blender::bke::bNodeTreeType * rna_node_tree_type_from_enum(int value)
int rna_node_tree_idname_to_enum(const char *idname)
const EnumPropertyItem * RNA_enum_node_tree_types_itemf_impl(bContext *C, bool *r_free)
#define UI_SIDEBAR_PANEL_WIDTH
bool UI_but_active_drop_name(const bContext *C)
void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
void UI_view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
void UI_view2d_center_set(View2D *v2d, float x, float y)
#define ND_GPENCIL_EDITMODE
#define ND_SPACE_NODE_VIEW
SIMD_FORCE_INLINE btScalar length() const
Return the length of the vector.
void push(Args &&...args)
constexpr IndexRange drop_back(int64_t n) const
void append(const T &value)
IndexRange index_range() const
AssetMetaData & get_metadata() const
Vector< const bNodeTreeZone * > get_zone_stack_for_node(const int32_t node_id) const
Vector< std::unique_ptr< bNodeTreeZone > > zones
void iter(FunctionRef< void(ID *old_id, ID *new_id)> func) const
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void MEM_freeN(void *vmemh)
void *(* MEM_dupallocN)(const void *vmemh)
bNode * node_get_active(bNodeTree *ntree)
const bNodeInstanceKey NODE_INSTANCE_KEY_BASE
bNodeInstanceKey node_instance_key(bNodeInstanceKey parent_key, const bNodeTree *ntree, const bNode *node)
bNodeTreeType * node_tree_type_find(const char *idname)
bNodeTree * node_tree_from_id(ID *id)
bNode * node_find_node_by_name(bNodeTree *ntree, const char *name)
static void node_header_region_init(wmWindowManager *, ARegion *region)
static void node_widgets()
static void node_space_subtype_item_extend(bContext *C, EnumPropertyItem **item, int *totitem)
static int node_space_icon_get(const ScrArea *area)
static void node_toolbar_region_draw(const bContext *C, ARegion *region)
static void node_space_blend_read_data(BlendDataReader *reader, SpaceLink *sl)
static void node_group_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
static void node_header_region_draw(const bContext *C, ARegion *region)
bool push_compute_context_for_tree_path(const SpaceNode &snode, ComputeContextBuilder &compute_context_builder)
static void node_foreach_id(SpaceLink *space_link, LibraryForeachIDData *data)
void free_previews(wmWindowManager &wm, SpaceNode &snode)
static SpaceLink * node_duplicate(SpaceLink *sl)
static void node_main_region_init(wmWindowManager *wm, ARegion *region)
static void node_id_remap(ID *old_id, ID *new_id, SpaceNode *snode)
void node_set_cursor(wmWindow &win, ARegion ®ion, SpaceNode &snode, const float2 &cursor)
static void node_area_refresh(const bContext *C, ScrArea *area)
static bool node_material_drop_poll(bContext *C, wmDrag *drag, const wmEvent *)
void NODE_GGT_backdrop_corner_pin(wmGizmoGroupType *gzgt)
static bool node_mask_drop_poll(bContext *, wmDrag *drag, const wmEvent *)
static int node_space_subtype_get(ScrArea *area)
void NODE_GGT_backdrop_crop(wmGizmoGroupType *gzgt)
static bool node_group_drop_poll(bContext *C, wmDrag *drag, const wmEvent *)
static void node_init(wmWindowManager *, ScrArea *area)
static void node_region_listener(const wmRegionListenerParams *params)
static bool node_id_im_drop_poll(bContext *, wmDrag *drag, const wmEvent *)
float2 space_node_group_offset(const SpaceNode &snode)
static void node_free(SpaceLink *sl)
static bool node_collection_drop_poll(bContext *C, wmDrag *drag, const wmEvent *)
std::optional< ObjectAndModifier > get_modifier_for_node_editor(const SpaceNode &snode)
static blender::StringRefNull node_space_name_get(const ScrArea *area)
std::optional< int32_t > find_nested_node_id_in_root(const SpaceNode &snode, const bNode &node)
static void node_dropboxes()
void NODE_GGT_backdrop_transform(wmGizmoGroupType *gzgt)
void snode_set_context(const bContext &C)
void NODE_GGT_backdrop_sun_beams(wmGizmoGroupType *gzgt)
static void node_area_listener(const wmSpaceTypeListenerParams *params)
static void node_id_im_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
static int node_context(const bContext *C, const char *member, bContextDataResult *result)
static bool node_object_drop_poll(bContext *C, wmDrag *drag, const wmEvent *)
void node_draw_space(const bContext &C, ARegion ®ion)
static void node_cursor(wmWindow *win, ScrArea *area, ARegion *region)
static void node_buttons_region_draw(const bContext *C, ARegion *region)
static void node_id_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
static void node_toolbar_region_init(wmWindowManager *wm, ARegion *region)
static void node_exit(wmWindowManager *wm, ScrArea *area)
static bool is_compositor_viewer_image_visible(const bContext *C)
static void node_main_region_draw(const bContext *C, ARegion *region)
static bool any_node_uses_id(const bNodeTree *ntree, const ID *id)
static const bNode * group_node_by_name(const bNodeTree &ntree, StringRef name)
static void node_buttons_region_init(wmWindowManager *wm, ARegion *region)
static void node_space_blend_write(BlendWriter *writer, SpaceLink *sl)
static void node_area_tag_tree_recalc(SpaceNode *snode, ScrArea *area)
static SpaceLink * node_create(const ScrArea *, const Scene *)
static void node_space_subtype_set(ScrArea *area, int value)
VecBase< float, 2 > float2
const char * node_context_dir[]
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
void RNA_struct_property_unset(PointerRNA *ptr, const char *identifier)
void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
bNodeTree * ED_node_tree_get(SpaceNode *snode, int level)
void ED_node_tree_push(SpaceNode *snode, bNodeTree *ntree, bNode *gnode)
void ED_node_cursor_location_set(SpaceNode *snode, const float value[2])
void ED_node_tree_path_get(SpaceNode *snode, char *value)
int ED_node_tree_depth(SpaceNode *snode)
void ED_node_set_active_viewer_key(SpaceNode *snode)
int ED_node_tree_path_length(SpaceNode *snode)
void ED_node_tree_pop(SpaceNode *snode)
const char * node_context_dir[]
void ED_node_cursor_location_get(const SpaceNode *snode, float value[2])
void ED_node_tree_start(SpaceNode *snode, bNodeTree *ntree, ID *id, ID *from)
bool clip_gizmo_events_by_ui
void(* message_subscribe)(const wmRegionMessageSubscribeParams *params)
void(* cursor)(wmWindow *win, ScrArea *area, ARegion *region)
void(* listener)(const wmRegionListenerParams *params)
void(* draw)(const bContext *C, ARegion *region)
int(* snap_size)(const ARegion *region, int size, int axis)
void(* init)(wmWindowManager *wm, ARegion *region)
struct bNodeTree * node_group
SpaceNode_Runtime * runtime
struct bNodeTree * edittree
struct bNodeTree * geometry_nodes_tool_tree
struct bNodeTree * nodetree
struct bNodeTree * nodetree
struct bNodeTreePath * next
struct bNodeTreePath * prev
bNodeInstanceKey parent_key
bNodeTreeRuntimeHandle * runtime
NodeInstanceHashHandle * previews
bNodeInstanceKey active_viewer_key
bool recalc_regular_compositing
const AssetRepresentationHandle * asset
struct wmKeyConfig * defaultconf
struct wmEvent * eventstate
wmDropBox * WM_dropbox_add(ListBase *lb, const char *idname, bool(*poll)(bContext *C, wmDrag *drag, const wmEvent *event), void(*copy)(bContext *C, wmDrag *drag, wmDropBox *drop), void(*cancel)(Main *bmain, wmDrag *drag, wmDropBox *drop), WMDropboxTooltipFunc tooltip)
void WM_drag_free_imported_drag_ID(Main *bmain, wmDrag *drag, wmDropBox *drop)
Free asset ID imported for canceled drop.
bool WM_drag_is_ID_type(const wmDrag *drag, int idcode)
ID * WM_drag_get_local_ID_or_import_from_asset(const bContext *C, const wmDrag *drag, int idcode)
ListBase * WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
wmDragAsset * WM_drag_get_asset_data(const wmDrag *drag, int idcode)
ID * WM_drag_get_local_ID(const wmDrag *drag, short idcode)
wmEventHandler_Dropbox * WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropboxes)
wmEventHandler_Keymap * WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
void WM_main_add_notifier(uint type, void *reference)
wmEventHandler_Keymap * WM_event_add_keymap_handler_v2d_mask(ListBase *handlers, wmKeyMap *keymap)
wmGizmoGroupTypeRef * WM_gizmogrouptype_append_and_link(wmGizmoMapType *gzmap_type, void(*wtfunc)(wmGizmoGroupType *))
void WM_gizmomap_tag_refresh(wmGizmoMap *gzmap)
wmGizmoMapType * WM_gizmomaptype_ensure(const wmGizmoMapType_Params *gzmap_params)
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
bScreen * WM_window_get_active_screen(const wmWindow *win)