Commit Graph

3115 Commits

Author SHA1 Message Date
Jacques Lucke
18600e430c Geometry Nodes: show correct type in menu socket tooltips
Previously, menu sockets were sometimes shown as integers or strings
in socket tooltips. Now, they are always shown as "Menu" type. This also
changes how these values are logged. Previously, they were logged as
strings. Now, only the integer identifier is logged and the name is looked
up when drawing the tooltip.

Pull Request: https://projects.blender.org/blender/blender/pulls/121236
2024-05-05 09:30:02 +02:00
Campbell Barton
9918488bb1 Cleanup: use uppercase tags, following own style guide 2024-05-03 11:33:21 +10:00
Bastien Montagne
ec350a6115 BKE ID copy: Pass new owner ID when possible.
Advanced ID copying code can now take a `new_owner_id` ID pointer parameter,
and use it to set the relevant 'loopback' pointer to its owner ID by the
copy code itself.

Besides avoiding the need for all code copying embedded IDs to set the
loopback pointer themselves, this also means that `lib_id` copying code
itself does not need to use `IDWALK_IGNORE_MISSING_OWNER_ID` anymore.

This change is not expected to have any effect in current codebase.
2024-05-02 17:17:04 +02:00
Campbell Barton
f6b7464b4c Cleanup: spelling in comments 2024-05-02 16:44:10 +10:00
Jacques Lucke
5bc949b4a7 Fix: avoid tagging file as modified when clicking in node editor 2024-05-02 01:43:45 +02:00
Pratik Borhade
3c336c82cc Fix #121248: Crash executing node tool operator without active node
Calling `NODE_OT_select_same_type_step` when no node is active triggers
the crash.

Pull Request: https://projects.blender.org/blender/blender/pulls/121252
2024-05-01 14:48:12 +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
4ec93f73a5 Cleanup: spelling in comments 2024-04-29 09:09:44 +10:00
Bastien Montagne
e5a921ad9b Fix #120103: Copy/Paste of nodes is not handling ID references properly.
This commit fixes several critical issues with previous code:
* It only covered a (very small) subset of potential ID references in a
  node (namely, just the `bNode::id` pointer).
* It completely ignored linked data case.
* It would modify ID pointers in the clipboard itself.

The new code stores ID reference info in a separate mapping. It uses the
new 'sub-data' foreach_id feature from `BKE_lib_query` to reliably and
generically process all ID pointers of a node.

The paste handling of ID pointers is split in two steps:
* All knowns ID references are searched for in current Main data-base,
  and the result (current valid ID pointer or null if not found) is
  stored temporarily in the ID references mapping.
* Once a node has been duplicated from the clipboard into the paste
  destination nodetree, its ID pointers are updated accordingly.

This allows to keep the 'reference ID' data in the clipboard always
valid, regardless of which IDs are currently existing in Main (i.e. to
keep all available data, even when opening new blendfiles, or doing
undo/redo that would affect the existing IDs).

Pull Request: https://projects.blender.org/blender/blender/pulls/121122
2024-04-28 18:59:42 +02:00
Campbell Barton
c0def6c93d Cleanup: spelling in comments 2024-04-27 11:58:02 +10:00
Guillermo Venegas
615100acda IO: Use FileHandler in Node Editors
Use `FileHandlers` to handle file drag-n-drop in Node Editors. Drop-boxes
still remain since they handle Images ID drag-n-drop.

This also allows to open/drag-n-drop multiple files at once.

Also this will allow add-ons to also support drag-n-drop for images and
movies in node editors while still providing access to Blender's native
support since File Handlers let users choose which to invoke if there's
multiple configured.

Pull Request: https://projects.blender.org/blender/blender/pulls/121051
2024-04-26 16:40:16 +02:00
Bartosz Kosiorek
749433f20b UI: Add tooltips with node description to node titles
These were already displayed in the node add menu. But it can also be
useful to see node descriptions when opening existing projects.

Pull Request: https://projects.blender.org/blender/blender/pulls/119705
2024-04-26 16:29:46 +02:00
Iliya Katueshenock
fa66b52d0a Nodes: tooltips for value of dangling reroute node
Dangling reroute nodes have no source of value. For that reason, such reroute nodes
are ignored by geometry nodes. Other node systems still have to handle this case
more explicitly. To users this behavior generally makes sense, but it's also not completely
obvious. Now, there is a new tooltip when hovering over dangling reroute nodes that
mentions how those work.

