Commit Graph

125 Commits

Author SHA1 Message Date
Pratik Borhade
0ad79ca541 Fix #139170: Regression: The Linked Node Group Socket Name is Editable
This probably have occured after migration from UIList. When nodetree ID
is linked form another file, disable the layout for individual rows and
the add/remove operator. Also tweak `supports_renaming()` function so that
individual tree element cannot be renamed when linked.

Pull Request: https://projects.blender.org/blender/blender/pulls/139269
2025-05-23 12:19:41 +02:00
Falk David
a7d2b7850e Grease Pencil: Add initial support for Node Tools
This adds inital Grease Pencil support for node tools.

Node tools work in `Object Mode`, `Edit Mode`,`Sculpt Mode`,
and `Draw Mode`.

While Grease Pencil has many editing tools, including editing
multiple frames at the same time, for now, node tools only
allow editing the current frame.

Currently, the idea is that node tools can do arbitrary changes
to the drawings, but cannot do changes to the existing layer tree, e.g.
changing the order of layers, removing a layer or groups, etc.

All the node tool specific nodes like `Selection` and `Set Selection`
are adapted to work with Grease Pencil. In `Draw Mode`, we currently
interpret everything as selected.
The `Active Element` node has a `Layer` mode that provides the
index of the active layer (if there is one).

When `Auto-Key` is used, a new keyframe is created on the
current frame.
Locked/invisible layers cannot be edited with node tools.

Pull Request: https://projects.blender.org/blender/blender/pulls/136624
2025-05-05 10:41:21 +02:00
Hans Goudey
937358d58e Point Cloud: Enable object type without experimental option
In the past couple months, the basic operations needed for a new object
type were implemented, as well as basic edit mode tools. With that, the
object type is in a good enough state that it doesn't need to be hidden
behind an experimental option. That also resolves some inconsistency,
because the object type is already created by geometry nodes and used by
importers; it's weird that you can't add it manually as original data.

This also removes the "bounds" drawing flag for the object created from
the add menu. It's unnecessary now and there was even a TODO comment.

Pull Request: https://projects.blender.org/blender/blender/pulls/137546
2025-04-15 20:08:46 +02:00
quackarooni
5a5ad978bf Nodes: Make spacing for Panel Toggle properties consistent with that of Boolean sockets
Panel toggles have a subpanel for listing out properties associated with their
Boolean checkbox.

The vertical spacing for properties in this panel is slightly different to how
normal Boolean sockets list their properties. This patch makes it more
consistent by putting the properties after `Default` in a `column` sublayout.

Pull Request: https://projects.blender.org/blender/blender/pulls/137211
2025-04-10 09:46:37 +02:00
quackarooni
a345f86e33 Fix #137169: "Panel Toggle" poll errors if a panel's first child item is a panel
The poll function for `NODE_PT_node_tree_interface_panel_toggle` looks at the
first child item and checks if it has the `is_panel_toggle` property set to
`True`. This fails if the first child is a panel, which doesn't have that
property.

The fix is to simply fall back to returning False if the first child item does
not have the aforementioned property.

Pull Request: https://projects.blender.org/blender/blender/pulls/137171
2025-04-09 10:17:41 +02:00
Omar Emara
7c0c31efb0 Nodes: Enable panel toggles in the Compositor
This patch enables panel toggles in the compositor since it now supports
boolean sockets. This essentially reverts c3957f432a.
2025-03-24 10:20:39 +02:00
Campbell Barton
4177b75e7a Cleanup: quiet warnings from ruff, use static sets 2025-03-04 16:02:55 +11:00
Jacques Lucke
c3957f432a Fix: Nodes: only expose panel toggles in geometry and shader nodes
The compositor does not support boolean sockets currently.
2025-02-28 19:23:44 +01:00
Falk David
2822777f13 Nodes: support boolean inputs as toggles in panel headers
Adds the option to create a boolean socket that can be used as a panel toggle.
This allows creating simpler and more compact node group UIs when a panel
can be "disabled".

The toggle input is a normal input socket that is just drawn a bit differently in
the UI. Whether a boolean is a toggle input or not does not affect evaluation.

Also see #133936 for guides on how to add and remove panel toggles.

