Commit Graph

2251 Commits

Author SHA1 Message Date
Jacques Lucke
24dc9a21b1 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
Campbell Barton
41fe7b0d27 Merge branch 'blender-v4.2-release' 2024-07-10 17:42:42 +10:00
Campbell Barton
7ee6451a51 Extensions: support adding system repositories via the command line 2024-07-10 17:39:06 +10:00
Falk David
509cb361bb GPv3: Remove tint tool from tool bar
This is now accessible from the draw tool as a brush asset.

Pull Request: https://projects.blender.org/blender/blender/pulls/124421
2024-07-09 17:17:25 +02:00
Jacques Lucke
dc8e9678e1 Geometry Nodes: allow naming geometry sets
This adds a new `name` member to the `GeometrySet` class. This name can be set
with the new `Set Geometry Name` node. Currently, the name is only used in the
spreadsheet when displaying instances.

The main purpose of this name is to help debugging in instance trees. However, in the
future it may also be used when exporting instance trees or when creating separate
objects from them.

Note, the name is not expected to be unique, it is fully in user control.

Naming geometries is necessary to make the spreadsheet more useful for instances,
because currently the user has no information for which geometry is used by each instance.

We also want to use this name to improve the integration with grease pencil where
sometimes layers become instances with the same name.

Pull Request: https://projects.blender.org/blender/blender/pulls/114910
2024-07-09 17:03:54 +02:00
Campbell Barton
d44b96bf07 Merge branch 'blender-v4.2-release' 2024-07-09 20:41:11 +10:00
Campbell Barton
3a29e25d21 Extensions: expand on the error report when a repository is locked
- Include the repository name.
- Add a hint for force-unlocking the repository.
2024-07-09 20:39:23 +10:00
Campbell Barton
13200f1f60 Merge branch 'blender-v4.2-release' 2024-07-09 19:49:51 +10:00
Campbell Barton
987a027326 Merge branch 'blender-v4.2-release' 2024-07-09 19:49:49 +10:00
Campbell Barton
29f5d56359 Merge branch 'blender-v4.2-release' 2024-07-09 19:49:46 +10:00
Campbell Barton
b44d5cb5af Fix unhandled exception when updating legacy add-ons to extensions 2024-07-09 19:45:18 +10:00
Campbell Barton
f4231418e9 Extensions: limit the size of the data read from the lock-file
Avoid reading a large amount of data if the lock file
inexplicably contains large amounts of data.
2024-07-09 19:37:12 +10:00
Campbell Barton
1ffde9338d Extensions: support force unlocking a repository
When the repository is owned by another Blender session,
support removing the file-system lock.

This is accessible from a menu in the repository popover.

This is needed if Blender exits unexpectedly while a repository
is being modified (typically install/upgrade).

Addresses #122135.
2024-07-09 19:27:32 +10:00
Campbell Barton
d06c79958c Merge branch 'blender-v4.2-release' 2024-07-09 15:43:02 +10:00
Campbell Barton
912194390a Extensions: ensure generated strings in the TOML file are valid
While this wasn't likely to cause any problems in practice,
using the sub-command "build --split-platform" with a platform
containing any characters that need escaping would have produced a TOML
with invalid syntax.

Add a utility function that's guaranteed to create a valid TOML string.
2024-07-09 15:32:09 +10:00
Fermin
ad58c9eaca XR: Add passthrough support for Meta Quest devices
Uses the OpenXR extension XR_FB_PASSTHROUGH_EXTENSION_NAME,
compatible mainly with the Meta Quest family of devices.

Currently, passthrough support over OpenXR is disabled by default
in the Quest Link app, and must be manually enabled in its settings
to use this feature.

The performance of the passthrough render varies with the quality
of the connection between the headset and the PC. For better results,
connecting the headset directly through USB to the PC, or at least
connecting the PC to the local network over ethernet, is recommended.