Pull Request: https://projects.blender.org/blender/blender/pulls/120851
2024-04-25 10:48:06 +02:00
Iliya Katueshenock
8e830a95de Nodes: Add default socket value to tooltip of socket
Even if node is not used, socket value is still there.
This value can be placed in tooltip instead of evaluated one.

Pull Request: https://projects.blender.org/blender/blender/pulls/120497
2024-04-24 17:03:55 +02:00
Brecht Van Lommel
15b9ae5436 Refactor: Use typed functions for blend file data reading
This makes the read and write API functions match more closely, and adds
asserts to check that the data size is as expected.

There are still a few places remaining that use BLO_read_data_address
and similar generic functions, these should eventually be replaced as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/120994
2024-04-24 17:01:22 +02:00
Iliya Katueshenock
ed9921185a Geometry Nodes: more detailed socket tooltips for multi-input sockets
Tooltip for multi-input socket. This kind of inspection can help to
see what data are passed into a node. Any invalid, muted or dangling
link will not be taken into account. This feature reuse the already
existing tooltip formatting and just add column indentation in multi-line case.

Pull Request: https://projects.blender.org/blender/blender/pulls/104468
2024-04-22 19:48:57 +02:00
Omar Emara
757da9dbc1 Cleanup: Remove redundant compositor arguments
The compositor execute functions have a `rendering` argument to specify
if the compositor is executing as part of the render pipeline. But the
render context argument is null if we are not rendering, so the
`rendering` arguement is redundant and can be removed.

Additionally, we no longer use use_file_output as a hack to detect
rendering.

Pull Request: https://projects.blender.org/blender/blender/pulls/120659
2024-04-16 09:11:39 +02:00
Damien Picard
abc0bf814f UI: Fix and improve a few messages
- "Log Encoding with Chroma inset and rotation": add "of primaries" in
  the description of the AgX Log color space to better explain the
  operation, based on wording in !106355.
- Remove a few double spaces.
- Make Line Art title case everywhere, to convey it's the system /
  brand / product name and not the generic concept.
- "Copy Absolute coordinates or Normal vector" -> "of Normal Vector":
typo.
- "Makes a link between selected output in input sockets" ->
  "Make...", "output and input": typo.
- "Purge Unused Data From This File" -> "from this": title case as per
  HIGs.
- GPencil -> Grease Pencil: no reason to use an abbreviation here.
- "Around Current Frame" -> "Around Frame": actual name of the
  onion-skinning method.
- "... (layer height for layer tool, i.e.)" -> "(i.e. the layer height
  for the layer tool)": put "i.e." at the start of the sentence.
- Expand description of toe-in stereo camera option.
- "Children collections their parent-collection-specific settings" ->
  "Children collections with their...": typo.
- "Generate vertex weights base on..." -> "based on" : typo, lower
  case.
- Expand description of GP modifier properties, based on their mesh
  counterparts.
- "AEnvelope" -> "Envelope": typo.
- "Falloff type the feather" -> "of the feather": typo.
- "usually make transition as long as effect strip": rephrase.
- "When disabled a users extensions directory is created" -> "a
  user's": typo.
- "successfull" -> "successful": typo.
- "Remove all attributes... a single wildcard (*).": remove trailing
  ".".
- "..., use "Save Preferences."": remove trailing ".".

Some issues reported by Marina Veselkova and Tamar Mebonia.

Pull Request: https://projects.blender.org/blender/blender/pulls/120649
2024-04-15 20:02:38 +02:00
Hans Goudey
c91449836a Cleanup: Move BKE_workspace.h to C++ 2024-04-12 17:03:18 -04:00
Iliya Katueshenock
0bd6279504 Nodes: Display node label for tooltips on a free reroute
It is not so informative to display `Input` (name of input socket)
tooltip for free reroute node. Instead, use label for this.

Pull Request: https://projects.blender.org/blender/blender/pulls/120534
2024-04-11 19:16:07 +02:00
Iliya Katueshenock
9f89cc5072 Refactor: Nodes: Generate socket tooltips in more generic way
Split code to separate functions depending on the source of info for
socket inspection. Each function retrieves some optional string.
Collecting of result string is just loop.