Pull Request: https://projects.blender.org/blender/blender/pulls/133936
2025-02-28 19:07:02 +01:00
Dalai Felinto
e7214cbd31 Fix: missed point_cloud for node tools and more aggressive renaming
The issue was introduced on 1584cd9aa5 (see !134911 for details).

This fixes this and rename the remaining point_cloud from the API.
The DNA is left untouched, so users don't need to re-enable the
experimental point cloud feature.

Pull Request: https://projects.blender.org/blender/blender/pulls/134927
2025-02-24 14:43:08 +01:00
Campbell Barton
c7804568e7 Cleanup: reference imported types in class definitions 2025-02-13 10:15:19 +11:00
Campbell Barton
84c9e6e655 Cleanup: use single quotes for enums 2025-01-21 23:50:17 +11:00
Omar Emara
e52bbae2bf Compositor: Only show precision for GPU device
The compositor precision option only matters for GPU device, so hide it
when in CPU mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/132680
2025-01-08 07:41:48 +01:00
Campbell Barton
444f1064c9 Cleanup: remove unused functions, imports 2025-01-04 21:09:41 +11:00
Jacques Lucke
ebfbc7757b Fix #128589: allow disabling node group interface UI for custom node tree types
This adds a new `bl_use_group_interface` property that can be set on custom node
group types. By default it is `true` to avoid this being a breaking change. If
it's set to `false` some UI elements related to the built-in node group
interface are hidden.

Pull Request: https://projects.blender.org/blender/blender/pulls/131877
2024-12-14 11:51:19 +01:00
Aras Pranckevicius
82f0578ca3 Compositor: always use the new CPU compositor
Part of #125968: this makes the new CPU compositor always be used.

Pull Request: https://projects.blender.org/blender/blender/pulls/131783
2024-12-12 20:17:36 +01:00
Habib Gahbiche
35ea495bb6 UI: Nodes: Remove some snapping options
Compositor: UI: remove snapping to nodes.

Snapping nodes to other nodes behaves in a very unpredictable way, which makes most snapping options useless.

The patch removes the following:
- Snapping options `Node X`, `Node Y` and `Node XY`
- Menu `Snap Node Element`
- Menu `Snap Target`

New behavior:
- Activating `Snap` always acts as 'Snap to Grid'

Part of https://projects.blender.org/blender/blender/issues/128612

Pull Request: https://projects.blender.org/blender/blender/pulls/127667
2024-11-24 14:30:22 +01:00
Campbell Barton
8960285921 Cleanup: remove BLENDER_EEVEE from Blender's panels 2024-10-30 13:20:01 +11:00
Campbell Barton
f81dcbb67e Cleanup: remove BLENDER_EEVEE checks
Since the engine has been removed there is no need to check for it.
2024-10-30 13:20:00 +11:00
Campbell Barton
e10b0b3449 Cleanup: remove unused EEVEE panels
Besides being unused, some contained errors and would not have worked
if used.
2024-10-30 13:19:59 +11:00
Pablo Vazquez
14208b6dfa UI: Compositor: Show Parent button when available
The Parent Node Tree operator button to go up a level in nested
node trees is always visible in the header, regardless if we are
currently in a nested tree or not.

Only show the button when it is actually possible to go a level up.
This frees up space in the header when at the top level.
2024-09-12 15:44:06 +02:00
Pablo Vazquez
3986b99e42 UI: Compositor: do not expand backdrop channels
To be consistent with other editors (Image Editor, Sequencer), and use
less space in the header.
2024-09-12 15:44:06 +02:00
Jacques Lucke
1ee6a8fad5 Geometry Nodes: support customizing warning propagation
Previously, all errors, warnings and info messages were propagated from the node
that generates it to the top level node group. This is a good default, but may
not always be desirable. For example, someone may build a node group asset that
generates some warning that is irrelevant to the user to the asset. Now, the
asset author can selectively disable propagating warnings from that node.

Each node has a new `Warning Propagation` setting. It controls if warnings from
this node should be propagated to the parent group node. By default, everything
is propagated. One can also choose to propagate nothing, only errors or only
errors and warnings.

Note, this does not affect whether the warning is shown in the node itself, only
if the warning is propagated one level up!
Pull Request: https://projects.blender.org/blender/blender/pulls/126786
2024-08-30 12:06:48 +02:00
Jacques Lucke
ab26dc5817 Nodes: add operator to get node width from parent
This operator sets the new default group node width (from e842966c5e) based on
the parent group node. This makes it easier to initialize the value. Without
this, one had to create and delete the group node potentially many times to find
a good default width.

