Cleanup: Move BKE_node.h to C++ #107790

Merged
Hans Goudey merged 16 commits from mod_moder/blender:tmp_move_node_on_cpp into main 2023-05-15 15:14:30 +02:00
254 changed files with 3636 additions and 3553 deletions

View File

@ -406,13 +406,6 @@ typedef struct bNodeType {
#define NODE_CLASS_ATTRIBUTE 42
#define NODE_CLASS_LAYOUT 100
typedef enum eNodeSizePreset {
NODE_SIZE_DEFAULT,
NODE_SIZE_SMALL,
NODE_SIZE_MIDDLE,
NODE_SIZE_LARGE,
} eNodeSizePreset;
struct bNodeTreeExec;
typedef void (*bNodeClassCallback)(void *calldata, int nclass, const char *name);
@ -496,26 +489,10 @@ void ntreeSetTypes(const struct bContext *C, struct bNodeTree *ntree);
struct bNodeTree *ntreeAddTree(struct Main *bmain, const char *name, const char *idname);
struct bNodeTree *ntreeAddTreeEmbedded(struct Main *bmain,
struct ID *owner_id,
const char *name,
const char *idname);
/* Copy/free functions, need to manage ID users. */
/**
* Free (or release) any data used by this node-tree.
* Does not free the node-tree itself and does no ID user counting.
*/
void ntreeFreeTree(struct bNodeTree *ntree);
/**
* Free tree which is embedded into another data-block.
*/
void ntreeFreeEmbeddedTree(struct bNodeTree *ntree);
struct bNodeTree *ntreeCopyTree_ex(const struct bNodeTree *ntree,
struct Main *bmain,
bool do_id_user);
struct bNodeTree *ntreeCopyTree(struct Main *bmain, const struct bNodeTree *ntree);
/**
* Get address of potential node-tree pointer of given ID.
@ -524,14 +501,13 @@ struct bNodeTree *ntreeCopyTree(struct Main *bmain, const struct bNodeTree *ntre
* sure, please use `ntreeFromID()` instead.
*/
struct bNodeTree **BKE_ntree_ptr_from_id(struct ID *id);
/**
* Returns the private NodeTree object of the data-block, if it has one.
*/
struct bNodeTree *ntreeFromID(struct ID *id);
void ntreeFreeLocalNode(struct bNodeTree *ntree, struct bNode *node);
void ntreeFreeLocalTree(struct bNodeTree *ntree);
struct bNode *ntreeFindType(struct bNodeTree *ntree, int type);
/**
* Check recursively if a node tree contains another.
@ -539,7 +515,6 @@ struct bNode *ntreeFindType(struct bNodeTree *ntree, int type);
bool ntreeContainsTree(const struct bNodeTree *tree_to_search_in,
const struct bNodeTree *tree_to_search_for);
void ntreeUpdateAllNew(struct Main *main);
void ntreeUpdateAllUsers(struct Main *main, struct ID *id);
/**
@ -549,30 +524,15 @@ void ntreeUpdateAllUsers(struct Main *main, struct ID *id);
*/
void ntreeSetOutput(struct bNodeTree *ntree);
void ntreeNodeFlagSet(const bNodeTree *ntree, int flag, bool enable);
/**
* Returns localized tree for execution in threads.
*/
struct bNodeTree *ntreeLocalize(struct bNodeTree *ntree);
/**
* Merge local tree results back, and free local tree.
*
* We have to assume the editor already changed completely.
*/
void ntreeLocalMerge(struct Main *bmain, struct bNodeTree *localtree, struct bNodeTree *ntree);
/**
* This is only direct data, tree itself should have been written.
*/
void ntreeBlendWrite(struct BlendWriter *writer, struct bNodeTree *ntree);
/**
* \note `ntree` itself has been read!
*/
void ntreeBlendReadData(struct BlendDataReader *reader,
struct ID *owner_id,
struct bNodeTree *ntree);
void ntreeBlendReadLib(struct BlendLibReader *reader, struct bNodeTree *ntree);
void ntreeBlendReadExpand(struct BlendExpander *expander, struct bNodeTree *ntree);
/** \} */
@ -580,31 +540,12 @@ void ntreeBlendReadExpand(struct BlendExpander *expander, struct bNodeTree *ntre
/** \name Node Tree Interface
* \{ */
struct bNodeSocket *ntreeFindSocketInterface(struct bNodeTree *ntree,
eNodeSocketInOut in_out,
const char *identifier);
void ntreeRemoveSocketInterface(bNodeTree *ntree, bNodeSocket *sock);
struct bNodeSocket *ntreeAddSocketInterface(struct bNodeTree *ntree,
eNodeSocketInOut in_out,
const char *idname,
const char *name);
struct bNodeSocket *ntreeInsertSocketInterface(struct bNodeTree *ntree,
eNodeSocketInOut in_out,
const char *idname,
struct bNodeSocket *next_sock,
const char *name);
struct bNodeSocket *ntreeAddSocketInterfaceFromSocket(struct bNodeTree *ntree,
const struct bNode *from_node,
const struct bNodeSocket *from_sock);
struct bNodeSocket *ntreeAddSocketInterfaceFromSocketWithName(struct bNodeTree *ntree,
const struct bNode *from_node,
const struct bNodeSocket *from_sock,
const char *idname,
const char *name);
struct bNodeSocket *ntreeInsertSocketInterfaceFromSocket(struct bNodeTree *ntree,
struct bNodeSocket *next_sock,
const struct bNode *from_node,
const struct bNodeSocket *from_sock);
void ntreeRemoveSocketInterface(struct bNodeTree *ntree, struct bNodeSocket *sock);
/** \} */
@ -615,7 +556,6 @@ void ntreeRemoveSocketInterface(struct bNodeTree *ntree, struct bNodeSocket *soc
struct bNodeType *nodeTypeFind(const char *idname);
void nodeRegisterType(struct bNodeType *ntype);
void nodeUnregisterType(struct bNodeType *ntype);
bool nodeTypeUndefined(const struct bNode *node);
struct GHashIterator *nodeTypeGetIterator(void);
/* Helper macros for iterating over node types. */
@ -639,11 +579,9 @@ bool nodeSocketIsRegistered(const struct bNodeSocket *sock);
struct GHashIterator *nodeSocketTypeGetIterator(void);
const char *nodeSocketTypeLabel(const bNodeSocketType *stype);
bool nodeIsStaticSocketType(const struct bNodeSocketType *stype);
const char *nodeStaticSocketType(int type, int subtype);
const char *nodeStaticSocketInterfaceType(int type, int subtype);
const char *nodeStaticSocketLabel(int type, int subtype);
const char *nodeSocketSubTypeLabel(int subtype);
/* Helper macros for iterating over node types. */
#define NODE_SOCKET_TYPES_BEGIN(stype) \
@ -678,24 +616,13 @@ struct bNodeSocket *nodeAddStaticSocket(struct bNodeTree *ntree,
const char *identifier,
const char *name);
void nodeRemoveSocket(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock);
void nodeRemoveSocketEx(struct bNodeTree *ntree,
struct bNode *node,
struct bNodeSocket *sock,
bool do_id_user);
void nodeRemoveAllSockets(struct bNodeTree *ntree, struct bNode *node);
void nodeModifySocketType(struct bNodeTree *ntree,
struct bNode *node,
struct bNodeSocket *sock,
const char *idname);
void nodeModifySocketTypeStatic(
struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock, int type, int subtype);
struct bNode *nodeAddNode(const struct bContext *C, struct bNodeTree *ntree, const char *idname);
struct bNode *nodeAddStaticNode(const struct bContext *C, struct bNodeTree *ntree, int type);
/**
* \note Goes over entire tree.
*/
void nodeUnlinkNode(struct bNodeTree *ntree, struct bNode *node);
/**
* Find the first available, non-duplicate name for a given node.
*/
@ -706,13 +633,6 @@ void nodeUniqueName(struct bNodeTree *ntree, struct bNode *node);
*/
void nodeUniqueID(struct bNodeTree *ntree, struct bNode *node);
/**
* Rebuild the `node_by_id` runtime vector set. Call after removing a node if not handled
* separately. This is important instead of just using `nodes_by_id.remove()` since it maintains
* the node order.
*/
void nodeRebuildIDVector(struct bNodeTree *node_tree);
/**
* Delete node, associated animation data and ID user count.
*/
@ -725,47 +645,6 @@ void nodeDimensionsGet(const struct bNode *node, float *r_width, float *r_height
void nodeTagUpdateID(struct bNode *node);
void nodeInternalLinks(struct bNode *node, struct bNodeLink **r_links, int *r_len);
#ifdef __cplusplus
namespace blender::bke {
/**
* \note keeps socket list order identical, for copying links.
* \param use_unique: If true, make sure the node's identifier and name are unique in the new
* tree. Must be *true* if the \a dst_tree had nodes that weren't in the source node's tree.
* Must be *false* when simply copying a node tree, so that identifiers don't change.
*/
bNode *node_copy_with_mapping(bNodeTree *dst_tree,
const bNode &node_src,
int flag,
bool use_unique,
Map<const bNodeSocket *, bNodeSocket *> &new_socket_map);
bNode *node_copy(bNodeTree *dst_tree, const bNode &src_node, int flag, bool use_unique);
/**
* Move socket default from \a src (input socket) to locations specified by \a dst (output socket).
* Result value moved in specific location. (potentially multiple group nodes socket values, if \a
* dst is a group input node).
* \note Conceptually, the effect should be such that the evaluation of
* this graph again returns the value in src.
*/
void node_socket_move_default_value(Main &bmain,
bNodeTree &tree,
bNodeSocket &src,
bNodeSocket &dst);
/**
* Free the node itself.
*
* \note ID user reference-counting and changing the `nodes_by_id` vector are up to the caller.
*/
void node_free_node(bNodeTree *tree, bNode *node);
} // namespace blender::bke
#endif
/**
* Also used via RNA API, so we check for proper input output direction.
*/
@ -776,25 +655,19 @@ struct bNodeLink *nodeAddLink(struct bNodeTree *ntree,
struct bNodeSocket *tosock);
void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link);
void nodeRemSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock);
/**
* Set the mute status of a single link.
*/
void nodeLinkSetMute(struct bNodeTree *ntree, struct bNodeLink *link, const bool muted);
bool nodeLinkIsHidden(const struct bNodeLink *link);
bool nodeLinkIsSelected(const struct bNodeLink *link);
void nodeInternalRelink(struct bNodeTree *ntree, struct bNode *node);
void nodeToView(const struct bNode *node, float x, float y, float *rx, float *ry);
void nodeFromView(const struct bNode *node, float x, float y, float *rx, float *ry);
bool nodeLinkIsHidden(const struct bNodeLink *link);
void nodeAttachNode(struct bNodeTree *ntree, struct bNode *node, struct bNode *parent);
void nodeDetachNode(struct bNodeTree *ntree, struct bNode *node);
void nodePositionRelative(struct bNode *from_node,
const struct bNode *to_node,
const struct bNodeSocket *from_sock,
const struct bNodeSocket *to_sock);
void nodePositionPropagate(struct bNode *node);
/**
* Same as above but expects that the socket definitely is in the node tree.
*/
void nodeFindNode(struct bNodeTree *ntree,
struct bNodeSocket *sock,
struct bNode **r_node,
int *r_sockindex);
/**
* Finds a node based on its name.
*/
@ -806,65 +679,9 @@ bool nodeFindNodeTry(struct bNodeTree *ntree,
struct bNodeSocket *sock,
struct bNode **r_node,
int *r_sockindex);
/**
* Same as above but expects that the socket definitely is in the node tree.
*/
void nodeFindNode(struct bNodeTree *ntree,
struct bNodeSocket *sock,
struct bNode **r_node,
int *r_sockindex);
/**
* \note Recursive.
*/
struct bNode *nodeFindRootParent(bNode *node);
bool nodeIsParentAndChild(const bNode *parent, const bNode *child);
/**
* Iterate over a chain of nodes, starting with \a node_start, executing
* \a callback for each node (which can return false to end iterator).
*
* \param reversed: for backwards iteration
* \note Recursive
*/
void nodeChainIter(const bNodeTree *ntree,
const bNode *node_start,
bool (*callback)(bNode *, bNode *, void *, const bool),
void *userdata,
bool reversed);
/**
* Iterate over a chain of nodes, starting with \a node_start, executing
* \a callback for each node (which can return false to end iterator).
*
* Faster than nodeChainIter. Iter only once per node.
* Can be called recursively (using another nodeChainIterBackwards) by
* setting the recursion_lvl accordingly.
*
* \note Needs updated socket links (ntreeUpdateTree).
* \note Recursive
*/
void nodeChainIterBackwards(const bNodeTree *ntree,
const bNode *node_start,
bool (*callback)(bNode *, bNode *, void *),
void *userdata,
int recursion_lvl);
/**
* Iterate over all parents of \a node, executing \a callback for each parent
* (which can return false to end iterator)
*
* \note Recursive
*/
void nodeParentsIter(bNode *node, bool (*callback)(bNode *, void *), void *userdata);
/**
* A dangling reroute node is a reroute node that does *not* have a "data source", i.e. no
* non-reroute node is connected to its input.
*/
bool nodeIsDanglingReroute(const struct bNodeTree *ntree, const struct bNode *node);
struct bNodeLink *nodeFindLink(struct bNodeTree *ntree,
const struct bNodeSocket *from,
const struct bNodeSocket *to);
int nodeCountSocketLinks(const struct bNodeTree *ntree, const struct bNodeSocket *sock);
void nodeSetSelected(struct bNode *node, bool select);
@ -878,37 +695,9 @@ void nodeClearActive(struct bNodeTree *ntree);
* Two active flags, ID nodes have special flag for buttons display.
*/
struct bNode *nodeGetActiveTexture(struct bNodeTree *ntree);
struct bNode *nodeGetActivePaintCanvas(struct bNodeTree *ntree);
/**
* \brief Does the given node supports the sub active flag.
*
* \param sub_active: The active flag to check. #NODE_ACTIVE_TEXTURE / #NODE_ACTIVE_PAINT_CANVAS.
*/
bool nodeSupportsActiveFlag(const struct bNode *node, int sub_active);
void nodeSetSocketAvailability(struct bNodeTree *ntree,
struct bNodeSocket *sock,
bool is_available);
int nodeSocketLinkLimit(const struct bNodeSocket *sock);
/**
* If the node implements a `declare` function, this function makes sure that `node->declaration`
* is up to date. It is expected that the sockets of the node are up to date already.
*/
bool nodeDeclarationEnsure(struct bNodeTree *ntree, struct bNode *node);
/**
* Just update `node->declaration` if necessary. This can also be called on nodes that may not be
* up to date (e.g. because the need versioning or are dynamic).
*/
bool nodeDeclarationEnsureOnOutdatedNode(struct bNodeTree *ntree, struct bNode *node);
/**
* Update `socket->declaration` for all sockets in the node. This assumes that the node declaration
* and sockets are up to date already.
*/
void nodeSocketDeclarationsUpdate(struct bNode *node);
/**
* Node Instance Hash.
*/
@ -947,89 +736,22 @@ bool BKE_node_instance_hash_tag_key(bNodeInstanceHash *hash, bNodeInstanceKey ke
void BKE_node_instance_hash_remove_untagged(bNodeInstanceHash *hash,
bNodeInstanceValueFP valfreefp);
typedef GHashIterator bNodeInstanceHashIterator;
BLI_INLINE bNodeInstanceHashIterator *BKE_node_instance_hash_iterator_new(bNodeInstanceHash *hash)
{
return BLI_ghashIterator_new(hash->ghash);
}
BLI_INLINE void BKE_node_instance_hash_iterator_init(bNodeInstanceHashIterator *iter,
bNodeInstanceHash *hash)
{
BLI_ghashIterator_init(iter, hash->ghash);
}
BLI_INLINE void BKE_node_instance_hash_iterator_free(bNodeInstanceHashIterator *iter)
{
BLI_ghashIterator_free(iter);
}
BLI_INLINE bNodeInstanceKey
BKE_node_instance_hash_iterator_get_key(bNodeInstanceHashIterator *iter)
{
return *(bNodeInstanceKey *)BLI_ghashIterator_getKey(iter);
}
BLI_INLINE void *BKE_node_instance_hash_iterator_get_value(bNodeInstanceHashIterator *iter)
{
return BLI_ghashIterator_getValue(iter);
}
BLI_INLINE void BKE_node_instance_hash_iterator_step(bNodeInstanceHashIterator *iter)
{
BLI_ghashIterator_step(iter);
}
BLI_INLINE bool BKE_node_instance_hash_iterator_done(bNodeInstanceHashIterator *iter)
{
return BLI_ghashIterator_done(iter);
}
#define NODE_INSTANCE_HASH_ITER(iter_, hash_) \
for (BKE_node_instance_hash_iterator_init(&iter_, hash_); \
BKE_node_instance_hash_iterator_done(&iter_) == false; \
BKE_node_instance_hash_iterator_step(&iter_))
/* Node Previews */
bool BKE_node_preview_used(const struct bNode *node);
bNodePreview *BKE_node_preview_verify(
struct bNodeInstanceHash *previews, bNodeInstanceKey key, int xsize, int ysize, bool create);
bNodePreview *BKE_node_preview_copy(struct bNodePreview *preview);
void BKE_node_preview_free(struct bNodePreview *preview);
void BKE_node_preview_init_tree(struct bNodeTree *ntree, int xsize, int ysize);
void BKE_node_preview_remove_unused(struct bNodeTree *ntree);
void BKE_node_preview_clear(struct bNodePreview *preview);
void BKE_node_preview_clear_tree(struct bNodeTree *ntree);
void BKE_node_preview_merge_tree(struct bNodeTree *to_ntree,
struct bNodeTree *from_ntree,
bool remove_old);
/** \} */
/* -------------------------------------------------------------------- */
/** \name Node Type Access
* \{ */
void nodeLabel(const struct bNodeTree *ntree, const struct bNode *node, char *label, int maxlen);
/**
* Get node socket label if it is set.
*/
const char *nodeSocketLabel(const struct bNodeSocket *sock);
bool nodeGroupPoll(const struct bNodeTree *nodetree,
const struct bNodeTree *grouptree,
const char **r_disabled_hint);
/**
* Initialize a new node type struct with default values and callbacks.
*/
void node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass);
void node_type_base_custom(struct bNodeType *ntype,
const char *idname,
const char *name,
short nclass);
void node_type_socket_templates(struct bNodeType *ntype,
struct bNodeSocketTemplate *inputs,
struct bNodeSocketTemplate *outputs);
void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth);
void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size);
/**
* \warning Nodes defining a storage type _must_ allocate this for new nodes.
* Otherwise nodes will reload as undefined (#46619).
@ -1043,12 +765,6 @@ void node_type_storage(struct bNodeType *ntype,
/** \} */
/* -------------------------------------------------------------------- */
/** \name Node Generic Functions
* \{ */
bool BKE_node_is_connected_to_output(const struct bNodeTree *ntree, const struct bNode *node);
/* ************** COMMON NODES *************** */
#define NODE_UNDEFINED -2 /* node type is not registered */
@ -1620,32 +1336,6 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, struct Scene *scene, i
void BKE_node_system_init(void);
void BKE_node_system_exit(void);
extern bNodeTreeType NodeTreeTypeUndefined;
extern struct bNodeType NodeTypeUndefined;
extern struct bNodeSocketType NodeSocketTypeUndefined;
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
namespace blender::bke {
bNodeSocket *node_find_enabled_socket(bNode &node, eNodeSocketInOut in_out, StringRef name);
bNodeSocket *node_find_enabled_input_socket(bNode &node, StringRef name);
bNodeSocket *node_find_enabled_output_socket(bNode &node, StringRef name);
} // namespace blender::bke
#endif
#define NODE_STORAGE_FUNCS(StorageT) \
[[maybe_unused]] static StorageT &node_storage(bNode &node) \
{ \
return *static_cast<StorageT *>(node.storage); \
} \
[[maybe_unused]] static const StorageT &node_storage(const bNode &node) \
{ \
return *static_cast<const StorageT *>(node.storage); \
}