Pull Request: https://projects.blender.org/blender/blender/pulls/120496
2024-04-11 17:52:59 +02:00
Jacques Lucke
9a78d523b0 Fix: matrices were printed in transposed order in some tooltips 2024-04-11 17:27:24 +02:00
Iliya Katueshenock
4049309071 Fix: Geometry Nodes: GP3 component in tooltip without experimental option ON
Do not display this GP component in tooltip for some nodes which is support this.

Pull Request: https://projects.blender.org/blender/blender/pulls/120525
2024-04-11 15:21:04 +02:00
Iliya Katueshenock
a03c3d16d8 Fix: Ensure null terminator for TIP_ string
Make sure TIP_ function will be called for string with null terminator.

Pull Request: https://projects.blender.org/blender/blender/pulls/120524
2024-04-11 14:59:57 +02:00
Iliya Katueshenock
de6834e5c2 Cleanup: Unused argument
`ntree` is unused after 3357658c13

Pull Request: https://projects.blender.org/blender/blender/pulls/120495
2024-04-11 00:36:31 +02:00
Iliya Katueshenock
3357658c13 Cleanup: Nodes: Remove unnecessary socket tooltip check
There is no context in which socket can't have data to display in tooltip.
The most basic info is the name of the socket. Such tooltip can be even
for output Shader socket. If is there, socket tooltip can be built from
data of socket declaration. Description, constraints and so. Such as supported
components. At point socket was used in evaluation on CPU, there is value
to display. Any trivial types or statistic about them value. Fields can
have dependencies, which is also can be known from evaluated value.

Pull Request: https://projects.blender.org/blender/blender/pulls/120492
2024-04-11 00:21:34 +02:00
Jacques Lucke
936fb7488e Cleanup: move runtime data to Library.runtime
Having a better separation between runtime and non-runtime data makes
it easier to reason about the code.

Pull Request: https://projects.blender.org/blender/blender/pulls/120271
2024-04-08 13:08:36 +02:00
Jacques Lucke
7ed713e772 Fix #120087: wrong node selection after duplicating node 2024-04-02 15:40:51 +02:00
Harley Acheson
27c95da888 Refactor: Remove BLF _ex functions using default arguments
Remove all BLF "_ex" versions of functions by using default arguments.
These functions only differ by having an optional argument that can
return extra details about the result of the operation. This PR just
make these part of the main function as optional arguments with default
values - all nullptr.

Pull Request: https://projects.blender.org/blender/blender/pulls/119994
2024-03-28 04:02:13 +01:00
Hans Goudey
0bde788d63 Cleanup: Use "All" asset library to simplify node link drag search
The "All" library didn't exist internally when this code was first
written. The "skip_local" check that complicated this isn't necessary
because we don't add local node groups that aren't assets anyway.
2024-03-27 20:19:23 -04:00
Hans Goudey
efee753e8f Cleanup: Move BKE_idprop.h to C++ 2024-03-26 13:07:04 -04:00
Omar Emara
6d7b4e049e Compositor: Refactor backdrop offset
This patch refactors the backdrop offset to be stored as a float instead
of an int and to be stored in the image runtime structure instead of the
image itself.

Pull Request: https://projects.blender.org/blender/blender/pulls/119877
2024-03-26 07:49:33 +01:00
Hans Goudey
893130e6fe Refactor: Remove unnecessary C wrapper for GPUBatch class
Similar to fe76d8c946

Pull Request: https://projects.blender.org/blender/blender/pulls/119898
2024-03-26 03:06:25 +01:00
Hans Goudey
fe76d8c946 Refactor: Remove unnecessary C wrappers for vertex and index buffers
Now that all relevant code is C++, the indirection from the C struct
`GPUVertBuf` to the C++ `blender::gpu::VertBuf` class just adds
complexity and necessitates a wrapper API, making more cleanups like
use of RAII or other C++ types more difficult.

This commit replaces the C wrapper structs with direct use of the
vertex and index buffer base classes. In C++ we can choose which parts
of a class are private, so we don't risk exposing too many
implementation details here.