Thanks a lot to [KISKA](https://kiska.com/)
for their support in the development of this feature.

Pull Request: https://projects.blender.org/blender/blender/pulls/124204
2024-07-09 06:10:17 +02:00
Campbell Barton
b8fc441fdd Merge branch 'blender-v4.2-release' 2024-07-09 13:47:10 +10:00
Campbell Barton
5d379b9887 Cleanup: remove type hints, follow code style for core scripts 2024-07-09 13:32:30 +10:00
Hans Goudey
792efafa2c Cleanup: Miscellaneous changes to OBJ/import nodes
- Sort add menu alphabetically
- Use forward declaration for GeometrySet again
- Use `this->` to access class methods
- Use `MEM_cnew`
- Fix typo
- Pass Span by value
- Pass MutableSpan instead of Vector &
- Remove unnecessary whitespace
- Use `BLI_SCOPED_DEFER` for freeing non-RAII objects
- Use `is_empty()` instead of `size() == 0`
- Use `GeometrySet::from_mesh` ability to handle null argument
2024-07-08 15:12:42 -04:00
Bastien Montagne
385dfb4650 Merge branch 'blender-v4.2-release' 2024-07-08 20:51:48 +02:00
Bastien Montagne
92d5659653 I18N: Update UI translations from git/weblate repository (9735e28dcce47210).
Note that this commit also introduces a new language, Slovenian.
2024-07-08 20:50:07 +02:00
Devashish Lal
4b884f737c Geometry Nodes: OBJ Import Node
Add a node similar to the STL import node (d1455c4138) that
imports OBJ files, including both meshes and curves. The output consists
of a geometry instance for each mesh/curve in the file.

There are a few improvements to address in the future: Currently the node
has no inputs besides the file path. Options may be exposed in the future.
Materials are also not imported yet, because creating material data-blocks
during evaluation may not be trivial.

This is part of a GSoC project:
https://devtalk.blender.org/t/gsoc-2024-geometry-nodes-file-import-nodes/34482

Pull Request: https://projects.blender.org/blender/blender/pulls/123967
2024-07-08 20:20:38 +02:00
Harley Acheson
4e98eebab8 Merge branch 'blender-v4.2-release' 2024-07-08 10:14:03 -07:00
Harley Acheson
987b781412 UI: Various Grammar Changes for Extensions
Various minimal grammar changes in the new Extensions system. For
example changing "Please turn Online Access on the System settings" to
"Please turn Online Access on in the System settings"

Pull Request: https://projects.blender.org/blender/blender/pulls/124262
2024-07-08 19:12:56 +02:00
Jesse Yurkovich
5bb5cfd97a Merge branch 'blender-v4.2-release' 2024-07-08 09:07:07 -07:00
Julian Eisel
7b0ea0f1b4 Sculpt/Paint: New asset based brush management workflow
This is the main merge commit of the brush assets project. The previous
commits did some preparing changes, more tweaks are in the following commits.
Also, a lot of the more general work was already merged into the main branch
over the last two years.

With the new design, quite some things can be removed/replaced:
- There's a unified "Brush" tool now, brush based tools and all special
  handling is removed.
- Old tool and brush icons are unsed now, and their initialization code
  removed here. That means they draw as blank now, and the icon files can be
  removed in a follow up.
- Creation of default brushes is unnecessary since brushes are now bundled in
  the Essentials asset library. Icons/previews are handled as standard asset
  previews.
- Grease pencil eraser options are replaced by a general default eraser brush
  that can be set by the user.

More changes are planned still, see task list issue below.

Main Authors: Bastien Montagne, Brecht Van Lommel, Hans Goudey, Julian Eisel
Additionally involved on the design: Dalai Felinto, Julien Kaspar

Blog Post: https://code.blender.org/2024/07/brush-assets-is-out/

Tasks:
https://projects.blender.org/blender/blender/issues/116337

Reviewed incrementally as part of the brush assets project, see:
https://projects.blender.org/blender/blender/pulls/106303
2024-07-08 17:50:25 +02:00
Julian Eisel
56387f5be5 Assets: Disable "Open Blend File" operator for assets from asset system files
Asset system files (using the `.asset.blend` extension) are special and cannot
be edited like normal files. Opening them showes warnings about this. So better
not "encourage" editing these files that much.

Note that this check will result in false positives, since users may create
files with this extension. Asset system files have an extra flag stored
identifying them. Accessing that from the asset representation is a bit more
involved, probably requires changes in the asset indexer. For now keeping it
simple, the false positives are not a big deal for this convenience operator.

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

Part of the brush assets project, see:
- https://projects.blender.org/blender/blender/issues/116337
- https://projects.blender.org/blender/blender/pulls/106303
2024-07-08 17:50:24 +02:00
Falk David
07bc687785 Python: Define attribute groups based on AttributeOwnerType
The function `rna_def_attributes_common` assumed that the owner of the
attributes is an `ID`. This PR refactors the code to partially remove this
assumption.

The `rna_def_attributes_common` function now takes an argument
`AttributeOwnerType type` that defines what `AttributeGroup` should be used.

This is in preperation for #116043 where we want to use
`rna_def_attributes_common` for grease pencil drawings, which are not IDs.

In addition to the refactor explained above, this also changes the API
slightly:
Previously, the `AttributeGroup` defiend `active_color`,
`active_color_index`, `active_color_name`, `default_color_name`, and
`render_color_index` for all IDs. These properties could only be used by
meshes. So this PR seperates the `AttributeGroup` type into one type
per attribute owner: `AttributeGroupMesh`, `AttributeGroupPointCloud`,
`AttributeGroupCurves`, and `AttributeGroupGreasePencil`.
As such the properties mentioned above are now only usable by meshes.

Note that this technically breaks the API and will have to be noted in the
release notes.

Pull Request: https://projects.blender.org/blender/blender/pulls/123658
2024-07-08 17:11:21 +02:00
Hans Goudey
4e6a962b2b Fix #120590: FBX import gives sharp edges for non-normalized normals
A few files included in reports contained normals that were not normalized.
In order to contain consistent normals around smooth corner fans, sharp
edges are added when neighboring corner normals aren't close enough.
Non-unit-vector normals also triggered this check.

Blender used to do this implicitly when the derived `MeshLoop.normal`
value was set. That API has been changed already, and it's clearer if the
addon provides normalized normals, so this PR adds a normalization
step to the FBX importer.

Pull Request: https://projects.blender.org/blender/blender/pulls/124261
2024-07-08 17:09:22 +02:00
Sybren A. Stüvel
9d3dc77e05 Anim: move Bone Selection Sets add-on into Blender
The functionality of the Bone Selection Sets add-on is now integrated
into Blender itself. Rigify has been updated to no longer check for the
add-on, but just assume that the functionality is available.

The keymap is still the same, and so are all the class names. This
ensures that there are no conflicts when people still have the old
add-on enabled somehow. And there is versioning code to remove the
'add-on enabled' state so that Blender won't complain it cannot find it
any more.

Compared to the add-on, the following changes are made:

- The 'bone' icon has been removed from the list of available selection
  sets. It was the same for each entry anyway, and thus didn't provide
  any information.
- The code has been split up into multiple files, with the UI elements
  in `scripts/startup/bl_ui/properties_data_armature.py` and the
  operators in `scripts/startup/bl_operators/bone_selection_sets.py`.
- Helper functions and classes are prefixed with `_` to indicate that
  they are not part of any public API.
- The `Operator` helper subclasses have been transformed to mix-in
  classes. This way the only subclasses of `Operator` are the actual
  operators.
- Comments & descriptions have been updated for clarity & consistency.

This commit contains code by the following authors, ordered by number of
commits in the original add-on repository, highest first:

Co-Authored By: Ines Almeida <britalmeida@gmail.com>
Co-Authored By: Sybren A. Stüvel <sybren@stuvel.eu>
Co-Authored By: Campbell Barton <ideasman42@gmail.com>
Co-Authored By: meta-androcto <meta.androcto1@gmail.com>
Co-Authored By: Demeter Dzadik <Mets>
Co-Authored By: lijenstina <lijenstina@gmail.com>
Co-Authored By: Brecht Van Lommel <brechtvanlommel@gmail.com>
Co-Authored By: Aaron Carlisle <carlisle.b3d@gmail.com>

For the full history see the original add-on at:
https://projects.blender.org/blender/blender-addons/commits/branch/main/bone_selection_sets.py

Reviewed On: https://projects.blender.org/blender/blender/pulls/124343
2024-07-08 16:28:42 +02:00
Sybren A. Stüvel
ef669e3b99 Anim: fix Rigify bone selection set generation code
The "create selection set for bone collection" function was checking for
bone collection membership the wrong way. This is now fixed.

Reviewed On: https://projects.blender.org/blender/blender/pulls/124343
2024-07-08 16:28:42 +02:00
Campbell Barton
df162e5f1b Merge branch 'blender-v4.2-release' 2024-07-08 22:36:13 +10:00
Damien Picard
e9de6b5e7a I18n: More translation fixes for Rigify
Allow translation of a few missing messages in the Rigify add-on. In
particular, the most important "Generate Rig" button!

Some issues reported by Gabriel Gazzàn.
2024-07-08 13:00:08 +02:00
Campbell Barton
e52783033d Merge branch 'blender-v4.2-release' 2024-07-08 15:31:44 +10:00
Campbell Barton
9bbf269fe3 Extensions: suppress all pylint warnings & handle add-on errors
- Suppress pylint warnings via comments or be minor changes.
- Any errors disabling add-ons before upgrading or uninstalling are now
  reported to the operators.
- Disable cyclic import warning is it's impractical to resolve.
- Enable useless-suppression warning.
2024-07-08 15:29:27 +10:00
Campbell Barton
817efe4aef Merge branch 'blender-v4.2-release' 2024-07-08 13:33:34 +10:00
Campbell Barton
05feac04fa Extensions: minor changes to error handling & uninstalling
- Any change that cases validate to fail reports a fatal_error.
- If removing a package fails, attempt to the remove cache.
2024-07-08 13:27:58 +10:00
Campbell Barton
bae1d3311f Merge branch 'blender-v4.2-release' 2024-07-08 13:05:49 +10:00
Campbell Barton
ac6e216b26 Merge branch 'blender-v4.2-release' 2024-07-08 13:05:45 +10:00
Campbell Barton
74f8ac15f5 Extensions: "build --split-platform" now includes it's own wheels
The `[build.generated]` section now includes a filtered list of wheels
to simplify checking existing wheels on the server.

Also disallow quotes & control characters in wheel paths because they
already shouldn't be used and doing so would cause escaping issues in
the generated TOML.

Implements #124242.
2024-07-08 12:50:43 +10:00
Campbell Barton
f3630777f6 Extensions: show add-on errors in the add-ons panel
Restore the UI from 4.1. Also correct an error when extensions are
disabled.
2024-07-08 11:36:52 +10:00
Campbell Barton
a515da841b Merge branch 'blender-v4.2-release' 2024-07-07 17:51:42 +10:00
Campbell Barton
5877efbec3 Extensions: add missing checks for errors in IO, JSON & TOML data
Exceptions need be caught and forwarded so they show it in Blender's
interface. While most common errors where accounted for, various IO
errors & malformed JSON/TOML could cause internal operations to fail
with unhandled exceptions.
2024-07-07 17:43:33 +10:00
John Kiril Swenson
406554c11e VSE: Add snapping in preview area
Adds snapping in the VSE preview area.

Source points are the four corners and origins of all selected, visible
image quads. Targets can be preview borders, preview center, or
corners/origins of other strips.

Pull Request: https://projects.blender.org/blender/blender/pulls/122759
2024-07-06 15:24:52 +02:00
Campbell Barton
08bf742302 Merge branch 'blender-v4.2-release' 2024-07-06 15:00:43 +10:00
Campbell Barton
11b1919bcf Extensions: resolve popup glitches when dropping URL's
Use UILayout::template_popup_confirm to replace workarounds that didn't
work very well.

- Resolve "Add Repository..." button in the dialog not closing the
  popup when pressed.
- Add a "Cancel" button while the remote resository data is
  downloading.
- Remove the hack to scale the UILayout to hide the existing
  confirm/cancel buttons.

Resolves #124098.
2024-07-06 14:49:41 +10:00
Sybren A. Stüvel
0aa75ab57b Refactor: rename "Animation data-block" to "Action"
Rename "Animation data-block" to "Action" or "Layered Action", where
appropriate. Some uses of the term actually refer to the `AnimData`
struct, in which case they were left as-is.

No real functional changes, just changing some messages & descriptions.

Pull Request: https://projects.blender.org/blender/blender/pulls/124170
2024-07-05 17:52:55 +02:00
Sybren A. Stüvel
c0364efec0 Refactor: rename 'Action Binding' to 'Action Slot'
Rename 'Binding' to 'Slot'. The old term was causing all kind of
confusion, and 'slot' was considered to be a better term for the
intended functionality.

This commit breaks existing blend files that were using the new layered
Action for their animation. The animation data will be lost due to the
rename, as there is no versioning code or DNA renaming logic. At this
time the new system is still marked as experimental, so shouldn't be
used for anything serious anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/124170
2024-07-05 17:52:55 +02:00
Campbell Barton
8250ac142f Merge branch 'blender-v4.2-release' 2024-07-05 20:49:47 +10:00
Campbell Barton
337abcdfc1 Merge branch 'blender-v4.2-release' 2024-07-05 20:49:45 +10:00