Commit Graph

187 Commits

Author SHA1 Message Date
Damien Picard
b37d121e0a I18n: extract and disambiguate a few messages
Extract
- Add to Quick Favorites tooltip.
- "Mask", the name of a newly created mask (DATA_).
- "New" in the context of the new mask ID button.
- A few strings using BLI_STR_UTF8_ defines were not extracted.
  Take the special characters out of the translation macros.
- "External" menu items from the filebrowser's Files context
  menu (right-click on a file). These items were already extracted,
  but not translated.

Improve
- Separate formatted error message "%s is not compatible with
  ["the specified", "any"] 'refresh' options" into two messages.

Disambiguate
- Use Action context for new F-modifiers' names. This is already used
  for the "type" operator prop.
- Translate ImportHelper's default confirmation text using the
  Operator context, as it uses the operator name which is extracted
  with this context.
- "Scale" can be a noun, the scale of something, or a verb, to scale
  something. The latter mostly uses the Operator context, so apply
  this context to verbs, and the default contexts to nouns.
- "Scale Influence" can mean "Influence on Scale" (tracking
  stabilization) and "to Scale the Influence" (dynamic paint canvas).
- "Object Line Art" as type of Line Art to add, as opposed to the
  active object's Line Art settings.
- Float to Integer node: use NodeTree context for the node label, as
  this is already extracted and used for the enum.

Do not translate
- Sequencer labels containing only a string formatting field.

Some issues reported by Gabriel Gazzán and Ye Gui.

Pull Request: https://projects.blender.org/blender/blender/pulls/122283
2024-05-27 19:33:35 +02:00
Iliya Katueshenock
1904e2fc8d Geometry Nodes: treat rotation as vector data type in link-drag-search in some nodes
If there is implicit conversion between rotation and vector type, so these search items
make sense.

Pull Request: https://projects.blender.org/blender/blender/pulls/121754
2024-05-20 20:30:52 +02:00
Jacques Lucke
861cb8622d Geometry Nodes: change Location to Translation in Combine/Separate Transform nodes
Based on the context, both names can make sense, however "translation"
seems to be the more correct term and general here.

Pull Request: https://projects.blender.org/blender/blender/pulls/121656
2024-05-18 15:48:04 +02:00
Iliya Katueshenock
75d17b1db5 Cleanup: Move BKE_node to namespace
Move all header file into namespace.
Unnecessary namespaces was removed from implementations file.
Part of forward declarations in header was moved in the top part
of file just to do not have a lot of separate namespaces.

Pull Request: https://projects.blender.org/blender/blender/pulls/121637
2024-05-13 16:07:12 +02:00
Jacques Lucke
25c134fd08 Geometry Nodes: new Axes to Rotation node
This adds a new `Axes to Rotation` node which creates a new rotation.
In many cases, the primary and secondary axis inputs are a normal and
tangent of a mesh or curve. This provides a simpler and more direct way
to create this rotation compared to using two `Align Rotation to Vector` nodes.

This more direct way of computing the rotation also allows us to optimize
the case better.

The node rotates one axis (X, Y or Z) to the given primary axis direction. Then
 it rotates around that primary direction to align the second axis to the given
secondary direction. Ideally, both input axes are orthogonal. However, the node
still creates the "best" rotation when they are not orthogonal. If one or the axes
is zero or both are (close to) parallel, the resulting rotation is unstable. There is
not too much the node can do to make it more stable.

Pull Request: https://projects.blender.org/blender/blender/pulls/104416
2024-05-08 13:34:14 +02:00
Jacques Lucke
69625494ad Cleanup: add missing includes 2024-05-06 19:52:45 +02:00
Iliya Katueshenock
968b98be56 Geometry Nodes: new Input Rotation node
This adds a new node input node for a constant rotation.
Similar nodes exist for vector, integer, boolean, etc. already.

Pull Request: https://projects.blender.org/blender/blender/pulls/120345
2024-05-06 19:04:30 +02:00
Jacques Lucke
dca2faec33 Geometry Nodes: fix typo in Invert Matrix node
Also changing the identifier because this node is only just out of
experimental and has not been released yet.
2024-05-06 16:19:15 +02:00
Iliya Katueshenock
4732e7cda5 Cleanup: incorrect assertion
This assertion was added in assumption that sizes of input argument are always correct.
But this is not such. More correct is to depend on assertions of span access methods.

The size of the multi-function parameters is only guaranteed to be large enough so that
every index in the mask can be accessed. It may be larger.