Pull Request: https://projects.blender.org/blender/blender/pulls/126239
2024-08-15 17:54:56 +02:00
Jacques Lucke
e842966c5e Nodes: add group node default width
This adds the ability to customize the default width of a group node that's
created for a node group. This feature works towards the goal of unifying the
features available to built-in nodes and node groups. We often customize the
width of built-in nodes from them to looks slightly better (e.g. to avoid
cut-off labels).

Pull Request: https://projects.blender.org/blender/blender/pulls/126054
2024-08-11 19:25:53 +02:00
Omar Emara
f2fcbc3330 Cleanup: Format 2024-08-08 17:36:23 +03:00
Omar Emara
f40cf759c7 Compositor: Add experimental option for new CPU compositor
This patch introduces a new experimental option for the new CPU
compositor under development. This is to make development easier such
that it happens directly in main, but the compositor is not expected to
work and will probably crash.

Pull Request: https://projects.blender.org/blender/blender/pulls/125960
2024-08-08 15:40:06 +02:00
Campbell Barton
dc74a98b9e Cleanup: remove unused imports 2024-07-23 15:58:21 +10:00
Omar Emara
cbabe2d3ef Compositor: Remove Auto Render option
This patch removes the Auto Render option from the compositor. This is
done for the following reason:

- The option didn't really work except in the case of transforming an
  object. So it wasn't really reliable.
- It made little sense to use since the introduction of the Viewport
  Compositor.
- It had a number of UX issues, including the fact that it can't be used
  with animation playback, and the fact that rendering can get in the
  way of the UI depending on the preferences for temporary editors.

Pull Request: https://projects.blender.org/blender/blender/pulls/123132
2024-06-13 07:29:37 +02:00
Jacques Lucke
e2de34263a Nodes: don't show custom color panel for reroute nodes
This color is not used anywhere.
2024-06-05 11:00:22 +02:00
Leon Schittek
db5d410164 Node Editor: add overlay to automatically label reroute nodes
Add an overlay option to automatically display a label on reroute nodes.

This automatic label is propagated through chained reroute nodes and
is based on the explicit label of linked reroute nodes.

The automatic label is dimmed to distinguish it from manually set ones.

Pull Request: https://projects.blender.org/blender/blender/pulls/113368
2024-06-05 10:02:37 +02:00
Leon Schittek
b15dc90c9d Fix #119282: Enable edge-pan when duplicating nodes from menu
The commit that added this to the keymap (33d5ecd5b5) mentions not
hard-coding the edge-panning to be enabled. So this just enables the
edge-panning for the menu entries, as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/120324
2024-06-05 06:53:17 +02:00
Jacques Lucke
c49045ff53 Nodes: open node property panel by default
This makes it easier to find these properties which are more common
nowadays than they used to be. Especially in geometry nodes.
2024-06-04 19:06:26 +02:00
Sergey Sharybin
727a90a0f1 Compositor: Make GPU compositor an official feature
Effectively, make GPU compositor available without need to enable
an experimental feature set.

The compositor device is now exposed in the Performance panel of
Render Buttons. It is also still available in the compositor's
N-panel, together with some other options which are more about how
editing works, and not exactly related to render performance.

Pull Request: https://projects.blender.org/blender/blender/pulls/121398
2024-05-14 15:49:20 +02:00
Nika Kutsniashvili
ede675705e UI: Reorganize 'Select' menus in editors
Reorganizes (and in some cases add missing operators to) all 'Select'
menus in all editors except 3D Viewport (done in a separate patch).

The goal of this change is to make menus as consistent as possible, and
to group & sort items according to a certain logic, which should be easy to
remember and users can always expect certain items to be always at same
place in every editor.

More details and images in the pull request.

Pull Request: https://projects.blender.org/blender/blender/pulls/121337
2024-05-13 16:27:23 +02:00
Clément Foucault
d27cc47a74 Fix: EEVEE-Next: Missing panel in node editor
Fix #120627
2024-05-11 12:47:23 +02:00
Sergey Sharybin
7b4232e8aa Compositor: Move Execution Mode and Precision from bNodeTree to Scene
This allows to expose these settings in the Performance panel in the
render buttons. Also moves compositor-specific options away from the
generic node tree structure.