Pull Request: https://projects.blender.org/blender/blender/pulls/119825
2024-03-24 16:38:30 +01:00
Hans Goudey
8b514bccd1 Cleanup: Move remaining GPU headers to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/119807
2024-03-23 01:24:18 +01:00
Leon Schittek
3d867af642 Fix #115899: Prevent transparent gaps on nodes
Add some padding to the different shapes used to draw nodes to
prevent transparent gaps between them.
Also improve positoning of the node's outline.

Pull Request: https://projects.blender.org/blender/blender/pulls/119001
2024-03-22 09:15:00 +01:00
Leon Schittek
5acf2984d4 Node Editor: Improve padding around buttons and sockets
Make the padding that is added above and below buttons and sockets
more consistent across nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/118972
2024-03-22 09:09:47 +01:00
Jacques Lucke
25a10c211f Nodes: support accessing socket type directly from declaration
Previously, we haven't added this because there were plans to use these
declarations at a higher abstraction level where one declaration potentially
contains more than one socket. This hasn't happened yet, and we are also using
other ways to achieve dynamic socket amounts (using dynamic declarations).
Therefore, it is reasonable to simplify the code by storing the integer socket
type in the declaration directly.

Pull Request: https://projects.blender.org/blender/blender/pulls/119691
2024-03-20 12:37:37 +01:00
Jacques Lucke
3ad4ea81d1 Nodes: rename multi_input_socket_index to multi_input_sort_id
For historical reasons, the `multi_input_socket_index` was actually reversed
(large index comes first). This patch renames it to `multi_input_sort_id` and
adds a comment. This new name makes it less confusing that the id is reversed.

Pull Request: https://projects.blender.org/blender/blender/pulls/119652
2024-03-19 13:42:09 +01:00
Jacques Lucke
68c5e35be1 Merge branch 'blender-v4.1-release' 2024-03-12 17:33:59 +01:00
Sean Kim
1982cad490 Fix: update comparator for std::sort for NamedAttribute
This PR applies a fix for the comparator being passed into std::sort to
avoid potential Mac / libc++ issues as seen in #119189

Pull Request: https://projects.blender.org/blender/blender/pulls/119385
2024-03-12 17:31:02 +01:00
Jacques Lucke
d6829fa7cc Merge branch 'blender-v4.1-release' 2024-03-11 19:49:34 +01:00
Jacques Lucke
9feb02e9ad Fix #113170: node editor background color affects node panel color
The offset `-15` that's passed to `UI_GetThemeColorShade4fv` is chosen so that the color
stays almost the same in the default theme.

Pull Request: https://projects.blender.org/blender/blender/pulls/119283
2024-03-11 19:47:52 +01:00
Jacques Lucke
55cda490ab Fix #119171: show node panels when they have ui even if they don't have sockets
Pull Request: https://projects.blender.org/blender/blender/pulls/119287
2024-03-11 14:08:59 +01:00
Habib Gahbiche
ab3b8df693 Fix #116249: Compositor: Gizmos ignore backdrop transformations
Consider offset caused by transform and translate nodes in backdrop.

Affected nodes are:
- Corner Pin
- Sun Beams.

The behavior is now slightly different for rotated images (using a transform or rotate node) compared to Tiled compositor: the gizmos might move when image is rotated. The reason is the Full Frame compositor changes the image dimensions after rotation

Pull Request: https://projects.blender.org/blender/blender/pulls/119025
2024-03-07 18:47:28 +01:00
Hans Goudey
72758f3296 Cleanup: Use FunctionRef for IDRemapper callback
This avoids the need for a separate argument struct in a few cases
and generally makes the remapping friendlier to use with lambdas.
2024-03-07 09:30:22 -05:00
Hans Goudey
1e1d7034ec Cleanup: Move GPU_uniform_buffer.h to C++ 2024-03-06 21:54:28 -05:00
Hans Goudey
5993c517bd Cleanup: Use C++ Array, Span, int2 for lasso coords 2024-03-05 11:29:04 -05:00
Hans Goudey
164eb3c25b Cleanup: Move lasso utility files to C++ 2024-03-05 10:23:11 -05:00
Campbell Barton
e011c1ab9b Cleanup: spelling in comments 2024-03-05 11:25:35 +11:00