Pull Request: https://projects.blender.org/blender/blender/pulls/121393
2024-05-03 15:05:48 +02:00
Iliya Katueshenock
831e91c357 Geometry Nodes: support working with raw matrix values
These nodes allow working with the raw values that make up a matrix.
This can be used to construct a 4x4 matrix directly, without using the
`Combine Transform` node. This allows building transforms with arbitrary
skew, or projection matrices.

Pull Request: https://projects.blender.org/blender/blender/pulls/121283
2024-05-01 21:31:08 +02:00
Hans Goudey
462e7aeedd Geometry Nodes: Add Align Rotation to Vector node
A version of "Align Euler to Vector" with the rotation socket
instead of the vector Euler socket. Other than that, and a few
cleanups to use newer math functions, the node is the same.

The old node is just "Deprecated" for now. We could remove
it with versioning, but we can also wait to do that.

In a simple test this node is about 1.7 times faster than the old one.

Pull Request: https://projects.blender.org/blender/blender/pulls/118565
2024-04-30 15:52:11 +02:00
Hans Goudey
3cd1c365c3 Geometry Nodes: Add Project point matrix node
With the matrix socket being introduced into geometry nodes, we
are starting to deal with more complex transforms like perspective
projection. For those matrices projecting a point is not as simple
as just matrix multiplication, there has to be an additional normalization
step after. To solve that in an intuitive way consistent with how it's
typically solved in code, add a new "Project Point" node.

The canonical use case for now is in combination with the mouse
position, viewport transform, and raycast nodes, to find where the
mouse clicked on the edited geometry.

Pull Request: https://projects.blender.org/blender/blender/pulls/120597
2024-04-24 15:56:33 +02:00
Jacques Lucke
d7d8cefd72 Fix: incorrect safe float4x4 to quaternion conversion
The issue was that when a 4x4 matrix is normalized, it does not
always mean that any inner 3x3 matrix is normalized too.
2024-04-22 19:52:47 +02:00
Jacques Lucke
c00c1b8e23 Geometry Nodes: remove experimental option for matrix socket and nodes
This makes the matrix socket and initial set of corresponding nodes non-experimental.
That means, they'll be part of the next release.

Pull Request: https://projects.blender.org/blender/blender/pulls/120539
2024-04-17 10:34:13 +02:00
Jacques Lucke
bd72562ff9 Geometry Nodes: handle matrix to rotation conversion more gracefully
Previously, this conversion would often result in invalid quaternions or
hit an assert in `normalized_to_quat_fast`. It's not super nice to convert
to euler as an intermediate step performance wise, but it seems to be
the easiest solution for now. Extracting rotations from matrices should
not be done all that often anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/120568
2024-04-15 18:04:19 +02:00
Jacques Lucke
486947398f Geometry Nodes: add invertable boolean output to invert matrix node
Not all matrices are invertable (e.g. when a transformation matrix is has
a scale of zero), and it's sometimes important when a matrix is.

This also better specifies the behavior when the matrix is not invertable:
the identity matrix is returned.

Pull Request: https://projects.blender.org/blender/blender/pulls/120530
2024-04-11 18:28:57 +02:00
Iliya Katueshenock
5319e6af7b Fix: Geometry Nodes: Separate Transform node
Fix of wrong destination for scale and non-normalized rotation matrix.

Pull Request: https://projects.blender.org/blender/blender/pulls/119602
2024-03-19 05:29:38 +01:00
Jacques Lucke
b4e3a00cd3 Merge branch 'blender-v4.1-release' 2024-03-11 19:35:26 +01:00
Hans Goudey
dc9249c97f Fix #110562: Crash animating node property affecting socket visibility
For various reasons, the animation system can't properly update the node tree
so that the socket availability caused by changing node enum properties
propagates completely. So animating node properties that affect
socket visibility to change isn't possible without issues like crashes.
Unfortunately that wasn't disallowed before. In this commit there is
a balance of disabling animation on sockets that could reasonably expected
to affect socket visibility, and minimizing breaking changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/119221
2024-03-11 19:26:58 +01:00
Jacques Lucke
deb332601c Fix #113090, #111450, #104909: node rna properties collide with built-in names
This fixes the following name collisions:
* Compositor Box/Ellipse Mask node: `width` -> `mask_width`
  (also renamed the `height` property accordingly)
* Shader AOV Output node: `name` -> `aov_name`
* Geometry Color node: `color` -> `value`.

Those are breaking changes unfortunately, because looking up those property
names yielded the node-specific and not the common property. Therefore, this is
targeted at `main` instead of `4.1`.