View File

@ -0,0 +1,372 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2005 Blender Foundation */
mod_moder marked this conversation as resolved
Review

Always check new files for the right copyright. This should be Copyright 2023 Blender Foundation.

Always check new files for the right copyright. This should be `Copyright 2023 Blender Foundation.`

I added this in #107952

I added this in https://projects.blender.org/blender/blender/pulls/107952
#pragma once
/** \file
* \ingroup bke
*/
#include "BLI_compiler_compat.h"
#include "BLI_ghash.h"
#include "DNA_listBase.h"
#include "BKE_node.h"
/* for FOREACH_NODETREE_BEGIN */
#include "DNA_node_types.h"
#include "RNA_types.h"
#include "BLI_map.hh"
#include "BLI_string_ref.hh"
namespace blender::bke {
bNodeTree *ntreeAddTreeEmbedded(Main *bmain, ID *owner_id, const char *name, const char *idname);
/* Copy/free functions, need to manage ID users. */
/**
* Free (or release) any data used by this node-tree.
* Does not free the node-tree itself and does no ID user counting.
*/
void ntreeFreeTree(bNodeTree *ntree);
bNodeTree *ntreeCopyTree_ex(const bNodeTree *ntree, Main *bmain, bool do_id_user);
bNodeTree *ntreeCopyTree(Main *bmain, const bNodeTree *ntree);
void ntreeFreeLocalNode(bNodeTree *ntree, bNode *node);
bNode *ntreeFindType(bNodeTree *ntree, int type);
void ntreeUpdateAllNew(Main *main);
void ntreeNodeFlagSet(const bNodeTree *ntree, int flag, bool enable);
/**
* Merge local tree results back, and free local tree.
*
* We have to assume the editor already changed completely.
*/
void ntreeLocalMerge(Main *bmain, bNodeTree *localtree, bNodeTree *ntree);
/**
* \note `ntree` itself has been read!
*/
void ntreeBlendReadData(BlendDataReader *reader, ID *owner_id, bNodeTree *ntree);
void ntreeBlendReadLib(BlendLibReader *reader, bNodeTree *ntree);
void ntreeBlendReadExpand(BlendExpander *expander, bNodeTree *ntree);
/* -------------------------------------------------------------------- */
/** \name Node Tree Interface
* \{ */
bNodeSocket *ntreeFindSocketInterface(bNodeTree *ntree,
eNodeSocketInOut in_out,
const char *identifier);
bNodeSocket *ntreeInsertSocketInterface(bNodeTree *ntree,
eNodeSocketInOut in_out,
const char *idname,
bNodeSocket *next_sock,
const char *name);
bNodeSocket *ntreeAddSocketInterfaceFromSocket(bNodeTree *ntree,
const bNode *from_node,
const bNodeSocket *from_sock);
bNodeSocket *ntreeAddSocketInterfaceFromSocketWithName(bNodeTree *ntree,
const bNode *from_node,
const bNodeSocket *from_sock,
const char *idname,
const char *name);
bNodeSocket *ntreeInsertSocketInterfaceFromSocket(bNodeTree *ntree,
bNodeSocket *next_sock,
const bNode *from_node,
const bNodeSocket *from_sock);
/** \} */
bool node_type_is_undefined(const bNode *node);
bool nodeIsStaticSocketType(const bNodeSocketType *stype);
const char *nodeSocketSubTypeLabel(int subtype);
void nodeRemoveSocketEx(bNodeTree *ntree, bNode *node, bNodeSocket *sock, bool do_id_user);
void nodeRemoveAllSockets(bNodeTree *ntree, bNode *node);
void nodeModifySocketType(bNodeTree *ntree, bNode *node, bNodeSocket *sock, const char *idname);
/**
* \note Goes over entire tree.
*/
void nodeUnlinkNode(bNodeTree *ntree, bNode *node);
/**
* Rebuild the `node_by_id` runtime vector set. Call after removing a node if not handled
* separately. This is important instead of just using `nodes_by_id.remove()` since it maintains
* the node order.
*/
void nodeRebuildIDVector(bNodeTree *node_tree);
/**
* \note keeps socket list order identical, for copying links.
* \param use_unique: If true, make sure the node's identifier and name are unique in the new
* tree. Must be *true* if the \a dst_tree had nodes that weren't in the source node's tree.
* Must be *false* when simply copying a node tree, so that identifiers don't change.
*/
bNode *node_copy_with_mapping(bNodeTree *dst_tree,
const bNode &node_src,
int flag,
bool use_unique,
Map<const bNodeSocket *, bNodeSocket *> &new_socket_map);
bNode *node_copy(bNodeTree *dst_tree, const bNode &src_node, int flag, bool use_unique);
/**
* Move socket default from \a src (input socket) to locations specified by \a dst (output socket).
* Result value moved in specific location. (potentially multiple group nodes socket values, if \a
* dst is a group input node).
* \note Conceptually, the effect should be such that the evaluation of
* this graph again returns the value in src.
*/
void node_socket_move_default_value(Main &bmain,
bNodeTree &tree,
bNodeSocket &src,
bNodeSocket &dst);
/**
* Free the node itself.
*
* \note ID user reference-counting and changing the `nodes_by_id` vector are up to the caller.
*/
void node_free_node(bNodeTree *tree, bNode *node);
/**
* Set the mute status of a single link.
*/
void nodeLinkSetMute(bNodeTree *ntree, bNodeLink *link, const bool muted);
bool nodeLinkIsSelected(const bNodeLink *link);
void nodeInternalRelink(bNodeTree *ntree, bNode *node);
void nodeToView(const bNode *node, float x, float y, float *rx, float *ry);
void nodeFromView(const bNode *node, float x, float y, float *rx, float *ry);
void nodePositionRelative(bNode *from_node,
const bNode *to_node,
const bNodeSocket *from_sock,
const bNodeSocket *to_sock);
void nodePositionPropagate(bNode *node);
/**
* \note Recursive.
*/
bNode *nodeFindRootParent(bNode *node);
/**
* Iterate over a chain of nodes, starting with \a node_start, executing
* \a callback for each node (which can return false to end iterator).
*
* \param reversed: for backwards iteration
* \note Recursive
*/
void nodeChainIter(const bNodeTree *ntree,
const bNode *node_start,
bool (*callback)(bNode *, bNode *, void *, const bool),
void *userdata,
bool reversed);
/**
* Iterate over a chain of nodes, starting with \a node_start, executing
* \a callback for each node (which can return false to end iterator).
*
* Faster than nodeChainIter. Iter only once per node.
* Can be called recursively (using another nodeChainIterBackwards) by
* setting the recursion_lvl accordingly.
*
* \note Needs updated socket links (ntreeUpdateTree).
* \note Recursive
*/
void nodeChainIterBackwards(const bNodeTree *ntree,
const bNode *node_start,
bool (*callback)(bNode *, bNode *, void *),
void *userdata,
int recursion_lvl);
/**
* Iterate over all parents of \a node, executing \a callback for each parent
* (which can return false to end iterator)
*
* \note Recursive
*/
void nodeParentsIter(bNode *node, bool (*callback)(bNode *, void *), void *userdata);
/**
* A dangling reroute node is a reroute node that does *not* have a "data source", i.e. no
* non-reroute node is connected to its input.
*/
bool nodeIsDanglingReroute(const struct bNodeTree *ntree, const struct bNode *node);
struct bNodeLink *nodeFindLink(struct bNodeTree *ntree,
const struct bNodeSocket *from,
const struct bNodeSocket *to);
struct bNode *nodeGetActivePaintCanvas(struct bNodeTree *ntree);
/**
* \brief Does the given node supports the sub active flag.
*
* \param sub_active: The active flag to check. #NODE_ACTIVE_TEXTURE / #NODE_ACTIVE_PAINT_CANVAS.
*/
bool nodeSupportsActiveFlag(const struct bNode *node, int sub_active);
void nodeSetSocketAvailability(struct bNodeTree *ntree,
struct bNodeSocket *sock,
bool is_available);
/**
* If the node implements a `declare` function, this function makes sure that `node->declaration`
* is up to date. It is expected that the sockets of the node are up to date already.
*/
bool nodeDeclarationEnsure(struct bNodeTree *ntree, struct bNode *node);
/**
* Just update `node->declaration` if necessary. This can also be called on nodes that may not be
* up to date (e.g. because the need versioning or are dynamic).
*/
bool nodeDeclarationEnsureOnOutdatedNode(struct bNodeTree *ntree, struct bNode *node);
/**
* Update `socket->declaration` for all sockets in the node. This assumes that the node declaration
* and sockets are up to date already.
*/
void nodeSocketDeclarationsUpdate(struct bNode *node);
typedef GHashIterator bNodeInstanceHashIterator;
BLI_INLINE bNodeInstanceHashIterator *node_instance_hash_iterator_new(bNodeInstanceHash *hash)
{
return BLI_ghashIterator_new(hash->ghash);
}
BLI_INLINE void node_instance_hash_iterator_init(bNodeInstanceHashIterator *iter,
bNodeInstanceHash *hash)
{
BLI_ghashIterator_init(iter, hash->ghash);
}
BLI_INLINE void node_instance_hash_iterator_free(bNodeInstanceHashIterator *iter)
{
BLI_ghashIterator_free(iter);
}
BLI_INLINE bNodeInstanceKey node_instance_hash_iterator_get_key(bNodeInstanceHashIterator *iter)
{
return *(bNodeInstanceKey *)BLI_ghashIterator_getKey(iter);
}
BLI_INLINE void *node_instance_hash_iterator_get_value(bNodeInstanceHashIterator *iter)
{
return BLI_ghashIterator_getValue(iter);
}
BLI_INLINE void node_instance_hash_iterator_step(bNodeInstanceHashIterator *iter)
{
BLI_ghashIterator_step(iter);
}
BLI_INLINE bool node_instance_hash_iterator_done(bNodeInstanceHashIterator *iter)
{
return BLI_ghashIterator_done(iter);
}
#define NODE_INSTANCE_HASH_ITER(iter_, hash_) \
for (blender::bke::node_instance_hash_iterator_init(&iter_, hash_); \
blender::bke::node_instance_hash_iterator_done(&iter_) == false; \
blender::bke::node_instance_hash_iterator_step(&iter_))
/* Node Previews */
bool node_preview_used(const bNode *node);
bNodePreview *node_preview_verify(
bNodeInstanceHash *previews, bNodeInstanceKey key, int xsize, int ysize, bool create);
bNodePreview *node_preview_copy(bNodePreview *preview);
void node_preview_free(bNodePreview *preview);
void node_preview_init_tree(bNodeTree *ntree, int xsize, int ysize);
void node_preview_remove_unused(bNodeTree *ntree);
void node_preview_clear(bNodePreview *preview);
void node_preview_merge_tree(bNodeTree *to_ntree, bNodeTree *from_ntree, bool remove_old);
/* -------------------------------------------------------------------- */
/** \name Node Type Access
* \{ */
void nodeLabel(const bNodeTree *ntree, const bNode *node, char *label, int maxlen);
/**
* Get node socket label if it is set.
*/
const char *nodeSocketLabel(const bNodeSocket *sock);
/**
* Initialize a new node type struct with default values and callbacks.
*/
void node_type_base(bNodeType *ntype, int type, const char *name, short nclass);
void node_type_socket_templates(bNodeType *ntype,
bNodeSocketTemplate *inputs,
bNodeSocketTemplate *outputs);
void node_type_size(bNodeType *ntype, int width, int minwidth, int maxwidth);
enum class eNodeSizePreset : int8_t {
DEFAULT,
SMALL,
MIDDLE,
LARGE,
};
void node_type_size_preset(bNodeType *ntype, eNodeSizePreset size);
/* -------------------------------------------------------------------- */
/** \name Node Generic Functions
* \{ */
bool node_is_connected_to_output(const struct bNodeTree *ntree, const struct bNode *node);
bNodeSocket *node_find_enabled_socket(bNode &node, eNodeSocketInOut in_out, StringRef name);
bNodeSocket *node_find_enabled_input_socket(bNode &node, StringRef name);
bNodeSocket *node_find_enabled_output_socket(bNode &node, StringRef name);
extern bNodeTreeType NodeTreeTypeUndefined;
extern bNodeType NodeTypeUndefined;
extern bNodeSocketType NodeSocketTypeUndefined;
} // namespace blender::bke
#define NODE_STORAGE_FUNCS(StorageT) \
[[maybe_unused]] static StorageT &node_storage(bNode &node) \
{ \
return *static_cast<StorageT *>(node.storage); \
} \
[[maybe_unused]] static const StorageT &node_storage(const bNode &node) \
{ \
return *static_cast<const StorageT *>(node.storage); \
}