For the backwards-compatibility the options are still present in the
DNA for the bNodeTree. This is to minimize the impact on the Studio
which has used the GPU compositor for a while now. They can be
removed in a future release.

There is no functional changes expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/121583
2024-05-10 18:08:33 +02:00
Jeroen Bakker
f01e84e3a5 EEVEE-Next: Add operator to convert a world volume to mesh
EEVEE-Next world volume are infinite like Cycles. EEVEE-Classic world volumes
end at the clip_end of the camera/viewport. This can lead to confusion as
it would render different then expected.

This PR adds an operator to convert a world volume into a mesh volume. The
operator can be found in the shader editor (world mode) and in the properties
panel/World/Volume.

**Why an operator?**

As this alters the content of the scene we want the artist to be in control of
the conversion. Doing it automatic lead to a lot of complexity and cases that
might not be expected by the user.

Pull Request: https://projects.blender.org/blender/blender/pulls/119734
2024-05-10 12:42:17 +02:00
Jacques Lucke
f4b9ca758a Nodes: add color tag to node groups
This allows setting a color tag for node groups which affects the header
color of group nodes. With this, node groups can look even more similar
to built-in nodes. The only remaining difference is the node group icon in
the node header.

Blender has quite a few different built-in color tags. Most of those are
exposed with very few exceptions. For example, the layout, interface
and pattern categories are not exposed because they are only for built-in
nodes or are not used anymore.

It's generally agreed upon that the set of different color tags is likely too
large. Some differences between color make more sense in some contexts
than in others. In the interest of consistency, it was decided to expose all
these categories anyway. If we ever decide to consolidate them, the worst
that can happen is that a group looses it's category, which wouldn't be too bad.

Pull Request: https://projects.blender.org/blender/blender/pulls/121385
2024-05-08 22:00:35 +02:00
Jacques Lucke
125afb20d3 Nodes: reorganize node group properties UI
The initial motivation for this came from #121334, because now there
are two description inputs which look very alike and not's not obvious
at a glance where they belong to. Additionally, I find myself sometimes
looking for node properties in the group properties panel because of the same panel name.

This patch does the following changes to improve the situation:
* Reorder the node group properties and socket interface panel.
* Rename `Properties` panel to `Group` (similar to `Node` in the corresponding tab).
* Rename the `Interface` panel to `Group Sockets`.
* Add a `Name` field for the node group. This makes it even more obvious that
  one is looking at the group properties. Also it makes it possible to rename
  the group without having to go up one level to change the name in the group node.
* New layout-panel for the different usages. This only exists for geometry nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/121564
2024-05-08 18:03:49 +02:00
Sergey Sharybin
149e547de6 Compositor: Remove quality setting from DNA and UI
It was meant to be included into the previous commit in the area,
but was forgotten due to some technicalities.

Also remove the DisplaceSimpleOperation, which is now not used.

Pull Request: https://projects.blender.org/blender/blender/pulls/121580
2024-05-08 16:56:32 +02:00
Sergey Sharybin
6db8091f45 Compositor: Remove Two Pass option
There are few issues with the logic and implementation of this option:

- While the first pass is faster in the terms of a wall-clock time, it
  is often not giving usable results to artists, as the final look of
  the result is so much different from what it is expected to be.

- It is not supported by the GPU compositor.

- It is based on some static rules based on the node type, rather than
  on the apparent computational complexity.

The performance settings are planned to be moved to the RenderData, and
it is unideal to carry on such limited functionality to more places. There
are better approaches to quickly provide approximated results, which we can
look into later.

Pull Request: https://projects.blender.org/blender/blender/pulls/121558
2024-05-08 14:34:11 +02:00
Jacques Lucke
d740d6b942 Fix: node group description only available for geometry nodes 2024-05-08 11:42:00 +02:00
Jacques Lucke
6176e66636 Nodes: add node group description
This allows node groups to have a description that is shown in the add menu
or when hovering over the node header.

This new description is stored in `bNodeTree.description`. Unfortunately, it
conflicts a bit with `ID.asset_data.description`. The difference is that the latter
only exists for assets. However, it makes sense for node groups to have
descriptions even if they are not assets (just like `static` functions in C++ should
also be able to have comments). In some cases, node groups are also generated
by addons for a specific purpose. Those should still have a description without
being reusable to make it easier to understand for users.