Pull Request: https://projects.blender.org/blender/blender/pulls/119284
2024-03-11 15:57:30 +01:00
Campbell Barton
9796805bb8 Cleanup: sort CMake source files 2024-03-07 13:29:09 +11:00
Jacques Lucke
62bb346af9 Merge branch 'blender-v4.1-release' 2024-03-03 00:40:47 +01:00
Pratik Borhade
5f70bd0e46 Fix #116435: Rotate Vector node on a link connects wrong sockets
`sock_rotation` has higher priority (6) than the vector socket (4).
Hence inserting node between vector-vector link joins thorugh "rotation"
socket (`get_main_socket()` / `get_main_socket_priority()`).
This can be fixed by making "vector" input socket as default for link.

But this will break the link creation when node is inserted between
rotation-rotation link. It seems rotation is converted to vectors so
perhaps make sense to make "vector" as default socket for link.

Pull Request: https://projects.blender.org/blender/blender/pulls/116550
2024-03-03 00:38:34 +01:00
Jacques Lucke
fae16e7454 Merge branch 'blender-v4.1-release' 2024-03-02 01:25:04 +01:00
Jacques Lucke
4a81fe8180 Fix #115755: rename enum from type to rotation_type to resolve name collision
`type` is a built-in property already.

Pull Request: https://projects.blender.org/blender/blender/pulls/118990
2024-03-01 23:57:33 +01:00
Hans Goudey
f8cf609526 Cleanup: Use C++ Math functions 2024-02-21 07:57:56 -05:00
Brecht Van Lommel
0f2064bc3b Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was 4bf6a2e564.
2024-02-19 15:59:59 +01:00
Hans Goudey
1cfe9dd08c Geometry Nodes: Matrix socket type, attribute type, and initial nodes
Implements the design from #116067.
The socket type is called "Matrix" but it is often referred to as "Transform"
when that's what it is semantically. The attribute type is "4x4 Matrix" since
that's a lower level choice. Currently matrix sockets are always passed
around internally as `float4x4`, but that can be optimized in the future
when smaller types would give the same behavior.

A new "Matrix" utilities category has the following set of initial nodes"
- **Combine Transform**
- **Separate Transform**
- **Multiply Matrices**
- **Transform Direction**
- **Transform Vector**
- **Invert Matrix**
- **Transpose Matrix**

The nodes and socket type are behind an experimental flag for now,
which will give us time to make sure it's the right set of initial nodes.
The viewer node overlay doesn't support matrices-- they aren't supported
for rendering in general. They also aren't supported in the modifier interface
currently. But they are supported in the spreadsheet, where the value is
displayed in a tooltip.

Pull Request: https://projects.blender.org/blender/blender/pulls/116166
2024-02-13 18:59:36 +01:00
Campbell Barton
1a3b5452c4 Cleanup: unused includes in source/blender/nodes
Remove 166 includes.
2024-02-13 13:23:35 +11:00
Bastien Montagne
45e7827898 Clenup: Move BLT headers to Cpp.
Noisy but fairly straight forward.
2024-02-09 18:59:42 +01:00
Jacques Lucke
e1ee422d12 Nodes: improve handling of deprecated nodes
In 4.1 we deprecate the `Rotate Euler` node in favor of the `Rotate Rotation`
node which uses the new rotation socket type. The node is not removed
(for now) because that would come with compatibility issues. More generally,
we'll likely run into the situation where nodes are deprecated more often in the
future, without actually removing them to keep compatibility. This patch improves
how such nodes are handled in the UI.

The patch does three things:
* Adds a new `Utilities > Deprecated` entry in the add node menu in geometry nodes.
* Moves search items which are deprecated to the bottom in the search results
  (currently, this only works in English, can be fixed in bcon3).
* Adds a new `bNodeType->deprecation_notice` that will result in a deprecation
  warning when the node is used.

Pull Request: https://projects.blender.org/blender/blender/pulls/117905
2024-02-06 19:08:01 +01:00
Hans Goudey
6b6e57c98c Geometry Nodes: Add local/global toggle to Rotate Rotation node
All the option does internally is reverse the order of the rotations,
but this is the same as old "Rotate Euler" node, and it's a bit more
intuitive this way. Also use the same socket names, "Rotation" and
"Rotate By" which are much more intuitive.

Technically it would be better to not have to duplicate the multi-
function just to switch the order of the arguments. But the
evaluator assumes that the order always matches the socket
order currently.

Pull Request: https://projects.blender.org/blender/blender/pulls/117899
2024-02-06 16:23:26 +01:00
Hans Goudey
f4867c0d70 Geometry Nodes: Add Rotate Rotation node
This is meant as a replacement for the Rotate Euler node. Overall it
should be more performant, and the clarity given by the separate socket
type should help distinguish its purpose.

