2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2005 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2005-12-18 13:46:01 +00:00
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
2005-12-18 13:46:01 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup bke
|
2011-02-18 13:05:18 +00:00
|
|
|
*/
|
|
|
|
|
|
2018-11-07 12:17:58 +11:00
|
|
|
#include "BLI_compiler_compat.h"
|
2013-08-25 21:29:33 +00:00
|
|
|
#include "BLI_ghash.h"
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
#include "DNA_listBase.h"
|
|
|
|
|
|
2018-11-30 15:22:01 +11:00
|
|
|
/* for FOREACH_NODETREE_BEGIN */
|
2013-03-18 16:34:57 +00:00
|
|
|
#include "DNA_node_types.h"
|
|
|
|
|
|
2023-08-10 22:40:27 +02:00
|
|
|
#include "RNA_types.hh"
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2021-12-15 09:51:57 -06:00
|
|
|
#ifdef __cplusplus
|
2021-12-22 08:47:46 -06:00
|
|
|
# include "BLI_map.hh"
|
2021-12-15 09:51:57 -06:00
|
|
|
# include "BLI_string_ref.hh"
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2008-05-01 22:28:18 +00:00
|
|
|
/* not very important, but the stack solver likes to know a maximum */
|
2017-03-24 14:36:00 +01:00
|
|
|
#define MAX_SOCKET 512
|
2007-03-24 18:41:54 +00:00
|
|
|
|
2020-09-30 11:51:13 +10:00
|
|
|
struct BlendDataReader;
|
|
|
|
|
struct BlendLibReader;
|
|
|
|
|
struct BlendWriter;
|
2019-09-07 23:17:40 +10:00
|
|
|
struct FreestyleLineStyle;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
struct GPUMaterial;
|
|
|
|
|
struct GPUNodeStack;
|
2010-08-04 04:01:27 +00:00
|
|
|
struct ID;
|
2013-03-05 03:44:47 +00:00
|
|
|
struct ImBuf;
|
2019-09-07 23:17:40 +10:00
|
|
|
struct Light;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct Main;
|
2019-09-07 23:17:40 +10:00
|
|
|
struct Material;
|
2009-09-16 18:59:13 +00:00
|
|
|
struct PointerRNA;
|
2010-08-04 04:01:27 +00:00
|
|
|
struct Scene;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct SpaceNode;
|
2010-08-04 04:01:27 +00:00
|
|
|
struct Tex;
|
2019-09-07 23:17:40 +10:00
|
|
|
struct World;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bContext;
|
|
|
|
|
struct bNode;
|
|
|
|
|
struct bNodeExecContext;
|
|
|
|
|
struct bNodeExecData;
|
2013-03-18 16:34:57 +00:00
|
|
|
struct bNodeInstanceHash;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bNodeLink;
|
|
|
|
|
struct bNodeSocket;
|
|
|
|
|
struct bNodeStack;
|
|
|
|
|
struct bNodeTree;
|
|
|
|
|
struct bNodeTreeExec;
|
|
|
|
|
struct bNodeTreeType;
|
|
|
|
|
struct uiLayout;
|
2005-12-18 13:46:01 +00:00
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Node Type Definitions
|
|
|
|
|
* \{ */
|
2005-12-20 15:43:55 +00:00
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
|
* \brief Compact definition of a node socket.
|
|
|
|
|
*
|
2011-09-05 21:01:50 +00:00
|
|
|
* Can be used to quickly define a list of static sockets for a node,
|
2018-06-01 18:19:39 +02:00
|
|
|
* which are added to each new node of that type.
|
2011-09-05 21:01:50 +00:00
|
|
|
*
|
2013-03-18 16:34:57 +00:00
|
|
|
* \deprecated This struct is used by C nodes to define templates as simple
|
|
|
|
|
* static struct lists. These are converted to the new template collections
|
|
|
|
|
* in RNA types automatically.
|
2011-09-05 21:01:50 +00:00
|
|
|
*/
|
|
|
|
|
typedef struct bNodeSocketTemplate {
|
Nodes: Support storing socket link limits in bNodeSocketType
Currently the link limit of sockets is stored in bNodeSocket->limit.
This allows for a lot of flexibility, but is also very redundant.
In every case I've had to deal with so far, it would have "more correct"
to set the link limit per socket type and not per socket. I did not enforce
this constraint yet, because the link limit is exposed in the Python API,
which I did not want to break here.
In the future it might even make sense to only support only three kinds of link limits:
a) no links, b) at most one link, c) an arbitrary number links links. The other link
limits usually don't work well with tools (e.g. which link should be removed when a new
one is connected?) and is not used in practice. However, that is for another day.
Eventually, I would like to get rid of bNodeSocket->limit completely and replace it
either with fixed link limits or a callback in bNodeSocketType.
This patch consists of three parts:
**1. Support defining link limit in socket type**
This introduces a new `nodeSocketLinkLimit` function that serves as an indirection to
hide where the link limit of a socket is defined.
**2. Define link limits for builtin sockets on socket type**
Data sockets: one input, many outputs
Virtual sockets: one input, one output
Undefined sockets: many inputs, many outputs (to avoid that links are removed when the type of the socket is not known)
**3. Remove `bNodeSocketTemplate->limit`**
This wasn't used anymore after the second commit. Removing it simplifies socket definitions
in hundreds of places and removes a lot of redundancy.
Differential Revision: https://developer.blender.org/D7038
Reviewers: brecht
2020-03-06 12:20:05 +01:00
|
|
|
int type;
|
2012-01-11 08:51:06 +00:00
|
|
|
char name[64]; /* MAX_NAME */
|
2011-09-05 21:01:50 +00:00
|
|
|
float val1, val2, val3, val4; /* default alloc value for inputs */
|
|
|
|
|
float min, max;
|
2012-11-27 16:19:52 +00:00
|
|
|
int subtype; /* would use PropertySubType but this is a bad level include to use RNA */
|
2011-11-07 17:30:52 +00:00
|
|
|
int flag;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
/* after this line is used internal only */
|
2011-09-05 21:01:50 +00:00
|
|
|
struct bNodeSocket *sock; /* used to hold verified socket */
|
2013-03-18 16:34:57 +00:00
|
|
|
char identifier[64]; /* generated from name */
|
2011-09-05 21:01:50 +00:00
|
|
|
} bNodeSocketTemplate;
|
|
|
|
|
|
2020-07-07 18:23:33 +02:00
|
|
|
/* Use `void *` for callbacks that require C++. This is rather ugly, but works well for now. This
|
|
|
|
|
* would not be necessary if we would use bNodeSocketType and bNodeType only in C++ code.
|
|
|
|
|
* However, achieving this requires quite a few changes currently. */
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
namespace blender {
|
2022-03-18 10:57:45 +01:00
|
|
|
class CPPType;
|
2020-07-17 11:36:59 +02:00
|
|
|
namespace nodes {
|
2022-08-10 09:14:22 +02:00
|
|
|
class DNode;
|
2021-08-20 13:14:39 +02:00
|
|
|
class NodeMultiFunctionBuilder;
|
2020-12-02 13:25:25 +01:00
|
|
|
class GeoNodeExecParams;
|
2023-01-16 15:47:10 -06:00
|
|
|
class NodeDeclaration;
|
2021-08-30 17:13:46 +02:00
|
|
|
class NodeDeclarationBuilder;
|
2023-02-20 19:17:03 +01:00
|
|
|
class GatherAddNodeSearchParams;
|
2021-12-15 09:51:57 -06:00
|
|
|
class GatherLinkSearchOpParams;
|
2023-12-06 10:00:25 -05:00
|
|
|
struct NodeExtraInfoParams;
|
2020-07-17 11:36:59 +02:00
|
|
|
} // namespace nodes
|
2022-08-10 09:14:22 +02:00
|
|
|
namespace realtime_compositor {
|
|
|
|
|
class Context;
|
|
|
|
|
class NodeOperation;
|
|
|
|
|
class ShaderNode;
|
|
|
|
|
} // namespace realtime_compositor
|
2020-07-07 18:23:33 +02:00
|
|
|
} // namespace blender
|
|
|
|
|
|
2022-03-18 10:57:45 +01:00
|
|
|
using CPPTypeHandle = blender::CPPType;
|
2021-08-20 13:14:39 +02:00
|
|
|
using NodeMultiFunctionBuildFunction = void (*)(blender::nodes::NodeMultiFunctionBuilder &builder);
|
2020-12-02 13:25:25 +01:00
|
|
|
using NodeGeometryExecFunction = void (*)(blender::nodes::GeoNodeExecParams params);
|
2021-08-30 17:13:46 +02:00
|
|
|
using NodeDeclareFunction = void (*)(blender::nodes::NodeDeclarationBuilder &builder);
|
2023-01-16 15:47:10 -06:00
|
|
|
using NodeDeclareDynamicFunction = void (*)(const bNodeTree &tree,
|
|
|
|
|
const bNode &node,
|
2023-10-08 14:38:28 +02:00
|
|
|
blender::nodes::NodeDeclarationBuilder &builder);
|
2023-08-30 12:37:21 +02:00
|
|
|
using SocketGetCPPValueFunction = void (*)(const void *socket_value, void *r_value);
|
|
|
|
|
using SocketGetGeometryNodesCPPValueFunction = void (*)(const void *socket_value, void *r_value);
|
2020-07-07 18:23:33 +02:00
|
|
|
|
2021-12-15 09:51:57 -06:00
|
|
|
/* Adds socket link operations that are specific to this node type. */
|
|
|
|
|
using NodeGatherSocketLinkOperationsFunction =
|
|
|
|
|
void (*)(blender::nodes::GatherLinkSearchOpParams ¶ms);
|
|
|
|
|
|
2023-02-20 19:17:03 +01:00
|
|
|
/* Adds node add menu operations that are specific to this node type. */
|
|
|
|
|
using NodeGatherAddOperationsFunction =
|
|
|
|
|
void (*)(blender::nodes::GatherAddNodeSearchParams ¶ms);
|
|
|
|
|
|
2022-08-10 09:14:22 +02:00
|
|
|
using NodeGetCompositorOperationFunction = blender::realtime_compositor::NodeOperation
|
|
|
|
|
*(*)(blender::realtime_compositor::Context &context, blender::nodes::DNode node);
|
|
|
|
|
using NodeGetCompositorShaderNodeFunction =
|
|
|
|
|
blender::realtime_compositor::ShaderNode *(*)(blender::nodes::DNode node);
|
2023-12-05 15:57:40 +01:00
|
|
|
using NodeExtraInfoFunction = void (*)(blender::nodes::NodeExtraInfoParams ¶ms);
|
2022-08-10 09:14:22 +02:00
|
|
|
|
2020-07-07 18:23:33 +02:00
|
|
|
#else
|
2022-08-10 09:14:22 +02:00
|
|
|
typedef void *NodeGetCompositorOperationFunction;
|
|
|
|
|
typedef void *NodeGetCompositorShaderNodeFunction;
|
2021-08-20 13:14:39 +02:00
|
|
|
typedef void *NodeMultiFunctionBuildFunction;
|
2020-12-02 13:25:25 +01:00
|
|
|
typedef void *NodeGeometryExecFunction;
|
2021-08-30 17:13:46 +02:00
|
|
|
typedef void *NodeDeclareFunction;
|
2023-01-16 15:47:10 -06:00
|
|
|
typedef void *NodeDeclareDynamicFunction;
|
2021-12-15 09:51:57 -06:00
|
|
|
typedef void *NodeGatherSocketLinkOperationsFunction;
|
2023-02-20 19:17:03 +01:00
|
|
|
typedef void *NodeGatherAddOperationsFunction;
|
2020-12-02 13:25:25 +01:00
|
|
|
typedef void *SocketGetCPPTypeFunction;
|
2021-08-02 10:34:50 +02:00
|
|
|
typedef void *SocketGetGeometryNodesCPPTypeFunction;
|
|
|
|
|
typedef void *SocketGetGeometryNodesCPPValueFunction;
|
2020-12-02 13:25:25 +01:00
|
|
|
typedef void *SocketGetCPPValueFunction;
|
2023-12-05 15:57:40 +01:00
|
|
|
typedef void *NodeExtraInfoFunction;
|
2021-11-22 10:18:08 +01:00
|
|
|
typedef struct CPPTypeHandle CPPTypeHandle;
|
2020-07-07 18:23:33 +02:00
|
|
|
#endif
|
|
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
|
* \brief Defines a socket type.
|
|
|
|
|
*
|
2011-09-05 21:01:50 +00:00
|
|
|
* Defines the appearance and behavior of a socket in the UI.
|
|
|
|
|
*/
|
|
|
|
|
typedef struct bNodeSocketType {
|
2023-04-05 14:38:26 +10:00
|
|
|
/** Identifier name. */
|
2021-07-06 18:36:11 +01:00
|
|
|
char idname[64];
|
2023-04-05 14:38:26 +10:00
|
|
|
/** Type label. */
|
2021-07-06 18:36:11 +01:00
|
|
|
char label[64];
|
2023-04-05 14:38:26 +10:00
|
|
|
/** Sub-type label. */
|
2023-04-03 18:23:30 +02:00
|
|
|
char subtype_label[64];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-05-08 14:58:41 +00:00
|
|
|
void (*draw)(struct bContext *C,
|
|
|
|
|
struct uiLayout *layout,
|
|
|
|
|
struct PointerRNA *ptr,
|
|
|
|
|
struct PointerRNA *node_ptr,
|
|
|
|
|
const char *text);
|
2013-03-18 16:34:57 +00:00
|
|
|
void (*draw_color)(struct bContext *C,
|
|
|
|
|
struct PointerRNA *ptr,
|
|
|
|
|
struct PointerRNA *node_ptr,
|
|
|
|
|
float *r_color);
|
2023-08-30 12:37:21 +02:00
|
|
|
void (*draw_color_simple)(const bNodeSocketType *socket_type, float *r_color);
|
|
|
|
|
|
|
|
|
|
void (*interface_draw)(struct ID *id,
|
|
|
|
|
struct bNodeTreeInterfaceSocket *socket,
|
|
|
|
|
struct bContext *C,
|
|
|
|
|
struct uiLayout *layout);
|
|
|
|
|
void (*interface_init_socket)(struct ID *id,
|
|
|
|
|
const struct bNodeTreeInterfaceSocket *interface_socket,
|
2013-03-28 10:32:04 +00:00
|
|
|
struct bNode *node,
|
2023-08-30 12:37:21 +02:00
|
|
|
struct bNodeSocket *socket,
|
2013-03-28 10:32:04 +00:00
|
|
|
const char *data_path);
|
2023-08-30 12:37:21 +02:00
|
|
|
void (*interface_from_socket)(struct ID *id,
|
|
|
|
|
struct bNodeTreeInterfaceSocket *interface_socket,
|
2022-12-20 22:42:59 -06:00
|
|
|
const struct bNode *node,
|
2023-08-30 12:37:21 +02:00
|
|
|
const struct bNodeSocket *socket);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* RNA integration */
|
|
|
|
|
ExtensionRNA ext_socket;
|
|
|
|
|
ExtensionRNA ext_interface;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* for standard socket types in C */
|
|
|
|
|
int type, subtype;
|
2020-02-28 13:28:16 +01:00
|
|
|
|
Nodes: Support storing socket link limits in bNodeSocketType
Currently the link limit of sockets is stored in bNodeSocket->limit.
This allows for a lot of flexibility, but is also very redundant.
In every case I've had to deal with so far, it would have "more correct"
to set the link limit per socket type and not per socket. I did not enforce
this constraint yet, because the link limit is exposed in the Python API,
which I did not want to break here.
In the future it might even make sense to only support only three kinds of link limits:
a) no links, b) at most one link, c) an arbitrary number links links. The other link
limits usually don't work well with tools (e.g. which link should be removed when a new
one is connected?) and is not used in practice. However, that is for another day.
Eventually, I would like to get rid of bNodeSocket->limit completely and replace it
either with fixed link limits or a callback in bNodeSocketType.
This patch consists of three parts:
**1. Support defining link limit in socket type**
This introduces a new `nodeSocketLinkLimit` function that serves as an indirection to
hide where the link limit of a socket is defined.
**2. Define link limits for builtin sockets on socket type**
Data sockets: one input, many outputs
Virtual sockets: one input, one output
Undefined sockets: many inputs, many outputs (to avoid that links are removed when the type of the socket is not known)
**3. Remove `bNodeSocketTemplate->limit`**
This wasn't used anymore after the second commit. Removing it simplifies socket definitions
in hundreds of places and removes a lot of redundancy.
Differential Revision: https://developer.blender.org/D7038
Reviewers: brecht
2020-03-06 12:20:05 +01:00
|
|
|
/* When set, bNodeSocket->limit does not have any effect anymore. */
|
|
|
|
|
bool use_link_limits_of_type;
|
|
|
|
|
int input_link_limit;
|
|
|
|
|
int output_link_limit;
|
|
|
|
|
|
2020-02-28 13:28:16 +01:00
|
|
|
/* Callback to free the socket type. */
|
|
|
|
|
void (*free_self)(struct bNodeSocketType *stype);
|
2020-07-07 18:23:33 +02:00
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
/* Return the CPPType of this socket. */
|
2021-11-22 10:18:08 +01:00
|
|
|
const CPPTypeHandle *base_cpp_type;
|
2020-12-02 13:25:25 +01:00
|
|
|
/* Get the value of this socket in a generic way. */
|
2021-08-02 10:34:50 +02:00
|
|
|
SocketGetCPPValueFunction get_base_cpp_value;
|
|
|
|
|
/* Get geometry nodes cpp type. */
|
2021-11-22 10:18:08 +01:00
|
|
|
const CPPTypeHandle *geometry_nodes_cpp_type;
|
2021-08-02 10:34:50 +02:00
|
|
|
/* Get geometry nodes cpp value. */
|
|
|
|
|
SocketGetGeometryNodesCPPValueFunction get_geometry_nodes_cpp_value;
|
2023-12-17 14:00:07 +01:00
|
|
|
/* Default value for this socket type. */
|
|
|
|
|
const void *geometry_nodes_default_cpp_value;
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
} bNodeSocketType;
|
Orange; daily noodler update commit.
- Adding execution code for Node trees. Was a bit a puzzle, since I want
it to be multithreading by design. This now is solved by defining a
stack per tree for all data that's being written into. This stack, which
resides now in the NodeTree itself, then can be allocated per thread.
- For testing pleasure, I've added a 'mix node' and a 'show node', so
you can already see it do something. :)
- reshuffled structure, to put things nice together, and have easier node
adding. Current state is still WIP though, structure might change.
For the record; new file node_shaders.c will contain all shader node
definitions, apart from the drawing callbacks.
Next: I'm going to check on Andrea's work on icons now, since this is very
much needed for true shader/composit work.
Now back to release work...
2005-12-21 14:24:51 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
typedef void *(*NodeInitExecFunction)(struct bNodeExecContext *context,
|
|
|
|
|
struct bNode *node,
|
|
|
|
|
bNodeInstanceKey key);
|
2013-10-29 17:46:01 +00:00
|
|
|
typedef void (*NodeFreeExecFunction)(void *nodedata);
|
2013-03-18 16:34:57 +00:00
|
|
|
typedef void (*NodeExecFunction)(void *data,
|
|
|
|
|
int thread,
|
|
|
|
|
struct bNode *,
|
|
|
|
|
struct bNodeExecData *execdata,
|
|
|
|
|
struct bNodeStack **in,
|
|
|
|
|
struct bNodeStack **out);
|
|
|
|
|
typedef int (*NodeGPUExecFunction)(struct GPUMaterial *mat,
|
|
|
|
|
struct bNode *node,
|
|
|
|
|
struct bNodeExecData *execdata,
|
|
|
|
|
struct GPUNodeStack *in,
|
|
|
|
|
struct GPUNodeStack *out);
|
2023-09-26 17:05:36 -04:00
|
|
|
typedef void (*NodeMaterialXFunction)(void *data, struct bNode *node, struct bNodeSocket *out);
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
|
* \brief Defines a node type.
|
|
|
|
|
*
|
2011-09-05 21:01:50 +00:00
|
|
|
* Initial attributes and constants for a node as well as callback functions
|
|
|
|
|
* implementing the node behavior.
|
|
|
|
|
*/
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
typedef struct bNodeType {
|
2013-03-18 16:34:57 +00:00
|
|
|
char idname[64]; /* identifier name */
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
int type;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
char ui_name[64]; /* MAX_NAME */
|
|
|
|
|
char ui_description[256];
|
|
|
|
|
int ui_icon;
|
2023-08-04 21:43:54 +02:00
|
|
|
/** Should usually use the idname instead, but this enum type is still exposed in Python. */
|
|
|
|
|
const char *enum_name_legacy;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
float width, minwidth, maxwidth;
|
2011-09-05 21:01:50 +00:00
|
|
|
float height, minheight, maxheight;
|
2018-07-05 19:18:43 +02:00
|
|
|
short nclass, flag;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* templates for static sockets */
|
|
|
|
|
bNodeSocketTemplate *inputs, *outputs;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
char storagename[64]; /* struct name for DNA */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-10-10 11:33:20 +00:00
|
|
|
/* Draw the option buttons on the node */
|
|
|
|
|
void (*draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr);
|
|
|
|
|
/* Additional parameters in the side panel */
|
|
|
|
|
void (*draw_buttons_ex)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-10-10 11:33:20 +00:00
|
|
|
/* Additional drawing on backdrop */
|
|
|
|
|
void (*draw_backdrop)(
|
|
|
|
|
struct SpaceNode *snode, struct ImBuf *backdrop, struct bNode *node, int x, int y);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-10-28 03:13:49 +11:00
|
|
|
/**
|
|
|
|
|
* Optional custom label function for the node header.
|
|
|
|
|
* \note Used as a fallback when #bNode.label isn't set.
|
|
|
|
|
*/
|
2021-12-11 09:51:53 -06:00
|
|
|
void (*labelfunc)(const struct bNodeTree *ntree,
|
|
|
|
|
const struct bNode *node,
|
|
|
|
|
char *label,
|
2023-05-07 15:22:58 +10:00
|
|
|
int label_maxncpy);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-02-07 15:29:16 +00:00
|
|
|
/** Optional override for node class, used for drawing node header. */
|
|
|
|
|
int (*ui_class)(const struct bNode *node);
|
|
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/** Called when the node is updated in the editor. */
|
|
|
|
|
void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node);
|
|
|
|
|
/** Check and update if internal ID data has changed. */
|
2019-04-20 20:25:22 +02:00
|
|
|
void (*group_update_func)(struct bNodeTree *ntree, struct bNode *node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-03-07 15:08:32 +11:00
|
|
|
/**
|
|
|
|
|
* Initialize a new node instance of this type after creation.
|
|
|
|
|
*
|
|
|
|
|
* \note Assignments to `node->id` must not increment the user of the ID.
|
|
|
|
|
* This is handled by the caller of this callback.
|
|
|
|
|
*/
|
2013-03-18 16:34:57 +00:00
|
|
|
void (*initfunc)(struct bNodeTree *ntree, struct bNode *node);
|
2023-03-07 15:08:32 +11:00
|
|
|
/**
|
|
|
|
|
* Free the node instance.
|
|
|
|
|
*
|
|
|
|
|
* \note Access to `node->id` must be avoided in this function as this is called
|
|
|
|
|
* while freeing #Main, the state of this ID is undefined.
|
|
|
|
|
* Higher level logic to remove the node handles the user-count.
|
|
|
|
|
*/
|
2013-03-18 16:34:57 +00:00
|
|
|
void (*freefunc)(struct bNode *node);
|
|
|
|
|
/** Make a copy of the node instance. */
|
2019-06-03 17:08:25 +02:00
|
|
|
void (*copyfunc)(struct bNodeTree *dest_ntree,
|
|
|
|
|
struct bNode *dest_node,
|
|
|
|
|
const struct bNode *src_node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* Registerable API callback versions, called in addition to C callbacks */
|
|
|
|
|
void (*initfunc_api)(const struct bContext *C, struct PointerRNA *ptr);
|
|
|
|
|
void (*freefunc_api)(struct PointerRNA *ptr);
|
2019-06-03 17:08:25 +02:00
|
|
|
void (*copyfunc_api)(struct PointerRNA *ptr, const struct bNode *src_node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-04-19 15:48:18 +02:00
|
|
|
/**
|
|
|
|
|
* An additional poll test for deciding whether nodes should be an option in search menus.
|
|
|
|
|
* Potentially more strict poll than #poll(), but doesn't have to check the same things.
|
|
|
|
|
*/
|
|
|
|
|
bool (*add_ui_poll)(const struct bContext *C);
|
|
|
|
|
|
2021-04-12 18:43:23 +02:00
|
|
|
/**
|
|
|
|
|
* Can this node type be added to a node tree?
|
2021-12-15 09:51:57 -06:00
|
|
|
* \param r_disabled_hint: Hint to display in the UI when the poll fails.
|
2021-04-12 18:43:23 +02:00
|
|
|
* The callback can set this to a static string without having to
|
|
|
|
|
* null-check it (or without setting it to null if it's not used).
|
|
|
|
|
* The caller must pass a valid `const char **` and null-initialize it
|
|
|
|
|
* when it's not just a dummy, that is, if it actually wants to access
|
|
|
|
|
* the returned disabled-hint (null-check needed!).
|
|
|
|
|
*/
|
2022-12-28 20:15:41 -05:00
|
|
|
bool (*poll)(const struct bNodeType *ntype,
|
|
|
|
|
const struct bNodeTree *nodetree,
|
|
|
|
|
const char **r_disabled_hint);
|
2023-05-27 15:10:58 +10:00
|
|
|
/**
|
|
|
|
|
* Can this node be added to a node tree?
|
2021-04-12 18:43:23 +02:00
|
|
|
* \param r_disabled_hint: See `poll()`.
|
|
|
|
|
*/
|
2022-12-28 20:15:41 -05:00
|
|
|
bool (*poll_instance)(const struct bNode *node,
|
|
|
|
|
const struct bNodeTree *nodetree,
|
2021-04-12 18:43:23 +02:00
|
|
|
const char **r_disabled_hint);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-01-28 10:07:29 +01:00
|
|
|
/* Optional handling of link insertion. Returns false if the link shouldn't be created. */
|
2023-01-16 15:47:10 -06:00
|
|
|
bool (*insert_link)(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-02-28 13:28:16 +01:00
|
|
|
void (*free_self)(struct bNodeType *ntype);
|
|
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* **** execution callbacks **** */
|
2021-03-05 17:35:25 +01:00
|
|
|
NodeInitExecFunction init_exec_fn;
|
|
|
|
|
NodeFreeExecFunction free_exec_fn;
|
|
|
|
|
NodeExecFunction exec_fn;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
/* gpu */
|
2021-03-05 17:35:25 +01:00
|
|
|
NodeGPUExecFunction gpu_fn;
|
2023-09-25 18:36:42 +02:00
|
|
|
/* MaterialX */
|
|
|
|
|
NodeMaterialXFunction materialx_fn;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-08-10 09:14:22 +02:00
|
|
|
/* Get an instance of this node's compositor operation. Freeing the instance is the
|
|
|
|
|
* responsibility of the caller. */
|
|
|
|
|
NodeGetCompositorOperationFunction get_compositor_operation;
|
|
|
|
|
|
|
|
|
|
/* Get an instance of this node's compositor shader node. Freeing the instance is the
|
|
|
|
|
* responsibility of the caller. */
|
|
|
|
|
NodeGetCompositorShaderNodeFunction get_compositor_shader_node;
|
|
|
|
|
|
2022-11-23 14:34:31 +02:00
|
|
|
/* A message to display in the node header for unsupported realtime compositor nodes. The message
|
|
|
|
|
* is assumed to be static and thus require no memory handling. This field is to be removed when
|
|
|
|
|
* all nodes are supported. */
|
|
|
|
|
const char *realtime_compositor_unsupported_message;
|
|
|
|
|
|
2021-08-20 13:14:39 +02:00
|
|
|
/* Build a multi-function for this node. */
|
|
|
|
|
NodeMultiFunctionBuildFunction build_multi_function;
|
2020-07-07 18:23:33 +02:00
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
/* Execute a geometry node. */
|
|
|
|
|
NodeGeometryExecFunction geometry_node_execute;
|
|
|
|
|
|
2023-01-16 15:47:10 -06:00
|
|
|
/**
|
2023-10-15 20:28:23 +02:00
|
|
|
* Declares which sockets and panels the node has. It has to be able to generate a declaration
|
|
|
|
|
* with and without a specific node context. If the declaration depends on the node, but the node
|
|
|
|
|
* is not provided, then the declaration should be generated as much as possible and everything
|
|
|
|
|
* that depends on the node context should be skipped.
|
2023-01-16 15:47:10 -06:00
|
|
|
*/
|
2023-10-15 20:28:23 +02:00
|
|
|
NodeDeclareFunction declare;
|
2023-01-16 15:47:10 -06:00
|
|
|
|
2023-10-15 20:28:23 +02:00
|
|
|
/**
|
|
|
|
|
* Declaration of the node outside of any context. If the node declaration is never dependent on
|
|
|
|
|
* the node context, this declaration is also shared with the corresponding node instances.
|
|
|
|
|
* Otherwise, it mainly allows checking what sockets a node will have, without having to create
|
|
|
|
|
* the node. In this case, the static declaration is mostly just a hint, and does not have to
|
|
|
|
|
* match with the final node.
|
|
|
|
|
*/
|
|
|
|
|
NodeDeclarationHandle *static_declaration;
|
2021-08-30 17:13:46 +02:00
|
|
|
|
2021-12-15 09:51:57 -06:00
|
|
|
/**
|
|
|
|
|
* Add to the list of search names and operations gathered by node link drag searching.
|
|
|
|
|
* Usually it isn't necessary to override the default behavior here, but a node type can have
|
|
|
|
|
* custom behavior here like adding custom search items.
|
|
|
|
|
*/
|
|
|
|
|
NodeGatherSocketLinkOperationsFunction gather_link_search_ops;
|
|
|
|
|
|
2023-12-05 15:57:40 +01:00
|
|
|
/** Get extra information that is drawn next to the node. */
|
|
|
|
|
NodeExtraInfoFunction get_extra_info;
|
|
|
|
|
|
2021-11-17 11:52:44 +01:00
|
|
|
/** True when the node cannot be muted. */
|
|
|
|
|
bool no_muting;
|
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* RNA integration */
|
2020-04-03 18:24:08 +02:00
|
|
|
ExtensionRNA rna_ext;
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
} bNodeType;
|
|
|
|
|
|
2023-01-20 15:19:32 +11:00
|
|
|
/** #bNodeType.nclass (for add-menu and themes). */
|
2011-09-05 21:01:50 +00:00
|
|
|
#define NODE_CLASS_INPUT 0
|
|
|
|
|
#define NODE_CLASS_OUTPUT 1
|
|
|
|
|
#define NODE_CLASS_OP_COLOR 3
|
|
|
|
|
#define NODE_CLASS_OP_VECTOR 4
|
|
|
|
|
#define NODE_CLASS_OP_FILTER 5
|
|
|
|
|
#define NODE_CLASS_GROUP 6
|
2021-08-23 16:23:58 +02:00
|
|
|
#define NODE_CLASS_CONVERTER 8
|
2011-09-05 21:01:50 +00:00
|
|
|
#define NODE_CLASS_MATTE 9
|
|
|
|
|
#define NODE_CLASS_DISTORT 10
|
|
|
|
|
#define NODE_CLASS_PATTERN 12
|
|
|
|
|
#define NODE_CLASS_TEXTURE 13
|
2012-11-03 14:32:26 +00:00
|
|
|
#define NODE_CLASS_SCRIPT 32
|
2013-03-18 16:34:57 +00:00
|
|
|
#define NODE_CLASS_INTERFACE 33
|
2011-11-02 19:24:30 +00:00
|
|
|
#define NODE_CLASS_SHADER 40
|
2020-12-01 10:28:29 -05:00
|
|
|
#define NODE_CLASS_GEOMETRY 41
|
|
|
|
|
#define NODE_CLASS_ATTRIBUTE 42
|
2011-09-05 21:01:50 +00:00
|
|
|
#define NODE_CLASS_LAYOUT 100
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
struct bNodeTreeExec;
|
|
|
|
|
|
2011-11-07 22:14:48 +00:00
|
|
|
typedef void (*bNodeClassCallback)(void *calldata, int nclass, const char *name);
|
2012-06-06 22:38:39 +00:00
|
|
|
typedef struct bNodeTreeType {
|
2011-09-05 21:01:50 +00:00
|
|
|
int type; /* type identifier */
|
2013-03-18 16:34:57 +00:00
|
|
|
char idname[64]; /* identifier name */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-07-28 16:34:17 -05:00
|
|
|
/* The ID name of group nodes for this type. */
|
|
|
|
|
char group_idname[64];
|
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
char ui_name[64];
|
|
|
|
|
char ui_description[256];
|
|
|
|
|
int ui_icon;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* callbacks */
|
2019-08-14 23:29:46 +10:00
|
|
|
/* Iteration over all node classes. */
|
|
|
|
|
void (*foreach_nodeclass)(struct Scene *scene, void *calldata, bNodeClassCallback func);
|
2013-03-18 16:34:57 +00:00
|
|
|
/* Check visibility in the node editor */
|
2018-07-02 11:47:00 +02:00
|
|
|
bool (*poll)(const struct bContext *C, struct bNodeTreeType *ntreetype);
|
2013-03-18 16:34:57 +00:00
|
|
|
/* Select a node tree from the context */
|
|
|
|
|
void (*get_from_context)(const struct bContext *C,
|
|
|
|
|
struct bNodeTreeType *ntreetype,
|
|
|
|
|
struct bNodeTree **r_ntree,
|
|
|
|
|
struct ID **r_id,
|
|
|
|
|
struct ID **r_from);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* calls allowing threaded composite */
|
|
|
|
|
void (*localize)(struct bNodeTree *localtree, struct bNodeTree *ntree);
|
2018-06-11 15:40:37 +02:00
|
|
|
void (*local_merge)(struct Main *bmain, struct bNodeTree *localtree, struct bNodeTree *ntree);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-09-14 13:25:24 +10:00
|
|
|
/* Tree update. Overrides `nodetype->updatetreefunc`. */
|
2011-09-05 21:01:50 +00:00
|
|
|
void (*update)(struct bNodeTree *ntree);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-12-15 09:51:57 -06:00
|
|
|
bool (*validate_link)(eNodeSocketDatatype from, eNodeSocketDatatype to);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-12-08 21:53:35 +01:00
|
|
|
void (*node_add_init)(struct bNodeTree *ntree, struct bNode *bnode);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-04-29 23:36:46 -05:00
|
|
|
/* Check if the socket type is valid for this tree type. */
|
2021-07-06 18:36:11 +01:00
|
|
|
bool (*valid_socket_type)(struct bNodeTreeType *ntreetype, struct bNodeSocketType *socket_type);
|
2021-04-29 23:36:46 -05:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* RNA integration */
|
2020-04-03 18:24:08 +02:00
|
|
|
ExtensionRNA rna_ext;
|
2011-09-05 21:01:50 +00:00
|
|
|
} bNodeTreeType;
|
|
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/** \} */
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Generic API, Trees
|
|
|
|
|
* \{ */
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
struct bNodeTreeType *ntreeTypeFind(const char *idname);
|
2013-03-18 18:25:05 +00:00
|
|
|
void ntreeTypeAdd(struct bNodeTreeType *nt);
|
2015-05-11 12:39:39 +10:00
|
|
|
void ntreeTypeFreeLink(const struct bNodeTreeType *nt);
|
2023-03-02 23:14:59 +01:00
|
|
|
bool ntreeIsRegistered(const struct bNodeTree *ntree);
|
2013-03-18 16:34:57 +00:00
|
|
|
struct GHashIterator *ntreeTypeGetIterator(void);
|
|
|
|
|
|
2021-10-03 12:06:06 +11:00
|
|
|
/* Helper macros for iterating over tree types. */
|
2013-03-18 16:34:57 +00:00
|
|
|
#define NODE_TREE_TYPES_BEGIN(ntype) \
|
|
|
|
|
{ \
|
|
|
|
|
GHashIterator *__node_tree_type_iter__ = ntreeTypeGetIterator(); \
|
2013-05-08 12:58:11 +00:00
|
|
|
for (; !BLI_ghashIterator_done(__node_tree_type_iter__); \
|
|
|
|
|
BLI_ghashIterator_step(__node_tree_type_iter__)) \
|
|
|
|
|
{ \
|
2021-02-02 09:51:38 -06:00
|
|
|
bNodeTreeType *ntype = (bNodeTreeType *)BLI_ghashIterator_getValue(__node_tree_type_iter__);
|
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
#define NODE_TREE_TYPES_END \
|
|
|
|
|
} \
|
|
|
|
|
BLI_ghashIterator_free(__node_tree_type_iter__); \
|
2013-09-13 08:45:20 +00:00
|
|
|
} \
|
|
|
|
|
(void)0
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* Try to initialize all type-info in a node tree.
|
|
|
|
|
*
|
|
|
|
|
* \note In general undefined type-info is a perfectly valid case,
|
|
|
|
|
* the type may just be registered later.
|
|
|
|
|
* In that case the update_typeinfo function will set type-info on registration
|
|
|
|
|
* and do necessary updates.
|
|
|
|
|
*/
|
2013-03-18 16:34:57 +00:00
|
|
|
void ntreeSetTypes(const struct bContext *C, struct bNodeTree *ntree);
|
|
|
|
|
|
2019-08-22 16:00:59 +02:00
|
|
|
struct bNodeTree *ntreeAddTree(struct Main *bmain, const char *name, const char *idname);
|
2007-03-26 15:07:38 +00:00
|
|
|
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* Free tree which is embedded into another data-block.
|
|
|
|
|
*/
|
2020-04-20 16:14:45 +02:00
|
|
|
void ntreeFreeEmbeddedTree(struct bNodeTree *ntree);
|
2012-08-22 08:54:18 +00:00
|
|
|
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* Get address of potential node-tree pointer of given ID.
|
|
|
|
|
*
|
|
|
|
|
* \warning Using this function directly is potentially dangerous, if you don't know or are not
|
|
|
|
|
* sure, please use `ntreeFromID()` instead.
|
|
|
|
|
*/
|
2020-02-06 16:24:19 +01:00
|
|
|
struct bNodeTree **BKE_ntree_ptr_from_id(struct ID *id);
|
2023-05-15 15:14:22 +02:00
|
|
|
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* Returns the private NodeTree object of the data-block, if it has one.
|
|
|
|
|
*/
|
2020-02-06 16:24:19 +01:00
|
|
|
struct bNodeTree *ntreeFromID(struct ID *id);
|
2012-12-03 16:21:43 +00:00
|
|
|
|
2018-12-14 15:20:33 +01:00
|
|
|
void ntreeFreeLocalTree(struct bNodeTree *ntree);
|
2023-02-10 17:30:55 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check recursively if a node tree contains another.
|
|
|
|
|
*/
|
|
|
|
|
bool ntreeContainsTree(const struct bNodeTree *tree_to_search_in,
|
|
|
|
|
const struct bNodeTree *tree_to_search_for);
|
|
|
|
|
|
2021-12-21 15:18:56 +01:00
|
|
|
void ntreeUpdateAllUsers(struct Main *main, struct ID *id);
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* XXX: old trees handle output flags automatically based on special output
|
2019-04-27 12:07:07 +10:00
|
|
|
* node types and last active selection.
|
|
|
|
|
* New tree types have a per-output socket flag to indicate the final output to use explicitly.
|
2011-09-05 21:01:50 +00:00
|
|
|
*/
|
2012-07-31 23:06:12 +00:00
|
|
|
void ntreeSetOutput(struct bNodeTree *ntree);
|
2006-06-19 17:29:44 +00:00
|
|
|
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* Returns localized tree for execution in threads.
|
|
|
|
|
*/
|
2009-01-27 17:12:40 +00:00
|
|
|
struct bNodeTree *ntreeLocalize(struct bNodeTree *ntree);
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* This is only direct data, tree itself should have been written.
|
|
|
|
|
*/
|
2020-09-10 13:33:29 +02:00
|
|
|
void ntreeBlendWrite(struct BlendWriter *writer, struct bNodeTree *ntree);
|
|
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Generic API, Nodes
|
|
|
|
|
* \{ */
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
struct bNodeType *nodeTypeFind(const char *idname);
|
Cycles: Merge Anisotropic BSDF node into Glossy BSDF node
Used to be https://archive.blender.org/developer/D17123.
Internally these are already using the same code path anyways, there's no point in maintaining two distinct nodes.
The obvious approach would be to add Anisotropy controls to the Glossy BSDF node and remove the Anisotropic BSDF node. However, that would break forward compability, since older Blender versions don't know how to handle the Anisotropy input on the Glossy BSDF node.
Therefore, this commit technically removes the Glossy BSDF node, uses versioning to replace them with an Anisotropic BSDF node, and renames that node to "Glossy BSDF".
That way, when you open a new file in an older version, all the nodes show up as Anisotropic BSDF nodes and render correctly.
This is a bit ugly internally since we need to preserve the old `idname` which now no longer matches the UI name, but that's not too bad.
Also removes the "Sharp" distribution option and replaces it with GGX, sets Roughness to zero and disconnects any input to the Roughness socket.
Pull Request: https://projects.blender.org/blender/blender/pulls/104445
2023-05-18 23:12:20 +02:00
|
|
|
const char *nodeTypeFindAlias(const char *idname);
|
2013-03-18 18:25:05 +00:00
|
|
|
void nodeRegisterType(struct bNodeType *ntype);
|
|
|
|
|
void nodeUnregisterType(struct bNodeType *ntype);
|
Cycles: Merge Anisotropic BSDF node into Glossy BSDF node
Used to be https://archive.blender.org/developer/D17123.
Internally these are already using the same code path anyways, there's no point in maintaining two distinct nodes.
The obvious approach would be to add Anisotropy controls to the Glossy BSDF node and remove the Anisotropic BSDF node. However, that would break forward compability, since older Blender versions don't know how to handle the Anisotropy input on the Glossy BSDF node.
Therefore, this commit technically removes the Glossy BSDF node, uses versioning to replace them with an Anisotropic BSDF node, and renames that node to "Glossy BSDF".
That way, when you open a new file in an older version, all the nodes show up as Anisotropic BSDF nodes and render correctly.
This is a bit ugly internally since we need to preserve the old `idname` which now no longer matches the UI name, but that's not too bad.
Also removes the "Sharp" distribution option and replaces it with GGX, sets Roughness to zero and disconnects any input to the Roughness socket.
Pull Request: https://projects.blender.org/blender/blender/pulls/104445
2023-05-18 23:12:20 +02:00
|
|
|
void nodeRegisterAlias(struct bNodeType *nt, const char *alias);
|
2013-03-18 16:34:57 +00:00
|
|
|
struct GHashIterator *nodeTypeGetIterator(void);
|
|
|
|
|
|
2021-10-03 12:06:06 +11:00
|
|
|
/* Helper macros for iterating over node types. */
|
2013-03-18 16:34:57 +00:00
|
|
|
#define NODE_TYPES_BEGIN(ntype) \
|
|
|
|
|
{ \
|
|
|
|
|
GHashIterator *__node_type_iter__ = nodeTypeGetIterator(); \
|
2013-05-08 12:58:11 +00:00
|
|
|
for (; !BLI_ghashIterator_done(__node_type_iter__); \
|
|
|
|
|
BLI_ghashIterator_step(__node_type_iter__)) { \
|
2021-02-02 09:51:38 -06:00
|
|
|
bNodeType *ntype = (bNodeType *)BLI_ghashIterator_getValue(__node_type_iter__);
|
2013-03-18 16:34:57 +00:00
|
|
|
|
|
|
|
|
#define NODE_TYPES_END \
|
|
|
|
|
} \
|
|
|
|
|
BLI_ghashIterator_free(__node_type_iter__); \
|
2018-11-30 15:35:15 +11:00
|
|
|
} \
|
|
|
|
|
((void)0)
|
2013-03-18 16:34:57 +00:00
|
|
|
|
|
|
|
|
struct bNodeSocketType *nodeSocketTypeFind(const char *idname);
|
2013-03-18 18:25:05 +00:00
|
|
|
void nodeRegisterSocketType(struct bNodeSocketType *stype);
|
|
|
|
|
void nodeUnregisterSocketType(struct bNodeSocketType *stype);
|
2023-03-02 23:14:59 +01:00
|
|
|
bool nodeSocketIsRegistered(const struct bNodeSocket *sock);
|
2013-03-18 16:34:57 +00:00
|
|
|
struct GHashIterator *nodeSocketTypeGetIterator(void);
|
2021-07-06 18:36:11 +01:00
|
|
|
const char *nodeSocketTypeLabel(const bNodeSocketType *stype);
|
|
|
|
|
|
2013-11-24 15:23:38 +11:00
|
|
|
const char *nodeStaticSocketType(int type, int subtype);
|
2023-08-30 12:37:21 +02:00
|
|
|
const char *nodeStaticSocketInterfaceTypeNew(int type, int subtype);
|
2021-07-06 18:36:11 +01:00
|
|
|
const char *nodeStaticSocketLabel(int type, int subtype);
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2021-10-03 12:06:06 +11:00
|
|
|
/* Helper macros for iterating over node types. */
|
2013-03-18 16:34:57 +00:00
|
|
|
#define NODE_SOCKET_TYPES_BEGIN(stype) \
|
|
|
|
|
{ \
|
|
|
|
|
GHashIterator *__node_socket_type_iter__ = nodeSocketTypeGetIterator(); \
|
2013-05-08 12:58:11 +00:00
|
|
|
for (; !BLI_ghashIterator_done(__node_socket_type_iter__); \
|
|
|
|
|
BLI_ghashIterator_step(__node_socket_type_iter__)) \
|
|
|
|
|
{ \
|
2021-02-02 09:51:38 -06:00
|
|
|
bNodeSocketType *stype = (bNodeSocketType *)BLI_ghashIterator_getValue( \
|
|
|
|
|
__node_socket_type_iter__);
|
2013-03-18 16:34:57 +00:00
|
|
|
|
|
|
|
|
#define NODE_SOCKET_TYPES_END \
|
|
|
|
|
} \
|
|
|
|
|
BLI_ghashIterator_free(__node_socket_type_iter__); \
|
2019-04-20 11:28:21 +02:00
|
|
|
} \
|
|
|
|
|
((void)0)
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2023-03-02 23:14:59 +01:00
|
|
|
struct bNodeSocket *nodeFindSocket(const struct bNode *node,
|
2021-03-26 14:25:52 -04:00
|
|
|
eNodeSocketInOut in_out,
|
|
|
|
|
const char *identifier);
|
2013-03-18 16:34:57 +00:00
|
|
|
struct bNodeSocket *nodeAddSocket(struct bNodeTree *ntree,
|
|
|
|
|
struct bNode *node,
|
2021-03-26 14:25:52 -04:00
|
|
|
eNodeSocketInOut in_out,
|
2013-03-18 16:34:57 +00:00
|
|
|
const char *idname,
|
|
|
|
|
const char *identifier,
|
|
|
|
|
const char *name);
|
|
|
|
|
struct bNodeSocket *nodeAddStaticSocket(struct bNodeTree *ntree,
|
|
|
|
|
struct bNode *node,
|
2021-03-26 14:25:52 -04:00
|
|
|
eNodeSocketInOut in_out,
|
2013-03-18 16:34:57 +00:00
|
|
|
int type,
|
|
|
|
|
int subtype,
|
|
|
|
|
const char *identifier,
|
|
|
|
|
const char *name);
|
2011-09-05 21:01:50 +00:00
|
|
|
void nodeRemoveSocket(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock);
|
2023-05-15 15:14:22 +02:00
|
|
|
|
2021-07-06 18:36:11 +01:00
|
|
|
void nodeModifySocketTypeStatic(
|
2018-01-20 01:04:07 +01:00
|
|
|
struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock, int type, int subtype);
|
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
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);
|
2023-05-15 15:14:22 +02:00
|
|
|
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* Find the first available, non-duplicate name for a given node.
|
|
|
|
|
*/
|
2012-07-31 23:06:12 +00:00
|
|
|
void nodeUniqueName(struct bNodeTree *ntree, struct bNode *node);
|
2022-12-11 20:23:18 -06:00
|
|
|
/**
|
|
|
|
|
* Create a new unique integer identifier for the node. Also set the node's
|
|
|
|
|
* index in the tree, which is an eagerly maintained cache.
|
|
|
|
|
*/
|
2022-12-01 14:53:27 -06:00
|
|
|
void nodeUniqueID(struct bNodeTree *ntree, struct bNode *node);
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* Delete node, associated animation data and ID user count.
|
|
|
|
|
*/
|
2019-03-16 18:54:00 +01:00
|
|
|
void nodeRemoveNode(struct Main *bmain,
|
|
|
|
|
struct bNodeTree *ntree,
|
|
|
|
|
struct bNode *node,
|
|
|
|
|
bool do_id_user);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-11-18 12:46:20 +01:00
|
|
|
void nodeDimensionsGet(const struct bNode *node, float *r_width, float *r_height);
|
|
|
|
|
void nodeTagUpdateID(struct bNode *node);
|
2023-01-09 23:29:58 -05:00
|
|
|
void nodeInternalLinks(struct bNode *node, struct bNodeLink **r_links, int *r_len);
|
2022-11-18 12:46:20 +01:00
|
|
|
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* Also used via RNA API, so we check for proper input output direction.
|
|
|
|
|
*/
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
struct bNodeLink *nodeAddLink(struct bNodeTree *ntree,
|
|
|
|
|
struct bNode *fromnode,
|
|
|
|
|
struct bNodeSocket *fromsock,
|
|
|
|
|
struct bNode *tonode,
|
|
|
|
|
struct bNodeSocket *tosock);
|
2012-07-31 23:06:12 +00:00
|
|
|
void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link);
|
|
|
|
|
void nodeRemSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock);
|
2023-05-15 15:14:22 +02:00
|
|
|
|
2021-01-15 10:48:22 -06:00
|
|
|
bool nodeLinkIsHidden(const struct bNodeLink *link);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-11-18 11:20:13 +01:00
|
|
|
void nodeAttachNode(struct bNodeTree *ntree, struct bNode *node, struct bNode *parent);
|
|
|
|
|
void nodeDetachNode(struct bNodeTree *ntree, struct bNode *node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-05-15 15:14:22 +02:00
|
|
|
/**
|
|
|
|
|
* 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);
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* Finds a node based on its name.
|
|
|
|
|
*/
|
2012-07-31 23:06:12 +00:00
|
|
|
struct bNode *nodeFindNodebyName(struct bNodeTree *ntree, const char *name);
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* Finds a node based on given socket and returns true on success.
|
|
|
|
|
*/
|
2022-11-11 11:48:56 +01:00
|
|
|
bool nodeFindNodeTry(struct bNodeTree *ntree,
|
|
|
|
|
struct bNodeSocket *sock,
|
|
|
|
|
struct bNode **r_node,
|
|
|
|
|
int *r_sockindex);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-03-03 22:38:49 +01:00
|
|
|
bool nodeIsParentAndChild(const bNode *parent, const bNode *child);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-01-15 10:48:22 -06:00
|
|
|
int nodeCountSocketLinks(const struct bNodeTree *ntree, const struct bNodeSocket *sock);
|
2005-12-30 11:25:15 +00:00
|
|
|
|
2014-03-31 23:39:08 +11:00
|
|
|
void nodeSetSelected(struct bNode *node, bool select);
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* Two active flags, ID nodes have special flag for buttons display.
|
|
|
|
|
*/
|
2012-07-31 23:06:12 +00:00
|
|
|
void nodeSetActive(struct bNodeTree *ntree, struct bNode *node);
|
|
|
|
|
struct bNode *nodeGetActive(struct bNodeTree *ntree);
|
|
|
|
|
void nodeClearActive(struct bNodeTree *ntree);
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* Two active flags, ID nodes have special flag for buttons display.
|
|
|
|
|
*/
|
2012-07-31 23:06:12 +00:00
|
|
|
struct bNode *nodeGetActiveTexture(struct bNodeTree *ntree);
|
2012-01-08 10:23:19 +00:00
|
|
|
|
2021-01-15 10:48:22 -06:00
|
|
|
int nodeSocketLinkLimit(const struct bNodeSocket *sock);
|
Nodes: Support storing socket link limits in bNodeSocketType
Currently the link limit of sockets is stored in bNodeSocket->limit.
This allows for a lot of flexibility, but is also very redundant.
In every case I've had to deal with so far, it would have "more correct"
to set the link limit per socket type and not per socket. I did not enforce
this constraint yet, because the link limit is exposed in the Python API,
which I did not want to break here.
In the future it might even make sense to only support only three kinds of link limits:
a) no links, b) at most one link, c) an arbitrary number links links. The other link
limits usually don't work well with tools (e.g. which link should be removed when a new
one is connected?) and is not used in practice. However, that is for another day.
Eventually, I would like to get rid of bNodeSocket->limit completely and replace it
either with fixed link limits or a callback in bNodeSocketType.
This patch consists of three parts:
**1. Support defining link limit in socket type**
This introduces a new `nodeSocketLinkLimit` function that serves as an indirection to
hide where the link limit of a socket is defined.
**2. Define link limits for builtin sockets on socket type**
Data sockets: one input, many outputs
Virtual sockets: one input, one output
Undefined sockets: many inputs, many outputs (to avoid that links are removed when the type of the socket is not known)
**3. Remove `bNodeSocketTemplate->limit`**
This wasn't used anymore after the second commit. Removing it simplifies socket definitions
in hundreds of places and removes a lot of redundancy.
Differential Revision: https://developer.blender.org/D7038
Reviewers: brecht
2020-03-06 12:20:05 +01:00
|
|
|
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* Node Instance Hash.
|
|
|
|
|
*/
|
2015-04-07 11:25:42 +10:00
|
|
|
typedef struct bNodeInstanceHash {
|
2021-10-03 12:06:06 +11:00
|
|
|
/** XXX should be made a direct member, #GHash allocation needs to support it */
|
|
|
|
|
GHash *ghash;
|
2013-03-18 16:34:57 +00:00
|
|
|
} bNodeInstanceHash;
|
|
|
|
|
|
|
|
|
|
typedef void (*bNodeInstanceValueFP)(void *value);
|
|
|
|
|
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* Magic number for initial hash key.
|
|
|
|
|
*/
|
2013-03-18 16:34:57 +00:00
|
|
|
extern const bNodeInstanceKey NODE_INSTANCE_KEY_BASE;
|
2013-04-24 16:36:50 +00:00
|
|
|
extern const bNodeInstanceKey NODE_INSTANCE_KEY_NONE;
|
2013-03-18 16:34:57 +00:00
|
|
|
|
|
|
|
|
bNodeInstanceKey BKE_node_instance_key(bNodeInstanceKey parent_key,
|
2021-01-25 21:11:57 -06:00
|
|
|
const struct bNodeTree *ntree,
|
|
|
|
|
const struct bNode *node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 18:25:05 +00:00
|
|
|
bNodeInstanceHash *BKE_node_instance_hash_new(const char *info);
|
2013-03-18 16:34:57 +00:00
|
|
|
void BKE_node_instance_hash_free(bNodeInstanceHash *hash, bNodeInstanceValueFP valfreefp);
|
|
|
|
|
void BKE_node_instance_hash_insert(bNodeInstanceHash *hash, bNodeInstanceKey key, void *value);
|
2013-03-18 18:25:05 +00:00
|
|
|
void *BKE_node_instance_hash_lookup(bNodeInstanceHash *hash, bNodeInstanceKey key);
|
2013-03-18 16:34:57 +00:00
|
|
|
int BKE_node_instance_hash_remove(bNodeInstanceHash *hash,
|
|
|
|
|
bNodeInstanceKey key,
|
|
|
|
|
bNodeInstanceValueFP valfreefp);
|
|
|
|
|
void BKE_node_instance_hash_clear(bNodeInstanceHash *hash, bNodeInstanceValueFP valfreefp);
|
2013-03-18 18:25:05 +00:00
|
|
|
void *BKE_node_instance_hash_pop(bNodeInstanceHash *hash, bNodeInstanceKey key);
|
2013-03-18 16:34:57 +00:00
|
|
|
int BKE_node_instance_hash_haskey(bNodeInstanceHash *hash, bNodeInstanceKey key);
|
|
|
|
|
int BKE_node_instance_hash_size(bNodeInstanceHash *hash);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
void BKE_node_instance_hash_clear_tags(bNodeInstanceHash *hash);
|
|
|
|
|
void BKE_node_instance_hash_tag(bNodeInstanceHash *hash, void *value);
|
2014-03-31 23:39:08 +11:00
|
|
|
bool BKE_node_instance_hash_tag_key(bNodeInstanceHash *hash, bNodeInstanceKey key);
|
2013-03-18 16:34:57 +00:00
|
|
|
void BKE_node_instance_hash_remove_untagged(bNodeInstanceHash *hash,
|
|
|
|
|
bNodeInstanceValueFP valfreefp);
|
|
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Node Type Access
|
|
|
|
|
* \{ */
|
2011-02-21 13:47:49 +00:00
|
|
|
|
2022-09-21 15:01:52 -05:00
|
|
|
bool nodeGroupPoll(const struct bNodeTree *nodetree,
|
|
|
|
|
const struct bNodeTree *grouptree,
|
2021-04-12 18:43:23 +02:00
|
|
|
const char **r_disabled_hint);
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2022-01-03 19:32:33 -05:00
|
|
|
void node_type_base_custom(struct bNodeType *ntype,
|
|
|
|
|
const char *idname,
|
|
|
|
|
const char *name,
|
2023-08-16 09:29:46 +02:00
|
|
|
const char *enum_name,
|
2022-01-03 19:32:33 -05:00
|
|
|
short nclass);
|
2023-05-15 15:14:22 +02:00
|
|
|
|
2021-12-07 17:19:15 +11:00
|
|
|
/**
|
|
|
|
|
* \warning Nodes defining a storage type _must_ allocate this for new nodes.
|
2023-02-12 14:37:16 +11:00
|
|
|
* Otherwise nodes will reload as undefined (#46619).
|
2021-12-07 17:19:15 +11:00
|
|
|
*/
|
2012-07-31 23:06:12 +00:00
|
|
|
void node_type_storage(struct bNodeType *ntype,
|
|
|
|
|
const char *storagename,
|
2013-03-18 16:34:57 +00:00
|
|
|
void (*freefunc)(struct bNode *node),
|
|
|
|
|
void (*copyfunc)(struct bNodeTree *dest_ntree,
|
|
|
|
|
struct bNode *dest_node,
|
2019-06-03 17:08:25 +02:00
|
|
|
const struct bNode *src_node));
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2018-03-14 01:58:46 +11:00
|
|
|
/** \} */
|
2015-02-14 07:27:09 +11:00
|
|
|
|
2023-07-09 21:40:17 +10:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Common Node Types
|
|
|
|
|
* \{ */
|
2011-02-07 09:33:36 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
#define NODE_UNDEFINED -2 /* node type is not registered */
|
2021-10-15 14:08:52 -05:00
|
|
|
#define NODE_CUSTOM -1 /* for dynamically registered custom types */
|
2007-03-24 18:41:54 +00:00
|
|
|
#define NODE_GROUP 2
|
2015-11-12 18:52:58 +11:00
|
|
|
// #define NODE_FORLOOP 3 /* deprecated */
|
|
|
|
|
// #define NODE_WHILELOOP 4 /* deprecated */
|
2011-09-05 21:01:50 +00:00
|
|
|
#define NODE_FRAME 5
|
2012-06-01 12:38:03 +00:00
|
|
|
#define NODE_REROUTE 6
|
2013-03-18 16:34:57 +00:00
|
|
|
#define NODE_GROUP_INPUT 7
|
|
|
|
|
#define NODE_GROUP_OUTPUT 8
|
2019-03-16 18:48:22 +01:00
|
|
|
#define NODE_CUSTOM_GROUP 9
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Node Tree Iterator
|
|
|
|
|
*
|
2019-04-27 12:07:07 +10:00
|
|
|
* Utility macro for visiting every node tree in the library data,
|
|
|
|
|
* including local bNodeTree blocks in other IDs.
|
|
|
|
|
* This avoids the need for callback functions and allows executing code
|
|
|
|
|
* in a single inner code block.
|
2013-03-18 16:34:57 +00:00
|
|
|
*
|
|
|
|
|
* Variables:
|
|
|
|
|
*
|
2019-04-27 12:07:07 +10:00
|
|
|
* - nodetree:
|
|
|
|
|
* The actual bNodeTree data block.
|
2023-07-09 21:22:31 +10:00
|
|
|
* Check `nodetree->idname` or `nodetree->typeinfo` to use only specific types.
|
2013-03-18 16:34:57 +00:00
|
|
|
*
|
2019-04-27 12:07:07 +10:00
|
|
|
* - id:
|
|
|
|
|
* The owner of the bNodeTree data block.
|
|
|
|
|
* Same as nodetree if it's a linkable node tree from the library.
|
2013-03-18 16:34:57 +00:00
|
|
|
*
|
|
|
|
|
* Examples:
|
|
|
|
|
*
|
2015-02-14 07:27:09 +11:00
|
|
|
* \code{.c}
|
2018-11-30 15:22:01 +11:00
|
|
|
* FOREACH_NODETREE_BEGIN(bmain, nodetree, id) {
|
2013-03-18 16:34:57 +00:00
|
|
|
* if (id == nodetree)
|
|
|
|
|
* printf("This is a linkable node tree");
|
2018-11-30 15:22:01 +11:00
|
|
|
* } FOREACH_NODETREE_END;
|
2013-03-18 16:34:57 +00:00
|
|
|
*
|
2018-11-30 15:22:01 +11:00
|
|
|
* FOREACH_NODETREE_BEGIN(bmain, nodetree, id) {
|
2013-03-18 16:34:57 +00:00
|
|
|
* if (nodetree->idname == "ShaderNodeTree")
|
|
|
|
|
* printf("This is a shader node tree);
|
|
|
|
|
* if (GS(id) == ID_MA)
|
|
|
|
|
* printf(" and it's owned by a material");
|
2018-11-30 15:22:01 +11:00
|
|
|
* } FOREACH_NODETREE_END;
|
2015-02-14 07:27:09 +11:00
|
|
|
* \endcode
|
|
|
|
|
*
|
|
|
|
|
* \{ */
|
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
|
|
|
|
2013-03-26 22:37:41 +00:00
|
|
|
/* should be an opaque type, only for internal use by BKE_node_tree_iter_*** */
|
|
|
|
|
struct NodeTreeIterStore {
|
|
|
|
|
bNodeTree *ngroup;
|
|
|
|
|
Scene *scene;
|
2019-09-07 23:17:40 +10:00
|
|
|
struct Material *mat;
|
2013-03-26 22:37:41 +00:00
|
|
|
Tex *tex;
|
2019-09-07 23:17:40 +10:00
|
|
|
struct Light *light;
|
|
|
|
|
struct World *world;
|
|
|
|
|
struct FreestyleLineStyle *linestyle;
|
2013-03-26 22:37:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void BKE_node_tree_iter_init(struct NodeTreeIterStore *ntreeiter, struct Main *bmain);
|
|
|
|
|
bool BKE_node_tree_iter_step(struct NodeTreeIterStore *ntreeiter,
|
|
|
|
|
struct bNodeTree **r_nodetree,
|
|
|
|
|
struct ID **r_id);
|
|
|
|
|
|
2018-11-30 15:22:01 +11:00
|
|
|
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id) \
|
2013-03-18 16:34:57 +00:00
|
|
|
{ \
|
2013-03-26 22:37:41 +00:00
|
|
|
struct NodeTreeIterStore _nstore; \
|
2013-03-18 16:34:57 +00:00
|
|
|
bNodeTree *_nodetree; \
|
|
|
|
|
ID *_id; \
|
|
|
|
|
/* avoid compiler warning about unused variables */ \
|
2013-03-26 22:37:41 +00:00
|
|
|
BKE_node_tree_iter_init(&_nstore, bmain); \
|
|
|
|
|
while (BKE_node_tree_iter_step(&_nstore, &_nodetree, &_id) == true) { \
|
2013-03-18 16:34:57 +00:00
|
|
|
if (_nodetree) {
|
|
|
|
|
|
|
|
|
|
#define FOREACH_NODETREE_END \
|
|
|
|
|
} \
|
2013-03-26 22:37:41 +00:00
|
|
|
} \
|
2018-11-30 15:22:01 +11:00
|
|
|
} \
|
|
|
|
|
((void)0)
|
2021-12-14 15:49:31 +11:00
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/** \} */
|
2012-10-01 07:54:37 +00:00
|
|
|
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Node Tree
|
|
|
|
|
*/
|
|
|
|
|
|
2022-01-07 11:38:08 +11:00
|
|
|
void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, struct Scene *scene, int layer_index);
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Shader Nodes
|
2018-03-14 01:58:46 +11:00
|
|
|
* \{ */
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
|
2021-07-03 23:08:40 +10:00
|
|
|
/* NOTE: types are needed to restore callbacks, don't change values. */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-06-14 18:02:40 +02:00
|
|
|
// #define SH_NODE_MATERIAL 100
|
2008-02-09 23:17:15 +00:00
|
|
|
#define SH_NODE_RGB 101
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
#define SH_NODE_VALUE 102
|
2022-08-30 11:05:46 +01:00
|
|
|
#define SH_NODE_MIX_RGB_LEGACY 103
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
#define SH_NODE_VALTORGB 104
|
|
|
|
|
#define SH_NODE_RGBTOBW 105
|
2018-05-14 13:34:54 +02:00
|
|
|
#define SH_NODE_SHADERTORGB 106
|
2023-06-14 18:02:40 +02:00
|
|
|
// #define SH_NODE_TEXTURE 106
|
2005-12-30 11:25:15 +00:00
|
|
|
#define SH_NODE_NORMAL 107
|
2023-06-14 18:02:40 +02:00
|
|
|
// #define SH_NODE_GEOMETRY 108
|
2006-01-04 12:13:13 +00:00
|
|
|
#define SH_NODE_MAPPING 109
|
Orange:
- New UI element: the "Curve Button".
For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.
To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:
curvemap= curvemapping_add(3, 0, 0, 1, 1)
Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all editing.
Evaluating a single channel:
float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);
Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:
curvemapping_evaluate3F(curvemap, newvec, oldvec);
Optimized versions for byte or short mapping is possible too, not done yet.
In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:
http://www.blender.org/bf/curves.jpg
- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection
In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).
- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
(Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them
Other fixes:
- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
the old code made ints from the raster pos coordinate, which doesn't work
well for zoom in/out situations
- bug in Node editing: buttons could not get freed, causing in memory error
prints at end of a Blender session. That one was a very simple, but nasty
error causing me all evening last night to find!
(Hint; check diff of editnode.c, where uiDoButtons is called)
Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00
|
|
|
#define SH_NODE_CURVE_VEC 110
|
|
|
|
|
#define SH_NODE_CURVE_RGB 111
|
2006-12-22 08:10:29 +00:00
|
|
|
#define SH_NODE_CAMERA 114
|
2006-08-01 01:12:01 +00:00
|
|
|
#define SH_NODE_MATH 115
|
Shading: Add more operators to Vector Math node.
Add Multiply, Divide, Project, Reflect, Distance, Length, Scale, Snap,
Floor, Ceil, Modulo, Fraction, Absolute, Minimum, and Maximum operators
to the Vector Math node. The Value output has been removed from operators
whose output is a vector, and the other way around. All of those removals
has been handled properly in versioning code.
The patch doesn't include tests for the new operators. Tests will be added
in a later patch.
Reviewers: brecht, JacquesLucke
Differential Revision: https://developer.blender.org/D5523
2019-08-21 19:36:33 +02:00
|
|
|
#define SH_NODE_VECTOR_MATH 116
|
2007-03-24 18:41:54 +00:00
|
|
|
#define SH_NODE_SQUEEZE 117
|
2023-06-14 18:02:40 +02:00
|
|
|
// #define SH_NODE_MATERIAL_EXT 118
|
== Shader nodes ==
* Geometry node: Front/back output
This is used as a mask for determining whether you're looking at the front side or back side of a mesh, useful for blending materials, my practical need was giving different materials to the pages of a magazine: http://mke3.net/blender/etc/frontback-h264.mov
Give 1.0 if it's the front side, and 0.0 if it's the back side.
* Extended material node
This is the same as the material node, but gives more available inputs and outputs, (basically just connecting up more of ShadeInput and ShadeResult to the node). I didn't want to add it to the normal simple Material node since you don't always need all that stuff, and it would make the node huge, but when you do need it, it's nice to have it.
== Comp nodes ==
* Invert node
Inverting is something that happens all the time in a node setup, and this makes it easier. It's been possible to invert previously by adding a mix node and subtracting the input from 1.0, but it's not the best way of doing it. This node:
- makes it a lot faster to set up, rather than all the clicking required with the mix node
- is a lot more usable amidst a complex comp setup, when you're looking at a node tree, it's very helpful to be able to see at a glance what's going on. Using subtract for inverting is easily mixed up with other nodes in which you are actually subtracting, not inverting, and looks very similar to all the other mix nodes that usually litter a comp tree.
- has options to invert the RGB channels, the Alpha channel, or both. This saves adding lots of extra nodes (separate RGBA, subtract, set alpha) when you want to do something simple like invert an alpha channel. I'd like to add this option to other nodes too.
There's also a shader node version too.
* Also a few fixes that I committed ages ago, but seems to have been overwritten in Bob's node refactor:
- adding new compbufs to the set alpha and alphaover nodes when you have only one noodle connected to the lower input
- making the fac value on RGB curves still work when there's nothing connected to it
2007-05-31 06:55:02 +00:00
|
|
|
#define SH_NODE_INVERT 119
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
#define SH_NODE_SEPRGB_LEGACY 120
|
|
|
|
|
#define SH_NODE_COMBRGB_LEGACY 121
|
2007-08-31 07:42:06 +00:00
|
|
|
#define SH_NODE_HUE_SAT 122
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-11-08 11:38:16 +00:00
|
|
|
#define SH_NODE_OUTPUT_MATERIAL 124
|
|
|
|
|
#define SH_NODE_OUTPUT_WORLD 125
|
2018-06-27 14:41:53 +02:00
|
|
|
#define SH_NODE_OUTPUT_LIGHT 126
|
2011-11-08 11:38:16 +00:00
|
|
|
#define SH_NODE_FRESNEL 127
|
|
|
|
|
#define SH_NODE_MIX_SHADER 128
|
|
|
|
|
#define SH_NODE_ATTRIBUTE 129
|
|
|
|
|
#define SH_NODE_BACKGROUND 130
|
Cycles: Merge Anisotropic BSDF node into Glossy BSDF node
Used to be https://archive.blender.org/developer/D17123.
Internally these are already using the same code path anyways, there's no point in maintaining two distinct nodes.
The obvious approach would be to add Anisotropy controls to the Glossy BSDF node and remove the Anisotropic BSDF node. However, that would break forward compability, since older Blender versions don't know how to handle the Anisotropy input on the Glossy BSDF node.
Therefore, this commit technically removes the Glossy BSDF node, uses versioning to replace them with an Anisotropic BSDF node, and renames that node to "Glossy BSDF".
That way, when you open a new file in an older version, all the nodes show up as Anisotropic BSDF nodes and render correctly.
This is a bit ugly internally since we need to preserve the old `idname` which now no longer matches the UI name, but that's not too bad.
Also removes the "Sharp" distribution option and replaces it with GGX, sets Roughness to zero and disconnects any input to the Roughness socket.
Pull Request: https://projects.blender.org/blender/blender/pulls/104445
2023-05-18 23:12:20 +02:00
|
|
|
#define SH_NODE_BSDF_GLOSSY 131
|
2011-11-08 11:38:16 +00:00
|
|
|
#define SH_NODE_BSDF_DIFFUSE 132
|
Cycles: Merge Anisotropic BSDF node into Glossy BSDF node
Used to be https://archive.blender.org/developer/D17123.
Internally these are already using the same code path anyways, there's no point in maintaining two distinct nodes.
The obvious approach would be to add Anisotropy controls to the Glossy BSDF node and remove the Anisotropic BSDF node. However, that would break forward compability, since older Blender versions don't know how to handle the Anisotropy input on the Glossy BSDF node.
Therefore, this commit technically removes the Glossy BSDF node, uses versioning to replace them with an Anisotropic BSDF node, and renames that node to "Glossy BSDF".
That way, when you open a new file in an older version, all the nodes show up as Anisotropic BSDF nodes and render correctly.
This is a bit ugly internally since we need to preserve the old `idname` which now no longer matches the UI name, but that's not too bad.
Also removes the "Sharp" distribution option and replaces it with GGX, sets Roughness to zero and disconnects any input to the Roughness socket.
Pull Request: https://projects.blender.org/blender/blender/pulls/104445
2023-05-18 23:12:20 +02:00
|
|
|
#define SH_NODE_BSDF_GLOSSY_LEGACY 133
|
2011-11-08 11:38:16 +00:00
|
|
|
#define SH_NODE_BSDF_GLASS 134
|
|
|
|
|
#define SH_NODE_BSDF_TRANSLUCENT 137
|
|
|
|
|
#define SH_NODE_BSDF_TRANSPARENT 138
|
2023-07-24 15:36:36 +02:00
|
|
|
#define SH_NODE_BSDF_SHEEN 139
|
2011-11-08 11:38:16 +00:00
|
|
|
#define SH_NODE_EMISSION 140
|
|
|
|
|
#define SH_NODE_NEW_GEOMETRY 141
|
|
|
|
|
#define SH_NODE_LIGHT_PATH 142
|
|
|
|
|
#define SH_NODE_TEX_IMAGE 143
|
|
|
|
|
#define SH_NODE_TEX_SKY 145
|
|
|
|
|
#define SH_NODE_TEX_GRADIENT 146
|
|
|
|
|
#define SH_NODE_TEX_VORONOI 147
|
|
|
|
|
#define SH_NODE_TEX_MAGIC 148
|
|
|
|
|
#define SH_NODE_TEX_WAVE 149
|
|
|
|
|
#define SH_NODE_TEX_NOISE 150
|
2023-11-18 09:40:44 +01:00
|
|
|
#define SH_NODE_TEX_MUSGRAVE_DEPRECATED 152
|
2011-11-08 11:38:16 +00:00
|
|
|
#define SH_NODE_TEX_COORD 155
|
|
|
|
|
#define SH_NODE_ADD_SHADER 156
|
|
|
|
|
#define SH_NODE_TEX_ENVIRONMENT 157
|
2020-02-15 12:29:40 +11:00
|
|
|
// #define SH_NODE_OUTPUT_TEXTURE 158
|
2011-11-08 11:38:16 +00:00
|
|
|
#define SH_NODE_HOLDOUT 159
|
|
|
|
|
#define SH_NODE_LAYER_WEIGHT 160
|
2013-12-28 01:54:44 +01:00
|
|
|
#define SH_NODE_VOLUME_ABSORPTION 161
|
|
|
|
|
#define SH_NODE_VOLUME_SCATTER 162
|
2012-05-07 20:24:38 +00:00
|
|
|
#define SH_NODE_GAMMA 163
|
|
|
|
|
#define SH_NODE_TEX_CHECKER 164
|
2012-01-24 16:32:31 +00:00
|
|
|
#define SH_NODE_BRIGHTCONTRAST 165
|
2012-05-07 20:24:38 +00:00
|
|
|
#define SH_NODE_LIGHT_FALLOFF 166
|
2012-05-21 12:52:28 +00:00
|
|
|
#define SH_NODE_OBJECT_INFO 167
|
2014-06-13 21:44:48 +02:00
|
|
|
#define SH_NODE_PARTICLE_INFO 168
|
2012-09-04 13:29:07 +00:00
|
|
|
#define SH_NODE_TEX_BRICK 169
|
2012-10-10 15:56:43 +00:00
|
|
|
#define SH_NODE_BUMP 170
|
2012-11-03 14:32:26 +00:00
|
|
|
#define SH_NODE_SCRIPT 171
|
2012-11-06 19:59:02 +00:00
|
|
|
#define SH_NODE_AMBIENT_OCCLUSION 172
|
|
|
|
|
#define SH_NODE_BSDF_REFRACTION 173
|
|
|
|
|
#define SH_NODE_TANGENT 174
|
|
|
|
|
#define SH_NODE_NORMAL_MAP 175
|
2012-12-28 14:21:30 +00:00
|
|
|
#define SH_NODE_HAIR_INFO 176
|
2013-04-01 20:26:52 +00:00
|
|
|
#define SH_NODE_SUBSURFACE_SCATTERING 177
|
2013-05-20 15:58:37 +00:00
|
|
|
#define SH_NODE_WIREFRAME 178
|
2013-05-23 17:45:20 +00:00
|
|
|
#define SH_NODE_BSDF_TOON 179
|
2013-06-09 20:46:22 +00:00
|
|
|
#define SH_NODE_WAVELENGTH 180
|
2013-06-13 08:55:51 +00:00
|
|
|
#define SH_NODE_BLACKBODY 181
|
2013-06-20 08:20:30 +00:00
|
|
|
#define SH_NODE_VECT_TRANSFORM 182
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
#define SH_NODE_SEPHSV_LEGACY 183
|
|
|
|
|
#define SH_NODE_COMBHSV_LEGACY 184
|
2013-09-15 23:58:00 +00:00
|
|
|
#define SH_NODE_BSDF_HAIR 185
|
2020-02-15 12:29:40 +11:00
|
|
|
// #define SH_NODE_LAMP 186
|
2014-06-13 21:44:48 +02:00
|
|
|
#define SH_NODE_UVMAP 187
|
|
|
|
|
#define SH_NODE_SEPXYZ 188
|
|
|
|
|
#define SH_NODE_COMBXYZ 189
|
2014-07-14 16:20:40 +09:00
|
|
|
#define SH_NODE_OUTPUT_LINESTYLE 190
|
2014-07-20 12:14:31 +09:00
|
|
|
#define SH_NODE_UVALONGSTROKE 191
|
2015-07-18 22:36:09 +02:00
|
|
|
#define SH_NODE_TEX_POINTDENSITY 192
|
2017-04-18 11:43:09 +02:00
|
|
|
#define SH_NODE_BSDF_PRINCIPLED 193
|
2018-05-27 11:01:46 +02:00
|
|
|
#define SH_NODE_TEX_IES 194
|
2017-06-20 14:33:13 +02:00
|
|
|
#define SH_NODE_EEVEE_SPECULAR 195
|
2017-08-18 18:37:05 +02:00
|
|
|
#define SH_NODE_BEVEL 197
|
2018-01-13 13:11:03 +01:00
|
|
|
#define SH_NODE_DISPLACEMENT 198
|
2018-01-21 00:40:42 +01:00
|
|
|
#define SH_NODE_VECTOR_DISPLACEMENT 199
|
2018-01-30 15:05:19 +01:00
|
|
|
#define SH_NODE_VOLUME_PRINCIPLED 200
|
2018-07-18 11:14:43 +02:00
|
|
|
/* 201..700 occupied by other node types, continue from 701 */
|
|
|
|
|
#define SH_NODE_BSDF_HAIR_PRINCIPLED 701
|
2019-08-13 16:29:32 +02:00
|
|
|
#define SH_NODE_MAP_RANGE 702
|
2019-08-13 22:22:15 +02:00
|
|
|
#define SH_NODE_CLAMP 703
|
2019-08-21 20:04:09 +02:00
|
|
|
#define SH_NODE_TEX_WHITE_NOISE 704
|
2019-08-21 20:22:24 +02:00
|
|
|
#define SH_NODE_VOLUME_INFO 705
|
2019-09-12 17:42:13 +02:00
|
|
|
#define SH_NODE_VERTEX_COLOR 706
|
2019-12-04 19:57:28 +01:00
|
|
|
#define SH_NODE_OUTPUT_AOV 707
|
2020-02-17 15:15:46 +00:00
|
|
|
#define SH_NODE_VECTOR_ROTATE 708
|
2021-09-30 19:05:08 +01:00
|
|
|
#define SH_NODE_CURVE_FLOAT 709
|
2022-01-25 13:25:33 +01:00
|
|
|
#define SH_NODE_POINT_INFO 710
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
#define SH_NODE_COMBINE_COLOR 711
|
|
|
|
|
#define SH_NODE_SEPARATE_COLOR 712
|
2022-08-30 11:05:46 +01:00
|
|
|
#define SH_NODE_MIX 713
|
2011-11-08 11:38:16 +00:00
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/** \} */
|
2007-03-24 18:41:54 +00:00
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Composite Nodes
|
2018-03-14 01:58:46 +11:00
|
|
|
* \{ */
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
2007-03-24 18:41:54 +00:00
|
|
|
/* output socket defines */
|
2013-08-03 13:12:09 +00:00
|
|
|
#define RRES_OUT_IMAGE 0
|
|
|
|
|
#define RRES_OUT_ALPHA 1
|
2007-03-24 18:41:54 +00:00
|
|
|
|
2021-07-03 23:08:40 +10:00
|
|
|
/* NOTE: types are needed to restore callbacks, don't change values. */
|
2006-01-24 21:50:23 +00:00
|
|
|
#define CMP_NODE_VIEWER 201
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
#define CMP_NODE_RGB 202
|
|
|
|
|
#define CMP_NODE_VALUE 203
|
|
|
|
|
#define CMP_NODE_MIX_RGB 204
|
|
|
|
|
#define CMP_NODE_VALTORGB 205
|
|
|
|
|
#define CMP_NODE_RGBTOBW 206
|
|
|
|
|
#define CMP_NODE_NORMAL 207
|
|
|
|
|
#define CMP_NODE_CURVE_VEC 208
|
|
|
|
|
#define CMP_NODE_CURVE_RGB 209
|
|
|
|
|
#define CMP_NODE_ALPHAOVER 210
|
|
|
|
|
#define CMP_NODE_BLUR 211
|
|
|
|
|
#define CMP_NODE_FILTER 212
|
Orange; more render & compo stuff!
-> Rendering in RenderLayers
It's important to distinguish a 'render layer' from a 'pass'. The first is
control over the main pipeline itself, to indicate what geometry is being
is rendered. The 'pass' (not in this commit!) is related to internal
shading code, like shadow/spec/AO/normals/etc.
Options for RenderLayers now are:
- Indicate which 3d 'view layers' have to be included (so you can render
front and back separately)
- "Solid", all solid faces, includes sky at the moment too
- "ZTransp", all transparent faces
- "Halo", the halos
- "Strand", the particle strands (not coded yet...)
Currently only 2 'passes' are exported for render, which is the "Combined"
buffer and the "Z. The latter now works, and can be turned on/off.
Note that all layers are still fully kept in memory now, saving the tiles
and layers to disk (in exr) is also todo.
-> New Blur options
The existing Blur Node (compositor) now has an optional input image. This
has to be a 'value buffer', which can be a Zbuffer, or any mask you can
think of. The input values have to be in the 0-1 range, so another new
node was added too "Map Value".
The value input can also be used to tweak blur size with the (todo)
Time Node.
Temporal screenies:
http://www.blender.org/bf/rt.jpg
http://www.blender.org/bf/rt1.jpg
http://www.blender.org/bf/rt2.jpg
BTW: The compositor is very slow still, it recalulates all nodes on each
change still. Persistant memory and dependency checks is coming!
2006-01-26 22:18:46 +00:00
|
|
|
#define CMP_NODE_MAP_VALUE 213
|
|
|
|
|
#define CMP_NODE_TIME 214
|
2006-01-31 21:49:05 +00:00
|
|
|
#define CMP_NODE_VECBLUR 215
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
#define CMP_NODE_SEPRGBA_LEGACY 216
|
|
|
|
|
#define CMP_NODE_SEPHSVA_LEGACY 217
|
2006-02-17 13:51:55 +00:00
|
|
|
#define CMP_NODE_SETALPHA 218
|
Four-in-one commit:
(NOTE: new include dependency in Render module, might need MSVC update!
It has to include the imbuf/intern/openexr/ directory in search path)
-> New Composite node: "Hue Saturation".
Works like the former 'post process' menu. There's no gamma, brightness or
multiply needed in this node, for that the Curves Node functions better.
-> Enabled Toolbox in Node editor
This now also replaces the SHIFT+A for adding nodes. The nodes are
automatically added to the menus, using the 'class' category from the
type definition.
Current classes are (compositor examples):
Inputs: RenderResult, Image
Outputs: Composite, Viewer
Color Ops: RGB Curves, Mix, Hue Saturation, AlphaOver
Vector Ops: Normal, Vector Curves, Map Value
Filters: Filter, Blur, VectorBlur
Convertors: ColorRamp, RGBtoBW, Separate RGBA, Separate HSVA, Set Alpha
Generators: RGB, Value, Time
Groups: the list of custom defined nodes
-> OpenEXR tile saving support
Created an API for for saving tile-based Images with an unlimited amount
of layers/channels. I've tested it for 'render result' now, with the idea
that this can (optionally) replace the current inserting of tiles in the
main result buffers. Especially with a lot of layers, the used memory for
these buffers can easily go into the 100s of megs.
Two other advantages:
- all 'render result' layers can be saved entirely in a single file, for
later use in compositing, also for animation output.
- on each render, per scene, a unique temp file can be stored, allowing
to re-use these temp files on starting Blender or loading files, showing
the last result of a render command.
The option is currently disabled, needs more work... but I had to commit
this because of the rest of the work I did!
-> Bug fix
The Image node didn't call an execute event when browsing another image.
2006-02-18 13:28:44 +00:00
|
|
|
#define CMP_NODE_HUE_SAT 219
|
2007-03-24 18:41:54 +00:00
|
|
|
#define CMP_NODE_IMAGE 220
|
|
|
|
|
#define CMP_NODE_R_LAYERS 221
|
|
|
|
|
#define CMP_NODE_COMPOSITE 222
|
2006-01-24 21:50:23 +00:00
|
|
|
#define CMP_NODE_OUTPUT_FILE 223
|
2007-03-24 18:41:54 +00:00
|
|
|
#define CMP_NODE_TEXTURE 224
|
|
|
|
|
#define CMP_NODE_TRANSLATE 225
|
|
|
|
|
#define CMP_NODE_ZCOMBINE 226
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
#define CMP_NODE_COMBRGBA_LEGACY 227
|
2006-07-31 02:24:35 +00:00
|
|
|
#define CMP_NODE_DILATEERODE 228
|
2007-03-24 18:41:54 +00:00
|
|
|
#define CMP_NODE_ROTATE 229
|
|
|
|
|
#define CMP_NODE_SCALE 230
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
#define CMP_NODE_SEPYCCA_LEGACY 231
|
|
|
|
|
#define CMP_NODE_COMBYCCA_LEGACY 232
|
|
|
|
|
#define CMP_NODE_SEPYUVA_LEGACY 233
|
|
|
|
|
#define CMP_NODE_COMBYUVA_LEGACY 234
|
2007-03-24 18:41:54 +00:00
|
|
|
#define CMP_NODE_DIFF_MATTE 235
|
2006-11-15 14:41:04 +00:00
|
|
|
#define CMP_NODE_COLOR_SPILL 236
|
2009-09-10 04:12:22 +00:00
|
|
|
#define CMP_NODE_CHROMA_MATTE 237
|
2007-01-09 04:32:39 +00:00
|
|
|
#define CMP_NODE_CHANNEL_MATTE 238
|
2007-03-24 18:41:54 +00:00
|
|
|
#define CMP_NODE_FLIP 239
|
2023-12-03 23:20:44 +01:00
|
|
|
/* Split viewer node is now a regular split node: CMP_NODE_SPLIT. */
|
|
|
|
|
#define CMP_NODE_SPLITVIEWER__DEPRECATED 240
|
2015-11-12 18:52:58 +11:00
|
|
|
// #define CMP_NODE_INDEX_MASK 241
|
2007-03-24 18:41:54 +00:00
|
|
|
#define CMP_NODE_MAP_UV 242
|
|
|
|
|
#define CMP_NODE_ID_MASK 243
|
|
|
|
|
#define CMP_NODE_DEFOCUS 244
|
|
|
|
|
#define CMP_NODE_DISPLACE 245
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
#define CMP_NODE_COMBHSVA_LEGACY 246
|
2007-03-24 18:41:54 +00:00
|
|
|
#define CMP_NODE_MATH 247
|
|
|
|
|
#define CMP_NODE_LUMA_MATTE 248
|
2007-04-13 03:23:39 +00:00
|
|
|
#define CMP_NODE_BRIGHTCONTRAST 249
|
2007-04-13 04:22:32 +00:00
|
|
|
#define CMP_NODE_GAMMA 250
|
== Shader nodes ==
* Geometry node: Front/back output
This is used as a mask for determining whether you're looking at the front side or back side of a mesh, useful for blending materials, my practical need was giving different materials to the pages of a magazine: http://mke3.net/blender/etc/frontback-h264.mov
Give 1.0 if it's the front side, and 0.0 if it's the back side.
* Extended material node
This is the same as the material node, but gives more available inputs and outputs, (basically just connecting up more of ShadeInput and ShadeResult to the node). I didn't want to add it to the normal simple Material node since you don't always need all that stuff, and it would make the node huge, but when you do need it, it's nice to have it.
== Comp nodes ==
* Invert node
Inverting is something that happens all the time in a node setup, and this makes it easier. It's been possible to invert previously by adding a mix node and subtracting the input from 1.0, but it's not the best way of doing it. This node:
- makes it a lot faster to set up, rather than all the clicking required with the mix node
- is a lot more usable amidst a complex comp setup, when you're looking at a node tree, it's very helpful to be able to see at a glance what's going on. Using subtract for inverting is easily mixed up with other nodes in which you are actually subtracting, not inverting, and looks very similar to all the other mix nodes that usually litter a comp tree.
- has options to invert the RGB channels, the Alpha channel, or both. This saves adding lots of extra nodes (separate RGBA, subtract, set alpha) when you want to do something simple like invert an alpha channel. I'd like to add this option to other nodes too.
There's also a shader node version too.
* Also a few fixes that I committed ages ago, but seems to have been overwritten in Bob's node refactor:
- adding new compbufs to the set alpha and alphaover nodes when you have only one noodle connected to the lower input
- making the fac value on RGB curves still work when there's nothing connected to it
2007-05-31 06:55:02 +00:00
|
|
|
#define CMP_NODE_INVERT 251
|
2007-07-10 02:27:37 +00:00
|
|
|
#define CMP_NODE_NORMALIZE 252
|
2007-10-29 14:37:19 +00:00
|
|
|
#define CMP_NODE_CROP 253
|
2007-12-27 14:19:11 +00:00
|
|
|
#define CMP_NODE_DBLUR 254
|
2007-12-27 20:36:17 +00:00
|
|
|
#define CMP_NODE_BILATERALBLUR 255
|
2008-03-11 14:40:27 +00:00
|
|
|
#define CMP_NODE_PREMULKEY 256
|
2009-09-10 04:12:22 +00:00
|
|
|
#define CMP_NODE_DIST_MATTE 257
|
|
|
|
|
#define CMP_NODE_VIEW_LEVELS 258
|
|
|
|
|
#define CMP_NODE_COLOR_MATTE 259
|
2010-01-20 04:19:55 +00:00
|
|
|
#define CMP_NODE_COLORBALANCE 260
|
2010-01-21 00:00:45 +00:00
|
|
|
#define CMP_NODE_HUECORRECT 261
|
2011-11-07 12:56:05 +00:00
|
|
|
#define CMP_NODE_MOVIECLIP 262
|
|
|
|
|
#define CMP_NODE_STABILIZE2D 263
|
|
|
|
|
#define CMP_NODE_TRANSFORM 264
|
|
|
|
|
#define CMP_NODE_MOVIEDISTORTION 265
|
2012-01-10 19:08:08 +00:00
|
|
|
#define CMP_NODE_DOUBLEEDGEMASK 266
|
2012-03-01 07:56:15 +00:00
|
|
|
#define CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED \
|
|
|
|
|
267 /* DEPRECATED multi file node has been merged into regular CMP_NODE_OUTPUT_FILE */
|
2012-06-04 16:42:58 +00:00
|
|
|
#define CMP_NODE_MASK 268
|
2012-06-14 12:18:42 +00:00
|
|
|
#define CMP_NODE_KEYINGSCREEN 269
|
2012-06-14 12:19:13 +00:00
|
|
|
#define CMP_NODE_KEYING 270
|
2012-06-19 17:29:58 +00:00
|
|
|
#define CMP_NODE_TRACKPOS 271
|
2012-08-23 06:48:01 +00:00
|
|
|
#define CMP_NODE_INPAINT 272
|
|
|
|
|
#define CMP_NODE_DESPECKLE 273
|
2021-03-29 07:44:27 +02:00
|
|
|
#define CMP_NODE_ANTIALIASING 274
|
2023-06-08 16:14:45 +02:00
|
|
|
#define CMP_NODE_KUWAHARA 275
|
2023-12-03 23:20:44 +01:00
|
|
|
#define CMP_NODE_SPLIT 276
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2007-10-26 15:32:36 +00:00
|
|
|
#define CMP_NODE_GLARE 301
|
|
|
|
|
#define CMP_NODE_TONEMAP 302
|
|
|
|
|
#define CMP_NODE_LENSDIST 303
|
2014-07-26 12:59:29 +02:00
|
|
|
#define CMP_NODE_SUNBEAMS 304
|
2007-10-26 15:32:36 +00:00
|
|
|
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
merge to TRUNK!
* The old compositor is still available (Debug Menu: 200)
This commit was brought to you by:
Developers:
* Monique Dewanchand
* Jeroen Bakker
* Dalai Felinto
* Lukas Tönne
Review:
* Brecht van Lommel
Testers:
* Nate Wiebe
* Wolfgang Faehnle
* Carlo Andreacchio
* Daniel Salazar
* Artur Mag
* Christian Krupa
* Francesco Siddi
* Dan McGrath
* Bassam Kurdali
But mostly by the community:
Gold:
Joshua Faulkner
Michael Tiemann
Francesco Paglia
Blender Guru
Blender Developers Fund
Silver:
Pablo Vazquez
Joel Heethaar
Amrein Olivier
Ilias Karasavvidis
Thomas Kumlehn
Sebastian Koenig
Hannu Hoffrén
Benjamin Dansie
Fred M'ule
Michel Vilain
Bradley Cathey
Gianmichele Mariani
Gottfried Hofmann
Bjørnar Frøyse
Valentijn Bruning
Paul Holmes
Clemens Rudolph
Juris Graphix
David Strebel
Ronan Zeegers
François Tarlier
Felipe Andres Esquivel Reed
Olaf Beckman
Jesus Alberto Olmos Linares
Kajimba
Maria Figueiredo
Alexandr Galperin
Francesco Siddi
Julio Iglesias Lopez
Kjartan Tysdal
Thomas Torfs
Film Works
Teruyuki Nakamura
Roger Luethi
Benoit Bolsee
Stefan Abrahamsen
Andreas Mattijat
Xavier Bouchoux
Blender 3D Graphics and Animation
Henk Vostermans
Daniel Blanco Delgado
BlenderDay/2011
Bradley Cathey
Matthieu Dupont de Dinechin
Gianmichele Mariani
Jérôme Scaillet
Bronze (Ivo Grigull, Dylan Urquidi, Philippe Derungs, Phil Beauchamp, Bruce Parrott, Mathieu Quiblier, Daniel Martinez, Leandro Inocencio, Lluc Romaní Brasó,
Jonathan Williamson, Michael Ehlen, Karlis Stigis, Dreamsteep, Martin Lindelöf, Filippo Saracino, Douwe van der Veen, Olli Äkräs, Bruno D'Arcangeli,
Francisco Sedrez Warmling, Watchmike.ca, peter lener, Matteo Novellino, Martin Kirsch, Austars Schnore, KC Elliott, Massimiliano Puliero, Karl Stein,
Wood Design Studios, Omer Khan, Jyrki Kanto, Michał Krupa, Lars Brubaker, Neil Richmond, Adam Kalisz, Robert Garlington, Ian Wilson, Carlo Andreacchio,
Jeremias Boos, Robert Holcomb, Gabriel Zöller, Robert Cude, Natibel de Leon, Nathan Turnage, Nicolas Vergnes, Philipp Kleinhenz, Norman Hartig, Louis Kreusel,
Christopher Taylor, Giovanni Remondini, Daniel Rentzsch, Nico Partipilo, Thomas Ventresco, Johannes Schwarz, Александр Коротеев, Brendon Harvey,
Marcelo G. Malheiros, Marius Giurgi, Richard Burns, Perttu Iso-Metsälä, Steve Bazin, Radoslav Borisov, Yoshiyuki Shida, Julien Guigner, Andrew Hunter,
Philipp Oeser, Daniel Thul, Thobias Johansson, Mauro Bonecchi, Georg Piorczynski, Sebastian Michailidis, L M Weedy, Gen X, Stefan Hinze, Nicolò Zubbini,
Erik Pusch, Rob Scott, Florian Koch, Charles Razack, Adrian Baker, Oliver Villar Diz, David Revoy, Julio Iglesias Lopez, Coen Spoor, Carlos Folch,
Joseph Christie, Victor Hernández García, David Mcsween, James Finnerty, Cory Kruckenberg, Giacomo Graziosi, Olivier Saraja, Lars Brubaker, Eric Hudson,
Johannes Schwarz, David Elguea, Marcus Schulderinsky, Karel De Bruijn, Lucas van Wijngaarden, Stefano Ciarrocchi, Mehmet Eribol, Thomas Berglund, Zuofei Song,
Dylan Urquidi )
2012-05-17 12:49:33 +00:00
|
|
|
#define CMP_NODE_COLORCORRECTION 312
|
|
|
|
|
#define CMP_NODE_MASK_BOX 313
|
|
|
|
|
#define CMP_NODE_MASK_ELLIPSE 314
|
|
|
|
|
#define CMP_NODE_BOKEHIMAGE 315
|
|
|
|
|
#define CMP_NODE_BOKEHBLUR 316
|
|
|
|
|
#define CMP_NODE_SWITCH 317
|
2012-10-24 08:36:10 +00:00
|
|
|
#define CMP_NODE_PIXELATE 318
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-14 19:53:46 +00:00
|
|
|
#define CMP_NODE_MAP_RANGE 319
|
Merge plane track feature from tomato branch
This commit includes all the changes made for plane tracker
in tomato branch.
Movie clip editor changes:
- Artist might create a plane track out of multiple point
tracks which belongs to the same track (minimum amount of
point tracks is 4, maximum is not actually limited).
When new plane track is added, it's getting "tracked"
across all point tracks, which makes it stick to the same
plane point tracks belong to.
- After plane track was added, it need to be manually adjusted
in a way it covers feature one might to mask/replace.
General transform tools (G, R, S) or sliding corners with
a mouse could be sued for this. Plane corner which
corresponds to left bottom image corner has got X/Y axis
on it (red is for X axis, green for Y).
- Re-adjusting plane corners makes plane to be "re-tracked"
for the frames sequence between current frame and next
and previous keyframes.
- Kayframes might be removed from the plane, using Shit-X
(Marker Delete) operator. However, currently manual
re-adjustment or "re-track" trigger is needed.
Compositor changes:
- Added new node called Plane Track Deform.
- User selects which plane track to use (for this he need
to select movie clip datablock, object and track names).
- Node gets an image input, which need to be warped into
the plane.
- Node outputs:
* Input image warped into the plane.
* Plane, rasterized to a mask.
Masking changes:
- Mask points might be parented to a plane track, which
makes this point deforming in a way as if it belongs
to the tracked plane.
Some video tutorials are available:
- Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4
- Artist video: https://vimeo.com/71727578
This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
|
|
|
#define CMP_NODE_PLANETRACKDEFORM 320
|
2014-03-11 14:07:49 +01:00
|
|
|
#define CMP_NODE_CORNERPIN 321
|
2015-04-06 10:40:12 -03:00
|
|
|
#define CMP_NODE_SWITCH_VIEW 322
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
#define CMP_NODE_CRYPTOMATTE_LEGACY 323
|
Compositor: Added denoising node
This node is built on Intel's OpenImageDenoise library.
Other denoisers could be integrated, for example Lukas' Cycles denoiser.
Compositor: Made OpenImageDenoise optional, added CMake and build_env files to find OIDN
Compositor: Fixed some warnings in the denoising operator
build_environment: Updated OpenImageDenoise to 0.8.1
build_environment: Updated OpenImageDenoise in `make deps` for macOS
Reviewers: sergey, jbakker, brecht
Reviewed By: brecht
Subscribers: YAFU, LazyDodo, Zen_YS, slumber, samgreen, tjvoll, yeus, ponomarovmax, getrad, coder.kalyan, vitos1k, Yegor, DeepBlender, kumaran7, Darkfie9825, aliasguru, aafra, ace_dragon, juang3d, pandrodor, cdog, lordodin, jtheninja, mavek, marcog, 5k1n2, Atair, rawalanche, 0o00o0oo, filibis, poor, lukasstockner97
Tags: #compositing
Differential Revision: https://developer.blender.org/D4304
2019-08-14 15:30:26 +02:00
|
|
|
#define CMP_NODE_DENOISE 324
|
2020-12-19 14:40:31 -05:00
|
|
|
#define CMP_NODE_EXPOSURE 325
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
#define CMP_NODE_CRYPTOMATTE 326
|
2021-09-05 15:22:30 -04:00
|
|
|
#define CMP_NODE_POSTERIZE 327
|
2022-01-10 08:57:53 +01:00
|
|
|
#define CMP_NODE_CONVERT_COLOR_SPACE 328
|
2022-01-12 12:16:41 +01:00
|
|
|
#define CMP_NODE_SCENE_TIME 329
|
2022-02-01 18:17:51 -05:00
|
|
|
#define CMP_NODE_SEPARATE_XYZ 330
|
|
|
|
|
#define CMP_NODE_COMBINE_XYZ 331
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
#define CMP_NODE_COMBINE_COLOR 332
|
|
|
|
|
#define CMP_NODE_SEPARATE_COLOR 333
|
2012-11-14 19:53:46 +00:00
|
|
|
|
== Shader nodes ==
* Geometry node: Front/back output
This is used as a mask for determining whether you're looking at the front side or back side of a mesh, useful for blending materials, my practical need was giving different materials to the pages of a magazine: http://mke3.net/blender/etc/frontback-h264.mov
Give 1.0 if it's the front side, and 0.0 if it's the back side.
* Extended material node
This is the same as the material node, but gives more available inputs and outputs, (basically just connecting up more of ShadeInput and ShadeResult to the node). I didn't want to add it to the normal simple Material node since you don't always need all that stuff, and it would make the node huge, but when you do need it, it's nice to have it.
== Comp nodes ==
* Invert node
Inverting is something that happens all the time in a node setup, and this makes it easier. It's been possible to invert previously by adding a mix node and subtracting the input from 1.0, but it's not the best way of doing it. This node:
- makes it a lot faster to set up, rather than all the clicking required with the mix node
- is a lot more usable amidst a complex comp setup, when you're looking at a node tree, it's very helpful to be able to see at a glance what's going on. Using subtract for inverting is easily mixed up with other nodes in which you are actually subtracting, not inverting, and looks very similar to all the other mix nodes that usually litter a comp tree.
- has options to invert the RGB channels, the Alpha channel, or both. This saves adding lots of extra nodes (separate RGBA, subtract, set alpha) when you want to do something simple like invert an alpha channel. I'd like to add this option to other nodes too.
There's also a shader node version too.
* Also a few fixes that I committed ages ago, but seems to have been overwritten in Bob's node refactor:
- adding new compbufs to the set alpha and alphaover nodes when you have only one noodle connected to the lower input
- making the fac value on RGB curves still work when there's nothing connected to it
2007-05-31 06:55:02 +00:00
|
|
|
/* channel toggles */
|
|
|
|
|
#define CMP_CHAN_RGB 1
|
|
|
|
|
#define CMP_CHAN_A 2
|
2007-04-13 03:23:39 +00:00
|
|
|
|
2021-07-15 22:15:47 +02:00
|
|
|
/* Default SMAA configuration values. */
|
|
|
|
|
#define CMP_DEFAULT_SMAA_THRESHOLD 1.0f
|
|
|
|
|
#define CMP_DEFAULT_SMAA_CONTRAST_LIMIT 0.2f
|
|
|
|
|
#define CMP_DEFAULT_SMAA_CORNER_ROUNDING 0.25f
|
|
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Texture Nodes
|
2018-03-14 01:58:46 +11:00
|
|
|
* \{ */
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2009-03-24 17:40:58 +00:00
|
|
|
#define TEX_NODE_OUTPUT 401
|
|
|
|
|
#define TEX_NODE_CHECKER 402
|
|
|
|
|
#define TEX_NODE_TEXTURE 403
|
|
|
|
|
#define TEX_NODE_BRICKS 404
|
|
|
|
|
#define TEX_NODE_MATH 405
|
|
|
|
|
#define TEX_NODE_MIX_RGB 406
|
|
|
|
|
#define TEX_NODE_RGBTOBW 407
|
|
|
|
|
#define TEX_NODE_VALTORGB 408
|
|
|
|
|
#define TEX_NODE_IMAGE 409
|
|
|
|
|
#define TEX_NODE_CURVE_RGB 410
|
|
|
|
|
#define TEX_NODE_INVERT 411
|
|
|
|
|
#define TEX_NODE_HUE_SAT 412
|
|
|
|
|
#define TEX_NODE_CURVE_TIME 413
|
|
|
|
|
#define TEX_NODE_ROTATE 414
|
|
|
|
|
#define TEX_NODE_VIEWER 415
|
|
|
|
|
#define TEX_NODE_TRANSLATE 416
|
|
|
|
|
#define TEX_NODE_COORD 417
|
|
|
|
|
#define TEX_NODE_DISTANCE 418
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
#define TEX_NODE_COMPOSE_LEGACY 419
|
|
|
|
|
#define TEX_NODE_DECOMPOSE_LEGACY 420
|
2009-03-24 17:40:58 +00:00
|
|
|
#define TEX_NODE_VALTONOR 421
|
|
|
|
|
#define TEX_NODE_SCALE 422
|
2009-06-13 14:22:40 +00:00
|
|
|
#define TEX_NODE_AT 423
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
#define TEX_NODE_COMBINE_COLOR 424
|
|
|
|
|
#define TEX_NODE_SEPARATE_COLOR 425
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2009-06-13 14:22:40 +00:00
|
|
|
/* 501-599 reserved. Use like this: TEX_NODE_PROC + TEX_CLOUDS, etc */
|
2009-03-24 17:40:58 +00:00
|
|
|
#define TEX_NODE_PROC 500
|
|
|
|
|
#define TEX_NODE_PROC_MAX 600
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/** \} */
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Geometry Nodes
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
#define GEO_NODE_TRIANGULATE 1000
|
2022-11-26 18:05:41 -06:00
|
|
|
#define GEO_NODE_TRANSFORM_GEOMETRY 1002
|
2021-10-14 12:06:42 -05:00
|
|
|
#define GEO_NODE_MESH_BOOLEAN 1003
|
2020-12-02 13:25:25 +01:00
|
|
|
#define GEO_NODE_OBJECT_INFO 1007
|
|
|
|
|
#define GEO_NODE_JOIN_GEOMETRY 1010
|
2021-02-03 17:47:46 +01:00
|
|
|
#define GEO_NODE_COLLECTION_INFO 1023
|
2021-02-04 16:36:34 +01:00
|
|
|
#define GEO_NODE_IS_VIEWPORT 1024
|
2021-10-14 12:06:42 -05:00
|
|
|
#define GEO_NODE_SUBDIVIDE_MESH 1029
|
2021-03-16 17:35:12 -04:00
|
|
|
#define GEO_NODE_MESH_PRIMITIVE_CUBE 1032
|
|
|
|
|
#define GEO_NODE_MESH_PRIMITIVE_CIRCLE 1033
|
|
|
|
|
#define GEO_NODE_MESH_PRIMITIVE_UV_SPHERE 1034
|
|
|
|
|
#define GEO_NODE_MESH_PRIMITIVE_CYLINDER 1035
|
|
|
|
|
#define GEO_NODE_MESH_PRIMITIVE_ICO_SPHERE 1036
|
|
|
|
|
#define GEO_NODE_MESH_PRIMITIVE_CONE 1037
|
|
|
|
|
#define GEO_NODE_MESH_PRIMITIVE_LINE 1038
|
2021-03-26 13:09:35 -04:00
|
|
|
#define GEO_NODE_MESH_PRIMITIVE_GRID 1039
|
2021-04-06 16:02:55 -05:00
|
|
|
#define GEO_NODE_BOUNDING_BOX 1042
|
2021-04-19 10:38:50 +02:00
|
|
|
#define GEO_NODE_SWITCH 1043
|
Geometry Nodes: Initial basic curve data support
This patch adds initial curve support to geometry nodes. Currently
there is only one node available, the "Curve to Mesh" node, T87428.
However, the aim of the changes here is larger than just supporting
curve data in nodes-- it also uses the opportunity to add better spline
data structures, intended to replace the existing curve evaluation code.
The curve code in Blender is quite old, and it's generally regarded as
some of the messiest, hardest-to-understand code as well. The classes
in `BKE_spline.hh` aim to be faster, more extensible, and much more
easily understandable. Further explanation can be found in comments in
that file.
Initial builtin spline attributes are supported-- reading and writing
from the `cyclic` and `resolution` attributes works with any of the
attribute nodes. Also, only Z-up normal calculation is implemented
at the moment, and tilts do not apply yet.
**Limitations**
- For now, you must bring curves into the node tree with an "Object
Info" node. Changes to the curve modifier stack will come later.
- Converting to a mesh is necessary to visualize the curve data.
Further progress can be tracked in: T87245
Higher level design document: https://wiki.blender.org/wiki/Modules/Physics_Nodes/Projects/EverythingNodes/CurveNodes
Differential Revision: https://developer.blender.org/D11091
2021-05-03 12:29:17 -05:00
|
|
|
#define GEO_NODE_CURVE_TO_MESH 1045
|
2021-10-14 12:06:42 -05:00
|
|
|
#define GEO_NODE_RESAMPLE_CURVE 1047
|
2021-05-20 12:29:06 +02:00
|
|
|
#define GEO_NODE_INPUT_MATERIAL 1050
|
2021-10-14 12:06:42 -05:00
|
|
|
#define GEO_NODE_REPLACE_MATERIAL 1051
|
2021-06-03 19:12:38 -04:00
|
|
|
#define GEO_NODE_CURVE_LENGTH 1054
|
2021-06-09 11:58:08 -05:00
|
|
|
#define GEO_NODE_CONVEX_HULL 1056
|
2021-06-15 22:31:57 -05:00
|
|
|
#define GEO_NODE_SEPARATE_COMPONENTS 1059
|
2021-06-29 22:00:29 -05:00
|
|
|
#define GEO_NODE_CURVE_PRIMITIVE_STAR 1062
|
2021-06-29 22:20:54 -05:00
|
|
|
#define GEO_NODE_CURVE_PRIMITIVE_SPIRAL 1063
|
2021-06-29 22:39:08 -05:00
|
|
|
#define GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER 1064
|
2021-06-30 00:03:55 -05:00
|
|
|
#define GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT 1065
|
2021-06-30 19:17:28 -05:00
|
|
|
#define GEO_NODE_CURVE_PRIMITIVE_CIRCLE 1066
|
2021-07-05 10:46:00 +02:00
|
|
|
#define GEO_NODE_VIEWER 1067
|
2021-07-05 12:27:12 -05:00
|
|
|
#define GEO_NODE_CURVE_PRIMITIVE_LINE 1068
|
2021-07-12 13:10:56 -04:00
|
|
|
#define GEO_NODE_CURVE_PRIMITIVE_QUADRILATERAL 1070
|
2021-10-14 12:06:42 -05:00
|
|
|
#define GEO_NODE_TRIM_CURVE 1071
|
|
|
|
|
#define GEO_NODE_FILL_CURVE 1075
|
2021-09-09 12:54:20 +02:00
|
|
|
#define GEO_NODE_INPUT_POSITION 1076
|
|
|
|
|
#define GEO_NODE_SET_POSITION 1077
|
|
|
|
|
#define GEO_NODE_INPUT_INDEX 1078
|
|
|
|
|
#define GEO_NODE_INPUT_NORMAL 1079
|
2021-10-14 12:06:42 -05:00
|
|
|
#define GEO_NODE_CAPTURE_ATTRIBUTE 1080
|
2021-09-15 10:51:52 -05:00
|
|
|
#define GEO_NODE_MATERIAL_SELECTION 1081
|
2021-10-13 08:39:54 -05:00
|
|
|
#define GEO_NODE_SET_MATERIAL 1082
|
2021-09-20 12:37:52 +02:00
|
|
|
#define GEO_NODE_REALIZE_INSTANCES 1083
|
2021-09-20 18:39:39 -05:00
|
|
|
#define GEO_NODE_ATTRIBUTE_STATISTIC 1084
|
2021-10-14 12:06:42 -05:00
|
|
|
#define GEO_NODE_SAMPLE_CURVE 1085
|
2021-09-21 13:11:39 -05:00
|
|
|
#define GEO_NODE_INPUT_TANGENT 1086
|
2021-09-21 14:11:32 -05:00
|
|
|
#define GEO_NODE_STRING_JOIN 1087
|
2021-11-30 07:21:14 -06:00
|
|
|
#define GEO_NODE_CURVE_SPLINE_PARAMETER 1088
|
2021-10-14 12:06:42 -05:00
|
|
|
#define GEO_NODE_FILLET_CURVE 1089
|
2021-09-24 11:50:02 +02:00
|
|
|
#define GEO_NODE_DISTRIBUTE_POINTS_ON_FACES 1090
|
2021-09-24 12:41:49 -05:00
|
|
|
#define GEO_NODE_STRING_TO_CURVES 1091
|
2021-09-27 10:16:38 +02:00
|
|
|
#define GEO_NODE_INSTANCE_ON_POINTS 1092
|
Geometry Nodes: Mesh Point Cloud Conversion Nodes
This commit adds nodes to do direct conversion between meshes and point
clouds in geometry nodes. The conversion from mesh to points is helpful
to instance once per face, or once per edge, which was previously only
possibly with ugly work-arounds. Fields can be evaluated on the mesh
to pass them to the points with the attribute capture node.
The other conversion, point cloud to mesh vertices, is a bit less
obvious, though it is still a common request from users. It's helpful
for flexibility when passing data around, better visualization in the
viewport (and in the future, cycles), and the simplicity of points.
This is a step towards T91754, where point clouds are currently
combined with meshes when outputing to the next modifier after geometry
nodes. Since we're removing the implicit behavior for realizing
instances, it feels natural to use an explicit node to convert points
to vertices too.
Differential Revision: https://developer.blender.org/D12657
2021-09-28 12:14:13 -05:00
|
|
|
#define GEO_NODE_MESH_TO_POINTS 1093
|
|
|
|
|
#define GEO_NODE_POINTS_TO_VERTICES 1094
|
2021-10-14 12:06:42 -05:00
|
|
|
#define GEO_NODE_REVERSE_CURVE 1095
|
2021-09-28 15:21:36 -05:00
|
|
|
#define GEO_NODE_PROXIMITY 1096
|
2021-10-14 12:06:42 -05:00
|
|
|
#define GEO_NODE_SUBDIVIDE_CURVE 1097
|
2021-10-01 09:58:49 -05:00
|
|
|
#define GEO_NODE_INPUT_SPLINE_LENGTH 1098
|
2021-10-01 11:59:29 -05:00
|
|
|
#define GEO_NODE_CURVE_SPLINE_TYPE 1099
|
2022-03-02 17:58:17 -05:00
|
|
|
#define GEO_NODE_CURVE_SET_HANDLE_TYPE 1100
|
2021-10-03 07:54:05 -05:00
|
|
|
#define GEO_NODE_POINTS_TO_VOLUME 1101
|
2021-10-03 15:00:28 -05:00
|
|
|
#define GEO_NODE_CURVE_HANDLE_TYPE_SELECTION 1102
|
2021-10-11 08:38:02 -05:00
|
|
|
#define GEO_NODE_DELETE_GEOMETRY 1103
|
|
|
|
|
#define GEO_NODE_SEPARATE_GEOMETRY 1104
|
2021-10-11 11:03:57 -05:00
|
|
|
#define GEO_NODE_INPUT_RADIUS 1105
|
|
|
|
|
#define GEO_NODE_INPUT_CURVE_TILT 1106
|
|
|
|
|
#define GEO_NODE_INPUT_CURVE_HANDLES 1107
|
2023-09-06 17:12:27 +02:00
|
|
|
#define GEO_NODE_INPUT_FACE_SMOOTH 1108
|
2021-10-11 11:03:57 -05:00
|
|
|
#define GEO_NODE_INPUT_SPLINE_RESOLUTION 1109
|
|
|
|
|
#define GEO_NODE_INPUT_SPLINE_CYCLIC 1110
|
|
|
|
|
#define GEO_NODE_SET_CURVE_RADIUS 1111
|
|
|
|
|
#define GEO_NODE_SET_CURVE_TILT 1112
|
|
|
|
|
#define GEO_NODE_SET_CURVE_HANDLES 1113
|
|
|
|
|
#define GEO_NODE_SET_SHADE_SMOOTH 1114
|
|
|
|
|
#define GEO_NODE_SET_SPLINE_RESOLUTION 1115
|
|
|
|
|
#define GEO_NODE_SET_SPLINE_CYCLIC 1116
|
|
|
|
|
#define GEO_NODE_SET_POINT_RADIUS 1117
|
2021-10-13 08:39:54 -05:00
|
|
|
#define GEO_NODE_INPUT_MATERIAL_INDEX 1118
|
|
|
|
|
#define GEO_NODE_SET_MATERIAL_INDEX 1119
|
2021-10-13 09:02:05 -05:00
|
|
|
#define GEO_NODE_TRANSLATE_INSTANCES 1120
|
2021-10-13 09:08:02 -05:00
|
|
|
#define GEO_NODE_SCALE_INSTANCES 1121
|
2021-10-13 09:42:10 -05:00
|
|
|
#define GEO_NODE_ROTATE_INSTANCES 1122
|
2021-10-14 12:06:42 -05:00
|
|
|
#define GEO_NODE_SPLIT_EDGES 1123
|
2021-10-14 12:06:48 -05:00
|
|
|
#define GEO_NODE_MESH_TO_CURVE 1124
|
2022-09-23 13:56:35 -05:00
|
|
|
#define GEO_NODE_TRANSFER_ATTRIBUTE_DEPRECATED 1125
|
2021-10-15 15:12:04 -05:00
|
|
|
#define GEO_NODE_SUBDIVISION_SURFACE 1126
|
2021-10-18 06:45:16 -05:00
|
|
|
#define GEO_NODE_CURVE_ENDPOINT_SELECTION 1127
|
2021-10-19 09:01:39 -05:00
|
|
|
#define GEO_NODE_RAYCAST 1128
|
2021-10-20 10:25:49 -05:00
|
|
|
#define GEO_NODE_CURVE_TO_POINTS 1130
|
2021-10-23 00:01:59 -05:00
|
|
|
#define GEO_NODE_INSTANCES_TO_POINTS 1131
|
2021-10-25 13:02:43 +02:00
|
|
|
#define GEO_NODE_IMAGE_TEXTURE 1132
|
2021-10-26 11:25:44 -05:00
|
|
|
#define GEO_NODE_VOLUME_TO_MESH 1133
|
2021-10-26 15:40:57 -05:00
|
|
|
#define GEO_NODE_INPUT_ID 1134
|
|
|
|
|
#define GEO_NODE_SET_ID 1135
|
2021-11-29 13:04:25 -06:00
|
|
|
#define GEO_NODE_ATTRIBUTE_DOMAIN_SIZE 1136
|
2021-12-01 11:11:50 -05:00
|
|
|
#define GEO_NODE_DUAL_MESH 1137
|
2021-12-06 11:58:08 -06:00
|
|
|
#define GEO_NODE_INPUT_MESH_EDGE_VERTICES 1138
|
|
|
|
|
#define GEO_NODE_INPUT_MESH_FACE_AREA 1139
|
|
|
|
|
#define GEO_NODE_INPUT_MESH_FACE_NEIGHBORS 1140
|
|
|
|
|
#define GEO_NODE_INPUT_MESH_VERTEX_NEIGHBORS 1141
|
2021-12-07 15:37:12 +01:00
|
|
|
#define GEO_NODE_GEOMETRY_TO_INSTANCE 1142
|
2021-12-07 10:07:24 -06:00
|
|
|
#define GEO_NODE_INPUT_MESH_EDGE_NEIGHBORS 1143
|
2021-12-08 10:14:03 -06:00
|
|
|
#define GEO_NODE_INPUT_MESH_ISLAND 1144
|
2021-12-09 11:50:25 -06:00
|
|
|
#define GEO_NODE_INPUT_SCENE_TIME 1145
|
2021-12-29 10:24:29 -06:00
|
|
|
#define GEO_NODE_ACCUMULATE_FIELD 1146
|
2022-01-03 11:16:50 -06:00
|
|
|
#define GEO_NODE_INPUT_MESH_EDGE_ANGLE 1147
|
2023-01-13 11:49:40 -06:00
|
|
|
#define GEO_NODE_EVALUATE_AT_INDEX 1148
|
2022-01-20 18:06:25 +00:00
|
|
|
#define GEO_NODE_CURVE_PRIMITIVE_ARC 1149
|
2022-01-21 09:26:40 -06:00
|
|
|
#define GEO_NODE_FLIP_FACES 1150
|
2022-01-21 17:34:47 +01:00
|
|
|
#define GEO_NODE_SCALE_ELEMENTS 1151
|
Geometry Nodes: Extrude Mesh Node
This patch introduces an extrude node with three modes. The vertex mode
is quite simple, and just attaches new edges to the selected vertices.
The edge mode attaches new faces to the selected edges. The faces mode
extrudes patches of selected faces, or each selected face individually,
depending on the "Individual" boolean input.
The default value of the "Offset" input is the mesh's normals, which
can be scaled with the "Offset Scale" input.
**Attribute Propagation**
Attributes are transferred to the new elements with specific rules.
Attributes will never change domains for interpolations. Generally
boolean attributes are propagated with "or", meaning any connected
"true" value that is mixed in for other types will cause the new value
to be "true" as well. The `"id"` attribute does not have any special
handling currently.
Vertex Mode
- Vertex: Copied values of selected vertices.
- Edge: Averaged values of selected edges. For booleans, edges are
selected if any connected edges are selected.
Edge Mode
- Vertex: Copied values of extruded vertices.
- Connecting edges (vertical): Average values of connected extruded
edges. For booleans, the edges are selected if any connected
extruded edges are selected.
- Duplicate edges: Copied values of selected edges.
- Face: Averaged values of all faces connected to the selected edge.
For booleans, faces are selected if any connected original faces
are selected.
- Corner: Averaged values of corresponding corners in all faces
connected to selected edges. For booleans, corners are selected
if one of those corners are selected.
Face Mode
- Vertex: Copied values of extruded vertices.
- Connecting edges (vertical): Average values of connected selected
edges, not including the edges "on top" of extruded regions.
For booleans, edges are selected when any connected extruded edges
were selected.
- Duplicate edges: Copied values of extruded edges.
- Face: Copied values of the corresponding selected faces.
- Corner: Copied values of corresponding corners in selected faces.
Individual Face Mode
- Vertex: Copied values of extruded vertices.
- Connecting edges (vertical): Average values of the two neighboring
edges on each extruded face. For booleans, edges are selected
when at least one neighbor on the extruded face was selected.
- Duplicate edges: Copied values of extruded edges.
- Face: Copied values of the corresponding selected faces.
- Corner: Copied values of corresponding corners in selected faces.
**Differences from edit mode**
In face mode (non-individual), the behavior can be different than the
extrude tools in edit mode-- this node doesn't handle keeping the back-
faces around in the cases that the edit mode tools do. The planned
"Solidify" node will handle that use case instead. Keeping this node
simpler and faster is preferable at this point, especially because that
sort of "smart" behavior is not that predictable and makes less sense
in a procedural context.
In the future, an "Even Offset" option could be added to this node
hopefully fairly simply. For now it is left out in order to keep
the patch simpler.
**Implementation**
For the implementation, the `Mesh` data structure is used directly
rather than converting to `BMesh` and back like D12224. This optimizes
for large extrusion operations rather than many sequential extrusions.
While this is potentially more verbose, it has some important benefits:
First, there is no conversion to and from `BMesh`. The code only has
to fill arrays and it can do that all at once, making each component of
the algorithm much easier to optimize. It also makes the attribute
interpolation more explicit, and likely faster. Only limited topology
maps must be created in most cases.
While there are some necessary loops and allocations with the size of
the entire mesh, I tried to keep everything I could on the order of the
size of the selection rather than the size of the mesh. In that respect,
the individual faces mode is the best, since there is no topology
information necessary, and the amount of work just depends on the size
of the selection.
Modifying an existing mesh instead of generating a new one was a bit
of a toss-up, but has a few potential benefits:
- Avoids manually copying over attribute data for original elements.
- Avoids some overhead of creating a new mesh.
- Can potentially take advantage of future ammortized mesh growth.
This could be changed easily if it turns out to be the wrong choice.
Differential Revision: https://developer.blender.org/D13709
2022-01-23 22:42:49 -06:00
|
|
|
#define GEO_NODE_EXTRUDE_MESH 1152
|
2022-01-25 10:51:52 -06:00
|
|
|
#define GEO_NODE_MERGE_BY_DISTANCE 1153
|
2022-02-23 13:04:12 -06:00
|
|
|
#define GEO_NODE_DUPLICATE_ELEMENTS 1154
|
2022-02-23 14:19:08 -06:00
|
|
|
#define GEO_NODE_INPUT_MESH_FACE_IS_PLANAR 1155
|
2022-03-14 11:48:11 -05:00
|
|
|
#define GEO_NODE_STORE_NAMED_ATTRIBUTE 1156
|
|
|
|
|
#define GEO_NODE_INPUT_NAMED_ATTRIBUTE 1157
|
|
|
|
|
#define GEO_NODE_REMOVE_ATTRIBUTE 1158
|
2022-06-06 11:50:13 -05:00
|
|
|
#define GEO_NODE_INPUT_INSTANCE_ROTATION 1159
|
2022-06-06 12:02:59 -05:00
|
|
|
#define GEO_NODE_INPUT_INSTANCE_SCALE 1160
|
2022-06-17 13:26:22 +02:00
|
|
|
#define GEO_NODE_VOLUME_CUBE 1161
|
2022-06-25 08:47:31 -05:00
|
|
|
#define GEO_NODE_POINTS 1162
|
2023-01-13 11:49:40 -06:00
|
|
|
#define GEO_NODE_EVALUATE_ON_DOMAIN 1163
|
2022-06-29 10:56:17 -05:00
|
|
|
#define GEO_NODE_MESH_TO_VOLUME 1164
|
2022-06-29 12:25:20 -05:00
|
|
|
#define GEO_NODE_UV_UNWRAP 1165
|
|
|
|
|
#define GEO_NODE_UV_PACK_ISLANDS 1166
|
2022-07-08 14:45:48 +02:00
|
|
|
#define GEO_NODE_DEFORM_CURVES_ON_SURFACE 1167
|
2022-07-27 15:38:30 +02:00
|
|
|
#define GEO_NODE_INPUT_SHORTEST_EDGE_PATHS 1168
|
|
|
|
|
#define GEO_NODE_EDGE_PATHS_TO_CURVES 1169
|
|
|
|
|
#define GEO_NODE_EDGE_PATHS_TO_SELECTION 1170
|
2023-01-19 16:55:37 -06:00
|
|
|
#define GEO_NODE_MESH_FACE_GROUP_BOUNDARIES 1171
|
2022-09-19 10:13:55 -05:00
|
|
|
#define GEO_NODE_DISTRIBUTE_POINTS_IN_VOLUME 1172
|
2022-09-22 08:15:03 -05:00
|
|
|
#define GEO_NODE_SELF_OBJECT 1173
|
2022-09-23 13:56:35 -05:00
|
|
|
#define GEO_NODE_SAMPLE_INDEX 1174
|
|
|
|
|
#define GEO_NODE_SAMPLE_NEAREST 1175
|
|
|
|
|
#define GEO_NODE_SAMPLE_NEAREST_SURFACE 1176
|
2022-10-03 16:41:58 -05:00
|
|
|
#define GEO_NODE_OFFSET_POINT_IN_CURVE 1177
|
2022-09-28 14:38:27 -05:00
|
|
|
#define GEO_NODE_CURVE_TOPOLOGY_CURVE_OF_POINT 1178
|
|
|
|
|
#define GEO_NODE_CURVE_TOPOLOGY_POINTS_OF_CURVE 1179
|
|
|
|
|
#define GEO_NODE_MESH_TOPOLOGY_OFFSET_CORNER_IN_FACE 1180
|
|
|
|
|
#define GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_FACE 1181
|
|
|
|
|
#define GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_VERTEX 1182
|
|
|
|
|
#define GEO_NODE_MESH_TOPOLOGY_EDGES_OF_CORNER 1183
|
|
|
|
|
#define GEO_NODE_MESH_TOPOLOGY_EDGES_OF_VERTEX 1184
|
|
|
|
|
#define GEO_NODE_MESH_TOPOLOGY_FACE_OF_CORNER 1185
|
|
|
|
|
#define GEO_NODE_MESH_TOPOLOGY_VERTEX_OF_CORNER 1186
|
2022-10-03 16:06:29 +02:00
|
|
|
#define GEO_NODE_SAMPLE_UV_SURFACE 1187
|
2022-10-03 15:50:21 -05:00
|
|
|
#define GEO_NODE_SET_CURVE_NORMAL 1188
|
2022-11-14 18:55:51 -06:00
|
|
|
#define GEO_NODE_IMAGE_INFO 1189
|
2022-12-07 18:22:44 +01:00
|
|
|
#define GEO_NODE_BLUR_ATTRIBUTE 1190
|
2022-12-09 15:50:00 -06:00
|
|
|
#define GEO_NODE_IMAGE 1191
|
2023-01-20 12:16:49 +01:00
|
|
|
#define GEO_NODE_INTERPOLATE_CURVES 1192
|
2023-02-09 16:27:20 +01:00
|
|
|
#define GEO_NODE_EDGES_TO_FACE_GROUPS 1193
|
2023-11-29 16:02:06 +01:00
|
|
|
// #define GEO_NODE_POINTS_TO_SDF_VOLUME 1194
|
|
|
|
|
// #define GEO_NODE_MESH_TO_SDF_VOLUME 1195
|
|
|
|
|
// #define GEO_NODE_SDF_VOLUME_SPHERE 1196
|
|
|
|
|
// #define GEO_NODE_MEAN_FILTER_SDF_VOLUME 1197
|
|
|
|
|
// #define GEO_NODE_OFFSET_SDF_VOLUME 1198
|
2023-04-22 13:11:51 +02:00
|
|
|
#define GEO_NODE_INDEX_OF_NEAREST 1199
|
Geometry Nodes: add simulation support
This adds support for building simulations with geometry nodes. A new
`Simulation Input` and `Simulation Output` node allow maintaining a
simulation state across multiple frames. Together these two nodes form
a `simulation zone` which contains all the nodes that update the simulation
state from one frame to the next.
A new simulation zone can be added via the menu
(`Simulation > Simulation Zone`) or with the node add search.
The simulation state contains a geometry by default. However, it is possible
to add multiple geometry sockets as well as other socket types. Currently,
field inputs are evaluated and stored for the preceding geometry socket in
the order that the sockets are shown. Simulation state items can be added
by linking one of the empty sockets to something else. In the sidebar, there
is a new panel that allows adding, removing and reordering these sockets.
The simulation nodes behave as follows:
* On the first frame, the inputs of the `Simulation Input` node are evaluated
to initialize the simulation state. In later frames these sockets are not
evaluated anymore. The `Delta Time` at the first frame is zero, but the
simulation zone is still evaluated.
* On every next frame, the `Simulation Input` node outputs the simulation
state of the previous frame. Nodes in the simulation zone can edit that
data in arbitrary ways, also taking into account the `Delta Time`. The new
simulation state has to be passed to the `Simulation Output` node where it
is cached and forwarded.
* On a frame that is already cached or baked, the nodes in the simulation
zone are not evaluated, because the `Simulation Output` node can return
the previously cached data directly.
It is not allowed to connect sockets from inside the simulation zone to the
outside without going through the `Simulation Output` node. This is a necessary
restriction to make caching and sub-frame interpolation work. Links can go into
the simulation zone without problems though.
Anonymous attributes are not propagated by the simulation nodes unless they
are explicitly stored in the simulation state. This is unfortunate, but
currently there is no practical and reliable alternative. The core problem
is detecting which anonymous attributes will be required for the simulation
and afterwards. While we can detect this for the current evaluation, we can't
look into the future in time to see what data will be necessary. We intend to
make it easier to explicitly pass data through a simulation in the future,
even if the simulation is in a nested node group.
There is a new `Simulation Nodes` panel in the physics tab in the properties
editor. It allows baking all simulation zones on the selected objects. The
baking options are intentially kept at a minimum for this MVP. More features
for simulation baking as well as baking in general can be expected to be added
separately.
All baked data is stored on disk in a folder next to the .blend file. #106937
describes how baking is implemented in more detail. Volumes can not be baked
yet and materials are lost during baking for now. Packing the baked data into
the .blend file is not yet supported.
The timeline indicates which frames are currently cached, baked or cached but
invalidated by user-changes.
Simulation input and output nodes are internally linked together by their
`bNode.identifier` which stays the same even if the node name changes. They
are generally added and removed together. However, there are still cases where
"dangling" simulation nodes can be created currently. Those generally don't
cause harm, but would be nice to avoid this in more cases in the future.
Co-authored-by: Hans Goudey <h.goudey@me.com>
Co-authored-by: Lukas Tönne <lukas@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/104924
2023-05-03 13:18:51 +02:00
|
|
|
/* Function nodes use the range starting at 1200. */
|
|
|
|
|
#define GEO_NODE_SIMULATION_INPUT 2100
|
|
|
|
|
#define GEO_NODE_SIMULATION_OUTPUT 2101
|
2023-11-29 16:02:06 +01:00
|
|
|
// #define GEO_NODE_INPUT_SIGNED_DISTANCE 2102
|
|
|
|
|
// #define GEO_NODE_SAMPLE_VOLUME 2103
|
2023-05-31 15:25:48 +02:00
|
|
|
#define GEO_NODE_MESH_TOPOLOGY_CORNERS_OF_EDGE 2104
|
2023-07-11 22:36:10 +02:00
|
|
|
/* Leaving out two indices to avoid crashes with files that were created during the development of
|
|
|
|
|
* the repeat zone. */
|
|
|
|
|
#define GEO_NODE_REPEAT_INPUT 2107
|
|
|
|
|
#define GEO_NODE_REPEAT_OUTPUT 2108
|
2023-08-04 20:59:04 +02:00
|
|
|
#define GEO_NODE_TOOL_SELECTION 2109
|
|
|
|
|
#define GEO_NODE_TOOL_SET_SELECTION 2110
|
|
|
|
|
#define GEO_NODE_TOOL_3D_CURSOR 2111
|
|
|
|
|
#define GEO_NODE_TOOL_FACE_SET 2112
|
|
|
|
|
#define GEO_NODE_TOOL_SET_FACE_SET 2113
|
2023-08-29 16:52:20 +02:00
|
|
|
#define GEO_NODE_POINTS_TO_CURVES 2114
|
2023-09-06 17:12:27 +02:00
|
|
|
#define GEO_NODE_INPUT_EDGE_SMOOTH 2115
|
2023-10-18 10:26:23 +02:00
|
|
|
#define GEO_NODE_SPLIT_TO_INSTANCES 2116
|
2023-10-20 11:04:15 +02:00
|
|
|
#define GEO_NODE_INPUT_NAMED_LAYER_SELECTION 2117
|
2023-11-22 16:11:32 +01:00
|
|
|
#define GEO_NODE_INDEX_SWITCH 2118
|
2023-12-12 19:11:06 +01:00
|
|
|
#define GEO_NODE_INPUT_ACTIVE_CAMERA 2119
|
2023-12-18 13:01:06 +01:00
|
|
|
#define GEO_NODE_BAKE 2120
|
2023-12-20 22:33:17 +01:00
|
|
|
#define GEO_NODE_GET_NAMED_GRID 2121
|
|
|
|
|
#define GEO_NODE_STORE_NAMED_GRID 2122
|
2024-01-12 14:30:34 +01:00
|
|
|
#define GEO_NODE_SORT_ELEMENTS 2123
|
2024-01-26 12:40:01 +01:00
|
|
|
#define GEO_NODE_MENU_SWITCH 2124
|
2022-02-23 09:08:16 -06:00
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
/** \} */
|
|
|
|
|
|
2020-04-20 15:27:12 +02:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Function Nodes
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
#define FN_NODE_BOOLEAN_MATH 1200
|
Geometry Nodes: Generalized Compare Node
Replace compare floats node with a generalized compare node. The node
allows for the comparison of float, int, string, color, and vector.
The datatypes support the following operators:
Float, Int: <, >, <=, >=, ==, !=
String: ==, !=
Color: ==, !=, lighter, darker
(using rgb_to_grayscale value as the brightness value)
Vector Supports 5 comparison modes for: ==, !=, <, >, <=, >=
Average: The average of the components of the vectors are compared.
Dot Product: The dot product of the vectors are compared.
Direction: The angle between the vectors is compared to an angle
Element-wise: The individual components of the vectors are compared.
Length: The lengths of the vectors are compared.
Differential Revision: https://developer.blender.org/D13228
2021-12-01 09:36:25 -06:00
|
|
|
#define FN_NODE_COMPARE 1202
|
2021-09-24 14:03:42 -05:00
|
|
|
#define FN_NODE_LEGACY_RANDOM_FLOAT 1206
|
2020-12-17 18:37:04 +01:00
|
|
|
#define FN_NODE_INPUT_VECTOR 1207
|
2021-02-19 16:03:14 -06:00
|
|
|
#define FN_NODE_INPUT_STRING 1208
|
2021-07-05 11:52:10 -05:00
|
|
|
#define FN_NODE_FLOAT_TO_INT 1209
|
2021-09-21 14:11:32 -05:00
|
|
|
#define FN_NODE_VALUE_TO_STRING 1210
|
|
|
|
|
#define FN_NODE_STRING_LENGTH 1211
|
2021-10-24 11:19:10 +02:00
|
|
|
#define FN_NODE_SLICE_STRING 1212
|
2021-09-24 10:59:52 -05:00
|
|
|
#define FN_NODE_INPUT_SPECIAL_CHARACTERS 1213
|
2021-09-24 14:03:42 -05:00
|
|
|
#define FN_NODE_RANDOM_VALUE 1214
|
2021-10-02 20:04:45 -05:00
|
|
|
#define FN_NODE_ROTATE_EULER 1215
|
2021-10-09 14:40:37 -05:00
|
|
|
#define FN_NODE_ALIGN_EULER_TO_VECTOR 1216
|
2021-10-11 23:02:17 +01:00
|
|
|
#define FN_NODE_INPUT_COLOR 1217
|
2021-10-19 15:27:47 -05:00
|
|
|
#define FN_NODE_REPLACE_STRING 1218
|
2021-10-22 14:59:15 +02:00
|
|
|
#define FN_NODE_INPUT_BOOL 1219
|
|
|
|
|
#define FN_NODE_INPUT_INT 1220
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
#define FN_NODE_SEPARATE_COLOR 1221
|
|
|
|
|
#define FN_NODE_COMBINE_COLOR 1222
|
2023-08-24 14:58:55 +02:00
|
|
|
#define FN_NODE_AXIS_ANGLE_TO_ROTATION 1223
|
|
|
|
|
#define FN_NODE_EULER_TO_ROTATION 1224
|
|
|
|
|
#define FN_NODE_QUATERNION_TO_ROTATION 1225
|
|
|
|
|
#define FN_NODE_ROTATION_TO_AXIS_ANGLE 1226
|
|
|
|
|
#define FN_NODE_ROTATION_TO_EULER 1227
|
|
|
|
|
#define FN_NODE_ROTATION_TO_QUATERNION 1228
|
|
|
|
|
#define FN_NODE_ROTATE_VECTOR 1229
|
|
|
|
|
#define FN_NODE_ROTATE_ROTATION 1230
|
|
|
|
|
#define FN_NODE_INVERT_ROTATION 1231
|
2020-04-20 15:27:12 +02:00
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
2020-11-06 16:43:09 +11:00
|
|
|
void BKE_node_system_init(void);
|
|
|
|
|
void BKE_node_system_exit(void);
|
2007-03-26 15:07:38 +00:00
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|