The solution here is to use the asset description if the node group is an asset,
and to use `bNodeTree.description` otherwise. The description is synced
automatically when marking or clearing assets.

A side benefit of this solution is that appended node group assets can keep their
description, which is currently always lost.

Pull Request: https://projects.blender.org/blender/blender/pulls/121334
2024-05-08 11:25:00 +02:00
Jacques Lucke
176c6ef329 Geometry Nodes: unify menu switch with other nodes with dynamic sockets
This changes the menu switch socket to use the socket-items system
(`NOD_socket_items.hh`) that is already used by the simulation zone, repeat
zone, bake node and index switch node. By using this system, the per-node
boilerplate can be removed significantly. This is especially important as we
plan to have dynamic socket amounts in more nodes in the future.

There are some user visible changes which make the node more consistent with
others:
* Move the menu items list into the properties panel as in 0c585a1b8a.
* Add an extend socket.
* Duplicating a menu item keeps the name of the old one.

There is also a (backward compatible) change in the Python API: It's now
possible to directly access `node.enum_items` and `node.active_index` instead of
having to use `node.enum_definition.enum_items`. This is consistent with the
other nodes. For backward compatibility, `node.enum_definition` still exists,
but simply returns the node itself.

Many API functions from `NodeEnumDefinition` like
`NodeEnumDefinition::remove_item` have been removed. Those are not used anymore
and are unnecessary boilerplate. If ever necessary, they can be implemented back
in terms of the socket-items system.

The socket-items system had to be extended a little bit to support the case for
the menu switch node where each socket item has a name but no type. Previously,
there was the case without name and type in the index switch node, and the case
with both in the bake node and zones. The system was trivial to extend to this
case.

Pull Request: https://projects.blender.org/blender/blender/pulls/121234
2024-04-30 10:19:32 +02:00
Jacques Lucke
0c585a1b8a Geometry Nodes: move socket items ui and operators from Python to C++
This has some benefits:
* Nodes with dynamic socket amounts can remain more self-contained
  (2 fewer files to edit with this patch).
* It's easier to reuse existing C++ code, reducing redundancy.

One new thing I'm doing here is to define operators in node files. It seems
reasonable to register operators that belong to a node together with that
node. Without this, code spreads out further than necessary without any real benefit.

This patch affects the simulation zone, repeat zone, bake node and index switch node.

The UI is slightly affected too. Since we had the UI defined in Python before,
it wasn't possible to integrate it into the node properties panel. That is possible
now and looks better anyway. The previous UI was an artifact of technical limitations.

Pull Request: https://projects.blender.org/blender/blender/pulls/121178
2024-04-29 19:50:11 +02:00
Campbell Barton
0e3b594edb Refactor: scripts under scripts/startup/ to use str.format
Part of modernizing scripts in Blender, where the previous convention
was to use percentage formatting which has become the "old" way to
format strings in Python.

See proposal for details #120453.

Ref !120552
2024-04-27 16:02:36 +10:00
Hans Goudey
ce224fe401 Node Tools: Add mouse position node, wait for cursor option
Add a "Mouse Position" node that outputs the location of the mouse
cursor in region space and the overall size of the region, both in pixel
units. Both outputs are integers to help reflect their pixel units.
If there the mouse position is ever accessible in sub-pixels, they can
easily be changed to floats.

Also add a "Wait for Cursor" option similar to the one for some built-in
operators that delay's the operator's execution until there is a mouse
click in the viewport. That way the operator can be called from menus
even though it is interactive. This option is placed in the node editor
header. When there are more options, it will be part of an "Options"
popover panel similar to the existing "Modes" and "types" popovers.

Combined with the viewport transform node, and other nodes like Raycast,
these features can allow making tools that create geometry where you
click in the scene.

Pull Request: https://projects.blender.org/blender/blender/pulls/121043
2024-04-26 20:14:25 +02:00
Campbell Barton
cf1ab3ec6e Cleanup: consistent quotes in Python 2024-03-14 10:38:45 +11:00
Campbell Barton
4f8db2ee67 Cleanup: use static sets for contains checks, remove f-string use 2024-02-28 11:02:49 +11:00