Commit Graph

507 Commits

Author SHA1 Message Date
Jacques Lucke
5c325c394a Fix #145007: don't show empty tooltip popups 2025-08-25 13:10:13 +02:00
Nika Kutsniashvili
15567f597d UI: Remove unused theme properties
There are many accumulated unused properties in theme. Generally, it's a mess,
lot of copy-paste errors and leftovers between editors, shared functions with no
actual use, etc. Some were just added and never used, like Pattern and Layout nodes,
which were meant to be used with Texture Nodes I believe, but it never happened.

Overall 19 properties removed:

- 3D Viewport: Edge UV Face Select
- 3D Viewport: Last Selected Point

- Dope Sheet/Timeline: Value Sliders
- Dope Sheet/Timeline: View Sliders
- Nonlinear Animation: View Sliders
- Video Sequencer: Window Sliders
- Graph Editor/Drivers: Window Sliders

- Graph Editor/Drivers: Vertex Bevel
- Graph Editor/Drivers: Vertex Group Unreferenced
- Image/UV Editor: Vertex Bevel
- Image/UV Editor: Vertex Group Unreferenced

- Image/UV Editor: Freestyle Face Mask
- Image/UV Editor: Face Retopology
- Image/UV Editor: Face Orientation Front
- Image/UV Editor: Face Orientation Back

- Node Editors: Selected Text
- Node Editors: Pattern Node
- Node Editors: Layout Node

- Video Sequencer: Draw Action

---

Details:
- Made Vertex Bevel and Vertex Group Unreferenced colors in `rna_def_userdef_theme_spaces_vertex`
optional, so that they don't appear in Graph Editor and UV Editor theme properties, where they're unused.
- Same thing in `rna_def_userdef_theme_spaces_face` for face attributes (Freestyle Mark, Retopology),
so that they don't appear in UV Editor, where they're unused. Also did same for face orientation colors,
but used different argument for them, since they could be used in future (remember seeing PR for this).

Pull Request: https://projects.blender.org/blender/blender/pulls/143782
2025-08-17 15:39:39 +02:00
Hans Goudey
23ad91ce53 Nodes: Change collapsed node shape
This PR changes the collapsed node socket shape to remove the "pill"
shape, so that the input and output sockets are stacked vertically
instead of around semi-circles.

The main motivation is to improve the look with single value sockets,
where the combination of their vertical shape and the rounded pill shape
of the node looked quite bad.

Regardless of that though, I'd argue this makes the smaller collapsed
nodes look much nicer: more consistent with other nodes and even a bit
smaller. For larger collapsed nodes, at least it gets rid of the
"gigantic circle" shape.

There is still some overlap with stacked single-value sockets. That's
a compromise to keep the node small (half the distance between sockets
as regular nodes), but it could be tweaked.

Pull Request: https://projects.blender.org/blender/blender/pulls/144028
2025-08-07 14:37:21 +02:00
Omar Emara
d84d779661 Compositor: Improve unsupported passes warning
This patch improves warnings displayed when the user attempts to use
passes in render engines other than EEVEE with the viewport compositor.

Previously, an error icon was always displayed if the viewport
compositor was in use as well as a viewport overlay text. This error
existed even when the render engine was set to EEVEE and even if the
passes are not actually used, which was always confusing for users.

This patch improves this by only displaying the error when a pass is
actually used and when a non-EEVEE render engine is used.