View File

@ -15,7 +15,7 @@
#include "DNA_node_types.h"
#include "BKE_node.h"
#include "BKE_node.hh"
struct bNode;
struct bNodeSocket;

View File

@ -70,7 +70,7 @@
#include "BKE_image_format.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.h"
#include "BKE_packedFile.h"

View File

@ -26,7 +26,7 @@
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_object.h"
#include "DNA_ID.h"

View File

@ -38,7 +38,7 @@
#include "BKE_lib_remap.h"
#include "BKE_main.h"
#include "BKE_main_namemap.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_report.h"
#include "BKE_scene.h"

View File

@ -21,7 +21,7 @@
#include "BKE_lib_remap.h"
#include "BKE_main.h"
#include "BKE_mesh.hh"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_object.h"
#include "BKE_scene.h"

View File

@ -33,7 +33,7 @@
#include "BKE_lib_query.h"
#include "BKE_linestyle.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_tree_update.h"
#include "BKE_texture.h"
@ -2038,7 +2038,8 @@ void BKE_linestyle_default_shader(const bContext *C, FreestyleLineStyle *linesty
BLI_assert(linestyle->nodetree == nullptr);
ntree = ntreeAddTreeEmbedded(nullptr, &linestyle->id, "stroke_shader", "ShaderNodeTree");
ntree = blender::bke::ntreeAddTreeEmbedded(
nullptr, &linestyle->id, "stroke_shader", "ShaderNodeTree");
uv_along_stroke = nodeAddStaticNode(C, ntree, SH_NODE_UVALONGSTROKE);
uv_along_stroke->locx = 0.0f;

View File

@ -57,7 +57,7 @@
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_mesh.hh"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_object.h"
#include "BKE_scene.h"
@ -1560,7 +1560,7 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma, const struct Ob
ma->texpaintslot = static_cast<TexPaintSlot *>(
MEM_callocN(sizeof(TexPaintSlot) * count, "texpaint_slots"));
bNode *active_node = nodeGetActivePaintCanvas(ma->nodetree);
bNode *active_node = blender::bke::nodeGetActivePaintCanvas(ma->nodetree);
fill_texpaint_slots_recursive(ma->nodetree, active_node, ob, ma, count, slot_filter);
@ -1932,7 +1932,7 @@ void BKE_material_copybuf_copy(Main *bmain, Material *ma)
matcopybuf = blender::dna::shallow_copy(*ma);
if (ma->nodetree != nullptr) {
matcopybuf.nodetree = ntreeCopyTree_ex(ma->nodetree, bmain, false);
matcopybuf.nodetree = blender::bke::ntreeCopyTree_ex(ma->nodetree, bmain, false);
}
matcopybuf.preview = nullptr;
@ -1962,7 +1962,7 @@ void BKE_material_copybuf_paste(Main *bmain, Material *ma)
(ma->id) = id;
if (matcopybuf.nodetree != nullptr) {
ma->nodetree = ntreeCopyTree_ex(matcopybuf.nodetree, bmain, false);
ma->nodetree = blender::bke::ntreeCopyTree_ex(matcopybuf.nodetree, bmain, false);
}
}
@ -2001,7 +2001,7 @@ static void material_default_surface_init(Material *ma)
{
strcpy(ma->id.name, "MADefault Surface");
bNodeTree *ntree = ntreeAddTreeEmbedded(
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
ma->use_nodes = true;
@ -2029,7 +2029,7 @@ static void material_default_volume_init(Material *ma)
{
strcpy(ma->id.name, "MADefault Volume");
bNodeTree *ntree = ntreeAddTreeEmbedded(
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
ma->use_nodes = true;
@ -2054,7 +2054,7 @@ static void material_default_holdout_init(Material *ma)
{
strcpy(ma->id.name, "MADefault Holdout");
bNodeTree *ntree = ntreeAddTreeEmbedded(
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
ma->use_nodes = true;

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "DNA_node_types.h"
@ -39,7 +39,7 @@ static void update_node_vector(const bNodeTree &ntree)
bNode &node = *nodes[i];
node.runtime->index_in_tree = i;
node.runtime->owner_tree = const_cast<bNodeTree *>(&ntree);
tree_runtime.has_undefined_nodes_or_sockets |= node.typeinfo == &NodeTypeUndefined;
tree_runtime.has_undefined_nodes_or_sockets |= node.typeinfo == &bke::NodeTypeUndefined;
if (node.is_group()) {
tree_runtime.group_nodes.append(&node);
}
@ -75,7 +75,8 @@ static void update_socket_vectors_and_owner_node(const bNodeTree &ntree)
socket->runtime->index_in_inout_sockets = tree_runtime.input_sockets.append_and_get_index(
socket);
socket->runtime->owner_node = node;
tree_runtime.has_undefined_nodes_or_sockets |= socket->typeinfo == &NodeSocketTypeUndefined;
tree_runtime.has_undefined_nodes_or_sockets |= socket->typeinfo ==
&bke::NodeSocketTypeUndefined;
}
LISTBASE_FOREACH (bNodeSocket *, socket, &node->outputs) {
socket->runtime->index_in_node = node_runtime.outputs.append_and_get_index(socket);
@ -83,7 +84,8 @@ static void update_socket_vectors_and_owner_node(const bNodeTree &ntree)
socket->runtime->index_in_inout_sockets = tree_runtime.output_sockets.append_and_get_index(
socket);
socket->runtime->owner_node = node;
tree_runtime.has_undefined_nodes_or_sockets |= socket->typeinfo == &NodeSocketTypeUndefined;
tree_runtime.has_undefined_nodes_or_sockets |= socket->typeinfo ==
&bke::NodeSocketTypeUndefined;
}
}
}

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "NOD_node_declaration.hh"
@ -41,7 +41,7 @@ static InputSocketFieldType get_interface_input_field_type(const bNode &node,
/* Outputs always support fields when the data type is correct. */
return InputSocketFieldType::IsSupported;
}
if (node.typeinfo == &NodeTypeUndefined) {
if (node.typeinfo == &blender::bke::NodeTypeUndefined) {
return InputSocketFieldType::None;
}
if (node.type == NODE_CUSTOM) {
@ -75,7 +75,7 @@ static OutputFieldDependency get_interface_output_field_dependency(const bNode &
/* Input nodes get special treatment in #determine_group_input_states. */
return OutputFieldDependency::ForDependentField();
}
if (node.typeinfo == &NodeTypeUndefined) {
if (node.typeinfo == &blender::bke::NodeTypeUndefined) {
return OutputFieldDependency::ForDataSource();
}
if (node.type == NODE_CUSTOM) {

View File

@ -15,7 +15,7 @@
#include "BKE_anim_data.h"
#include "BKE_image.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.h"
@ -540,7 +540,7 @@ class NodeTreeMainUpdater {
void update_individual_nodes(bNodeTree &ntree)
{
for (bNode *node : ntree.all_nodes()) {
nodeDeclarationEnsure(&ntree, node);
blender::bke::nodeDeclarationEnsure(&ntree, node);
if (this->should_update_individual_node(ntree, *node)) {
bNodeType &ntype = *node->typeinfo;
if (ntype.group_update_func) {
@ -701,7 +701,7 @@ class NodeTreeMainUpdater {
if ((ntree.runtime->changed_flag & allowed_flags) == ntree.runtime->changed_flag) {
return;
}
BKE_node_preview_remove_unused(&ntree);
blender::bke::node_preview_remove_unused(&ntree);
}
void propagate_runtime_flags(const bNodeTree &ntree)

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_zones.hh"

View File

@ -109,7 +109,7 @@
#include "BKE_mesh_wrapper.h"
#include "BKE_modifier.h"
#include "BKE_multires.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_object.h"
#include "BKE_object_facemap.h"
#include "BKE_paint.h"

View File

@ -78,7 +78,7 @@
#include "BKE_linestyle.h"
#include "BKE_main.h"
#include "BKE_mask.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_object.h"
#include "BKE_paint.h"

View File

@ -30,7 +30,7 @@
#include "BKE_lib_query.h"
#include "BKE_lib_remap.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_pointcache.h"
#include "BKE_simulation.h"
@ -51,7 +51,7 @@ static void simulation_init_data(ID *id)
MEMCPY_STRUCT_AFTER(simulation, DNA_struct_default_get(Simulation), id);
ntreeAddTreeEmbedded(nullptr, id, "Geometry Nodetree", ntreeType_Geometry->idname);
blender::bke::ntreeAddTreeEmbedded(nullptr, id, "Geometry Nodetree", ntreeType_Geometry->idname);
}
static void simulation_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag)

View File

@ -47,7 +47,7 @@
#include "BKE_lib_id.h"
#include "BKE_lib_query.h"
#include "BKE_material.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_scene.h"
#include "BKE_texture.h"

View File

@ -78,7 +78,7 @@
#include "BKE_material.h"
#include "BKE_mesh.hh"
#include "BKE_modifier.h"
#include "BKE_node.h" /* for tree type defines */
#include "BKE_node.hh" /* for tree type defines */
#include "BKE_object.h"
#include "BKE_packedFile.h"
#include "BKE_report.h"
@ -1844,7 +1844,7 @@ static void lib_link_id_embedded_id(BlendLibReader *reader, ID *id)
bNodeTree *nodetree = ntreeFromID(id);
if (nodetree != nullptr) {
lib_link_id(reader, &nodetree->id);
ntreeBlendReadLib(reader, nodetree);
blender::bke::ntreeBlendReadLib(reader, nodetree);
}
if (GS(id->name) == ID_SCE) {
@ -1915,7 +1915,7 @@ static void direct_link_id_embedded_id(BlendDataReader *reader,
(ID *)*nodetree,
id_old != nullptr ? (ID *)ntreeFromID(id_old) : nullptr,
0);
ntreeBlendReadData(reader, id, *nodetree);
blender::bke::ntreeBlendReadData(reader, id, *nodetree);
}
if (GS(id->name) == ID_SCE) {
@ -3950,7 +3950,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
/* After all data has been read and versioned, uses LIB_TAG_NEW. Theoretically this should
* not be calculated in the undo case, but it is currently needed even on undo to recalculate
* a cache. */
ntreeUpdateAllNew(bfd->main);
blender::bke::ntreeUpdateAllNew(bfd->main);
placeholders_ensure_valid(bfd->main);
@ -4287,7 +4287,7 @@ static void expand_id_embedded_id(BlendExpander *expander, ID *id)
bNodeTree *nodetree = ntreeFromID(id);
if (nodetree != nullptr) {
expand_id(expander, &nodetree->id);
ntreeBlendReadExpand(expander, nodetree);
blender::bke::ntreeBlendReadExpand(expander, nodetree);
}
if (GS(id->name) == ID_SCE) {
@ -4606,7 +4606,7 @@ static void library_link_end(Main *mainl, FileData **fd, const int flag)
BKE_main_id_refcount_recompute(mainvar, false);
/* After all data has been read and versioned, uses LIB_TAG_NEW. */
ntreeUpdateAllNew(mainvar);
blender::bke::ntreeUpdateAllNew(mainvar);
placeholders_ensure_valid(mainvar);

View File

@ -51,7 +51,7 @@
#include "BKE_mesh.hh"
#include "BKE_mesh_legacy_convert.h"
#include "BKE_multires.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "IMB_imbuf.h"
#include "MEM_guardedalloc.h"

View File

@ -65,7 +65,7 @@
#include "BKE_main_namemap.h"
#include "BKE_mesh.hh"
#include "BKE_modifier.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_screen.h"
#include "BKE_workspace.h"
@ -940,7 +940,7 @@ static void version_geometry_nodes_primitive_uv_maps(bNodeTree &ntree)
BLI_addhead(&ntree.nodes, node);
}
if (!new_nodes.is_empty()) {
nodeRebuildIDVector(&ntree);
blender::bke::nodeRebuildIDVector(&ntree);
}
}
@ -1074,7 +1074,7 @@ static void version_geometry_nodes_extrude_smooth_propagation(bNodeTree &ntree)
BLI_addhead(&ntree.nodes, node);
}
if (!new_nodes.is_empty()) {
nodeRebuildIDVector(&ntree);
blender::bke::nodeRebuildIDVector(&ntree);
}
}

View File

@ -20,7 +20,7 @@
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_main_namemap.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "MEM_guardedalloc.h"

View File

@ -50,7 +50,7 @@
#include "BKE_main_namemap.h"
#include "BKE_material.h"
#include "BKE_mesh.hh"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.h"
#include "BKE_paint.h"

View File

@ -104,7 +104,7 @@
#include "BKE_lib_override.h"
#include "BKE_lib_query.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_packedFile.h"
#include "BKE_report.h"
#include "BKE_workspace.h"

View File

@ -15,7 +15,7 @@
#include "BKE_main.h"
#include "BKE_mball_tessellate.h"
#include "BKE_modifier.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_scene.h"
#include "BKE_vfont.h"

View File

@ -5,7 +5,7 @@
#include "DNA_node_types.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "COM_NodeOperationBuilder.h"
@ -130,7 +130,7 @@ Node *COM_convert_bnode(bNode *b_node)
Node *node = nullptr;
/* ignore undefined nodes with missing or invalid node data */
if (nodeTypeUndefined(b_node)) {
if (blender::bke::node_type_is_undefined(b_node)) {
return nullptr;
}

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2011 Blender Foundation. */
#include "BKE_node.h"
#include "BKE_node.hh"
#include "RNA_access.h"
#include "RNA_prototypes.h"

View File

@ -5,7 +5,7 @@
#include "DNA_node_types.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "COM_Converter.h"

View File

@ -5,7 +5,7 @@
#include "BLT_translation.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_scene.h"
@ -37,7 +37,7 @@ static void compositor_init_node_previews(const RenderData *render_data, bNodeTr
preview_width = int(blender::compositor::COM_PREVIEW_SIZE / aspect);
preview_height = blender::compositor::COM_PREVIEW_SIZE;
}
BKE_node_preview_init_tree(node_tree, preview_width, preview_height);
blender::bke::node_preview_init_tree(node_tree, preview_width, preview_height);
}
static void compositor_reset_node_tree_status(bNodeTree *node_tree)

View File

@ -3,7 +3,7 @@
#include "COM_ConvertColorSpaceNode.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BLI_utildefines.h"

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2018 Blender Foundation. */
#include "BKE_node.h"
#include "BKE_node.hh"
#include "NOD_composite.h"

View File

@ -2,7 +2,7 @@
* Copyright 2011 Blender Foundation. */
#include "COM_FilterNode.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "COM_ConvolutionEdgeFilterOperation.h"
namespace blender::compositor {

View File

@ -2,7 +2,7 @@
* Copyright 2011 Blender Foundation. */
#include "COM_InvertNode.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "COM_InvertOperation.h"
namespace blender::compositor {

View File

@ -3,7 +3,7 @@
#include "COM_ScaleNode.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "COM_ScaleOperation.h"
#include "COM_SetValueOperation.h"

View File

@ -8,7 +8,7 @@
#include "DNA_movieclip_types.h"
#include "BKE_node.h"
#include "BKE_node.hh"
namespace blender::compositor {

View File

@ -3,7 +3,7 @@
#include "COM_PreviewOperation.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "IMB_colormanagement.h"
namespace blender::compositor {
@ -32,7 +32,7 @@ void PreviewOperation::verify_preview(bNodeInstanceHash *previews, bNodeInstance
/* Size (0, 0) ensures the preview rect is not allocated in advance,
* this is set later in init_execution once the resolution is determined.
*/
preview_ = BKE_node_preview_verify(previews, key, 0, 0, true);
preview_ = blender::bke::node_preview_verify(previews, key, 0, 0, true);
}
void PreviewOperation::init_execution()

View File

@ -2,7 +2,7 @@
* Copyright 2017 Blender Foundation. */
#include "COM_SMAAOperation.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "COM_SMAAAreaTexture.h"
extern "C" {

View File

@ -5,7 +5,7 @@
#include "COM_WorkScheduler.h"
#include "BKE_image.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_scene.h"
#include "NOD_texture.h"

View File

@ -6,7 +6,7 @@
#include "DNA_defaults.h"
#include "BKE_movieclip.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_tracking.h"
namespace blender::compositor {

View File

@ -8,7 +8,7 @@
#include "NOD_derived_node_tree.hh"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "COM_scheduler.hh"

View File

@ -78,7 +78,7 @@
#include "BKE_mesh.hh"
#include "BKE_modifier.h"
#include "BKE_movieclip.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_object.h"
#include "BKE_particle.h"

View File

@ -28,7 +28,7 @@
#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"

View File

@ -71,7 +71,7 @@
#include "BKE_material.h"
#include "BKE_mball.h"
#include "BKE_modifier.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_object.h"
#include "BKE_particle.h"

View File

@ -26,7 +26,7 @@
#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"

View File

@ -16,7 +16,7 @@
#include "BKE_geometry_set.hh"
#include "BKE_idprop.h"
#include "BKE_layer.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_object.h"
#include "BLI_math.h"

View File

@ -30,7 +30,7 @@
#include "BKE_anim_data.h"
#include "BKE_global.h"
#include "BKE_idtype.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "BKE_workspace.h"

View File

@ -8,7 +8,7 @@
#include "DRW_render.h"
#include "BKE_lib_id.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BLI_dynstr.h"
#include "BLI_string_utils.h"
@ -1029,7 +1029,7 @@ Material *EEVEE_material_default_diffuse_get(void)
if (!e_data.diffuse_mat) {
Material *ma = static_cast<Material *>(BKE_id_new_nomain(ID_MA, "EEVEEE default diffuse"));
bNodeTree *ntree = ntreeAddTreeEmbedded(
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
ma->use_nodes = true;
@ -1056,7 +1056,7 @@ Material *EEVEE_material_default_glossy_get(void)
if (!e_data.glossy_mat) {
Material *ma = static_cast<Material *>(BKE_id_new_nomain(ID_MA, "EEVEEE default metal"));
bNodeTree *ntree = ntreeAddTreeEmbedded(
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
ma->use_nodes = true;
@ -1085,7 +1085,7 @@ Material *EEVEE_material_default_error_get(void)
if (!e_data.error_mat) {
Material *ma = static_cast<Material *>(BKE_id_new_nomain(ID_MA, "EEVEEE default error"));
bNodeTree *ntree = ntreeAddTreeEmbedded(
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
ma->use_nodes = true;

View File

@ -10,7 +10,7 @@
#include "BKE_lib_id.h"
#include "BKE_material.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "NOD_shader.h"
#include "eevee_instance.hh"
@ -73,7 +73,7 @@ MaterialModule::MaterialModule(Instance &inst) : inst_(inst)
{
{
diffuse_mat = (::Material *)BKE_id_new_nomain(ID_MA, "EEVEE default diffuse");
bNodeTree *ntree = ntreeAddTreeEmbedded(
bNodeTree *ntree = bke::ntreeAddTreeEmbedded(
nullptr, &diffuse_mat->id, "Shader Nodetree", ntreeType_Shader->idname);
diffuse_mat->use_nodes = true;
/* To use the forward pipeline. */
@ -95,7 +95,7 @@ MaterialModule::MaterialModule(Instance &inst) : inst_(inst)
}
{
glossy_mat = (::Material *)BKE_id_new_nomain(ID_MA, "EEVEE default metal");
bNodeTree *ntree = ntreeAddTreeEmbedded(
bNodeTree *ntree = bke::ntreeAddTreeEmbedded(
nullptr, &glossy_mat->id, "Shader Nodetree", ntreeType_Shader->idname);
glossy_mat->use_nodes = true;
/* To use the forward pipeline. */
@ -119,7 +119,7 @@ MaterialModule::MaterialModule(Instance &inst) : inst_(inst)
}
{
error_mat_ = (::Material *)BKE_id_new_nomain(ID_MA, "EEVEE default error");
bNodeTree *ntree = ntreeAddTreeEmbedded(
bNodeTree *ntree = bke::ntreeAddTreeEmbedded(
nullptr, &error_mat_->id, "Shader Nodetree", ntreeType_Shader->idname);
error_mat_->use_nodes = true;

View File

@ -7,7 +7,7 @@
*/
#include "BKE_lib_id.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_world.h"
#include "DEG_depsgraph_query.h"
#include "NOD_shader.h"

View File

@ -10,7 +10,7 @@
#include "BLI_memblock.h"
#include "BKE_image.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BLI_dynstr.h"
#include "BLI_hash.h"

View File

@ -4,7 +4,7 @@
#include "BLI_hash.h"
/* get_image */
#include "BKE_node.h"
#include "BKE_node.hh"
#include "DNA_node_types.h"
#include "ED_uvedit.h"
/* get_image */

View File

@ -5,7 +5,7 @@
#include "BKE_context.h"
#include "BKE_idtype.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_object.h"
#include "DEG_depsgraph.h"
#include "RNA_define.h"

View File

@ -8,7 +8,7 @@
#include "BKE_context.h"
#include "BKE_curves.hh"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "ED_curves.h"

View File

@ -23,7 +23,7 @@
#include "BKE_cryptomatte.h"
#include "BKE_image.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_screen.h"
#include "NOD_composite.h"

View File

@ -25,7 +25,7 @@
#include "BKE_colorband.h"
#include "BKE_colortools.h"
#include "BKE_curveprofile.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_tracking.h"
#include "IMB_colormanagement.h"

View File

@ -31,7 +31,7 @@
#include "BKE_lib_override.h"
#include "BKE_lib_remap.h"
#include "BKE_material.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_report.h"
#include "BKE_screen.h"
#include "BKE_text.h"

View File

@ -75,7 +75,7 @@
#include "BKE_mesh.hh"
#include "BKE_mesh_runtime.h"
#include "BKE_nla.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_pointcloud.h"

View File

@ -35,7 +35,7 @@
#include "BKE_mesh.hh"
#include "BKE_mesh_mapping.h"
#include "BKE_modifier.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_object.h"
#include "BKE_report.h"
#include "BKE_scene.h"
@ -516,7 +516,7 @@ static bool bake_object_check(const Scene *scene,
if (image) {
if (node) {
if (BKE_node_is_connected_to_output(ntree, node)) {
if (blender::bke::node_is_connected_to_output(ntree, node)) {
/* we don't return false since this may be a false positive
* this can't be RPT_ERROR though, otherwise it prevents
* multiple highpoly objects to be baked at once */

View File

@ -35,7 +35,7 @@
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_tree_update.h"
#include "BKE_object.h"
#include "BKE_report.h"

View File

@ -55,7 +55,7 @@
#include "BKE_light.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_object.h"
#include "BKE_pose_backup.h"
#include "BKE_scene.h"

View File

@ -41,7 +41,7 @@
#include "BKE_linestyle.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_object.h"
#include "BKE_report.h"
#include "BKE_scene.h"

View File

@ -30,7 +30,7 @@
#include "BKE_icons.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_paint.h"
#include "BKE_scene.h"

View File

@ -63,7 +63,7 @@
#include "BKE_mesh.hh"
#include "BKE_mesh_mapping.h"
#include "BKE_mesh_runtime.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_paint.h"
#include "BKE_report.h"
#include "BKE_scene.h"
@ -6636,7 +6636,7 @@ static void default_paint_slot_color_get(int layer_type, Material *ma, float col
case LAYER_ROUGHNESS:
case LAYER_METALLIC: {
bNodeTree *ntree = nullptr;
bNode *in_node = ma ? ntreeFindType(ma->nodetree, SH_NODE_BSDF_PRINCIPLED) : nullptr;
bNode *in_node = ma ? blender::bke::ntreeFindType(ma->nodetree, SH_NODE_BSDF_PRINCIPLED) : nullptr;
if (!in_node) {
/* An existing material or Principled BSDF node could not be found.
* Copy default color values from a default Principled BSDF instead. */
@ -6667,7 +6667,7 @@ static void default_paint_slot_color_get(int layer_type, Material *ma, float col
}
/* Cleanup */
if (ntree) {
ntreeFreeTree(ntree);
blender::bke::ntreeFreeTree(ntree);
MEM_freeN(ntree);
}
return;
@ -6740,7 +6740,7 @@ static bool proj_paint_add_slot(bContext *C, wmOperator *op)
nodeSetActive(ntree, new_node);
/* Connect to first available principled BSDF node. */
bNode *in_node = ntreeFindType(ntree, SH_NODE_BSDF_PRINCIPLED);
bNode *in_node = blender::bke::ntreeFindType(ntree, SH_NODE_BSDF_PRINCIPLED);
bNode *out_node = new_node;
if (in_node != nullptr) {
@ -6776,7 +6776,7 @@ static bool proj_paint_add_slot(bContext *C, wmOperator *op)
}
else if (type == LAYER_DISPLACEMENT) {
/* Connect to the displacement output socket */
in_node = ntreeFindType(ntree, SH_NODE_OUTPUT_MATERIAL);
in_node = blender::bke::ntreeFindType(ntree, SH_NODE_OUTPUT_MATERIAL);
if (in_node != nullptr) {
in_sock = nodeFindSocket(in_node, SOCK_IN, layer_type_items[type].name);
@ -6791,13 +6791,13 @@ static bool proj_paint_add_slot(bContext *C, wmOperator *op)
if (in_sock != nullptr && link == nullptr) {
nodeAddLink(ntree, out_node, out_sock, in_node, in_sock);
nodePositionRelative(out_node, in_node, out_sock, in_sock);
blender::bke::nodePositionRelative(out_node, in_node, out_sock, in_sock);
}
}
ED_node_tree_propagate_change(C, bmain, ntree);
/* In case we added more than one node, position them too. */
nodePositionPropagate(out_node);
blender::bke::nodePositionPropagate(out_node);
if (ima) {
BKE_texpaint_slot_refresh_cache(scene, ma, ob);

View File

@ -33,7 +33,7 @@
#include "BKE_layer.h"
#include "BKE_linestyle.h"
#include "BKE_modifier.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_paint.h"
#include "BKE_particle.h"

View File

@ -6,7 +6,7 @@
#include "BKE_global.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.h"
#include "BKE_report.h"
@ -315,7 +315,7 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op)
}
for (bNode *new_node : node_map.values()) {
nodeDeclarationEnsure(&tree, new_node);
bke::nodeDeclarationEnsure(&tree, new_node);
}
remap_pairing(tree, node_map);

View File

@ -20,7 +20,7 @@
#include "BKE_curve.h"
#include "BKE_image.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.h"
#include "BKE_scene.h"
@ -1150,6 +1150,9 @@ void ED_node_init_butfuncs()
* Defined in blenkernel, but not registered in type hashes.
*/
using blender::bke::NodeTypeUndefined;
using blender::bke::NodeSocketTypeUndefined;
NodeTypeUndefined.draw_buttons = nullptr;
NodeTypeUndefined.draw_buttons_ex = nullptr;

View File

@ -83,7 +83,7 @@ static void add_reroute_node_fn(nodes::LinkSearchOpParams &params)
static void add_group_input_node_fn(nodes::LinkSearchOpParams &params)
{
/* Add a group input based on the connected socket, and add a new group input node. */
bNodeSocket *interface_socket = ntreeAddSocketInterfaceFromSocket(
bNodeSocket *interface_socket = bke::ntreeAddSocketInterfaceFromSocket(
&params.node_tree, &params.node, &params.socket);
const int group_input_index = BLI_findindex(&params.node_tree.inputs, interface_socket);

View File

@ -23,7 +23,7 @@
#include "BKE_image.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.h"
#include "BKE_report.h"

View File

@ -38,7 +38,7 @@
#include "BKE_idtype.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.h"
#include "BKE_node_tree_zones.hh"
@ -312,7 +312,7 @@ static Array<uiBlock *> node_uiblocks_init(const bContext &C, const Span<bNode *
float2 node_to_view(const bNode &node, const float2 &co)
{
float2 result;
nodeToView(&node, co.x, co.y, &result.x, &result.y);
bke::nodeToView(&node, co.x, co.y, &result.x, &result.y);
return result * UI_SCALE_FAC;
}
@ -332,7 +332,7 @@ float2 node_from_view(const bNode &node, const float2 &co)
const float x = co.x / UI_SCALE_FAC;
const float y = co.y / UI_SCALE_FAC;
float2 result;
nodeFromView(&node, x, y, &result.x, &result.y);
bke::nodeFromView(&node, x, y, &result.x, &result.y);
return result;
}
@ -402,7 +402,7 @@ static void node_update_basis(const bContext &C,
uiLayout *row = uiLayoutRow(layout, true);
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
const char *socket_label = nodeSocketLabel(socket);
const char *socket_label = bke::nodeSocketLabel(socket);
const char *socket_translation_context = node_socket_get_translation_context(*socket);
socket->typeinfo->draw((bContext *)&C,
row,
@ -539,7 +539,7 @@ static void node_update_basis(const bContext &C,
uiLayout *row = uiLayoutRow(layout, true);
const char *socket_label = nodeSocketLabel(socket);
const char *socket_label = bke::nodeSocketLabel(socket);
const char *socket_translation_context = node_socket_get_translation_context(*socket);
socket->typeinfo->draw((bContext *)&C,
row,
@ -1162,7 +1162,7 @@ static char *node_socket_get_tooltip(const SpaceNode *snode,
}
if (output.str().empty()) {
output << nodeSocketLabel(&socket);
output << bke::nodeSocketLabel(&socket);
}
return BLI_strdup(output.str().c_str());
@ -2322,7 +2322,7 @@ static void node_draw_basis(const bContext &C,
}
char showname[128];
nodeLabel(&ntree, &node, showname, sizeof(showname));
bke::nodeLabel(&ntree, &node, showname, sizeof(showname));
uiBut *but = uiDefBut(&block,
UI_BTYPE_LABEL,
@ -2351,7 +2351,7 @@ static void node_draw_basis(const bContext &C,
const float outline_width = 1.0f;
{
/* Use warning color to indicate undefined types. */
if (nodeTypeUndefined(&node)) {
if (bke::node_type_is_undefined(&node)) {
UI_GetThemeColorBlend4f(TH_REDALERT, TH_NODE, 0.4f, color);
}
/* Muted nodes get a mix of the background with the node color. */
@ -2424,7 +2424,7 @@ static void node_draw_basis(const bContext &C,
if (node.flag & SELECT) {
UI_GetThemeColor4fv((node.flag & NODE_ACTIVE) ? TH_ACTIVE : TH_SELECT, color_outline);
}
else if (nodeTypeUndefined(&node)) {
else if (bke::node_type_is_undefined(&node)) {
UI_GetThemeColor4fv(TH_REDALERT, color_outline);
}
else if (ELEM(node.type, GEO_NODE_SIMULATION_INPUT, GEO_NODE_SIMULATION_OUTPUT)) {
@ -2493,7 +2493,7 @@ static void node_draw_hidden(const bContext &C,
/* Body. */
float color[4];
{
if (nodeTypeUndefined(&node)) {
if (bke::node_type_is_undefined(&node)) {
/* Use warning color to indicate undefined types. */
UI_GetThemeColorBlend4f(TH_REDALERT, TH_NODE, 0.4f, color);
}
@ -2557,7 +2557,7 @@ static void node_draw_hidden(const bContext &C,
}
char showname[128];
nodeLabel(&ntree, &node, showname, sizeof(showname));
bke::nodeLabel(&ntree, &node, showname, sizeof(showname));
uiBut *but = uiDefBut(&block,
UI_BTYPE_LABEL,
@ -2590,7 +2590,7 @@ static void node_draw_hidden(const bContext &C,
if (node.flag & SELECT) {
UI_GetThemeColor4fv((node.flag & NODE_ACTIVE) ? TH_ACTIVE : TH_SELECT, color_outline);
}
else if (nodeTypeUndefined(&node)) {
else if (bke::node_type_is_undefined(&node)) {
UI_GetThemeColor4fv(TH_REDALERT, color_outline);
}
else {
@ -2855,7 +2855,7 @@ static void frame_node_draw_label(TreeDrawContext &tree_draw_ctx,
const float font_size = data->label_size / aspect;
char label[MAX_NAME];
nodeLabel(&ntree, &node, label, sizeof(label));
bke::nodeLabel(&ntree, &node, label, sizeof(label));
BLF_enable(fontid, BLF_ASPECT);
BLF_aspect(fontid, aspect, aspect, 1.0f);
@ -3247,14 +3247,14 @@ static void node_draw_nodetree(const bContext &C,
nodelink_batch_start(snode);
LISTBASE_FOREACH (const bNodeLink *, link, &ntree.links) {
if (!nodeLinkIsHidden(link) && !nodeLinkIsSelected(link)) {
if (!nodeLinkIsHidden(link) && !bke::nodeLinkIsSelected(link)) {
node_draw_link(C, region.v2d, snode, *link, false);
}
}
/* Draw selected node links after the unselected ones, so they are shown on top. */
LISTBASE_FOREACH (const bNodeLink *, link, &ntree.links) {
if (!nodeLinkIsHidden(link) && nodeLinkIsSelected(link)) {
if (!nodeLinkIsHidden(link) && bke::nodeLinkIsSelected(link)) {
node_draw_link(C, region.v2d, snode, *link, true);
}
}

View File

@ -23,7 +23,7 @@
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.h"
#include "BKE_report.h"
@ -206,7 +206,7 @@ static void compo_freejob(void *cjv)
CompoJob *cj = (CompoJob *)cjv;
if (cj->localtree) {
ntreeLocalMerge(cj->bmain, cj->localtree, cj->ntree);
bke::ntreeLocalMerge(cj->bmain, cj->localtree, cj->ntree);
}
if (cj->compositor_depsgraph != nullptr) {
DEG_graph_free(cj->compositor_depsgraph);
@ -506,7 +506,7 @@ void ED_node_shader_default(const bContext *C, ID *id)
ma_default = BKE_material_default_surface();
}
ma->nodetree = ntreeCopyTree(bmain, ma_default->nodetree);
ma->nodetree = blender::bke::ntreeCopyTree(bmain, ma_default->nodetree);
ma->nodetree->owner_id = &ma->id;
for (bNode *node_iter : ma->nodetree->all_nodes()) {
STRNCPY_UTF8(node_iter->name, DATA_(node_iter->name));
@ -517,7 +517,7 @@ void ED_node_shader_default(const bContext *C, ID *id)
}
else if (ELEM(GS(id->name), ID_WO, ID_LA)) {
/* Emission */
bNodeTree *ntree = ntreeAddTreeEmbedded(
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
nullptr, id, "Shader Nodetree", ntreeType_Shader->idname);
bNode *shader, *output;
@ -568,7 +568,7 @@ void ED_node_composit_default(const bContext *C, Scene *sce)
return;
}
sce->nodetree = ntreeAddTreeEmbedded(
sce->nodetree = blender::bke::ntreeAddTreeEmbedded(
nullptr, &sce->id, "Compositing Nodetree", ntreeType_Composite->idname);
sce->nodetree->chunksize = 256;
@ -601,7 +601,7 @@ void ED_node_texture_default(const bContext *C, Tex *tex)
return;
}
tex->nodetree = ntreeAddTreeEmbedded(
tex->nodetree = blender::bke::ntreeAddTreeEmbedded(
nullptr, &tex->id, "Texture Nodetree", ntreeType_Texture->idname);
bNode *out = nodeAddStaticNode(C, tex->nodetree, TEX_NODE_OUTPUT);
@ -1354,7 +1354,7 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
}
for (bNode *node : node_map.values()) {
nodeDeclarationEnsure(ntree, node);
blender::bke::nodeDeclarationEnsure(ntree, node);
}
/* Clear flags for recursive depth-first iteration. */
@ -1899,7 +1899,7 @@ static int node_delete_reconnect_exec(bContext *C, wmOperator * /*op*/)
LISTBASE_FOREACH_MUTABLE (bNode *, node, &snode->edittree->nodes) {
if (node->flag & SELECT) {
nodeInternalRelink(snode->edittree, node);
blender::bke::nodeInternalRelink(snode->edittree, node);
nodeRemoveNode(bmain, snode->edittree, node, true);
}
}
@ -2186,7 +2186,7 @@ static int ntree_socket_add_exec(bContext *C, wmOperator *op)
bNodeSocket *sock;
if (active_sock) {
/* Insert a copy of the active socket right after it. */
sock = ntreeInsertSocketInterface(
sock = blender::bke::ntreeInsertSocketInterface(
ntree, in_out, active_sock->idname, active_sock->next, active_sock->name);
/* XXX this only works for actual sockets, not interface templates! */
// nodeSocketCopyValue(sock, &ntree_ptr, active_sock, &ntree_ptr);
@ -2304,7 +2304,7 @@ static int ntree_socket_change_type_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
nodeModifySocketType(ntree, nullptr, iosock, socket_type->idname);
blender::bke::nodeModifySocketType(ntree, nullptr, iosock, socket_type->idname);
/* Need the extra update here because the loop above does not check for valid links in the node
* group we're currently editing. */

View File

@ -250,7 +250,7 @@ static bool node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode)
* - `ngroup` (i.e. the source NodeTree) is left unscathed.
* - Temp copy. do change ID user-count for the copies.
*/
bNodeTree *wgroup = ntreeCopyTree(bmain, ngroup);
bNodeTree *wgroup = bke::ntreeCopyTree(bmain, ngroup);
/* Add the nodes into the `ntree`. */
Vector<bNode *> new_nodes;
@ -529,7 +529,7 @@ static bool node_group_separate_selected(
}
}
if (!make_copy) {
nodeRebuildIDVector(&ngroup);
bke::nodeRebuildIDVector(&ngroup);
}
/* add internal links to the ntree */
@ -562,7 +562,7 @@ static bool node_group_separate_selected(
remap_pairing(ntree, nodes_to_move, node_identifier_map);
for (bNode *node : node_map.values()) {
nodeDeclarationEnsure(&ntree, node);
bke::nodeDeclarationEnsure(&ntree, node);
}
/* and copy across the animation,
@ -697,7 +697,7 @@ static bool node_group_make_test_selected(bNodeTree &ntree,
/* make a local pseudo node tree to pass to the node poll functions */
bNodeTree *ngroup = ntreeAddTree(nullptr, "Pseudo Node Group", ntree_idname);
BLI_SCOPED_DEFER([&]() {
ntreeFreeTree(ngroup);
bke::ntreeFreeTree(ngroup);
MEM_freeN(ngroup);
});
@ -791,7 +791,7 @@ static void get_min_max_of_nodes(const Span<bNode *> nodes,
INIT_MINMAX2(min, max);
for (const bNode *node : nodes) {
float2 loc;
nodeToView(node, node->offsetx, node->offsety, &loc.x, &loc.y);
bke::nodeToView(node, node->offsetx, node->offsety, &loc.x, &loc.y);
math::min_max(loc, min, max);
if (use_size) {
loc.x += node->width;
@ -844,11 +844,11 @@ static bNodeSocket *add_interface_from_socket(const bNodeTree &original_tree,
const bNodeSocket &socket_for_name = prefer_node_for_interface_name(socket.owner_node()) ?
socket :
socket_for_io;
return ntreeAddSocketInterfaceFromSocketWithName(&tree_for_interface,
&node_for_io,
&socket_for_io,
socket_for_io.idname,
socket_for_name.name);
return bke::ntreeAddSocketInterfaceFromSocketWithName(&tree_for_interface,
&node_for_io,
&socket_for_io,
socket_for_io.idname,
socket_for_name.name);
}
static void node_group_make_insert_selected(const bContext &C,
@ -960,7 +960,8 @@ static void node_group_make_insert_selected(const bContext &C,
if (socket->is_directly_linked()) {
continue;
}
const bNodeSocket *io_socket = ntreeAddSocketInterfaceFromSocket(&group, node, socket);
const bNodeSocket *io_socket = bke::ntreeAddSocketInterfaceFromSocket(
&group, node, socket);
new_internal_links.append({node, socket, io_socket});
}
};
@ -1012,7 +1013,7 @@ static void node_group_make_insert_selected(const bContext &C,
BKE_ntree_update_tag_node_removed(&ntree);
BKE_ntree_update_tag_node_new(&group, node);
}
nodeRebuildIDVector(&ntree);
bke::nodeRebuildIDVector(&ntree);
/* Update input and output node first, since the group node declaration can depend on them. */
nodes::update_node_declaration_and_sockets(group, *input_node);

View File

@ -12,7 +12,7 @@
#include "BLI_vector.hh"
#include "BLI_vector_set.hh"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "UI_interface.h"
#include "UI_interface.hh"

View File

@ -18,7 +18,7 @@
#include "BKE_curve.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.h"
#include "BKE_screen.h"
@ -1643,7 +1643,7 @@ static int mute_links_exec(bContext *C, wmOperator *op)
bke::node_tree_runtime::AllowUsingOutdatedInfo allow_outdated_info{ntree};
for (bNodeLink *link : affected_links) {
nodeLinkSetMute(&ntree, link, !(link->flag & NODE_LINK_MUTED));
bke::nodeLinkSetMute(&ntree, link, !(link->flag & NODE_LINK_MUTED));
const bool muted = link->flag & NODE_LINK_MUTED;
/* Propagate mute status downstream past reroute nodes. */
@ -1652,7 +1652,7 @@ static int mute_links_exec(bContext *C, wmOperator *op)
links.push_multiple(link->tonode->output_socket(0).directly_linked_links());
while (!links.is_empty()) {
bNodeLink *link = links.pop();
nodeLinkSetMute(&ntree, link, muted);
bke::nodeLinkSetMute(&ntree, link, muted);
if (!link->tonode->is_reroute()) {
continue;
}
@ -1666,7 +1666,7 @@ static int mute_links_exec(bContext *C, wmOperator *op)
links.push_multiple(link->fromnode->input_socket(0).directly_linked_links());
while (!links.is_empty()) {
bNodeLink *link = links.pop();
nodeLinkSetMute(&ntree, link, muted);
bke::nodeLinkSetMute(&ntree, link, muted);
if (!link->fromnode->is_reroute()) {
continue;
}
@ -1722,7 +1722,7 @@ static int detach_links_exec(bContext *C, wmOperator * /*op*/)
for (bNode *node : ntree.all_nodes()) {
if (node->flag & SELECT) {
nodeInternalRelink(&ntree, node);
bke::nodeInternalRelink(&ntree, node);
}
}
@ -2254,7 +2254,7 @@ bNodeSocket *get_main_socket(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_
ListBase *sockets = (in_out == SOCK_IN) ? &node.inputs : &node.outputs;
/* Try to get the main socket based on the socket declaration. */
nodeDeclarationEnsure(&ntree, &node);
bke::nodeDeclarationEnsure(&ntree, &node);
const nodes::NodeDeclaration *node_decl = node.declaration();
if (node_decl != nullptr) {
Span<nodes::SocketDeclarationPtr> socket_decls = (in_out == SOCK_IN) ? node_decl->inputs :
@ -2371,7 +2371,7 @@ static void node_link_insert_offset_frame_chains(bNodeTree *ntree,
{
for (bNode *node : ntree->all_nodes()) {
if (nodeIsParentAndChild(parent, node)) {
nodeChainIter(ntree, node, node_link_insert_offset_frame_chain_cb, data, reversed);
bke::nodeChainIter(ntree, node, node_link_insert_offset_frame_chain_cb, data, reversed);
}
}
}
@ -2402,7 +2402,7 @@ static bool node_link_insert_offset_chain_cb(bNode *fromnode,
}
}
else if (ofs_node->parent) {
bNode *node = nodeFindRootParent(ofs_node);
bNode *node = bke::nodeFindRootParent(ofs_node);
node_offset_apply(*node, data->offset_x);
}
else {
@ -2430,7 +2430,7 @@ static void node_link_insert_offset_ntree(NodeInsertOfsData *iofsd,
float margin = width;
/* NODE_TEST will be used later, so disable for all nodes */
ntreeNodeFlagSet(ntree, NODE_TEST, false);
bke::ntreeNodeFlagSet(ntree, NODE_TEST, false);
/* `insert.totr` isn't updated yet,
* so `totr_insert` is used to get the correct world-space coords. */
@ -2505,7 +2505,7 @@ static void node_link_insert_offset_ntree(NodeInsertOfsData *iofsd,
node_offset_apply(*offs_node, addval);
}
else if (!insert.parent && offs_node->parent) {
node_offset_apply(*nodeFindRootParent(offs_node), addval);
node_offset_apply(*bke::nodeFindRootParent(offs_node), addval);
}
margin = addval;
}
@ -2521,13 +2521,13 @@ static void node_link_insert_offset_ntree(NodeInsertOfsData *iofsd,
iofsd->offset_x = margin;
/* flag all parents of insert as offset to prevent them from being offset */
nodeParentsIter(&insert, node_parents_offset_flag_enable_cb, nullptr);
bke::nodeParentsIter(&insert, node_parents_offset_flag_enable_cb, nullptr);
/* iterate over entire chain and apply offsets */
nodeChainIter(ntree,
right_alignment ? next : prev,
node_link_insert_offset_chain_cb,
iofsd,
!right_alignment);
bke::nodeChainIter(ntree,
right_alignment ? next : prev,
node_link_insert_offset_chain_cb,
iofsd,
!right_alignment);
}
insert.parent = init_parent;

View File

@ -21,7 +21,7 @@
#include "BKE_context.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.h"
#include "BKE_workspace.h"

View File

@ -236,7 +236,7 @@ static void node_socket_add_replace(const bContext *C,
}
else {
sock_from_tmp = (bNodeSocket *)BLI_findlink(&node_from->outputs, item->socket_index);
nodePositionRelative(node_from, node_to, sock_from_tmp, sock_to);
bke::nodePositionRelative(node_from, node_to, sock_from_tmp, sock_to);
}
node_link_item_apply(ntree, node_from, item);
@ -468,7 +468,7 @@ static void ui_node_sock_name(const bNodeTree *ntree,
bNode *node = sock->link->fromnode;
char node_name[UI_MAX_NAME_STR];
nodeLabel(ntree, node, node_name, sizeof(node_name));
bke::nodeLabel(ntree, node, node_name, sizeof(node_name));
if (BLI_listbase_is_empty(&node->inputs) && node->outputs.first != node->outputs.last) {
BLI_snprintf(
@ -834,7 +834,7 @@ static void ui_node_draw_input(
sub = uiLayoutRow(sub, true);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT);
uiItemL(sub, IFACE_(nodeSocketLabel(&input)), ICON_NONE);
uiItemL(sub, IFACE_(bke::nodeSocketLabel(&input)), ICON_NONE);
}
if (dependency_loop) {

View File

@ -15,7 +15,7 @@
#include "BKE_context.h"
#include "BKE_image.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_screen.h"

View File

@ -18,7 +18,7 @@
#include "BKE_gpencil_legacy.h"
#include "BKE_lib_id.h"
#include "BKE_lib_remap.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_screen.h"

View File

@ -39,7 +39,7 @@
#include "BKE_main.h"
#include "BKE_main_namemap.h"
#include "BKE_modifier.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_report.h"

View File

@ -14,7 +14,7 @@
#include "BLI_rect.h"
#include "BKE_context.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.h"
#include "BKE_report.h"
@ -48,7 +48,7 @@ static void create_transform_data_for_node(TransData &td,
/* account for parents (nested nodes) */
if (node.parent) {
nodeToView(node.parent,
blender::bke::nodeToView(node.parent,
node.locx + roundf(node.offsetx),
node.locy + roundf(node.offsety),
&locx,
@ -249,7 +249,7 @@ static void flushTransNodes(TransInfo *t)
/* account for parents (nested nodes) */
if (node->parent) {
nodeFromView(node->parent,
blender::bke::nodeFromView(node->parent,
loc[0] - roundf(node->offsetx),
loc[1] - roundf(node->offsety),
&node->locx,

View File

@ -25,7 +25,7 @@
#include "BKE_lib_id.h"
#include "BKE_lib_query.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_scene.h"
#include "BKE_undo_system.h"

View File

@ -36,7 +36,7 @@
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_mesh.hh"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_tree_update.h"
#include "BKE_object.h"
#include "BKE_scene.h"
@ -214,7 +214,7 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain,
if (iNodeTree) {
// make a copy of linestyle->nodetree
ntree = ntreeCopyTree_ex(iNodeTree, bmain, do_id_user);
ntree = blender::bke::ntreeCopyTree_ex(iNodeTree, bmain, do_id_user);
// find the active Output Line Style node
for (bNode *node = (bNode *)ntree->nodes.first; node; node = node->next) {
@ -226,7 +226,8 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain,
ma->nodetree = ntree;
}
else {
ntree = ntreeAddTreeEmbedded(nullptr, &ma->id, "stroke_shader", "ShaderNodeTree");
ntree = blender::bke::ntreeAddTreeEmbedded(
nullptr, &ma->id, "stroke_shader", "ShaderNodeTree");
}
ma->use_nodes = true;
ma->blend_method = MA_BM_HASHED;

View File

@ -11,7 +11,7 @@
#include "StrokeRenderer.h"
#include "BKE_global.h"
#include "BKE_node.h"
#include "BKE_node.hh"
namespace Freestyle {

View File

@ -17,7 +17,7 @@
#include "BKE_global.h"
#include "BKE_material.h"
#include "BKE_mesh.hh"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_paint.h"
#include "BKE_pbvh.h"
#include "BKE_subdiv_ccg.h"

View File

@ -2,6 +2,8 @@
#include "Materials.h"
#include "BKE_node.hh"
#include "BKE_node_tree_update.h"
MaterialNode::MaterialNode(bContext *C, Material *ma, KeyImageMap &key_image_map)
@ -86,7 +88,7 @@ bNodeTree *MaterialNode::prepare_material_nodetree()
return nullptr;
}
ntreeAddTreeEmbedded(nullptr, &material->id, "Shader Nodetree", "ShaderNodeTree");
blender::bke::ntreeAddTreeEmbedded(nullptr, &material->id, "Shader Nodetree", "ShaderNodeTree");
material->use_nodes = true;
ntree = material->nodetree;
return ntree;
@ -247,7 +249,7 @@ void MaterialNode::set_diffuse(COLLADAFW::ColorOrTexture &cot)
Image *MaterialNode::get_diffuse_image()
{
bNode *shader = ntreeFindType(ntree, SH_NODE_BSDF_PRINCIPLED);
bNode *shader = blender::bke::ntreeFindType(ntree, SH_NODE_BSDF_PRINCIPLED);
if (shader == nullptr) {
return nullptr;
}

View File

@ -42,7 +42,7 @@
#include "BKE_mesh.hh"
#include "BKE_mesh_legacy_convert.h"
#include "BKE_mesh_runtime.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_object.h"
#include "BKE_scene.h"
@ -1114,7 +1114,7 @@ static std::string bc_get_uvlayer_name(Mesh *me, int layer)
static bNodeTree *prepare_material_nodetree(Material *ma)
{
if (ma->nodetree == nullptr) {
ntreeAddTreeEmbedded(nullptr, &ma->id, "Shader Nodetree", "ShaderNodeTree");
blender::bke::ntreeAddTreeEmbedded(nullptr, &ma->id, "Shader Nodetree", "ShaderNodeTree");
ma->use_nodes = true;
}
return ma->nodetree;

View File

@ -19,7 +19,7 @@
#include "BKE_lib_id.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_object.h"
#include "BKE_scene.h"
#include "BKE_world.h"

View File

@ -10,7 +10,7 @@
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_tree_update.h"
#include "BLI_fileops.h"
@ -374,7 +374,7 @@ void USDMaterialReader::import_usd_preview(Material *mtl,
* and output shaders. */
/* Add the node tree. */
bNodeTree *ntree = ntreeAddTreeEmbedded(nullptr, &mtl->id, "Shader Nodetree", "ShaderNodeTree");
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(nullptr, &mtl->id, "Shader Nodetree", "ShaderNodeTree");
mtl->use_nodes = true;
/* Create the Principled BSDF shader node. */

View File

@ -8,7 +8,7 @@
#include "BKE_image.h"
#include "BKE_image_format.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "IMB_colormanagement.h"

View File

@ -22,7 +22,7 @@
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_mesh.hh"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BLI_fileops.h"
#include "BLI_math.h"
#include "BLI_math_vector_types.hh"

View File

@ -5,7 +5,7 @@
*/
#include "BKE_image.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BLI_map.hh"

View File

@ -6,7 +6,7 @@
#include "BKE_image.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BLI_map.hh"
#include "BLI_math_vector.h"
@ -410,7 +410,7 @@ bNodeTree *create_mtl_node_tree(Main *bmain,
Material *mat,
bool relative_paths)
{
bNodeTree *ntree = ntreeAddTreeEmbedded(
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
nullptr, &mat->id, "Shader Nodetree", ntreeType_Shader->idname);
bNode *bsdf = add_node(ntree, SH_NODE_BSDF_PRINCIPLED, node_locx_bsdf, node_locy_top);

View File

@ -37,7 +37,7 @@
#include "BKE_idtype.h"
#include "BKE_lib_override.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_report.h"
#include "DEG_depsgraph.h"

View File

@ -17,7 +17,7 @@
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.h"
#include "BKE_tracking.h"
@ -75,7 +75,7 @@ static void localize(bNodeTree *localtree, bNodeTree *ntree)
local_node->runtime->original = node;
/* move over the compbufs */
/* right after #ntreeCopyTree() `oldsock` pointers are valid */
/* right after #blender::bke::ntreeCopyTree() `oldsock` pointers are valid */
if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
if (node->id) {
@ -96,7 +96,7 @@ static void localize(bNodeTree *localtree, bNodeTree *ntree)
static void local_merge(Main *bmain, bNodeTree *localtree, bNodeTree *ntree)
{
/* move over the compbufs and previews */
BKE_node_preview_merge_tree(ntree, localtree, true);
blender::bke::node_preview_merge_tree(ntree, localtree, true);
for (bNode *lnode = (bNode *)localtree->nodes.first; lnode; lnode = lnode->next) {
if (bNode *orig_node = nodeFindNodebyName(ntree, lnode->name)) {
@ -142,7 +142,7 @@ static void composite_node_add_init(bNodeTree * /*bnodetree*/, bNode *bnode)
static bool composite_node_tree_socket_type_valid(bNodeTreeType * /*ntreetype*/,
bNodeSocketType *socket_type)
{
return nodeIsStaticSocketType(socket_type) &&
return blender::bke::nodeIsStaticSocketType(socket_type) &&
ELEM(socket_type->type, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA);
}

View File

@ -30,7 +30,7 @@ void cmp_node_update_default(bNodeTree * /*ntree*/, bNode *node)
void cmp_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
{
node_type_base(ntype, type, name, nclass);
blender::bke::node_type_base(ntype, type, name, nclass);
ntype->poll = cmp_node_poll_default;
ntype->updatefunc = cmp_node_update_default;

View File

@ -106,7 +106,7 @@ void register_node_type_cmp_antialiasing()
ntype.declare = file_ns::cmp_node_antialiasing_declare;
ntype.draw_buttons = file_ns::node_composit_buts_antialiasing;
ntype.flag |= NODE_PREVIEW;
node_type_size(&ntype, 170, 140, 200);
blender::bke::node_type_size(&ntype, 170, 140, 200);
ntype.initfunc = file_ns::node_composit_init_antialiasing;
node_type_storage(
&ntype, "NodeAntiAliasingData", node_free_standard_storage, node_copy_standard_storage);

View File

@ -209,7 +209,7 @@ void register_node_type_cmp_colorbalance()
ntype.declare = file_ns::cmp_node_colorbalance_declare;
ntype.draw_buttons = file_ns::node_composit_buts_colorbalance;
ntype.draw_buttons_ex = file_ns::node_composit_buts_colorbalance_ex;
node_type_size(&ntype, 400, 200, 400);
blender::bke::node_type_size(&ntype, 400, 200, 400);
ntype.initfunc = file_ns::node_composit_init_colorbalance;
node_type_storage(
&ntype, "NodeColorBalance", node_free_standard_storage, node_copy_standard_storage);

View File

@ -352,7 +352,7 @@ void register_node_type_cmp_colorcorrection()
ntype.declare = file_ns::cmp_node_colorcorrection_declare;
ntype.draw_buttons = file_ns::node_composit_buts_colorcorrection;
ntype.draw_buttons_ex = file_ns::node_composit_buts_colorcorrection_ex;
node_type_size(&ntype, 400, 200, 600);
blender::bke::node_type_size(&ntype, 400, 200, 600);
ntype.initfunc = file_ns::node_composit_init_colorcorrection;
node_type_storage(
&ntype, "NodeColorCorrection", node_free_standard_storage, node_copy_standard_storage);

View File

@ -11,7 +11,7 @@
#include "node_common.h"
#include "node_composite_util.hh"
#include "BKE_node.h"
#include "BKE_node.hh"
#include "RNA_access.h"
@ -30,7 +30,7 @@ void register_node_type_cmp_group()
BLI_assert(ntype.rna_ext.srna != nullptr);
RNA_struct_blender_type_set(ntype.rna_ext.srna, &ntype);
node_type_size(&ntype, 140, 60, 400);
blender::bke::node_type_size(&ntype, 140, 60, 400);
ntype.labelfunc = node_group_label;
ntype.declare_dynamic = blender::nodes::node_group_declare_dynamic;

View File

@ -159,7 +159,7 @@ void register_node_type_cmp_convert_color_space(void)
&ntype, CMP_NODE_CONVERT_COLOR_SPACE, "Convert Colorspace", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::CMP_NODE_CONVERT_COLOR_SPACE_declare;
ntype.draw_buttons = file_ns::node_composit_buts_convert_colorspace;
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::MIDDLE);
ntype.initfunc = file_ns::node_composit_init_convert_colorspace;
node_type_storage(
&ntype, "NodeConvertColorSpace", node_free_standard_storage, node_copy_standard_storage);

View File

@ -334,9 +334,9 @@ void register_node_type_cmp_cryptomatte()
static bNodeType ntype;
cmp_node_type_base(&ntype, CMP_NODE_CRYPTOMATTE, "Cryptomatte", NODE_CLASS_MATTE);
node_type_socket_templates(
blender::bke::node_type_socket_templates(
&ntype, file_ns::cmp_node_cryptomatte_in, file_ns::cmp_node_cryptomatte_out);
node_type_size(&ntype, 240, 100, 700);
blender::bke::node_type_size(&ntype, 240, 100, 700);
ntype.initfunc = file_ns::node_init_cryptomatte;
ntype.initfunc_api = file_ns::node_init_api_cryptomatte;
ntype.poll = file_ns::node_poll_cryptomatte;
@ -426,7 +426,7 @@ void register_node_type_cmp_cryptomatte_legacy()
cmp_node_type_base(
&ntype, CMP_NODE_CRYPTOMATTE_LEGACY, "Cryptomatte (Legacy)", NODE_CLASS_MATTE);
node_type_socket_templates(&ntype, nullptr, file_ns::cmp_node_cryptomatte_out);
blender::bke::node_type_socket_templates(&ntype, nullptr, file_ns::cmp_node_cryptomatte_out);
ntype.initfunc = legacy_file_ns::node_init_cryptomatte_legacy;
node_type_storage(
&ntype, "NodeCryptomatte", file_ns::node_free_cryptomatte, file_ns::node_copy_cryptomatte);

Some files were not shown because too many files have changed in this diff Show More