2022-02-10 23:07:11 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
* Copyright 2005 Blender Foundation. All rights reserved. */
|
2005-12-18 14:46:01 +01:00
|
|
|
|
2012-02-17 19:59:41 +01:00
|
|
|
#pragma once
|
2005-12-18 14:46:01 +01:00
|
|
|
|
2019-02-17 22:08:12 +01:00
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
2011-02-18 14:05:18 +01:00
|
|
|
*/
|
|
|
|
|
2018-11-07 02:17:58 +01:00
|
|
|
#include "BLI_compiler_compat.h"
|
2013-08-25 23:29:33 +02:00
|
|
|
#include "BLI_ghash.h"
|
2013-03-18 17:34:57 +01:00
|
|
|
|
2011-09-05 23:01:50 +02:00
|
|
|
#include "DNA_listBase.h"
|
|
|
|
|
2018-11-30 05:22:01 +01:00
|
|
|
/* for FOREACH_NODETREE_BEGIN */
|
2013-03-18 17:34:57 +01:00
|
|
|
#include "DNA_node_types.h"
|
|
|
|
|
|
|
|
#include "RNA_types.h"
|
|
|
|
|
2021-12-15 16:51:57 +01:00
|
|
|
#ifdef __cplusplus
|
2021-12-22 15:47:46 +01:00
|
|
|
# include "BLI_map.hh"
|
2021-12-15 16:51:57 +01:00
|
|
|
# include "BLI_string_ref.hh"
|
|
|
|
#endif
|
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2008-05-02 00:28:18 +02: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 19:41:54 +01:00
|
|
|
|
2019-01-28 11:08:24 +01:00
|
|
|
struct ARegion;
|
2020-09-30 03:51:13 +02:00
|
|
|
struct BlendDataReader;
|
|
|
|
struct BlendExpander;
|
|
|
|
struct BlendLibReader;
|
|
|
|
struct BlendWriter;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct ColorManagedDisplaySettings;
|
|
|
|
struct ColorManagedViewSettings;
|
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
|
|
|
struct CryptomatteSession;
|
2019-09-07 15:17:40 +02: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 22:51:28 +02:00
|
|
|
struct GPUMaterial;
|
|
|
|
struct GPUNodeStack;
|
2010-08-04 06:01:27 +02:00
|
|
|
struct ID;
|
2013-03-05 04:44:47 +01:00
|
|
|
struct ImBuf;
|
2012-02-22 13:59:43 +01:00
|
|
|
struct ImageFormatData;
|
2019-09-07 15:17:40 +02:00
|
|
|
struct Light;
|
2010-08-04 06:01:27 +02:00
|
|
|
struct ListBase;
|
|
|
|
struct MTex;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct Main;
|
2019-09-07 15:17:40 +02:00
|
|
|
struct Material;
|
2009-09-16 20:59:13 +02:00
|
|
|
struct PointerRNA;
|
2010-08-04 06:01:27 +02:00
|
|
|
struct RenderData;
|
|
|
|
struct Scene;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct SpaceNode;
|
2010-08-04 06:01:27 +02:00
|
|
|
struct Tex;
|
2019-09-07 15:17:40 +02:00
|
|
|
struct World;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct bContext;
|
|
|
|
struct bNode;
|
|
|
|
struct bNodeExecContext;
|
|
|
|
struct bNodeExecData;
|
2013-03-18 17:34:57 +01:00
|
|
|
struct bNodeInstanceHash;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct bNodeLink;
|
|
|
|
struct bNodeSocket;
|
|
|
|
struct bNodeStack;
|
|
|
|
struct bNodeTree;
|
|
|
|
struct bNodeTreeExec;
|
|
|
|
struct bNodeTreeType;
|
|
|
|
struct uiLayout;
|
2005-12-18 14:46:01 +01:00
|
|
|
|
2015-02-13 21:27:09 +01:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Node Type Definitions
|
|
|
|
* \{ */
|
2005-12-20 16:43:55 +01:00
|
|
|
|
2019-11-24 15:14:39 +01:00
|
|
|
/**
|
|
|
|
* \brief Compact definition of a node socket.
|
|
|
|
*
|
2011-09-05 23:01:50 +02: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 23:01:50 +02:00
|
|
|
*
|
2013-03-18 17:34:57 +01: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 23:01:50 +02: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 09:51:06 +01:00
|
|
|
char name[64]; /* MAX_NAME */
|
2011-09-05 23:01:50 +02:00
|
|
|
float val1, val2, val3, val4; /* default alloc value for inputs */
|
|
|
|
float min, max;
|
2012-11-27 17:19:52 +01:00
|
|
|
int subtype; /* would use PropertySubType but this is a bad level include to use RNA */
|
2011-11-07 18:30:52 +01: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 16:42:51 +01:00
|
|
|
/* after this line is used internal only */
|
2011-09-05 23:01:50 +02:00
|
|
|
struct bNodeSocket *sock; /* used to hold verified socket */
|
2013-03-18 17:34:57 +01:00
|
|
|
char identifier[64]; /* generated from name */
|
2011-09-05 23:01:50 +02: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 {
|
2021-08-20 13:14:39 +02:00
|
|
|
class NodeMultiFunctionBuilder;
|
2020-12-02 13:25:25 +01:00
|
|
|
class GeoNodeExecParams;
|
2021-08-30 17:13:46 +02:00
|
|
|
class NodeDeclarationBuilder;
|
2021-12-15 16:51:57 +01:00
|
|
|
class GatherLinkSearchOpParams;
|
2020-07-17 11:36:59 +02:00
|
|
|
} // namespace nodes
|
2020-07-07 18:23:33 +02:00
|
|
|
namespace fn {
|
|
|
|
class MFDataType;
|
2020-12-02 13:25:25 +01:00
|
|
|
} // namespace fn
|
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);
|
2020-12-02 13:25:25 +01:00
|
|
|
using SocketGetCPPValueFunction = void (*)(const struct bNodeSocket &socket, void *r_value);
|
2021-08-02 10:34:50 +02:00
|
|
|
using SocketGetGeometryNodesCPPValueFunction = void (*)(const struct bNodeSocket &socket,
|
|
|
|
void *r_value);
|
2020-07-07 18:23:33 +02:00
|
|
|
|
2021-12-15 16:51:57 +01:00
|
|
|
/* Adds socket link operations that are specific to this node type. */
|
|
|
|
using NodeGatherSocketLinkOperationsFunction =
|
|
|
|
void (*)(blender::nodes::GatherLinkSearchOpParams ¶ms);
|
|
|
|
|
2020-07-07 18:23:33 +02:00
|
|
|
#else
|
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;
|
2021-12-15 16:51:57 +01:00
|
|
|
typedef void *NodeGatherSocketLinkOperationsFunction;
|
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;
|
2021-11-22 10:18:08 +01:00
|
|
|
typedef struct CPPTypeHandle CPPTypeHandle;
|
2020-07-07 18:23:33 +02:00
|
|
|
#endif
|
|
|
|
|
2019-11-24 15:14:39 +01:00
|
|
|
/**
|
|
|
|
* \brief Defines a socket type.
|
|
|
|
*
|
2011-09-05 23:01:50 +02:00
|
|
|
* Defines the appearance and behavior of a socket in the UI.
|
|
|
|
*/
|
|
|
|
typedef struct bNodeSocketType {
|
2021-07-06 19:36:11 +02:00
|
|
|
/* Identifier name */
|
|
|
|
char idname[64];
|
|
|
|
/* Type label */
|
|
|
|
char label[64];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-05-08 16:58:41 +02:00
|
|
|
void (*draw)(struct bContext *C,
|
|
|
|
struct uiLayout *layout,
|
|
|
|
struct PointerRNA *ptr,
|
|
|
|
struct PointerRNA *node_ptr,
|
|
|
|
const char *text);
|
2013-03-18 17:34:57 +01:00
|
|
|
void (*draw_color)(struct bContext *C,
|
|
|
|
struct PointerRNA *ptr,
|
|
|
|
struct PointerRNA *node_ptr,
|
|
|
|
float *r_color);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 17:34:57 +01:00
|
|
|
void (*interface_draw)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr);
|
|
|
|
void (*interface_draw_color)(struct bContext *C, struct PointerRNA *ptr, float *r_color);
|
|
|
|
void (*interface_register_properties)(struct bNodeTree *ntree,
|
2021-12-10 21:54:32 +01:00
|
|
|
struct bNodeSocket *interface_socket,
|
2013-03-18 17:34:57 +01:00
|
|
|
struct StructRNA *data_srna);
|
|
|
|
void (*interface_init_socket)(struct bNodeTree *ntree,
|
2021-12-10 21:54:32 +01:00
|
|
|
const struct bNodeSocket *interface_socket,
|
2013-03-28 11:32:04 +01:00
|
|
|
struct bNode *node,
|
|
|
|
struct bNodeSocket *sock,
|
|
|
|
const char *data_path);
|
|
|
|
void (*interface_verify_socket)(struct bNodeTree *ntree,
|
2021-12-10 21:54:32 +01:00
|
|
|
const struct bNodeSocket *interface_socket,
|
2013-03-18 17:34:57 +01:00
|
|
|
struct bNode *node,
|
|
|
|
struct bNodeSocket *sock,
|
|
|
|
const char *data_path);
|
|
|
|
void (*interface_from_socket)(struct bNodeTree *ntree,
|
2021-12-10 21:54:32 +01:00
|
|
|
struct bNodeSocket *interface_socket,
|
2013-03-18 17:34:57 +01:00
|
|
|
struct bNode *node,
|
|
|
|
struct bNodeSocket *sock);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 17:34:57 +01:00
|
|
|
/* RNA integration */
|
|
|
|
ExtensionRNA ext_socket;
|
|
|
|
ExtensionRNA ext_interface;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 17:34:57 +01: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;
|
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 16:42:51 +01: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 15:24:51 +01:00
|
|
|
|
2013-03-18 17:34:57 +01:00
|
|
|
typedef void *(*NodeInitExecFunction)(struct bNodeExecContext *context,
|
|
|
|
struct bNode *node,
|
|
|
|
bNodeInstanceKey key);
|
2013-10-29 18:46:01 +01:00
|
|
|
typedef void (*NodeFreeExecFunction)(void *nodedata);
|
2013-03-18 17:34:57 +01: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);
|
2011-09-05 23:01:50 +02:00
|
|
|
|
2019-11-24 15:14:39 +01:00
|
|
|
/**
|
|
|
|
* \brief Defines a node type.
|
|
|
|
*
|
2011-09-05 23:01:50 +02: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 16:42:51 +01:00
|
|
|
typedef struct bNodeType {
|
2013-03-18 17:34:57 +01: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 16:42:51 +01:00
|
|
|
int type;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 17:34:57 +01:00
|
|
|
char ui_name[64]; /* MAX_NAME */
|
|
|
|
char ui_description[256];
|
|
|
|
int ui_icon;
|
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 16:42:51 +01:00
|
|
|
float width, minwidth, maxwidth;
|
2011-09-05 23:01:50 +02: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 23:01:50 +02: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 16:42:51 +01:00
|
|
|
char storagename[64]; /* struct name for DNA */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-10-10 13:33:20 +02: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 13:33:20 +02: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-27 17:13:49 +01:00
|
|
|
/**
|
|
|
|
* Optional custom label function for the node header.
|
|
|
|
* \note Used as a fallback when #bNode.label isn't set.
|
|
|
|
*/
|
2021-12-11 16:51:53 +01:00
|
|
|
void (*labelfunc)(const struct bNodeTree *ntree,
|
|
|
|
const struct bNode *node,
|
|
|
|
char *label,
|
|
|
|
int maxlen);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-02-07 16:29:16 +01:00
|
|
|
/** Optional override for node class, used for drawing node header. */
|
|
|
|
int (*ui_class)(const struct bNode *node);
|
|
|
|
|
2011-09-05 23:01:50 +02: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
|
|
|
|
2011-09-05 23:01:50 +02:00
|
|
|
/** Initialize a new node instance of this type after creation. */
|
2013-03-18 17:34:57 +01:00
|
|
|
void (*initfunc)(struct bNodeTree *ntree, struct bNode *node);
|
|
|
|
/** Free the node instance. */
|
|
|
|
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 17:34:57 +01: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
|
|
|
|
2021-04-12 18:43:23 +02:00
|
|
|
/**
|
|
|
|
* Can this node type be added to a node tree?
|
2021-12-15 16:51:57 +01: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!).
|
|
|
|
*/
|
|
|
|
bool (*poll)(struct bNodeType *ntype, struct bNodeTree *nodetree, const char **r_disabled_hint);
|
|
|
|
/** Can this node be added to a node tree?
|
|
|
|
* \param r_disabled_hint: See `poll()`.
|
|
|
|
*/
|
|
|
|
bool (*poll_instance)(struct bNode *node,
|
|
|
|
struct bNodeTree *nodetree,
|
|
|
|
const char **r_disabled_hint);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Node callback for handling link insertion and swapping of occupied inputs.
Nodes have a feature for moving existing links to unoccupied sockets when connecting
to an already used input. This is based on the standard legacy socket types (value/float,
vector, color/rgba) and works reasonably well for shader, compositor and texture nodes.
For new pynode systems, however, the hardcoded nature of that feature has major drawbacks:
* It does not take different type systems into account, leading to meaningless connections
when sockets are swapped and making the feature useless or outright debilitating.
* Advanced socket behaviors would be possible with a registerable callback, e.g. creating
extensible input lists that move existing connections down to make room for a new link.
Now any handling of new links is done via the 'insert_links' callback, which can also be
registered through the RNA API. For the legacy shader/compo/tex nodes the behavior is the
same, using a C callback.
Note on the 'use_swap' flag: this has been removed because it was meaningless anyway:
It was disabled only for the insert-node-on-link feature, which works only for
completely unconnected nodes anyway, so there would be nothing to swap in the first place.
2015-12-03 12:51:29 +01:00
|
|
|
/* optional handling of link insertion */
|
|
|
|
void (*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 23:01:50 +02: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 22:51:28 +02:00
|
|
|
/* gpu */
|
2021-03-05 17:35:25 +01:00
|
|
|
NodeGPUExecFunction gpu_fn;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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;
|
2021-05-25 10:25:55 +02:00
|
|
|
bool geometry_node_execute_supports_laziness;
|
2020-12-02 13:25:25 +01:00
|
|
|
|
2021-08-30 17:13:46 +02:00
|
|
|
/* Declares which sockets the node has. */
|
|
|
|
NodeDeclareFunction declare;
|
2021-10-18 15:21:51 +02:00
|
|
|
/* Different nodes of this type can have different declarations. */
|
|
|
|
bool declaration_is_dynamic;
|
|
|
|
/* Declaration to be used when it is not dynamic. */
|
|
|
|
NodeDeclarationHandle *fixed_declaration;
|
2021-08-30 17:13:46 +02:00
|
|
|
|
2021-12-15 16:51:57 +01: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;
|
|
|
|
|
2021-11-17 11:52:44 +01:00
|
|
|
/** True when the node cannot be muted. */
|
|
|
|
bool no_muting;
|
|
|
|
|
2013-03-18 17:34:57 +01: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 16:42:51 +01:00
|
|
|
} bNodeType;
|
|
|
|
|
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 14:28:44 +01:00
|
|
|
/* nodetype->nclass, for add-menu and themes */
|
2011-09-05 23:01:50 +02: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 23:01:50 +02:00
|
|
|
#define NODE_CLASS_MATTE 9
|
|
|
|
#define NODE_CLASS_DISTORT 10
|
|
|
|
#define NODE_CLASS_PATTERN 12
|
|
|
|
#define NODE_CLASS_TEXTURE 13
|
2012-11-03 15:32:26 +01:00
|
|
|
#define NODE_CLASS_SCRIPT 32
|
2013-03-18 17:34:57 +01:00
|
|
|
#define NODE_CLASS_INTERFACE 33
|
2011-11-02 20:24:30 +01:00
|
|
|
#define NODE_CLASS_SHADER 40
|
2020-12-01 16:28:29 +01:00
|
|
|
#define NODE_CLASS_GEOMETRY 41
|
|
|
|
#define NODE_CLASS_ATTRIBUTE 42
|
2011-09-05 23:01:50 +02: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 16:42:51 +01:00
|
|
|
|
2013-02-22 11:46:27 +01:00
|
|
|
typedef enum eNodeSizePreset {
|
|
|
|
NODE_SIZE_DEFAULT,
|
|
|
|
NODE_SIZE_SMALL,
|
2013-05-21 22:21:46 +02:00
|
|
|
NODE_SIZE_MIDDLE,
|
2019-04-16 16:40:47 +02:00
|
|
|
NODE_SIZE_LARGE,
|
2013-02-22 11:46:27 +01:00
|
|
|
} eNodeSizePreset;
|
|
|
|
|
2011-09-05 23:01:50 +02:00
|
|
|
struct bNodeTreeExec;
|
|
|
|
|
2011-11-07 23:14:48 +01:00
|
|
|
typedef void (*bNodeClassCallback)(void *calldata, int nclass, const char *name);
|
2012-06-07 00:38:39 +02:00
|
|
|
typedef struct bNodeTreeType {
|
2011-09-05 23:01:50 +02:00
|
|
|
int type; /* type identifier */
|
2013-03-18 17:34:57 +01:00
|
|
|
char idname[64]; /* identifier name */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 17:34:57 +01:00
|
|
|
char ui_name[64];
|
|
|
|
char ui_description[256];
|
|
|
|
int ui_icon;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-09-05 23:01:50 +02:00
|
|
|
/* callbacks */
|
|
|
|
void (*free_cache)(struct bNodeTree *ntree);
|
|
|
|
void (*free_node_cache)(struct bNodeTree *ntree, struct bNode *node);
|
2019-08-14 15:29:46 +02:00
|
|
|
/* Iteration over all node classes. */
|
|
|
|
void (*foreach_nodeclass)(struct Scene *scene, void *calldata, bNodeClassCallback func);
|
2013-03-18 17:34:57 +01: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 17:34:57 +01: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 23:01:50 +02: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
|
|
|
|
2021-10-03 03:06:06 +02:00
|
|
|
/* Tree update. Overrides `nodetype->updatetreefunc` ! */
|
2011-09-05 23:01:50 +02:00
|
|
|
void (*update)(struct bNodeTree *ntree);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-12-15 16:51:57 +01: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-30 06:36:46 +02:00
|
|
|
/* Check if the socket type is valid for this tree type. */
|
2021-07-06 19:36:11 +02:00
|
|
|
bool (*valid_socket_type)(struct bNodeTreeType *ntreetype, struct bNodeSocketType *socket_type);
|
2021-04-30 06:36:46 +02:00
|
|
|
|
2013-03-18 17:34:57 +01:00
|
|
|
/* RNA integration */
|
2020-04-03 18:24:08 +02:00
|
|
|
ExtensionRNA rna_ext;
|
2011-09-05 23:01:50 +02:00
|
|
|
} bNodeTreeType;
|
|
|
|
|
2015-02-13 21:27:09 +01:00
|
|
|
/** \} */
|
2013-03-18 17:34:57 +01:00
|
|
|
|
2015-02-13 21:27:09 +01: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 16:42:51 +01:00
|
|
|
|
2013-03-18 17:34:57 +01:00
|
|
|
struct bNodeTreeType *ntreeTypeFind(const char *idname);
|
2013-03-18 19:25:05 +01:00
|
|
|
void ntreeTypeAdd(struct bNodeTreeType *nt);
|
2015-05-11 04:39:39 +02:00
|
|
|
void ntreeTypeFreeLink(const struct bNodeTreeType *nt);
|
2013-03-19 14:40:16 +01:00
|
|
|
bool ntreeIsRegistered(struct bNodeTree *ntree);
|
2013-03-18 17:34:57 +01:00
|
|
|
struct GHashIterator *ntreeTypeGetIterator(void);
|
|
|
|
|
2021-10-03 03:06:06 +02:00
|
|
|
/* Helper macros for iterating over tree types. */
|
2013-03-18 17:34:57 +01:00
|
|
|
#define NODE_TREE_TYPES_BEGIN(ntype) \
|
|
|
|
{ \
|
|
|
|
GHashIterator *__node_tree_type_iter__ = ntreeTypeGetIterator(); \
|
2013-05-08 14:58:11 +02:00
|
|
|
for (; !BLI_ghashIterator_done(__node_tree_type_iter__); \
|
|
|
|
BLI_ghashIterator_step(__node_tree_type_iter__)) { \
|
2021-02-02 16:51:38 +01: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 14:06:05 +01:00
|
|
|
|
2013-03-18 17:34:57 +01:00
|
|
|
#define NODE_TREE_TYPES_END \
|
|
|
|
} \
|
|
|
|
BLI_ghashIterator_free(__node_tree_type_iter__); \
|
2013-09-13 10:45:20 +02:00
|
|
|
} \
|
|
|
|
(void)0
|
2013-03-18 17:34:57 +01:00
|
|
|
|
2021-12-07 07:19:15 +01: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 17:34:57 +01: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 17:07:38 +02:00
|
|
|
|
2012-08-22 10:54:18 +02:00
|
|
|
/* copy/free funcs, need to manage ID users */
|
2021-12-07 07:19:15 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Free (or release) any data used by this node-tree.
|
|
|
|
* Does not free the node-tree itself and does no ID user counting.
|
|
|
|
*/
|
2012-08-22 10:54:18 +02:00
|
|
|
void ntreeFreeTree(struct bNodeTree *ntree);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Free tree which is embedded into another data-block.
|
|
|
|
*/
|
2020-04-20 16:14:45 +02:00
|
|
|
void ntreeFreeEmbeddedTree(struct bNodeTree *ntree);
|
2017-06-14 22:36:30 +02:00
|
|
|
struct bNodeTree *ntreeCopyTree_ex(const struct bNodeTree *ntree,
|
|
|
|
struct Main *bmain,
|
2022-01-07 01:38:08 +01:00
|
|
|
bool do_id_user);
|
2019-08-22 16:00:59 +02:00
|
|
|
struct bNodeTree *ntreeCopyTree(struct Main *bmain, const struct bNodeTree *ntree);
|
2012-08-22 10:54:18 +02:00
|
|
|
|
2021-12-07 07:19:15 +01: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);
|
2021-12-07 07:19:15 +01: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 17:21:43 +01:00
|
|
|
|
2019-03-16 18:54:00 +01:00
|
|
|
void ntreeFreeLocalNode(struct bNodeTree *ntree, struct bNode *node);
|
2018-12-14 15:20:33 +01:00
|
|
|
void ntreeFreeLocalTree(struct bNodeTree *ntree);
|
2016-06-14 11:31:00 +02:00
|
|
|
struct bNode *ntreeFindType(const struct bNodeTree *ntree, int type);
|
2014-01-27 10:17:56 +01:00
|
|
|
bool ntreeHasTree(const struct bNodeTree *ntree, const struct bNodeTree *lookup);
|
2019-04-20 20:25:22 +02:00
|
|
|
void ntreeUpdateAllNew(struct Main *main);
|
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 16:42:51 +01:00
|
|
|
|
2021-02-05 12:34:03 +01:00
|
|
|
void ntreeGetDependencyList(struct bNodeTree *ntree,
|
|
|
|
struct bNode ***r_deplist,
|
|
|
|
int *r_deplist_len);
|
2021-12-21 15:18:56 +01:00
|
|
|
void ntreeUpdateNodeLevels(struct bNodeTree *ntree);
|
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 14:06:05 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* XXX: old trees handle output flags automatically based on special output
|
2019-04-27 04:07:07 +02: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 23:01:50 +02:00
|
|
|
*/
|
2012-08-01 01:06:12 +02:00
|
|
|
void ntreeSetOutput(struct bNodeTree *ntree);
|
2006-06-19 19:29:44 +02:00
|
|
|
|
2012-08-01 01:06:12 +02:00
|
|
|
void ntreeFreeCache(struct bNodeTree *ntree);
|
2011-09-05 23:01:50 +02:00
|
|
|
|
2022-01-07 01:38:08 +01:00
|
|
|
void ntreeNodeFlagSet(const bNodeTree *ntree, int flag, bool enable);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Returns localized tree for execution in threads.
|
|
|
|
*/
|
2009-01-27 18:12:40 +01:00
|
|
|
struct bNodeTree *ntreeLocalize(struct bNodeTree *ntree);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Merge local tree results back, and free local tree.
|
|
|
|
*
|
|
|
|
* We have to assume the editor already changed completely.
|
|
|
|
*/
|
2018-06-11 15:40:37 +02:00
|
|
|
void ntreeLocalMerge(struct Main *bmain, struct bNodeTree *localtree, 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 16:42:51 +01:00
|
|
|
|
2021-12-07 07:19:15 +01: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);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* \note `ntree` itself has been read!
|
|
|
|
*/
|
2020-09-10 13:33:29 +02:00
|
|
|
void ntreeBlendReadData(struct BlendDataReader *reader, struct bNodeTree *ntree);
|
|
|
|
void ntreeBlendReadLib(struct BlendLibReader *reader, struct bNodeTree *ntree);
|
|
|
|
void ntreeBlendReadExpand(struct BlendExpander *expander, struct bNodeTree *ntree);
|
|
|
|
|
2015-02-13 21:27:09 +01:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Node Tree Interface
|
|
|
|
* \{ */
|
2021-12-14 05:49:31 +01:00
|
|
|
|
2013-03-18 17:34:57 +01:00
|
|
|
struct bNodeSocket *ntreeFindSocketInterface(struct bNodeTree *ntree,
|
2021-03-26 19:25:52 +01:00
|
|
|
eNodeSocketInOut in_out,
|
2013-03-18 17:34:57 +01:00
|
|
|
const char *identifier);
|
|
|
|
struct bNodeSocket *ntreeAddSocketInterface(struct bNodeTree *ntree,
|
2021-03-26 19:25:52 +01:00
|
|
|
eNodeSocketInOut in_out,
|
2013-03-18 17:34:57 +01:00
|
|
|
const char *idname,
|
|
|
|
const char *name);
|
|
|
|
struct bNodeSocket *ntreeInsertSocketInterface(struct bNodeTree *ntree,
|
2021-03-26 19:25:52 +01:00
|
|
|
eNodeSocketInOut in_out,
|
2013-03-18 17:34:57 +01:00
|
|
|
const char *idname,
|
|
|
|
struct bNodeSocket *next_sock,
|
|
|
|
const char *name);
|
|
|
|
struct bNodeSocket *ntreeAddSocketInterfaceFromSocket(struct bNodeTree *ntree,
|
|
|
|
struct bNode *from_node,
|
|
|
|
struct bNodeSocket *from_sock);
|
|
|
|
struct bNodeSocket *ntreeInsertSocketInterfaceFromSocket(struct bNodeTree *ntree,
|
|
|
|
struct bNodeSocket *next_sock,
|
|
|
|
struct bNode *from_node,
|
|
|
|
struct bNodeSocket *from_sock);
|
|
|
|
void ntreeRemoveSocketInterface(struct bNodeTree *ntree, struct bNodeSocket *sock);
|
|
|
|
|
2021-01-15 17:48:22 +01:00
|
|
|
struct StructRNA *ntreeInterfaceTypeGet(struct bNodeTree *ntree, bool create);
|
2013-03-18 17:34:57 +01:00
|
|
|
void ntreeInterfaceTypeFree(struct bNodeTree *ntree);
|
|
|
|
void ntreeInterfaceTypeUpdate(struct bNodeTree *ntree);
|
|
|
|
|
2015-02-13 21:27:09 +01: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 16:42:51 +01:00
|
|
|
|
2013-03-18 17:34:57 +01:00
|
|
|
struct bNodeType *nodeTypeFind(const char *idname);
|
2013-03-18 19:25:05 +01:00
|
|
|
void nodeRegisterType(struct bNodeType *ntype);
|
|
|
|
void nodeUnregisterType(struct bNodeType *ntype);
|
2021-12-03 22:25:17 +01:00
|
|
|
bool nodeTypeUndefined(const struct bNode *node);
|
2013-03-18 17:34:57 +01:00
|
|
|
struct GHashIterator *nodeTypeGetIterator(void);
|
|
|
|
|
2021-10-03 03:06:06 +02:00
|
|
|
/* Helper macros for iterating over node types. */
|
2013-03-18 17:34:57 +01:00
|
|
|
#define NODE_TYPES_BEGIN(ntype) \
|
|
|
|
{ \
|
|
|
|
GHashIterator *__node_type_iter__ = nodeTypeGetIterator(); \
|
2013-05-08 14:58:11 +02:00
|
|
|
for (; !BLI_ghashIterator_done(__node_type_iter__); \
|
|
|
|
BLI_ghashIterator_step(__node_type_iter__)) { \
|
2021-02-02 16:51:38 +01:00
|
|
|
bNodeType *ntype = (bNodeType *)BLI_ghashIterator_getValue(__node_type_iter__);
|
2013-03-18 17:34:57 +01:00
|
|
|
|
|
|
|
#define NODE_TYPES_END \
|
|
|
|
} \
|
|
|
|
BLI_ghashIterator_free(__node_type_iter__); \
|
2018-11-30 05:35:15 +01:00
|
|
|
} \
|
|
|
|
((void)0)
|
2013-03-18 17:34:57 +01:00
|
|
|
|
|
|
|
struct bNodeSocketType *nodeSocketTypeFind(const char *idname);
|
2013-03-18 19:25:05 +01:00
|
|
|
void nodeRegisterSocketType(struct bNodeSocketType *stype);
|
|
|
|
void nodeUnregisterSocketType(struct bNodeSocketType *stype);
|
2013-03-19 14:40:16 +01:00
|
|
|
bool nodeSocketIsRegistered(struct bNodeSocket *sock);
|
2013-03-18 17:34:57 +01:00
|
|
|
struct GHashIterator *nodeSocketTypeGetIterator(void);
|
2021-07-06 19:36:11 +02:00
|
|
|
const char *nodeSocketTypeLabel(const bNodeSocketType *stype);
|
|
|
|
|
|
|
|
bool nodeIsStaticSocketType(const struct bNodeSocketType *stype);
|
2013-11-24 05:23:38 +01:00
|
|
|
const char *nodeStaticSocketType(int type, int subtype);
|
|
|
|
const char *nodeStaticSocketInterfaceType(int type, int subtype);
|
2021-07-06 19:36:11 +02:00
|
|
|
const char *nodeStaticSocketLabel(int type, int subtype);
|
2013-03-18 17:34:57 +01:00
|
|
|
|
2021-10-03 03:06:06 +02:00
|
|
|
/* Helper macros for iterating over node types. */
|
2013-03-18 17:34:57 +01:00
|
|
|
#define NODE_SOCKET_TYPES_BEGIN(stype) \
|
|
|
|
{ \
|
|
|
|
GHashIterator *__node_socket_type_iter__ = nodeSocketTypeGetIterator(); \
|
2013-05-08 14:58:11 +02:00
|
|
|
for (; !BLI_ghashIterator_done(__node_socket_type_iter__); \
|
|
|
|
BLI_ghashIterator_step(__node_socket_type_iter__)) { \
|
2021-02-02 16:51:38 +01:00
|
|
|
bNodeSocketType *stype = (bNodeSocketType *)BLI_ghashIterator_getValue( \
|
|
|
|
__node_socket_type_iter__);
|
2013-03-18 17:34:57 +01: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 17:34:57 +01:00
|
|
|
|
2021-03-26 19:25:52 +01:00
|
|
|
struct bNodeSocket *nodeFindSocket(const struct bNode *node,
|
|
|
|
eNodeSocketInOut in_out,
|
|
|
|
const char *identifier);
|
2013-03-18 17:34:57 +01:00
|
|
|
struct bNodeSocket *nodeAddSocket(struct bNodeTree *ntree,
|
|
|
|
struct bNode *node,
|
2021-03-26 19:25:52 +01:00
|
|
|
eNodeSocketInOut in_out,
|
2013-03-18 17:34:57 +01:00
|
|
|
const char *idname,
|
|
|
|
const char *identifier,
|
|
|
|
const char *name);
|
|
|
|
struct bNodeSocket *nodeAddStaticSocket(struct bNodeTree *ntree,
|
|
|
|
struct bNode *node,
|
2021-03-26 19:25:52 +01:00
|
|
|
eNodeSocketInOut in_out,
|
2013-03-18 17:34:57 +01:00
|
|
|
int type,
|
|
|
|
int subtype,
|
|
|
|
const char *identifier,
|
|
|
|
const char *name);
|
2011-09-05 23:01:50 +02:00
|
|
|
void nodeRemoveSocket(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock);
|
2021-08-30 17:13:46 +02:00
|
|
|
void nodeRemoveSocketEx(struct bNodeTree *ntree,
|
|
|
|
struct bNode *node,
|
|
|
|
struct bNodeSocket *sock,
|
|
|
|
bool do_id_user);
|
2011-09-05 23:01:50 +02:00
|
|
|
void nodeRemoveAllSockets(struct bNodeTree *ntree, struct bNode *node);
|
2021-07-06 19:36:11 +02:00
|
|
|
void nodeModifySocketType(struct bNodeTree *ntree,
|
|
|
|
struct bNode *node,
|
|
|
|
struct bNodeSocket *sock,
|
|
|
|
const char *idname);
|
|
|
|
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 14:06:05 +01:00
|
|
|
|
2013-03-18 17:34:57 +01: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);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* \note Goes over entire tree.
|
|
|
|
*/
|
2012-08-01 01:06:12 +02:00
|
|
|
void nodeUnlinkNode(struct bNodeTree *ntree, struct bNode *node);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Find the first available, non-duplicate name for a given node.
|
|
|
|
*/
|
2012-08-01 01:06:12 +02:00
|
|
|
void nodeUniqueName(struct bNodeTree *ntree, struct bNode *node);
|
2011-09-05 23:01:50 +02:00
|
|
|
|
2021-12-07 07:19:15 +01: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
|
|
|
|
2021-12-22 15:47:46 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
namespace blender::bke {
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
2021-12-22 15:47:46 +01:00
|
|
|
* \note keeps socket list order identical, for copying links.
|
2021-12-22 15:52:46 +01:00
|
|
|
* \note `unique_name` should usually be true, unless the \a dst_tree is temporary,
|
|
|
|
* or the names can already be assumed valid.
|
2021-12-07 07:19:15 +01:00
|
|
|
*/
|
2021-12-22 15:47:46 +01:00
|
|
|
bNode *node_copy_with_mapping(bNodeTree *dst_tree,
|
|
|
|
const bNode &node_src,
|
|
|
|
int flag,
|
|
|
|
bool unique_name,
|
|
|
|
Map<const bNodeSocket *, bNodeSocket *> &new_socket_map);
|
2019-06-03 17:08:25 +02:00
|
|
|
|
2021-12-22 15:47:46 +01:00
|
|
|
bNode *node_copy(bNodeTree *dst_tree, const bNode &src_node, int flag, bool unique_name);
|
|
|
|
|
|
|
|
} // namespace blender::bke
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2021-12-07 07:19:15 +01: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 16:42:51 +01:00
|
|
|
struct bNodeLink *nodeAddLink(struct bNodeTree *ntree,
|
|
|
|
struct bNode *fromnode,
|
|
|
|
struct bNodeSocket *fromsock,
|
|
|
|
struct bNode *tonode,
|
|
|
|
struct bNodeSocket *tosock);
|
2012-08-01 01:06:12 +02:00
|
|
|
void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link);
|
|
|
|
void nodeRemSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock);
|
2021-03-16 20:11:54 +01:00
|
|
|
void nodeMuteLinkToggle(struct bNodeTree *ntree, struct bNodeLink *link);
|
2021-01-15 17:48:22 +01:00
|
|
|
bool nodeLinkIsHidden(const struct bNodeLink *link);
|
2022-02-28 21:52:00 +01:00
|
|
|
bool nodeLinkIsSelected(const struct bNodeLink *link);
|
2012-08-01 01:06:12 +02:00
|
|
|
void nodeInternalRelink(struct bNodeTree *ntree, struct bNode *node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-01-15 17:48:22 +01:00
|
|
|
void nodeToView(const struct bNode *node, float x, float y, float *rx, float *ry);
|
|
|
|
void nodeFromView(const struct bNode *node, float x, float y, float *rx, float *ry);
|
|
|
|
bool nodeAttachNodeCheck(const struct bNode *node, const struct bNode *parent);
|
2012-08-01 01:06:12 +02:00
|
|
|
void nodeAttachNode(struct bNode *node, struct bNode *parent);
|
|
|
|
void nodeDetachNode(struct bNode *node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-09-20 19:53:16 +02:00
|
|
|
void nodePositionRelative(struct bNode *from_node,
|
|
|
|
struct bNode *to_node,
|
|
|
|
struct bNodeSocket *from_sock,
|
|
|
|
struct bNodeSocket *to_sock);
|
|
|
|
void nodePositionPropagate(struct bNode *node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Finds a node based on its name.
|
|
|
|
*/
|
2012-08-01 01:06:12 +02:00
|
|
|
struct bNode *nodeFindNodebyName(struct bNodeTree *ntree, const char *name);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Finds a node based on given socket and returns true on success.
|
|
|
|
*/
|
2020-09-02 18:28:04 +02:00
|
|
|
bool nodeFindNode(struct bNodeTree *ntree,
|
|
|
|
struct bNodeSocket *sock,
|
|
|
|
struct bNode **r_node,
|
|
|
|
int *r_sockindex);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* \note Recursive.
|
|
|
|
*/
|
2015-08-01 16:16:16 +02:00
|
|
|
struct bNode *nodeFindRootParent(bNode *node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* \returns true if \a child has \a parent as a parent/grandparent/... etc.
|
|
|
|
* \note Recursive
|
|
|
|
*/
|
2015-08-01 16:16:16 +02:00
|
|
|
bool nodeIsChildOf(const bNode *parent, const bNode *child);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Iterate over a chain of nodes, starting with \a node_start, executing
|
|
|
|
* \a callback for each node (which can return false to end iterator).
|
|
|
|
*
|
|
|
|
* \param reversed: for backwards iteration
|
|
|
|
* \note Recursive
|
|
|
|
*/
|
2015-08-01 16:16:16 +02:00
|
|
|
void nodeChainIter(const bNodeTree *ntree,
|
|
|
|
const bNode *node_start,
|
|
|
|
bool (*callback)(bNode *, bNode *, void *, const bool),
|
|
|
|
void *userdata,
|
2022-01-07 01:38:08 +01:00
|
|
|
bool reversed);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Iterate over a chain of nodes, starting with \a node_start, executing
|
|
|
|
* \a callback for each node (which can return false to end iterator).
|
|
|
|
*
|
|
|
|
* Faster than nodeChainIter. Iter only once per node.
|
|
|
|
* Can be called recursively (using another nodeChainIterBackwards) by
|
|
|
|
* setting the recursion_lvl accordingly.
|
|
|
|
*
|
|
|
|
* \note Needs updated socket links (ntreeUpdateTree).
|
|
|
|
* \note Recursive
|
|
|
|
*/
|
2019-09-30 13:09:39 +02:00
|
|
|
void nodeChainIterBackwards(const bNodeTree *ntree,
|
|
|
|
const bNode *node_start,
|
|
|
|
bool (*callback)(bNode *, bNode *, void *),
|
2019-10-10 00:31:47 +02:00
|
|
|
void *userdata,
|
|
|
|
int recursion_lvl);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Iterate over all parents of \a node, executing \a callback for each parent
|
|
|
|
* (which can return false to end iterator)
|
|
|
|
*
|
|
|
|
* \note Recursive
|
|
|
|
*/
|
2015-08-01 16:16:16 +02:00
|
|
|
void nodeParentsIter(bNode *node, bool (*callback)(bNode *, void *), void *userdata);
|
2007-12-27 11:17:33 +01:00
|
|
|
|
2005-12-19 00:08:22 +01:00
|
|
|
struct bNodeLink *nodeFindLink(struct bNodeTree *ntree,
|
2021-01-15 17:48:22 +01:00
|
|
|
const struct bNodeSocket *from,
|
|
|
|
const struct bNodeSocket *to);
|
|
|
|
int nodeCountSocketLinks(const struct bNodeTree *ntree, const struct bNodeSocket *sock);
|
2005-12-30 12:25:15 +01:00
|
|
|
|
2014-03-31 14:39:08 +02:00
|
|
|
void nodeSetSelected(struct bNode *node, bool select);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Two active flags, ID nodes have special flag for buttons display.
|
|
|
|
*/
|
2012-08-01 01:06:12 +02:00
|
|
|
void nodeSetActive(struct bNodeTree *ntree, struct bNode *node);
|
|
|
|
struct bNode *nodeGetActive(struct bNodeTree *ntree);
|
|
|
|
void nodeClearActive(struct bNodeTree *ntree);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Two active flags, ID nodes have special flag for buttons display.
|
|
|
|
*/
|
2012-08-01 01:06:12 +02:00
|
|
|
struct bNode *nodeGetActiveTexture(struct bNodeTree *ntree);
|
2022-04-08 16:37:35 +02:00
|
|
|
struct bNode *nodeGetActivePaintCanvas(struct bNodeTree *ntree);
|
|
|
|
|
|
|
|
/**
|
2022-04-11 03:41:00 +02:00
|
|
|
* \brief Does the given node supports the sub active flag.
|
2022-04-08 16:37:35 +02:00
|
|
|
*
|
2022-04-11 03:41:00 +02:00
|
|
|
* \param sub_active: The active flag to check. #NODE_ACTIVE_TEXTURE / #NODE_ACTIVE_PAINT_CANVAS.
|
2022-04-08 16:37:35 +02:00
|
|
|
*/
|
|
|
|
bool nodeSupportsActiveFlag(const struct bNode *node, int sub_active);
|
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 15:24:51 +01:00
|
|
|
|
2021-01-15 17:48:22 +01:00
|
|
|
int nodeSocketIsHidden(const struct bNodeSocket *sock);
|
2021-11-17 11:10:46 +01:00
|
|
|
void nodeSetSocketAvailability(struct bNodeTree *ntree,
|
|
|
|
struct bNodeSocket *sock,
|
|
|
|
bool is_available);
|
2012-01-08 11:23:19 +01:00
|
|
|
|
2021-01-15 17:48:22 +01: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 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* If the node implements a `declare` function, this function makes sure that `node->declaration`
|
|
|
|
* is up to date. It is expected that the sockets of the node are up to date already.
|
|
|
|
*/
|
2021-11-08 12:23:50 +01:00
|
|
|
bool nodeDeclarationEnsure(struct bNodeTree *ntree, struct bNode *node);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Just update `node->declaration` if necessary. This can also be called on nodes that may not be
|
|
|
|
* up to date (e.g. because the need versioning or are dynamic).
|
|
|
|
*/
|
2021-11-08 12:23:50 +01:00
|
|
|
bool nodeDeclarationEnsureOnOutdatedNode(struct bNodeTree *ntree, struct bNode *node);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Update `socket->declaration` for all sockets in the node. This assumes that the node declaration
|
|
|
|
* and sockets are up to date already.
|
|
|
|
*/
|
2021-11-08 12:23:50 +01:00
|
|
|
void nodeSocketDeclarationsUpdate(struct bNode *node);
|
2021-09-14 16:34:31 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Node Clipboard.
|
|
|
|
*/
|
2021-01-26 04:11:57 +01:00
|
|
|
void BKE_node_clipboard_init(const struct bNodeTree *ntree);
|
2012-08-06 10:41:45 +02:00
|
|
|
void BKE_node_clipboard_clear(void);
|
2019-03-16 18:54:00 +01:00
|
|
|
void BKE_node_clipboard_free(void);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Return false when one or more ID's are lost.
|
|
|
|
*/
|
2014-01-27 17:52:21 +01:00
|
|
|
bool BKE_node_clipboard_validate(void);
|
2012-08-06 10:41:45 +02:00
|
|
|
void BKE_node_clipboard_add_node(struct bNode *node);
|
|
|
|
void BKE_node_clipboard_add_link(struct bNodeLink *link);
|
2012-08-06 10:25:24 +02:00
|
|
|
const struct ListBase *BKE_node_clipboard_get_nodes(void);
|
|
|
|
const struct ListBase *BKE_node_clipboard_get_links(void);
|
2012-08-06 10:41:45 +02:00
|
|
|
int BKE_node_clipboard_get_type(void);
|
2012-08-02 11:52:37 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Node Instance Hash.
|
|
|
|
*/
|
2015-04-07 03:25:42 +02:00
|
|
|
typedef struct bNodeInstanceHash {
|
2021-10-03 03:06:06 +02:00
|
|
|
/** XXX should be made a direct member, #GHash allocation needs to support it */
|
|
|
|
GHash *ghash;
|
2013-03-18 17:34:57 +01:00
|
|
|
} bNodeInstanceHash;
|
|
|
|
|
|
|
|
typedef void (*bNodeInstanceValueFP)(void *value);
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Magic number for initial hash key.
|
|
|
|
*/
|
2013-03-18 17:34:57 +01:00
|
|
|
extern const bNodeInstanceKey NODE_INSTANCE_KEY_BASE;
|
2013-04-24 18:36:50 +02:00
|
|
|
extern const bNodeInstanceKey NODE_INSTANCE_KEY_NONE;
|
2013-03-18 17:34:57 +01:00
|
|
|
|
|
|
|
bNodeInstanceKey BKE_node_instance_key(bNodeInstanceKey parent_key,
|
2021-01-26 04:11:57 +01:00
|
|
|
const struct bNodeTree *ntree,
|
|
|
|
const struct bNode *node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 19:25:05 +01:00
|
|
|
bNodeInstanceHash *BKE_node_instance_hash_new(const char *info);
|
2013-03-18 17:34:57 +01: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 19:25:05 +01:00
|
|
|
void *BKE_node_instance_hash_lookup(bNodeInstanceHash *hash, bNodeInstanceKey key);
|
2013-03-18 17:34:57 +01: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 19:25:05 +01:00
|
|
|
void *BKE_node_instance_hash_pop(bNodeInstanceHash *hash, bNodeInstanceKey key);
|
2013-03-18 17:34:57 +01: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 17:34:57 +01:00
|
|
|
void BKE_node_instance_hash_clear_tags(bNodeInstanceHash *hash);
|
|
|
|
void BKE_node_instance_hash_tag(bNodeInstanceHash *hash, void *value);
|
2014-03-31 14:39:08 +02:00
|
|
|
bool BKE_node_instance_hash_tag_key(bNodeInstanceHash *hash, bNodeInstanceKey key);
|
2013-03-18 17:34:57 +01:00
|
|
|
void BKE_node_instance_hash_remove_untagged(bNodeInstanceHash *hash,
|
|
|
|
bNodeInstanceValueFP valfreefp);
|
|
|
|
|
|
|
|
typedef GHashIterator bNodeInstanceHashIterator;
|
|
|
|
|
|
|
|
BLI_INLINE bNodeInstanceHashIterator *BKE_node_instance_hash_iterator_new(bNodeInstanceHash *hash)
|
|
|
|
{
|
|
|
|
return BLI_ghashIterator_new(hash->ghash);
|
|
|
|
}
|
|
|
|
BLI_INLINE void BKE_node_instance_hash_iterator_init(bNodeInstanceHashIterator *iter,
|
|
|
|
bNodeInstanceHash *hash)
|
|
|
|
{
|
|
|
|
BLI_ghashIterator_init(iter, hash->ghash);
|
|
|
|
}
|
|
|
|
BLI_INLINE void BKE_node_instance_hash_iterator_free(bNodeInstanceHashIterator *iter)
|
|
|
|
{
|
|
|
|
BLI_ghashIterator_free(iter);
|
|
|
|
}
|
|
|
|
BLI_INLINE bNodeInstanceKey
|
|
|
|
BKE_node_instance_hash_iterator_get_key(bNodeInstanceHashIterator *iter)
|
|
|
|
{
|
|
|
|
return *(bNodeInstanceKey *)BLI_ghashIterator_getKey(iter);
|
2013-03-18 19:25:05 +01:00
|
|
|
}
|
|
|
|
BLI_INLINE void *BKE_node_instance_hash_iterator_get_value(bNodeInstanceHashIterator *iter)
|
|
|
|
{
|
|
|
|
return BLI_ghashIterator_getValue(iter);
|
2013-03-18 17:34:57 +01:00
|
|
|
}
|
|
|
|
BLI_INLINE void BKE_node_instance_hash_iterator_step(bNodeInstanceHashIterator *iter)
|
|
|
|
{
|
|
|
|
BLI_ghashIterator_step(iter);
|
2013-05-08 14:58:11 +02:00
|
|
|
}
|
|
|
|
BLI_INLINE bool BKE_node_instance_hash_iterator_done(bNodeInstanceHashIterator *iter)
|
|
|
|
{
|
|
|
|
return BLI_ghashIterator_done(iter);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2013-03-18 17:34:57 +01:00
|
|
|
|
|
|
|
#define NODE_INSTANCE_HASH_ITER(iter_, hash_) \
|
|
|
|
for (BKE_node_instance_hash_iterator_init(&iter_, hash_); \
|
2013-05-08 14:58:11 +02:00
|
|
|
BKE_node_instance_hash_iterator_done(&iter_) == false; \
|
2013-03-18 17:34:57 +01:00
|
|
|
BKE_node_instance_hash_iterator_step(&iter_))
|
|
|
|
|
|
|
|
/* Node Previews */
|
|
|
|
|
2021-01-15 17:48:22 +01:00
|
|
|
bool BKE_node_preview_used(const struct bNode *node);
|
2014-04-01 02:34:00 +02:00
|
|
|
bNodePreview *BKE_node_preview_verify(
|
|
|
|
struct bNodeInstanceHash *previews, bNodeInstanceKey key, int xsize, int ysize, bool create);
|
2013-03-18 19:25:05 +01:00
|
|
|
bNodePreview *BKE_node_preview_copy(struct bNodePreview *preview);
|
2013-03-18 17:34:57 +01:00
|
|
|
void BKE_node_preview_free(struct bNodePreview *preview);
|
2021-12-20 00:57:51 +01:00
|
|
|
void BKE_node_preview_init_tree(struct bNodeTree *ntree, int xsize, int ysize);
|
2013-03-18 17:34:57 +01:00
|
|
|
void BKE_node_preview_remove_unused(struct bNodeTree *ntree);
|
|
|
|
void BKE_node_preview_clear(struct bNodePreview *preview);
|
|
|
|
void BKE_node_preview_clear_tree(struct bNodeTree *ntree);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-22 11:34:52 +01:00
|
|
|
void BKE_node_preview_merge_tree(struct bNodeTree *to_ntree,
|
|
|
|
struct bNodeTree *from_ntree,
|
|
|
|
bool remove_old);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-02-13 21:27:09 +01:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Node Type Access
|
|
|
|
* \{ */
|
2011-02-21 14:47:49 +01:00
|
|
|
|
2021-12-11 16:51:53 +01:00
|
|
|
void nodeLabel(const struct bNodeTree *ntree, const struct bNode *node, char *label, int maxlen);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Get node socket label if it is set.
|
|
|
|
*/
|
2020-02-11 16:31:40 +01:00
|
|
|
const char *nodeSocketLabel(const struct bNodeSocket *sock);
|
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 14:06:05 +01:00
|
|
|
|
2021-04-12 18:43:23 +02:00
|
|
|
bool nodeGroupPoll(struct bNodeTree *nodetree,
|
|
|
|
struct bNodeTree *grouptree,
|
|
|
|
const char **r_disabled_hint);
|
2013-03-18 17:34:57 +01:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Initialize a new node type struct with default values and callbacks.
|
|
|
|
*/
|
2022-01-04 01:32:33 +01:00
|
|
|
void node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass);
|
|
|
|
void node_type_base_custom(struct bNodeType *ntype,
|
|
|
|
const char *idname,
|
|
|
|
const char *name,
|
|
|
|
short nclass);
|
2012-08-01 01:06:12 +02:00
|
|
|
void node_type_socket_templates(struct bNodeType *ntype,
|
|
|
|
struct bNodeSocketTemplate *inputs,
|
|
|
|
struct bNodeSocketTemplate *outputs);
|
|
|
|
void node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth);
|
2013-02-22 11:46:27 +01:00
|
|
|
void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size);
|
2013-03-18 17:34:57 +01:00
|
|
|
void node_type_init(struct bNodeType *ntype,
|
|
|
|
void (*initfunc)(struct bNodeTree *ntree, struct bNode *node));
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* \warning Nodes defining a storage type _must_ allocate this for new nodes.
|
|
|
|
* Otherwise nodes will reload as undefined (T46619).
|
|
|
|
*/
|
2012-08-01 01:06:12 +02:00
|
|
|
void node_type_storage(struct bNodeType *ntype,
|
|
|
|
const char *storagename,
|
2013-03-18 17:34:57 +01: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));
|
2012-08-01 01:06:12 +02:00
|
|
|
void node_type_update(struct bNodeType *ntype,
|
2019-04-20 20:25:22 +02:00
|
|
|
void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node));
|
|
|
|
void node_type_group_update(struct bNodeType *ntype,
|
|
|
|
void (*group_update_func)(struct bNodeTree *ntree,
|
|
|
|
struct bNode *node));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 17:34:57 +01:00
|
|
|
void node_type_exec(struct bNodeType *ntype,
|
2021-03-05 17:35:25 +01:00
|
|
|
NodeInitExecFunction init_exec_fn,
|
|
|
|
NodeFreeExecFunction free_exec_fn,
|
|
|
|
NodeExecFunction exec_fn);
|
|
|
|
void node_type_gpu(struct bNodeType *ntype, NodeGPUExecFunction gpu_fn);
|
2011-09-05 23:01:50 +02:00
|
|
|
|
2018-03-13 15:58:46 +01:00
|
|
|
/** \} */
|
2015-02-13 21:27:09 +01:00
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Node Generic Functions
|
|
|
|
* \{ */
|
|
|
|
|
2014-07-23 16:33:29 +02:00
|
|
|
bool BKE_node_is_connected_to_output(struct bNodeTree *ntree, struct bNode *node);
|
|
|
|
|
2011-09-05 23:01:50 +02:00
|
|
|
/* ************** COMMON NODES *************** */
|
2011-02-07 10:33:36 +01:00
|
|
|
|
2013-03-18 17:34:57 +01:00
|
|
|
#define NODE_UNDEFINED -2 /* node type is not registered */
|
2021-10-15 21:08:52 +02:00
|
|
|
#define NODE_CUSTOM -1 /* for dynamically registered custom types */
|
2007-03-24 19:41:54 +01:00
|
|
|
#define NODE_GROUP 2
|
2015-11-12 08:52:58 +01:00
|
|
|
// #define NODE_FORLOOP 3 /* deprecated */
|
|
|
|
// #define NODE_WHILELOOP 4 /* deprecated */
|
2011-09-05 23:01:50 +02:00
|
|
|
#define NODE_FRAME 5
|
2012-06-01 14:38:03 +02:00
|
|
|
#define NODE_REROUTE 6
|
2013-03-18 17:34:57 +01: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 23:01:50 +02:00
|
|
|
|
2013-03-18 17:34:57 +01:00
|
|
|
void BKE_node_tree_unlink_id(ID *id, struct bNodeTree *ntree);
|
2011-09-05 23:01:50 +02:00
|
|
|
|
2015-02-13 21:27:09 +01:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Node Tree Iterator
|
|
|
|
*
|
2019-04-27 04:07:07 +02: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 17:34:57 +01:00
|
|
|
*
|
|
|
|
* Variables:
|
|
|
|
*
|
2019-04-27 04:07:07 +02:00
|
|
|
* - nodetree:
|
|
|
|
* The actual bNodeTree data block.
|
|
|
|
* Check nodetree->idname or nodetree->typeinfo to use only specific types.
|
2013-03-18 17:34:57 +01:00
|
|
|
*
|
2019-04-27 04:07:07 +02: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 17:34:57 +01:00
|
|
|
*
|
|
|
|
* Examples:
|
|
|
|
*
|
2015-02-13 21:27:09 +01:00
|
|
|
* \code{.c}
|
2018-11-30 05:22:01 +01:00
|
|
|
* FOREACH_NODETREE_BEGIN(bmain, nodetree, id) {
|
2013-03-18 17:34:57 +01:00
|
|
|
* if (id == nodetree)
|
|
|
|
* printf("This is a linkable node tree");
|
2018-11-30 05:22:01 +01:00
|
|
|
* } FOREACH_NODETREE_END;
|
2013-03-18 17:34:57 +01:00
|
|
|
*
|
2018-11-30 05:22:01 +01:00
|
|
|
* FOREACH_NODETREE_BEGIN(bmain, nodetree, id) {
|
2013-03-18 17:34:57 +01: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 05:22:01 +01:00
|
|
|
* } FOREACH_NODETREE_END;
|
2015-02-13 21:27:09 +01: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 14:06:05 +01:00
|
|
|
|
2013-03-26 23:37:41 +01:00
|
|
|
/* should be an opaque type, only for internal use by BKE_node_tree_iter_*** */
|
|
|
|
struct NodeTreeIterStore {
|
|
|
|
bNodeTree *ngroup;
|
|
|
|
Scene *scene;
|
2019-09-07 15:17:40 +02:00
|
|
|
struct Material *mat;
|
2013-03-26 23:37:41 +01:00
|
|
|
Tex *tex;
|
2019-09-07 15:17:40 +02:00
|
|
|
struct Light *light;
|
|
|
|
struct World *world;
|
|
|
|
struct FreestyleLineStyle *linestyle;
|
2020-04-20 12:56:16 +02:00
|
|
|
struct Simulation *simulation;
|
2013-03-26 23:37:41 +01: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 05:22:01 +01:00
|
|
|
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id) \
|
2013-03-18 17:34:57 +01:00
|
|
|
{ \
|
2013-03-26 23:37:41 +01:00
|
|
|
struct NodeTreeIterStore _nstore; \
|
2013-03-18 17:34:57 +01:00
|
|
|
bNodeTree *_nodetree; \
|
|
|
|
ID *_id; \
|
|
|
|
/* avoid compiler warning about unused variables */ \
|
2013-03-26 23:37:41 +01:00
|
|
|
BKE_node_tree_iter_init(&_nstore, bmain); \
|
|
|
|
while (BKE_node_tree_iter_step(&_nstore, &_nodetree, &_id) == true) { \
|
2013-03-18 17:34:57 +01:00
|
|
|
if (_nodetree) {
|
|
|
|
|
|
|
|
#define FOREACH_NODETREE_END \
|
|
|
|
} \
|
2013-03-26 23:37:41 +01:00
|
|
|
} \
|
2018-11-30 05:22:01 +01:00
|
|
|
} \
|
|
|
|
((void)0)
|
2021-12-14 05:49:31 +01:00
|
|
|
|
2015-02-13 21:27:09 +01:00
|
|
|
/** \} */
|
2012-10-01 09:54:37 +02: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 01:38:08 +01: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-13 21:27:09 +01:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Shader Nodes
|
2018-03-13 15:58:46 +01: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 16:42:51 +01:00
|
|
|
|
2021-07-03 15:08:40 +02:00
|
|
|
/* NOTE: types are needed to restore callbacks, don't change values. */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
//#define SH_NODE_MATERIAL 100
|
2008-02-10 00:17:15 +01: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 16:42:51 +01:00
|
|
|
#define SH_NODE_VALUE 102
|
|
|
|
#define SH_NODE_MIX_RGB 103
|
|
|
|
#define SH_NODE_VALTORGB 104
|
|
|
|
#define SH_NODE_RGBTOBW 105
|
2018-05-14 13:34:54 +02:00
|
|
|
#define SH_NODE_SHADERTORGB 106
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
//#define SH_NODE_TEXTURE 106
|
2005-12-30 12:25:15 +01:00
|
|
|
#define SH_NODE_NORMAL 107
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
//#define SH_NODE_GEOMETRY 108
|
2006-01-04 13:13:13 +01: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 12:41:06 +01:00
|
|
|
#define SH_NODE_CURVE_VEC 110
|
|
|
|
#define SH_NODE_CURVE_RGB 111
|
2006-12-22 09:10:29 +01:00
|
|
|
#define SH_NODE_CAMERA 114
|
2006-08-01 03:12:01 +02: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 19:41:54 +01:00
|
|
|
#define SH_NODE_SQUEEZE 117
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +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 08:55:02 +02: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 09:42:06 +02:00
|
|
|
#define SH_NODE_HUE_SAT 122
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-11-08 12:38:16 +01: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 12:38:16 +01:00
|
|
|
#define SH_NODE_FRESNEL 127
|
|
|
|
#define SH_NODE_MIX_SHADER 128
|
|
|
|
#define SH_NODE_ATTRIBUTE 129
|
|
|
|
#define SH_NODE_BACKGROUND 130
|
|
|
|
#define SH_NODE_BSDF_ANISOTROPIC 131
|
|
|
|
#define SH_NODE_BSDF_DIFFUSE 132
|
|
|
|
#define SH_NODE_BSDF_GLOSSY 133
|
|
|
|
#define SH_NODE_BSDF_GLASS 134
|
|
|
|
#define SH_NODE_BSDF_TRANSLUCENT 137
|
|
|
|
#define SH_NODE_BSDF_TRANSPARENT 138
|
|
|
|
#define SH_NODE_BSDF_VELVET 139
|
|
|
|
#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
|
|
|
|
#define SH_NODE_TEX_MUSGRAVE 152
|
|
|
|
#define SH_NODE_TEX_COORD 155
|
|
|
|
#define SH_NODE_ADD_SHADER 156
|
|
|
|
#define SH_NODE_TEX_ENVIRONMENT 157
|
2020-02-15 02:29:40 +01:00
|
|
|
// #define SH_NODE_OUTPUT_TEXTURE 158
|
2011-11-08 12:38:16 +01: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 22:24:38 +02:00
|
|
|
#define SH_NODE_GAMMA 163
|
|
|
|
#define SH_NODE_TEX_CHECKER 164
|
2012-01-24 17:32:31 +01:00
|
|
|
#define SH_NODE_BRIGHTCONTRAST 165
|
2012-05-07 22:24:38 +02:00
|
|
|
#define SH_NODE_LIGHT_FALLOFF 166
|
2012-05-21 14:52:28 +02:00
|
|
|
#define SH_NODE_OBJECT_INFO 167
|
2014-06-13 21:44:48 +02:00
|
|
|
#define SH_NODE_PARTICLE_INFO 168
|
2012-09-04 15:29:07 +02:00
|
|
|
#define SH_NODE_TEX_BRICK 169
|
2012-10-10 17:56:43 +02:00
|
|
|
#define SH_NODE_BUMP 170
|
2012-11-03 15:32:26 +01:00
|
|
|
#define SH_NODE_SCRIPT 171
|
2012-11-06 20:59:02 +01: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 15:21:30 +01:00
|
|
|
#define SH_NODE_HAIR_INFO 176
|
2013-04-01 22:26:52 +02:00
|
|
|
#define SH_NODE_SUBSURFACE_SCATTERING 177
|
2013-05-20 17:58:37 +02:00
|
|
|
#define SH_NODE_WIREFRAME 178
|
2013-05-23 19:45:20 +02:00
|
|
|
#define SH_NODE_BSDF_TOON 179
|
2013-06-09 22:46:22 +02:00
|
|
|
#define SH_NODE_WAVELENGTH 180
|
2013-06-13 10:55:51 +02:00
|
|
|
#define SH_NODE_BLACKBODY 181
|
2013-06-20 10:20:30 +02: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-16 01:58:00 +02:00
|
|
|
#define SH_NODE_BSDF_HAIR 185
|
2020-02-15 02:29:40 +01: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 09:20:40 +02:00
|
|
|
#define SH_NODE_OUTPUT_LINESTYLE 190
|
2014-07-20 05:14:31 +02: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 16:15:46 +01:00
|
|
|
#define SH_NODE_VECTOR_ROTATE 708
|
2021-09-30 20:05:08 +02: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
|
2011-11-08 12:38:16 +01:00
|
|
|
|
2015-02-13 21:27:09 +01:00
|
|
|
/** \} */
|
2007-03-24 19:41:54 +01:00
|
|
|
|
2015-02-13 21:27:09 +01:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Composite Nodes
|
2018-03-13 15:58:46 +01: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 23:05:47 +01:00
|
|
|
|
2007-03-24 19:41:54 +01:00
|
|
|
/* output socket defines */
|
2013-08-03 15:12:09 +02:00
|
|
|
#define RRES_OUT_IMAGE 0
|
|
|
|
#define RRES_OUT_ALPHA 1
|
2007-03-24 19:41:54 +01:00
|
|
|
|
2021-07-03 15:08:40 +02:00
|
|
|
/* NOTE: types are needed to restore callbacks, don't change values. */
|
2006-01-24 22:50:23 +01: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 23:05:47 +01: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 23:18:46 +01:00
|
|
|
#define CMP_NODE_MAP_VALUE 213
|
|
|
|
#define CMP_NODE_TIME 214
|
2006-01-31 22:49:05 +01: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 14:51:55 +01: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 14:28:44 +01:00
|
|
|
#define CMP_NODE_HUE_SAT 219
|
2007-03-24 19:41:54 +01:00
|
|
|
#define CMP_NODE_IMAGE 220
|
|
|
|
#define CMP_NODE_R_LAYERS 221
|
|
|
|
#define CMP_NODE_COMPOSITE 222
|
2006-01-24 22:50:23 +01:00
|
|
|
#define CMP_NODE_OUTPUT_FILE 223
|
2007-03-24 19:41:54 +01: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 04:24:35 +02:00
|
|
|
#define CMP_NODE_DILATEERODE 228
|
2007-03-24 19:41:54 +01: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 19:41:54 +01:00
|
|
|
#define CMP_NODE_DIFF_MATTE 235
|
2006-11-15 15:41:04 +01:00
|
|
|
#define CMP_NODE_COLOR_SPILL 236
|
2009-09-10 06:12:22 +02:00
|
|
|
#define CMP_NODE_CHROMA_MATTE 237
|
2007-01-09 05:32:39 +01:00
|
|
|
#define CMP_NODE_CHANNEL_MATTE 238
|
2007-03-24 19:41:54 +01:00
|
|
|
#define CMP_NODE_FLIP 239
|
2006-11-16 22:50:35 +01:00
|
|
|
#define CMP_NODE_SPLITVIEWER 240
|
2015-11-12 08:52:58 +01:00
|
|
|
// #define CMP_NODE_INDEX_MASK 241
|
2007-03-24 19:41:54 +01: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 19:41:54 +01:00
|
|
|
#define CMP_NODE_MATH 247
|
|
|
|
#define CMP_NODE_LUMA_MATTE 248
|
2007-04-13 05:23:39 +02:00
|
|
|
#define CMP_NODE_BRIGHTCONTRAST 249
|
2007-04-13 06:22:32 +02: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 08:55:02 +02:00
|
|
|
#define CMP_NODE_INVERT 251
|
2007-07-10 04:27:37 +02:00
|
|
|
#define CMP_NODE_NORMALIZE 252
|
2007-10-29 15:37:19 +01:00
|
|
|
#define CMP_NODE_CROP 253
|
2007-12-27 15:19:11 +01:00
|
|
|
#define CMP_NODE_DBLUR 254
|
2007-12-27 21:36:17 +01:00
|
|
|
#define CMP_NODE_BILATERALBLUR 255
|
2008-03-11 15:40:27 +01:00
|
|
|
#define CMP_NODE_PREMULKEY 256
|
2009-09-10 06:12:22 +02:00
|
|
|
#define CMP_NODE_DIST_MATTE 257
|
|
|
|
#define CMP_NODE_VIEW_LEVELS 258
|
|
|
|
#define CMP_NODE_COLOR_MATTE 259
|
2010-01-20 05:19:55 +01:00
|
|
|
#define CMP_NODE_COLORBALANCE 260
|
2010-01-21 01:00:45 +01:00
|
|
|
#define CMP_NODE_HUECORRECT 261
|
2011-11-07 13:56:05 +01:00
|
|
|
#define CMP_NODE_MOVIECLIP 262
|
|
|
|
#define CMP_NODE_STABILIZE2D 263
|
|
|
|
#define CMP_NODE_TRANSFORM 264
|
|
|
|
#define CMP_NODE_MOVIEDISTORTION 265
|
2012-01-10 20:08:08 +01:00
|
|
|
#define CMP_NODE_DOUBLEEDGEMASK 266
|
2012-03-01 08:56:15 +01: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 18:42:58 +02:00
|
|
|
#define CMP_NODE_MASK 268
|
2012-06-14 14:18:42 +02:00
|
|
|
#define CMP_NODE_KEYINGSCREEN 269
|
2012-06-14 14:19:13 +02:00
|
|
|
#define CMP_NODE_KEYING 270
|
2012-06-19 19:29:58 +02:00
|
|
|
#define CMP_NODE_TRACKPOS 271
|
2012-08-23 08:48:01 +02:00
|
|
|
#define CMP_NODE_INPAINT 272
|
|
|
|
#define CMP_NODE_DESPECKLE 273
|
2021-03-29 07:44:27 +02:00
|
|
|
#define CMP_NODE_ANTIALIASING 274
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2007-10-26 17:32:36 +02: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 17:32:36 +02: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 14:49:33 +02: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 10:36:10 +02:00
|
|
|
#define CMP_NODE_PIXELATE 318
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-14 20:53:46 +01: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 11:46:30 +02:00
|
|
|
#define CMP_NODE_PLANETRACKDEFORM 320
|
2014-03-11 14:07:49 +01:00
|
|
|
#define CMP_NODE_CORNERPIN 321
|
2015-04-06 15:40:12 +02: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 20:40:31 +01: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 21:22:30 +02: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-02 00:17:51 +01: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 20:53:46 +01: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 08:55:02 +02:00
|
|
|
/* channel toggles */
|
|
|
|
#define CMP_CHAN_RGB 1
|
|
|
|
#define CMP_CHAN_A 2
|
2007-04-13 05:23:39 +02:00
|
|
|
|
2007-03-26 01:54:39 +02:00
|
|
|
/* filter types */
|
|
|
|
#define CMP_FILT_SOFT 0
|
2022-02-09 10:27:35 +01:00
|
|
|
#define CMP_FILT_SHARP_BOX 1
|
2007-03-26 01:54:39 +02:00
|
|
|
#define CMP_FILT_LAPLACE 2
|
|
|
|
#define CMP_FILT_SOBEL 3
|
|
|
|
#define CMP_FILT_PREWITT 4
|
|
|
|
#define CMP_FILT_KIRSCH 5
|
|
|
|
#define CMP_FILT_SHADOW 6
|
2022-02-09 10:27:35 +01:00
|
|
|
#define CMP_FILT_SHARP_DIAMOND 7
|
2007-03-26 01:54:39 +02:00
|
|
|
|
|
|
|
/* scale node type, in custom1 */
|
2007-11-14 00:53:58 +01:00
|
|
|
#define CMP_SCALE_RELATIVE 0
|
|
|
|
#define CMP_SCALE_ABSOLUTE 1
|
|
|
|
#define CMP_SCALE_SCENEPERCENT 2
|
2010-07-08 22:58:34 +02:00
|
|
|
#define CMP_SCALE_RENDERPERCENT 3
|
2012-06-14 18:55:55 +02:00
|
|
|
/* custom2 */
|
|
|
|
#define CMP_SCALE_RENDERSIZE_FRAME_ASPECT (1 << 0)
|
|
|
|
#define CMP_SCALE_RENDERSIZE_FRAME_CROP (1 << 1)
|
2007-03-26 01:54:39 +02:00
|
|
|
|
2013-06-12 14:55:44 +02:00
|
|
|
/* track position node, in custom1 */
|
|
|
|
#define CMP_TRACKPOS_ABSOLUTE 0
|
|
|
|
#define CMP_TRACKPOS_RELATIVE_START 1
|
|
|
|
#define CMP_TRACKPOS_RELATIVE_FRAME 2
|
2013-06-12 16:28:36 +02:00
|
|
|
#define CMP_TRACKPOS_ABSOLUTE_FRAME 3
|
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 23:05:47 +01:00
|
|
|
|
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
|
|
|
/* Cryptomatte source. */
|
|
|
|
#define CMP_CRYPTOMATTE_SRC_RENDER 0
|
|
|
|
#define CMP_CRYPTOMATTE_SRC_IMAGE 1
|
|
|
|
|
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-13 21:27:09 +01:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Texture Nodes
|
2018-03-13 15:58:46 +01:00
|
|
|
* \{ */
|
2008-11-12 23:03:11 +01:00
|
|
|
|
|
|
|
struct TexResult;
|
|
|
|
|
2009-03-24 18:40:58 +01: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 18:40:58 +01:00
|
|
|
#define TEX_NODE_VALTONOR 421
|
|
|
|
#define TEX_NODE_SCALE 422
|
2009-06-13 16:22:40 +02: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 23:03:11 +01:00
|
|
|
|
2009-06-13 16:22:40 +02:00
|
|
|
/* 501-599 reserved. Use like this: TEX_NODE_PROC + TEX_CLOUDS, etc */
|
2009-03-24 18:40:58 +01:00
|
|
|
#define TEX_NODE_PROC 500
|
|
|
|
#define TEX_NODE_PROC_MAX 600
|
2008-11-12 23:03:11 +01:00
|
|
|
|
2015-02-13 21:27:09 +01:00
|
|
|
/** \} */
|
2008-11-12 23:03:11 +01:00
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Geometry Nodes
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
#define GEO_NODE_TRIANGULATE 1000
|
|
|
|
#define GEO_NODE_TRANSFORM 1002
|
2021-10-14 19:06:42 +02: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 19:06:42 +02:00
|
|
|
#define GEO_NODE_SUBDIVIDE_MESH 1029
|
2021-03-16 22:35:12 +01: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 18:09:35 +01:00
|
|
|
#define GEO_NODE_MESH_PRIMITIVE_GRID 1039
|
2021-04-06 23:02:55 +02: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 19:29:17 +02:00
|
|
|
#define GEO_NODE_CURVE_TO_MESH 1045
|
2021-10-14 19:06:42 +02:00
|
|
|
#define GEO_NODE_RESAMPLE_CURVE 1047
|
2021-05-20 12:29:06 +02:00
|
|
|
#define GEO_NODE_INPUT_MATERIAL 1050
|
2021-10-14 19:06:42 +02:00
|
|
|
#define GEO_NODE_REPLACE_MATERIAL 1051
|
2021-06-04 01:12:38 +02:00
|
|
|
#define GEO_NODE_CURVE_LENGTH 1054
|
2021-06-09 18:58:08 +02:00
|
|
|
#define GEO_NODE_CONVEX_HULL 1056
|
2021-06-16 05:31:57 +02:00
|
|
|
#define GEO_NODE_SEPARATE_COMPONENTS 1059
|
2021-06-30 05:00:29 +02:00
|
|
|
#define GEO_NODE_CURVE_PRIMITIVE_STAR 1062
|
2021-06-30 05:20:54 +02:00
|
|
|
#define GEO_NODE_CURVE_PRIMITIVE_SPIRAL 1063
|
2021-06-30 05:39:08 +02:00
|
|
|
#define GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER 1064
|
2021-06-30 07:03:55 +02:00
|
|
|
#define GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT 1065
|
2021-07-01 02:17:28 +02:00
|
|
|
#define GEO_NODE_CURVE_PRIMITIVE_CIRCLE 1066
|
2021-07-05 10:46:00 +02:00
|
|
|
#define GEO_NODE_VIEWER 1067
|
2021-07-05 19:27:12 +02:00
|
|
|
#define GEO_NODE_CURVE_PRIMITIVE_LINE 1068
|
2021-07-12 19:10:56 +02:00
|
|
|
#define GEO_NODE_CURVE_PRIMITIVE_QUADRILATERAL 1070
|
2021-10-14 19:06:42 +02: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 19:06:42 +02:00
|
|
|
#define GEO_NODE_CAPTURE_ATTRIBUTE 1080
|
2021-09-15 17:51:52 +02:00
|
|
|
#define GEO_NODE_MATERIAL_SELECTION 1081
|
2021-10-13 15:39:54 +02:00
|
|
|
#define GEO_NODE_SET_MATERIAL 1082
|
2021-09-20 12:37:52 +02:00
|
|
|
#define GEO_NODE_REALIZE_INSTANCES 1083
|
2021-09-21 01:39:39 +02:00
|
|
|
#define GEO_NODE_ATTRIBUTE_STATISTIC 1084
|
2021-10-14 19:06:42 +02:00
|
|
|
#define GEO_NODE_SAMPLE_CURVE 1085
|
2021-09-21 20:11:39 +02:00
|
|
|
#define GEO_NODE_INPUT_TANGENT 1086
|
2021-09-21 21:11:32 +02:00
|
|
|
#define GEO_NODE_STRING_JOIN 1087
|
2021-11-30 14:21:14 +01:00
|
|
|
#define GEO_NODE_CURVE_SPLINE_PARAMETER 1088
|
2021-10-14 19:06:42 +02: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 19:41:49 +02: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 19:14:13 +02:00
|
|
|
#define GEO_NODE_MESH_TO_POINTS 1093
|
|
|
|
#define GEO_NODE_POINTS_TO_VERTICES 1094
|
2021-10-14 19:06:42 +02:00
|
|
|
#define GEO_NODE_REVERSE_CURVE 1095
|
2021-09-28 22:21:36 +02:00
|
|
|
#define GEO_NODE_PROXIMITY 1096
|
2021-10-14 19:06:42 +02:00
|
|
|
#define GEO_NODE_SUBDIVIDE_CURVE 1097
|
2021-10-01 16:58:49 +02:00
|
|
|
#define GEO_NODE_INPUT_SPLINE_LENGTH 1098
|
2021-10-01 18:59:29 +02:00
|
|
|
#define GEO_NODE_CURVE_SPLINE_TYPE 1099
|
2022-03-02 23:58:17 +01:00
|
|
|
#define GEO_NODE_CURVE_SET_HANDLE_TYPE 1100
|
2021-10-03 14:54:05 +02:00
|
|
|
#define GEO_NODE_POINTS_TO_VOLUME 1101
|
2021-10-03 22:00:28 +02:00
|
|
|
#define GEO_NODE_CURVE_HANDLE_TYPE_SELECTION 1102
|
2021-10-11 15:38:02 +02:00
|
|
|
#define GEO_NODE_DELETE_GEOMETRY 1103
|
|
|
|
#define GEO_NODE_SEPARATE_GEOMETRY 1104
|
2021-10-11 18:03:57 +02:00
|
|
|
#define GEO_NODE_INPUT_RADIUS 1105
|
|
|
|
#define GEO_NODE_INPUT_CURVE_TILT 1106
|
|
|
|
#define GEO_NODE_INPUT_CURVE_HANDLES 1107
|
|
|
|
#define GEO_NODE_INPUT_SHADE_SMOOTH 1108
|
|
|
|
#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 15:39:54 +02:00
|
|
|
#define GEO_NODE_INPUT_MATERIAL_INDEX 1118
|
|
|
|
#define GEO_NODE_SET_MATERIAL_INDEX 1119
|
2021-10-13 16:02:05 +02:00
|
|
|
#define GEO_NODE_TRANSLATE_INSTANCES 1120
|
2021-10-13 16:08:02 +02:00
|
|
|
#define GEO_NODE_SCALE_INSTANCES 1121
|
2021-10-13 16:42:10 +02:00
|
|
|
#define GEO_NODE_ROTATE_INSTANCES 1122
|
2021-10-14 19:06:42 +02:00
|
|
|
#define GEO_NODE_SPLIT_EDGES 1123
|
2021-10-14 19:06:48 +02:00
|
|
|
#define GEO_NODE_MESH_TO_CURVE 1124
|
2021-10-15 21:08:52 +02:00
|
|
|
#define GEO_NODE_TRANSFER_ATTRIBUTE 1125
|
2021-10-15 22:12:04 +02:00
|
|
|
#define GEO_NODE_SUBDIVISION_SURFACE 1126
|
2021-10-18 13:45:16 +02:00
|
|
|
#define GEO_NODE_CURVE_ENDPOINT_SELECTION 1127
|
2021-10-19 16:01:39 +02:00
|
|
|
#define GEO_NODE_RAYCAST 1128
|
2021-10-20 17:25:49 +02:00
|
|
|
#define GEO_NODE_CURVE_TO_POINTS 1130
|
2021-10-23 07:01:59 +02: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 18:25:44 +02:00
|
|
|
#define GEO_NODE_VOLUME_TO_MESH 1133
|
2021-10-26 22:40:57 +02:00
|
|
|
#define GEO_NODE_INPUT_ID 1134
|
|
|
|
#define GEO_NODE_SET_ID 1135
|
2021-11-29 20:04:25 +01:00
|
|
|
#define GEO_NODE_ATTRIBUTE_DOMAIN_SIZE 1136
|
2021-12-01 17:11:50 +01:00
|
|
|
#define GEO_NODE_DUAL_MESH 1137
|
2021-12-06 18:58:08 +01: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 17:07:24 +01:00
|
|
|
#define GEO_NODE_INPUT_MESH_EDGE_NEIGHBORS 1143
|
2021-12-08 17:14:03 +01:00
|
|
|
#define GEO_NODE_INPUT_MESH_ISLAND 1144
|
2021-12-09 18:50:25 +01:00
|
|
|
#define GEO_NODE_INPUT_SCENE_TIME 1145
|
2021-12-29 17:24:29 +01:00
|
|
|
#define GEO_NODE_ACCUMULATE_FIELD 1146
|
2022-01-03 18:16:50 +01:00
|
|
|
#define GEO_NODE_INPUT_MESH_EDGE_ANGLE 1147
|
2022-01-18 16:25:37 +01:00
|
|
|
#define GEO_NODE_FIELD_AT_INDEX 1148
|
2022-01-20 19:06:25 +01:00
|
|
|
#define GEO_NODE_CURVE_PRIMITIVE_ARC 1149
|
2022-01-21 16:26:40 +01: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-24 05:42:49 +01:00
|
|
|
#define GEO_NODE_EXTRUDE_MESH 1152
|
2022-01-25 17:51:52 +01:00
|
|
|
#define GEO_NODE_MERGE_BY_DISTANCE 1153
|
2022-02-23 20:04:12 +01:00
|
|
|
#define GEO_NODE_DUPLICATE_ELEMENTS 1154
|
2022-02-23 21:19:08 +01:00
|
|
|
#define GEO_NODE_INPUT_MESH_FACE_IS_PLANAR 1155
|
2022-03-14 17:48:11 +01:00
|
|
|
#define GEO_NODE_STORE_NAMED_ATTRIBUTE 1156
|
|
|
|
#define GEO_NODE_INPUT_NAMED_ATTRIBUTE 1157
|
|
|
|
#define GEO_NODE_REMOVE_ATTRIBUTE 1158
|
2022-06-06 18:50:13 +02:00
|
|
|
#define GEO_NODE_INPUT_INSTANCE_ROTATION 1159
|
2022-06-06 19:02:59 +02: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 15:47:31 +02:00
|
|
|
#define GEO_NODE_POINTS 1162
|
2022-06-25 18:23:19 +02:00
|
|
|
#define GEO_NODE_FIELD_ON_DOMAIN 1163
|
2022-06-29 17:56:17 +02:00
|
|
|
#define GEO_NODE_MESH_TO_VOLUME 1164
|
2022-06-29 19:25:20 +02: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-02-23 16:08:16 +01: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 16:36:25 +01:00
|
|
|
#define FN_NODE_COMPARE 1202
|
2021-09-24 21:03:42 +02: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 23:03:14 +01:00
|
|
|
#define FN_NODE_INPUT_STRING 1208
|
2021-07-05 18:52:10 +02:00
|
|
|
#define FN_NODE_FLOAT_TO_INT 1209
|
2021-09-21 21:11:32 +02: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 17:59:52 +02:00
|
|
|
#define FN_NODE_INPUT_SPECIAL_CHARACTERS 1213
|
2021-09-24 21:03:42 +02:00
|
|
|
#define FN_NODE_RANDOM_VALUE 1214
|
2021-10-03 03:04:45 +02:00
|
|
|
#define FN_NODE_ROTATE_EULER 1215
|
2021-10-09 21:40:37 +02:00
|
|
|
#define FN_NODE_ALIGN_EULER_TO_VECTOR 1216
|
2021-10-12 00:02:17 +02:00
|
|
|
#define FN_NODE_INPUT_COLOR 1217
|
2021-10-19 22:27:47 +02: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
|
2020-04-20 15:27:12 +02:00
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
2020-11-06 06:43:09 +01:00
|
|
|
void BKE_node_system_init(void);
|
|
|
|
void BKE_node_system_exit(void);
|
2007-03-26 17:07:38 +02:00
|
|
|
|
2019-02-23 09:17:30 +01:00
|
|
|
extern struct bNodeType NodeTypeUndefined;
|
|
|
|
extern struct bNodeSocketType NodeSocketTypeUndefined;
|
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2021-12-07 15:09:30 +01:00
|
|
|
|
2021-12-15 16:51:57 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
namespace blender::bke {
|
|
|
|
|
|
|
|
bNodeSocket *node_find_enabled_socket(bNode &node, eNodeSocketInOut in_out, StringRef name);
|
|
|
|
bNodeSocket *node_find_enabled_input_socket(bNode &node, StringRef name);
|
|
|
|
bNodeSocket *node_find_enabled_output_socket(bNode &node, StringRef name);
|
|
|
|
|
|
|
|
} // namespace blender::bke
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2021-12-07 15:09:30 +01:00
|
|
|
#define NODE_STORAGE_FUNCS(StorageT) \
|
|
|
|
[[maybe_unused]] static StorageT &node_storage(bNode &node) \
|
|
|
|
{ \
|
|
|
|
return *static_cast<StorageT *>(node.storage); \
|
|
|
|
} \
|
|
|
|
[[maybe_unused]] static const StorageT &node_storage(const bNode &node) \
|
|
|
|
{ \
|
|
|
|
return *static_cast<const StorageT *>(node.storage); \
|
|
|
|
}
|