Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesdna/DNA_node_types.h')
-rw-r--r--source/blender/makesdna/DNA_node_types.h342
1 files changed, 297 insertions, 45 deletions
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 61a03b46f9e..bf2c9b2eb61 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -12,8 +12,33 @@
#include "DNA_scene_types.h" /* for #ImageFormatData */
#include "DNA_vec_types.h" /* for #rctf */
+/** Workaround to forward-declare C++ type in C header. */
#ifdef __cplusplus
-extern "C" {
+namespace blender {
+template<typename T> class Span;
+class StringRef;
+class StringRefNull;
+} // namespace blender
+namespace blender::nodes {
+class NodeDeclaration;
+class SocketDeclaration;
+} // namespace blender::nodes
+namespace blender::bke {
+class bNodeTreeRuntime;
+class bNodeRuntime;
+class bNodeSocketRuntime;
+} // namespace blender::bke
+using NodeDeclarationHandle = blender::nodes::NodeDeclaration;
+using SocketDeclarationHandle = blender::nodes::SocketDeclaration;
+using bNodeTreeRuntimeHandle = blender::bke::bNodeTreeRuntime;
+using bNodeRuntimeHandle = blender::bke::bNodeRuntime;
+using bNodeSocketRuntimeHandle = blender::bke::bNodeSocketRuntime;
+#else
+typedef struct NodeDeclarationHandle NodeDeclarationHandle;
+typedef struct SocketDeclarationHandle SocketDeclarationHandle;
+typedef struct bNodeTreeRuntimeHandle bNodeTreeRuntimeHandle;
+typedef struct bNodeRuntimeHandle bNodeRuntimeHandle;
+typedef struct bNodeSocketRuntimeHandle bNodeSocketRuntimeHandle;
#endif
struct AnimData;
@@ -30,6 +55,7 @@ struct bNodeLink;
struct bNodePreview;
struct bNodeTreeExec;
struct bNodeType;
+struct bNode;
struct uiBlock;
#define NODE_MAXSTR 64
@@ -65,30 +91,6 @@ typedef struct bNodeStack {
#define NS_CR_FIT 4
#define NS_CR_STRETCH 5
-/** Workaround to forward-declare C++ type in C header. */
-#ifdef __cplusplus
-namespace blender::nodes {
-class NodeDeclaration;
-class SocketDeclaration;
-} // namespace blender::nodes
-namespace blender::bke {
-class bNodeTreeRuntime;
-class bNodeRuntime;
-class bNodeSocketRuntime;
-} // namespace blender::bke
-using NodeDeclarationHandle = blender::nodes::NodeDeclaration;
-using SocketDeclarationHandle = blender::nodes::SocketDeclaration;
-using bNodeTreeRuntimeHandle = blender::bke::bNodeTreeRuntime;
-using bNodeRuntimeHandle = blender::bke::bNodeRuntime;
-using bNodeSocketRuntimeHandle = blender::bke::bNodeSocketRuntime;
-#else
-typedef struct NodeDeclarationHandle NodeDeclarationHandle;
-typedef struct SocketDeclarationHandle SocketDeclarationHandle;
-typedef struct bNodeTreeRuntimeHandle bNodeTreeRuntimeHandle;
-typedef struct bNodeRuntimeHandle bNodeRuntimeHandle;
-typedef struct bNodeSocketRuntimeHandle bNodeSocketRuntimeHandle;
-#endif
-
typedef struct bNodeSocket {
struct bNodeSocket *next, *prev;
@@ -133,16 +135,16 @@ typedef struct bNodeSocket {
/** Default input value used for unlinked sockets. */
void *default_value;
- /* execution data */
- /** Local stack index. */
+ /** Local stack index for "node_exec". */
short stack_index;
- /* XXX deprecated, kept for forward compatibility */
- short stack_type DNA_DEPRECATED;
char display_shape;
/* #eAttrDomain used when the geometry nodes modifier creates an attribute for a group
* output. */
char attribute_domain;
+
+ char _pad[2];
+
/* Runtime-only cache of the number of input links, for multi-input sockets. */
short total_inputs;
@@ -168,9 +170,6 @@ typedef struct bNodeSocket {
int own_index DNA_DEPRECATED;
/* XXX deprecated, only used for restoring old group node links */
int to_index DNA_DEPRECATED;
- /* XXX deprecated, still forward compatible since verification
- * restores pointer from matching own_index. */
- struct bNodeSocket *groupsock DNA_DEPRECATED;
/** A link pointer, set in #BKE_ntree_update_main. */
struct bNodeLink *link;
@@ -181,6 +180,50 @@ typedef struct bNodeSocket {
bNodeStack ns DNA_DEPRECATED;
bNodeSocketRuntimeHandle *runtime;
+
+#ifdef __cplusplus
+ bool is_available() const;
+ bool is_multi_input() const;
+ bool is_input() const;
+ bool is_output() const;
+
+ /** Utility to access the value of the socket. */
+ template<typename T> const T *default_value_typed() const;
+
+ /* The following methods are only available when #bNodeTree.ensure_topology_cache has been
+ * called. */
+
+ /** Zero based index for every input and output socket. */
+ int index() const;
+ /** Socket index in the entire node tree. Inputs and outputs share the same index space. */
+ int index_in_tree() const;
+ /** Node this socket belongs to. */
+ bNode &owner_node();
+ const bNode &owner_node() const;
+ /** Node tree this socket belongs to. */
+ const bNodeTree &owner_tree() const;
+
+ /** Links which are incident to this socket. */
+ blender::Span<bNodeLink *> directly_linked_links();
+ blender::Span<const bNodeLink *> directly_linked_links() const;
+ /** Sockets which are connected to this socket with a link. */
+ blender::Span<bNodeSocket *> directly_linked_sockets();
+ blender::Span<const bNodeSocket *> directly_linked_sockets() const;
+ bool is_directly_linked() const;
+ /**
+ * Sockets which are connected to this socket when reroutes and muted nodes are taken into
+ * account.
+ */
+ blender::Span<const bNodeSocket *> logically_linked_sockets() const;
+ bool is_logically_linked() const;
+
+ /**
+ * For output sockets, this is the corresponding input socket the value of which should be
+ * forwarded when the node is muted.
+ */
+ const bNodeSocket *internal_link_input() const;
+
+#endif
} bNodeSocket;
/** #bNodeSocket.type & #bNodeSocketType.type */
@@ -333,6 +376,40 @@ typedef struct bNode {
char iter_flag;
bNodeRuntimeHandle *runtime;
+
+#ifdef __cplusplus
+ blender::StringRefNull label_or_name() const;
+ bool is_muted() const;
+ bool is_reroute() const;
+ bool is_frame() const;
+ bool is_group() const;
+ bool is_group_input() const;
+ bool is_group_output() const;
+ const blender::nodes::NodeDeclaration *declaration() const;
+
+ /* The following methods are only available when #bNodeTree.ensure_topology_cache has been
+ * called. */
+
+ /** A span containing all input sockets of the node (including unavailable sockets). */
+ blender::Span<bNodeSocket *> input_sockets();
+ blender::Span<const bNodeSocket *> input_sockets() const;
+ /** A span containing all output sockets of the node (including unavailable sockets). */
+ blender::Span<bNodeSocket *> output_sockets();
+ blender::Span<const bNodeSocket *> output_sockets() const;
+ /** Utility to get an input socket by its index. */
+ bNodeSocket &input_socket(int index);
+ const bNodeSocket &input_socket(int index) const;
+ /** Utility to get an output socket by its index. */
+ bNodeSocket &output_socket(int index);
+ const bNodeSocket &output_socket(int index) const;
+ /** A span containing all internal links when the node is muted. */
+ blender::Span<const bNodeLink *> internal_links_span() const;
+ /** Lookup socket of this node by its identifier. */
+ const bNodeSocket &input_by_identifier(blender::StringRef identifier) const;
+ const bNodeSocket &output_by_identifier(blender::StringRef identifier) const;
+ /** Node tree this node belongs to. */
+ const bNodeTree &owner_tree() const;
+#endif
} bNode;
/* node->flag */
@@ -422,6 +499,12 @@ typedef struct bNodeLink {
int flag;
int multi_input_socket_index;
+
+#ifdef __cplusplus
+ bool is_muted() const;
+ bool is_available() const;
+#endif
+
} bNodeLink;
/* link->flag */
@@ -453,6 +536,9 @@ typedef struct bNodeTree {
/** Animation data (must be immediately after id for utilities to use it). */
struct AnimData *adt;
+ /** The ID owning this node tree, in case it is an embedded one. */
+ ID *owner_id;
+
/** Runtime type information. */
struct bNodeTreeType *typeinfo;
/** Runtime type identifier. */
@@ -535,6 +621,53 @@ typedef struct bNodeTree {
struct PreviewImage *preview;
bNodeTreeRuntimeHandle *runtime;
+
+#ifdef __cplusplus
+ /**
+ * Update a run-time cache for the node tree based on it's current state. This makes many methods
+ * available which allow efficient lookup for topology information (like neighboring sockets).
+ */
+ void ensure_topology_cache() const;
+
+ /* The following methods are only available when #bNodeTree.ensure_topology_cache has been
+ * called. */
+
+ /** A span containing all nodes in the node tree. */
+ blender::Span<bNode *> all_nodes();
+ blender::Span<const bNode *> all_nodes() const;
+ /** A span containing all group nodes in the node tree. */
+ blender::Span<bNode *> group_nodes();
+ blender::Span<const bNode *> group_nodes() const;
+ /** A span containing all input sockets in the node tree. */
+ blender::Span<bNodeSocket *> all_input_sockets();
+ blender::Span<const bNodeSocket *> all_input_sockets() const;
+ /** A span containing all output sockets in the node tree. */
+ blender::Span<bNodeSocket *> all_output_sockets();
+ blender::Span<const bNodeSocket *> all_output_sockets() const;
+ /** A span containing all sockets in the node tree. */
+ blender::Span<bNodeSocket *> all_sockets();
+ blender::Span<const bNodeSocket *> all_sockets() const;
+ /** Efficient lookup of all nodes with a specific type. */
+ blender::Span<bNode *> nodes_by_type(blender::StringRefNull type_idname);
+ blender::Span<const bNode *> nodes_by_type(blender::StringRefNull type_idname) const;
+ /**
+ * Cached toposort of all nodes. If there are cycles, the returned array is not actually a
+ * toposort. However, if a connected component does not contain a cycle, this component is sorted
+ * correctly. Use #has_available_link_cycle to check for cycles.
+ */
+ blender::Span<const bNode *> toposort_left_to_right() const;
+ blender::Span<const bNode *> toposort_right_to_left() const;
+ /** True when there are any cycles in the node tree. */
+ bool has_available_link_cycle() const;
+ /**
+ * True when there are nodes or sockets in the node tree that don't use a known type. This can
+ * happen when nodes don't exist in the current Blender version that existed in the version where
+ * this node tree was saved.
+ */
+ bool has_undefined_nodes_or_sockets() const;
+ /** Get the active group output node. */
+ const bNode *group_output_node() const;
+#endif
} bNodeTree;
/** #NodeTree.type, index */
@@ -632,19 +765,19 @@ typedef struct bNodeSocketValueMaterial {
/* Data structs, for `node->storage`. */
-enum {
+typedef enum CMPNodeMaskType {
CMP_NODE_MASKTYPE_ADD = 0,
CMP_NODE_MASKTYPE_SUBTRACT = 1,
CMP_NODE_MASKTYPE_MULTIPLY = 2,
CMP_NODE_MASKTYPE_NOT = 3,
-};
+} CMPNodeMaskType;
-enum {
- CMP_NODE_DILATEERODE_STEP = 0,
- CMP_NODE_DILATEERODE_DISTANCE_THRESH = 1,
- CMP_NODE_DILATEERODE_DISTANCE = 2,
- CMP_NODE_DILATEERODE_DISTANCE_FEATHER = 3,
-};
+typedef enum CMPNodeDilateErodeMethod {
+ CMP_NODE_DILATE_ERODE_STEP = 0,
+ CMP_NODE_DILATE_ERODE_DISTANCE_THRESHOLD = 1,
+ CMP_NODE_DILATE_ERODE_DISTANCE = 2,
+ CMP_NODE_DILATE_ERODE_DISTANCE_FEATHER = 3,
+} CMPNodeDilateErodeMethod;
enum {
CMP_NODE_INPAINT_SIMPLE = 0,
@@ -857,7 +990,7 @@ typedef struct NodeGlare {
char _pad1[4];
} NodeGlare;
-/** Tonemap node. */
+/** Tone-map node. */
typedef struct NodeTonemap {
float key, offset, gamma;
float f, m, a, c;
@@ -1376,6 +1509,15 @@ typedef struct NodeGeometryTransferAttribute {
char _pad[1];
} NodeGeometryTransferAttribute;
+typedef struct NodeGeometrySampleIndex {
+ /* eCustomDataType. */
+ int8_t data_type;
+ /* eAttrDomain. */
+ int8_t domain;
+ int8_t clamp;
+ char _pad[1];
+} NodeGeometrySampleIndex;
+
typedef struct NodeGeometryRaycast {
/* GeometryNodeRaycastMapMode. */
uint8_t mapping;
@@ -1453,6 +1595,8 @@ typedef struct NodeGeometryImageTexture {
typedef struct NodeGeometryViewer {
/* eCustomDataType. */
int8_t data_type;
+ /* eAttrDomain. */
+ int8_t domain;
} NodeGeometryViewer;
typedef struct NodeGeometryUVUnwrap {
@@ -1460,6 +1604,11 @@ typedef struct NodeGeometryUVUnwrap {
uint8_t method;
} NodeGeometryUVUnwrap;
+typedef struct NodeGeometryDistributePointsInVolume {
+ /* GeometryNodePointDistributeVolumeMode. */
+ uint8_t mode;
+} NodeGeometryDistributePointsInVolume;
+
typedef struct NodeFunctionCompare {
/* NodeCompareOperation */
int8_t operation;
@@ -1475,6 +1624,17 @@ typedef struct NodeCombSepColor {
int8_t mode;
} NodeCombSepColor;
+typedef struct NodeShaderMix {
+ /* eNodeSocketDatatype */
+ int8_t data_type;
+ /* NodeShaderMixMode */
+ int8_t factor_mode;
+ int8_t clamp_factor;
+ int8_t clamp_result;
+ int8_t blend_type;
+ char _pad[3];
+} NodeShaderMix;
+
/* script node mode */
#define NODE_SCRIPT_INTERNAL 0
#define NODE_SCRIPT_EXTERNAL 1
@@ -1529,6 +1689,7 @@ enum {
SHD_ATTRIBUTE_GEOMETRY = 0,
SHD_ATTRIBUTE_OBJECT = 1,
SHD_ATTRIBUTE_INSTANCER = 2,
+ SHD_ATTRIBUTE_VIEW_LAYER = 3,
};
/* toon modes */
@@ -1768,6 +1929,11 @@ typedef enum NodeBooleanMathOperation {
NODE_BOOLEAN_MATH_NIMPLY = 8,
} NodeBooleanMathOperation;
+typedef enum NodeShaderMixMode {
+ NODE_MIX_MODE_UNIFORM = 0,
+ NODE_MIX_MODE_NON_UNIFORM = 1,
+} NodeShaderMixMode;
+
typedef enum NodeCompareMode {
NODE_COMPARE_MODE_ELEMENT = 0,
NODE_COMPARE_MODE_LENGTH = 1,
@@ -1844,6 +2010,91 @@ enum {
/* viewer and composite output. */
#define CMP_NODE_OUTPUT_IGNORE_ALPHA 1
+/** Split Viewer Node. Stored in `custom2`. */
+typedef enum CMPNodeSplitViewerAxis {
+ CMP_NODE_SPLIT_VIEWER_HORIZONTAL = 0,
+ CMP_NODE_SPLIT_VIEWER_VERTICAL = 1,
+} CMPNodeSplitViewerAxis;
+
+/** Color Balance Node. Stored in `custom1`. */
+typedef enum CMPNodeColorBalanceMethod {
+ CMP_NODE_COLOR_BALANCE_LGG = 0,
+ CMP_NODE_COLOR_BALANCE_ASC_CDL = 1,
+} CMPNodeColorBalanceMethod;
+
+/** Alpha Convert Node. Stored in `custom1`. */
+typedef enum CMPNodeAlphaConvertMode {
+ CMP_NODE_ALPHA_CONVERT_PREMULTIPLY = 0,
+ CMP_NODE_ALPHA_CONVERT_UNPREMULTIPLY = 1,
+} CMPNodeAlphaConvertMode;
+
+/** Distance Matte Node. Stored in #NodeChroma.channel. */
+typedef enum CMPNodeDistanceMatteColorSpace {
+ CMP_NODE_DISTANCE_MATTE_COLOR_SPACE_YCCA = 0,
+ CMP_NODE_DISTANCE_MATTE_COLOR_SPACE_RGBA = 1,
+} CMPNodeDistanceMatteColorSpace;
+
+/** Color Spill Node. Stored in `custom2`. */
+typedef enum CMPNodeColorSpillLimitAlgorithm {
+ CMP_NODE_COLOR_SPILL_LIMIT_ALGORITHM_SINGLE = 0,
+ CMP_NODE_COLOR_SPILL_LIMIT_ALGORITHM_AVERAGE = 1,
+} CMPNodeColorSpillLimitAlgorithm;
+
+/** Channel Matte Node. Stored in #NodeChroma.algorithm. */
+typedef enum CMPNodeChannelMatteLimitAlgorithm {
+ CMP_NODE_CHANNEL_MATTE_LIMIT_ALGORITHM_SINGLE = 0,
+ CMP_NODE_CHANNEL_MATTE_LIMIT_ALGORITHM_MAX = 1,
+} CMPNodeChannelMatteLimitAlgorithm;
+
+/* Flip Node. Stored in custom1. */
+typedef enum CMPNodeFlipMode {
+ CMP_NODE_FLIP_X = 0,
+ CMP_NODE_FLIP_Y = 1,
+ CMP_NODE_FLIP_X_Y = 2,
+} CMPNodeFlipMode;
+
+/* Scale Node. Stored in custom1. */
+typedef enum CMPNodeScaleMethod {
+ CMP_NODE_SCALE_RELATIVE = 0,
+ CMP_NODE_SCALE_ABSOLUTE = 1,
+ CMP_NODE_SCALE_RENDER_PERCENT = 2,
+ CMP_NODE_SCALE_RENDER_SIZE = 3,
+} CMPNodeScaleMethod;
+
+/* Scale Node. Stored in custom2. */
+typedef enum CMPNodeScaleRenderSizeMethod {
+ CMP_NODE_SCALE_RENDER_SIZE_STRETCH = 0,
+ CMP_NODE_SCALE_RENDER_SIZE_FIT = 1,
+ CMP_NODE_SCALE_RENDER_SIZE_CROP = 2,
+} CMPNodeScaleRenderSizeMethod;
+
+/* Filter Node. Stored in custom1. */
+typedef enum CMPNodeFilterMethod {
+ CMP_NODE_FILTER_SOFT = 0,
+ CMP_NODE_FILTER_SHARP_BOX = 1,
+ CMP_NODE_FILTER_LAPLACE = 2,
+ CMP_NODE_FILTER_SOBEL = 3,
+ CMP_NODE_FILTER_PREWITT = 4,
+ CMP_NODE_FILTER_KIRSCH = 5,
+ CMP_NODE_FILTER_SHADOW = 6,
+ CMP_NODE_FILTER_SHARP_DIAMOND = 7,
+} CMPNodeFilterMethod;
+
+/* Levels Node. Stored in custom1. */
+typedef enum CMPNodeLevelsChannel {
+ CMP_NODE_LEVLES_LUMINANCE = 1,
+ CMP_NODE_LEVLES_RED = 2,
+ CMP_NODE_LEVLES_GREEN = 3,
+ CMP_NODE_LEVLES_BLUE = 4,
+ CMP_NODE_LEVLES_LUMINANCE_BT709 = 5,
+} CMPNodeLevelsChannel;
+
+/* Tone Map Node. Stored in NodeTonemap.type. */
+typedef enum CMPNodeToneMapType {
+ CMP_NODE_TONE_MAP_SIMPLE = 0,
+ CMP_NODE_TONE_MAP_PHOTORECEPTOR = 1,
+} CMPNodeToneMapType;
+
/* Plane track deform node. */
enum {
@@ -1961,6 +2212,11 @@ typedef enum GeometryNodeTriangulateQuads {
GEO_NODE_TRIANGULATE_QUAD_LONGEDGE = 4,
} GeometryNodeTriangulateQuads;
+typedef enum GeometryNodeDistributePointsInVolumeMode {
+ GEO_NODE_DISTRIBUTE_POINTS_IN_VOLUME_DENSITY_RANDOM = 0,
+ GEO_NODE_DISTRIBUTE_POINTS_IN_VOLUME_DENSITY_GRID = 1,
+} GeometryNodeDistributePointsInVolumeMode;
+
typedef enum GeometryNodeDistributePointsOnFacesMode {
GEO_NODE_POINT_DISTRIBUTE_POINTS_ON_FACES_RANDOM = 0,
GEO_NODE_POINT_DISTRIBUTE_POINTS_ON_FACES_POISSON = 1,
@@ -2145,7 +2401,3 @@ typedef enum NodeCombSepColorMode {
NODE_COMBSEP_COLOR_HSV = 1,
NODE_COMBSEP_COLOR_HSL = 2,
} NodeCombSepColorMode;
-
-#ifdef __cplusplus
-}
-#endif