2011-02-18 13:05:18 +00:00
|
|
|
/*
|
2005-12-18 13:46:01 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2011-11-29 10:54:47 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2005-12-18 13:46:01 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-12-18 13:46:01 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
2005-12-18 13:46:01 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
2011-02-18 13:05:18 +00:00
|
|
|
*/
|
|
|
|
|
2018-11-07 12:17:58 +11:00
|
|
|
#include "BLI_compiler_compat.h"
|
2013-08-25 21:29:33 +00:00
|
|
|
#include "BLI_ghash.h"
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
#include "DNA_listBase.h"
|
|
|
|
|
2018-11-30 15:22:01 +11:00
|
|
|
/* for FOREACH_NODETREE_BEGIN */
|
2013-03-18 16:34:57 +00:00
|
|
|
#include "DNA_node_types.h"
|
|
|
|
|
|
|
|
#include "RNA_types.h"
|
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2008-05-01 22:28:18 +00:00
|
|
|
/* not very important, but the stack solver likes to know a maximum */
|
2017-03-24 14:36:00 +01:00
|
|
|
#define MAX_SOCKET 512
|
2007-03-24 18:41:54 +00:00
|
|
|
|
2019-01-28 21:08:24 +11:00
|
|
|
struct ARegion;
|
2020-09-30 11:51:13 +10:00
|
|
|
struct BlendDataReader;
|
|
|
|
struct BlendExpander;
|
|
|
|
struct BlendLibReader;
|
|
|
|
struct BlendWriter;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct ColorManagedDisplaySettings;
|
|
|
|
struct ColorManagedViewSettings;
|
2019-09-07 23:17:40 +10:00
|
|
|
struct FreestyleLineStyle;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
struct GPUMaterial;
|
|
|
|
struct GPUNodeStack;
|
2010-08-04 04:01:27 +00:00
|
|
|
struct ID;
|
2013-03-05 03:44:47 +00:00
|
|
|
struct ImBuf;
|
2012-02-22 12:59:43 +00:00
|
|
|
struct ImageFormatData;
|
2019-09-07 23:17:40 +10:00
|
|
|
struct Light;
|
2010-08-04 04:01:27 +00:00
|
|
|
struct ListBase;
|
|
|
|
struct MTex;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct Main;
|
2019-09-07 23:17:40 +10:00
|
|
|
struct Material;
|
2009-09-16 18:59:13 +00:00
|
|
|
struct PointerRNA;
|
2010-08-04 04:01:27 +00:00
|
|
|
struct RenderData;
|
|
|
|
struct Scene;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct SpaceNode;
|
2010-08-04 04:01:27 +00:00
|
|
|
struct Tex;
|
2019-09-07 23:17:40 +10:00
|
|
|
struct World;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bContext;
|
|
|
|
struct bNode;
|
|
|
|
struct bNodeExecContext;
|
|
|
|
struct bNodeExecData;
|
2013-03-18 16:34:57 +00:00
|
|
|
struct bNodeInstanceHash;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bNodeLink;
|
|
|
|
struct bNodeSocket;
|
|
|
|
struct bNodeStack;
|
|
|
|
struct bNodeTree;
|
|
|
|
struct bNodeTreeExec;
|
|
|
|
struct bNodeTreeType;
|
|
|
|
struct uiLayout;
|
2005-12-18 13:46:01 +00:00
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Node Type Definitions
|
|
|
|
* \{ */
|
2005-12-20 15:43:55 +00:00
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
* \brief Compact definition of a node socket.
|
|
|
|
*
|
2011-09-05 21:01:50 +00:00
|
|
|
* Can be used to quickly define a list of static sockets for a node,
|
2018-06-01 18:19:39 +02:00
|
|
|
* which are added to each new node of that type.
|
2011-09-05 21:01:50 +00:00
|
|
|
*
|
2013-03-18 16:34:57 +00:00
|
|
|
* \deprecated This struct is used by C nodes to define templates as simple
|
|
|
|
* static struct lists. These are converted to the new template collections
|
|
|
|
* in RNA types automatically.
|
2011-09-05 21:01:50 +00:00
|
|
|
*/
|
|
|
|
typedef struct bNodeSocketTemplate {
|
Nodes: Support storing socket link limits in bNodeSocketType
Currently the link limit of sockets is stored in bNodeSocket->limit.
This allows for a lot of flexibility, but is also very redundant.
In every case I've had to deal with so far, it would have "more correct"
to set the link limit per socket type and not per socket. I did not enforce
this constraint yet, because the link limit is exposed in the Python API,
which I did not want to break here.
In the future it might even make sense to only support only three kinds of link limits:
a) no links, b) at most one link, c) an arbitrary number links links. The other link
limits usually don't work well with tools (e.g. which link should be removed when a new
one is connected?) and is not used in practice. However, that is for another day.
Eventually, I would like to get rid of bNodeSocket->limit completely and replace it
either with fixed link limits or a callback in bNodeSocketType.
This patch consists of three parts:
**1. Support defining link limit in socket type**
This introduces a new `nodeSocketLinkLimit` function that serves as an indirection to
hide where the link limit of a socket is defined.
**2. Define link limits for builtin sockets on socket type**
Data sockets: one input, many outputs
Virtual sockets: one input, one output
Undefined sockets: many inputs, many outputs (to avoid that links are removed when the type of the socket is not known)
**3. Remove `bNodeSocketTemplate->limit`**
This wasn't used anymore after the second commit. Removing it simplifies socket definitions
in hundreds of places and removes a lot of redundancy.
Differential Revision: https://developer.blender.org/D7038
Reviewers: brecht
2020-03-06 12:20:05 +01:00
|
|
|
int type;
|
2012-01-11 08:51:06 +00:00
|
|
|
char name[64]; /* MAX_NAME */
|
2011-09-05 21:01:50 +00:00
|
|
|
float val1, val2, val3, val4; /* default alloc value for inputs */
|
|
|
|
float min, max;
|
2012-11-27 16:19:52 +00:00
|
|
|
int subtype; /* would use PropertySubType but this is a bad level include to use RNA */
|
2011-11-07 17:30:52 +00:00
|
|
|
int flag;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
/* after this line is used internal only */
|
2011-09-05 21:01:50 +00:00
|
|
|
struct bNodeSocket *sock; /* used to hold verified socket */
|
2013-03-18 16:34:57 +00:00
|
|
|
char identifier[64]; /* generated from name */
|
2011-09-05 21:01:50 +00:00
|
|
|
} bNodeSocketTemplate;
|
|
|
|
|
2020-07-07 18:23:33 +02:00
|
|
|
/* Use `void *` for callbacks that require C++. This is rather ugly, but works well for now. This
|
|
|
|
* would not be necessary if we would use bNodeSocketType and bNodeType only in C++ code.
|
|
|
|
* However, achieving this requires quite a few changes currently. */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
namespace blender {
|
2020-07-17 11:36:59 +02:00
|
|
|
namespace nodes {
|
2020-07-07 18:23:33 +02:00
|
|
|
class SocketMFNetworkBuilder;
|
|
|
|
class NodeMFNetworkBuilder;
|
2020-12-02 13:25:25 +01:00
|
|
|
class GeoNodeExecParams;
|
2020-07-17 11:36:59 +02:00
|
|
|
} // namespace nodes
|
2020-07-07 18:23:33 +02:00
|
|
|
namespace fn {
|
2020-12-02 13:25:25 +01:00
|
|
|
class CPPType;
|
2020-07-07 18:23:33 +02:00
|
|
|
class MFDataType;
|
2020-12-02 13:25:25 +01:00
|
|
|
} // namespace fn
|
2020-07-07 18:23:33 +02:00
|
|
|
} // namespace blender
|
|
|
|
|
2020-07-17 11:36:59 +02:00
|
|
|
using NodeExpandInMFNetworkFunction = void (*)(blender::nodes::NodeMFNetworkBuilder &builder);
|
2020-12-02 13:25:25 +01:00
|
|
|
using NodeGeometryExecFunction = void (*)(blender::nodes::GeoNodeExecParams params);
|
|
|
|
using SocketGetCPPTypeFunction = const blender::fn::CPPType *(*)();
|
|
|
|
using SocketGetCPPValueFunction = void (*)(const struct bNodeSocket &socket, void *r_value);
|
2020-07-17 11:36:59 +02:00
|
|
|
using SocketExpandInMFNetworkFunction = void (*)(blender::nodes::SocketMFNetworkBuilder &builder);
|
2020-07-07 18:23:33 +02:00
|
|
|
|
|
|
|
#else
|
|
|
|
typedef void *NodeExpandInMFNetworkFunction;
|
|
|
|
typedef void *SocketExpandInMFNetworkFunction;
|
2020-12-02 13:25:25 +01:00
|
|
|
typedef void *NodeGeometryExecFunction;
|
|
|
|
typedef void *SocketGetCPPTypeFunction;
|
|
|
|
typedef void *SocketGetCPPValueFunction;
|
2020-07-07 18:23:33 +02:00
|
|
|
#endif
|
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
* \brief Defines a socket type.
|
|
|
|
*
|
2011-09-05 21:01:50 +00:00
|
|
|
* Defines the appearance and behavior of a socket in the UI.
|
|
|
|
*/
|
|
|
|
typedef struct bNodeSocketType {
|
2013-03-18 16:34:57 +00:00
|
|
|
char idname[64]; /* identifier name */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-05-08 14:58:41 +00:00
|
|
|
void (*draw)(struct bContext *C,
|
|
|
|
struct uiLayout *layout,
|
|
|
|
struct PointerRNA *ptr,
|
|
|
|
struct PointerRNA *node_ptr,
|
|
|
|
const char *text);
|
2013-03-18 16:34:57 +00:00
|
|
|
void (*draw_color)(struct bContext *C,
|
|
|
|
struct PointerRNA *ptr,
|
|
|
|
struct PointerRNA *node_ptr,
|
|
|
|
float *r_color);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00: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,
|
|
|
|
struct bNodeSocket *stemp,
|
|
|
|
struct StructRNA *data_srna);
|
|
|
|
void (*interface_init_socket)(struct bNodeTree *ntree,
|
|
|
|
struct bNodeSocket *stemp,
|
2013-03-28 10:32:04 +00:00
|
|
|
struct bNode *node,
|
|
|
|
struct bNodeSocket *sock,
|
|
|
|
const char *data_path);
|
|
|
|
void (*interface_verify_socket)(struct bNodeTree *ntree,
|
2013-03-18 16:34:57 +00:00
|
|
|
struct bNodeSocket *stemp,
|
|
|
|
struct bNode *node,
|
|
|
|
struct bNodeSocket *sock,
|
|
|
|
const char *data_path);
|
|
|
|
void (*interface_from_socket)(struct bNodeTree *ntree,
|
2013-03-28 10:32:04 +00:00
|
|
|
struct bNodeSocket *stemp,
|
2013-03-18 16:34:57 +00:00
|
|
|
struct bNode *node,
|
|
|
|
struct bNodeSocket *sock);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* RNA integration */
|
|
|
|
ExtensionRNA ext_socket;
|
|
|
|
ExtensionRNA ext_interface;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* for standard socket types in C */
|
|
|
|
int type, subtype;
|
2020-02-28 13:28:16 +01:00
|
|
|
|
Nodes: Support storing socket link limits in bNodeSocketType
Currently the link limit of sockets is stored in bNodeSocket->limit.
This allows for a lot of flexibility, but is also very redundant.
In every case I've had to deal with so far, it would have "more correct"
to set the link limit per socket type and not per socket. I did not enforce
this constraint yet, because the link limit is exposed in the Python API,
which I did not want to break here.
In the future it might even make sense to only support only three kinds of link limits:
a) no links, b) at most one link, c) an arbitrary number links links. The other link
limits usually don't work well with tools (e.g. which link should be removed when a new
one is connected?) and is not used in practice. However, that is for another day.
Eventually, I would like to get rid of bNodeSocket->limit completely and replace it
either with fixed link limits or a callback in bNodeSocketType.
This patch consists of three parts:
**1. Support defining link limit in socket type**
This introduces a new `nodeSocketLinkLimit` function that serves as an indirection to
hide where the link limit of a socket is defined.
**2. Define link limits for builtin sockets on socket type**
Data sockets: one input, many outputs
Virtual sockets: one input, one output
Undefined sockets: many inputs, many outputs (to avoid that links are removed when the type of the socket is not known)
**3. Remove `bNodeSocketTemplate->limit`**
This wasn't used anymore after the second commit. Removing it simplifies socket definitions
in hundreds of places and removes a lot of redundancy.
Differential Revision: https://developer.blender.org/D7038
Reviewers: brecht
2020-03-06 12:20:05 +01:00
|
|
|
/* When set, bNodeSocket->limit does not have any effect anymore. */
|
|
|
|
bool use_link_limits_of_type;
|
|
|
|
int input_link_limit;
|
|
|
|
int output_link_limit;
|
|
|
|
|
2020-02-28 13:28:16 +01:00
|
|
|
/* Callback to free the socket type. */
|
|
|
|
void (*free_self)(struct bNodeSocketType *stype);
|
2020-07-07 18:23:33 +02:00
|
|
|
|
|
|
|
/* Expands the socket into a multi-function node that outputs the socket value. */
|
|
|
|
SocketExpandInMFNetworkFunction expand_in_mf_network;
|
2020-12-02 13:25:25 +01:00
|
|
|
/* Return the CPPType of this socket. */
|
|
|
|
SocketGetCPPTypeFunction get_cpp_type;
|
|
|
|
/* Get the value of this socket in a generic way. */
|
|
|
|
SocketGetCPPValueFunction get_cpp_value;
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
} bNodeSocketType;
|
Orange; daily noodler update commit.
- Adding execution code for Node trees. Was a bit a puzzle, since I want
it to be multithreading by design. This now is solved by defining a
stack per tree for all data that's being written into. This stack, which
resides now in the NodeTree itself, then can be allocated per thread.
- For testing pleasure, I've added a 'mix node' and a 'show node', so
you can already see it do something. :)
- reshuffled structure, to put things nice together, and have easier node
adding. Current state is still WIP though, structure might change.
For the record; new file node_shaders.c will contain all shader node
definitions, apart from the drawing callbacks.
Next: I'm going to check on Andrea's work on icons now, since this is very
much needed for true shader/composit work.
Now back to release work...
2005-12-21 14:24:51 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
typedef void *(*NodeInitExecFunction)(struct bNodeExecContext *context,
|
|
|
|
struct bNode *node,
|
|
|
|
bNodeInstanceKey key);
|
2013-10-29 17:46:01 +00:00
|
|
|
typedef void (*NodeFreeExecFunction)(void *nodedata);
|
2013-03-18 16:34:57 +00:00
|
|
|
typedef void (*NodeExecFunction)(void *data,
|
|
|
|
int thread,
|
|
|
|
struct bNode *,
|
|
|
|
struct bNodeExecData *execdata,
|
|
|
|
struct bNodeStack **in,
|
|
|
|
struct bNodeStack **out);
|
|
|
|
typedef int (*NodeGPUExecFunction)(struct GPUMaterial *mat,
|
|
|
|
struct bNode *node,
|
|
|
|
struct bNodeExecData *execdata,
|
|
|
|
struct GPUNodeStack *in,
|
|
|
|
struct GPUNodeStack *out);
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
* \brief Defines a node type.
|
|
|
|
*
|
2011-09-05 21:01:50 +00:00
|
|
|
* Initial attributes and constants for a node as well as callback functions
|
|
|
|
* implementing the node behavior.
|
|
|
|
*/
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
typedef struct bNodeType {
|
2012-04-29 15:47:02 +00:00
|
|
|
void *next, *prev;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
char idname[64]; /* identifier name */
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
int type;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
char ui_name[64]; /* MAX_NAME */
|
|
|
|
char ui_description[256];
|
|
|
|
int ui_icon;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
float width, minwidth, maxwidth;
|
2011-09-05 21:01:50 +00:00
|
|
|
float height, minheight, maxheight;
|
2018-07-05 19:18:43 +02:00
|
|
|
short nclass, flag;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* templates for static sockets */
|
|
|
|
bNodeSocketTemplate *inputs, *outputs;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
char storagename[64]; /* struct name for DNA */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-10-10 11:33:20 +00:00
|
|
|
/* Main draw function for the node */
|
|
|
|
void (*draw_nodetype)(const struct bContext *C,
|
2020-03-06 16:56:42 +01:00
|
|
|
struct ARegion *region,
|
2013-10-10 11:33:20 +00:00
|
|
|
struct SpaceNode *snode,
|
2013-03-18 16:34:57 +00:00
|
|
|
struct bNodeTree *ntree,
|
|
|
|
struct bNode *node,
|
|
|
|
bNodeInstanceKey key);
|
2013-10-10 11:33:20 +00:00
|
|
|
/* Updates the node geometry attributes according to internal state before actual drawing */
|
|
|
|
void (*draw_nodetype_prepare)(const struct bContext *C,
|
|
|
|
struct bNodeTree *ntree,
|
|
|
|
struct bNode *node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-10-10 11:33:20 +00:00
|
|
|
/* Draw the option buttons on the node */
|
|
|
|
void (*draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr);
|
|
|
|
/* Additional parameters in the side panel */
|
|
|
|
void (*draw_buttons_ex)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-10-10 11:33:20 +00:00
|
|
|
/* Additional drawing on backdrop */
|
|
|
|
void (*draw_backdrop)(
|
|
|
|
struct SpaceNode *snode, struct ImBuf *backdrop, struct bNode *node, int x, int y);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-10-28 03:13:49 +11:00
|
|
|
/**
|
|
|
|
* Optional custom label function for the node header.
|
|
|
|
* \note Used as a fallback when #bNode.label isn't set.
|
|
|
|
*/
|
2013-11-12 18:18:04 +00:00
|
|
|
void (*labelfunc)(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
|
2011-09-05 21:01:50 +00:00
|
|
|
/** Optional custom resize handle polling. */
|
|
|
|
int (*resize_area_func)(struct bNode *node, int x, int y);
|
2012-06-01 12:38:03 +00:00
|
|
|
/** Optional selection area polling. */
|
|
|
|
int (*select_area_func)(struct bNode *node, int x, int y);
|
|
|
|
/** Optional tweak area polling (for grabbing). */
|
|
|
|
int (*tweak_area_func)(struct bNode *node, int x, int y);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/** Called when the node is updated in the editor. */
|
|
|
|
void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node);
|
|
|
|
/** Check and update if internal ID data has changed. */
|
2019-04-20 20:25:22 +02:00
|
|
|
void (*group_update_func)(struct bNodeTree *ntree, struct bNode *node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/** Initialize a new node instance of this type after creation. */
|
2013-03-18 16:34:57 +00: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 16:34:57 +00:00
|
|
|
/* Registerable API callback versions, called in addition to C callbacks */
|
|
|
|
void (*initfunc_api)(const struct bContext *C, struct PointerRNA *ptr);
|
|
|
|
void (*freefunc_api)(struct PointerRNA *ptr);
|
2019-06-03 17:08:25 +02:00
|
|
|
void (*copyfunc_api)(struct PointerRNA *ptr, const struct bNode *src_node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* can this node type be added to a node tree */
|
2018-07-02 11:47:00 +02:00
|
|
|
bool (*poll)(struct bNodeType *ntype, struct bNodeTree *nodetree);
|
2013-03-18 16:34:57 +00:00
|
|
|
/* can this node be added to a node tree */
|
2018-07-02 11:47:00 +02:00
|
|
|
bool (*poll_instance)(struct bNode *node, struct bNodeTree *nodetree);
|
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);
|
2012-10-25 16:49:06 +00:00
|
|
|
/* Update the internal links list, for muting and disconnect operators. */
|
|
|
|
void (*update_internal_links)(struct bNodeTree *, struct bNode *node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-02-28 13:28:16 +01:00
|
|
|
void (*free_self)(struct bNodeType *ntype);
|
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* **** execution callbacks **** */
|
2021-03-05 17:35:25 +01:00
|
|
|
NodeInitExecFunction init_exec_fn;
|
|
|
|
NodeFreeExecFunction free_exec_fn;
|
|
|
|
NodeExecFunction exec_fn;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
/* gpu */
|
2021-03-05 17:35:25 +01:00
|
|
|
NodeGPUExecFunction gpu_fn;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-07-07 18:23:33 +02:00
|
|
|
/* Expands the bNode into nodes in a multi-function network, which will be evaluated later on. */
|
|
|
|
NodeExpandInMFNetworkFunction expand_in_mf_network;
|
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
/* Execute a geometry node. */
|
|
|
|
NodeGeometryExecFunction geometry_node_execute;
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* RNA integration */
|
2020-04-03 18:24:08 +02:00
|
|
|
ExtensionRNA rna_ext;
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
} bNodeType;
|
|
|
|
|
Four-in-one commit:
(NOTE: new include dependency in Render module, might need MSVC update!
It has to include the imbuf/intern/openexr/ directory in search path)
-> New Composite node: "Hue Saturation".
Works like the former 'post process' menu. There's no gamma, brightness or
multiply needed in this node, for that the Curves Node functions better.
-> Enabled Toolbox in Node editor
This now also replaces the SHIFT+A for adding nodes. The nodes are
automatically added to the menus, using the 'class' category from the
type definition.
Current classes are (compositor examples):
Inputs: RenderResult, Image
Outputs: Composite, Viewer
Color Ops: RGB Curves, Mix, Hue Saturation, AlphaOver
Vector Ops: Normal, Vector Curves, Map Value
Filters: Filter, Blur, VectorBlur
Convertors: ColorRamp, RGBtoBW, Separate RGBA, Separate HSVA, Set Alpha
Generators: RGB, Value, Time
Groups: the list of custom defined nodes
-> OpenEXR tile saving support
Created an API for for saving tile-based Images with an unlimited amount
of layers/channels. I've tested it for 'render result' now, with the idea
that this can (optionally) replace the current inserting of tiles in the
main result buffers. Especially with a lot of layers, the used memory for
these buffers can easily go into the 100s of megs.
Two other advantages:
- all 'render result' layers can be saved entirely in a single file, for
later use in compositing, also for animation output.
- on each render, per scene, a unique temp file can be stored, allowing
to re-use these temp files on starting Blender or loading files, showing
the last result of a render command.
The option is currently disabled, needs more work... but I had to commit
this because of the rest of the work I did!
-> Bug fix
The Image node didn't call an execute event when browsing another image.
2006-02-18 13:28:44 +00:00
|
|
|
/* nodetype->nclass, for add-menu and themes */
|
2011-09-05 21:01:50 +00:00
|
|
|
#define NODE_CLASS_INPUT 0
|
|
|
|
#define NODE_CLASS_OUTPUT 1
|
|
|
|
#define NODE_CLASS_OP_COLOR 3
|
|
|
|
#define NODE_CLASS_OP_VECTOR 4
|
|
|
|
#define NODE_CLASS_OP_FILTER 5
|
|
|
|
#define NODE_CLASS_GROUP 6
|
2015-11-12 18:52:58 +11:00
|
|
|
// #define NODE_CLASS_FILE 7
|
2011-09-05 21:01:50 +00:00
|
|
|
#define NODE_CLASS_CONVERTOR 8
|
|
|
|
#define NODE_CLASS_MATTE 9
|
|
|
|
#define NODE_CLASS_DISTORT 10
|
2015-11-12 18:52:58 +11:00
|
|
|
// #define NODE_CLASS_OP_DYNAMIC 11 /* deprecated */
|
2011-09-05 21:01:50 +00:00
|
|
|
#define NODE_CLASS_PATTERN 12
|
|
|
|
#define NODE_CLASS_TEXTURE 13
|
2015-11-12 18:52:58 +11:00
|
|
|
// #define NODE_CLASS_EXECUTION 14
|
|
|
|
// #define NODE_CLASS_GETDATA 15
|
|
|
|
// #define NODE_CLASS_SETDATA 16
|
|
|
|
// #define NODE_CLASS_MATH 17
|
|
|
|
// #define NODE_CLASS_MATH_VECTOR 18
|
|
|
|
// #define NODE_CLASS_MATH_ROTATION 19
|
|
|
|
// #define NODE_CLASS_PARTICLES 25
|
|
|
|
// #define NODE_CLASS_TRANSFORM 30
|
|
|
|
// #define NODE_CLASS_COMBINE 31
|
2012-11-03 14:32:26 +00:00
|
|
|
#define NODE_CLASS_SCRIPT 32
|
2013-03-18 16:34:57 +00:00
|
|
|
#define NODE_CLASS_INTERFACE 33
|
2011-11-02 19:24:30 +00:00
|
|
|
#define NODE_CLASS_SHADER 40
|
2020-12-01 10:28:29 -05:00
|
|
|
#define NODE_CLASS_GEOMETRY 41
|
|
|
|
#define NODE_CLASS_ATTRIBUTE 42
|
2011-09-05 21:01:50 +00:00
|
|
|
#define NODE_CLASS_LAYOUT 100
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
|
2012-05-22 14:13:33 +00:00
|
|
|
/* node resize directions */
|
|
|
|
#define NODE_RESIZE_TOP 1
|
|
|
|
#define NODE_RESIZE_BOTTOM 2
|
|
|
|
#define NODE_RESIZE_RIGHT 4
|
|
|
|
#define NODE_RESIZE_LEFT 8
|
|
|
|
|
2013-02-22 10:46:27 +00:00
|
|
|
typedef enum eNodeSizePreset {
|
|
|
|
NODE_SIZE_DEFAULT,
|
|
|
|
NODE_SIZE_SMALL,
|
2013-05-21 20:21:46 +00:00
|
|
|
NODE_SIZE_MIDDLE,
|
2019-04-16 16:40:47 +02:00
|
|
|
NODE_SIZE_LARGE,
|
2013-02-22 10:46:27 +00:00
|
|
|
} eNodeSizePreset;
|
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
struct bNodeTreeExec;
|
|
|
|
|
2011-11-07 22:14:48 +00:00
|
|
|
typedef void (*bNodeClassCallback)(void *calldata, int nclass, const char *name);
|
2012-06-06 22:38:39 +00:00
|
|
|
typedef struct bNodeTreeType {
|
2011-09-05 21:01:50 +00:00
|
|
|
int type; /* type identifier */
|
2013-03-18 16:34:57 +00:00
|
|
|
char idname[64]; /* identifier name */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
char ui_name[64];
|
|
|
|
char ui_description[256];
|
|
|
|
int ui_icon;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* callbacks */
|
|
|
|
void (*free_cache)(struct bNodeTree *ntree);
|
|
|
|
void (*free_node_cache)(struct bNodeTree *ntree, struct bNode *node);
|
2019-08-14 23:29:46 +10:00
|
|
|
/* Iteration over all node classes. */
|
|
|
|
void (*foreach_nodeclass)(struct Scene *scene, void *calldata, bNodeClassCallback func);
|
2013-03-18 16:34:57 +00:00
|
|
|
/* Check visibility in the node editor */
|
2018-07-02 11:47:00 +02:00
|
|
|
bool (*poll)(const struct bContext *C, struct bNodeTreeType *ntreetype);
|
2013-03-18 16:34:57 +00:00
|
|
|
/* Select a node tree from the context */
|
|
|
|
void (*get_from_context)(const struct bContext *C,
|
|
|
|
struct bNodeTreeType *ntreetype,
|
|
|
|
struct bNodeTree **r_ntree,
|
|
|
|
struct ID **r_id,
|
|
|
|
struct ID **r_from);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* calls allowing threaded composite */
|
|
|
|
void (*localize)(struct bNodeTree *localtree, struct bNodeTree *ntree);
|
|
|
|
void (*local_sync)(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
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* Tree update. Overrides nodetype->updatetreefunc! */
|
|
|
|
void (*update)(struct bNodeTree *ntree);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
bool (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link);
|
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
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* RNA integration */
|
2020-04-03 18:24:08 +02:00
|
|
|
ExtensionRNA rna_ext;
|
2011-09-05 21:01:50 +00:00
|
|
|
} bNodeTreeType;
|
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/** \} */
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Generic API, Trees
|
|
|
|
* \{ */
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
struct bNodeTreeType *ntreeTypeFind(const char *idname);
|
2013-03-18 18:25:05 +00:00
|
|
|
void ntreeTypeAdd(struct bNodeTreeType *nt);
|
2015-05-11 12:39:39 +10:00
|
|
|
void ntreeTypeFreeLink(const struct bNodeTreeType *nt);
|
2013-03-19 13:40:16 +00:00
|
|
|
bool ntreeIsRegistered(struct bNodeTree *ntree);
|
2013-03-18 16:34:57 +00:00
|
|
|
struct GHashIterator *ntreeTypeGetIterator(void);
|
|
|
|
|
|
|
|
/* helper macros for iterating over tree types */
|
|
|
|
#define NODE_TREE_TYPES_BEGIN(ntype) \
|
|
|
|
{ \
|
|
|
|
GHashIterator *__node_tree_type_iter__ = ntreeTypeGetIterator(); \
|
2013-05-08 12:58:11 +00:00
|
|
|
for (; !BLI_ghashIterator_done(__node_tree_type_iter__); \
|
|
|
|
BLI_ghashIterator_step(__node_tree_type_iter__)) { \
|
2021-02-02 09:51:38 -06:00
|
|
|
bNodeTreeType *ntype = (bNodeTreeType *)BLI_ghashIterator_getValue(__node_tree_type_iter__);
|
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
#define NODE_TREE_TYPES_END \
|
|
|
|
} \
|
|
|
|
BLI_ghashIterator_free(__node_tree_type_iter__); \
|
2013-09-13 08:45:20 +00:00
|
|
|
} \
|
|
|
|
(void)0
|
2013-03-18 16:34:57 +00:00
|
|
|
|
|
|
|
void ntreeSetTypes(const struct bContext *C, struct bNodeTree *ntree);
|
|
|
|
|
2019-08-22 16:00:59 +02:00
|
|
|
struct bNodeTree *ntreeAddTree(struct Main *bmain, const char *name, const char *idname);
|
2007-03-26 15:07:38 +00:00
|
|
|
|
2012-08-22 08:54:18 +00:00
|
|
|
/* copy/free funcs, need to manage ID users */
|
|
|
|
void ntreeFreeTree(struct bNodeTree *ntree);
|
2020-04-20 16:14:45 +02:00
|
|
|
/* Free tree which is embedded into another datablock. */
|
|
|
|
void ntreeFreeEmbeddedTree(struct bNodeTree *ntree);
|
2017-06-14 22:36:30 +02:00
|
|
|
struct bNodeTree *ntreeCopyTree_ex(const struct bNodeTree *ntree,
|
|
|
|
struct Main *bmain,
|
|
|
|
const 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 08:54:18 +00:00
|
|
|
|
2020-02-06 16:24:19 +01:00
|
|
|
struct bNodeTree **BKE_ntree_ptr_from_id(struct ID *id);
|
|
|
|
struct bNodeTree *ntreeFromID(struct ID *id);
|
2012-12-03 16:21:43 +00: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 20:17:56 +11:00
|
|
|
bool ntreeHasType(const struct bNodeTree *ntree, int type);
|
|
|
|
bool ntreeHasTree(const struct bNodeTree *ntree, const struct bNodeTree *lookup);
|
2013-05-07 15:28:42 +00:00
|
|
|
void ntreeUpdateTree(struct Main *main, struct bNodeTree *ntree);
|
2019-04-20 20:25:22 +02:00
|
|
|
void ntreeUpdateAllNew(struct Main *main);
|
2020-12-10 16:12:11 +01:00
|
|
|
void ntreeUpdateAllUsers(struct Main *main, struct ID *id);
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
|
2021-02-05 22:34:03 +11:00
|
|
|
void ntreeGetDependencyList(struct bNodeTree *ntree,
|
|
|
|
struct bNode ***r_deplist,
|
|
|
|
int *r_deplist_len);
|
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
|
|
|
|
2019-04-27 12:07:07 +10:00
|
|
|
/* XXX old trees handle output flags automatically based on special output
|
|
|
|
* node types and last active selection.
|
|
|
|
* New tree types have a per-output socket flag to indicate the final output to use explicitly.
|
2011-09-05 21:01:50 +00:00
|
|
|
*/
|
2012-07-31 23:06:12 +00:00
|
|
|
void ntreeSetOutput(struct bNodeTree *ntree);
|
2006-06-19 17:29:44 +00:00
|
|
|
|
2012-07-31 23:06:12 +00:00
|
|
|
void ntreeFreeCache(struct bNodeTree *ntree);
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2021-01-15 10:48:22 -06:00
|
|
|
bool ntreeNodeExists(const struct bNodeTree *ntree, const struct bNode *testnode);
|
|
|
|
bool ntreeOutputExists(const struct bNode *node, const struct bNodeSocket *testsock);
|
2015-08-01 16:16:16 +02:00
|
|
|
void ntreeNodeFlagSet(const bNodeTree *ntree, const int flag, const bool enable);
|
2009-01-27 17:12:40 +00:00
|
|
|
struct bNodeTree *ntreeLocalize(struct bNodeTree *ntree);
|
2012-07-31 23:06:12 +00:00
|
|
|
void ntreeLocalSync(struct bNodeTree *localtree, struct bNodeTree *ntree);
|
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 15:42:51 +00:00
|
|
|
|
2020-09-10 13:33:29 +02:00
|
|
|
void ntreeBlendWrite(struct BlendWriter *writer, struct bNodeTree *ntree);
|
|
|
|
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-14 07:27:09 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Node Tree Interface
|
|
|
|
* \{ */
|
2013-03-18 16:34:57 +00:00
|
|
|
struct bNodeSocket *ntreeFindSocketInterface(struct bNodeTree *ntree,
|
|
|
|
int in_out,
|
|
|
|
const char *identifier);
|
|
|
|
struct bNodeSocket *ntreeAddSocketInterface(struct bNodeTree *ntree,
|
|
|
|
int in_out,
|
|
|
|
const char *idname,
|
|
|
|
const char *name);
|
|
|
|
struct bNodeSocket *ntreeInsertSocketInterface(struct bNodeTree *ntree,
|
|
|
|
int in_out,
|
|
|
|
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 10:48:22 -06:00
|
|
|
struct StructRNA *ntreeInterfaceTypeGet(struct bNodeTree *ntree, bool create);
|
2013-03-18 16:34:57 +00:00
|
|
|
void ntreeInterfaceTypeFree(struct bNodeTree *ntree);
|
|
|
|
void ntreeInterfaceTypeUpdate(struct bNodeTree *ntree);
|
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Generic API, Nodes
|
|
|
|
* \{ */
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
struct bNodeType *nodeTypeFind(const char *idname);
|
2013-03-18 18:25:05 +00:00
|
|
|
void nodeRegisterType(struct bNodeType *ntype);
|
|
|
|
void nodeUnregisterType(struct bNodeType *ntype);
|
2020-11-19 14:23:48 +01:00
|
|
|
bool nodeTypeUndefined(struct bNode *node);
|
2013-03-18 16:34:57 +00:00
|
|
|
struct GHashIterator *nodeTypeGetIterator(void);
|
|
|
|
|
|
|
|
/* helper macros for iterating over node types */
|
|
|
|
#define NODE_TYPES_BEGIN(ntype) \
|
|
|
|
{ \
|
|
|
|
GHashIterator *__node_type_iter__ = nodeTypeGetIterator(); \
|
2013-05-08 12:58:11 +00:00
|
|
|
for (; !BLI_ghashIterator_done(__node_type_iter__); \
|
|
|
|
BLI_ghashIterator_step(__node_type_iter__)) { \
|
2021-02-02 09:51:38 -06:00
|
|
|
bNodeType *ntype = (bNodeType *)BLI_ghashIterator_getValue(__node_type_iter__);
|
2013-03-18 16:34:57 +00:00
|
|
|
|
|
|
|
#define NODE_TYPES_END \
|
|
|
|
} \
|
|
|
|
BLI_ghashIterator_free(__node_type_iter__); \
|
2018-11-30 15:35:15 +11:00
|
|
|
} \
|
|
|
|
((void)0)
|
2013-03-18 16:34:57 +00:00
|
|
|
|
|
|
|
struct bNodeSocketType *nodeSocketTypeFind(const char *idname);
|
2013-03-18 18:25:05 +00:00
|
|
|
void nodeRegisterSocketType(struct bNodeSocketType *stype);
|
|
|
|
void nodeUnregisterSocketType(struct bNodeSocketType *stype);
|
2013-03-19 13:40:16 +00:00
|
|
|
bool nodeSocketIsRegistered(struct bNodeSocket *sock);
|
2013-03-18 16:34:57 +00:00
|
|
|
struct GHashIterator *nodeSocketTypeGetIterator(void);
|
2013-11-24 15:23:38 +11:00
|
|
|
const char *nodeStaticSocketType(int type, int subtype);
|
|
|
|
const char *nodeStaticSocketInterfaceType(int type, int subtype);
|
2013-03-18 16:34:57 +00:00
|
|
|
|
|
|
|
/* helper macros for iterating over node types */
|
|
|
|
#define NODE_SOCKET_TYPES_BEGIN(stype) \
|
|
|
|
{ \
|
|
|
|
GHashIterator *__node_socket_type_iter__ = nodeSocketTypeGetIterator(); \
|
2013-05-08 12:58:11 +00:00
|
|
|
for (; !BLI_ghashIterator_done(__node_socket_type_iter__); \
|
|
|
|
BLI_ghashIterator_step(__node_socket_type_iter__)) { \
|
2021-02-02 09:51:38 -06:00
|
|
|
bNodeSocketType *stype = (bNodeSocketType *)BLI_ghashIterator_getValue( \
|
|
|
|
__node_socket_type_iter__);
|
2013-03-18 16:34:57 +00:00
|
|
|
|
|
|
|
#define NODE_SOCKET_TYPES_END \
|
|
|
|
} \
|
|
|
|
BLI_ghashIterator_free(__node_socket_type_iter__); \
|
2019-04-20 11:28:21 +02:00
|
|
|
} \
|
|
|
|
((void)0)
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2020-06-27 20:18:40 +05:30
|
|
|
struct bNodeSocket *nodeFindSocket(const struct bNode *node, int in_out, const char *identifier);
|
2013-03-18 16:34:57 +00:00
|
|
|
struct bNodeSocket *nodeAddSocket(struct bNodeTree *ntree,
|
|
|
|
struct bNode *node,
|
|
|
|
int in_out,
|
|
|
|
const char *idname,
|
|
|
|
const char *identifier,
|
|
|
|
const char *name);
|
|
|
|
struct bNodeSocket *nodeInsertSocket(struct bNodeTree *ntree,
|
|
|
|
struct bNode *node,
|
|
|
|
int in_out,
|
|
|
|
const char *idname,
|
|
|
|
struct bNodeSocket *next_sock,
|
|
|
|
const char *identifier,
|
|
|
|
const char *name);
|
|
|
|
struct bNodeSocket *nodeAddStaticSocket(struct bNodeTree *ntree,
|
|
|
|
struct bNode *node,
|
|
|
|
int in_out,
|
|
|
|
int type,
|
|
|
|
int subtype,
|
|
|
|
const char *identifier,
|
|
|
|
const char *name);
|
|
|
|
struct bNodeSocket *nodeInsertStaticSocket(struct bNodeTree *ntree,
|
|
|
|
struct bNode *node,
|
|
|
|
int in_out,
|
|
|
|
int type,
|
|
|
|
int subtype,
|
|
|
|
struct bNodeSocket *next_sock,
|
|
|
|
const char *identifier,
|
|
|
|
const char *name);
|
2011-09-05 21:01:50 +00:00
|
|
|
void nodeRemoveSocket(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock);
|
|
|
|
void nodeRemoveAllSockets(struct bNodeTree *ntree, struct bNode *node);
|
2018-01-20 01:04:07 +01:00
|
|
|
void nodeModifySocketType(
|
|
|
|
struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock, int type, int subtype);
|
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
struct bNode *nodeAddNode(const struct bContext *C, struct bNodeTree *ntree, const char *idname);
|
|
|
|
struct bNode *nodeAddStaticNode(const struct bContext *C, struct bNodeTree *ntree, int type);
|
2012-07-31 23:06:12 +00:00
|
|
|
void nodeUnlinkNode(struct bNodeTree *ntree, struct bNode *node);
|
|
|
|
void nodeUniqueName(struct bNodeTree *ntree, struct bNode *node);
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2019-03-16 18:54:00 +01:00
|
|
|
/* Delete node, associated animation data and ID user count. */
|
|
|
|
void nodeRemoveNode(struct Main *bmain,
|
|
|
|
struct bNodeTree *ntree,
|
|
|
|
struct bNode *node,
|
|
|
|
bool do_id_user);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-03 17:08:25 +02:00
|
|
|
struct bNode *BKE_node_copy_ex(struct bNodeTree *ntree,
|
|
|
|
const struct bNode *node_src,
|
2020-01-16 15:04:06 +01:00
|
|
|
const int flag,
|
|
|
|
const bool unique_name);
|
2019-06-03 17:08:25 +02:00
|
|
|
|
|
|
|
/* Same as BKE_node_copy_ex() but stores pointers to a new node and its sockets in the source
|
|
|
|
* node.
|
|
|
|
*
|
|
|
|
* NOTE: DANGER ZONE!
|
|
|
|
*
|
|
|
|
* TODO(sergey): Maybe it's better to make BKE_node_copy_ex() return a mapping from old node and
|
|
|
|
* sockets to new one. */
|
|
|
|
struct bNode *BKE_node_copy_store_new_pointers(struct bNodeTree *ntree,
|
|
|
|
struct bNode *node_src,
|
|
|
|
const int flag);
|
2019-06-07 17:45:31 +02:00
|
|
|
struct bNodeTree *ntreeCopyTree_ex_new_pointers(const struct bNodeTree *ntree,
|
|
|
|
struct Main *bmain,
|
|
|
|
const bool do_id_user);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
struct bNodeLink *nodeAddLink(struct bNodeTree *ntree,
|
|
|
|
struct bNode *fromnode,
|
|
|
|
struct bNodeSocket *fromsock,
|
|
|
|
struct bNode *tonode,
|
|
|
|
struct bNodeSocket *tosock);
|
2012-07-31 23:06:12 +00:00
|
|
|
void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link);
|
|
|
|
void nodeRemSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock);
|
2021-01-15 10:48:22 -06:00
|
|
|
bool nodeLinkIsHidden(const struct bNodeLink *link);
|
2012-07-31 23:06:12 +00:00
|
|
|
void nodeInternalRelink(struct bNodeTree *ntree, struct bNode *node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-01-15 10:48:22 -06: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-07-31 23:06:12 +00: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
|
|
|
|
2012-07-31 23:06:12 +00:00
|
|
|
struct bNode *nodeFindNodebyName(struct bNodeTree *ntree, const char *name);
|
2020-09-02 18:28:04 +02:00
|
|
|
bool nodeFindNode(struct bNodeTree *ntree,
|
|
|
|
struct bNodeSocket *sock,
|
|
|
|
struct bNode **r_node,
|
|
|
|
int *r_sockindex);
|
2015-08-01 16:16:16 +02:00
|
|
|
struct bNode *nodeFindRootParent(bNode *node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-08-01 16:16:16 +02:00
|
|
|
bool nodeIsChildOf(const bNode *parent, const bNode *child);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
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,
|
|
|
|
const bool reversed);
|
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);
|
2015-08-01 16:16:16 +02:00
|
|
|
void nodeParentsIter(bNode *node, bool (*callback)(bNode *, void *), void *userdata);
|
2007-12-27 10:17:33 +00:00
|
|
|
|
2005-12-18 23:08:22 +00:00
|
|
|
struct bNodeLink *nodeFindLink(struct bNodeTree *ntree,
|
2021-01-15 10:48:22 -06:00
|
|
|
const struct bNodeSocket *from,
|
|
|
|
const struct bNodeSocket *to);
|
|
|
|
int nodeCountSocketLinks(const struct bNodeTree *ntree, const struct bNodeSocket *sock);
|
2005-12-30 11:25:15 +00:00
|
|
|
|
2014-03-31 23:39:08 +11:00
|
|
|
void nodeSetSelected(struct bNode *node, bool select);
|
2012-07-31 23:06:12 +00:00
|
|
|
void nodeSetActive(struct bNodeTree *ntree, struct bNode *node);
|
|
|
|
struct bNode *nodeGetActive(struct bNodeTree *ntree);
|
|
|
|
struct bNode *nodeGetActiveID(struct bNodeTree *ntree, short idtype);
|
2013-03-18 18:25:05 +00:00
|
|
|
bool nodeSetActiveID(struct bNodeTree *ntree, short idtype, struct ID *id);
|
2012-07-31 23:06:12 +00:00
|
|
|
void nodeClearActive(struct bNodeTree *ntree);
|
|
|
|
void nodeClearActiveID(struct bNodeTree *ntree, short idtype);
|
|
|
|
struct bNode *nodeGetActiveTexture(struct bNodeTree *ntree);
|
Orange; daily noodler update commit.
- Adding execution code for Node trees. Was a bit a puzzle, since I want
it to be multithreading by design. This now is solved by defining a
stack per tree for all data that's being written into. This stack, which
resides now in the NodeTree itself, then can be allocated per thread.
- For testing pleasure, I've added a 'mix node' and a 'show node', so
you can already see it do something. :)
- reshuffled structure, to put things nice together, and have easier node
adding. Current state is still WIP though, structure might change.
For the record; new file node_shaders.c will contain all shader node
definitions, apart from the drawing callbacks.
Next: I'm going to check on Andrea's work on icons now, since this is very
much needed for true shader/composit work.
Now back to release work...
2005-12-21 14:24:51 +00:00
|
|
|
|
2012-07-31 23:06:12 +00:00
|
|
|
void nodeUpdate(struct bNodeTree *ntree, struct bNode *node);
|
2013-11-26 06:39:14 +11:00
|
|
|
bool nodeUpdateID(struct bNodeTree *ntree, struct ID *id);
|
2012-10-25 16:49:06 +00:00
|
|
|
void nodeUpdateInternalLinks(struct bNodeTree *ntree, struct bNode *node);
|
2008-02-24 22:27:40 +00:00
|
|
|
|
2021-01-15 10:48:22 -06:00
|
|
|
int nodeSocketIsHidden(const struct bNodeSocket *sock);
|
2015-01-14 11:14:21 +01:00
|
|
|
void ntreeTagUsedSockets(struct bNodeTree *ntree);
|
2019-08-18 11:16:04 +02:00
|
|
|
void nodeSetSocketAvailability(struct bNodeSocket *sock, bool is_available);
|
2012-01-08 10:23:19 +00:00
|
|
|
|
2021-01-15 10:48:22 -06:00
|
|
|
int nodeSocketLinkLimit(const struct bNodeSocket *sock);
|
Nodes: Support storing socket link limits in bNodeSocketType
Currently the link limit of sockets is stored in bNodeSocket->limit.
This allows for a lot of flexibility, but is also very redundant.
In every case I've had to deal with so far, it would have "more correct"
to set the link limit per socket type and not per socket. I did not enforce
this constraint yet, because the link limit is exposed in the Python API,
which I did not want to break here.
In the future it might even make sense to only support only three kinds of link limits:
a) no links, b) at most one link, c) an arbitrary number links links. The other link
limits usually don't work well with tools (e.g. which link should be removed when a new
one is connected?) and is not used in practice. However, that is for another day.
Eventually, I would like to get rid of bNodeSocket->limit completely and replace it
either with fixed link limits or a callback in bNodeSocketType.
This patch consists of three parts:
**1. Support defining link limit in socket type**
This introduces a new `nodeSocketLinkLimit` function that serves as an indirection to
hide where the link limit of a socket is defined.
**2. Define link limits for builtin sockets on socket type**
Data sockets: one input, many outputs
Virtual sockets: one input, one output
Undefined sockets: many inputs, many outputs (to avoid that links are removed when the type of the socket is not known)
**3. Remove `bNodeSocketTemplate->limit`**
This wasn't used anymore after the second commit. Removing it simplifies socket definitions
in hundreds of places and removes a lot of redundancy.
Differential Revision: https://developer.blender.org/D7038
Reviewers: brecht
2020-03-06 12:20:05 +01:00
|
|
|
|
2012-08-02 09:52:37 +00:00
|
|
|
/* Node Clipboard */
|
2021-01-25 21:11:57 -06:00
|
|
|
void BKE_node_clipboard_init(const struct bNodeTree *ntree);
|
2012-08-06 08:41:45 +00:00
|
|
|
void BKE_node_clipboard_clear(void);
|
2019-03-16 18:54:00 +01:00
|
|
|
void BKE_node_clipboard_free(void);
|
2014-01-28 03:52:21 +11:00
|
|
|
bool BKE_node_clipboard_validate(void);
|
2012-08-06 08:41:45 +00:00
|
|
|
void BKE_node_clipboard_add_node(struct bNode *node);
|
|
|
|
void BKE_node_clipboard_add_link(struct bNodeLink *link);
|
2012-08-06 08:25:24 +00:00
|
|
|
const struct ListBase *BKE_node_clipboard_get_nodes(void);
|
|
|
|
const struct ListBase *BKE_node_clipboard_get_links(void);
|
2012-08-06 08:41:45 +00:00
|
|
|
int BKE_node_clipboard_get_type(void);
|
2012-08-02 09:52:37 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* Node Instance Hash */
|
2015-04-07 11:25:42 +10:00
|
|
|
typedef struct bNodeInstanceHash {
|
2018-01-16 11:40:43 +11:00
|
|
|
GHash *ghash; /* XXX should be made a direct member, GHash allocation needs to support it */
|
2013-03-18 16:34:57 +00:00
|
|
|
} bNodeInstanceHash;
|
|
|
|
|
|
|
|
typedef void (*bNodeInstanceValueFP)(void *value);
|
|
|
|
|
|
|
|
extern const bNodeInstanceKey NODE_INSTANCE_KEY_BASE;
|
2013-04-24 16:36:50 +00:00
|
|
|
extern const bNodeInstanceKey NODE_INSTANCE_KEY_NONE;
|
2013-03-18 16:34:57 +00:00
|
|
|
|
|
|
|
bNodeInstanceKey BKE_node_instance_key(bNodeInstanceKey parent_key,
|
2021-01-25 21:11:57 -06:00
|
|
|
const struct bNodeTree *ntree,
|
|
|
|
const struct bNode *node);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 18:25:05 +00:00
|
|
|
bNodeInstanceHash *BKE_node_instance_hash_new(const char *info);
|
2013-03-18 16:34:57 +00:00
|
|
|
void BKE_node_instance_hash_free(bNodeInstanceHash *hash, bNodeInstanceValueFP valfreefp);
|
|
|
|
void BKE_node_instance_hash_insert(bNodeInstanceHash *hash, bNodeInstanceKey key, void *value);
|
2013-03-18 18:25:05 +00:00
|
|
|
void *BKE_node_instance_hash_lookup(bNodeInstanceHash *hash, bNodeInstanceKey key);
|
2013-03-18 16:34:57 +00:00
|
|
|
int BKE_node_instance_hash_remove(bNodeInstanceHash *hash,
|
|
|
|
bNodeInstanceKey key,
|
|
|
|
bNodeInstanceValueFP valfreefp);
|
|
|
|
void BKE_node_instance_hash_clear(bNodeInstanceHash *hash, bNodeInstanceValueFP valfreefp);
|
2013-03-18 18:25:05 +00:00
|
|
|
void *BKE_node_instance_hash_pop(bNodeInstanceHash *hash, bNodeInstanceKey key);
|
2013-03-18 16:34:57 +00:00
|
|
|
int BKE_node_instance_hash_haskey(bNodeInstanceHash *hash, bNodeInstanceKey key);
|
|
|
|
int BKE_node_instance_hash_size(bNodeInstanceHash *hash);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
void BKE_node_instance_hash_clear_tags(bNodeInstanceHash *hash);
|
|
|
|
void BKE_node_instance_hash_tag(bNodeInstanceHash *hash, void *value);
|
2014-03-31 23:39:08 +11:00
|
|
|
bool BKE_node_instance_hash_tag_key(bNodeInstanceHash *hash, bNodeInstanceKey key);
|
2013-03-18 16:34:57 +00:00
|
|
|
void BKE_node_instance_hash_remove_untagged(bNodeInstanceHash *hash,
|
|
|
|
bNodeInstanceValueFP valfreefp);
|
|
|
|
|
|
|
|
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 18:25:05 +00:00
|
|
|
}
|
|
|
|
BLI_INLINE void *BKE_node_instance_hash_iterator_get_value(bNodeInstanceHashIterator *iter)
|
|
|
|
{
|
|
|
|
return BLI_ghashIterator_getValue(iter);
|
2013-03-18 16:34:57 +00:00
|
|
|
}
|
|
|
|
BLI_INLINE void BKE_node_instance_hash_iterator_step(bNodeInstanceHashIterator *iter)
|
|
|
|
{
|
|
|
|
BLI_ghashIterator_step(iter);
|
2013-05-08 12:58:11 +00: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 16:34:57 +00:00
|
|
|
|
|
|
|
#define NODE_INSTANCE_HASH_ITER(iter_, hash_) \
|
|
|
|
for (BKE_node_instance_hash_iterator_init(&iter_, hash_); \
|
2013-05-08 12:58:11 +00:00
|
|
|
BKE_node_instance_hash_iterator_done(&iter_) == false; \
|
2013-03-18 16:34:57 +00:00
|
|
|
BKE_node_instance_hash_iterator_step(&iter_))
|
|
|
|
|
|
|
|
/* Node Previews */
|
|
|
|
|
2021-01-15 10:48:22 -06:00
|
|
|
bool BKE_node_preview_used(const struct bNode *node);
|
2014-04-01 11:34:00 +11:00
|
|
|
bNodePreview *BKE_node_preview_verify(
|
|
|
|
struct bNodeInstanceHash *previews, bNodeInstanceKey key, int xsize, int ysize, bool create);
|
2013-03-18 18:25:05 +00:00
|
|
|
bNodePreview *BKE_node_preview_copy(struct bNodePreview *preview);
|
2013-03-18 16:34:57 +00:00
|
|
|
void BKE_node_preview_free(struct bNodePreview *preview);
|
|
|
|
void BKE_node_preview_init_tree(struct bNodeTree *ntree,
|
|
|
|
int xsize,
|
|
|
|
int ysize,
|
2021-02-26 16:50:36 +11:00
|
|
|
bool create_previews);
|
2013-03-18 16:34:57 +00:00
|
|
|
void BKE_node_preview_free_tree(struct bNodeTree *ntree);
|
|
|
|
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-18 16:34:57 +00:00
|
|
|
void BKE_node_preview_sync_tree(struct bNodeTree *to_ntree, struct bNodeTree *from_ntree);
|
2013-03-22 10:34:52 +00: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
|
|
|
|
2014-02-03 18:55:59 +11:00
|
|
|
void BKE_node_preview_set_pixel(
|
|
|
|
struct bNodePreview *preview, const float col[4], int x, int y, bool do_manage);
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Node Type Access
|
|
|
|
* \{ */
|
2011-02-21 13:47:49 +00:00
|
|
|
|
2013-11-12 18:18:04 +00:00
|
|
|
void nodeLabel(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
|
2020-02-11 15:31:40 +00: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 13:06:05 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
int nodeGroupPoll(struct bNodeTree *nodetree, struct bNodeTree *grouptree);
|
|
|
|
|
2011-02-07 09:33:36 +00:00
|
|
|
/* Init a new node type struct with default values and callbacks */
|
2013-03-18 16:34:57 +00:00
|
|
|
void node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag);
|
|
|
|
void node_type_base_custom(
|
|
|
|
struct bNodeType *ntype, const char *idname, const char *name, short nclass, short flag);
|
2012-07-31 23:06:12 +00: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 10:46:27 +00:00
|
|
|
void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size);
|
2013-03-18 16:34:57 +00:00
|
|
|
void node_type_init(struct bNodeType *ntype,
|
|
|
|
void (*initfunc)(struct bNodeTree *ntree, struct bNode *node));
|
2012-07-31 23:06:12 +00:00
|
|
|
void node_type_storage(struct bNodeType *ntype,
|
|
|
|
const char *storagename,
|
2013-03-18 16:34:57 +00:00
|
|
|
void (*freefunc)(struct bNode *node),
|
|
|
|
void (*copyfunc)(struct bNodeTree *dest_ntree,
|
|
|
|
struct bNode *dest_node,
|
2019-06-03 17:08:25 +02:00
|
|
|
const struct bNode *src_node));
|
2013-11-12 18:18:04 +00:00
|
|
|
void node_type_label(
|
|
|
|
struct bNodeType *ntype,
|
|
|
|
void (*labelfunc)(struct bNodeTree *ntree, struct bNode *, char *label, int maxlen));
|
2012-07-31 23:06:12 +00: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 16:34:57 +00: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);
|
2012-10-25 16:49:06 +00:00
|
|
|
void node_type_internal_links(struct bNodeType *ntype,
|
|
|
|
void (*update_internal_links)(struct bNodeTree *, struct bNode *));
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2018-03-14 01:58:46 +11:00
|
|
|
/** \} */
|
2015-02-14 07:27:09 +11:00
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Node Generic Functions
|
|
|
|
* \{ */
|
|
|
|
|
2014-07-23 11:33:29 -03:00
|
|
|
bool BKE_node_is_connected_to_output(struct bNodeTree *ntree, struct bNode *node);
|
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* ************** COMMON NODES *************** */
|
2011-02-07 09:33:36 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
#define NODE_UNDEFINED -2 /* node type is not registered */
|
|
|
|
#define NODE_CUSTOM -1 /* for dynamically registered custom types */
|
2007-03-24 18:41:54 +00:00
|
|
|
#define NODE_GROUP 2
|
2015-11-12 18:52:58 +11:00
|
|
|
// #define NODE_FORLOOP 3 /* deprecated */
|
|
|
|
// #define NODE_WHILELOOP 4 /* deprecated */
|
2011-09-05 21:01:50 +00:00
|
|
|
#define NODE_FRAME 5
|
2012-06-01 12:38:03 +00:00
|
|
|
#define NODE_REROUTE 6
|
2013-03-18 16:34:57 +00:00
|
|
|
#define NODE_GROUP_INPUT 7
|
|
|
|
#define NODE_GROUP_OUTPUT 8
|
2019-03-16 18:48:22 +01:00
|
|
|
#define NODE_CUSTOM_GROUP 9
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
void BKE_node_tree_unlink_id(ID *id, struct bNodeTree *ntree);
|
2011-09-05 21:01:50 +00:00
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Node Tree Iterator
|
|
|
|
*
|
2019-04-27 12:07:07 +10:00
|
|
|
* Utility macro for visiting every node tree in the library data,
|
|
|
|
* including local bNodeTree blocks in other IDs.
|
|
|
|
* This avoids the need for callback functions and allows executing code
|
|
|
|
* in a single inner code block.
|
2013-03-18 16:34:57 +00:00
|
|
|
*
|
|
|
|
* Variables:
|
|
|
|
*
|
2019-04-27 12:07:07 +10:00
|
|
|
* - nodetree:
|
|
|
|
* The actual bNodeTree data block.
|
|
|
|
* Check nodetree->idname or nodetree->typeinfo to use only specific types.
|
2013-03-18 16:34:57 +00:00
|
|
|
*
|
2019-04-27 12:07:07 +10:00
|
|
|
* - id:
|
|
|
|
* The owner of the bNodeTree data block.
|
|
|
|
* Same as nodetree if it's a linkable node tree from the library.
|
2013-03-18 16:34:57 +00:00
|
|
|
*
|
|
|
|
* Examples:
|
|
|
|
*
|
2015-02-14 07:27:09 +11:00
|
|
|
* \code{.c}
|
2018-11-30 15:22:01 +11:00
|
|
|
* FOREACH_NODETREE_BEGIN(bmain, nodetree, id) {
|
2013-03-18 16:34:57 +00:00
|
|
|
* if (id == nodetree)
|
|
|
|
* printf("This is a linkable node tree");
|
2018-11-30 15:22:01 +11:00
|
|
|
* } FOREACH_NODETREE_END;
|
2013-03-18 16:34:57 +00:00
|
|
|
*
|
2018-11-30 15:22:01 +11:00
|
|
|
* FOREACH_NODETREE_BEGIN(bmain, nodetree, id) {
|
2013-03-18 16:34:57 +00:00
|
|
|
* if (nodetree->idname == "ShaderNodeTree")
|
|
|
|
* printf("This is a shader node tree);
|
|
|
|
* if (GS(id) == ID_MA)
|
|
|
|
* printf(" and it's owned by a material");
|
2018-11-30 15:22:01 +11:00
|
|
|
* } FOREACH_NODETREE_END;
|
2015-02-14 07:27:09 +11:00
|
|
|
* \endcode
|
|
|
|
*
|
|
|
|
* \{ */
|
Orange: more noodle updates!
**** NEW: Group Nodes
Node trees usually become messy and confusing quickly, so we need
not only a way to collapse Nodes into single 'groups', but also a
way to re-use that data to create libraries of effects.
This has been done by making a new Library data type, the NodeTree.
Everything that has been grouped is stored here, and available for
re-use, appending or linking. These NodeTrees are fully generic,
i.e. can store shader trees, composit trees, and so on. The 'type'
value as stored in the NodeTree will keep track of internal type
definitions and execute/drawing callbacks. Needless to say, re-using
shader trees in a composit tree is a bit useless, and will be
prevented in the browsing code. :)
So; any NodeTree can become a "Goup Node" inside in a NodeTree. This
Group Node then works just like any Node.
To prevent the current code to become too complex, I've disabled
the possibility to insert Groups inside of Groups. That might be
enabled later, but is a real nasty piece of code to get OK.
Since Group Nodes are a dynamic Node type, a lot of work has been
done to ensure Node definitions can be dynamic too, but still allow
to be stored in files, and allow to be verified for type-definition
changes on reloading. This system needs a little bit maturing still,
so the Python gurus should better wait a little bit! (Also for me to
write the definite API docs for it).
What works now:
- Press CTRL+G to create a new Group. The grouping code checks for
impossible selections (like an unselected node between selected nodes).
Everthing that's selected then gets removed from the current tree, and
inserted in a new NodeTree library data block. A Group Node then is
added which links to this new NodeTree.
- Press ALT+G to ungroup. This will not delete the NodeTree library
data, but just duplicate the Group into the current tree.
- Press TAB, or click on the NodeTree icon to edit Groups. Note that
NodeTrees are instances, so editing one Group will also change the
other users.
This also means that when removing nodes in a Group (or hiding sockets
or changing internal links) this is immediately corrected for all users
of this Group, also in other Materials.
- While editing Groups, only the internal Nodes can be edited. A single
click outside of the Group boundary will close this 'edit mode'.
What needs to be done:
- SHIFT+A menu in toolbox style, also including a list of Groups
- Enable the single-user button in the Group Node
- Displaying all (visible) internal group UI elements in the Node Panel
- Enable Library linking and prevent editing of Groups then.
**** NEW: Socket Visibility control
Node types will be generated with a lot of possible inputs or outputs,
and drawing all sockets all the time isn't very useful then.
A new option in the Node header ('plus' icon) allows to either hide all
unused sockets (first keypress) or to reveil them (when there are hidden
sockets, the icon displays black, otherwise it's blended).
Hidden sockets in Nodes also are not exported to a Group, so this way
you can control what options (in/outputs) exactly are available.
To be done:
- a way to hide individual sockets, like with a RMB click on it.
**** NEW: Nodes now render!
This is still quite primitive, more on a level to replace the (now
obsolete and disabled) Material Layers.
What needs to be done:
- make the "Geometry" node work properly, also for AA textures
- make the Texture Node work (does very little at the moment)
- give Material Nodes all inputs as needed (like Map-to Panel)
- find a way to export more data from a Material Node, like the
shadow value, or light intensity only, etc
Very important also to separate from the Material Buttons the
"global" options, like "Ztransp" or "Wire" or "Halo". These can not
be set for each Material-Node individually.
Also note that the Preview Render (Buttons window) now renders a bit
differently. This was a horrid piece of antique code, using a totally
incompatible way of rendering. Target is to fully re-use internal
render code for previews.
OK... that's it mostly. Now test!
2006-01-02 13:06:05 +00:00
|
|
|
|
2013-03-26 22:37:41 +00:00
|
|
|
/* should be an opaque type, only for internal use by BKE_node_tree_iter_*** */
|
|
|
|
struct NodeTreeIterStore {
|
|
|
|
bNodeTree *ngroup;
|
|
|
|
Scene *scene;
|
2019-09-07 23:17:40 +10:00
|
|
|
struct Material *mat;
|
2013-03-26 22:37:41 +00:00
|
|
|
Tex *tex;
|
2019-09-07 23:17:40 +10:00
|
|
|
struct Light *light;
|
|
|
|
struct World *world;
|
|
|
|
struct FreestyleLineStyle *linestyle;
|
2020-04-20 12:56:16 +02:00
|
|
|
struct Simulation *simulation;
|
2013-03-26 22:37:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void BKE_node_tree_iter_init(struct NodeTreeIterStore *ntreeiter, struct Main *bmain);
|
|
|
|
bool BKE_node_tree_iter_step(struct NodeTreeIterStore *ntreeiter,
|
|
|
|
struct bNodeTree **r_nodetree,
|
|
|
|
struct ID **r_id);
|
|
|
|
|
2018-11-30 15:22:01 +11:00
|
|
|
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id) \
|
2013-03-18 16:34:57 +00:00
|
|
|
{ \
|
2013-03-26 22:37:41 +00:00
|
|
|
struct NodeTreeIterStore _nstore; \
|
2013-03-18 16:34:57 +00:00
|
|
|
bNodeTree *_nodetree; \
|
|
|
|
ID *_id; \
|
|
|
|
/* avoid compiler warning about unused variables */ \
|
2013-03-26 22:37:41 +00:00
|
|
|
BKE_node_tree_iter_init(&_nstore, bmain); \
|
|
|
|
while (BKE_node_tree_iter_step(&_nstore, &_nodetree, &_id) == true) { \
|
2013-03-18 16:34:57 +00:00
|
|
|
if (_nodetree) {
|
|
|
|
|
|
|
|
#define FOREACH_NODETREE_END \
|
|
|
|
} \
|
2013-03-26 22:37:41 +00:00
|
|
|
} \
|
2018-11-30 15:22:01 +11:00
|
|
|
} \
|
|
|
|
((void)0)
|
2015-02-14 07:27:09 +11:00
|
|
|
/** \} */
|
2012-10-01 07:54:37 +00:00
|
|
|
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Node Tree
|
|
|
|
*/
|
|
|
|
|
|
|
|
void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree,
|
|
|
|
struct Scene *scene,
|
|
|
|
const int layer_index);
|
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Shader Nodes
|
2018-03-14 01:58:46 +11:00
|
|
|
* \{ */
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
|
|
|
|
/* note: types are needed to restore callbacks, don't change values */
|
Four-in-one commit:
(NOTE: new include dependency in Render module, might need MSVC update!
It has to include the imbuf/intern/openexr/ directory in search path)
-> New Composite node: "Hue Saturation".
Works like the former 'post process' menu. There's no gamma, brightness or
multiply needed in this node, for that the Curves Node functions better.
-> Enabled Toolbox in Node editor
This now also replaces the SHIFT+A for adding nodes. The nodes are
automatically added to the menus, using the 'class' category from the
type definition.
Current classes are (compositor examples):
Inputs: RenderResult, Image
Outputs: Composite, Viewer
Color Ops: RGB Curves, Mix, Hue Saturation, AlphaOver
Vector Ops: Normal, Vector Curves, Map Value
Filters: Filter, Blur, VectorBlur
Convertors: ColorRamp, RGBtoBW, Separate RGBA, Separate HSVA, Set Alpha
Generators: RGB, Value, Time
Groups: the list of custom defined nodes
-> OpenEXR tile saving support
Created an API for for saving tile-based Images with an unlimited amount
of layers/channels. I've tested it for 'render result' now, with the idea
that this can (optionally) replace the current inserting of tiles in the
main result buffers. Especially with a lot of layers, the used memory for
these buffers can easily go into the 100s of megs.
Two other advantages:
- all 'render result' layers can be saved entirely in a single file, for
later use in compositing, also for animation output.
- on each render, per scene, a unique temp file can be stored, allowing
to re-use these temp files on starting Blender or loading files, showing
the last result of a render command.
The option is currently disabled, needs more work... but I had to commit
this because of the rest of the work I did!
-> Bug fix
The Image node didn't call an execute event when browsing another image.
2006-02-18 13:28:44 +00:00
|
|
|
/* range 1 - 100 is reserved for common nodes */
|
2019-04-27 12:07:07 +10:00
|
|
|
/* using toolbox, we add node groups by assuming the values below
|
|
|
|
* don't exceed NODE_GROUP_MENU for now. */
|
Four-in-one commit:
(NOTE: new include dependency in Render module, might need MSVC update!
It has to include the imbuf/intern/openexr/ directory in search path)
-> New Composite node: "Hue Saturation".
Works like the former 'post process' menu. There's no gamma, brightness or
multiply needed in this node, for that the Curves Node functions better.
-> Enabled Toolbox in Node editor
This now also replaces the SHIFT+A for adding nodes. The nodes are
automatically added to the menus, using the 'class' category from the
type definition.
Current classes are (compositor examples):
Inputs: RenderResult, Image
Outputs: Composite, Viewer
Color Ops: RGB Curves, Mix, Hue Saturation, AlphaOver
Vector Ops: Normal, Vector Curves, Map Value
Filters: Filter, Blur, VectorBlur
Convertors: ColorRamp, RGBtoBW, Separate RGBA, Separate HSVA, Set Alpha
Generators: RGB, Value, Time
Groups: the list of custom defined nodes
-> OpenEXR tile saving support
Created an API for for saving tile-based Images with an unlimited amount
of layers/channels. I've tested it for 'render result' now, with the idea
that this can (optionally) replace the current inserting of tiles in the
main result buffers. Especially with a lot of layers, the used memory for
these buffers can easily go into the 100s of megs.
Two other advantages:
- all 'render result' layers can be saved entirely in a single file, for
later use in compositing, also for animation output.
- on each render, per scene, a unique temp file can be stored, allowing
to re-use these temp files on starting Blender or loading files, showing
the last result of a render command.
The option is currently disabled, needs more work... but I had to commit
this because of the rest of the work I did!
-> Bug fix
The Image node didn't call an execute event when browsing another image.
2006-02-18 13:28:44 +00:00
|
|
|
|
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_OUTPUT 1
|
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-09 23:17:15 +00:00
|
|
|
#define SH_NODE_RGB 101
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
#define SH_NODE_VALUE 102
|
|
|
|
#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 11:25:15 +00: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 12:13:13 +00:00
|
|
|
#define SH_NODE_MAPPING 109
|
Orange:
- New UI element: the "Curve Button".
For mapping ranges (like 0 - 1) to another range, the curve button can be
used for proportional falloff, bone influences, painting density, etc.
Most evident use is of course to map RGB color with curves.
To be able to use it, you have to allocate a CurveMapping struct and pass
this on to the button. The CurveMapping API is in the new C file
blenkernel/intern/colortools.c
It's as simple as calling:
curvemap= curvemapping_add(3, 0, 0, 1, 1)
Which will create 3 curves, and sets a default 0-1 range. The current code
only supports up to 4 curves maximum per mapping struct.
The CurveMap button in Blender than handles allmost all editing.
Evaluating a single channel:
float newvalue= curvemapping_evaluateF(curvemap, 0, oldval);
Where the second argument is the channel index, here 0-1-2 are possible.
Or mapping a vector:
curvemapping_evaluate3F(curvemap, newvec, oldvec);
Optimized versions for byte or short mapping is possible too, not done yet.
In butspace.c I've added a template wrapper for buttons around the curve, to
reveil settings or show tools; check this screenie:
http://www.blender.org/bf/curves.jpg
- Buttons R, G, B: select channel
- icons + and -: zoom in, out
- icon 'wrench': menu with tools, like clear curve, set handle type
- icon 'clipping': menu with clip values, and to dis/enable clipping
- icon 'x': delete selection
In the curve button itself, only LMB clicks are handled (like all UI elements
in Blender).
- click on point: select
- shift+click on point: swap select
- click on point + drag: select point (if not selected) and move it
- click outside point + drag: translate view
- CTRL+click: add new point
- hold SHIFT while dragging to snap to grid
(Yes I know... either one of these can be Blender compliant, not both!)
- if you drag a point exactly on top of another, it merges them
Other fixes:
- Icons now draw using "Safe RasterPos", so they align with pixel boundary.
the old code made ints from the raster pos coordinate, which doesn't work
well for zoom in/out situations
- bug in Node editing: buttons could not get freed, causing in memory error
prints at end of a Blender session. That one was a very simple, but nasty
error causing me all evening last night to find!
(Hint; check diff of editnode.c, where uiDoButtons is called)
Last note: this adds 3 new files in our tree, I did scons, but not MSVC!
2006-01-08 11:41:06 +00:00
|
|
|
#define SH_NODE_CURVE_VEC 110
|
|
|
|
#define SH_NODE_CURVE_RGB 111
|
2006-12-22 08:10:29 +00:00
|
|
|
#define SH_NODE_CAMERA 114
|
2006-08-01 01:12:01 +00:00
|
|
|
#define SH_NODE_MATH 115
|
Shading: Add more operators to Vector Math node.
Add Multiply, Divide, Project, Reflect, Distance, Length, Scale, Snap,
Floor, Ceil, Modulo, Fraction, Absolute, Minimum, and Maximum operators
to the Vector Math node. The Value output has been removed from operators
whose output is a vector, and the other way around. All of those removals
has been handled properly in versioning code.
The patch doesn't include tests for the new operators. Tests will be added
in a later patch.
Reviewers: brecht, JacquesLucke
Differential Revision: https://developer.blender.org/D5523
2019-08-21 19:36:33 +02:00
|
|
|
#define SH_NODE_VECTOR_MATH 116
|
2007-03-24 18:41:54 +00:00
|
|
|
#define SH_NODE_SQUEEZE 117
|
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 06:55:02 +00:00
|
|
|
#define SH_NODE_INVERT 119
|
2007-08-20 11:05:14 +00:00
|
|
|
#define SH_NODE_SEPRGB 120
|
|
|
|
#define SH_NODE_COMBRGB 121
|
2007-08-31 07:42:06 +00:00
|
|
|
#define SH_NODE_HUE_SAT 122
|
2008-02-09 23:17:15 +00:00
|
|
|
#define NODE_DYNAMIC 123
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-11-08 11:38:16 +00:00
|
|
|
#define SH_NODE_OUTPUT_MATERIAL 124
|
|
|
|
#define SH_NODE_OUTPUT_WORLD 125
|
2018-06-27 14:41:53 +02:00
|
|
|
#define SH_NODE_OUTPUT_LIGHT 126
|
2011-11-08 11:38:16 +00:00
|
|
|
#define SH_NODE_FRESNEL 127
|
|
|
|
#define SH_NODE_MIX_SHADER 128
|
|
|
|
#define SH_NODE_ATTRIBUTE 129
|
|
|
|
#define SH_NODE_BACKGROUND 130
|
|
|
|
#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 12:29:40 +11:00
|
|
|
// #define SH_NODE_OUTPUT_TEXTURE 158
|
2011-11-08 11:38:16 +00:00
|
|
|
#define SH_NODE_HOLDOUT 159
|
|
|
|
#define SH_NODE_LAYER_WEIGHT 160
|
2013-12-28 01:54:44 +01:00
|
|
|
#define SH_NODE_VOLUME_ABSORPTION 161
|
|
|
|
#define SH_NODE_VOLUME_SCATTER 162
|
2012-05-07 20:24:38 +00:00
|
|
|
#define SH_NODE_GAMMA 163
|
|
|
|
#define SH_NODE_TEX_CHECKER 164
|
2012-01-24 16:32:31 +00:00
|
|
|
#define SH_NODE_BRIGHTCONTRAST 165
|
2012-05-07 20:24:38 +00:00
|
|
|
#define SH_NODE_LIGHT_FALLOFF 166
|
2012-05-21 12:52:28 +00:00
|
|
|
#define SH_NODE_OBJECT_INFO 167
|
2014-06-13 21:44:48 +02:00
|
|
|
#define SH_NODE_PARTICLE_INFO 168
|
2012-09-04 13:29:07 +00:00
|
|
|
#define SH_NODE_TEX_BRICK 169
|
2012-10-10 15:56:43 +00:00
|
|
|
#define SH_NODE_BUMP 170
|
2012-11-03 14:32:26 +00:00
|
|
|
#define SH_NODE_SCRIPT 171
|
2012-11-06 19:59:02 +00:00
|
|
|
#define SH_NODE_AMBIENT_OCCLUSION 172
|
|
|
|
#define SH_NODE_BSDF_REFRACTION 173
|
|
|
|
#define SH_NODE_TANGENT 174
|
|
|
|
#define SH_NODE_NORMAL_MAP 175
|
2012-12-28 14:21:30 +00:00
|
|
|
#define SH_NODE_HAIR_INFO 176
|
2013-04-01 20:26:52 +00:00
|
|
|
#define SH_NODE_SUBSURFACE_SCATTERING 177
|
2013-05-20 15:58:37 +00:00
|
|
|
#define SH_NODE_WIREFRAME 178
|
2013-05-23 17:45:20 +00:00
|
|
|
#define SH_NODE_BSDF_TOON 179
|
2013-06-09 20:46:22 +00:00
|
|
|
#define SH_NODE_WAVELENGTH 180
|
2013-06-13 08:55:51 +00:00
|
|
|
#define SH_NODE_BLACKBODY 181
|
2013-06-20 08:20:30 +00:00
|
|
|
#define SH_NODE_VECT_TRANSFORM 182
|
2013-07-03 23:46:56 +00:00
|
|
|
#define SH_NODE_SEPHSV 183
|
|
|
|
#define SH_NODE_COMBHSV 184
|
2013-09-15 23:58:00 +00:00
|
|
|
#define SH_NODE_BSDF_HAIR 185
|
2020-02-15 12:29:40 +11:00
|
|
|
// #define SH_NODE_LAMP 186
|
2014-06-13 21:44:48 +02:00
|
|
|
#define SH_NODE_UVMAP 187
|
|
|
|
#define SH_NODE_SEPXYZ 188
|
|
|
|
#define SH_NODE_COMBXYZ 189
|
2014-07-14 16:20:40 +09:00
|
|
|
#define SH_NODE_OUTPUT_LINESTYLE 190
|
2014-07-20 12:14:31 +09:00
|
|
|
#define SH_NODE_UVALONGSTROKE 191
|
2015-07-18 22:36:09 +02:00
|
|
|
#define SH_NODE_TEX_POINTDENSITY 192
|
2017-04-18 11:43:09 +02:00
|
|
|
#define SH_NODE_BSDF_PRINCIPLED 193
|
2018-05-27 11:01:46 +02:00
|
|
|
#define SH_NODE_TEX_IES 194
|
2017-06-20 14:33:13 +02:00
|
|
|
#define SH_NODE_EEVEE_SPECULAR 195
|
2017-08-18 18:37:05 +02:00
|
|
|
#define SH_NODE_BEVEL 197
|
2018-01-13 13:11:03 +01:00
|
|
|
#define SH_NODE_DISPLACEMENT 198
|
2018-01-21 00:40:42 +01:00
|
|
|
#define SH_NODE_VECTOR_DISPLACEMENT 199
|
2018-01-30 15:05:19 +01:00
|
|
|
#define SH_NODE_VOLUME_PRINCIPLED 200
|
2018-07-18 11:14:43 +02:00
|
|
|
/* 201..700 occupied by other node types, continue from 701 */
|
|
|
|
#define SH_NODE_BSDF_HAIR_PRINCIPLED 701
|
2019-08-13 16:29:32 +02:00
|
|
|
#define SH_NODE_MAP_RANGE 702
|
2019-08-13 22:22:15 +02:00
|
|
|
#define SH_NODE_CLAMP 703
|
2019-08-21 20:04:09 +02:00
|
|
|
#define SH_NODE_TEX_WHITE_NOISE 704
|
2019-08-21 20:22:24 +02:00
|
|
|
#define SH_NODE_VOLUME_INFO 705
|
2019-09-12 17:42:13 +02:00
|
|
|
#define SH_NODE_VERTEX_COLOR 706
|
2019-12-04 19:57:28 +01:00
|
|
|
#define SH_NODE_OUTPUT_AOV 707
|
2020-02-17 15:15:46 +00:00
|
|
|
#define SH_NODE_VECTOR_ROTATE 708
|
2011-11-08 11:38:16 +00:00
|
|
|
|
2007-03-25 23:54:39 +00:00
|
|
|
/* custom defines options for Material node */
|
2020-02-15 12:29:40 +11:00
|
|
|
// #define SH_NODE_MAT_DIFF 1
|
|
|
|
// #define SH_NODE_MAT_SPEC 2
|
|
|
|
// #define SH_NODE_MAT_NEG 4
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
|
|
|
|
/* API */
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
struct bNodeTreeExec *ntreeShaderBeginExecTree(struct bNodeTree *ntree);
|
|
|
|
void ntreeShaderEndExecTree(struct bNodeTreeExec *exec);
|
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
|
|
|
bool ntreeShaderExecTree(struct bNodeTree *ntree, int thread);
|
2018-07-05 12:44:15 +02:00
|
|
|
struct bNode *ntreeShaderOutputNode(struct bNodeTree *ntree, int target);
|
2005-12-18 13:46:01 +00:00
|
|
|
|
2018-08-01 19:25:58 +02:00
|
|
|
void ntreeGPUMaterialNodes(struct bNodeTree *localtree,
|
|
|
|
struct GPUMaterial *mat,
|
2018-07-05 17:20:44 +02:00
|
|
|
bool *has_surface_output,
|
|
|
|
bool *has_volume_output);
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/** \} */
|
2007-03-24 18:41:54 +00:00
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Composite Nodes
|
2018-03-14 01:58:46 +11:00
|
|
|
* \{ */
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
2007-03-24 18:41:54 +00:00
|
|
|
/* output socket defines */
|
2013-08-03 13:12:09 +00:00
|
|
|
#define RRES_OUT_IMAGE 0
|
|
|
|
#define RRES_OUT_ALPHA 1
|
2020-02-15 12:29:40 +11:00
|
|
|
// #define RRES_OUT_Z 2
|
|
|
|
// #define RRES_OUT_NORMAL 3
|
|
|
|
// #define RRES_OUT_UV 4
|
|
|
|
// #define RRES_OUT_VEC 5
|
|
|
|
// #define RRES_OUT_RGBA 6
|
2013-08-03 13:12:09 +00:00
|
|
|
#define RRES_OUT_DIFF 7
|
2020-02-15 12:29:40 +11:00
|
|
|
// #define RRES_OUT_SPEC 8
|
|
|
|
// #define RRES_OUT_SHADOW 9
|
|
|
|
// #define RRES_OUT_AO 10
|
|
|
|
// #define RRES_OUT_REFLECT 11
|
|
|
|
// #define RRES_OUT_REFRACT 12
|
|
|
|
// #define RRES_OUT_INDIRECT 13
|
|
|
|
// #define RRES_OUT_INDEXOB 14
|
|
|
|
// #define RRES_OUT_INDEXMA 15
|
|
|
|
// #define RRES_OUT_MIST 16
|
|
|
|
// #define RRES_OUT_EMIT 17
|
|
|
|
// #define RRES_OUT_ENV 18
|
|
|
|
// #define RRES_OUT_DIFF_DIRECT 19
|
|
|
|
// #define RRES_OUT_DIFF_INDIRECT 20
|
|
|
|
// #define RRES_OUT_DIFF_COLOR 21
|
|
|
|
// #define RRES_OUT_GLOSSY_DIRECT 22
|
|
|
|
// #define RRES_OUT_GLOSSY_INDIRECT 23
|
|
|
|
// #define RRES_OUT_GLOSSY_COLOR 24
|
|
|
|
// #define RRES_OUT_TRANSM_DIRECT 25
|
|
|
|
// #define RRES_OUT_TRANSM_INDIRECT 26
|
|
|
|
// #define RRES_OUT_TRANSM_COLOR 27
|
|
|
|
// #define RRES_OUT_SUBSURFACE_DIRECT 28
|
|
|
|
// #define RRES_OUT_SUBSURFACE_INDIRECT 29
|
|
|
|
// #define RRES_OUT_SUBSURFACE_COLOR 30
|
|
|
|
// #define RRES_OUT_DEBUG 31
|
2007-03-24 18:41:54 +00:00
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
/* note: types are needed to restore callbacks, don't change values */
|
2006-01-24 21:50:23 +00:00
|
|
|
#define CMP_NODE_VIEWER 201
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
#define CMP_NODE_RGB 202
|
|
|
|
#define CMP_NODE_VALUE 203
|
|
|
|
#define CMP_NODE_MIX_RGB 204
|
|
|
|
#define CMP_NODE_VALTORGB 205
|
|
|
|
#define CMP_NODE_RGBTOBW 206
|
|
|
|
#define CMP_NODE_NORMAL 207
|
|
|
|
#define CMP_NODE_CURVE_VEC 208
|
|
|
|
#define CMP_NODE_CURVE_RGB 209
|
|
|
|
#define CMP_NODE_ALPHAOVER 210
|
|
|
|
#define CMP_NODE_BLUR 211
|
|
|
|
#define CMP_NODE_FILTER 212
|
Orange; more render & compo stuff!
-> Rendering in RenderLayers
It's important to distinguish a 'render layer' from a 'pass'. The first is
control over the main pipeline itself, to indicate what geometry is being
is rendered. The 'pass' (not in this commit!) is related to internal
shading code, like shadow/spec/AO/normals/etc.
Options for RenderLayers now are:
- Indicate which 3d 'view layers' have to be included (so you can render
front and back separately)
- "Solid", all solid faces, includes sky at the moment too
- "ZTransp", all transparent faces
- "Halo", the halos
- "Strand", the particle strands (not coded yet...)
Currently only 2 'passes' are exported for render, which is the "Combined"
buffer and the "Z. The latter now works, and can be turned on/off.
Note that all layers are still fully kept in memory now, saving the tiles
and layers to disk (in exr) is also todo.
-> New Blur options
The existing Blur Node (compositor) now has an optional input image. This
has to be a 'value buffer', which can be a Zbuffer, or any mask you can
think of. The input values have to be in the 0-1 range, so another new
node was added too "Map Value".
The value input can also be used to tweak blur size with the (todo)
Time Node.
Temporal screenies:
http://www.blender.org/bf/rt.jpg
http://www.blender.org/bf/rt1.jpg
http://www.blender.org/bf/rt2.jpg
BTW: The compositor is very slow still, it recalulates all nodes on each
change still. Persistant memory and dependency checks is coming!
2006-01-26 22:18:46 +00:00
|
|
|
#define CMP_NODE_MAP_VALUE 213
|
|
|
|
#define CMP_NODE_TIME 214
|
2006-01-31 21:49:05 +00:00
|
|
|
#define CMP_NODE_VECBLUR 215
|
2006-02-17 13:51:55 +00:00
|
|
|
#define CMP_NODE_SEPRGBA 216
|
|
|
|
#define CMP_NODE_SEPHSVA 217
|
|
|
|
#define CMP_NODE_SETALPHA 218
|
Four-in-one commit:
(NOTE: new include dependency in Render module, might need MSVC update!
It has to include the imbuf/intern/openexr/ directory in search path)
-> New Composite node: "Hue Saturation".
Works like the former 'post process' menu. There's no gamma, brightness or
multiply needed in this node, for that the Curves Node functions better.
-> Enabled Toolbox in Node editor
This now also replaces the SHIFT+A for adding nodes. The nodes are
automatically added to the menus, using the 'class' category from the
type definition.
Current classes are (compositor examples):
Inputs: RenderResult, Image
Outputs: Composite, Viewer
Color Ops: RGB Curves, Mix, Hue Saturation, AlphaOver
Vector Ops: Normal, Vector Curves, Map Value
Filters: Filter, Blur, VectorBlur
Convertors: ColorRamp, RGBtoBW, Separate RGBA, Separate HSVA, Set Alpha
Generators: RGB, Value, Time
Groups: the list of custom defined nodes
-> OpenEXR tile saving support
Created an API for for saving tile-based Images with an unlimited amount
of layers/channels. I've tested it for 'render result' now, with the idea
that this can (optionally) replace the current inserting of tiles in the
main result buffers. Especially with a lot of layers, the used memory for
these buffers can easily go into the 100s of megs.
Two other advantages:
- all 'render result' layers can be saved entirely in a single file, for
later use in compositing, also for animation output.
- on each render, per scene, a unique temp file can be stored, allowing
to re-use these temp files on starting Blender or loading files, showing
the last result of a render command.
The option is currently disabled, needs more work... but I had to commit
this because of the rest of the work I did!
-> Bug fix
The Image node didn't call an execute event when browsing another image.
2006-02-18 13:28:44 +00:00
|
|
|
#define CMP_NODE_HUE_SAT 219
|
2007-03-24 18:41:54 +00:00
|
|
|
#define CMP_NODE_IMAGE 220
|
|
|
|
#define CMP_NODE_R_LAYERS 221
|
|
|
|
#define CMP_NODE_COMPOSITE 222
|
2006-01-24 21:50:23 +00:00
|
|
|
#define CMP_NODE_OUTPUT_FILE 223
|
2007-03-24 18:41:54 +00:00
|
|
|
#define CMP_NODE_TEXTURE 224
|
|
|
|
#define CMP_NODE_TRANSLATE 225
|
|
|
|
#define CMP_NODE_ZCOMBINE 226
|
|
|
|
#define CMP_NODE_COMBRGBA 227
|
2006-07-31 02:24:35 +00:00
|
|
|
#define CMP_NODE_DILATEERODE 228
|
2007-03-24 18:41:54 +00:00
|
|
|
#define CMP_NODE_ROTATE 229
|
|
|
|
#define CMP_NODE_SCALE 230
|
|
|
|
#define CMP_NODE_SEPYCCA 231
|
|
|
|
#define CMP_NODE_COMBYCCA 232
|
|
|
|
#define CMP_NODE_SEPYUVA 233
|
|
|
|
#define CMP_NODE_COMBYUVA 234
|
|
|
|
#define CMP_NODE_DIFF_MATTE 235
|
2006-11-15 14:41:04 +00:00
|
|
|
#define CMP_NODE_COLOR_SPILL 236
|
2009-09-10 04:12:22 +00:00
|
|
|
#define CMP_NODE_CHROMA_MATTE 237
|
2007-01-09 04:32:39 +00:00
|
|
|
#define CMP_NODE_CHANNEL_MATTE 238
|
2007-03-24 18:41:54 +00:00
|
|
|
#define CMP_NODE_FLIP 239
|
2006-11-16 21:50:35 +00:00
|
|
|
#define CMP_NODE_SPLITVIEWER 240
|
2015-11-12 18:52:58 +11:00
|
|
|
// #define CMP_NODE_INDEX_MASK 241
|
2007-03-24 18:41:54 +00:00
|
|
|
#define CMP_NODE_MAP_UV 242
|
|
|
|
#define CMP_NODE_ID_MASK 243
|
|
|
|
#define CMP_NODE_DEFOCUS 244
|
|
|
|
#define CMP_NODE_DISPLACE 245
|
|
|
|
#define CMP_NODE_COMBHSVA 246
|
|
|
|
#define CMP_NODE_MATH 247
|
|
|
|
#define CMP_NODE_LUMA_MATTE 248
|
2007-04-13 03:23:39 +00:00
|
|
|
#define CMP_NODE_BRIGHTCONTRAST 249
|
2007-04-13 04:22:32 +00:00
|
|
|
#define CMP_NODE_GAMMA 250
|
== Shader nodes ==
* Geometry node: Front/back output
This is used as a mask for determining whether you're looking at the front side or back side of a mesh, useful for blending materials, my practical need was giving different materials to the pages of a magazine: http://mke3.net/blender/etc/frontback-h264.mov
Give 1.0 if it's the front side, and 0.0 if it's the back side.
* Extended material node
This is the same as the material node, but gives more available inputs and outputs, (basically just connecting up more of ShadeInput and ShadeResult to the node). I didn't want to add it to the normal simple Material node since you don't always need all that stuff, and it would make the node huge, but when you do need it, it's nice to have it.
== Comp nodes ==
* Invert node
Inverting is something that happens all the time in a node setup, and this makes it easier. It's been possible to invert previously by adding a mix node and subtracting the input from 1.0, but it's not the best way of doing it. This node:
- makes it a lot faster to set up, rather than all the clicking required with the mix node
- is a lot more usable amidst a complex comp setup, when you're looking at a node tree, it's very helpful to be able to see at a glance what's going on. Using subtract for inverting is easily mixed up with other nodes in which you are actually subtracting, not inverting, and looks very similar to all the other mix nodes that usually litter a comp tree.
- has options to invert the RGB channels, the Alpha channel, or both. This saves adding lots of extra nodes (separate RGBA, subtract, set alpha) when you want to do something simple like invert an alpha channel. I'd like to add this option to other nodes too.
There's also a shader node version too.
* Also a few fixes that I committed ages ago, but seems to have been overwritten in Bob's node refactor:
- adding new compbufs to the set alpha and alphaover nodes when you have only one noodle connected to the lower input
- making the fac value on RGB curves still work when there's nothing connected to it
2007-05-31 06:55:02 +00:00
|
|
|
#define CMP_NODE_INVERT 251
|
2007-07-10 02:27:37 +00:00
|
|
|
#define CMP_NODE_NORMALIZE 252
|
2007-10-29 14:37:19 +00:00
|
|
|
#define CMP_NODE_CROP 253
|
2007-12-27 14:19:11 +00:00
|
|
|
#define CMP_NODE_DBLUR 254
|
2007-12-27 20:36:17 +00:00
|
|
|
#define CMP_NODE_BILATERALBLUR 255
|
2008-03-11 14:40:27 +00:00
|
|
|
#define CMP_NODE_PREMULKEY 256
|
2009-09-10 04:12:22 +00:00
|
|
|
#define CMP_NODE_DIST_MATTE 257
|
|
|
|
#define CMP_NODE_VIEW_LEVELS 258
|
|
|
|
#define CMP_NODE_COLOR_MATTE 259
|
2010-01-20 04:19:55 +00:00
|
|
|
#define CMP_NODE_COLORBALANCE 260
|
2010-01-21 00:00:45 +00:00
|
|
|
#define CMP_NODE_HUECORRECT 261
|
2011-11-07 12:56:05 +00:00
|
|
|
#define CMP_NODE_MOVIECLIP 262
|
|
|
|
#define CMP_NODE_STABILIZE2D 263
|
|
|
|
#define CMP_NODE_TRANSFORM 264
|
|
|
|
#define CMP_NODE_MOVIEDISTORTION 265
|
2012-01-10 19:08:08 +00:00
|
|
|
#define CMP_NODE_DOUBLEEDGEMASK 266
|
2012-03-01 07:56:15 +00:00
|
|
|
#define CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED \
|
|
|
|
267 /* DEPRECATED multi file node has been merged into regular CMP_NODE_OUTPUT_FILE */
|
2012-06-04 16:42:58 +00:00
|
|
|
#define CMP_NODE_MASK 268
|
2012-06-14 12:18:42 +00:00
|
|
|
#define CMP_NODE_KEYINGSCREEN 269
|
2012-06-14 12:19:13 +00:00
|
|
|
#define CMP_NODE_KEYING 270
|
2012-06-19 17:29:58 +00:00
|
|
|
#define CMP_NODE_TRACKPOS 271
|
2012-08-23 06:48:01 +00:00
|
|
|
#define CMP_NODE_INPAINT 272
|
|
|
|
#define CMP_NODE_DESPECKLE 273
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2007-10-26 15:32:36 +00:00
|
|
|
#define CMP_NODE_GLARE 301
|
|
|
|
#define CMP_NODE_TONEMAP 302
|
|
|
|
#define CMP_NODE_LENSDIST 303
|
2014-07-26 12:59:29 +02:00
|
|
|
#define CMP_NODE_SUNBEAMS 304
|
2007-10-26 15:32:36 +00:00
|
|
|
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
merge to TRUNK!
* The old compositor is still available (Debug Menu: 200)
This commit was brought to you by:
Developers:
* Monique Dewanchand
* Jeroen Bakker
* Dalai Felinto
* Lukas Tönne
Review:
* Brecht van Lommel
Testers:
* Nate Wiebe
* Wolfgang Faehnle
* Carlo Andreacchio
* Daniel Salazar
* Artur Mag
* Christian Krupa
* Francesco Siddi
* Dan McGrath
* Bassam Kurdali
But mostly by the community:
Gold:
Joshua Faulkner
Michael Tiemann
Francesco Paglia
Blender Guru
Blender Developers Fund
Silver:
Pablo Vazquez
Joel Heethaar
Amrein Olivier
Ilias Karasavvidis
Thomas Kumlehn
Sebastian Koenig
Hannu Hoffrén
Benjamin Dansie
Fred M'ule
Michel Vilain
Bradley Cathey
Gianmichele Mariani
Gottfried Hofmann
Bjørnar Frøyse
Valentijn Bruning
Paul Holmes
Clemens Rudolph
Juris Graphix
David Strebel
Ronan Zeegers
François Tarlier
Felipe Andres Esquivel Reed
Olaf Beckman
Jesus Alberto Olmos Linares
Kajimba
Maria Figueiredo
Alexandr Galperin
Francesco Siddi
Julio Iglesias Lopez
Kjartan Tysdal
Thomas Torfs
Film Works
Teruyuki Nakamura
Roger Luethi
Benoit Bolsee
Stefan Abrahamsen
Andreas Mattijat
Xavier Bouchoux
Blender 3D Graphics and Animation
Henk Vostermans
Daniel Blanco Delgado
BlenderDay/2011
Bradley Cathey
Matthieu Dupont de Dinechin
Gianmichele Mariani
Jérôme Scaillet
Bronze (Ivo Grigull, Dylan Urquidi, Philippe Derungs, Phil Beauchamp, Bruce Parrott, Mathieu Quiblier, Daniel Martinez, Leandro Inocencio, Lluc Romaní Brasó,
Jonathan Williamson, Michael Ehlen, Karlis Stigis, Dreamsteep, Martin Lindelöf, Filippo Saracino, Douwe van der Veen, Olli Äkräs, Bruno D'Arcangeli,
Francisco Sedrez Warmling, Watchmike.ca, peter lener, Matteo Novellino, Martin Kirsch, Austars Schnore, KC Elliott, Massimiliano Puliero, Karl Stein,
Wood Design Studios, Omer Khan, Jyrki Kanto, Michał Krupa, Lars Brubaker, Neil Richmond, Adam Kalisz, Robert Garlington, Ian Wilson, Carlo Andreacchio,
Jeremias Boos, Robert Holcomb, Gabriel Zöller, Robert Cude, Natibel de Leon, Nathan Turnage, Nicolas Vergnes, Philipp Kleinhenz, Norman Hartig, Louis Kreusel,
Christopher Taylor, Giovanni Remondini, Daniel Rentzsch, Nico Partipilo, Thomas Ventresco, Johannes Schwarz, Александр Коротеев, Brendon Harvey,
Marcelo G. Malheiros, Marius Giurgi, Richard Burns, Perttu Iso-Metsälä, Steve Bazin, Radoslav Borisov, Yoshiyuki Shida, Julien Guigner, Andrew Hunter,
Philipp Oeser, Daniel Thul, Thobias Johansson, Mauro Bonecchi, Georg Piorczynski, Sebastian Michailidis, L M Weedy, Gen X, Stefan Hinze, Nicolò Zubbini,
Erik Pusch, Rob Scott, Florian Koch, Charles Razack, Adrian Baker, Oliver Villar Diz, David Revoy, Julio Iglesias Lopez, Coen Spoor, Carlos Folch,
Joseph Christie, Victor Hernández García, David Mcsween, James Finnerty, Cory Kruckenberg, Giacomo Graziosi, Olivier Saraja, Lars Brubaker, Eric Hudson,
Johannes Schwarz, David Elguea, Marcus Schulderinsky, Karel De Bruijn, Lucas van Wijngaarden, Stefano Ciarrocchi, Mehmet Eribol, Thomas Berglund, Zuofei Song,
Dylan Urquidi )
2012-05-17 12:49:33 +00:00
|
|
|
#define CMP_NODE_COLORCORRECTION 312
|
|
|
|
#define CMP_NODE_MASK_BOX 313
|
|
|
|
#define CMP_NODE_MASK_ELLIPSE 314
|
|
|
|
#define CMP_NODE_BOKEHIMAGE 315
|
|
|
|
#define CMP_NODE_BOKEHBLUR 316
|
|
|
|
#define CMP_NODE_SWITCH 317
|
2012-10-24 08:36:10 +00:00
|
|
|
#define CMP_NODE_PIXELATE 318
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-14 19:53:46 +00:00
|
|
|
#define CMP_NODE_MAP_RANGE 319
|
Merge plane track feature from tomato branch
This commit includes all the changes made for plane tracker
in tomato branch.
Movie clip editor changes:
- Artist might create a plane track out of multiple point
tracks which belongs to the same track (minimum amount of
point tracks is 4, maximum is not actually limited).
When new plane track is added, it's getting "tracked"
across all point tracks, which makes it stick to the same
plane point tracks belong to.
- After plane track was added, it need to be manually adjusted
in a way it covers feature one might to mask/replace.
General transform tools (G, R, S) or sliding corners with
a mouse could be sued for this. Plane corner which
corresponds to left bottom image corner has got X/Y axis
on it (red is for X axis, green for Y).
- Re-adjusting plane corners makes plane to be "re-tracked"
for the frames sequence between current frame and next
and previous keyframes.
- Kayframes might be removed from the plane, using Shit-X
(Marker Delete) operator. However, currently manual
re-adjustment or "re-track" trigger is needed.
Compositor changes:
- Added new node called Plane Track Deform.
- User selects which plane track to use (for this he need
to select movie clip datablock, object and track names).
- Node gets an image input, which need to be warped into
the plane.
- Node outputs:
* Input image warped into the plane.
* Plane, rasterized to a mask.
Masking changes:
- Mask points might be parented to a plane track, which
makes this point deforming in a way as if it belongs
to the tracked plane.
Some video tutorials are available:
- Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4
- Artist video: https://vimeo.com/71727578
This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
|
|
|
#define CMP_NODE_PLANETRACKDEFORM 320
|
2014-03-11 14:07:49 +01:00
|
|
|
#define CMP_NODE_CORNERPIN 321
|
2015-04-06 10:40:12 -03:00
|
|
|
#define CMP_NODE_SWITCH_VIEW 322
|
2018-07-18 13:03:09 +02:00
|
|
|
#define CMP_NODE_CRYPTOMATTE 323
|
Compositor: Added denoising node
This node is built on Intel's OpenImageDenoise library.
Other denoisers could be integrated, for example Lukas' Cycles denoiser.
Compositor: Made OpenImageDenoise optional, added CMake and build_env files to find OIDN
Compositor: Fixed some warnings in the denoising operator
build_environment: Updated OpenImageDenoise to 0.8.1
build_environment: Updated OpenImageDenoise in `make deps` for macOS
Reviewers: sergey, jbakker, brecht
Reviewed By: brecht
Subscribers: YAFU, LazyDodo, Zen_YS, slumber, samgreen, tjvoll, yeus, ponomarovmax, getrad, coder.kalyan, vitos1k, Yegor, DeepBlender, kumaran7, Darkfie9825, aliasguru, aafra, ace_dragon, juang3d, pandrodor, cdog, lordodin, jtheninja, mavek, marcog, 5k1n2, Atair, rawalanche, 0o00o0oo, filibis, poor, lukasstockner97
Tags: #compositing
Differential Revision: https://developer.blender.org/D4304
2019-08-14 15:30:26 +02:00
|
|
|
#define CMP_NODE_DENOISE 324
|
2020-12-19 14:40:31 -05:00
|
|
|
#define CMP_NODE_EXPOSURE 325
|
2012-11-14 19:53:46 +00:00
|
|
|
|
== Shader nodes ==
* Geometry node: Front/back output
This is used as a mask for determining whether you're looking at the front side or back side of a mesh, useful for blending materials, my practical need was giving different materials to the pages of a magazine: http://mke3.net/blender/etc/frontback-h264.mov
Give 1.0 if it's the front side, and 0.0 if it's the back side.
* Extended material node
This is the same as the material node, but gives more available inputs and outputs, (basically just connecting up more of ShadeInput and ShadeResult to the node). I didn't want to add it to the normal simple Material node since you don't always need all that stuff, and it would make the node huge, but when you do need it, it's nice to have it.
== Comp nodes ==
* Invert node
Inverting is something that happens all the time in a node setup, and this makes it easier. It's been possible to invert previously by adding a mix node and subtracting the input from 1.0, but it's not the best way of doing it. This node:
- makes it a lot faster to set up, rather than all the clicking required with the mix node
- is a lot more usable amidst a complex comp setup, when you're looking at a node tree, it's very helpful to be able to see at a glance what's going on. Using subtract for inverting is easily mixed up with other nodes in which you are actually subtracting, not inverting, and looks very similar to all the other mix nodes that usually litter a comp tree.
- has options to invert the RGB channels, the Alpha channel, or both. This saves adding lots of extra nodes (separate RGBA, subtract, set alpha) when you want to do something simple like invert an alpha channel. I'd like to add this option to other nodes too.
There's also a shader node version too.
* Also a few fixes that I committed ages ago, but seems to have been overwritten in Bob's node refactor:
- adding new compbufs to the set alpha and alphaover nodes when you have only one noodle connected to the lower input
- making the fac value on RGB curves still work when there's nothing connected to it
2007-05-31 06:55:02 +00:00
|
|
|
/* channel toggles */
|
|
|
|
#define CMP_CHAN_RGB 1
|
|
|
|
#define CMP_CHAN_A 2
|
2007-04-13 03:23:39 +00:00
|
|
|
|
2007-03-25 23:54:39 +00:00
|
|
|
/* filter types */
|
|
|
|
#define CMP_FILT_SOFT 0
|
|
|
|
#define CMP_FILT_SHARP 1
|
|
|
|
#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
|
|
|
|
|
|
|
|
/* scale node type, in custom1 */
|
2007-11-13 23:53:58 +00:00
|
|
|
#define CMP_SCALE_RELATIVE 0
|
|
|
|
#define CMP_SCALE_ABSOLUTE 1
|
|
|
|
#define CMP_SCALE_SCENEPERCENT 2
|
2010-07-08 20:58:34 +00:00
|
|
|
#define CMP_SCALE_RENDERPERCENT 3
|
2012-06-14 16:55:55 +00:00
|
|
|
/* custom2 */
|
|
|
|
#define CMP_SCALE_RENDERSIZE_FRAME_ASPECT (1 << 0)
|
|
|
|
#define CMP_SCALE_RENDERSIZE_FRAME_CROP (1 << 1)
|
2007-03-25 23:54:39 +00:00
|
|
|
|
2013-06-12 12:55:44 +00: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 14:28:36 +00: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 22:05:47 +00:00
|
|
|
|
|
|
|
/* API */
|
2014-02-05 13:51:51 +01:00
|
|
|
void ntreeCompositExecTree(struct Scene *scene,
|
|
|
|
struct bNodeTree *ntree,
|
|
|
|
struct RenderData *rd,
|
|
|
|
int rendering,
|
|
|
|
int do_previews,
|
2015-04-06 10:40:12 -03:00
|
|
|
const struct ColorManagedViewSettings *view_settings,
|
|
|
|
const struct ColorManagedDisplaySettings *display_settings,
|
|
|
|
const char *view_name);
|
2020-09-04 20:59:13 +02:00
|
|
|
void ntreeCompositTagRender(struct Scene *scene);
|
Render API/Cycles: Identify Render Passes by their name instead of a type flag
Previously, every RenderPass would have a bitfield that specified its type. That limits the number of passes to 32, which was reached a while ago.
However, most of the code already supported arbitrary RenderPasses since they were also used to store Multilayer EXR images.
Therefore, this commit completely removes the passflag from RenderPass and changes all code to use the unique pass name for identification.
Since Blender Internal relies on hardcoded passes and to preserve compatibility, 32 pass names are reserved for the old hardcoded passes.
To support these arbitrary passes, the Render Result compositor node now adds dynamic sockets. For compatibility, the old hardcoded sockets are always stored and just hidden when the corresponding pass isn't available.
To use these changes, the Render Engine API now includes a function that allows render engines to add arbitrary passes to the render result. To be able to add options for these passes, addons can now add their own properties to SceneRenderLayers.
To keep the compositor input node updated, render engine plugins have to implement a callback that registers all the passes that will be generated.
From a user perspective, nothing should change with this commit.
Differential Revision: https://developer.blender.org/D2443
Differential Revision: https://developer.blender.org/D2444
2017-05-03 00:21:18 +02:00
|
|
|
void ntreeCompositUpdateRLayers(struct bNodeTree *ntree);
|
2017-11-22 10:52:39 -02:00
|
|
|
void ntreeCompositRegisterPass(struct bNodeTree *ntree,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct ViewLayer *view_layer,
|
|
|
|
const char *name,
|
2020-03-17 13:45:35 -06:00
|
|
|
eNodeSocketDatatype type);
|
2011-10-19 17:08:35 +00:00
|
|
|
void ntreeCompositClearTags(struct bNodeTree *ntree);
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
2012-03-01 07:56:15 +00:00
|
|
|
struct bNodeSocket *ntreeCompositOutputFileAddSocket(struct bNodeTree *ntree,
|
|
|
|
struct bNode *node,
|
|
|
|
const char *name,
|
|
|
|
struct ImageFormatData *im_format);
|
|
|
|
int ntreeCompositOutputFileRemoveActiveSocket(struct bNodeTree *ntree, struct bNode *node);
|
2012-05-11 08:06:01 +00:00
|
|
|
void ntreeCompositOutputFileSetPath(struct bNode *node,
|
|
|
|
struct bNodeSocket *sock,
|
|
|
|
const char *name);
|
|
|
|
void ntreeCompositOutputFileSetLayer(struct bNode *node,
|
|
|
|
struct bNodeSocket *sock,
|
|
|
|
const char *name);
|
|
|
|
/* needed in do_versions */
|
|
|
|
void ntreeCompositOutputFileUniquePath(struct ListBase *list,
|
|
|
|
struct bNodeSocket *sock,
|
|
|
|
const char defname[],
|
|
|
|
char delim);
|
|
|
|
void ntreeCompositOutputFileUniqueLayer(struct ListBase *list,
|
|
|
|
struct bNodeSocket *sock,
|
|
|
|
const char defname[],
|
|
|
|
char delim);
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2013-11-06 12:44:54 +00:00
|
|
|
void ntreeCompositColorBalanceSyncFromLGG(bNodeTree *ntree, bNode *node);
|
|
|
|
void ntreeCompositColorBalanceSyncFromCDL(bNodeTree *ntree, bNode *node);
|
|
|
|
|
2018-07-18 13:03:09 +02:00
|
|
|
void ntreeCompositCryptomatteSyncFromAdd(bNodeTree *ntree, bNode *node);
|
|
|
|
void ntreeCompositCryptomatteSyncFromRemove(bNodeTree *ntree, bNode *node);
|
|
|
|
struct bNodeSocket *ntreeCompositCryptomatteAddSocket(struct bNodeTree *ntree, struct bNode *node);
|
|
|
|
int ntreeCompositCryptomatteRemoveSocket(struct bNodeTree *ntree, struct bNode *node);
|
|
|
|
|
2015-02-14 07:27:09 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Texture Nodes
|
2018-03-14 01:58:46 +11:00
|
|
|
* \{ */
|
2008-11-12 22:03:11 +00:00
|
|
|
|
|
|
|
struct TexResult;
|
|
|
|
|
2009-03-24 17:40:58 +00:00
|
|
|
#define TEX_NODE_OUTPUT 401
|
|
|
|
#define TEX_NODE_CHECKER 402
|
|
|
|
#define TEX_NODE_TEXTURE 403
|
|
|
|
#define TEX_NODE_BRICKS 404
|
|
|
|
#define TEX_NODE_MATH 405
|
|
|
|
#define TEX_NODE_MIX_RGB 406
|
|
|
|
#define TEX_NODE_RGBTOBW 407
|
|
|
|
#define TEX_NODE_VALTORGB 408
|
|
|
|
#define TEX_NODE_IMAGE 409
|
|
|
|
#define TEX_NODE_CURVE_RGB 410
|
|
|
|
#define TEX_NODE_INVERT 411
|
|
|
|
#define TEX_NODE_HUE_SAT 412
|
|
|
|
#define TEX_NODE_CURVE_TIME 413
|
|
|
|
#define TEX_NODE_ROTATE 414
|
|
|
|
#define TEX_NODE_VIEWER 415
|
|
|
|
#define TEX_NODE_TRANSLATE 416
|
|
|
|
#define TEX_NODE_COORD 417
|
|
|
|
#define TEX_NODE_DISTANCE 418
|
|
|
|
#define TEX_NODE_COMPOSE 419
|
|
|
|
#define TEX_NODE_DECOMPOSE 420
|
|
|
|
#define TEX_NODE_VALTONOR 421
|
|
|
|
#define TEX_NODE_SCALE 422
|
2009-06-13 14:22:40 +00:00
|
|
|
#define TEX_NODE_AT 423
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2009-06-13 14:22:40 +00:00
|
|
|
/* 501-599 reserved. Use like this: TEX_NODE_PROC + TEX_CLOUDS, etc */
|
2009-03-24 17:40:58 +00:00
|
|
|
#define TEX_NODE_PROC 500
|
|
|
|
#define TEX_NODE_PROC_MAX 600
|
2008-11-12 22:03:11 +00:00
|
|
|
|
|
|
|
/* API */
|
|
|
|
void ntreeTexCheckCyclics(struct bNodeTree *ntree);
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
struct bNodeTreeExec *ntreeTexBeginExecTree(struct bNodeTree *ntree);
|
|
|
|
void ntreeTexEndExecTree(struct bNodeTreeExec *exec);
|
2012-10-15 23:11:59 +00:00
|
|
|
int ntreeTexExecTree(struct bNodeTree *ntree,
|
|
|
|
struct TexResult *target,
|
2020-10-01 16:56:24 +02:00
|
|
|
const float co[3],
|
2012-10-15 23:11:59 +00:00
|
|
|
float dxt[3],
|
|
|
|
float dyt[3],
|
|
|
|
int osatex,
|
|
|
|
const short thread,
|
2020-05-01 14:37:13 +10:00
|
|
|
const struct Tex *tex,
|
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
|
|
|
short which_output,
|
|
|
|
int cfra,
|
|
|
|
int preview,
|
|
|
|
struct MTex *mtex);
|
2015-02-14 07:27:09 +11:00
|
|
|
/** \} */
|
2008-11-12 22:03:11 +00:00
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Geometry Nodes
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
#define GEO_NODE_TRIANGULATE 1000
|
|
|
|
#define GEO_NODE_EDGE_SPLIT 1001
|
|
|
|
#define GEO_NODE_TRANSFORM 1002
|
|
|
|
#define GEO_NODE_BOOLEAN 1003
|
|
|
|
#define GEO_NODE_POINT_DISTRIBUTE 1004
|
|
|
|
#define GEO_NODE_POINT_INSTANCE 1005
|
|
|
|
#define GEO_NODE_SUBDIVISION_SURFACE 1006
|
|
|
|
#define GEO_NODE_OBJECT_INFO 1007
|
2020-12-16 13:31:56 +01:00
|
|
|
#define GEO_NODE_ATTRIBUTE_RANDOMIZE 1008
|
2020-12-02 13:25:25 +01:00
|
|
|
#define GEO_NODE_ATTRIBUTE_MATH 1009
|
|
|
|
#define GEO_NODE_JOIN_GEOMETRY 1010
|
2020-12-10 07:58:45 -06:00
|
|
|
#define GEO_NODE_ATTRIBUTE_FILL 1011
|
2020-12-11 12:00:48 +01:00
|
|
|
#define GEO_NODE_ATTRIBUTE_MIX 1012
|
2020-12-17 11:55:45 +01:00
|
|
|
#define GEO_NODE_ATTRIBUTE_COLOR_RAMP 1013
|
2020-12-17 12:22:47 -06:00
|
|
|
#define GEO_NODE_POINT_SEPARATE 1014
|
|
|
|
#define GEO_NODE_ATTRIBUTE_COMPARE 1015
|
2021-01-13 10:10:25 -06:00
|
|
|
#define GEO_NODE_POINT_ROTATE 1016
|
2021-01-11 12:06:52 -06:00
|
|
|
#define GEO_NODE_ATTRIBUTE_VECTOR_MATH 1017
|
2021-01-12 12:55:14 +01:00
|
|
|
#define GEO_NODE_ALIGN_ROTATION_TO_VECTOR 1018
|
2021-01-13 10:30:42 -06:00
|
|
|
#define GEO_NODE_POINT_TRANSLATE 1019
|
|
|
|
#define GEO_NODE_POINT_SCALE 1020
|
2021-01-21 16:47:03 +01:00
|
|
|
#define GEO_NODE_ATTRIBUTE_SAMPLE_TEXTURE 1021
|
2021-01-26 17:37:58 +01:00
|
|
|
#define GEO_NODE_POINTS_TO_VOLUME 1022
|
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-02-05 08:28:31 -06:00
|
|
|
#define GEO_NODE_ATTRIBUTE_PROXIMITY 1025
|
2021-02-05 16:20:14 +01:00
|
|
|
#define GEO_NODE_VOLUME_TO_MESH 1026
|
2021-02-09 11:12:24 -06:00
|
|
|
#define GEO_NODE_ATTRIBUTE_COMBINE_XYZ 1027
|
|
|
|
#define GEO_NODE_ATTRIBUTE_SEPARATE_XYZ 1028
|
2021-02-19 13:20:04 -06:00
|
|
|
#define GEO_NODE_SUBDIVISION_SURFACE_SIMPLE 1029
|
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
|
|
|
|
#define FN_NODE_SWITCH 1201
|
|
|
|
#define FN_NODE_FLOAT_COMPARE 1202
|
2020-05-04 12:49:25 +02:00
|
|
|
#define FN_NODE_GROUP_INSTANCE_ID 1203
|
|
|
|
#define FN_NODE_COMBINE_STRINGS 1204
|
2020-07-21 17:20:05 +02:00
|
|
|
#define FN_NODE_OBJECT_TRANSFORMS 1205
|
2020-08-02 22:04:24 +02:00
|
|
|
#define FN_NODE_RANDOM_FLOAT 1206
|
2020-12-17 18:37:04 +01:00
|
|
|
#define FN_NODE_INPUT_VECTOR 1207
|
2021-02-19 16:03:14 -06:00
|
|
|
#define FN_NODE_INPUT_STRING 1208
|
2020-04-20 15:27:12 +02:00
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
2020-11-06 16:43:09 +11:00
|
|
|
void BKE_node_system_init(void);
|
|
|
|
void BKE_node_system_exit(void);
|
2007-03-26 15:07:38 +00:00
|
|
|
|
2017-08-29 12:20:55 +02:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/* evaluation support, */
|
|
|
|
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph;
|
2017-08-29 12:51:56 +02:00
|
|
|
|
2018-04-06 12:07:27 +02:00
|
|
|
void BKE_nodetree_shading_params_eval(struct Depsgraph *depsgraph,
|
2017-08-29 12:51:56 +02:00
|
|
|
struct bNodeTree *ntree_dst,
|
|
|
|
const struct bNodeTree *ntree_src);
|
2017-08-29 12:20:55 +02:00
|
|
|
|
2019-02-23 19:17:30 +11:00
|
|
|
extern struct bNodeType NodeTypeUndefined;
|
|
|
|
extern struct bNodeSocketType NodeSocketTypeUndefined;
|
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|