2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2005 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup spnode
|
|
|
|
|
* \brief lower level node drawing for nodes (boarders, headers etc), also node layout.
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
|
2022-09-01 19:46:19 +02:00
|
|
|
#include "BLI_color.hh"
|
2023-09-01 21:37:11 +02:00
|
|
|
#include "BLI_string.h"
|
2019-08-27 08:13:23 -06:00
|
|
|
#include "BLI_system.h"
|
2021-01-25 12:44:18 +01:00
|
|
|
#include "BLI_threads.h"
|
2008-12-24 10:33:10 +00:00
|
|
|
|
|
|
|
|
#include "DNA_node_types.h"
|
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
|
#include "DNA_screen_types.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "DNA_space_types.h"
|
|
|
|
|
#include "DNA_userdef_types.h"
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2023-11-16 11:41:55 +01:00
|
|
|
#include "BKE_context.hh"
|
|
|
|
|
#include "BKE_curve.hh"
|
2008-12-24 10:33:10 +00:00
|
|
|
#include "BKE_image.h"
|
2023-12-01 19:43:16 +01:00
|
|
|
#include "BKE_main.hh"
|
2023-05-15 15:14:22 +02:00
|
|
|
#include "BKE_node.hh"
|
2024-01-26 12:40:01 +01:00
|
|
|
#include "BKE_node_enum.hh"
|
2022-05-30 15:31:13 +02:00
|
|
|
#include "BKE_node_runtime.hh"
|
2023-11-16 11:41:55 +01:00
|
|
|
#include "BKE_node_tree_update.hh"
|
2024-02-10 19:16:25 +01:00
|
|
|
#include "BKE_scene.hh"
|
2012-06-19 17:29:58 +00:00
|
|
|
#include "BKE_tracking.h"
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2024-01-31 14:04:56 -05:00
|
|
|
#include "BLF_api.hh"
|
2024-02-09 18:59:42 +01:00
|
|
|
#include "BLT_translation.hh"
|
2012-05-22 14:13:33 +00:00
|
|
|
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "BIF_glutil.hh"
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2024-03-23 01:24:18 +01:00
|
|
|
#include "GPU_batch.hh"
|
|
|
|
|
#include "GPU_batch_presets.hh"
|
|
|
|
|
#include "GPU_framebuffer.hh"
|
|
|
|
|
#include "GPU_immediate.hh"
|
|
|
|
|
#include "GPU_matrix.hh"
|
|
|
|
|
#include "GPU_platform.hh"
|
|
|
|
|
#include "GPU_shader_shared.hh"
|
|
|
|
|
#include "GPU_state.hh"
|
2024-02-11 16:10:00 -05:00
|
|
|
#include "GPU_uniform_buffer.hh"
|
2016-10-14 23:45:55 -04:00
|
|
|
|
2024-01-05 11:16:57 -05:00
|
|
|
#include "DRW_engine.hh"
|
2020-11-24 13:18:57 +01:00
|
|
|
|
2023-08-10 22:40:27 +02:00
|
|
|
#include "RNA_access.hh"
|
|
|
|
|
#include "RNA_define.hh"
|
2024-07-10 18:30:02 +02:00
|
|
|
#include "RNA_prototypes.hh"
|
2008-12-29 00:55:23 +00:00
|
|
|
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "ED_node.hh"
|
|
|
|
|
#include "ED_space_api.hh"
|
2010-11-06 17:55:43 +00:00
|
|
|
|
2023-08-04 23:11:22 +02:00
|
|
|
#include "WM_api.hh"
|
|
|
|
|
#include "WM_types.hh"
|
2008-12-29 00:55:23 +00:00
|
|
|
|
2023-08-05 02:57:52 +02:00
|
|
|
#include "UI_resources.hh"
|
|
|
|
|
#include "UI_view2d.hh"
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2024-01-18 22:50:23 +02:00
|
|
|
#include "IMB_colormanagement.hh"
|
|
|
|
|
#include "IMB_imbuf_types.hh"
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2023-10-16 10:45:54 +02:00
|
|
|
#include "NOD_composite.hh"
|
2023-06-23 22:15:42 +02:00
|
|
|
#include "NOD_geometry.hh"
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
#include "NOD_geometry_nodes_gizmos.hh"
|
2021-10-22 11:56:05 +02:00
|
|
|
#include "NOD_node_declaration.hh"
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
#include "NOD_partial_eval.hh"
|
2013-03-18 16:34:57 +00:00
|
|
|
#include "NOD_shader.h"
|
2023-10-04 19:23:21 +02:00
|
|
|
#include "NOD_socket.hh"
|
2013-03-18 16:34:57 +00:00
|
|
|
#include "NOD_texture.h"
|
2021-11-12 12:12:27 -06:00
|
|
|
#include "node_intern.hh" /* own include */
|
2008-12-29 00:55:23 +00:00
|
|
|
|
2022-01-20 10:36:56 -06:00
|
|
|
namespace blender::ed::space_node {
|
2021-12-03 16:25:17 -05:00
|
|
|
|
2020-05-01 15:21:41 +02:00
|
|
|
/* Default flags for uiItemR(). Name is kept short since this is used a lot in this file. */
|
|
|
|
|
#define DEFAULT_FLAGS UI_ITEM_R_SPLIT_EMPTY_NAME
|
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* ****************** SOCKET BUTTON DRAW FUNCTIONS ***************** */
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_socket_button_label(bContext * /*C*/,
|
2013-05-08 14:58:41 +00:00
|
|
|
uiLayout *layout,
|
2022-10-03 17:37:25 -05:00
|
|
|
PointerRNA * /*ptr*/,
|
|
|
|
|
PointerRNA * /*node_ptr*/,
|
2013-05-08 14:58:41 +00:00
|
|
|
const char *text)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
2023-08-12 16:29:49 +10:00
|
|
|
uiItemL(layout, text, ICON_NONE);
|
2012-05-02 07:18:51 +00:00
|
|
|
}
|
|
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* ****************** BUTTON CALLBACKS FOR ALL TREES ***************** */
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_buts_value(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2021-06-02 17:19:36 +02:00
|
|
|
bNode *node = (bNode *)ptr->data;
|
2013-03-18 16:34:57 +00:00
|
|
|
/* first output stores value */
|
2021-06-02 17:19:36 +02:00
|
|
|
bNodeSocket *output = (bNodeSocket *)node->outputs.first;
|
2023-09-06 00:48:50 +02:00
|
|
|
PointerRNA sockptr = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, output);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
uiLayout *row = uiLayoutRow(layout, true);
|
|
|
|
|
uiItemR(row, &sockptr, "default_value", DEFAULT_FLAGS, "", ICON_NONE);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_buts_rgb(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2021-06-02 17:19:36 +02:00
|
|
|
bNode *node = (bNode *)ptr->data;
|
2013-03-18 16:34:57 +00:00
|
|
|
/* first output stores value */
|
2021-06-02 17:19:36 +02:00
|
|
|
bNodeSocket *output = (bNodeSocket *)node->outputs.first;
|
2013-03-18 16:34:57 +00:00
|
|
|
uiLayout *col;
|
2023-09-06 00:48:50 +02:00
|
|
|
PointerRNA sockptr = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, output);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
col = uiLayoutColumn(layout, false);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiTemplateColorPicker(col, &sockptr, "default_value", true, false, false, false);
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(col, &sockptr, "default_value", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_buts_mix_rgb(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2018-06-04 09:31:30 +02:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2020-09-08 15:20:07 +02:00
|
|
|
uiLayout *col = uiLayoutColumn(layout, false);
|
|
|
|
|
uiLayout *row = uiLayoutRow(col, true);
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(row, ptr, "blend_type", DEFAULT_FLAGS, "", ICON_NONE);
|
2019-03-26 21:16:47 +11:00
|
|
|
if (ELEM(ntree->type, NTREE_COMPOSIT, NTREE_TEXTURE)) {
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(row, ptr, "use_alpha", DEFAULT_FLAGS, "", ICON_IMAGE_RGB_ALPHA);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2012-07-10 09:12:33 +00:00
|
|
|
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(col, ptr, "use_clamp", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
2009-09-16 18:59:13 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_buts_time(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2009-09-16 18:59:13 +00:00
|
|
|
{
|
2018-08-23 10:25:54 +02:00
|
|
|
uiTemplateCurveMapping(layout, ptr, "curve", 's', false, false, false, false);
|
2009-09-16 18:59:13 +00:00
|
|
|
|
2021-12-29 11:16:18 -05:00
|
|
|
uiLayout *col = uiLayoutColumn(layout, true);
|
|
|
|
|
uiItemR(col, ptr, "frame_start", DEFAULT_FLAGS, IFACE_("Start"), ICON_NONE);
|
|
|
|
|
uiItemR(col, ptr, "frame_end", DEFAULT_FLAGS, IFACE_("End"), ICON_NONE);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_buts_colorramp(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2021-06-02 17:19:36 +02:00
|
|
|
uiTemplateColorRamp(layout, ptr, "color_ramp", false);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_buts_curvevec(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2018-08-23 10:25:54 +02:00
|
|
|
uiTemplateCurveMapping(layout, ptr, "mapping", 'v', false, false, false, false);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_buts_curvefloat(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2021-09-30 19:05:08 +01:00
|
|
|
{
|
|
|
|
|
uiTemplateCurveMapping(layout, ptr, "mapping", 0, false, false, false, false);
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-20 10:36:56 -06:00
|
|
|
} // namespace blender::ed::space_node
|
|
|
|
|
|
2012-06-21 14:12:14 +00:00
|
|
|
#define SAMPLE_FLT_ISNONE FLT_MAX
|
2022-02-23 18:24:08 +11:00
|
|
|
/* Bad! 2.5 will do better? ... no it won't! */
|
2019-01-15 23:24:20 +11:00
|
|
|
static float _sample_col[4] = {SAMPLE_FLT_ISNONE};
|
2012-06-21 14:12:14 +00:00
|
|
|
void ED_node_sample_set(const float col[4])
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2012-06-21 14:12:14 +00:00
|
|
|
if (col) {
|
|
|
|
|
copy_v4_v4(_sample_col, col);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
copy_v4_fl(_sample_col, SAMPLE_FLT_ISNONE);
|
|
|
|
|
}
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
2022-01-20 10:36:56 -06:00
|
|
|
namespace blender::ed::space_node {
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_buts_curvecol(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2021-06-02 17:19:36 +02:00
|
|
|
bNode *node = (bNode *)ptr->data;
|
|
|
|
|
CurveMapping *cumap = (CurveMapping *)node->storage;
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2012-06-21 14:12:14 +00:00
|
|
|
if (_sample_col[0] != SAMPLE_FLT_ISNONE) {
|
2009-09-16 18:59:13 +00:00
|
|
|
cumap->flag |= CUMA_DRAW_SAMPLE;
|
2011-09-11 02:50:01 +00:00
|
|
|
copy_v3_v3(cumap->sample, _sample_col);
|
2009-09-16 18:59:13 +00:00
|
|
|
}
|
2012-06-21 14:12:14 +00:00
|
|
|
else {
|
2009-09-16 18:59:13 +00:00
|
|
|
cumap->flag &= ~CUMA_DRAW_SAMPLE;
|
2012-06-21 14:12:14 +00:00
|
|
|
}
|
2009-09-16 18:59:13 +00:00
|
|
|
|
2021-02-05 16:23:34 +11:00
|
|
|
/* "Tone" (Standard/Film-like) only used in the Compositor. */
|
2021-01-05 16:43:59 +01:00
|
|
|
bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
|
|
|
|
|
uiTemplateCurveMapping(
|
|
|
|
|
layout, ptr, "mapping", 'c', false, false, false, (ntree->type == NTREE_COMPOSIT));
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_buts_normal(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2021-06-02 17:19:36 +02:00
|
|
|
bNode *node = (bNode *)ptr->data;
|
2013-03-18 16:34:57 +00:00
|
|
|
/* first output stores normal */
|
2021-06-02 17:19:36 +02:00
|
|
|
bNodeSocket *output = (bNodeSocket *)node->outputs.first;
|
2023-09-06 00:48:50 +02:00
|
|
|
PointerRNA sockptr = RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, output);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(layout, &sockptr, "default_value", DEFAULT_FLAGS, "", ICON_NONE);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2024-08-28 16:54:19 +02:00
|
|
|
static void node_buts_texture(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2021-06-02 17:19:36 +02:00
|
|
|
bNode *node = (bNode *)ptr->data;
|
2009-09-16 18:59:13 +00:00
|
|
|
|
2012-05-27 19:38:10 +00:00
|
|
|
short multi = (node->id && ((Tex *)node->id)->use_nodes && (node->type != CMP_NODE_TEXTURE) &&
|
|
|
|
|
(node->type != TEX_NODE_TEXTURE));
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2024-09-17 12:22:18 +02:00
|
|
|
uiTemplateID(layout, C, ptr, "texture", "texture.new", nullptr, nullptr);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (multi) {
|
2021-06-26 21:35:18 +10:00
|
|
|
/* Number Drawing not optimal here, better have a list. */
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(layout, ptr, "node_output", DEFAULT_FLAGS, "", ICON_NONE);
|
2009-09-16 18:59:13 +00:00
|
|
|
}
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_buts_math(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2018-06-04 09:31:30 +02:00
|
|
|
{
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(layout, ptr, "operation", DEFAULT_FLAGS, "", ICON_NONE);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(layout, ptr, "use_clamp", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_buts_combsep_color(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
{
|
|
|
|
|
uiItemR(layout, ptr, "mode", DEFAULT_FLAGS, "", ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-03 12:45:12 +02:00
|
|
|
NodeResizeDirection node_get_resize_direction(const SpaceNode &snode,
|
|
|
|
|
const bNode *node,
|
|
|
|
|
const int x,
|
|
|
|
|
const int y)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
2023-06-03 12:45:12 +02:00
|
|
|
const float size = NODE_RESIZE_MARGIN * math::max(snode.runtime->aspect, 1.0f);
|
|
|
|
|
|
2021-12-05 16:45:41 -05:00
|
|
|
if (node->type == NODE_FRAME) {
|
|
|
|
|
NodeFrame *data = (NodeFrame *)node->storage;
|
|
|
|
|
|
|
|
|
|
/* shrinking frame size is determined by child nodes */
|
|
|
|
|
if (!(data->flag & NODE_FRAME_RESIZEABLE)) {
|
|
|
|
|
return NODE_RESIZE_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NodeResizeDirection dir = NODE_RESIZE_NONE;
|
|
|
|
|
|
2022-11-18 12:46:20 +01:00
|
|
|
const rctf &totr = node->runtime->totr;
|
2022-01-05 12:32:00 +01:00
|
|
|
|
|
|
|
|
if (x > totr.xmax - size && x <= totr.xmax && y >= totr.ymin && y < totr.ymax) {
|
2021-12-05 16:45:41 -05:00
|
|
|
dir |= NODE_RESIZE_RIGHT;
|
|
|
|
|
}
|
|
|
|
|
if (x >= totr.xmin && x < totr.xmin + size && y >= totr.ymin && y < totr.ymax) {
|
|
|
|
|
dir |= NODE_RESIZE_LEFT;
|
|
|
|
|
}
|
|
|
|
|
if (x >= totr.xmin && x < totr.xmax && y >= totr.ymax - size && y < totr.ymax) {
|
|
|
|
|
dir |= NODE_RESIZE_TOP;
|
|
|
|
|
}
|
|
|
|
|
if (x >= totr.xmin && x < totr.xmax && y >= totr.ymin && y < totr.ymin + size) {
|
|
|
|
|
dir |= NODE_RESIZE_BOTTOM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dir;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
if (node->flag & NODE_HIDDEN) {
|
|
|
|
|
/* right part of node */
|
2022-11-18 12:46:20 +01:00
|
|
|
rctf totr = node->runtime->totr;
|
|
|
|
|
totr.xmin = node->runtime->totr.xmax - 1.0f * U.widget_unit;
|
2019-03-26 21:16:47 +11:00
|
|
|
if (BLI_rctf_isect_pt(&totr, x, y)) {
|
2012-05-22 14:13:33 +00:00
|
|
|
return NODE_RESIZE_RIGHT;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2020-07-03 17:20:08 +02:00
|
|
|
|
2021-12-03 11:05:59 -05:00
|
|
|
return NODE_RESIZE_NONE;
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-11-18 12:46:20 +01:00
|
|
|
const rctf &totr = node->runtime->totr;
|
2021-12-03 11:05:59 -05:00
|
|
|
NodeResizeDirection dir = NODE_RESIZE_NONE;
|
2020-07-03 17:20:08 +02:00
|
|
|
|
|
|
|
|
if (x >= totr.xmax - size && x < totr.xmax && y >= totr.ymin && y < totr.ymax) {
|
|
|
|
|
dir |= NODE_RESIZE_RIGHT;
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
2020-07-03 17:20:08 +02:00
|
|
|
if (x >= totr.xmin && x < totr.xmin + size && y >= totr.ymin && y < totr.ymax) {
|
|
|
|
|
dir |= NODE_RESIZE_LEFT;
|
|
|
|
|
}
|
|
|
|
|
return dir;
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ****************** BUTTON CALLBACKS FOR COMMON NODES ***************** */
|
|
|
|
|
|
2013-10-10 11:33:20 +00:00
|
|
|
static void node_draw_buttons_group(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
2011-11-04 13:31:15 +00:00
|
|
|
{
|
2024-09-17 12:22:18 +02:00
|
|
|
uiTemplateIDBrowse(layout, C, ptr, "node_tree", nullptr, nullptr, nullptr);
|
2011-11-04 13:31:15 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_buts_frame_ex(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2012-05-22 14:13:33 +00:00
|
|
|
{
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(layout, ptr, "label_size", DEFAULT_FLAGS, IFACE_("Label Size"), ICON_NONE);
|
|
|
|
|
uiItemR(layout, ptr, "shrink", DEFAULT_FLAGS, IFACE_("Shrink"), ICON_NONE);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(layout, ptr, "text", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
|
|
|
|
|
2024-05-13 16:07:12 +02:00
|
|
|
static void node_common_set_butfunc(blender::bke::bNodeType *ntype)
|
2011-09-05 21:01:50 +00:00
|
|
|
{
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (ntype->type) {
|
2011-09-05 21:01:50 +00:00
|
|
|
case NODE_GROUP:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_draw_buttons_group;
|
2011-09-05 21:01:50 +00:00
|
|
|
break;
|
|
|
|
|
case NODE_FRAME:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons_ex = node_buts_frame_ex;
|
2011-09-05 21:01:50 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* ****************** BUTTON CALLBACKS FOR SHADER NODES ***************** */
|
2012-06-04 19:38:33 +00:00
|
|
|
|
2012-07-09 23:07:15 +00:00
|
|
|
static void node_buts_image_user(uiLayout *layout,
|
|
|
|
|
bContext *C,
|
|
|
|
|
PointerRNA *ptr,
|
2018-01-26 08:39:38 +01:00
|
|
|
PointerRNA *imaptr,
|
|
|
|
|
PointerRNA *iuserptr,
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
const bool show_layer_selection,
|
|
|
|
|
const bool show_color_management)
|
2012-06-04 19:38:33 +00:00
|
|
|
{
|
2022-03-07 17:36:27 +01:00
|
|
|
Image *image = (Image *)imaptr->data;
|
|
|
|
|
if (!image) {
|
2012-06-04 19:38:33 +00:00
|
|
|
return;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2022-03-07 17:36:27 +01:00
|
|
|
ImageUser *iuser = (ImageUser *)iuserptr->data;
|
2012-06-04 19:38:33 +00:00
|
|
|
|
2020-09-08 15:20:07 +02:00
|
|
|
uiLayout *col = uiLayoutColumn(layout, false);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(col, imaptr, "source", DEFAULT_FLAGS, "", ICON_NONE);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-09-08 15:20:07 +02:00
|
|
|
const int source = RNA_enum_get(imaptr, "source");
|
2012-06-04 19:38:33 +00:00
|
|
|
|
|
|
|
|
if (source == IMA_SRC_SEQUENCE) {
|
2019-01-15 23:24:20 +11:00
|
|
|
/* don't use iuser->framenr directly
|
|
|
|
|
* because it may not be updated if auto-refresh is off */
|
2012-06-04 19:38:33 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
2014-01-20 18:54:03 +01:00
|
|
|
|
2012-06-04 19:38:33 +00:00
|
|
|
char numstr[32];
|
2022-06-30 18:36:42 +02:00
|
|
|
const int framenr = BKE_image_user_frame_get(iuser, scene->r.cfra, nullptr);
|
2023-05-09 12:50:37 +10:00
|
|
|
SNPRINTF(numstr, IFACE_("Frame: %d"), framenr);
|
2012-06-04 19:38:33 +00:00
|
|
|
uiItemL(layout, numstr, ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ELEM(source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
|
2014-04-01 11:34:00 +11:00
|
|
|
col = uiLayoutColumn(layout, true);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(col, ptr, "frame_duration", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
|
|
|
|
uiItemR(col, ptr, "frame_start", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
|
|
|
|
uiItemR(col, ptr, "frame_offset", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
|
|
|
|
uiItemR(col, ptr, "use_cyclic", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
|
|
|
|
uiItemR(col, ptr, "use_auto_refresh", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
2012-06-04 19:38:33 +00:00
|
|
|
}
|
|
|
|
|
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
if (show_layer_selection && RNA_enum_get(imaptr, "type") == IMA_TYPE_MULTILAYER &&
|
2015-04-06 10:40:12 -03:00
|
|
|
RNA_boolean_get(ptr, "has_layers"))
|
|
|
|
|
{
|
2015-02-09 23:11:30 +01:00
|
|
|
col = uiLayoutColumn(layout, false);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(col, ptr, "layer", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
2015-02-09 23:11:30 +01:00
|
|
|
}
|
2019-04-23 13:56:30 +02:00
|
|
|
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
if (show_color_management) {
|
2022-03-07 17:36:27 +01:00
|
|
|
uiLayout *split = uiLayoutSplit(layout, 0.33f, true);
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
PointerRNA colorspace_settings_ptr = RNA_pointer_get(imaptr, "colorspace_settings");
|
|
|
|
|
uiItemL(split, IFACE_("Color Space"), ICON_NONE);
|
|
|
|
|
uiItemR(split, &colorspace_settings_ptr, "name", DEFAULT_FLAGS, "", ICON_NONE);
|
2019-05-22 10:06:31 +02:00
|
|
|
|
2022-03-07 17:36:27 +01:00
|
|
|
if (image->source != IMA_SRC_GENERATED) {
|
|
|
|
|
split = uiLayoutSplit(layout, 0.33f, true);
|
|
|
|
|
uiItemL(split, IFACE_("Alpha"), ICON_NONE);
|
|
|
|
|
uiItemR(split, imaptr, "alpha_mode", DEFAULT_FLAGS, "", ICON_NONE);
|
|
|
|
|
|
|
|
|
|
bool is_data = IMB_colormanagement_space_name_is_data(image->colorspace_settings.name);
|
|
|
|
|
uiLayoutSetActive(split, !is_data);
|
|
|
|
|
}
|
|
|
|
|
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
/* Avoid losing changes image is painted. */
|
2021-06-02 17:19:36 +02:00
|
|
|
if (BKE_image_is_dirty((Image *)imaptr->data)) {
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
uiLayoutSetEnabled(split, false);
|
|
|
|
|
}
|
2019-05-22 10:06:31 +02:00
|
|
|
}
|
2012-06-04 19:38:33 +00:00
|
|
|
}
|
|
|
|
|
|
2011-11-08 11:38:16 +00:00
|
|
|
static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
|
|
|
|
{
|
2012-06-04 19:38:33 +00:00
|
|
|
PointerRNA imaptr = RNA_pointer_get(ptr, "image");
|
|
|
|
|
PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user");
|
|
|
|
|
|
2014-01-20 18:54:03 +01:00
|
|
|
uiLayoutSetContextPointer(layout, "image_user", &iuserptr);
|
2024-09-17 12:22:18 +02:00
|
|
|
uiTemplateID(layout, C, ptr, "image", "IMAGE_OT_new", "IMAGE_OT_open", nullptr);
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(layout, ptr, "interpolation", DEFAULT_FLAGS, "", ICON_NONE);
|
|
|
|
|
uiItemR(layout, ptr, "projection", DEFAULT_FLAGS, "", ICON_NONE);
|
2012-09-04 13:29:07 +00:00
|
|
|
|
2012-09-08 06:40:03 +00:00
|
|
|
if (RNA_enum_get(ptr, "projection") == SHD_PROJ_BOX) {
|
I18n: Extract many custom labels defined in uiItem*
Those labels needed a manual translation with IFACE_() or RPT_():
- "Add Item",
- "Blend",
- "Cached from the first line art modifier.",
- "Custom Curve",
- "Custom Path",
- "Custom Range",
- "End",
- "Enter a Unicode codepoint hex value",
- "Forward Axis",
- "Insert Unicode Character",
- "Mid Level",
- "Min",
- "Mode",
- "No Items",
- "Object",
- "Path",
- "Probability",
- "Sample Radius",
- "Sharp edges or custom normals detected, disabling GPU subdivision",
- "Start",
- "Texture Mapping",
- "Up Axis",
- "Using both CPU and GPU subdivision",
2024-06-15 14:12:27 +02:00
|
|
|
uiItemR(layout, ptr, "projection_blend", DEFAULT_FLAGS, IFACE_("Blend"), ICON_NONE);
|
2012-09-08 06:40:03 +00:00
|
|
|
}
|
2011-11-08 11:38:16 +00:00
|
|
|
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(layout, ptr, "extension", DEFAULT_FLAGS, "", ICON_NONE);
|
2015-07-21 22:09:52 +02:00
|
|
|
|
2021-07-03 23:08:40 +10:00
|
|
|
/* NOTE: image user properties used directly here, unlike compositor image node,
|
2012-07-02 16:27:09 +00:00
|
|
|
* which redefines them in the node struct RNA to get proper updates.
|
|
|
|
|
*/
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
node_buts_image_user(layout, C, &iuserptr, &imaptr, &iuserptr, false, true);
|
2012-06-04 19:38:33 +00:00
|
|
|
}
|
2012-03-08 19:52:58 +00:00
|
|
|
|
2013-10-10 11:33:20 +00:00
|
|
|
static void node_shader_buts_tex_image_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
2013-07-22 08:56:51 +00:00
|
|
|
{
|
|
|
|
|
PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user");
|
2021-06-02 17:19:36 +02:00
|
|
|
uiTemplateImage(layout, C, ptr, "image", &iuserptr, false, false);
|
2013-07-22 08:56:51 +00:00
|
|
|
}
|
|
|
|
|
|
2012-03-08 19:52:58 +00:00
|
|
|
static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
|
|
|
|
{
|
2012-06-04 19:38:33 +00:00
|
|
|
PointerRNA imaptr = RNA_pointer_get(ptr, "image");
|
|
|
|
|
PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user");
|
|
|
|
|
|
2014-01-20 18:54:03 +01:00
|
|
|
uiLayoutSetContextPointer(layout, "image_user", &iuserptr);
|
2024-09-17 12:22:18 +02:00
|
|
|
uiTemplateID(layout, C, ptr, "image", "IMAGE_OT_new", "IMAGE_OT_open", nullptr);
|
2012-06-04 19:38:33 +00:00
|
|
|
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(layout, ptr, "interpolation", DEFAULT_FLAGS, "", ICON_NONE);
|
|
|
|
|
uiItemR(layout, ptr, "projection", DEFAULT_FLAGS, "", ICON_NONE);
|
2019-04-23 13:56:30 +02:00
|
|
|
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
node_buts_image_user(layout, C, &iuserptr, &imaptr, &iuserptr, false, true);
|
2012-03-08 19:52:58 +00:00
|
|
|
}
|
|
|
|
|
|
2015-02-09 22:25:12 +01:00
|
|
|
static void node_shader_buts_tex_environment_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user");
|
2021-06-02 17:19:36 +02:00
|
|
|
uiTemplateImage(layout, C, ptr, "image", &iuserptr, false, false);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(layout, ptr, "interpolation", DEFAULT_FLAGS, IFACE_("Interpolation"), ICON_NONE);
|
|
|
|
|
uiItemR(layout, ptr, "projection", DEFAULT_FLAGS, IFACE_("Projection"), ICON_NONE);
|
2015-02-09 22:25:12 +01:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_shader_buts_displacement(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2018-01-21 00:40:42 +01:00
|
|
|
{
|
2023-08-12 16:29:49 +10:00
|
|
|
uiItemR(layout, ptr, "space", DEFAULT_FLAGS, "", ICON_NONE);
|
2018-01-21 00:40:42 +01:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_shader_buts_glossy(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2011-11-08 11:38:16 +00:00
|
|
|
{
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(layout, ptr, "distribution", DEFAULT_FLAGS, "", ICON_NONE);
|
2011-11-08 11:38:16 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_buts_output_shader(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2018-07-05 12:44:15 +02:00
|
|
|
{
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(layout, ptr, "target", DEFAULT_FLAGS, "", ICON_NONE);
|
2018-07-05 12:44:15 +02:00
|
|
|
}
|
|
|
|
|
|
2024-10-02 11:05:28 +02:00
|
|
|
static void node_shader_buts_scatter(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
uiItemR(layout, ptr, "phase", DEFAULT_FLAGS, "", ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* only once called */
|
2024-05-13 16:07:12 +02:00
|
|
|
static void node_shader_set_butfunc(blender::bke::bNodeType *ntype)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (ntype->type) {
|
2008-12-24 10:33:10 +00:00
|
|
|
case SH_NODE_NORMAL:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_normal;
|
2008-12-24 10:33:10 +00:00
|
|
|
break;
|
|
|
|
|
case SH_NODE_CURVE_VEC:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_curvevec;
|
2008-12-24 10:33:10 +00:00
|
|
|
break;
|
|
|
|
|
case SH_NODE_CURVE_RGB:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_curvecol;
|
2008-12-24 10:33:10 +00:00
|
|
|
break;
|
2021-09-30 19:05:08 +01:00
|
|
|
case SH_NODE_CURVE_FLOAT:
|
|
|
|
|
ntype->draw_buttons = node_buts_curvefloat;
|
|
|
|
|
break;
|
2008-12-24 10:33:10 +00:00
|
|
|
case SH_NODE_VALUE:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_value;
|
2008-12-24 10:33:10 +00:00
|
|
|
break;
|
|
|
|
|
case SH_NODE_RGB:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_rgb;
|
2008-12-24 10:33:10 +00:00
|
|
|
break;
|
2022-08-30 11:05:46 +01:00
|
|
|
case SH_NODE_MIX_RGB_LEGACY:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_mix_rgb;
|
2008-12-24 10:33:10 +00:00
|
|
|
break;
|
|
|
|
|
case SH_NODE_VALTORGB:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_colorramp;
|
2008-12-24 10:33:10 +00:00
|
|
|
break;
|
2018-06-04 09:31:30 +02:00
|
|
|
case SH_NODE_MATH:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_math;
|
2018-06-04 09:31:30 +02:00
|
|
|
break;
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
case SH_NODE_COMBINE_COLOR:
|
|
|
|
|
case SH_NODE_SEPARATE_COLOR:
|
|
|
|
|
ntype->draw_buttons = node_buts_combsep_color;
|
|
|
|
|
break;
|
2011-11-08 11:38:16 +00:00
|
|
|
case SH_NODE_TEX_IMAGE:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_shader_buts_tex_image;
|
|
|
|
|
ntype->draw_buttons_ex = node_shader_buts_tex_image_ex;
|
2011-11-08 11:38:16 +00:00
|
|
|
break;
|
|
|
|
|
case SH_NODE_TEX_ENVIRONMENT:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_shader_buts_tex_environment;
|
2015-02-09 22:25:12 +01:00
|
|
|
ntype->draw_buttons_ex = node_shader_buts_tex_environment_ex;
|
2011-11-08 11:38:16 +00:00
|
|
|
break;
|
2018-01-21 00:40:42 +01:00
|
|
|
case SH_NODE_DISPLACEMENT:
|
|
|
|
|
case SH_NODE_VECTOR_DISPLACEMENT:
|
|
|
|
|
ntype->draw_buttons = node_shader_buts_displacement;
|
|
|
|
|
break;
|
2011-11-08 11:38:16 +00:00
|
|
|
case SH_NODE_BSDF_GLASS:
|
2012-11-06 19:59:02 +00:00
|
|
|
case SH_NODE_BSDF_REFRACTION:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_shader_buts_glossy;
|
2011-11-08 11:38:16 +00:00
|
|
|
break;
|
2018-07-05 12:44:15 +02:00
|
|
|
case SH_NODE_OUTPUT_MATERIAL:
|
2018-06-27 14:41:53 +02:00
|
|
|
case SH_NODE_OUTPUT_LIGHT:
|
2018-07-05 12:44:15 +02:00
|
|
|
case SH_NODE_OUTPUT_WORLD:
|
|
|
|
|
ntype->draw_buttons = node_buts_output_shader;
|
|
|
|
|
break;
|
2024-10-02 11:05:28 +02:00
|
|
|
case SH_NODE_VOLUME_SCATTER:
|
|
|
|
|
ntype->draw_buttons = node_shader_buts_scatter;
|
|
|
|
|
break;
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ****************** BUTTON CALLBACKS FOR COMPOSITE NODES ***************** */
|
|
|
|
|
|
2015-04-06 10:40:12 -03:00
|
|
|
static void node_buts_image_views(uiLayout *layout,
|
2022-10-03 17:37:25 -05:00
|
|
|
bContext * /*C*/,
|
2015-04-06 10:40:12 -03:00
|
|
|
PointerRNA *ptr,
|
|
|
|
|
PointerRNA *imaptr)
|
|
|
|
|
{
|
|
|
|
|
uiLayout *col;
|
|
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (!imaptr->data) {
|
2015-04-06 10:40:12 -03:00
|
|
|
return;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
col = uiLayoutColumn(layout, false);
|
|
|
|
|
|
|
|
|
|
if (RNA_boolean_get(ptr, "has_views")) {
|
2019-03-26 21:16:47 +11:00
|
|
|
if (RNA_enum_get(ptr, "view") == 0) {
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(col, ptr, "view", DEFAULT_FLAGS, nullptr, ICON_CAMERA_STEREO);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
|
|
|
|
else {
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(col, ptr, "view", DEFAULT_FLAGS, nullptr, ICON_SCENE);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2015-04-06 10:40:12 -03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2021-06-02 17:19:36 +02:00
|
|
|
bNode *node = (bNode *)ptr->data;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2023-09-06 00:48:50 +02:00
|
|
|
PointerRNA iuserptr = RNA_pointer_create(ptr->owner_id, &RNA_ImageUser, node->storage);
|
2014-01-20 18:54:03 +01:00
|
|
|
uiLayoutSetContextPointer(layout, "image_user", &iuserptr);
|
2024-09-17 12:22:18 +02:00
|
|
|
uiTemplateID(layout, C, ptr, "image", "IMAGE_OT_new", "IMAGE_OT_open", nullptr);
|
2019-03-26 21:16:47 +11:00
|
|
|
if (!node->id) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2020-09-08 15:20:07 +02:00
|
|
|
PointerRNA imaptr = RNA_pointer_get(ptr, "image");
|
2014-01-20 18:54:03 +01:00
|
|
|
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
node_buts_image_user(layout, C, ptr, &imaptr, &iuserptr, true, true);
|
2015-04-06 10:40:12 -03:00
|
|
|
|
|
|
|
|
node_buts_image_views(layout, C, ptr, &imaptr);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-10 11:33:20 +00:00
|
|
|
static void node_composit_buts_image_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
2012-09-25 10:14:07 +00:00
|
|
|
{
|
2021-06-02 17:19:36 +02:00
|
|
|
bNode *node = (bNode *)ptr->data;
|
2012-09-25 10:14:07 +00:00
|
|
|
|
2023-09-06 00:48:50 +02:00
|
|
|
PointerRNA iuserptr = RNA_pointer_create(ptr->owner_id, &RNA_ImageUser, node->storage);
|
2014-01-20 18:54:03 +01:00
|
|
|
uiLayoutSetContextPointer(layout, "image_user", &iuserptr);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiTemplateImage(layout, C, ptr, "image", &iuserptr, false, true);
|
2012-09-25 10:14:07 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_composit_buts_huecorrect(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
{
|
2021-12-15 21:30:04 -05:00
|
|
|
bNode *node = (bNode *)ptr->data;
|
|
|
|
|
CurveMapping *cumap = (CurveMapping *)node->storage;
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
|
2021-12-15 21:30:04 -05:00
|
|
|
if (_sample_col[0] != SAMPLE_FLT_ISNONE) {
|
|
|
|
|
cumap->flag |= CUMA_DRAW_SAMPLE;
|
|
|
|
|
copy_v3_v3(cumap->sample, _sample_col);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
cumap->flag &= ~CUMA_DRAW_SAMPLE;
|
|
|
|
|
}
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
|
2021-12-15 21:30:04 -05:00
|
|
|
uiTemplateCurveMapping(layout, ptr, "mapping", 'h', false, false, false, false);
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_composit_buts_ycc(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2012-08-14 14:31:39 +00:00
|
|
|
{
|
2021-12-15 21:30:04 -05:00
|
|
|
uiItemR(layout, ptr, "mode", DEFAULT_FLAGS, "", ICON_NONE);
|
2012-08-14 14:31:39 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_composit_buts_combsep_color(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
{
|
|
|
|
|
bNode *node = (bNode *)ptr->data;
|
|
|
|
|
NodeCMPCombSepColor *storage = (NodeCMPCombSepColor *)node->storage;
|
|
|
|
|
|
|
|
|
|
uiItemR(layout, ptr, "mode", DEFAULT_FLAGS, "", ICON_NONE);
|
|
|
|
|
if (storage->mode == CMP_NODE_COMBSEP_COLOR_YCC) {
|
|
|
|
|
uiItemR(layout, ptr, "ycc_mode", DEFAULT_FLAGS, "", ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
static void node_composit_backdrop_boxmask(
|
|
|
|
|
SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y)
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
{
|
2021-06-02 17:19:36 +02:00
|
|
|
NodeBoxMask *boxmask = (NodeBoxMask *)node->storage;
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
const float backdropWidth = backdrop->x;
|
|
|
|
|
const float backdropHeight = backdrop->y;
|
2012-05-27 19:38:10 +00:00
|
|
|
const float aspect = backdropWidth / backdropHeight;
|
Cleanup: Internal degrees removal.
This patch changes most of the reamining degrees usage in internal code into radians.
I let a few which I know off asside, for reasons explained below - and I'm not sure to have found out all of them.
WARNING: this introduces forward incompatibility, which means files saved from this version won't open 100% correctly
in previous versions (a few angle properties would use radians values as degrees...).
Details:
- Data:
-- Lamp.spotsize: Game engine exposed this setting in degrees, to not break the API here I kept it as such
(using getter/setter functions), still using radians internally.
-- Mesh.smoothresh: Didn't touch to this one, as we will hopefully replace it completely by loop normals currently in dev.
- Modifiers:
-- EdgeSplitModifierData.split_angle, BevelModifierData.bevel_angle: Done.
- Postprocessing:
-- WipeVars.angle (sequencer's effect), NodeBokehImage.angle, NodeBoxMask.rotation, NodeEllipseMask.rotation: Done.
- BGE:
-- bConstraintActuator: Orientation type done (the minloc[0] & maxloc[0] cases). Did not touch to 'limit location' type,
it can also limit rotation, but it exposes through RNA the same limit_min/limit_max, which hence
can be either distance or angle values, depending on the mode. Will leave this to BGE team.
-- bSoundActuator.cone_outer_angle_3d, bSoundActuator.cone_inner_angle_3d: Done (note I kept degrees in BGE itself,
as it seems this is the expected value here...).
-- bRadarSensor.angle: Done.
Reviewers: brecht, campbellbarton, sergey, gaiaclary, dfelinto, moguri, jbakker, lukastoenne, howardt
Reviewed By: brecht, campbellbarton, sergey, gaiaclary, moguri, jbakker, lukastoenne, howardt
Thanks to all!
Differential Revision: http://developer.blender.org/D59
2013-12-03 20:09:25 +01:00
|
|
|
const float rad = -boxmask->rotation;
|
2012-05-22 21:16:59 +00:00
|
|
|
const float cosine = cosf(rad);
|
|
|
|
|
const float sine = sinf(rad);
|
|
|
|
|
const float halveBoxWidth = backdropWidth * (boxmask->width / 2.0f);
|
|
|
|
|
const float halveBoxHeight = backdropHeight * (boxmask->height / 2.0f) * aspect;
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
|
|
|
|
|
float cx, cy, x1, x2, x3, x4;
|
|
|
|
|
float y1, y2, y3, y4;
|
|
|
|
|
|
2012-05-27 19:38:10 +00:00
|
|
|
cx = x + snode->zoom * backdropWidth * boxmask->x;
|
|
|
|
|
cy = y + snode->zoom * backdropHeight * boxmask->y;
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
|
2012-05-27 19:38:10 +00:00
|
|
|
x1 = cx - (cosine * halveBoxWidth + sine * halveBoxHeight) * snode->zoom;
|
|
|
|
|
x2 = cx - (cosine * -halveBoxWidth + sine * halveBoxHeight) * snode->zoom;
|
|
|
|
|
x3 = cx - (cosine * -halveBoxWidth + sine * -halveBoxHeight) * snode->zoom;
|
|
|
|
|
x4 = cx - (cosine * halveBoxWidth + sine * -halveBoxHeight) * snode->zoom;
|
|
|
|
|
y1 = cy - (-sine * halveBoxWidth + cosine * halveBoxHeight) * snode->zoom;
|
|
|
|
|
y2 = cy - (-sine * -halveBoxWidth + cosine * halveBoxHeight) * snode->zoom;
|
|
|
|
|
y3 = cy - (-sine * -halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom;
|
|
|
|
|
y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom;
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
GPUVertFormat *format = immVertexFormat();
|
|
|
|
|
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2016-12-01 17:07:39 +01:00
|
|
|
|
2022-09-01 09:31:07 -03:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
2016-12-01 17:07:39 +01:00
|
|
|
|
|
|
|
|
immUniformColor3f(1.0f, 1.0f, 1.0f);
|
|
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINE_LOOP, 4);
|
2016-12-01 17:07:39 +01:00
|
|
|
immVertex2f(pos, x1, y1);
|
|
|
|
|
immVertex2f(pos, x2, y2);
|
|
|
|
|
immVertex2f(pos, x3, y3);
|
|
|
|
|
immVertex2f(pos, x4, y4);
|
|
|
|
|
immEnd();
|
|
|
|
|
|
|
|
|
|
immUnbindProgram();
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
}
|
|
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
static void node_composit_backdrop_ellipsemask(
|
|
|
|
|
SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y)
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
{
|
2021-06-02 17:19:36 +02:00
|
|
|
NodeEllipseMask *ellipsemask = (NodeEllipseMask *)node->storage;
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
const float backdropWidth = backdrop->x;
|
|
|
|
|
const float backdropHeight = backdrop->y;
|
2012-05-22 21:16:59 +00:00
|
|
|
const float aspect = backdropWidth / backdropHeight;
|
Cleanup: Internal degrees removal.
This patch changes most of the reamining degrees usage in internal code into radians.
I let a few which I know off asside, for reasons explained below - and I'm not sure to have found out all of them.
WARNING: this introduces forward incompatibility, which means files saved from this version won't open 100% correctly
in previous versions (a few angle properties would use radians values as degrees...).
Details:
- Data:
-- Lamp.spotsize: Game engine exposed this setting in degrees, to not break the API here I kept it as such
(using getter/setter functions), still using radians internally.
-- Mesh.smoothresh: Didn't touch to this one, as we will hopefully replace it completely by loop normals currently in dev.
- Modifiers:
-- EdgeSplitModifierData.split_angle, BevelModifierData.bevel_angle: Done.
- Postprocessing:
-- WipeVars.angle (sequencer's effect), NodeBokehImage.angle, NodeBoxMask.rotation, NodeEllipseMask.rotation: Done.
- BGE:
-- bConstraintActuator: Orientation type done (the minloc[0] & maxloc[0] cases). Did not touch to 'limit location' type,
it can also limit rotation, but it exposes through RNA the same limit_min/limit_max, which hence
can be either distance or angle values, depending on the mode. Will leave this to BGE team.
-- bSoundActuator.cone_outer_angle_3d, bSoundActuator.cone_inner_angle_3d: Done (note I kept degrees in BGE itself,
as it seems this is the expected value here...).
-- bRadarSensor.angle: Done.
Reviewers: brecht, campbellbarton, sergey, gaiaclary, dfelinto, moguri, jbakker, lukastoenne, howardt
Reviewed By: brecht, campbellbarton, sergey, gaiaclary, moguri, jbakker, lukastoenne, howardt
Thanks to all!
Differential Revision: http://developer.blender.org/D59
2013-12-03 20:09:25 +01:00
|
|
|
const float rad = -ellipsemask->rotation;
|
2012-05-22 21:16:59 +00:00
|
|
|
const float cosine = cosf(rad);
|
|
|
|
|
const float sine = sinf(rad);
|
|
|
|
|
const float halveBoxWidth = backdropWidth * (ellipsemask->width / 2.0f);
|
|
|
|
|
const float halveBoxHeight = backdropHeight * (ellipsemask->height / 2.0f) * aspect;
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
|
|
|
|
|
float cx, cy, x1, x2, x3, x4;
|
|
|
|
|
float y1, y2, y3, y4;
|
|
|
|
|
|
2012-05-27 19:38:10 +00:00
|
|
|
cx = x + snode->zoom * backdropWidth * ellipsemask->x;
|
|
|
|
|
cy = y + snode->zoom * backdropHeight * ellipsemask->y;
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
|
2012-05-27 19:38:10 +00:00
|
|
|
x1 = cx - (cosine * halveBoxWidth + sine * halveBoxHeight) * snode->zoom;
|
|
|
|
|
x2 = cx - (cosine * -halveBoxWidth + sine * halveBoxHeight) * snode->zoom;
|
|
|
|
|
x3 = cx - (cosine * -halveBoxWidth + sine * -halveBoxHeight) * snode->zoom;
|
|
|
|
|
x4 = cx - (cosine * halveBoxWidth + sine * -halveBoxHeight) * snode->zoom;
|
|
|
|
|
y1 = cy - (-sine * halveBoxWidth + cosine * halveBoxHeight) * snode->zoom;
|
|
|
|
|
y2 = cy - (-sine * -halveBoxWidth + cosine * halveBoxHeight) * snode->zoom;
|
|
|
|
|
y3 = cy - (-sine * -halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom;
|
|
|
|
|
y4 = cy - (-sine * halveBoxWidth + cosine * -halveBoxHeight) * snode->zoom;
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
GPUVertFormat *format = immVertexFormat();
|
|
|
|
|
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2016-12-01 17:07:39 +01:00
|
|
|
|
2022-09-01 09:31:07 -03:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
2016-12-01 17:07:39 +01:00
|
|
|
|
|
|
|
|
immUniformColor3f(1.0f, 1.0f, 1.0f);
|
|
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINE_LOOP, 4);
|
2016-12-01 17:07:39 +01:00
|
|
|
immVertex2f(pos, x1, y1);
|
|
|
|
|
immVertex2f(pos, x2, y2);
|
|
|
|
|
immVertex2f(pos, x3, y3);
|
|
|
|
|
immVertex2f(pos, x4, y4);
|
|
|
|
|
immEnd();
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
|
2016-12-01 17:07:39 +01:00
|
|
|
immUnbindProgram();
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
}
|
|
|
|
|
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
static void node_composit_buts_cryptomatte_legacy(uiLayout *layout,
|
2022-10-03 17:37:25 -05:00
|
|
|
bContext * /*C*/,
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
PointerRNA *ptr)
|
2018-07-18 13:03:09 +02:00
|
|
|
{
|
|
|
|
|
uiLayout *col = uiLayoutColumn(layout, true);
|
|
|
|
|
|
|
|
|
|
uiItemL(col, IFACE_("Matte Objects:"), ICON_NONE);
|
|
|
|
|
|
|
|
|
|
uiLayout *row = uiLayoutRow(col, true);
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
uiTemplateCryptoPicker(row, ptr, "add", ICON_ADD);
|
|
|
|
|
uiTemplateCryptoPicker(row, ptr, "remove", ICON_REMOVE);
|
2018-07-18 13:03:09 +02:00
|
|
|
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(col, ptr, "matte_id", DEFAULT_FLAGS, "", ICON_NONE);
|
2018-07-18 13:03:09 +02:00
|
|
|
}
|
|
|
|
|
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
static void node_composit_buts_cryptomatte_legacy_ex(uiLayout *layout,
|
2022-10-03 17:37:25 -05:00
|
|
|
bContext * /*C*/,
|
|
|
|
|
PointerRNA * /*ptr*/)
|
2018-07-18 13:03:09 +02:00
|
|
|
{
|
2018-10-01 10:45:50 +02:00
|
|
|
uiItemO(layout, IFACE_("Add Crypto Layer"), ICON_ADD, "NODE_OT_cryptomatte_layer_add");
|
|
|
|
|
uiItemO(layout, IFACE_("Remove Crypto Layer"), ICON_REMOVE, "NODE_OT_cryptomatte_layer_remove");
|
2018-07-18 13:03:09 +02:00
|
|
|
}
|
|
|
|
|
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
static void node_composit_buts_cryptomatte(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
|
|
|
|
{
|
2021-06-02 17:19:36 +02:00
|
|
|
bNode *node = (bNode *)ptr->data;
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
|
|
|
|
|
uiLayout *row = uiLayoutRow(layout, true);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(row, ptr, "source", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
|
|
|
|
|
uiLayout *col = uiLayoutColumn(layout, false);
|
2023-12-13 12:40:34 +02:00
|
|
|
if (node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_RENDER) {
|
2024-09-17 12:22:18 +02:00
|
|
|
uiTemplateID(col, C, ptr, "scene", nullptr, nullptr, nullptr);
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2024-09-17 12:22:18 +02:00
|
|
|
uiTemplateID(col, C, ptr, "image", nullptr, "IMAGE_OT_open", nullptr);
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
|
|
|
|
|
NodeCryptomatte *crypto = (NodeCryptomatte *)node->storage;
|
|
|
|
|
PointerRNA imaptr = RNA_pointer_get(ptr, "image");
|
2023-09-06 00:48:50 +02:00
|
|
|
PointerRNA iuserptr = RNA_pointer_create((ID *)ptr->owner_id, &RNA_ImageUser, &crypto->iuser);
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
uiLayoutSetContextPointer(layout, "image_user", &iuserptr);
|
|
|
|
|
|
|
|
|
|
node_buts_image_user(col, C, ptr, &imaptr, &iuserptr, false, false);
|
|
|
|
|
node_buts_image_views(col, C, ptr, &imaptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
col = uiLayoutColumn(layout, true);
|
2023-07-29 15:06:33 +10:00
|
|
|
uiItemR(col, ptr, "layer_name", UI_ITEM_NONE, "", ICON_NONE);
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
uiItemL(col, IFACE_("Matte ID:"), ICON_NONE);
|
|
|
|
|
|
|
|
|
|
row = uiLayoutRow(col, true);
|
|
|
|
|
uiItemR(row, ptr, "matte_id", DEFAULT_FLAGS, "", ICON_NONE);
|
|
|
|
|
uiTemplateCryptoPicker(row, ptr, "add", ICON_ADD);
|
|
|
|
|
uiTemplateCryptoPicker(row, ptr, "remove", ICON_REMOVE);
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* only once called */
|
2024-05-13 16:07:12 +02:00
|
|
|
static void node_composit_set_butfunc(blender::bke::bNodeType *ntype)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (ntype->type) {
|
2008-12-24 10:33:10 +00:00
|
|
|
case CMP_NODE_IMAGE:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_composit_buts_image;
|
|
|
|
|
ntype->draw_buttons_ex = node_composit_buts_image_ex;
|
2008-12-24 10:33:10 +00:00
|
|
|
break;
|
2022-03-30 08:00:00 -04:00
|
|
|
case CMP_NODE_NORMAL:
|
|
|
|
|
ntype->draw_buttons = node_buts_normal;
|
|
|
|
|
break;
|
2008-12-24 10:33:10 +00:00
|
|
|
case CMP_NODE_CURVE_RGB:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_curvecol;
|
2008-12-24 10:33:10 +00:00
|
|
|
break;
|
|
|
|
|
case CMP_NODE_VALUE:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_value;
|
2008-12-24 10:33:10 +00:00
|
|
|
break;
|
|
|
|
|
case CMP_NODE_RGB:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_rgb;
|
2008-12-24 10:33:10 +00:00
|
|
|
break;
|
|
|
|
|
case CMP_NODE_MIX_RGB:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_mix_rgb;
|
2008-12-24 10:33:10 +00:00
|
|
|
break;
|
|
|
|
|
case CMP_NODE_VALTORGB:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_colorramp;
|
2008-12-24 10:33:10 +00:00
|
|
|
break;
|
|
|
|
|
case CMP_NODE_TIME:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_time;
|
2008-12-24 10:33:10 +00:00
|
|
|
break;
|
|
|
|
|
case CMP_NODE_TEXTURE:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_texture;
|
2008-12-24 10:33:10 +00:00
|
|
|
break;
|
|
|
|
|
case CMP_NODE_MATH:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_math;
|
2008-12-24 10:33:10 +00:00
|
|
|
break;
|
2010-01-21 00:00:45 +00:00
|
|
|
case CMP_NODE_HUECORRECT:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_composit_buts_huecorrect;
|
2011-04-21 15:53:30 +00:00
|
|
|
break;
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
case CMP_NODE_COMBINE_COLOR:
|
|
|
|
|
case CMP_NODE_SEPARATE_COLOR:
|
|
|
|
|
ntype->draw_buttons = node_composit_buts_combsep_color;
|
|
|
|
|
break;
|
|
|
|
|
case CMP_NODE_COMBYCCA_LEGACY:
|
|
|
|
|
case CMP_NODE_SEPYCCA_LEGACY:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_composit_buts_ycc;
|
2010-12-13 21:17:00 +00:00
|
|
|
break;
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
case CMP_NODE_MASK_BOX:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_backdrop = node_composit_backdrop_boxmask;
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
break;
|
|
|
|
|
case CMP_NODE_MASK_ELLIPSE:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_backdrop = node_composit_backdrop_ellipsemask;
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
break;
|
2018-07-18 13:03:09 +02:00
|
|
|
case CMP_NODE_CRYPTOMATTE:
|
|
|
|
|
ntype->draw_buttons = node_composit_buts_cryptomatte;
|
Compositor: Redesign Cryptomatte node for better usability
In the current implementation, cryptomatte passes are connected to the node
and elements are picked by using the eyedropper tool on a special pick channel.
This design has two disadvantages - both connecting all passes individually
and always having to switch to the picker channel are tedious.
With the new design, the user selects the RenderLayer or Image from which the
Cryptomatte layers are directly loaded (the type of pass is determined by an
enum). This allows the node to automatically detect all relevant passes.
Then, when using the eyedropper tool, the operator looks up the selected
coordinates from the picked Image, Node backdrop or Clip and reads the picked
object directly from the Renderlayer/Image, therefore allowing to pick in any
context (e.g. by clicking on the Combined pass in the Image Viewer). The
sampled color is looked up in the metadata and the actual name is stored
in the cryptomatte node. This also allows to remove a hash by just removing
the name from the matte id.
Technically there is some loss of flexibility because the Cryptomatte pass
inputs can no longer be connected to other nodes, but since any compositing
done on them is likely to break the Cryptomatte system anyways, this isn't
really a concern in practise.
In the future, this would also allow to automatically translate values to names
by looking up the value in the associated metadata of the input, or to get a
better visualization of overlapping areas in the Pick output since we could
blend colors now that the output doesn't have to contain the exact value.
Idea + Original patch: Lucas Stockner
Reviewed By: Brecht van Lommel
Differential Revision: https://developer.blender.org/D3959
2021-03-16 07:37:30 +01:00
|
|
|
break;
|
|
|
|
|
case CMP_NODE_CRYPTOMATTE_LEGACY:
|
|
|
|
|
ntype->draw_buttons = node_composit_buts_cryptomatte_legacy;
|
|
|
|
|
ntype->draw_buttons_ex = node_composit_buts_cryptomatte_legacy_ex;
|
2018-07-18 13:03:09 +02:00
|
|
|
break;
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ****************** BUTTON CALLBACKS FOR TEXTURE NODES ***************** */
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_texture_buts_bricks(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2009-10-28 22:14:31 +00:00
|
|
|
uiLayout *col;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
col = uiLayoutColumn(layout, true);
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(col, ptr, "offset", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, IFACE_("Offset"), ICON_NONE);
|
|
|
|
|
uiItemR(col, ptr, "offset_frequency", DEFAULT_FLAGS, IFACE_("Frequency"), ICON_NONE);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
col = uiLayoutColumn(layout, true);
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(col, ptr, "squash", DEFAULT_FLAGS, IFACE_("Squash"), ICON_NONE);
|
|
|
|
|
uiItemR(col, ptr, "squash_frequency", DEFAULT_FLAGS, IFACE_("Frequency"), ICON_NONE);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_texture_buts_proc(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2021-06-02 17:19:36 +02:00
|
|
|
bNode *node = (bNode *)ptr->data;
|
2019-08-23 09:52:12 +02:00
|
|
|
ID *id = ptr->owner_id;
|
2008-12-24 10:33:10 +00:00
|
|
|
Tex *tex = (Tex *)node->storage;
|
2009-12-05 21:14:31 +00:00
|
|
|
uiLayout *col, *row;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-09-06 00:48:50 +02:00
|
|
|
PointerRNA tex_ptr = RNA_pointer_create(id, &RNA_Texture, tex);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
col = uiLayoutColumn(layout, false);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-27 19:38:10 +00:00
|
|
|
switch (tex->type) {
|
2008-12-24 10:33:10 +00:00
|
|
|
case TEX_BLEND:
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(col, &tex_ptr, "progression", DEFAULT_FLAGS, "", ICON_NONE);
|
2014-04-01 11:34:00 +11:00
|
|
|
row = uiLayoutRow(col, false);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(
|
|
|
|
|
row, &tex_ptr, "use_flip_axis", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
2009-09-16 18:59:13 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
case TEX_MARBLE:
|
2014-04-01 11:34:00 +11:00
|
|
|
row = uiLayoutRow(col, false);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(row, &tex_ptr, "marble_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
2014-04-01 11:34:00 +11:00
|
|
|
row = uiLayoutRow(col, false);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(row, &tex_ptr, "noise_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
2014-04-01 11:34:00 +11:00
|
|
|
row = uiLayoutRow(col, false);
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(row, &tex_ptr, "noise_basis", DEFAULT_FLAGS, "", ICON_NONE);
|
2014-04-01 11:34:00 +11:00
|
|
|
row = uiLayoutRow(col, false);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(
|
|
|
|
|
row, &tex_ptr, "noise_basis_2", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
2011-04-05 06:05:55 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-05 06:05:55 +00:00
|
|
|
case TEX_MAGIC:
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(col, &tex_ptr, "noise_depth", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
2011-04-05 06:05:55 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-05 06:05:55 +00:00
|
|
|
case TEX_STUCCI:
|
2014-04-01 11:34:00 +11:00
|
|
|
row = uiLayoutRow(col, false);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(row, &tex_ptr, "stucci_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
2014-04-01 11:34:00 +11:00
|
|
|
row = uiLayoutRow(col, false);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(row, &tex_ptr, "noise_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(col, &tex_ptr, "noise_basis", DEFAULT_FLAGS, "", ICON_NONE);
|
2009-09-16 18:59:13 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
case TEX_WOOD:
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(col, &tex_ptr, "noise_basis", DEFAULT_FLAGS, "", ICON_NONE);
|
|
|
|
|
uiItemR(col, &tex_ptr, "wood_type", DEFAULT_FLAGS, "", ICON_NONE);
|
2014-04-01 11:34:00 +11:00
|
|
|
row = uiLayoutRow(col, false);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(
|
|
|
|
|
row, &tex_ptr, "noise_basis_2", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
2014-04-01 11:34:00 +11:00
|
|
|
row = uiLayoutRow(col, false);
|
2022-09-25 22:41:22 +10:00
|
|
|
uiLayoutSetActive(row, !ELEM(tex->stype, TEX_BAND, TEX_RING));
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(row, &tex_ptr, "noise_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
2009-09-16 18:59:13 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
case TEX_CLOUDS:
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(col, &tex_ptr, "noise_basis", DEFAULT_FLAGS, "", ICON_NONE);
|
2014-04-01 11:34:00 +11:00
|
|
|
row = uiLayoutRow(col, false);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(row, &tex_ptr, "cloud_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
2014-04-01 11:34:00 +11:00
|
|
|
row = uiLayoutRow(col, false);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(row, &tex_ptr, "noise_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(col,
|
|
|
|
|
&tex_ptr,
|
|
|
|
|
"noise_depth",
|
|
|
|
|
DEFAULT_FLAGS | UI_ITEM_R_EXPAND,
|
|
|
|
|
IFACE_("Depth"),
|
|
|
|
|
ICON_NONE);
|
2009-09-16 18:59:13 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
case TEX_DISTNOISE:
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(col, &tex_ptr, "noise_basis", DEFAULT_FLAGS, "", ICON_NONE);
|
|
|
|
|
uiItemR(col, &tex_ptr, "noise_distortion", DEFAULT_FLAGS, "", ICON_NONE);
|
2009-09-16 18:59:13 +00:00
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-05 06:05:55 +00:00
|
|
|
case TEX_MUSGRAVE:
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(col, &tex_ptr, "musgrave_type", DEFAULT_FLAGS, "", ICON_NONE);
|
|
|
|
|
uiItemR(col, &tex_ptr, "noise_basis", DEFAULT_FLAGS, "", ICON_NONE);
|
2011-04-05 06:05:55 +00:00
|
|
|
break;
|
|
|
|
|
case TEX_VORONOI:
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(col, &tex_ptr, "distance_metric", DEFAULT_FLAGS, "", ICON_NONE);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (tex->vn_distm == TEX_MINKOVSKY) {
|
2021-06-02 17:19:36 +02:00
|
|
|
uiItemR(col, &tex_ptr, "minkovsky_exponent", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
2011-04-05 06:05:55 +00:00
|
|
|
}
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(col, &tex_ptr, "color_mode", DEFAULT_FLAGS, "", ICON_NONE);
|
2011-04-05 06:05:55 +00:00
|
|
|
break;
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-16 02:40:31 +00:00
|
|
|
static void node_texture_buts_image(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2024-09-17 12:22:18 +02:00
|
|
|
uiTemplateID(layout, C, ptr, "image", "IMAGE_OT_new", "IMAGE_OT_open", nullptr);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-10 11:33:20 +00:00
|
|
|
static void node_texture_buts_image_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
2013-07-22 08:56:51 +00:00
|
|
|
{
|
2021-06-02 17:19:36 +02:00
|
|
|
bNode *node = (bNode *)ptr->data;
|
2023-09-06 00:48:50 +02:00
|
|
|
PointerRNA iuserptr = RNA_pointer_create(ptr->owner_id, &RNA_ImageUser, node->storage);
|
2021-06-02 17:19:36 +02:00
|
|
|
uiTemplateImage(layout, C, ptr, "image", &iuserptr, false, false);
|
2013-07-22 08:56:51 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_texture_buts_output(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(layout, ptr, "filepath", DEFAULT_FLAGS, "", ICON_NONE);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_texture_buts_combsep_color(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
{
|
|
|
|
|
uiItemR(layout, ptr, "mode", DEFAULT_FLAGS, "", ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* only once called */
|
2024-05-13 16:07:12 +02:00
|
|
|
static void node_texture_set_butfunc(blender::bke::bNodeType *ntype)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2012-05-27 19:38:10 +00:00
|
|
|
if (ntype->type >= TEX_NODE_PROC && ntype->type < TEX_NODE_PROC_MAX) {
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_texture_buts_proc;
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
2012-04-28 06:31:57 +00:00
|
|
|
else {
|
|
|
|
|
switch (ntype->type) {
|
|
|
|
|
|
2012-05-27 19:38:10 +00:00
|
|
|
case TEX_NODE_MATH:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_math;
|
2012-05-27 19:38:10 +00:00
|
|
|
break;
|
2012-04-28 06:31:57 +00:00
|
|
|
|
2012-05-27 19:38:10 +00:00
|
|
|
case TEX_NODE_MIX_RGB:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_mix_rgb;
|
2012-05-27 19:38:10 +00:00
|
|
|
break;
|
2012-04-28 06:31:57 +00:00
|
|
|
|
2012-05-27 19:38:10 +00:00
|
|
|
case TEX_NODE_VALTORGB:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_colorramp;
|
2012-05-27 19:38:10 +00:00
|
|
|
break;
|
2012-04-28 06:31:57 +00:00
|
|
|
|
2012-05-27 19:38:10 +00:00
|
|
|
case TEX_NODE_CURVE_RGB:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_curvecol;
|
2012-05-27 19:38:10 +00:00
|
|
|
break;
|
2012-04-28 06:31:57 +00:00
|
|
|
|
2012-05-27 19:38:10 +00:00
|
|
|
case TEX_NODE_CURVE_TIME:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_time;
|
2012-05-27 19:38:10 +00:00
|
|
|
break;
|
2012-04-28 06:31:57 +00:00
|
|
|
|
2012-05-27 19:38:10 +00:00
|
|
|
case TEX_NODE_TEXTURE:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_buts_texture;
|
2012-05-27 19:38:10 +00:00
|
|
|
break;
|
2012-04-28 06:31:57 +00:00
|
|
|
|
2012-05-27 19:38:10 +00:00
|
|
|
case TEX_NODE_BRICKS:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_texture_buts_bricks;
|
2012-05-27 19:38:10 +00:00
|
|
|
break;
|
2012-04-28 06:31:57 +00:00
|
|
|
|
2012-05-27 19:38:10 +00:00
|
|
|
case TEX_NODE_IMAGE:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_texture_buts_image;
|
|
|
|
|
ntype->draw_buttons_ex = node_texture_buts_image_ex;
|
2012-05-27 19:38:10 +00:00
|
|
|
break;
|
2012-04-28 06:31:57 +00:00
|
|
|
|
2012-05-27 19:38:10 +00:00
|
|
|
case TEX_NODE_OUTPUT:
|
2013-10-10 11:33:20 +00:00
|
|
|
ntype->draw_buttons = node_texture_buts_output;
|
2012-05-27 19:38:10 +00:00
|
|
|
break;
|
Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
"Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
"Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
"Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
"Separate RGB/HSV" nodes.
Python addons have not been updated to the new nodes yet.
**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.
**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.
Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
|
|
|
|
|
|
|
|
case TEX_NODE_COMBINE_COLOR:
|
|
|
|
|
case TEX_NODE_SEPARATE_COLOR:
|
|
|
|
|
ntype->draw_buttons = node_texture_buts_combsep_color;
|
|
|
|
|
break;
|
2012-04-28 06:31:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
2021-06-03 10:46:16 +10:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Init Draw Callbacks For All Tree Types
|
|
|
|
|
*
|
|
|
|
|
* Only called on node initialization, once.
|
|
|
|
|
* \{ */
|
2008-12-24 10:33:10 +00:00
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_property_update_default(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
|
2021-06-02 17:19:36 +02:00
|
|
|
bNode *node = (bNode *)ptr->data;
|
2021-12-21 15:18:56 +01:00
|
|
|
BKE_ntree_update_tag_node_property(ntree, node);
|
|
|
|
|
ED_node_tree_propagate_change(nullptr, bmain, ntree);
|
2013-03-18 16:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
2024-05-13 16:07:12 +02:00
|
|
|
static void node_socket_template_properties_update(blender::bke::bNodeType *ntype,
|
|
|
|
|
blender::bke::bNodeSocketTemplate *stemp)
|
2013-03-18 16:34:57 +00:00
|
|
|
{
|
2020-04-03 18:24:08 +02:00
|
|
|
StructRNA *srna = ntype->rna_ext.srna;
|
2013-03-18 16:34:57 +00:00
|
|
|
PropertyRNA *prop = RNA_struct_type_find_property(srna, stemp->identifier);
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (prop) {
|
2023-08-09 22:40:39 +02:00
|
|
|
RNA_def_property_update_runtime(prop, node_property_update_default);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2013-03-18 16:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
2024-05-13 16:07:12 +02:00
|
|
|
static void node_template_properties_update(blender::bke::bNodeType *ntype)
|
2013-03-18 16:34:57 +00:00
|
|
|
{
|
2024-05-13 16:07:12 +02:00
|
|
|
blender::bke::bNodeSocketTemplate *stemp;
|
2018-06-04 09:31:30 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
if (ntype->inputs) {
|
2019-09-08 00:12:26 +10:00
|
|
|
for (stemp = ntype->inputs; stemp->type >= 0; stemp++) {
|
2013-03-18 16:34:57 +00:00
|
|
|
node_socket_template_properties_update(ntype, stemp);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
2013-03-18 16:34:57 +00:00
|
|
|
if (ntype->outputs) {
|
2019-09-08 00:12:26 +10:00
|
|
|
for (stemp = ntype->outputs; stemp->type >= 0; stemp++) {
|
2013-03-18 16:34:57 +00:00
|
|
|
node_socket_template_properties_update(ntype, stemp);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2013-03-18 16:34:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_socket_undefined_draw(bContext * /*C*/,
|
2013-05-08 14:58:41 +00:00
|
|
|
uiLayout *layout,
|
2022-10-03 17:37:25 -05:00
|
|
|
PointerRNA * /*ptr*/,
|
|
|
|
|
PointerRNA * /*node_ptr*/,
|
|
|
|
|
const char * /*text*/)
|
2013-03-19 13:40:16 +00:00
|
|
|
{
|
2014-04-03 22:49:27 +04:00
|
|
|
uiItemL(layout, IFACE_("Undefined Socket Type"), ICON_ERROR);
|
2013-03-19 13:40:16 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_socket_undefined_draw_color(bContext * /*C*/,
|
|
|
|
|
PointerRNA * /*ptr*/,
|
|
|
|
|
PointerRNA * /*node_ptr*/,
|
2013-03-19 13:40:16 +00:00
|
|
|
float *r_color)
|
|
|
|
|
{
|
|
|
|
|
r_color[0] = 1.0f;
|
|
|
|
|
r_color[1] = 0.0f;
|
|
|
|
|
r_color[2] = 0.0f;
|
|
|
|
|
r_color[3] = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-13 16:07:12 +02:00
|
|
|
static void node_socket_undefined_draw_color_simple(const bke::bNodeSocketType * /*type*/,
|
2023-08-30 12:37:21 +02:00
|
|
|
float *r_color)
|
2013-03-19 13:40:16 +00:00
|
|
|
{
|
|
|
|
|
r_color[0] = 1.0f;
|
|
|
|
|
r_color[1] = 0.0f;
|
|
|
|
|
r_color[2] = 0.0f;
|
|
|
|
|
r_color[3] = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-30 12:37:21 +02:00
|
|
|
static void node_socket_undefined_interface_draw(ID * /*id*/,
|
|
|
|
|
bNodeTreeInterfaceSocket * /*interface_socket*/,
|
|
|
|
|
bContext * /*C*/,
|
|
|
|
|
uiLayout *layout)
|
|
|
|
|
{
|
|
|
|
|
uiItemL(layout, IFACE_("Undefined Socket Type"), ICON_ERROR);
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-03 10:46:16 +10:00
|
|
|
/** \} */
|
|
|
|
|
|
2022-01-20 10:36:56 -06:00
|
|
|
} // namespace blender::ed::space_node
|
|
|
|
|
|
2021-12-08 00:31:20 -05:00
|
|
|
void ED_node_init_butfuncs()
|
2013-03-18 16:34:57 +00:00
|
|
|
{
|
2022-01-20 10:36:56 -06:00
|
|
|
using namespace blender::ed::space_node;
|
|
|
|
|
|
2013-03-19 13:40:16 +00:00
|
|
|
/* Fallback types for undefined tree, nodes, sockets
|
|
|
|
|
* Defined in blenkernel, but not registered in type hashes.
|
|
|
|
|
*/
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-05-15 15:14:22 +02:00
|
|
|
using blender::bke::NodeSocketTypeUndefined;
|
2023-05-16 10:15:56 +12:00
|
|
|
using blender::bke::NodeTypeUndefined;
|
2023-05-15 15:14:22 +02:00
|
|
|
|
2021-06-02 17:19:36 +02:00
|
|
|
NodeTypeUndefined.draw_buttons = nullptr;
|
|
|
|
|
NodeTypeUndefined.draw_buttons_ex = nullptr;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-19 13:40:16 +00:00
|
|
|
NodeSocketTypeUndefined.draw = node_socket_undefined_draw;
|
|
|
|
|
NodeSocketTypeUndefined.draw_color = node_socket_undefined_draw_color;
|
2023-08-30 12:37:21 +02:00
|
|
|
NodeSocketTypeUndefined.draw_color_simple = node_socket_undefined_draw_color_simple;
|
2013-03-19 13:40:16 +00:00
|
|
|
NodeSocketTypeUndefined.interface_draw = node_socket_undefined_interface_draw;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* node type ui functions */
|
2018-11-30 15:35:15 +11:00
|
|
|
NODE_TYPES_BEGIN (ntype) {
|
2013-03-18 16:34:57 +00:00
|
|
|
node_common_set_butfunc(ntype);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
node_composit_set_butfunc(ntype);
|
|
|
|
|
node_shader_set_butfunc(ntype);
|
|
|
|
|
node_texture_set_butfunc(ntype);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* define update callbacks for socket properties */
|
|
|
|
|
node_template_properties_update(ntype);
|
2018-11-30 15:35:15 +11:00
|
|
|
}
|
|
|
|
|
NODE_TYPES_END;
|
2013-03-18 16:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
2024-05-13 16:07:12 +02:00
|
|
|
void ED_init_custom_node_type(blender::bke::bNodeType * /*ntype*/) {}
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2024-05-13 16:07:12 +02:00
|
|
|
void ED_init_custom_node_socket_type(blender::bke::bNodeSocketType *stype)
|
2013-03-18 16:34:57 +00:00
|
|
|
{
|
2022-01-20 10:36:56 -06:00
|
|
|
stype->draw = blender::ed::space_node::node_socket_button_label;
|
2013-03-18 16:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
2022-01-20 10:36:56 -06:00
|
|
|
namespace blender::ed::space_node {
|
|
|
|
|
|
2021-02-24 13:01:24 -06:00
|
|
|
static const float virtual_node_socket_color[4] = {0.2, 0.2, 0.2, 1.0};
|
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
/* maps standard socket integer type to a color */
|
|
|
|
|
static const float std_node_socket_colors[][4] = {
|
2021-01-13 17:17:39 +01:00
|
|
|
{0.63, 0.63, 0.63, 1.0}, /* SOCK_FLOAT */
|
2013-03-24 01:19:55 +00:00
|
|
|
{0.39, 0.39, 0.78, 1.0}, /* SOCK_VECTOR */
|
|
|
|
|
{0.78, 0.78, 0.16, 1.0}, /* SOCK_RGBA */
|
2021-01-13 12:25:31 +01:00
|
|
|
{0.39, 0.78, 0.39, 1.0}, /* SOCK_SHADER */
|
2020-12-02 13:06:11 +01:00
|
|
|
{0.80, 0.65, 0.84, 1.0}, /* SOCK_BOOLEAN */
|
2023-06-07 08:31:46 -04:00
|
|
|
{0.0, 0.0, 0.0, 0.0}, /* UNUSED */
|
2021-05-12 17:55:07 +02:00
|
|
|
{0.35, 0.55, 0.36, 1.0}, /* SOCK_INT */
|
2020-12-02 13:06:11 +01:00
|
|
|
{0.44, 0.70, 1.00, 1.0}, /* SOCK_STRING */
|
|
|
|
|
{0.93, 0.62, 0.36, 1.0}, /* SOCK_OBJECT */
|
2021-05-12 17:55:07 +02:00
|
|
|
{0.39, 0.22, 0.39, 1.0}, /* SOCK_IMAGE */
|
2020-12-02 13:06:11 +01:00
|
|
|
{0.00, 0.84, 0.64, 1.0}, /* SOCK_GEOMETRY */
|
2020-12-11 17:32:08 +01:00
|
|
|
{0.96, 0.96, 0.96, 1.0}, /* SOCK_COLLECTION */
|
2021-05-12 17:55:07 +02:00
|
|
|
{0.62, 0.31, 0.64, 1.0}, /* SOCK_TEXTURE */
|
|
|
|
|
{0.92, 0.46, 0.51, 1.0}, /* SOCK_MATERIAL */
|
2023-08-24 13:34:36 +02:00
|
|
|
{0.65, 0.39, 0.78, 1.0}, /* SOCK_ROTATION */
|
2024-01-26 12:40:01 +01:00
|
|
|
{0.40, 0.40, 0.40, 1.0}, /* SOCK_MENU */
|
2024-02-13 18:59:36 +01:00
|
|
|
{0.72, 0.20, 0.52, 1.0}, /* SOCK_MATRIX */
|
2013-03-18 16:34:57 +00:00
|
|
|
};
|
|
|
|
|
|
2023-08-30 12:37:21 +02:00
|
|
|
/* Callback for colors that does not depend on the socket pointer argument to get the type. */
|
|
|
|
|
template<int socket_type>
|
|
|
|
|
void std_node_socket_color_fn(bContext * /*C*/,
|
|
|
|
|
PointerRNA * /*ptr*/,
|
|
|
|
|
PointerRNA * /*node_ptr*/,
|
|
|
|
|
float *r_color)
|
2013-03-18 16:34:57 +00:00
|
|
|
{
|
2023-08-30 12:37:21 +02:00
|
|
|
copy_v4_v4(r_color, std_node_socket_colors[socket_type]);
|
|
|
|
|
};
|
2024-05-13 16:07:12 +02:00
|
|
|
static void std_node_socket_color_simple_fn(const bke::bNodeSocketType *type, float *r_color)
|
2013-03-18 16:34:57 +00:00
|
|
|
{
|
2023-08-30 12:37:21 +02:00
|
|
|
copy_v4_v4(r_color, std_node_socket_colors[type->type]);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using SocketColorFn = void (*)(bContext *C, PointerRNA *ptr, PointerRNA *node_ptr, float *r_color);
|
|
|
|
|
/* Callbacks for all built-in socket types. */
|
|
|
|
|
static const SocketColorFn std_node_socket_color_funcs[] = {
|
|
|
|
|
std_node_socket_color_fn<SOCK_FLOAT>,
|
|
|
|
|
std_node_socket_color_fn<SOCK_VECTOR>,
|
|
|
|
|
std_node_socket_color_fn<SOCK_RGBA>,
|
|
|
|
|
std_node_socket_color_fn<SOCK_SHADER>,
|
|
|
|
|
std_node_socket_color_fn<SOCK_BOOLEAN>,
|
2023-09-22 12:02:32 +10:00
|
|
|
nullptr /* UNUSED. */,
|
2023-08-30 12:37:21 +02:00
|
|
|
std_node_socket_color_fn<SOCK_INT>,
|
|
|
|
|
std_node_socket_color_fn<SOCK_STRING>,
|
|
|
|
|
std_node_socket_color_fn<SOCK_OBJECT>,
|
|
|
|
|
std_node_socket_color_fn<SOCK_IMAGE>,
|
|
|
|
|
std_node_socket_color_fn<SOCK_GEOMETRY>,
|
|
|
|
|
std_node_socket_color_fn<SOCK_COLLECTION>,
|
|
|
|
|
std_node_socket_color_fn<SOCK_TEXTURE>,
|
|
|
|
|
std_node_socket_color_fn<SOCK_MATERIAL>,
|
|
|
|
|
std_node_socket_color_fn<SOCK_ROTATION>,
|
2024-01-26 12:40:01 +01:00
|
|
|
std_node_socket_color_fn<SOCK_MENU>,
|
2024-02-13 18:59:36 +01:00
|
|
|
std_node_socket_color_fn<SOCK_MATRIX>,
|
2023-08-30 12:37:21 +02:00
|
|
|
};
|
2013-03-18 16:34:57 +00:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/* draw function for file output node sockets,
|
|
|
|
|
* displays only sub-path and format, no value button */
|
2013-10-10 13:07:09 +00:00
|
|
|
static void node_file_output_socket_draw(bContext *C,
|
|
|
|
|
uiLayout *layout,
|
|
|
|
|
PointerRNA *ptr,
|
|
|
|
|
PointerRNA *node_ptr)
|
|
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
|
2021-06-02 17:19:36 +02:00
|
|
|
bNodeSocket *sock = (bNodeSocket *)ptr->data;
|
2013-10-10 13:07:09 +00:00
|
|
|
uiLayout *row;
|
2020-09-08 15:20:07 +02:00
|
|
|
PointerRNA inputptr;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-01 11:34:00 +11:00
|
|
|
row = uiLayoutRow(layout, false);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-08 15:20:07 +02:00
|
|
|
PointerRNA imfptr = RNA_pointer_get(node_ptr, "format");
|
|
|
|
|
int imtype = RNA_enum_get(&imfptr, "file_format");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-10-10 13:07:09 +00:00
|
|
|
if (imtype == R_IMF_IMTYPE_MULTILAYER) {
|
2021-06-02 17:19:36 +02:00
|
|
|
NodeImageMultiFileSocket *input = (NodeImageMultiFileSocket *)sock->storage;
|
2023-09-06 00:48:50 +02:00
|
|
|
inputptr = RNA_pointer_create(&ntree->id, &RNA_NodeOutputFileSlotLayer, input);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-10-10 13:07:09 +00:00
|
|
|
uiItemL(row, input->layer, ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2021-06-02 17:19:36 +02:00
|
|
|
NodeImageMultiFileSocket *input = (NodeImageMultiFileSocket *)sock->storage;
|
2013-10-10 13:07:09 +00:00
|
|
|
uiBlock *block;
|
2023-09-06 00:48:50 +02:00
|
|
|
inputptr = RNA_pointer_create(&ntree->id, &RNA_NodeOutputFileSlotFile, input);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-10-10 13:07:09 +00:00
|
|
|
uiItemL(row, input->path, ICON_NONE);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (!RNA_boolean_get(&inputptr, "use_node_format")) {
|
2013-10-10 13:07:09 +00:00
|
|
|
imfptr = RNA_pointer_get(&inputptr, "format");
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-08 15:20:07 +02:00
|
|
|
const char *imtype_name;
|
|
|
|
|
PropertyRNA *imtype_prop = RNA_struct_find_property(&imfptr, "file_format");
|
2013-10-10 13:07:09 +00:00
|
|
|
RNA_property_enum_name((bContext *)C,
|
|
|
|
|
&imfptr,
|
|
|
|
|
imtype_prop,
|
|
|
|
|
RNA_property_enum_get(&imfptr, imtype_prop),
|
|
|
|
|
&imtype_name);
|
|
|
|
|
block = uiLayoutGetBlock(row);
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_block_emboss_set(block, UI_EMBOSS_PULLDOWN);
|
2013-10-10 13:07:09 +00:00
|
|
|
uiItemL(row, imtype_name, ICON_NONE);
|
2014-11-09 21:20:40 +01:00
|
|
|
UI_block_emboss_set(block, UI_EMBOSS_NONE);
|
2013-10-10 13:07:09 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
|
2021-10-22 11:56:05 +02:00
|
|
|
static bool socket_needs_attribute_search(bNode &node, bNodeSocket &socket)
|
|
|
|
|
{
|
2023-09-14 11:51:05 +02:00
|
|
|
const nodes::NodeDeclaration *node_decl = node.declaration();
|
|
|
|
|
if (node_decl == nullptr) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (node_decl->skip_updating_sockets) {
|
2021-10-22 11:56:05 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (socket.in_out == SOCK_OUT) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
const int socket_index = BLI_findindex(&node.inputs, &socket);
|
2023-09-14 11:51:05 +02:00
|
|
|
return node_decl->inputs[socket_index]->is_attribute_name;
|
2021-10-22 11:56:05 +02:00
|
|
|
}
|
|
|
|
|
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
static void draw_gizmo_pin_icon(uiLayout *layout, PointerRNA *socket_ptr)
|
|
|
|
|
{
|
|
|
|
|
uiItemR(layout, socket_ptr, "pin_gizmo", UI_ITEM_NONE, "", ICON_GIZMO);
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-07 13:27:07 +01:00
|
|
|
static void draw_node_socket_name_editable(uiLayout *layout, bNodeSocket *sock, const char *text)
|
2024-05-30 10:41:05 +02:00
|
|
|
{
|
|
|
|
|
if (sock->runtime->declaration) {
|
|
|
|
|
if (sock->runtime->declaration->socket_name_rna) {
|
|
|
|
|
uiLayoutSetEmboss(layout, UI_EMBOSS_NONE);
|
|
|
|
|
uiItemR(layout,
|
|
|
|
|
const_cast<PointerRNA *>(&sock->runtime->declaration->socket_name_rna->owner),
|
|
|
|
|
sock->runtime->declaration->socket_name_rna->property_name.c_str(),
|
|
|
|
|
UI_ITEM_NONE,
|
|
|
|
|
"",
|
|
|
|
|
ICON_NONE);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
uiItemL(layout, text, ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-07 13:27:07 +01:00
|
|
|
static void draw_node_socket_without_value(uiLayout *layout, bNodeSocket *sock, const char *text)
|
|
|
|
|
{
|
|
|
|
|
draw_node_socket_name_editable(layout, sock, text);
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-08 14:58:41 +00:00
|
|
|
static void std_node_socket_draw(
|
|
|
|
|
bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, const char *text)
|
2013-03-18 16:34:57 +00:00
|
|
|
{
|
2021-06-02 17:19:36 +02:00
|
|
|
bNode *node = (bNode *)node_ptr->data;
|
|
|
|
|
bNodeSocket *sock = (bNodeSocket *)ptr->data;
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
bNodeTree *tree = reinterpret_cast<bNodeTree *>(ptr->owner_id);
|
2013-03-18 16:34:57 +00:00
|
|
|
int type = sock->typeinfo->type;
|
2021-06-26 21:35:18 +10:00
|
|
|
// int subtype = sock->typeinfo->subtype;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-10-10 13:07:09 +00:00
|
|
|
/* XXX not nice, eventually give this node its own socket type ... */
|
|
|
|
|
if (node->type == CMP_NODE_OUTPUT_FILE) {
|
|
|
|
|
node_file_output_socket_draw(C, layout, ptr, node_ptr);
|
2014-02-19 11:54:28 +01:00
|
|
|
return;
|
2013-10-10 13:07:09 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
const bool has_gizmo = tree->runtime->gizmo_propagation ?
|
|
|
|
|
tree->runtime->gizmo_propagation->gizmo_endpoint_sockets.contains(
|
|
|
|
|
sock) :
|
|
|
|
|
false;
|
|
|
|
|
|
|
|
|
|
if (has_gizmo) {
|
|
|
|
|
if (sock->in_out == SOCK_OUT && ELEM(node->type,
|
|
|
|
|
SH_NODE_VALUE,
|
|
|
|
|
FN_NODE_INPUT_VECTOR,
|
|
|
|
|
FN_NODE_INPUT_INT,
|
|
|
|
|
FN_NODE_INPUT_BOOL,
|
|
|
|
|
FN_NODE_INPUT_ROTATION,
|
|
|
|
|
NODE_GROUP_INPUT))
|
|
|
|
|
{
|
2024-07-12 13:09:57 +02:00
|
|
|
if (node->is_group_input()) {
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
uiLayout *row = uiLayoutRow(layout, false);
|
|
|
|
|
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
|
|
|
|
|
node_socket_button_label(C, row, ptr, node_ptr, text);
|
|
|
|
|
uiItemL(row, "", ICON_GIZMO);
|
|
|
|
|
}
|
|
|
|
|
else if (nodes::partial_eval::is_supported_value_node(*node)) {
|
|
|
|
|
uiLayout *row = uiLayoutRow(layout, false);
|
|
|
|
|
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
|
|
|
|
|
node_socket_button_label(C, row, ptr, node_ptr, text);
|
|
|
|
|
draw_gizmo_pin_icon(row, ptr);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (sock->in_out == SOCK_IN && sock->index() == 0 &&
|
|
|
|
|
nodes::gizmos::is_builtin_gizmo_node(*node))
|
|
|
|
|
{
|
|
|
|
|
uiLayout *row = uiLayoutRow(layout, false);
|
|
|
|
|
node_socket_button_label(C, row, ptr, node_ptr, text);
|
|
|
|
|
draw_gizmo_pin_icon(row, ptr);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-03 12:34:58 +02:00
|
|
|
if ((sock->in_out == SOCK_OUT) || (sock->flag & SOCK_HIDE_VALUE) ||
|
2023-06-05 20:21:07 +02:00
|
|
|
((sock->flag & SOCK_IS_LINKED) && !all_links_muted(*sock)))
|
2023-06-03 12:34:58 +02:00
|
|
|
{
|
2024-05-30 10:41:05 +02:00
|
|
|
draw_node_socket_without_value(layout, sock, text);
|
2013-05-08 14:58:37 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2024-09-24 18:22:32 +02:00
|
|
|
const char *label = text;
|
2021-06-09 09:13:09 -05:00
|
|
|
text = (sock->flag & SOCK_HIDE_LABEL) ? "" : text;
|
|
|
|
|
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
/* Some socket types draw the gizmo icon in a special way to look better. All others use a
|
|
|
|
|
* fallback default code path. */
|
|
|
|
|
bool gizmo_handled = false;
|
|
|
|
|
|
2013-03-18 16:34:57 +00:00
|
|
|
switch (type) {
|
|
|
|
|
case SOCK_FLOAT:
|
|
|
|
|
case SOCK_INT:
|
|
|
|
|
case SOCK_BOOLEAN:
|
2023-08-12 16:29:49 +10:00
|
|
|
uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, text, ICON_NONE);
|
2013-03-18 16:34:57 +00:00
|
|
|
break;
|
|
|
|
|
case SOCK_VECTOR:
|
2019-08-10 17:37:39 +02:00
|
|
|
if (sock->flag & SOCK_COMPACT) {
|
|
|
|
|
uiTemplateComponentMenu(layout, ptr, "default_value", text);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2019-08-16 17:59:12 +02:00
|
|
|
if (sock->typeinfo->subtype == PROP_DIRECTION) {
|
2020-05-01 15:21:41 +02:00
|
|
|
uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, "", ICON_NONE);
|
2019-08-16 17:59:12 +02:00
|
|
|
}
|
|
|
|
|
else {
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
uiLayout *column = uiLayoutColumn(layout, false);
|
|
|
|
|
{
|
|
|
|
|
uiLayout *row = uiLayoutRow(column, true);
|
2024-11-07 13:27:07 +01:00
|
|
|
draw_node_socket_name_editable(row, sock, text);
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
if (has_gizmo) {
|
|
|
|
|
draw_gizmo_pin_icon(row, ptr);
|
|
|
|
|
gizmo_handled = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
uiItemR(column, ptr, "default_value", DEFAULT_FLAGS, "", ICON_NONE);
|
2019-08-16 17:59:12 +02:00
|
|
|
}
|
2019-08-10 17:37:39 +02:00
|
|
|
}
|
2013-03-18 16:34:57 +00:00
|
|
|
break;
|
2023-06-14 20:30:10 +02:00
|
|
|
case SOCK_ROTATION: {
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
uiLayout *column = uiLayoutColumn(layout, false);
|
|
|
|
|
{
|
|
|
|
|
uiLayout *row = uiLayoutRow(column, true);
|
2024-11-07 13:27:07 +01:00
|
|
|
draw_node_socket_name_editable(row, sock, text);
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
if (has_gizmo) {
|
|
|
|
|
draw_gizmo_pin_icon(row, ptr);
|
|
|
|
|
gizmo_handled = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
uiItemR(column, ptr, "default_value", DEFAULT_FLAGS, "", ICON_NONE);
|
2023-06-14 20:30:10 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2024-02-13 18:59:36 +01:00
|
|
|
case SOCK_MATRIX: {
|
2024-11-07 13:27:07 +01:00
|
|
|
draw_node_socket_name_editable(layout, sock, text);
|
2024-02-13 18:59:36 +01:00
|
|
|
break;
|
|
|
|
|
}
|
2021-03-08 13:38:42 +01:00
|
|
|
case SOCK_RGBA: {
|
2021-10-19 14:04:03 -05:00
|
|
|
if (text[0] == '\0') {
|
2023-08-12 16:29:49 +10:00
|
|
|
uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, "", ICON_NONE);
|
2021-10-19 14:04:03 -05:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
uiLayout *row = uiLayoutSplit(layout, 0.4f, false);
|
2023-08-12 16:29:49 +10:00
|
|
|
uiItemL(row, text, ICON_NONE);
|
|
|
|
|
uiItemR(row, ptr, "default_value", DEFAULT_FLAGS, "", ICON_NONE);
|
2021-10-19 14:04:03 -05:00
|
|
|
}
|
2021-03-08 13:38:42 +01:00
|
|
|
break;
|
|
|
|
|
}
|
2013-07-19 10:40:43 +00:00
|
|
|
case SOCK_STRING: {
|
2021-10-22 11:56:05 +02:00
|
|
|
if (socket_needs_attribute_search(*node, *sock)) {
|
2024-06-17 13:02:16 -04:00
|
|
|
if (text[0] == '\0') {
|
2024-09-24 18:22:32 +02:00
|
|
|
node_geometry_add_attribute_search_button(*C, *node, *ptr, *layout, label);
|
2024-06-17 13:02:16 -04:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
uiLayout *row = uiLayoutSplit(layout, 0.4f, false);
|
|
|
|
|
uiItemL(row, text, ICON_NONE);
|
|
|
|
|
node_geometry_add_attribute_search_button(*C, *node, *ptr, *row);
|
|
|
|
|
}
|
2021-03-02 13:01:33 -06:00
|
|
|
}
|
|
|
|
|
else {
|
2024-06-17 13:02:16 -04:00
|
|
|
if (text[0] == '\0') {
|
2024-09-24 18:22:32 +02:00
|
|
|
uiItemFullR(layout,
|
|
|
|
|
ptr,
|
|
|
|
|
RNA_struct_find_property(ptr, "default_value"),
|
|
|
|
|
-1,
|
|
|
|
|
0,
|
|
|
|
|
UI_ITEM_NONE,
|
|
|
|
|
"",
|
|
|
|
|
ICON_NONE,
|
|
|
|
|
label);
|
2024-06-17 13:02:16 -04:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
uiLayout *row = uiLayoutSplit(layout, 0.4f, false);
|
|
|
|
|
uiItemL(row, text, ICON_NONE);
|
2024-07-05 14:03:32 -04:00
|
|
|
uiItemR(row, ptr, "default_value", DEFAULT_FLAGS, "", ICON_NONE);
|
2024-06-17 13:02:16 -04:00
|
|
|
}
|
2021-03-02 13:01:33 -06:00
|
|
|
}
|
2013-03-18 16:34:57 +00:00
|
|
|
break;
|
2011-09-05 21:01:50 +00:00
|
|
|
}
|
2024-01-26 12:40:01 +01:00
|
|
|
case SOCK_MENU: {
|
|
|
|
|
const bNodeSocketValueMenu *default_value =
|
|
|
|
|
sock->default_value_typed<bNodeSocketValueMenu>();
|
|
|
|
|
if (default_value->enum_items) {
|
|
|
|
|
if (default_value->enum_items->items.is_empty()) {
|
|
|
|
|
uiLayout *row = uiLayoutSplit(layout, 0.4f, false);
|
|
|
|
|
uiItemL(row, text, ICON_NONE);
|
I18n: Extract many custom labels defined in uiItem*
Those labels needed a manual translation with IFACE_() or RPT_():
- "Add Item",
- "Blend",
- "Cached from the first line art modifier.",
- "Custom Curve",
- "Custom Path",
- "Custom Range",
- "End",
- "Enter a Unicode codepoint hex value",
- "Forward Axis",
- "Insert Unicode Character",
- "Mid Level",
- "Min",
- "Mode",
- "No Items",
- "Object",
- "Path",
- "Probability",
- "Sample Radius",
- "Sharp edges or custom normals detected, disabling GPU subdivision",
- "Start",
- "Texture Mapping",
- "Up Axis",
- "Using both CPU and GPU subdivision",
2024-06-15 14:12:27 +02:00
|
|
|
uiItemL(row, IFACE_("No Items"), ICON_NONE);
|
2024-01-26 12:40:01 +01:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, "", ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (default_value->has_conflict()) {
|
|
|
|
|
uiItemL(layout, IFACE_("Menu Error"), ICON_ERROR);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
uiItemL(layout, IFACE_("Menu Undefined"), ICON_QUESTION);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2020-04-20 13:22:20 +02:00
|
|
|
case SOCK_OBJECT: {
|
2023-08-12 16:29:49 +10:00
|
|
|
uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, text, ICON_NONE);
|
2020-04-20 13:22:20 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case SOCK_IMAGE: {
|
2021-10-25 13:02:43 +02:00
|
|
|
const bNodeTree *node_tree = (const bNodeTree *)node_ptr->owner_id;
|
|
|
|
|
if (node_tree->type == NTREE_GEOMETRY) {
|
|
|
|
|
if (text[0] == '\0') {
|
2024-09-17 12:22:18 +02:00
|
|
|
uiTemplateID(layout, C, ptr, "default_value", "image.new", "image.open", nullptr);
|
2021-10-25 13:02:43 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* 0.3 split ratio is inconsistent, but use it here because the "New" button is large. */
|
|
|
|
|
uiLayout *row = uiLayoutSplit(layout, 0.3f, false);
|
2023-08-12 16:29:49 +10:00
|
|
|
uiItemL(row, text, ICON_NONE);
|
2024-09-17 12:22:18 +02:00
|
|
|
uiTemplateID(row, C, ptr, "default_value", "image.new", "image.open", nullptr);
|
2021-10-25 13:02:43 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2023-08-12 16:29:49 +10:00
|
|
|
uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, text, ICON_NONE);
|
2021-10-25 13:02:43 +02:00
|
|
|
}
|
2020-04-20 13:22:20 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2020-12-11 17:32:08 +01:00
|
|
|
case SOCK_COLLECTION: {
|
2023-08-12 16:29:49 +10:00
|
|
|
uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, text, ICON_NONE);
|
2020-12-11 17:32:08 +01:00
|
|
|
break;
|
|
|
|
|
}
|
2021-05-12 12:41:21 +02:00
|
|
|
case SOCK_TEXTURE: {
|
2021-08-10 11:46:10 +10:00
|
|
|
if (text[0] == '\0') {
|
2024-09-17 12:22:18 +02:00
|
|
|
uiTemplateID(layout, C, ptr, "default_value", "texture.new", nullptr, nullptr);
|
2021-08-09 17:30:44 -05:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* 0.3 split ratio is inconsistent, but use it here because the "New" button is large. */
|
|
|
|
|
uiLayout *row = uiLayoutSplit(layout, 0.3f, false);
|
2023-08-12 16:29:49 +10:00
|
|
|
uiItemL(row, text, ICON_NONE);
|
2024-09-17 12:22:18 +02:00
|
|
|
uiTemplateID(row, C, ptr, "default_value", "texture.new", nullptr, nullptr);
|
2021-08-09 17:30:44 -05:00
|
|
|
}
|
|
|
|
|
|
2021-05-12 12:41:21 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case SOCK_MATERIAL: {
|
2023-08-12 16:29:49 +10:00
|
|
|
uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, text, ICON_NONE);
|
2021-05-12 12:41:21 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2013-03-19 10:03:52 +00:00
|
|
|
default:
|
2024-05-30 10:41:05 +02:00
|
|
|
draw_node_socket_without_value(layout, sock, text);
|
2013-03-19 10:03:52 +00:00
|
|
|
break;
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
|
|
|
|
|
if (has_gizmo && !gizmo_handled) {
|
|
|
|
|
draw_gizmo_pin_icon(layout, ptr);
|
|
|
|
|
}
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
2023-08-30 12:37:21 +02:00
|
|
|
static void std_node_socket_interface_draw(ID *id,
|
|
|
|
|
bNodeTreeInterfaceSocket *interface_socket,
|
|
|
|
|
bContext * /*C*/,
|
|
|
|
|
uiLayout *layout)
|
2013-03-28 10:32:04 +00:00
|
|
|
{
|
2023-09-06 00:48:50 +02:00
|
|
|
PointerRNA ptr = RNA_pointer_create(id, &RNA_NodeTreeInterfaceSocket, interface_socket);
|
2021-01-10 13:24:37 -06:00
|
|
|
|
2024-05-13 16:07:12 +02:00
|
|
|
const bke::bNodeSocketType *typeinfo = interface_socket->socket_typeinfo();
|
2023-08-30 12:37:21 +02:00
|
|
|
BLI_assert(typeinfo != nullptr);
|
|
|
|
|
eNodeSocketDatatype type = eNodeSocketDatatype(typeinfo->type);
|
2023-06-14 18:02:40 +02:00
|
|
|
|
2021-01-10 13:24:37 -06:00
|
|
|
uiLayout *col = uiLayoutColumn(layout, false);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-28 10:32:04 +00:00
|
|
|
switch (type) {
|
2013-07-19 10:40:43 +00:00
|
|
|
case SOCK_FLOAT: {
|
2023-08-30 12:37:21 +02:00
|
|
|
uiItemR(col, &ptr, "subtype", DEFAULT_FLAGS, IFACE_("Subtype"), ICON_NONE);
|
|
|
|
|
uiItemR(col, &ptr, "default_value", DEFAULT_FLAGS, IFACE_("Default"), ICON_NONE);
|
2021-01-10 13:24:37 -06:00
|
|
|
uiLayout *sub = uiLayoutColumn(col, true);
|
2023-08-30 12:37:21 +02:00
|
|
|
uiItemR(sub, &ptr, "min_value", DEFAULT_FLAGS, IFACE_("Min"), ICON_NONE);
|
|
|
|
|
uiItemR(sub, &ptr, "max_value", DEFAULT_FLAGS, IFACE_("Max"), ICON_NONE);
|
2013-03-28 10:32:04 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2013-07-19 10:40:43 +00:00
|
|
|
case SOCK_INT: {
|
2023-08-30 12:37:21 +02:00
|
|
|
uiItemR(col, &ptr, "subtype", DEFAULT_FLAGS, IFACE_("Subtype"), ICON_NONE);
|
|
|
|
|
uiItemR(col, &ptr, "default_value", DEFAULT_FLAGS, IFACE_("Default"), ICON_NONE);
|
2021-01-10 13:24:37 -06:00
|
|
|
uiLayout *sub = uiLayoutColumn(col, true);
|
2023-08-30 12:37:21 +02:00
|
|
|
uiItemR(sub, &ptr, "min_value", DEFAULT_FLAGS, IFACE_("Min"), ICON_NONE);
|
|
|
|
|
uiItemR(sub, &ptr, "max_value", DEFAULT_FLAGS, IFACE_("Max"), ICON_NONE);
|
2013-03-28 10:32:04 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2013-07-19 10:40:43 +00:00
|
|
|
case SOCK_VECTOR: {
|
2023-08-30 12:37:21 +02:00
|
|
|
uiItemR(col, &ptr, "subtype", DEFAULT_FLAGS, IFACE_("Subtype"), ICON_NONE);
|
|
|
|
|
uiItemR(col, &ptr, "default_value", UI_ITEM_R_EXPAND, IFACE_("Default"), ICON_NONE);
|
2021-01-10 13:24:37 -06:00
|
|
|
uiLayout *sub = uiLayoutColumn(col, true);
|
2023-08-30 12:37:21 +02:00
|
|
|
uiItemR(sub, &ptr, "min_value", DEFAULT_FLAGS, IFACE_("Min"), ICON_NONE);
|
|
|
|
|
uiItemR(sub, &ptr, "max_value", DEFAULT_FLAGS, IFACE_("Max"), ICON_NONE);
|
2013-03-28 10:32:04 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2024-09-23 01:16:17 +02:00
|
|
|
case SOCK_STRING: {
|
|
|
|
|
uiItemR(col, &ptr, "subtype", DEFAULT_FLAGS, IFACE_("Subtype"), ICON_NONE);
|
|
|
|
|
uiItemR(col, &ptr, "default_value", DEFAULT_FLAGS, IFACE_("Default"), ICON_NONE);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2018-02-18 03:15:13 +01:00
|
|
|
case SOCK_BOOLEAN:
|
2023-06-14 20:30:10 +02:00
|
|
|
case SOCK_ROTATION:
|
2013-07-19 10:40:43 +00:00
|
|
|
case SOCK_RGBA:
|
2022-07-26 14:48:53 +02:00
|
|
|
case SOCK_OBJECT:
|
|
|
|
|
case SOCK_COLLECTION:
|
2023-02-10 09:22:45 -05:00
|
|
|
case SOCK_IMAGE:
|
2022-07-26 14:48:53 +02:00
|
|
|
case SOCK_TEXTURE:
|
|
|
|
|
case SOCK_MATERIAL: {
|
2023-08-30 12:37:21 +02:00
|
|
|
uiItemR(col, &ptr, "default_value", DEFAULT_FLAGS, IFACE_("Default"), ICON_NONE);
|
2013-03-28 10:32:04 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2024-01-26 12:40:01 +01:00
|
|
|
case SOCK_MENU: {
|
|
|
|
|
uiItemR(col, &ptr, "default_value", DEFAULT_FLAGS, IFACE_("Default"), ICON_NONE);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2023-08-30 12:37:21 +02:00
|
|
|
case SOCK_SHADER:
|
|
|
|
|
case SOCK_GEOMETRY:
|
2024-02-13 18:59:36 +01:00
|
|
|
case SOCK_MATRIX:
|
2023-08-30 12:37:21 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case SOCK_CUSTOM:
|
|
|
|
|
BLI_assert_unreachable();
|
|
|
|
|
break;
|
2013-03-28 10:32:04 +00:00
|
|
|
}
|
2020-07-27 15:03:23 +03:00
|
|
|
|
2023-02-11 16:14:38 +01:00
|
|
|
col = uiLayoutColumn(layout, false);
|
2023-02-11 16:11:10 +01:00
|
|
|
|
2023-08-30 12:37:21 +02:00
|
|
|
const bNodeTree *node_tree = reinterpret_cast<const bNodeTree *>(id);
|
2023-10-12 14:04:44 +02:00
|
|
|
if (interface_socket->flag & NODE_INTERFACE_SOCKET_INPUT && node_tree->type == NTREE_GEOMETRY) {
|
2024-06-04 19:01:45 +02:00
|
|
|
if (ELEM(type, SOCK_INT, SOCK_VECTOR, SOCK_MATRIX)) {
|
2023-10-12 14:04:44 +02:00
|
|
|
uiItemR(col, &ptr, "default_input", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
uiLayout *sub = uiLayoutColumn(col, false);
|
|
|
|
|
uiLayoutSetActive(sub, interface_socket->default_input == NODE_INPUT_DEFAULT_VALUE);
|
|
|
|
|
uiItemR(sub, &ptr, "hide_value", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-30 12:37:21 +02:00
|
|
|
if (interface_socket->flag & NODE_INTERFACE_SOCKET_INPUT && node_tree->type == NTREE_GEOMETRY) {
|
2024-06-17 13:50:41 +02:00
|
|
|
if (type == SOCK_BOOLEAN) {
|
|
|
|
|
uiItemR(col, &ptr, "layer_selection_field", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
2023-10-20 14:51:30 +02:00
|
|
|
}
|
|
|
|
|
uiLayout *sub = uiLayoutColumn(col, false);
|
|
|
|
|
uiLayoutSetActive(sub, !is_layer_selection_field(*interface_socket));
|
|
|
|
|
uiItemR(sub, &ptr, "hide_in_modifier", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
2023-10-04 19:23:21 +02:00
|
|
|
if (nodes::socket_type_supports_fields(type)) {
|
2023-10-20 14:51:30 +02:00
|
|
|
uiLayout *sub_sub = uiLayoutColumn(col, false);
|
|
|
|
|
uiLayoutSetActive(sub_sub,
|
|
|
|
|
(interface_socket->default_input == NODE_INPUT_DEFAULT_VALUE) &&
|
|
|
|
|
!is_layer_selection_field(*interface_socket));
|
|
|
|
|
uiItemR(sub_sub, &ptr, "force_non_field", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
2023-10-04 19:21:07 +02:00
|
|
|
}
|
2023-02-11 16:11:10 +01:00
|
|
|
}
|
2013-03-28 10:32:04 +00:00
|
|
|
}
|
|
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
static void node_socket_virtual_draw_color(bContext * /*C*/,
|
|
|
|
|
PointerRNA * /*ptr*/,
|
|
|
|
|
PointerRNA * /*node_ptr*/,
|
2013-03-18 16:34:57 +00:00
|
|
|
float *r_color)
|
|
|
|
|
{
|
2021-02-24 13:01:24 -06:00
|
|
|
copy_v4_v4(r_color, virtual_node_socket_color);
|
2013-03-18 16:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
2024-05-13 16:07:12 +02:00
|
|
|
static void node_socket_virtual_draw_color_simple(const bke::bNodeSocketType * /*type*/,
|
|
|
|
|
float *r_color)
|
2023-08-30 12:37:21 +02:00
|
|
|
{
|
|
|
|
|
copy_v4_v4(r_color, virtual_node_socket_color);
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-20 10:36:56 -06:00
|
|
|
} // namespace blender::ed::space_node
|
|
|
|
|
|
2024-05-13 16:07:12 +02:00
|
|
|
void ED_init_standard_node_socket_type(blender::bke::bNodeSocketType *stype)
|
2022-01-20 10:36:56 -06:00
|
|
|
{
|
|
|
|
|
using namespace blender::ed::space_node;
|
|
|
|
|
stype->draw = std_node_socket_draw;
|
2023-08-30 12:37:21 +02:00
|
|
|
stype->draw_color = std_node_socket_color_funcs[stype->type];
|
|
|
|
|
stype->draw_color_simple = std_node_socket_color_simple_fn;
|
2022-01-20 10:36:56 -06:00
|
|
|
stype->interface_draw = std_node_socket_interface_draw;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-13 16:07:12 +02:00
|
|
|
void ED_init_node_socket_type_virtual(blender::bke::bNodeSocketType *stype)
|
2013-03-18 16:34:57 +00:00
|
|
|
{
|
2022-01-20 10:36:56 -06:00
|
|
|
using namespace blender::ed::space_node;
|
2013-03-18 16:34:57 +00:00
|
|
|
stype->draw = node_socket_button_label;
|
|
|
|
|
stype->draw_color = node_socket_virtual_draw_color;
|
2023-08-30 12:37:21 +02:00
|
|
|
stype->draw_color_simple = node_socket_virtual_draw_color_simple;
|
2013-03-18 16:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
Geometry Nodes: add simulation support
This adds support for building simulations with geometry nodes. A new
`Simulation Input` and `Simulation Output` node allow maintaining a
simulation state across multiple frames. Together these two nodes form
a `simulation zone` which contains all the nodes that update the simulation
state from one frame to the next.
A new simulation zone can be added via the menu
(`Simulation > Simulation Zone`) or with the node add search.
The simulation state contains a geometry by default. However, it is possible
to add multiple geometry sockets as well as other socket types. Currently,
field inputs are evaluated and stored for the preceding geometry socket in
the order that the sockets are shown. Simulation state items can be added
by linking one of the empty sockets to something else. In the sidebar, there
is a new panel that allows adding, removing and reordering these sockets.
The simulation nodes behave as follows:
* On the first frame, the inputs of the `Simulation Input` node are evaluated
to initialize the simulation state. In later frames these sockets are not
evaluated anymore. The `Delta Time` at the first frame is zero, but the
simulation zone is still evaluated.
* On every next frame, the `Simulation Input` node outputs the simulation
state of the previous frame. Nodes in the simulation zone can edit that
data in arbitrary ways, also taking into account the `Delta Time`. The new
simulation state has to be passed to the `Simulation Output` node where it
is cached and forwarded.
* On a frame that is already cached or baked, the nodes in the simulation
zone are not evaluated, because the `Simulation Output` node can return
the previously cached data directly.
It is not allowed to connect sockets from inside the simulation zone to the
outside without going through the `Simulation Output` node. This is a necessary
restriction to make caching and sub-frame interpolation work. Links can go into
the simulation zone without problems though.
Anonymous attributes are not propagated by the simulation nodes unless they
are explicitly stored in the simulation state. This is unfortunate, but
currently there is no practical and reliable alternative. The core problem
is detecting which anonymous attributes will be required for the simulation
and afterwards. While we can detect this for the current evaluation, we can't
look into the future in time to see what data will be necessary. We intend to
make it easier to explicitly pass data through a simulation in the future,
even if the simulation is in a nested node group.
There is a new `Simulation Nodes` panel in the physics tab in the properties
editor. It allows baking all simulation zones on the selected objects. The
baking options are intentially kept at a minimum for this MVP. More features
for simulation baking as well as baking in general can be expected to be added
separately.
All baked data is stored on disk in a folder next to the .blend file. #106937
describes how baking is implemented in more detail. Volumes can not be baked
yet and materials are lost during baking for now. Packing the baked data into
the .blend file is not yet supported.
The timeline indicates which frames are currently cached, baked or cached but
invalidated by user-changes.
Simulation input and output nodes are internally linked together by their
`bNode.identifier` which stays the same even if the node name changes. They
are generally added and removed together. However, there are still cases where
"dangling" simulation nodes can be created currently. Those generally don't
cause harm, but would be nice to avoid this in more cases in the future.
Co-authored-by: Hans Goudey <h.goudey@me.com>
Co-authored-by: Lukas Tönne <lukas@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/104924
2023-05-03 13:18:51 +02:00
|
|
|
void ED_node_type_draw_color(const char *idname, float *r_color)
|
|
|
|
|
{
|
|
|
|
|
using namespace blender::ed::space_node;
|
|
|
|
|
|
2024-08-19 20:27:37 +02:00
|
|
|
const blender::bke::bNodeSocketType *typeinfo = blender::bke::node_socket_type_find(idname);
|
Geometry Nodes: add simulation support
This adds support for building simulations with geometry nodes. A new
`Simulation Input` and `Simulation Output` node allow maintaining a
simulation state across multiple frames. Together these two nodes form
a `simulation zone` which contains all the nodes that update the simulation
state from one frame to the next.
A new simulation zone can be added via the menu
(`Simulation > Simulation Zone`) or with the node add search.
The simulation state contains a geometry by default. However, it is possible
to add multiple geometry sockets as well as other socket types. Currently,
field inputs are evaluated and stored for the preceding geometry socket in
the order that the sockets are shown. Simulation state items can be added
by linking one of the empty sockets to something else. In the sidebar, there
is a new panel that allows adding, removing and reordering these sockets.
The simulation nodes behave as follows:
* On the first frame, the inputs of the `Simulation Input` node are evaluated
to initialize the simulation state. In later frames these sockets are not
evaluated anymore. The `Delta Time` at the first frame is zero, but the
simulation zone is still evaluated.
* On every next frame, the `Simulation Input` node outputs the simulation
state of the previous frame. Nodes in the simulation zone can edit that
data in arbitrary ways, also taking into account the `Delta Time`. The new
simulation state has to be passed to the `Simulation Output` node where it
is cached and forwarded.
* On a frame that is already cached or baked, the nodes in the simulation
zone are not evaluated, because the `Simulation Output` node can return
the previously cached data directly.
It is not allowed to connect sockets from inside the simulation zone to the
outside without going through the `Simulation Output` node. This is a necessary
restriction to make caching and sub-frame interpolation work. Links can go into
the simulation zone without problems though.
Anonymous attributes are not propagated by the simulation nodes unless they
are explicitly stored in the simulation state. This is unfortunate, but
currently there is no practical and reliable alternative. The core problem
is detecting which anonymous attributes will be required for the simulation
and afterwards. While we can detect this for the current evaluation, we can't
look into the future in time to see what data will be necessary. We intend to
make it easier to explicitly pass data through a simulation in the future,
even if the simulation is in a nested node group.
There is a new `Simulation Nodes` panel in the physics tab in the properties
editor. It allows baking all simulation zones on the selected objects. The
baking options are intentially kept at a minimum for this MVP. More features
for simulation baking as well as baking in general can be expected to be added
separately.
All baked data is stored on disk in a folder next to the .blend file. #106937
describes how baking is implemented in more detail. Volumes can not be baked
yet and materials are lost during baking for now. Packing the baked data into
the .blend file is not yet supported.
The timeline indicates which frames are currently cached, baked or cached but
invalidated by user-changes.
Simulation input and output nodes are internally linked together by their
`bNode.identifier` which stays the same even if the node name changes. They
are generally added and removed together. However, there are still cases where
"dangling" simulation nodes can be created currently. Those generally don't
cause harm, but would be nice to avoid this in more cases in the future.
Co-authored-by: Hans Goudey <h.goudey@me.com>
Co-authored-by: Lukas Tönne <lukas@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/104924
2023-05-03 13:18:51 +02:00
|
|
|
if (!typeinfo || typeinfo->type == SOCK_CUSTOM) {
|
|
|
|
|
r_color[0] = 0.0f;
|
|
|
|
|
r_color[1] = 0.0f;
|
|
|
|
|
r_color[2] = 0.0f;
|
|
|
|
|
r_color[3] = 0.0f;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLI_assert(typeinfo->type < ARRAY_SIZE(std_node_socket_colors));
|
|
|
|
|
copy_v4_v4(r_color, std_node_socket_colors[typeinfo->type]);
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-20 10:36:56 -06:00
|
|
|
namespace blender::ed::space_node {
|
|
|
|
|
|
2008-12-24 10:33:10 +00:00
|
|
|
/* ************** Generic drawing ************** */
|
|
|
|
|
|
2021-12-03 16:25:17 -05:00
|
|
|
void draw_nodespace_back_pix(const bContext &C,
|
|
|
|
|
ARegion ®ion,
|
|
|
|
|
SpaceNode &snode,
|
2013-04-24 16:36:50 +00:00
|
|
|
bNodeInstanceKey parent_key)
|
|
|
|
|
{
|
2021-12-03 16:25:17 -05:00
|
|
|
Main *bmain = CTX_data_main(&C);
|
|
|
|
|
bNodeInstanceKey active_viewer_key = (snode.nodetree ? snode.nodetree->active_viewer_key :
|
2024-05-13 16:07:12 +02:00
|
|
|
bke::NODE_INSTANCE_KEY_NONE);
|
2019-04-23 09:15:45 -06:00
|
|
|
GPU_matrix_push_projection();
|
|
|
|
|
GPU_matrix_push();
|
2021-12-03 16:25:17 -05:00
|
|
|
wmOrtho2_region_pixelspace(®ion);
|
2019-04-23 09:15:45 -06:00
|
|
|
GPU_matrix_identity_set();
|
2021-12-03 16:25:17 -05:00
|
|
|
ED_region_draw_cb_draw(&C, ®ion, REGION_DRAW_BACKDROP);
|
2019-04-23 09:15:45 -06:00
|
|
|
GPU_matrix_pop_projection();
|
|
|
|
|
GPU_matrix_pop();
|
|
|
|
|
|
2021-12-03 16:25:17 -05:00
|
|
|
if (!(snode.flag & SNODE_BACKDRAW) || !ED_node_is_compositor(&snode)) {
|
2013-04-24 16:36:50 +00:00
|
|
|
return;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-03-26 21:16:47 +11:00
|
|
|
if (parent_key.value != active_viewer_key.value) {
|
2013-04-24 16:36:50 +00:00
|
|
|
return;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-24 13:18:57 +01:00
|
|
|
GPU_matrix_push_projection();
|
|
|
|
|
GPU_matrix_push();
|
|
|
|
|
|
|
|
|
|
/* The draw manager is used to draw the backdrop image. */
|
|
|
|
|
GPUFrameBuffer *old_fb = GPU_framebuffer_active_get();
|
|
|
|
|
GPU_framebuffer_restore();
|
2021-01-25 12:44:18 +01:00
|
|
|
BLI_thread_lock(LOCK_DRAW_IMAGE);
|
2021-12-03 16:25:17 -05:00
|
|
|
DRW_draw_view(&C);
|
2021-01-25 12:44:18 +01:00
|
|
|
BLI_thread_unlock(LOCK_DRAW_IMAGE);
|
2020-11-24 13:18:57 +01:00
|
|
|
GPU_framebuffer_bind_no_srgb(old_fb);
|
2023-08-30 12:37:21 +02:00
|
|
|
/* Draw manager changes the depth state. Set it back to NONE. Without this the
|
|
|
|
|
* node preview images aren't drawn correctly. */
|
2020-11-24 13:18:57 +01:00
|
|
|
GPU_depth_test(GPU_DEPTH_NONE);
|
|
|
|
|
|
2020-09-08 15:20:07 +02:00
|
|
|
void *lock;
|
|
|
|
|
Image *ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
|
2021-06-02 17:19:36 +02:00
|
|
|
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock);
|
2013-04-24 16:36:50 +00:00
|
|
|
if (ibuf) {
|
|
|
|
|
/* somehow the offset has to be calculated inverse */
|
2021-12-03 16:25:17 -05:00
|
|
|
wmOrtho2_region_pixelspace(®ion);
|
2024-03-26 07:49:33 +01:00
|
|
|
const float offset_x = snode.xof + ima->runtime.backdrop_offset[0] * snode.zoom;
|
|
|
|
|
const float offset_y = snode.yof + ima->runtime.backdrop_offset[1] * snode.zoom;
|
2023-03-21 08:27:05 +01:00
|
|
|
const float x = (region.winx - snode.zoom * ibuf->x) / 2 + offset_x;
|
|
|
|
|
const float y = (region.winy - snode.zoom * ibuf->y) / 2 + offset_y;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-08-30 12:37:21 +02:00
|
|
|
/** \note draw selected info on backdrop
|
|
|
|
|
*/
|
2021-12-03 16:25:17 -05:00
|
|
|
if (snode.edittree) {
|
|
|
|
|
bNode *node = (bNode *)snode.edittree->nodes.first;
|
2024-09-26 15:02:59 +10:00
|
|
|
const rctf *viewer_border = &snode.nodetree->viewer_border;
|
2013-04-24 16:36:50 +00:00
|
|
|
while (node) {
|
|
|
|
|
if (node->flag & NODE_SELECT) {
|
2013-10-10 11:33:20 +00:00
|
|
|
if (node->typeinfo->draw_backdrop) {
|
2021-12-03 16:25:17 -05:00
|
|
|
node->typeinfo->draw_backdrop(&snode, ibuf, node, x, y);
|
2013-03-07 17:47:30 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2013-04-24 16:36:50 +00:00
|
|
|
node = node->next;
|
____
`````|````` | | | ..''''
| | | |______ .''
| | | | ..'
| | |_______ |___________ ....''
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
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-12-03 16:25:17 -05:00
|
|
|
if ((snode.nodetree->flag & NTREE_VIEWER_BORDER) &&
|
2014-06-05 20:05:41 +06:00
|
|
|
viewer_border->xmin < viewer_border->xmax && viewer_border->ymin < viewer_border->ymax)
|
|
|
|
|
{
|
|
|
|
|
rcti pixel_border;
|
|
|
|
|
BLI_rcti_init(&pixel_border,
|
2021-12-03 16:25:17 -05:00
|
|
|
x + snode.zoom * viewer_border->xmin * ibuf->x,
|
|
|
|
|
x + snode.zoom * viewer_border->xmax * ibuf->x,
|
|
|
|
|
y + snode.zoom * viewer_border->ymin * ibuf->y,
|
|
|
|
|
y + snode.zoom * viewer_border->ymax * ibuf->y);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
uint pos = GPU_vertformat_attr_add(
|
|
|
|
|
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2022-09-01 09:31:07 -03:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
2017-02-21 22:17:47 -03:00
|
|
|
immUniformThemeColor(TH_ACTIVE);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-21 22:17:47 -03:00
|
|
|
immDrawBorderCorners(pos, &pixel_border, 1.0f, 1.0f);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-21 22:17:47 -03:00
|
|
|
immUnbindProgram();
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-04-24 16:36:50 +00:00
|
|
|
BKE_image_release_ibuf(ima, ibuf, lock);
|
2020-11-24 13:18:57 +01:00
|
|
|
GPU_matrix_pop_projection();
|
|
|
|
|
GPU_matrix_pop();
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
|
2023-03-19 07:03:01 +01:00
|
|
|
static float2 socket_link_connection_location(const bNode &node,
|
2022-11-07 16:12:07 +01:00
|
|
|
const bNodeSocket &socket,
|
|
|
|
|
const bNodeLink &link)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2023-03-19 07:03:01 +01:00
|
|
|
const float2 socket_location = socket.runtime->location;
|
2022-11-07 16:12:07 +01:00
|
|
|
if (socket.is_multi_input() && socket.is_input() && !(node.flag & NODE_HIDDEN)) {
|
2024-05-26 13:37:52 +02:00
|
|
|
/* For internal link case, handle number of links as at least 1. */
|
|
|
|
|
const int clamped_total_inputs = math::max<int>(1, socket.runtime->total_inputs);
|
2022-09-02 15:25:34 -05:00
|
|
|
return node_link_calculate_multi_input_position(
|
2024-05-26 13:37:52 +02:00
|
|
|
socket_location, link.multi_input_sort_id, clamped_total_inputs);
|
2009-02-07 14:03:34 +00:00
|
|
|
}
|
2022-09-02 15:25:34 -05:00
|
|
|
return socket_location;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-02 15:25:34 -05:00
|
|
|
static void calculate_inner_link_bezier_points(std::array<float2, 4> &points)
|
|
|
|
|
{
|
2022-09-02 14:09:32 -05:00
|
|
|
const int curving = UI_GetThemeValueType(TH_NODE_CURVING, SPACE_NODE);
|
2018-08-10 14:24:31 +02:00
|
|
|
if (curving == 0) {
|
|
|
|
|
/* Straight line: align all points. */
|
2022-09-02 14:09:32 -05:00
|
|
|
points[1] = math::interpolate(points[0], points[3], 1.0f / 3.0f);
|
|
|
|
|
points[2] = math::interpolate(points[0], points[3], 2.0f / 3.0f);
|
2018-08-10 14:24:31 +02:00
|
|
|
}
|
2022-09-02 14:47:23 -05:00
|
|
|
else {
|
2022-09-23 17:54:27 +02:00
|
|
|
const float dist_x = math::distance(points[0].x, points[3].x);
|
|
|
|
|
const float dist_y = math::distance(points[0].y, points[3].y);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-23 17:54:27 +02:00
|
|
|
/* Reduce the handle offset when the link endpoints are close to horizontal. */
|
2023-11-11 21:09:54 +01:00
|
|
|
const float slope = math::safe_divide(dist_y, dist_x);
|
2022-09-23 17:54:27 +02:00
|
|
|
const float clamp_factor = math::min(1.0f, slope * (4.5f - 0.25f * float(curving)));
|
|
|
|
|
|
|
|
|
|
const float handle_offset = curving * 0.1f * dist_x * clamp_factor;
|
|
|
|
|
|
|
|
|
|
points[1].x = points[0].x + handle_offset;
|
2022-09-02 14:47:23 -05:00
|
|
|
points[1].y = points[0].y;
|
2022-03-29 23:39:50 +02:00
|
|
|
|
2022-09-23 17:54:27 +02:00
|
|
|
points[2].x = points[3].x - handle_offset;
|
2022-09-02 14:47:23 -05:00
|
|
|
points[2].y = points[3].y;
|
|
|
|
|
}
|
2022-09-02 15:25:34 -05:00
|
|
|
}
|
2022-03-29 23:39:50 +02:00
|
|
|
|
2023-03-19 07:03:01 +01:00
|
|
|
static std::array<float2, 4> node_link_bezier_points(const bNodeLink &link)
|
2022-09-02 15:25:34 -05:00
|
|
|
{
|
|
|
|
|
std::array<float2, 4> points;
|
2023-03-19 07:03:01 +01:00
|
|
|
points[0] = socket_link_connection_location(*link.fromnode, *link.fromsock, link);
|
|
|
|
|
points[3] = socket_link_connection_location(*link.tonode, *link.tosock, link);
|
2022-09-02 15:25:34 -05:00
|
|
|
calculate_inner_link_bezier_points(points);
|
|
|
|
|
return points;
|
2022-09-02 14:47:23 -05:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-02 14:47:23 -05:00
|
|
|
static bool node_link_draw_is_visible(const View2D &v2d, const std::array<float2, 4> &points)
|
|
|
|
|
{
|
|
|
|
|
if (min_ffff(points[0].x, points[1].x, points[2].x, points[3].x) > v2d.cur.xmax) {
|
|
|
|
|
return false;
|
2012-07-09 23:07:15 +00:00
|
|
|
}
|
2022-09-02 14:47:23 -05:00
|
|
|
if (max_ffff(points[0].x, points[1].x, points[2].x, points[3].x) < v2d.cur.xmin) {
|
|
|
|
|
return false;
|
2012-07-09 23:07:15 +00:00
|
|
|
}
|
2020-09-02 19:10:18 +02:00
|
|
|
return true;
|
2018-04-05 15:41:17 +02:00
|
|
|
}
|
|
|
|
|
|
2023-03-19 07:03:01 +01:00
|
|
|
void node_link_bezier_points_evaluated(const bNodeLink &link,
|
2022-09-02 15:43:53 -05:00
|
|
|
std::array<float2, NODE_LINK_RESOL + 1> &coords)
|
2018-04-05 15:41:17 +02:00
|
|
|
{
|
2023-03-19 07:03:01 +01:00
|
|
|
const std::array<float2, 4> points = node_link_bezier_points(link);
|
2018-04-05 15:41:17 +02:00
|
|
|
|
2022-09-02 15:43:53 -05:00
|
|
|
/* The extra +1 in size is required by these functions and would be removed ideally. */
|
2022-09-02 14:32:17 -05:00
|
|
|
BKE_curve_forward_diff_bezier(points[0].x,
|
|
|
|
|
points[1].x,
|
|
|
|
|
points[2].x,
|
|
|
|
|
points[3].x,
|
2022-09-02 15:43:53 -05:00
|
|
|
&coords[0].x,
|
|
|
|
|
NODE_LINK_RESOL,
|
|
|
|
|
sizeof(float2));
|
2022-09-02 14:32:17 -05:00
|
|
|
BKE_curve_forward_diff_bezier(points[0].y,
|
|
|
|
|
points[1].y,
|
|
|
|
|
points[2].y,
|
|
|
|
|
points[3].y,
|
2022-09-02 15:43:53 -05:00
|
|
|
&coords[0].y,
|
|
|
|
|
NODE_LINK_RESOL,
|
|
|
|
|
sizeof(float2));
|
2009-02-07 14:03:34 +00:00
|
|
|
}
|
|
|
|
|
|
2018-04-05 15:41:17 +02:00
|
|
|
#define NODELINK_GROUP_SIZE 256
|
2012-05-27 19:38:10 +00:00
|
|
|
#define LINK_RESOL 24
|
2023-08-22 19:24:07 +02:00
|
|
|
#define LINK_WIDTH 2.5f
|
2023-03-17 04:19:05 +01:00
|
|
|
#define ARROW_SIZE (7 * UI_SCALE_FAC)
|
2018-04-05 15:41:17 +02:00
|
|
|
|
2023-08-21 10:05:45 +10:00
|
|
|
/* Reroute arrow shape and mute bar. These are expanded here and shrunk in the GLSL code.
|
|
|
|
|
* See: `gpu_shader_2D_nodelink_vert.glsl`. */
|
2018-04-05 16:07:28 +02:00
|
|
|
static float arrow_verts[3][2] = {{-1.0f, 1.0f}, {0.0f, 0.0f}, {-1.0f, -1.0f}};
|
2018-04-05 15:41:17 +02:00
|
|
|
static float arrow_expand_axis[3][2] = {{0.7071f, 0.7071f}, {M_SQRT2, 0.0f}, {0.7071f, -0.7071f}};
|
2021-03-16 19:11:54 +00:00
|
|
|
static float mute_verts[3][2] = {{0.7071f, 1.0f}, {0.7071f, 0.0f}, {0.7071f, -1.0f}};
|
|
|
|
|
static float mute_expand_axis[3][2] = {{1.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, -0.0f}};
|
2018-04-05 15:41:17 +02:00
|
|
|
|
2021-06-02 17:19:36 +02:00
|
|
|
/* Is zero initialized because it is static data. */
|
2018-07-31 20:44:49 +10:00
|
|
|
static struct {
|
2024-03-26 03:06:25 +01:00
|
|
|
gpu::Batch *batch; /* for batching line together */
|
|
|
|
|
gpu::Batch *batch_single; /* for single line */
|
2024-03-24 16:38:30 +01:00
|
|
|
gpu::VertBuf *inst_vbo;
|
2020-02-08 01:02:18 +11:00
|
|
|
uint p0_id, p1_id, p2_id, p3_id;
|
2021-10-21 21:00:17 +02:00
|
|
|
uint colid_id, muted_id, start_color_id, end_color_id;
|
2021-07-15 11:00:23 +02:00
|
|
|
uint dim_factor_id;
|
2021-09-27 15:10:28 +02:00
|
|
|
uint thickness_id;
|
2023-08-22 19:24:07 +02:00
|
|
|
uint dash_params_id;
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
uint has_back_link_id;
|
2018-07-18 00:12:21 +02:00
|
|
|
GPUVertBufRaw p0_step, p1_step, p2_step, p3_step;
|
2021-10-21 21:00:17 +02:00
|
|
|
GPUVertBufRaw colid_step, muted_step, start_color_step, end_color_step;
|
2021-07-15 11:00:23 +02:00
|
|
|
GPUVertBufRaw dim_factor_step;
|
2021-09-27 15:10:28 +02:00
|
|
|
GPUVertBufRaw thickness_step;
|
2023-08-22 19:24:07 +02:00
|
|
|
GPUVertBufRaw dash_params_step;
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
GPUVertBufRaw has_back_link_step;
|
2020-02-08 01:02:18 +11:00
|
|
|
uint count;
|
2018-04-05 15:41:17 +02:00
|
|
|
bool enabled;
|
2021-06-02 17:19:36 +02:00
|
|
|
} g_batch_link;
|
2018-04-05 15:41:17 +02:00
|
|
|
|
2021-06-02 17:19:36 +02:00
|
|
|
static void nodelink_batch_reset()
|
2018-04-05 15:41:17 +02:00
|
|
|
{
|
2018-07-18 00:12:21 +02:00
|
|
|
GPU_vertbuf_attr_get_raw_data(g_batch_link.inst_vbo, g_batch_link.p0_id, &g_batch_link.p0_step);
|
|
|
|
|
GPU_vertbuf_attr_get_raw_data(g_batch_link.inst_vbo, g_batch_link.p1_id, &g_batch_link.p1_step);
|
|
|
|
|
GPU_vertbuf_attr_get_raw_data(g_batch_link.inst_vbo, g_batch_link.p2_id, &g_batch_link.p2_step);
|
|
|
|
|
GPU_vertbuf_attr_get_raw_data(g_batch_link.inst_vbo, g_batch_link.p3_id, &g_batch_link.p3_step);
|
|
|
|
|
GPU_vertbuf_attr_get_raw_data(
|
|
|
|
|
g_batch_link.inst_vbo, g_batch_link.colid_id, &g_batch_link.colid_step);
|
2021-03-16 19:11:54 +00:00
|
|
|
GPU_vertbuf_attr_get_raw_data(
|
|
|
|
|
g_batch_link.inst_vbo, g_batch_link.muted_id, &g_batch_link.muted_step);
|
2021-07-15 11:00:23 +02:00
|
|
|
GPU_vertbuf_attr_get_raw_data(
|
|
|
|
|
g_batch_link.inst_vbo, g_batch_link.dim_factor_id, &g_batch_link.dim_factor_step);
|
2021-09-27 15:10:28 +02:00
|
|
|
GPU_vertbuf_attr_get_raw_data(
|
|
|
|
|
g_batch_link.inst_vbo, g_batch_link.thickness_id, &g_batch_link.thickness_step);
|
2021-09-28 17:02:47 +02:00
|
|
|
GPU_vertbuf_attr_get_raw_data(
|
2023-08-22 19:24:07 +02:00
|
|
|
g_batch_link.inst_vbo, g_batch_link.dash_params_id, &g_batch_link.dash_params_step);
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
GPU_vertbuf_attr_get_raw_data(
|
|
|
|
|
g_batch_link.inst_vbo, g_batch_link.has_back_link_id, &g_batch_link.has_back_link_step);
|
2021-10-21 21:00:17 +02:00
|
|
|
GPU_vertbuf_attr_get_raw_data(
|
|
|
|
|
g_batch_link.inst_vbo, g_batch_link.start_color_id, &g_batch_link.start_color_step);
|
|
|
|
|
GPU_vertbuf_attr_get_raw_data(
|
|
|
|
|
g_batch_link.inst_vbo, g_batch_link.end_color_id, &g_batch_link.end_color_step);
|
2018-04-05 15:41:17 +02:00
|
|
|
g_batch_link.count = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-24 16:38:30 +01:00
|
|
|
static void set_nodelink_vertex(gpu::VertBuf *vbo,
|
2020-02-08 01:02:18 +11:00
|
|
|
uint uv_id,
|
|
|
|
|
uint pos_id,
|
|
|
|
|
uint exp_id,
|
|
|
|
|
uint v,
|
|
|
|
|
const uchar uv[2],
|
2018-04-05 15:41:17 +02:00
|
|
|
const float pos[2],
|
|
|
|
|
const float exp[2])
|
|
|
|
|
{
|
2018-07-18 00:12:21 +02:00
|
|
|
GPU_vertbuf_attr_set(vbo, uv_id, v, uv);
|
|
|
|
|
GPU_vertbuf_attr_set(vbo, pos_id, v, pos);
|
|
|
|
|
GPU_vertbuf_attr_set(vbo, exp_id, v, exp);
|
2018-04-05 15:41:17 +02:00
|
|
|
}
|
|
|
|
|
|
2021-06-02 17:19:36 +02:00
|
|
|
static void nodelink_batch_init()
|
2018-04-05 15:41:17 +02:00
|
|
|
{
|
2018-07-18 00:12:21 +02:00
|
|
|
GPUVertFormat format = {0};
|
|
|
|
|
uint uv_id = GPU_vertformat_attr_add(&format, "uv", GPU_COMP_U8, 2, GPU_FETCH_INT_TO_FLOAT_UNIT);
|
|
|
|
|
uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
|
uint expand_id = GPU_vertformat_attr_add(&format, "expand", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2024-06-05 18:47:22 +02:00
|
|
|
gpu::VertBuf *vbo = GPU_vertbuf_create_with_format_ex(format, GPU_USAGE_STATIC);
|
2018-04-05 15:41:17 +02:00
|
|
|
int vcount = LINK_RESOL * 2; /* curve */
|
|
|
|
|
vcount += 2; /* restart strip */
|
2018-04-19 07:47:03 +02:00
|
|
|
vcount += 3 * 2; /* arrow */
|
2021-03-16 19:11:54 +00:00
|
|
|
vcount += 2; /* restart strip */
|
|
|
|
|
vcount += 3 * 2; /* mute */
|
2018-04-05 15:41:17 +02:00
|
|
|
vcount *= 2; /* shadow */
|
|
|
|
|
vcount += 2; /* restart strip */
|
2024-06-05 18:47:22 +02:00
|
|
|
GPU_vertbuf_data_alloc(*vbo, vcount);
|
2018-04-05 15:41:17 +02:00
|
|
|
int v = 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-09-08 00:12:26 +10:00
|
|
|
for (int k = 0; k < 2; k++) {
|
2020-02-08 01:02:18 +11:00
|
|
|
uchar uv[2] = {0, 0};
|
2018-04-05 15:41:17 +02:00
|
|
|
float pos[2] = {0.0f, 0.0f};
|
|
|
|
|
float exp[2] = {0.0f, 1.0f};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-05 15:41:17 +02:00
|
|
|
/* restart */
|
2019-03-26 21:16:47 +11:00
|
|
|
if (k == 1) {
|
2018-04-05 15:41:17 +02:00
|
|
|
set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-05 15:41:17 +02:00
|
|
|
/* curve strip */
|
2019-09-08 00:12:26 +10:00
|
|
|
for (int i = 0; i < LINK_RESOL; i++) {
|
2022-09-25 18:33:28 +10:00
|
|
|
uv[0] = 255 * (i / float(LINK_RESOL - 1));
|
2018-04-05 15:41:17 +02:00
|
|
|
uv[1] = 0;
|
|
|
|
|
set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
|
|
|
|
|
uv[1] = 255;
|
|
|
|
|
set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2018-04-05 15:41:17 +02:00
|
|
|
/* restart */
|
|
|
|
|
set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-05 15:41:17 +02:00
|
|
|
uv[0] = 127;
|
2019-04-17 06:17:24 +02:00
|
|
|
uv[1] = 0;
|
2018-04-05 15:41:17 +02:00
|
|
|
copy_v2_v2(pos, arrow_verts[0]);
|
|
|
|
|
copy_v2_v2(exp, arrow_expand_axis[0]);
|
|
|
|
|
set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
|
|
|
|
|
/* arrow */
|
2019-09-08 00:12:26 +10:00
|
|
|
for (int i = 0; i < 3; i++) {
|
2018-04-05 15:41:17 +02:00
|
|
|
uv[1] = 0;
|
|
|
|
|
copy_v2_v2(pos, arrow_verts[i]);
|
|
|
|
|
copy_v2_v2(exp, arrow_expand_axis[i]);
|
|
|
|
|
set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-05 15:41:17 +02:00
|
|
|
uv[1] = 255;
|
|
|
|
|
set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
|
2021-03-16 19:11:54 +00:00
|
|
|
/* restart */
|
|
|
|
|
set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
|
|
|
|
|
|
|
|
|
|
uv[0] = 127;
|
|
|
|
|
uv[1] = 0;
|
|
|
|
|
copy_v2_v2(pos, mute_verts[0]);
|
|
|
|
|
copy_v2_v2(exp, mute_expand_axis[0]);
|
|
|
|
|
set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
|
|
|
|
|
/* bar */
|
|
|
|
|
for (int i = 0; i < 3; ++i) {
|
|
|
|
|
uv[1] = 0;
|
|
|
|
|
copy_v2_v2(pos, mute_verts[i]);
|
|
|
|
|
copy_v2_v2(exp, mute_expand_axis[i]);
|
|
|
|
|
set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
|
|
|
|
|
|
|
|
|
|
uv[1] = 255;
|
|
|
|
|
set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-05 15:41:17 +02:00
|
|
|
/* restart */
|
|
|
|
|
if (k == 0) {
|
|
|
|
|
set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
|
2017-02-21 22:17:47 -03:00
|
|
|
}
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-06-02 17:19:36 +02:00
|
|
|
g_batch_link.batch = GPU_batch_create_ex(GPU_PRIM_TRI_STRIP, vbo, nullptr, GPU_BATCH_OWNS_VBO);
|
2018-04-05 15:41:17 +02:00
|
|
|
gpu_batch_presets_register(g_batch_link.batch);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-06-02 17:19:36 +02:00
|
|
|
g_batch_link.batch_single = GPU_batch_create_ex(
|
|
|
|
|
GPU_PRIM_TRI_STRIP, vbo, nullptr, GPU_BATCH_INVALID);
|
2018-04-05 15:41:17 +02:00
|
|
|
gpu_batch_presets_register(g_batch_link.batch_single);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-05 15:41:17 +02:00
|
|
|
/* Instances data */
|
2018-07-18 00:12:21 +02:00
|
|
|
GPUVertFormat format_inst = {0};
|
|
|
|
|
g_batch_link.p0_id = GPU_vertformat_attr_add(
|
|
|
|
|
&format_inst, "P0", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
|
g_batch_link.p1_id = GPU_vertformat_attr_add(
|
|
|
|
|
&format_inst, "P1", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
|
g_batch_link.p2_id = GPU_vertformat_attr_add(
|
|
|
|
|
&format_inst, "P2", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
|
g_batch_link.p3_id = GPU_vertformat_attr_add(
|
|
|
|
|
&format_inst, "P3", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
|
|
|
|
g_batch_link.colid_id = GPU_vertformat_attr_add(
|
|
|
|
|
&format_inst, "colid_doarrow", GPU_COMP_U8, 4, GPU_FETCH_INT);
|
2021-10-21 21:00:17 +02:00
|
|
|
g_batch_link.start_color_id = GPU_vertformat_attr_add(
|
|
|
|
|
&format_inst, "start_color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
|
|
|
|
|
g_batch_link.end_color_id = GPU_vertformat_attr_add(
|
|
|
|
|
&format_inst, "end_color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
|
2021-03-16 19:11:54 +00:00
|
|
|
g_batch_link.muted_id = GPU_vertformat_attr_add(
|
|
|
|
|
&format_inst, "domuted", GPU_COMP_U8, 2, GPU_FETCH_INT);
|
2021-07-15 11:00:23 +02:00
|
|
|
g_batch_link.dim_factor_id = GPU_vertformat_attr_add(
|
|
|
|
|
&format_inst, "dim_factor", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
|
2021-09-27 15:10:28 +02:00
|
|
|
g_batch_link.thickness_id = GPU_vertformat_attr_add(
|
|
|
|
|
&format_inst, "thickness", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
|
2023-08-22 19:24:07 +02:00
|
|
|
g_batch_link.dash_params_id = GPU_vertformat_attr_add(
|
|
|
|
|
&format_inst, "dash_params", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
g_batch_link.has_back_link_id = GPU_vertformat_attr_add(
|
2024-07-17 14:20:28 +02:00
|
|
|
&format_inst, "has_back_link", GPU_COMP_I32, 1, GPU_FETCH_INT);
|
2024-06-05 18:47:22 +02:00
|
|
|
g_batch_link.inst_vbo = GPU_vertbuf_create_with_format_ex(format_inst, GPU_USAGE_STREAM);
|
2019-01-15 23:24:20 +11:00
|
|
|
/* Alloc max count but only draw the range we need. */
|
2024-06-05 18:47:22 +02:00
|
|
|
GPU_vertbuf_data_alloc(*g_batch_link.inst_vbo, NODELINK_GROUP_SIZE);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
GPU_batch_instbuf_set(g_batch_link.batch, g_batch_link.inst_vbo, true);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-05 15:41:17 +02:00
|
|
|
nodelink_batch_reset();
|
|
|
|
|
}
|
2017-02-21 22:17:47 -03:00
|
|
|
|
2018-04-05 15:41:17 +02:00
|
|
|
static char nodelink_get_color_id(int th_col)
|
|
|
|
|
{
|
|
|
|
|
switch (th_col) {
|
|
|
|
|
case TH_WIRE:
|
|
|
|
|
return 1;
|
|
|
|
|
case TH_WIRE_INNER:
|
|
|
|
|
return 2;
|
|
|
|
|
case TH_ACTIVE:
|
|
|
|
|
return 3;
|
|
|
|
|
case TH_EDGE_SELECT:
|
|
|
|
|
return 4;
|
|
|
|
|
case TH_REDALERT:
|
|
|
|
|
return 5;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2017-02-21 22:17:47 -03:00
|
|
|
|
2021-12-03 16:25:17 -05:00
|
|
|
static void nodelink_batch_draw(const SpaceNode &snode)
|
2018-04-05 15:41:17 +02:00
|
|
|
{
|
2019-03-26 21:16:47 +11:00
|
|
|
if (g_batch_link.count == 0) {
|
2018-04-05 15:41:17 +02:00
|
|
|
return;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2017-02-21 22:17:47 -03:00
|
|
|
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2022-01-17 14:45:22 +01:00
|
|
|
NodeLinkInstanceData node_link_data;
|
2017-02-21 22:17:47 -03:00
|
|
|
|
2022-01-17 14:45:22 +01:00
|
|
|
UI_GetThemeColor4fv(TH_WIRE_INNER, node_link_data.colors[nodelink_get_color_id(TH_WIRE_INNER)]);
|
|
|
|
|
UI_GetThemeColor4fv(TH_WIRE, node_link_data.colors[nodelink_get_color_id(TH_WIRE)]);
|
|
|
|
|
UI_GetThemeColor4fv(TH_ACTIVE, node_link_data.colors[nodelink_get_color_id(TH_ACTIVE)]);
|
|
|
|
|
UI_GetThemeColor4fv(TH_EDGE_SELECT,
|
|
|
|
|
node_link_data.colors[nodelink_get_color_id(TH_EDGE_SELECT)]);
|
|
|
|
|
UI_GetThemeColor4fv(TH_REDALERT, node_link_data.colors[nodelink_get_color_id(TH_REDALERT)]);
|
2023-08-22 19:24:07 +02:00
|
|
|
node_link_data.aspect = snode.runtime->aspect;
|
2022-01-17 14:45:22 +01:00
|
|
|
node_link_data.arrowSize = ARROW_SIZE;
|
|
|
|
|
|
|
|
|
|
GPUUniformBuf *ubo = GPU_uniformbuf_create_ex(sizeof(node_link_data), &node_link_data, __func__);
|
2017-02-21 22:17:47 -03:00
|
|
|
|
2024-06-05 18:47:22 +02:00
|
|
|
GPU_vertbuf_data_len_set(*g_batch_link.inst_vbo, g_batch_link.count);
|
2018-07-18 00:12:21 +02:00
|
|
|
GPU_vertbuf_use(g_batch_link.inst_vbo); /* force update. */
|
2017-02-21 22:17:47 -03:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
GPU_batch_program_set_builtin(g_batch_link.batch, GPU_SHADER_2D_NODELINK_INST);
|
2022-01-17 14:45:22 +01:00
|
|
|
GPU_batch_uniformbuf_bind(g_batch_link.batch, "node_link_data", ubo);
|
2018-07-18 00:12:21 +02:00
|
|
|
GPU_batch_draw(g_batch_link.batch);
|
2017-02-21 22:17:47 -03:00
|
|
|
|
2022-01-17 14:45:22 +01:00
|
|
|
GPU_uniformbuf_unbind(ubo);
|
|
|
|
|
GPU_uniformbuf_free(ubo);
|
|
|
|
|
|
2018-04-05 15:41:17 +02:00
|
|
|
nodelink_batch_reset();
|
2017-02-21 22:17:47 -03:00
|
|
|
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2018-04-05 15:41:17 +02:00
|
|
|
}
|
2017-02-21 22:17:47 -03:00
|
|
|
|
2022-10-03 17:37:25 -05:00
|
|
|
void nodelink_batch_start(SpaceNode & /*snode*/)
|
2018-04-05 15:41:17 +02:00
|
|
|
{
|
2019-10-02 14:13:41 +02:00
|
|
|
g_batch_link.enabled = true;
|
2018-04-05 15:41:17 +02:00
|
|
|
}
|
2017-02-21 22:17:47 -03:00
|
|
|
|
2021-12-03 16:25:17 -05:00
|
|
|
void nodelink_batch_end(SpaceNode &snode)
|
2018-04-05 15:41:17 +02:00
|
|
|
{
|
|
|
|
|
nodelink_batch_draw(snode);
|
|
|
|
|
g_batch_link.enabled = false;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-01 19:46:19 +02:00
|
|
|
struct NodeLinkDrawConfig {
|
|
|
|
|
int th_col1;
|
|
|
|
|
int th_col2;
|
|
|
|
|
int th_col3;
|
|
|
|
|
|
|
|
|
|
ColorTheme4f start_color;
|
|
|
|
|
ColorTheme4f end_color;
|
|
|
|
|
ColorTheme4f outline_color;
|
|
|
|
|
|
|
|
|
|
bool drawarrow;
|
|
|
|
|
bool drawmuted;
|
|
|
|
|
bool highlighted;
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
bool has_back_link;
|
2022-09-01 19:46:19 +02:00
|
|
|
|
|
|
|
|
float dim_factor;
|
|
|
|
|
float thickness;
|
2023-08-22 19:24:07 +02:00
|
|
|
float dash_length;
|
2022-09-01 19:46:19 +02:00
|
|
|
float dash_factor;
|
|
|
|
|
float dash_alpha;
|
|
|
|
|
};
|
|
|
|
|
|
2021-12-03 16:25:17 -05:00
|
|
|
static void nodelink_batch_add_link(const SpaceNode &snode,
|
2022-09-02 14:09:32 -05:00
|
|
|
const std::array<float2, 4> &points,
|
2022-09-01 19:46:19 +02:00
|
|
|
const NodeLinkDrawConfig &draw_config)
|
2018-04-05 15:41:17 +02:00
|
|
|
{
|
|
|
|
|
/* Only allow these colors. If more is needed, you need to modify the shader accordingly. */
|
2022-09-01 19:46:19 +02:00
|
|
|
BLI_assert(
|
|
|
|
|
ELEM(draw_config.th_col1, TH_WIRE_INNER, TH_WIRE, TH_ACTIVE, TH_EDGE_SELECT, TH_REDALERT));
|
|
|
|
|
BLI_assert(
|
|
|
|
|
ELEM(draw_config.th_col2, TH_WIRE_INNER, TH_WIRE, TH_ACTIVE, TH_EDGE_SELECT, TH_REDALERT));
|
|
|
|
|
BLI_assert(ELEM(draw_config.th_col3, TH_WIRE, TH_REDALERT, -1));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-05 15:41:17 +02:00
|
|
|
g_batch_link.count++;
|
2022-09-02 14:09:32 -05:00
|
|
|
copy_v2_v2((float *)GPU_vertbuf_raw_step(&g_batch_link.p0_step), points[0]);
|
|
|
|
|
copy_v2_v2((float *)GPU_vertbuf_raw_step(&g_batch_link.p1_step), points[1]);
|
|
|
|
|
copy_v2_v2((float *)GPU_vertbuf_raw_step(&g_batch_link.p2_step), points[2]);
|
|
|
|
|
copy_v2_v2((float *)GPU_vertbuf_raw_step(&g_batch_link.p3_step), points[3]);
|
2021-06-02 17:19:36 +02:00
|
|
|
char *colid = (char *)GPU_vertbuf_raw_step(&g_batch_link.colid_step);
|
2022-09-01 19:46:19 +02:00
|
|
|
colid[0] = nodelink_get_color_id(draw_config.th_col1);
|
|
|
|
|
colid[1] = nodelink_get_color_id(draw_config.th_col2);
|
|
|
|
|
colid[2] = nodelink_get_color_id(draw_config.th_col3);
|
|
|
|
|
colid[3] = draw_config.drawarrow;
|
|
|
|
|
copy_v4_v4((float *)GPU_vertbuf_raw_step(&g_batch_link.start_color_step),
|
|
|
|
|
draw_config.start_color);
|
|
|
|
|
copy_v4_v4((float *)GPU_vertbuf_raw_step(&g_batch_link.end_color_step), draw_config.end_color);
|
2021-06-02 17:19:36 +02:00
|
|
|
char *muted = (char *)GPU_vertbuf_raw_step(&g_batch_link.muted_step);
|
2022-09-01 19:46:19 +02:00
|
|
|
muted[0] = draw_config.drawmuted;
|
|
|
|
|
*(float *)GPU_vertbuf_raw_step(&g_batch_link.dim_factor_step) = draw_config.dim_factor;
|
|
|
|
|
*(float *)GPU_vertbuf_raw_step(&g_batch_link.thickness_step) = draw_config.thickness;
|
2023-08-22 19:24:07 +02:00
|
|
|
float3 dash_params(draw_config.dash_length, draw_config.dash_factor, draw_config.dash_alpha);
|
|
|
|
|
copy_v3_v3((float *)GPU_vertbuf_raw_step(&g_batch_link.dash_params_step), dash_params);
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
*(int *)GPU_vertbuf_raw_step(&g_batch_link.has_back_link_step) = draw_config.has_back_link;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-05 15:41:17 +02:00
|
|
|
if (g_batch_link.count == NODELINK_GROUP_SIZE) {
|
|
|
|
|
nodelink_batch_draw(snode);
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-21 22:17:47 -03:00
|
|
|
|
2022-09-01 19:46:19 +02:00
|
|
|
static void node_draw_link_end_marker(const float2 center,
|
|
|
|
|
const float radius,
|
|
|
|
|
const ColorTheme4f &color)
|
|
|
|
|
{
|
|
|
|
|
rctf rect;
|
|
|
|
|
BLI_rctf_init(&rect, center.x - radius, center.x + radius, center.y - radius, center.y + radius);
|
|
|
|
|
|
|
|
|
|
UI_draw_roundbox_corner_set(UI_CNR_ALL);
|
|
|
|
|
UI_draw_roundbox_4fv(&rect, true, radius, color);
|
2022-09-29 10:28:39 +10:00
|
|
|
/* Round-box disables alpha. Re-enable it for node links that are drawn after this one. */
|
2022-09-01 19:46:19 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void node_draw_link_end_markers(const bNodeLink &link,
|
|
|
|
|
const NodeLinkDrawConfig &draw_config,
|
2022-09-02 14:09:32 -05:00
|
|
|
const std::array<float2, 4> &points,
|
2022-09-01 19:46:19 +02:00
|
|
|
const bool outline)
|
|
|
|
|
{
|
|
|
|
|
const float radius = (outline ? 0.65f : 0.45f) * NODE_SOCKSIZE;
|
|
|
|
|
if (link.fromsock) {
|
|
|
|
|
node_draw_link_end_marker(
|
2022-09-02 14:09:32 -05:00
|
|
|
points[0], radius, outline ? draw_config.outline_color : draw_config.start_color);
|
2022-09-01 19:46:19 +02:00
|
|
|
}
|
|
|
|
|
if (link.tosock) {
|
|
|
|
|
node_draw_link_end_marker(
|
2022-09-02 14:09:32 -05:00
|
|
|
points[3], radius, outline ? draw_config.outline_color : draw_config.end_color);
|
2022-09-01 19:46:19 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool node_link_is_field_link(const SpaceNode &snode, const bNodeLink &link)
|
|
|
|
|
{
|
|
|
|
|
if (snode.edittree->type != NTREE_GEOMETRY) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2024-08-20 16:15:52 +02:00
|
|
|
if (link.fromsock && link.fromsock->runtime->field_state == bke::FieldSocketState::IsField) {
|
2022-09-01 19:46:19 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
static bool node_link_is_gizmo_link(const SpaceNode &snode, const bNodeLink &link)
|
|
|
|
|
{
|
|
|
|
|
if (snode.edittree->type != NTREE_GEOMETRY) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (!link.fromsock || !link.tosock) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
const bNodeTree &tree = *snode.edittree;
|
|
|
|
|
return tree.runtime->sockets_on_active_gizmo_paths.contains(link.fromsock) &&
|
|
|
|
|
tree.runtime->sockets_on_active_gizmo_paths.contains(link.tosock);
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-01 09:29:56 +01:00
|
|
|
static NodeLinkDrawConfig nodelink_get_draw_config(const bContext &C,
|
|
|
|
|
const View2D &v2d,
|
2022-09-01 19:46:19 +02:00
|
|
|
const SpaceNode &snode,
|
|
|
|
|
const bNodeLink &link,
|
|
|
|
|
const int th_col1,
|
|
|
|
|
const int th_col2,
|
|
|
|
|
const int th_col3,
|
|
|
|
|
const bool selected)
|
2018-04-05 15:41:17 +02:00
|
|
|
{
|
2022-09-01 19:46:19 +02:00
|
|
|
NodeLinkDrawConfig draw_config;
|
|
|
|
|
|
|
|
|
|
draw_config.th_col1 = th_col1;
|
|
|
|
|
draw_config.th_col2 = th_col2;
|
|
|
|
|
draw_config.th_col3 = th_col3;
|
|
|
|
|
|
2023-03-19 07:03:01 +01:00
|
|
|
draw_config.dim_factor = selected ? 1.0f : node_link_dim_factor(v2d, link);
|
2021-10-21 21:00:17 +02:00
|
|
|
|
|
|
|
|
bTheme *btheme = UI_GetTheme();
|
2022-09-01 19:46:19 +02:00
|
|
|
draw_config.dash_alpha = btheme->space_node.dash_alpha;
|
|
|
|
|
|
|
|
|
|
const bool field_link = node_link_is_field_link(snode, link);
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
const bool gizmo_link = node_link_is_gizmo_link(snode, link);
|
2022-09-01 19:46:19 +02:00
|
|
|
|
|
|
|
|
draw_config.dash_factor = field_link ? 0.75f : 1.0f;
|
2023-08-22 19:24:07 +02:00
|
|
|
draw_config.dash_length = 10.0f * UI_SCALE_FAC;
|
2022-09-01 19:46:19 +02:00
|
|
|
|
|
|
|
|
const float scale = UI_view2d_scale_get_x(&v2d);
|
|
|
|
|
/* Clamp the thickness to make the links more readable when zooming out. */
|
2023-08-22 19:24:07 +02:00
|
|
|
draw_config.thickness = LINK_WIDTH * max_ff(UI_SCALE_FAC * scale, 1.0f) *
|
|
|
|
|
(field_link ? 0.7f : 1.0f);
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
draw_config.has_back_link = gizmo_link;
|
2022-09-01 19:46:19 +02:00
|
|
|
draw_config.highlighted = link.flag & NODE_LINK_TEMP_HIGHLIGHT;
|
|
|
|
|
draw_config.drawarrow = ((link.tonode && (link.tonode->type == NODE_REROUTE)) &&
|
|
|
|
|
(link.fromnode && (link.fromnode->type == NODE_REROUTE)));
|
|
|
|
|
draw_config.drawmuted = (link.flag & NODE_LINK_MUTED);
|
|
|
|
|
|
|
|
|
|
UI_GetThemeColor4fv(th_col3, draw_config.outline_color);
|
|
|
|
|
|
|
|
|
|
if (snode.overlay.flag & SN_OVERLAY_SHOW_OVERLAYS &&
|
|
|
|
|
snode.overlay.flag & SN_OVERLAY_SHOW_WIRE_COLORS)
|
|
|
|
|
{
|
2023-11-01 09:29:56 +01:00
|
|
|
const bNodeTree &node_tree = *snode.edittree;
|
|
|
|
|
PointerRNA from_node_ptr = RNA_pointer_create(
|
|
|
|
|
&const_cast<ID &>(node_tree.id), &RNA_Node, link.fromnode);
|
|
|
|
|
PointerRNA to_node_ptr = RNA_pointer_create(
|
|
|
|
|
&const_cast<ID &>(node_tree.id), &RNA_Node, link.tonode);
|
|
|
|
|
|
2022-09-01 19:46:19 +02:00
|
|
|
if (link.fromsock) {
|
2023-11-01 09:29:56 +01:00
|
|
|
node_socket_color_get(C, node_tree, from_node_ptr, *link.fromsock, draw_config.start_color);
|
2022-09-01 19:46:19 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2023-11-01 09:29:56 +01:00
|
|
|
node_socket_color_get(C, node_tree, to_node_ptr, *link.tosock, draw_config.start_color);
|
2021-09-27 15:10:28 +02:00
|
|
|
}
|
2021-07-15 11:00:23 +02:00
|
|
|
|
2022-09-01 19:46:19 +02:00
|
|
|
if (link.tosock) {
|
2023-11-01 09:29:56 +01:00
|
|
|
node_socket_color_get(C, node_tree, to_node_ptr, *link.tosock, draw_config.end_color);
|
2018-04-05 15:41:17 +02:00
|
|
|
}
|
2022-09-01 19:46:19 +02:00
|
|
|
else {
|
2023-11-01 09:29:56 +01:00
|
|
|
node_socket_color_get(C, node_tree, from_node_ptr, *link.fromsock, draw_config.end_color);
|
2021-10-21 21:00:17 +02:00
|
|
|
}
|
2022-09-01 19:46:19 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
UI_GetThemeColor4fv(th_col1, draw_config.start_color);
|
|
|
|
|
UI_GetThemeColor4fv(th_col2, draw_config.end_color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Highlight links connected to selected nodes. */
|
|
|
|
|
if (selected) {
|
|
|
|
|
ColorTheme4f color_selected;
|
|
|
|
|
UI_GetThemeColor4fv(TH_EDGE_SELECT, color_selected);
|
|
|
|
|
const float alpha = color_selected.a;
|
2021-10-21 21:00:17 +02:00
|
|
|
|
2022-09-01 19:46:19 +02:00
|
|
|
/* Interpolate color if highlight color is not fully transparent. */
|
|
|
|
|
if (alpha != 0.0) {
|
2021-12-03 16:25:17 -05:00
|
|
|
if (link.fromsock) {
|
2022-09-01 19:46:19 +02:00
|
|
|
interp_v3_v3v3(draw_config.start_color, draw_config.start_color, color_selected, alpha);
|
2021-10-21 21:00:17 +02:00
|
|
|
}
|
2021-12-03 16:25:17 -05:00
|
|
|
if (link.tosock) {
|
2022-09-01 19:46:19 +02:00
|
|
|
interp_v3_v3v3(draw_config.end_color, draw_config.end_color, color_selected, alpha);
|
2021-10-21 21:00:17 +02:00
|
|
|
}
|
|
|
|
|
}
|
2022-09-01 19:46:19 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-01 19:46:19 +02:00
|
|
|
if (draw_config.highlighted) {
|
|
|
|
|
ColorTheme4f link_preselection_highlight_color;
|
|
|
|
|
UI_GetThemeColor4fv(TH_SELECT, link_preselection_highlight_color);
|
|
|
|
|
/* Multi sockets can only be inputs. So we only have to highlight the end of the link. */
|
|
|
|
|
copy_v4_v4(draw_config.end_color, link_preselection_highlight_color);
|
|
|
|
|
}
|
2021-10-26 15:54:52 +02:00
|
|
|
|
2022-09-01 19:46:19 +02:00
|
|
|
return draw_config;
|
|
|
|
|
}
|
2021-10-26 15:54:52 +02:00
|
|
|
|
2022-09-01 19:46:19 +02:00
|
|
|
static void node_draw_link_bezier_ex(const SpaceNode &snode,
|
|
|
|
|
const NodeLinkDrawConfig &draw_config,
|
2022-09-02 14:09:32 -05:00
|
|
|
const std::array<float2, 4> &points)
|
2022-09-01 19:46:19 +02:00
|
|
|
{
|
|
|
|
|
if (g_batch_link.batch == nullptr) {
|
|
|
|
|
nodelink_batch_init();
|
|
|
|
|
}
|
2021-02-11 01:16:17 -06:00
|
|
|
|
2022-09-01 19:46:19 +02:00
|
|
|
if (g_batch_link.enabled && !draw_config.highlighted) {
|
|
|
|
|
/* Add link to batch. */
|
2022-09-02 14:09:32 -05:00
|
|
|
nodelink_batch_add_link(snode, points, draw_config);
|
2022-09-01 19:46:19 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
NodeLinkData node_link_data;
|
2022-09-02 14:09:32 -05:00
|
|
|
for (const int i : IndexRange(points.size())) {
|
|
|
|
|
copy_v2_v2(node_link_data.bezierPts[i], points[i]);
|
2012-06-01 12:38:03 +00:00
|
|
|
}
|
2022-09-01 19:46:19 +02:00
|
|
|
|
|
|
|
|
copy_v4_v4(node_link_data.colors[0], draw_config.outline_color);
|
|
|
|
|
copy_v4_v4(node_link_data.colors[1], draw_config.start_color);
|
|
|
|
|
copy_v4_v4(node_link_data.colors[2], draw_config.end_color);
|
|
|
|
|
|
|
|
|
|
node_link_data.doArrow = draw_config.drawarrow;
|
|
|
|
|
node_link_data.doMuted = draw_config.drawmuted;
|
|
|
|
|
node_link_data.dim_factor = draw_config.dim_factor;
|
|
|
|
|
node_link_data.thickness = draw_config.thickness;
|
2023-08-22 19:24:07 +02:00
|
|
|
node_link_data.dash_params[0] = draw_config.dash_length;
|
|
|
|
|
node_link_data.dash_params[1] = draw_config.dash_factor;
|
|
|
|
|
node_link_data.dash_params[2] = draw_config.dash_alpha;
|
Geometry Nodes: support attaching gizmos to input values
This adds support for attaching gizmos for input values. The goal is to make it
easier for users to set input values intuitively in the 3D viewport.
We went through multiple different possible designs until we settled on the one
implemented here. We picked it for it's flexibility and ease of use when using
geometry node assets. The core principle in the design is that **gizmos are
attached to existing input values instead of being the input value themselves**.
This actually fits the existing concept of gizmos in Blender well, but may be a
bit unintutitive in a node setup at first. The attachment is done using links in
the node editor.
The most basic usage of the node is to link a Value node to the new Linear Gizmo
node. This attaches the gizmo to the input value and allows you to change it
from the 3D view. The attachment is indicated by the gizmo icon in the sockets
which are controlled by a gizmo as well as the back-link (notice the double
link) when the gizmo is active.
The core principle makes it straight forward to control the same node setup from
the 3D view with gizmos, or by manually changing input values, or by driving the
input values procedurally.
If the input value is controlled indirectly by other inputs, it's often possible
to **automatically propagate** the gizmo to the actual input.
Backpropagation does not work for all nodes, although more nodes can be
supported over time.
This patch adds the first three gizmo nodes which cover common use cases:
* **Linear Gizmo**: Creates a gizmo that controls a float or integer value using
a linear movement of e.g. an arrow in the 3D viewport.
* **Dial Gizmo**: Creates a circular gizmo in the 3D viewport that can be
rotated to change the attached angle input.
* **Transform Gizmo**: Creates a simple gizmo for location, rotation and scale.
In the future, more built-in gizmos and potentially the ability for custom
gizmos could be added.
All gizmo nodes have a **Transform** geometry output. Using it is optional but
it is recommended when the gizmo is used to control inputs that affect a
geometry. When it is used, Blender will automatically transform the gizmos
together with the geometry that they control. To achieve this, the output should
be merged with the generated geometry using the *Join Geometry* node. The data
contained in *Transform* output is not visible geometry, but just internal
information that helps Blender to give a better user experience when using
gizmos.
The gizmo nodes have a multi-input socket. This allows **controlling multiple
values** with the same gizmo.
Only a small set of **gizmo shapes** is supported initially. It might be
extended in the future but one goal is to give the gizmos used by different node
group assets a familiar look and feel. A similar constraint exists for
**colors**. Currently, one can choose from a fixed set of colors which can be
modified in the theme settings.
The set of **visible gizmos** is determined by a multiple factors because it's
not really feasible to show all possible gizmos at all times. To see any of the
geometry nodes gizmos, the "Active Modifier" option has to be enabled in the
"Viewport Gizmos" popover. Then all gizmos are drawn for which at least one of
the following is true:
* The gizmo controls an input of the active modifier of the active object.
* The gizmo controls a value in a selected node in an open node editor.
* The gizmo controls a pinned value in an open node editor. Pinning works by
clicking the gizmo icon next to the value.
Pull Request: https://projects.blender.org/blender/blender/pulls/112677
2024-07-10 16:18:47 +02:00
|
|
|
node_link_data.has_back_link = draw_config.has_back_link;
|
2023-08-22 19:24:07 +02:00
|
|
|
node_link_data.aspect = snode.runtime->aspect;
|
2022-09-01 19:46:19 +02:00
|
|
|
node_link_data.arrowSize = ARROW_SIZE;
|
|
|
|
|
|
2024-03-26 03:06:25 +01:00
|
|
|
gpu::Batch *batch = g_batch_link.batch_single;
|
2022-09-01 19:46:19 +02:00
|
|
|
GPUUniformBuf *ubo = GPU_uniformbuf_create_ex(sizeof(NodeLinkData), &node_link_data, __func__);
|
|
|
|
|
|
|
|
|
|
GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_NODELINK);
|
|
|
|
|
GPU_batch_uniformbuf_bind(batch, "node_link_data", ubo);
|
|
|
|
|
GPU_batch_draw(batch);
|
|
|
|
|
|
|
|
|
|
GPU_uniformbuf_unbind(ubo);
|
|
|
|
|
GPU_uniformbuf_free(ubo);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-01 09:29:56 +01:00
|
|
|
void node_draw_link_bezier(const bContext &C,
|
|
|
|
|
const View2D &v2d,
|
2022-09-01 19:46:19 +02:00
|
|
|
const SpaceNode &snode,
|
|
|
|
|
const bNodeLink &link,
|
|
|
|
|
const int th_col1,
|
|
|
|
|
const int th_col2,
|
|
|
|
|
const int th_col3,
|
|
|
|
|
const bool selected)
|
|
|
|
|
{
|
2023-03-19 07:03:01 +01:00
|
|
|
const std::array<float2, 4> points = node_link_bezier_points(link);
|
2022-09-02 14:47:23 -05:00
|
|
|
if (!node_link_draw_is_visible(v2d, points)) {
|
2022-09-01 19:46:19 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const NodeLinkDrawConfig draw_config = nodelink_get_draw_config(
|
2023-11-01 09:29:56 +01:00
|
|
|
C, v2d, snode, link, th_col1, th_col2, th_col3, selected);
|
2022-09-01 19:46:19 +02:00
|
|
|
|
2022-09-02 14:09:32 -05:00
|
|
|
node_draw_link_bezier_ex(snode, draw_config, points);
|
2022-09-01 19:46:19 +02:00
|
|
|
}
|
|
|
|
|
|
2023-11-01 09:29:56 +01:00
|
|
|
void node_draw_link(const bContext &C,
|
|
|
|
|
const View2D &v2d,
|
2021-12-03 16:25:17 -05:00
|
|
|
const SpaceNode &snode,
|
2022-02-28 15:52:00 -05:00
|
|
|
const bNodeLink &link,
|
|
|
|
|
const bool selected)
|
2008-12-24 10:33:10 +00:00
|
|
|
{
|
2014-10-17 10:18:40 +02:00
|
|
|
int th_col1 = TH_WIRE_INNER, th_col2 = TH_WIRE_INNER, th_col3 = TH_WIRE;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-12-03 16:25:17 -05:00
|
|
|
if (link.fromsock == nullptr && link.tosock == nullptr) {
|
2008-12-24 10:33:10 +00:00
|
|
|
return;
|
2019-03-26 21:16:47 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-01 19:46:19 +02:00
|
|
|
/* going to give issues once... */
|
|
|
|
|
if (link.tosock->flag & SOCK_UNAVAIL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (link.fromsock->flag & SOCK_UNAVAIL) {
|
|
|
|
|
return;
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-09-01 19:46:19 +02:00
|
|
|
if (link.flag & NODE_LINK_VALID) {
|
|
|
|
|
/* special indicated link, on drop-node */
|
2024-05-23 19:52:37 +02:00
|
|
|
if (link.flag & NODE_LINK_INSERT_TARGET && !(link.flag & NODE_LINK_INSERT_TARGET_INVALID)) {
|
2022-09-01 19:46:19 +02:00
|
|
|
th_col1 = th_col2 = TH_ACTIVE;
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2022-09-01 19:46:19 +02:00
|
|
|
else if (link.flag & NODE_LINK_MUTED) {
|
|
|
|
|
th_col1 = th_col2 = TH_REDALERT;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
2022-09-01 19:46:19 +02:00
|
|
|
else {
|
|
|
|
|
/* Invalid link. */
|
|
|
|
|
th_col1 = th_col2 = th_col3 = TH_REDALERT;
|
|
|
|
|
// th_col3 = -1; /* no shadow */
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-01 09:29:56 +01:00
|
|
|
node_draw_link_bezier(C, v2d, snode, link, th_col1, th_col2, th_col3, selected);
|
2008-12-24 10:33:10 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Geometry Nodes: add simulation support
This adds support for building simulations with geometry nodes. A new
`Simulation Input` and `Simulation Output` node allow maintaining a
simulation state across multiple frames. Together these two nodes form
a `simulation zone` which contains all the nodes that update the simulation
state from one frame to the next.
A new simulation zone can be added via the menu
(`Simulation > Simulation Zone`) or with the node add search.
The simulation state contains a geometry by default. However, it is possible
to add multiple geometry sockets as well as other socket types. Currently,
field inputs are evaluated and stored for the preceding geometry socket in
the order that the sockets are shown. Simulation state items can be added
by linking one of the empty sockets to something else. In the sidebar, there
is a new panel that allows adding, removing and reordering these sockets.
The simulation nodes behave as follows:
* On the first frame, the inputs of the `Simulation Input` node are evaluated
to initialize the simulation state. In later frames these sockets are not
evaluated anymore. The `Delta Time` at the first frame is zero, but the
simulation zone is still evaluated.
* On every next frame, the `Simulation Input` node outputs the simulation
state of the previous frame. Nodes in the simulation zone can edit that
data in arbitrary ways, also taking into account the `Delta Time`. The new
simulation state has to be passed to the `Simulation Output` node where it
is cached and forwarded.
* On a frame that is already cached or baked, the nodes in the simulation
zone are not evaluated, because the `Simulation Output` node can return
the previously cached data directly.
It is not allowed to connect sockets from inside the simulation zone to the
outside without going through the `Simulation Output` node. This is a necessary
restriction to make caching and sub-frame interpolation work. Links can go into
the simulation zone without problems though.
Anonymous attributes are not propagated by the simulation nodes unless they
are explicitly stored in the simulation state. This is unfortunate, but
currently there is no practical and reliable alternative. The core problem
is detecting which anonymous attributes will be required for the simulation
and afterwards. While we can detect this for the current evaluation, we can't
look into the future in time to see what data will be necessary. We intend to
make it easier to explicitly pass data through a simulation in the future,
even if the simulation is in a nested node group.
There is a new `Simulation Nodes` panel in the physics tab in the properties
editor. It allows baking all simulation zones on the selected objects. The
baking options are intentially kept at a minimum for this MVP. More features
for simulation baking as well as baking in general can be expected to be added
separately.
All baked data is stored on disk in a folder next to the .blend file. #106937
describes how baking is implemented in more detail. Volumes can not be baked
yet and materials are lost during baking for now. Packing the baked data into
the .blend file is not yet supported.
The timeline indicates which frames are currently cached, baked or cached but
invalidated by user-changes.
Simulation input and output nodes are internally linked together by their
`bNode.identifier` which stays the same even if the node name changes. They
are generally added and removed together. However, there are still cases where
"dangling" simulation nodes can be created currently. Those generally don't
cause harm, but would be nice to avoid this in more cases in the future.
Co-authored-by: Hans Goudey <h.goudey@me.com>
Co-authored-by: Lukas Tönne <lukas@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/104924
2023-05-03 13:18:51 +02:00
|
|
|
std::array<float2, 4> node_link_bezier_points_dragged(const SpaceNode &snode,
|
|
|
|
|
const bNodeLink &link)
|
2022-09-02 15:25:34 -05:00
|
|
|
{
|
2023-03-17 04:19:05 +01:00
|
|
|
const float2 cursor = snode.runtime->cursor * UI_SCALE_FAC;
|
2022-09-02 15:25:34 -05:00
|
|
|
std::array<float2, 4> points;
|
2022-11-07 16:12:07 +01:00
|
|
|
points[0] = link.fromsock ?
|
2023-03-19 07:03:01 +01:00
|
|
|
socket_link_connection_location(*link.fromnode, *link.fromsock, link) :
|
2022-11-07 16:12:07 +01:00
|
|
|
cursor;
|
2023-03-19 07:03:01 +01:00
|
|
|
points[3] = link.tosock ? socket_link_connection_location(*link.tonode, *link.tosock, link) :
|
|
|
|
|
cursor;
|
2022-09-02 15:25:34 -05:00
|
|
|
calculate_inner_link_bezier_points(points);
|
|
|
|
|
return points;
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-01 09:29:56 +01:00
|
|
|
void node_draw_link_dragged(const bContext &C,
|
|
|
|
|
const View2D &v2d,
|
|
|
|
|
const SpaceNode &snode,
|
|
|
|
|
const bNodeLink &link)
|
2022-09-01 19:46:19 +02:00
|
|
|
{
|
|
|
|
|
if (link.fromsock == nullptr && link.tosock == nullptr) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-02 15:25:34 -05:00
|
|
|
const std::array<float2, 4> points = node_link_bezier_points_dragged(snode, link);
|
2022-09-01 19:46:19 +02:00
|
|
|
|
|
|
|
|
const NodeLinkDrawConfig draw_config = nodelink_get_draw_config(
|
2023-11-01 09:29:56 +01:00
|
|
|
C, v2d, snode, link, TH_ACTIVE, TH_ACTIVE, TH_WIRE, true);
|
2022-09-01 19:46:19 +02:00
|
|
|
/* End marker outline. */
|
2022-09-02 14:09:32 -05:00
|
|
|
node_draw_link_end_markers(link, draw_config, points, true);
|
2022-09-01 19:46:19 +02:00
|
|
|
/* Link. */
|
2022-09-02 14:09:32 -05:00
|
|
|
node_draw_link_bezier_ex(snode, draw_config, points);
|
2022-09-01 19:46:19 +02:00
|
|
|
/* End marker fill. */
|
2022-09-02 14:09:32 -05:00
|
|
|
node_draw_link_end_markers(link, draw_config, points, false);
|
2022-09-01 19:46:19 +02:00
|
|
|
}
|
|
|
|
|
|
2022-01-20 10:36:56 -06:00
|
|
|
} // namespace blender::ed::space_node
|
|
|
|
|
|
2020-02-08 01:02:18 +11:00
|
|
|
void ED_node_draw_snap(View2D *v2d, const float cent[2], float size, NodeBorder border, uint pos)
|
2012-06-29 14:34:46 +00:00
|
|
|
{
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINES, 4);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-29 14:34:46 +00:00
|
|
|
if (border & (NODE_LEFT | NODE_RIGHT)) {
|
2017-02-02 03:14:52 -02:00
|
|
|
immVertex2f(pos, cent[0], v2d->cur.ymin);
|
|
|
|
|
immVertex2f(pos, cent[0], v2d->cur.ymax);
|
2012-06-29 14:34:46 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2017-02-02 03:14:52 -02:00
|
|
|
immVertex2f(pos, cent[0], cent[1] - size);
|
|
|
|
|
immVertex2f(pos, cent[0], cent[1] + size);
|
2012-06-29 14:34:46 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-29 14:34:46 +00:00
|
|
|
if (border & (NODE_TOP | NODE_BOTTOM)) {
|
2017-02-02 03:14:52 -02:00
|
|
|
immVertex2f(pos, v2d->cur.xmin, cent[1]);
|
|
|
|
|
immVertex2f(pos, v2d->cur.xmax, cent[1]);
|
2012-06-29 14:34:46 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2017-02-02 03:14:52 -02:00
|
|
|
immVertex2f(pos, cent[0] - size, cent[1]);
|
|
|
|
|
immVertex2f(pos, cent[0] + size, cent[1]);
|
2012-06-29 14:34:46 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-02 03:14:52 -02:00
|
|
|
immEnd();
|
2012-06-29 14:34:46 +00:00
|
|
|
}
|