The Rotate Euler node is removed from search and the add menu by this
commit. In the future it can be versioned away. That isn't done now to
avoid a breaking API change and to make this commit less risky.

Pull Request: https://projects.blender.org/blender/blender/pulls/116106
2024-02-01 14:29:30 +01:00
Damien Picard
3bd41cf9bc I18n: Go over TIP_ and IFACE_ usages, change to RPT_ when relevant
The previous commit introduced a new `RPT_()` macro to translate
strings which are not tooltips or regular interface elements, but
longer reports or statuses.

This commit uses the new macro to translate many strings all over the
UI.

Most of it is a simple replace from `TIP_()` or `IFACE_()` to
`RPT_()`, but there are some additional changes:
- A few translations inside `BKE_report()` are removed altogether
  because they are already handled by the translation system.
- Messages inside `UI_but_disable()` are no longer translated
  manually, but they are handled by a new regex in the translation
  system.

Pull Request: https://projects.blender.org/blender/blender/pulls/116804

Pull Request: https://projects.blender.org/blender/blender/pulls/116804
2024-01-12 13:37:32 +01:00
Bastien Montagne
95b30b3516 Build: Ninja: Move 'Unity builds' to heavy pooljobs.
This commit adds a new helper to define expected properties when a
target needs to use the unity build feature.

That new helper does what was already done for existing cases, and in
addition add the target to the Ninja 'heavy' pooljobs if relevant.

Pull Request: https://projects.blender.org/blender/blender/pulls/116791
2024-01-05 18:35:48 +01:00
Campbell Barton
7ad2c71a0a Cleanup: remove redundant clamp with BLI_str_utf8_offset_from_index 2023-12-13 12:14:47 +11:00
Jeroen Bakker
65e58fe574 CMake: Fix Compiling Shader Builder on macOS
Due to changes in the build environment shader_builder wasn't able to
compile on macOs. This patch reverts several recent changes to CMake files.

* dbb2844ed9
* 94817f64b9
* 1b6cd937ff

The idea is that in the near future shader_builder will run on the buildbot as
part of any regular build to ensure that changes to the CMake doesn't break
shader_builder and we only detect it after a few days.

Pull Request: https://projects.blender.org/blender/blender/pulls/115929
2023-12-08 15:47:14 +01:00
Ray molenkamp
dbb2844ed9 Cleanup: CMake: Modernize bf_functions dependencies
Pretty straightforward

- Remove any bf_functions paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/115427
2023-11-28 01:14:15 +01:00
Campbell Barton
6297bbe931 License headers: attribute copyright to "Blender Authors"
See #110784, it seems that merging functionality reintroduced the old
convention.
2023-11-07 15:42:52 +11:00
Sergey Sharybin
85c557ffa2 Cleanup: Rename BLI_string_utils.h to BLI_string_utils.hh
All users of it are now C++, which opens doors to add C++ to the
public API.
2023-10-20 10:27:26 +02:00
Jacques Lucke
38813a7441 Nodes: unify static and dynamic declarations
This helps solving the problem encountered in #113553. The problem is that we
currently can't support link-drag-search for nodes which have a dynamic declaration.

With this patch, there is only a single `declare` function per node type, instead of
the separate `declare` and `declare_dynamic` functions. The new `declare` function
has access to the node and tree. However, both are allowed to be null. The final
node declaration has a flag for whether it depends on the node context or not.

Nodes that previously had a dynamic declaration should now create as much of
the declaration as possible that does not depend on the node. This allows code
like for link-drag-search to take those sockets into account even if the other
sockets are dynamic.

For node declarations that have dynamic types (e.g. Switch node), we can also
add extra information to the static node declaration, like the identifier of the socket
with the dynamic type. This is not part of this patch though.

I can think of two main alternatives to the approach implemented here:
* Define two separate functions for dynamic nodes. One that creates the "static
  declaration" without node context, and on that creates the actual declaration with
  node context.
* Have a single declare function that generates "build instructions" for the actual
  node declaration. So instead of building the final declaration directly, one can for
  example add a socket whose type depends on a specific rna path in the node.
  The actual node declaration is then automatically generated based on the build
  instructions. This becomes quite a bit more tricky with dynamic amounts of sockets
  and introduces another indirection between declarations and what sockets the node
  actually has.