This is implemented internally as an extra info callback for the node.
And the compositor_unsupported_message member hack was removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/144005
2025-08-07 12:18:06 +02:00
Jacques Lucke
b9b71dbb71 Refactor: Nodes: slightly generalize drawing node errors
The goal here is it to make it more obvious how error messages for
shader nodes should be added. Nowever there is a more explicit
block for compositer and geometry nodes.
2025-08-05 06:24:52 +02:00
Jacques Lucke
252b983c0c Geometry Nodes: change idnames of experimental bundle and closure nodes
This removes the "Geometry" part from their name because we want to use them in
other node tree types too (see #141936).

Usually, we don't change idnames because they are the primary identifier of
nodes and is expected to stay the same. Since they are generally not shown to
users (just Python developers), it's also not urgent to change them. However, in
this specific case we have the opportunity to update the idname before the node
becomes an official feature, so it's not as bad to change it.

This patch has full backward compatibility, but no forward compatibility (for
files that used the experimental feature).

Pull Request: https://projects.blender.org/blender/blender/pulls/143823
2025-08-02 10:17:39 +02:00
Jacques Lucke
1260e90b4c Refactor: Geometry Nodes: simplify detection of syncable nodes
This moves most of the code to deal with syncable nodes (such as
Combine/Separate Bundle) to the nodes module. Over time it might be possible to
decentralize it more.

This also changes the caching mechanism from storing a flag on the node to
storing a map on the node editor runtime data. This simplifies the code quite
significantly and also removes the need to store any of this data in DNA.

The node tree update code now always clears this cache because before it was
missing many cases, e.g. when creating links that would connect a Combine to a
Separate Bundle node.

Pull Request: https://projects.blender.org/blender/blender/pulls/143661
2025-07-30 20:42:20 +02:00
Jacques Lucke
21ca4584b6 Geometry Nodes: show sync button on bundle and closure nodes if syncing is possible
This shows a sync button when Geometry Nodes has detected that
syncing is possible and might be necessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/140967
2025-07-30 18:51:14 +02:00
Campbell Barton
649b89781e Cleanup: ensure UTF8 string copy for DNA & screen data
Use `BLI_strncpy_utf8` & `BLI_snprintf_utf8` for fixed size buffers in
DNA and screen data structures such as panels, menus & operators.

This could be considered a fix as copying a UTF8 string into a smaller
buffer without proper truncation can create an invalid UTF8 sequence.
However identifying which of these users are likely to run into would
be time consuming and not especially useful.
2025-07-26 12:33:15 +00:00
Jacques Lucke
70b956ba53 Fix: Nodes: memory leak in extra info tooltips
The issue was that the tooltip function arguments were sometimes allocated but
not freed. The solution is to handle the lifetime of the argument better. The
code now makes a copy of the argument when it's passed to a layout function. In
an idea world, one could just use something like `std::function` instead of
manual memory management, but the API does not support it yet.

This was caused by f3a1d8fad5.

Pull Request: https://projects.blender.org/blender/blender/pulls/143043
2025-07-24 10:35:47 +02:00
Campbell Barton
f256e7141a Cleanup: use '*' prefixed multi-line comment blocks 2025-07-24 10:48:04 +10:00
Leon Schittek
6a10812fb6 UI: Improve consistency of node socket symbols
Several changes to make node socket symbols more consistent across
the UI:
* Explicitly use the node editor's theme when looking up the outline
  color for node sockets so they are consistent across editors.
* Use the proper socket drawing function in `widget_nodesocket`,
  rather than relying on the "widget base" shader to draw a colored
  circle
* `uiTemplateNodesocket` now also works in non-embossed layouts.

Pull Request: https://projects.blender.org/blender/blender/pulls/136612
2025-07-22 23:43:22 +02:00
Brecht Van Lommel
902f1ebf89 Revert "Cleanup: Compiler warning about unused ntree with node socket tooltips"
This reverts commit f7ae14cd6a. The warning got
fixed another way before I pushed this change.
2025-07-22 16:22:26 +02:00
Brecht Van Lommel
f7ae14cd6a Cleanup: Compiler warning about unused ntree with node socket tooltips 2025-07-22 15:54:29 +02:00
Guillermo Venegas
230813f2ab Cleanup: UI: Remove redundant namespace prefixes
A follow-up from recent UI refactors.

Pull Request: https://projects.blender.org/blender/blender/pulls/141920
2025-07-21 15:08:12 +02:00
Guillermo Venegas
9c98ea1a18 Refactor: UI: Make button type params typed enums
This converts `eButType` and `eButPointerType` as typed enums.

This improves a bit `uiDefBut` self-documentation by taking an
struct with `ButType` and `ButPointerType` types, instead of
using a single `int` to write both enum types and bit index.

Almost all other `uiDefBut*` functions take just a `ButType`
parameter now.

`uiDefButI` for example is equivalent to:
`uiDefBut({ButType(type), ButPointerType::Int},...);`

Pull Request: https://projects.blender.org/blender/blender/pulls/142132
2025-07-18 13:12:16 +02:00
Jacques Lucke
c1f4b6e9d8 Nodes: Python: show idname in node tooltip
Currently, it's hard to figure out the idname of a node when just looking at it
in the node editor. while most users don't need this information, it's very
useful for Python developers.

This patch adds the node idname to the tooltip that shows up when hovering over
the node header. It only shows if "Python Tooltips" is enabled in the
preferences.

This also fixes a bug where the dynamic node description wouldn't show when the
node is collapsed.

Pull Request: https://projects.blender.org/blender/blender/pulls/142178
2025-07-18 06:19:18 +02:00
Jacques Lucke
f2ee95843c Nodes: improve socket tooltips
The main goal of the patch is to make the socket tooltips more useful. This is
achieved in two ways:
* Use better text formatting in the tooltip to make it easier to parse and to
  better separate the current actual value from more general information about
  the socket.
* Add some more information like implicit field inputs when the node is not used
  currently or more details about a color.

This patch basically rewrites the entire tooltip generation, because it's quite
different from before (where we just created a single string for the entire
tooltip).

I'm using monospace for the actual current socket value and type, while the
normal font is used for general information about the socket like it's name,
description, allowed geometry types etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/140540
2025-07-17 12:48:17 +02:00
Jacques Lucke
55e2fd2929 Cleanup: unify naming for named constructors
Previously, we used an inconsistent naming scheme for such "named constructors".
Now it always uses `from_*`.

Pull Request: https://projects.blender.org/blender/blender/pulls/142175
2025-07-17 09:09:16 +02:00
Campbell Barton
e8e188cb7d Cleanup: various non-functional changes for C++ 2025-07-17 12:32:30 +10:00
Guillermo Venegas
1a247fbaa8 Refactor: WM: Make OperatorCallContext an enum class, move to namespace
This allows forward declaring `OpCallContext`, avoiding the
transitive include `WM_Types.hh` in `UI_interface_layout.hh`

Pull Request: https://projects.blender.org/blender/blender/pulls/141804
2025-07-15 03:08:04 +02:00
Jacques Lucke
00c81f5113 Merge branch 'blender-v4.5-release' 2025-07-14 16:30:38 +02:00
Jacques Lucke
1f2f9aef51 Fix #141800: crash when showing node warnings during playback
The node warnings were only referenced by the tooltip function. Since they are
recreated on every evaluation, this resulted in a use-after-free. The fix is to
just copy the node warnings into the callback.

Of course this extra copy does have some performance implications, but I don't
think those are significant currently.

Pull Request: https://projects.blender.org/blender/blender/pulls/141875
2025-07-14 16:28:39 +02:00
Guillermo Venegas
5cc4b4322a Refactor: UI: Move UI_block_layout_resolve to C++ namespace, rename
This renames UI_block_layout API as blender::ui::block_layout_resolve,
following uiLayout refactors.

This simplifies usage by returning block layout size as C++ int2 instead
of using return parameters, in fact some places were providing
unused variables.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/141432
2025-07-08 21:16:57 +02:00
Bastien Montagne
a345b83f1a Merge branch 'blender-v4.5-release' 2025-07-07 15:53:53 +02:00
Damien Picard
23b217662e I18n: Translate some node socket tooltips
Node socket tooltips can include substrings from many different
sources. This commit adds two that were previously untranslated:
- hardcoded strings that simply need to be manually translated using
  `TIP_()`,
- the socket name, which should use its context. This simply copies
  the translation code from the socket name label.

Reported by Gabriel Gazzán in #43295.
2025-07-07 12:02:25 +02:00
Harley Acheson
a60ec16858 Fix #141225: Hide Right Node Editor Scrollbars When Sidebar Visible
For Node Editors do not show right-side scrollbars if region overlap
and there is a right-aligned region open, to avoid two scrollbars.

Pull Request: https://projects.blender.org/blender/blender/pulls/141418
2025-07-04 19:50:44 +02:00
Guillermo Venegas
b36e5b4b06 Refactor: UI: Replace UI_block_layout with blender::ui::block_layout
This renames `UI_block_layout` API as `blender::ui::block_layout`,
following uiLayout refactors.
This function now returns a layout reference instead of pointer,
this changes applies this return type where the layout can be used
as such reference.

Changes includes the use of `blender::ui::LayoutDirection` and
`blender::ui::LayoutType` as typed enum parameters.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/141401
2025-07-03 22:00:46 +02:00
Habib Gahbiche
7f668be362 Nodes: rename "Hide" to "Collapse"
Design task: https://projects.blender.org/blender/blender/issues/139158

Renaming includes:
- UI description
- Python operator description
- Code (Enums, function names and variables)

Unchanged:
- Python API
  - `bpy.ops.node.hide_toggle()`
  - `node.hide`
- Python operators / scripts

The reasoning is that improved naming is not enough reason to break
backward compatibility for Python API.

Pull Request: https://projects.blender.org/blender/blender/pulls/141038
2025-06-30 15:28:19 +02:00
Guillermo Venegas
091db9d52b Cleanup: UI: Use UI_interface_layout.hh instead of UI_interface.hh
This removes the include `UI_interface_layout.hh` from
`UI_interface_c.hh`, and in many places this swaps the include
from `UI_interface.hh` to `UI_interface_layout.hh`.

Also, cleanups some `UI_interface.hh` includes with
`UI_interface_icons.hh` or `UI_interface_types.hh`
2025-06-20 18:07:47 +02:00
Guillermo Venegas
96dee123d1 Refactor: UI: Add uiLayout aligment methods
This replaces uiLayout aligment API with uiLayout methods,
following uiLayout refactors and the Python API naming.

Also this converts the layout aligment enum to a fixed enum class.

Pull Request: https://projects.blender.org/blender/blender/pulls/140622
2025-06-19 02:57:37 +02:00
Habib Gahbiche
d88d4cc8ce Compositor: remove "Use Nodes"
Part of simplifying the compositor workflow:
https://projects.blender.org/blender/blender/issues/134214

The option "Use Nodes" is removed from the UI and marked deprecated.
It will get fully removed in 6.0.

"Use Nodes" is effectively replaced by the existing "Compositing"
option in the post-processing panel

Pull Request: https://projects.blender.org/blender/blender/pulls/138560
2025-06-18 18:39:02 +02:00
Guillermo Venegas
aa1dcddb3d Refactor: UI: Add uiLayout context_store methods
This replaces uiLayout context_store API with uiLayout methods,
following uiLayout refactors, following the Python API naming.

Pull Request: https://projects.blender.org/blender/blender/pulls/140566
2025-06-18 06:32:40 +02:00
Pablo Vazquez
2ea3cd2188 UI: Theme: Make nodes use the exact theme color
Make node headers (or body when collapsed) use the exact theme color
set for that node type, instead of a hardcoded blend between it and the
node backdrop.

This can result in unreadable combinations, but allows more
flexibility and it is consistent with the rest of Blender.

Both dark and light theme defaults have been updated.

See PR for details and screenshots.

Pull Request: https://projects.blender.org/blender/blender/pulls/140481
2025-06-16 18:34:29 +02:00
Jacques Lucke
323e1432e7 Merge branch 'blender-v4.5-release' 2025-06-13 10:17:46 +02:00
Jacques Lucke
d21d7702ca Fix #140289: only show link warnings when link is visible 2025-06-13 10:17:19 +02:00
Hans Goudey
14a42c0928 Cleanup: Use C++ vector types for convex hull API
Pull Request: https://projects.blender.org/blender/blender/pulls/140233
2025-06-11 22:46:27 +02:00
Guillermo Venegas
ff9c883154 Refactor: UI: Add uiLayout active get and set methods
This replaces API for accessing the uiLayout active state
with methods, following uiLayout refactors and the Python
API naming.

Part of #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/139963
2025-06-10 19:12:00 +02:00
Habib Gahbiche
bd61e69be5 Compositor: make compositor node trees reusable
This is part of the short term roadmap goal of simplifying the
compositor workflow
(see https://projects.blender.org/blender/blender/issues/134214).
The problem is that many users don't know how to get started with
compositing in Blender, even when they have used Blender for other
areas, e.g. modeling.

Note: although the solution makes compositor node trees reusable
accross blend files, this is a nice side effect and not the main goal
of the PR.

This PR implements a "New" button that creates a new compositing node
tree, and manages trees as IDs. This has following advantages:
- Consistent with other node editors and other parts of Blender,
therefore making it easier to getting started with compositing if users
are familiar with shading or geometry nodes
- Give users the ability to reuse the compositing node tree by linking
or appending it.

Note: The parameter "Use Nodes" is still present in this PR, but will
be removed (in a backward compatible way) in a follow up PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/135223
2025-06-10 17:46:55 +02:00
Clément Foucault
e57359726f GPU: VertexFormat: Use new data types
This prevents the use of unaligned data types in
vertex formats. These formats are not supported on many
platform.

This simplify the `GPUVertexFormat` class a lot as
we do not need packing shenanigans anymore and just
compute the vertex stride.

The old enums are kept for progressive porting of the
backends and user code.

This will break compatibility with python addons.

TODO:
- [x] Deprecation warning for PyGPU (4.5)
  - [x] Deprecate matrix attributes
- [x] Error handling for PyGPU (5.0)
- [x] Backends
  - [x] Metal
  - [x] OpenGL
  - [x] Vulkan

Pull Request: https://projects.blender.org/blender/blender/pulls/138846
2025-06-10 17:20:45 +02:00
Hans Goudey
77b14f2dcb Cleanup: Grammar: Fallback vs. fall back
The former is a noun or adjective, the latter is a verb.
2025-06-02 17:13:56 -04:00
Jacques Lucke
f3a1d8fad5 Refactor: Nodes: precompute node extra info rows
Previously, the extra info rows were computed twice per node on each redraw.
Now, they are only computed once.

Pull Request: https://projects.blender.org/blender/blender/pulls/139708
2025-06-02 13:50:49 +02:00
Jason C. Wenger
321e49a643 Nodes: make frame bounding box account for extra rows data
Previously, extra rows nodes did not properly apply margin to the frames which contain them.

Pull Request: https://projects.blender.org/blender/blender/pulls/139564
2025-05-30 10:29:00 +02:00
Hans Goudey
b80f1f5322 Geometry Nodes: Socket structure type and display changes
Implementation of #127106.
This is just a visual representation of the field/single/grid
status of sockets to make the workflow more intuitive. With
a visual representation for volume grid sockets, volume features
should be unblocked for further development. The structure type
will also be used to distinguish list sockets in the interface.

Group input nodes now have a "Structure Type" option instead of
the existing "Single Value Only". Usually the auto option should be
enough, but in some cases where the inferencing cannot (yet) make
a clear determination, it can be helpful to choose a specific type.

The new visualization and the group input structure type option
are hidden behind a new experimental option for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/134811
2025-05-28 02:33:47 +02:00
Jacques Lucke
6f83928c6b Refactor: Geometry Nodes: extract warning type to separate file
It should be possible to use this type without having to include the
entire logging system.
2025-05-27 05:50:44 +02:00
Jacques Lucke
024f8a9595 Fix #139388: Nodes: Frame node with text has wrong margins and line breaks
This was caused by an oversight in ae5b83e4ef.
It first removed the `aspect` and then brought it back later on, but forgot
to use it in all cases.
2025-05-26 06:01:53 +02:00
Jacques Lucke
680e53fcee Cleanup: Geometry Nodes: rename GeoModifierLog to GeoNodesLog
Nowadays, Geometry Nodes is not only evaluated by a modifier, but also by an
operator and in the future potentially by brushes. Therefore, the old name was
misleading because it sounded like it was specific to the modifier.

Pull Request: https://projects.blender.org/blender/blender/pulls/139378
2025-05-24 10:39:36 +02:00
Jacques Lucke
1307137f27 Nodes: clarify socket visibility methods
Node sockets have many different aspects that affect their visibility and
whether they are grayed out. This patch cleans up the methods used to check if
sockets are visible and adds descriptions that should make it more obvious which
ones should be used.

This also fixes a few places where the wrong method was used which is more
obvious now.

Pull Request: https://projects.blender.org/blender/blender/pulls/139251
2025-05-23 06:10:03 +02:00
Damien Picard
9ce0a2d1d5 I18n: Add translation contexts to node panels
Node UIs can now have panels. Some of those may need to have their
labels translated using translation contexts. PanelDeclarations
already had a translation_context member, this commit adds a way to
specify this context, and to use it for translation on drawing the
node.

Pull Request: https://projects.blender.org/blender/blender/pulls/139124
2025-05-21 13:54:11 +02:00
Omar Emara
c9dc4a0f69 Fix: Crash when all inputs inside panel are unavailable
Blender crashes when a node has a panel whose children input sockets are
all unavailable. This happens when marking sockets as collapsed, where
the non-initialized header_center_y members of such panels are accessed,
causing asserts or crashes.

The update_collapsed_sockets_recursive function has a check that should
avoid such accesses, but it seems wrong due to the negation of the
visibility check.

To fix this, we move the visibility check to a guard condition in the
marking function instead, and simplify the collapsed check in the update
function.

Pull Request: https://projects.blender.org/blender/blender/pulls/139104
2025-05-20 08:26:36 +02:00