I found the approach implemented in this patch to lead to the least amount of
boilerplate (doesn't require a seperate "build instructions" data structure) and code
duplication (socket properties are still only defined in one place). At the same time,
it offers more flexibility to how nodes can be dynamic.

Pull Request: https://projects.blender.org/blender/blender/pulls/113742
2023-10-15 20:28:23 +02:00
Campbell Barton
108dad4e52 BLI_string: prevent buffer overflow for BLI_str_utf8_offset_* functions
Strings that include Latin1 encoding or corrupt UTF8 byte sequences
could read past the buffer bounds (stepping over the null terminator).

Resolve by passing in the string length.

Other changes to support non-UTF8 byte sequences:

- BLI_str_utf8_offset_{to/from}_index were accumulating
  the UTF8 offset without accounting for non-UTF8 characters
  which could cause a buffer underflow or enter an eternal loop.

- BLI_str_utf8_offset_to_index would read past the buffer bounds if the
  offset passed in if it was in the middle of a UTF8 byte sequence.
2023-09-18 11:47:34 +10:00
Hans Goudey
974edc5885 Cleanup: Remove unnecessary "add node search"
Now that specific menus can be searched directly (see 7f9d51853c),
there is no need to maintain separate search functionality for adding
nodes. This PR removes the add node search. In a way this brings us
closer to the `NodeItem` situation before, but the setup is more
flexible since the menus are more standard and easier to customize.

In the few ways we customized the node search items before, this gives
us the same results as before. Overall the searching is less flexible,
but I think that is just a tradeoff we have to accept for the simplicity
of searching menus. In the future menus could be made more dynamic,
with each builtin node's menu path stored on the node type, similar to
assets. That might be a nice compromise. In the meantime this code
is just dead weight.

Pull Request: https://projects.blender.org/blender/blender/pulls/112056
2023-09-11 18:36:09 +02:00
Campbell Barton
19850496cb Cleanup: remove unused function, format 2023-08-26 17:05:19 +10:00
Campbell Barton
09f61f6881 Cleanup: enforce documented convention for RNA enum naming
This was noted in code comments and checked in Python documentation
generation but not at build time.

Since these enums are identifiers that end up included in various places
enforce the `rna_enum_*_items` convention which was noted as
the convention but not followed strictly.

Partially reverts [0], avoids having to deal with multiple prefix types.

[0]: 3ea7117ed1
2023-08-25 13:35:58 +10:00
Hans Goudey
45d8a8b0c3 Geometry Nodes: Initial basic rotation socket nodes
This PR adds an initial set of nodes using the new rotation socket.
6 nodes build rotations or convert them to other formats, a 7th rotates
a vector with a rotation, and the last inverts rotations.

The design task #109965 describes the choice to use separate nodes
for the rotation construction and separation operations. In the future,
a "Switch Node" operator (#111438) will help to make working with
these separated nodes faster.

- **Axis Angle to Rotation**
- **Rotation to Axis Angle**
- **Combine Quaternion**
- **Separate Quaternion**
- **Euler to Rotation**
- **Rotation to Euler**
- **Rotate Vector**
- **Invert Rotation**

See #92967

Pull Request: https://projects.blender.org/blender/blender/pulls/109030
2023-08-24 14:58:55 +02:00
Aaron Carlisle
3ea7117ed1 PyAPI Docs: Fix generation after recent node RNA changes
This commit allows both `rna_enum_` and `rna_node_`to be used for enum prefixes

This also fixes one enum by adding `rna_` to the prefix.

Together these changes fix the API documentation generation.
2023-08-16 17:37:41 -04:00
Aras Pranckevicius
acbd952abf Cleanup: fewer iostreams related includes from BLI/BKE headers
Including <iostream> or similar headers is quite expensive, since it
also pulls in things like <locale> and so on. In many BLI headers,
iostreams are only used to implement some sort of "debug print",
or an operator<< for ostream.

Change some of the commonly used places to instead include <iosfwd>,
which is the standard way of forward-declaring iostreams related
classes, and move the actual debug-print / operator<< implementations
into .cc files.

This is not done for templated classes though (it would be possible
to provide explicit operator<< instantiations somewhere in the
source file, but that would lead to hard-to-figure-out linker error
whenever someone would add a different template type). There, where
possible, I changed from full <iostream> include to only the needed
<ostream> part.

For Span<T>, I just removed print_as_lines since it's not used by
anything. It could be moved into a .cc file using a similar approach
as above if needed.

Doing full blender build changes include counts this way:
- <iostream> 1986 -> 978
- <sstream> 2880 -> 925

It does not affect the total build time much though, mostly because
towards the end of it there's just several CPU cores finishing
compiling OpenVDB related source files.

Pull Request: https://projects.blender.org/blender/blender/pulls/111046
2023-08-16 09:51:37 +02:00
Campbell Barton
e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Jacques Lucke
cc4d5c432c RNA: move headers to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/111022
2023-08-10 22:40:27 +02:00