Commit Graph

113617 Commits

Author SHA1 Message Date
Campbell Barton
589da4acb5 Cleanup: keep end-of-function code comment last (#2) 2024-10-03 15:00:07 +10:00
Campbell Barton
a9b977d256 Cleanup: sort CMake file lists 2024-10-03 14:46:26 +10:00
Campbell Barton
459c7c7f82 Cleanup: sort DNA rename (documented as sorted) 2024-10-03 14:44:12 +10:00
Campbell Barton
f489611ff3 Cleanup: keep end-of-function code comment last 2024-10-03 14:42:36 +10:00
Campbell Barton
cb283c3cd9 Cleanup: suppress array-bounds warning with GCC 2024-10-03 13:25:15 +10:00
Campbell Barton
952e1d46d1 Cleanup: match declaration names, avoid shadowing & clear trailing space 2024-10-03 12:12:08 +10:00
Campbell Barton
4fa3dc0dd4 Cleanup: spelling in comments, use uppercase tags 2024-10-03 12:11:52 +10:00
John Kiril Swenson
d2a802d3c6 VSE: Remove timeline box select
Remove the box select tool from the timeline to simplify selection
logic, avoid confusion for users, and make maintaining the code
easier in the future. It also brings the selection system  closer
to other industry-standard NLEs.

It also fixes an issue caused by d2091b4b1.

More details in PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/128051
2024-10-03 00:37:00 +02:00
Pablo Vazquez
177e2ac837 Grease Pencil: Tool settings layout adjustments
Small adjustments to improve consistency in tool settings
between different tools.

Pull Request: https://projects.blender.org/blender/blender/pulls/128491
2024-10-03 00:28:50 +02:00
Sean Kim
4cefac0da3 Fix: Remove incorrect sculpt assert
Added in 4bc146f00a

Missed the valid case where one of the two spans could be empty.

Pull Request: https://projects.blender.org/blender/blender/pulls/128501
2024-10-02 22:50:35 +02:00
Jesse Yurkovich
4a679470b6 Fix: USD: collection creation during import assigned extra fake user
When using the `create_collection` parameter during import, the newly
created Collection would be assigned a fake user which isn't necessary
and caused the user count to be 2 instead of the more natural 1 here.

Remove the fake user and add test coverage for the scenario in general.

Pull Request: https://projects.blender.org/blender/blender/pulls/128348
2024-10-02 19:53:50 +02:00
Falk David
07ed9b805d Fix: Compile error using clang
Clang doesn't allow to capture structured bindings in lambdas.
Instead, remove the structured bindings and just use a const
reference to the item iterator.
2024-10-02 18:56:01 +02:00
Falk David
1829982d3b GPv3: Merge Layers Operator
This adds a function to merge layers in original Grease Pencil geometry.
It also adds an operator to merge layers as well as some tests for the `merge_layers` function.

The operator has 3 modes:
* `Merge Down`: Combine the active layer with the layer just below (if there is one).
* `Merge Group`: Combine all the layers in a group into one single layer and remove
  the group. Can be accessed in the right-click menu of groups.
* `Merge All`: Combine all the layers of the object into one single layer.

All of these can be accessed in the `Extras` menu next to the layer tree.

Pull Request: https://projects.blender.org/blender/blender/pulls/128201
2024-10-02 18:28:30 +02:00
Bastien Montagne
76e7770bc9 Python API: Add link/append pre/post handlers.
The `pre` handler is called after blender internal code is done populating
the link/append context with data to be processed, and before this data
starts being linked from library files.

The `post` handler is called after blender is done linking, and
potentailly appending and/or instantiating, the requested data and all
of their dependencies.

Both handlers are called with a single argument, the link/append
context.

An new RNA sets of wrappers have been added to expose relevant info from
these internal C++ structures.

NOTE: !113658 is very similar (but tied to asset drag & drop), whereas
this PR is more general (these could probably live hand-in-hand / side-
by-side).

Implements #122357

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

-----------------

Some quick py example  code:

```python
import bpy

def my_handler_pre(lapp_context):
    print("About to {}:\n\t".format("link" if "LINK" in lapp_context.options else "append"),
          "\n\t".join("{} '{}', from libs ['{}']".format(item.id_type, item.name,
                                                         "', '".join([l.filepath for l in item.source_libraries]))
                      for item in lapp_context.import_items))

def my_handler_post(lapp_context):
    print("{}:\n\t".format("Linked" if "LINK" in lapp_context.options else "Appended"),
          "\n\t".join("{} '{}', from lib '{}'".format(item.id.id_type, item.id.name, item.source_library.filepath)
                      for item in lapp_context.import_items))

bpy.app.handlers.link_append_pre.append(my_handler_pre)
bpy.app.handlers.link_append_post.append(my_handler_post)
```
2024-10-02 16:44:38 +02:00
Sybren A. Stüvel
b46e2e6300 Anim: remove Slotted Actions experimental flag from prefs in non-exp build
Remove the 'Slotted Actions' (`use_animation_baklava`) experimental flag
from the preferences RNA, in non-experimental builds.

The experimental flag is already zeroed out when loading the
preferences. This commit ensures that it stays zeroed out. The rest of
the code assumes that the flag is always `false` in non-experimental
builds.

Pull Request: https://projects.blender.org/blender/blender/pulls/128483
2024-10-02 16:32:17 +02:00
Sybren A. Stüvel
8c37b20dd5 Anim: enable more slotted action handling in non-experimental builds
Remove some `#ifdef WITH_ANIM_BAKLAVA` guards to make a unit test
succeed. The code is handling slots when assigning Actions to IDs.
Non-experimental builds will only deal with legacy Actions, and thus the
slot assignment is a no-op anyway.

The unit test is explicitly creating layered Actions and running tests
on them. Since this also covers some new code introduced for Action
assignments (unified code for both legacy & layered Actions), I'd feel
more comfortable keeping the test enabled.

Note that when loading a blend file with layered Actions in a
non-experimental build will actually load them as legacy Actions.

Pull Request: https://projects.blender.org/blender/blender/pulls/128483
2024-10-02 16:32:15 +02:00
Falk David
1c2355c037 GPv3: Add mode toggle operators
This copies the legacy mode toggling operators to a new file
and renames the operators to use the `GREASE_PENCIL_OT` prefix
like the rest of the operators. No functional changes expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/128477
2024-10-02 15:17:28 +02:00
Jacques Lucke
86dd6791c2 Fix: memory leaks when using BKE_grease_pencil_nomain_to_grease_pencil
This fixes two memory leaks:
* Drawings were not properly freed because `MEM_delete` was called on the DNA
  base type which does not have the destructor.
* `CustomData` of layers was not freed before it was overridden.

Pull Request: https://projects.blender.org/blender/blender/pulls/128476
2024-10-02 14:39:31 +02:00
Lukas Tönne
dfc8a782f5 GPv3: Attribute panel to configure layer attributes on original data
This follows the same pattern as attribute panels for Mesh, Curves, and
Point Cloud. Only the layer domain is supported. The _add_ operator now
has to validate the domain setting on invoke, because layer attributes
don't support the default `Point` domain.

Pull Request: https://projects.blender.org/blender/blender/pulls/128471
2024-10-02 13:58:13 +02:00
Falk David
9d5c5d4a93 Fix: GP: Wrong offset vector when drawing onto surfaces
The offset from the surface was calculated based on only the normal
which didn't used to be the case.
The fix computes the offset based on the surface point and the direction
of the view.
Also makes sure to not draw overlays when computing the depths using
`V3D_DEPTH_NO_GPENCIL`.
2024-10-02 12:39:43 +02:00
Thomas Dinges
906bc801f4 Release cycle: Blender 4.3 Beta
Splash screen by Blender Studio: studio.blender.org
2024-10-02 12:34:01 +02:00
Pratik Borhade
d7fb60be4d Fix #128461: GPv3: Crash importing svg with more than one drawing
Wrong `points_num` when resizing the `CurvesGeometry`.
Otherwise, any attriute span will have wrong size, this triggers crash
when writing value in these attribute spans.

Pull Request: https://projects.blender.org/blender/blender/pulls/128472
2024-10-02 11:48:28 +02:00
Julian Eisel
78e330923d UI: Tree-view scrolling and resizing support
Implements scrolling support for tree-views, as well as changing the size of the
scroll-able tree-view. This is important to be able to place them in many places
in the UI, where a compact layout is preferred over an every expanding one
(causing following contents to be scrolled out of view). UI-lists would use
scrolling and resizing to ensure this, now tree-views are on par.

Enables scrolling and resizing for:
- Bone collection UI (`UILayout.template_bone_collection_tree()`)
- Grease Pencil layer UI (`UILayout.template_grease_pencil_layer_tree()`)
- Light link collection UI (`UILayout.template_light_linking_collection()`)
- UI to define a node tree interface (`UILayout.template_node_tree_interface()`)

These are all cases where compact UIs make more sense than expanding ones.

Internally this is enabled by calling the `set_default_rows()` method of the
tree-view, although the API might change still. It shouldn't be quite simple to
implement this for grid-views too if necessary, or other potential view types.

Although I'd like to do some smaller code quality improvements still, this
feature is important for some other modules (e.g. grease pencil module for the
layers UI in grease pencil v3), so I decided to prioritize merging this.

Pull Request: https://projects.blender.org/blender/blender/pulls/119668
2024-10-02 11:19:49 +02:00
Alexandre Cardaillac
0315eae536 Cycles: Add more scattering phase functions
Previously, Cycles only supported the Henyey-Greenstein phase function for volume scattering.
While HG is flexible and works for a wide range of effects, sometimes a more physically accurate
phase function may be needed for realism.

Therefore, this adds three new phase functions to the code:
Rayleigh: For particles with a size below the wavelength of light, mostly athmospheric scattering.
Fournier-Forand: For realistic underwater scattering.
Draine: Fairly specific on its own (mostly for interstellar dust), but useful for the next entry.
Mie: Approximates Mie scattering in water droplets using a mix of Draine and HG phase functions.

These phase functions can be combined using Mix nodes as usual.

Co-authored-by: Lukas Stockner <lukas@lukasstockner.de>
Pull Request: https://projects.blender.org/blender/blender/pulls/123532
2024-10-02 11:12:53 +02:00
Omar Emara
db490e90fe Fix #127392: File Output doesn't write empty inputs
The File Output node doesn't write invalid and single value layers,
which can cause differences in EXR structures when rendering animations.

To fix this, we write a dummy image that has the same dimensions as the
other layers in the file, filled with the value of the single value
input.

Pull Request: https://projects.blender.org/blender/blender/pulls/128454
2024-10-02 10:28:55 +02:00
Campbell Barton
0f3fdd25bc Cleanup: various non-functional changes for C++
- Remove redundant parenthesis
- Use strings macros
- NULL -> nullptr
2024-10-02 15:47:05 +10:00
Sean Kim
80f10766dd Cleanup: Reformat sculpt undo comments
* Wrap to longer line length
* Update to recent naming & structural changes

Pull Request: https://projects.blender.org/blender/blender/pulls/128462
2024-10-02 02:52:30 +02:00
Sean Kim
0c1a500214 Refactor: Remove DyntopoSymmetrize undo type
The `DyntopoSymmetrize` undo type fulfills the same function as the
`Geometry` push for Mesh and Multires, i.e. it indicates that a full,
mesh-wide change has occurred instead of a small delta.

Pull Request: https://projects.blender.org/blender/blender/pulls/128460
2024-10-02 01:16:28 +02:00
Harley Acheson
44168c32ff Fix #128406: Editor Highlight Edge Roundness
This separates out the edge drawing from the edge highlighting, needed
for the edge drawing shader. Also slightly improves the alignment of
the two.

Pull Request: https://projects.blender.org/blender/blender/pulls/128453
2024-10-01 21:58:02 +02:00
Harley Acheson
bfe693c8c2 UI: Changes to Docking Mouse Cursors
This makes one change and another correction to the mouse cursors used
during Docking. The change is to use WM_CURSOR_EDIT for Mac while just
hovering over the corner action zones. This means that Mac users will
transition from this to WM_CURSOR_HAND_CLOSED, instead using two hand
cursors.  The correction is to use the "split" cursors while splitting
areas. That it doesn't do that now is a mistake made during #127810.

Pull Request: https://projects.blender.org/blender/blender/pulls/128396
2024-10-01 21:04:20 +02:00
Germano Cavalcante
ab3e470b35 Fix: Occlusion of Curves failing during snapping
The geometry of objects behind Curves was being considered for snapping
even when occluded.

The occlusion test logic has been reworked and simplified when the snap
target is a Curve.

As a result, Snap to Face now works correctly for the active Curve.
2024-10-01 15:17:02 -03:00
Germano Cavalcante
304b3e026a Fix: Snap grid point of Rotate operator is closest to the constraint axis
The snap-to-grid constraint in the rotation operation should not be
limited to the grid closest to the constraint axis, as this restricts
rotational freedom.
2024-10-01 15:17:01 -03:00
Miguel Pozo
54ad693486 Fix: Partially revert #128281
Avoid the asserts until we figure out a better design.
2024-10-01 19:55:36 +02:00
Casey Bianco-Davis
b4881f6b0a GPv3: Layer Tint Color, Radius Offset and Adjustments panel.
This adds the layer adjustments back.
There is a the `Adjustment` panel under the layer properties with
the tint color, the tint factor, and the radius offset (now in meters).

The tint and radius offsets are stored as layer attributes.

For compatibility and the sake of not making the conversion code more complicated,
legacy layer adjustments are always converted to modifiers.

Pull Request: https://projects.blender.org/blender/blender/pulls/126777
2024-10-01 19:04:32 +02:00
Sybren A. Stüvel
7ebe7a3b3b Fix #128200: Crash when duplicating essential brush asset
The check for the RNA property type was missing a nullptr check.

Pull Request: https://projects.blender.org/blender/blender/pulls/128441
2024-10-01 18:25:52 +02:00
Julian Eisel
33b670a65d Sculpt/Paint: Automatically switch tools when activating brushes
As discussed in #128066, we want that activating a brush makes sure the
most appropriate tool is activated. For example activating an eraser
brush should activate an eraser tool, if available. This makes the
tool and brush binding two ways, which is more clear. Plus it means that
users don't have to care about tools at all if they don't want to, they
can just keep switching brushes and Blender takes care of the tool.

Implementation wise, this works by letting a Python operator lookup a
tool for a given brush type name, when activating a brush.

Design Task: https://projects.blender.org/blender/blender/issues/128066
2024-10-01 18:21:15 +02:00
Dalai Felinto
afa8b7632c Geometry Nodes: Warning Node: Show icons on the enum
Adds the icons to the Warning Type enum, so users associate the icons with the type.

Pull Request: https://projects.blender.org/blender/blender/pulls/128442
2024-10-01 18:19:48 +02:00
Julian Eisel
3798852071 Sculpt/Paint: Bring back some brush tools for paint modes
Since brush assets were merged, all sculpt and paint modes have a unified
"Brush" tool that is used for all brushes. Based on feedback, this mixes brush
types a bit too much, so some specific tools that use brushes should be brought
back. These brush types just behave very different from the main brush types,
and users expect them to be easily accessible from the toolbar. This also makes
them more discoverable and having tools that remember their last used brush can
be useful too (e.g. assigning shortcut to eraser tool to switch back to last
used eraser, rather than a specific eraser brush).

Note that further changes are planned, to get a true "best of both worlds"
design, where people can use a global brush library without having to worry
about tools, but brushes can also be accessed via tool categorization.
The new design works well with both mental models without being a compromise
in-between.

a79f9100a6 already brought back some tool for grease pencil draw mode, with this
commit the design is now applied to all sculpt & paint modes.

See PR for a list of tools that were brought back.

Design Task: https://projects.blender.org/blender/blender/issues/128066
Pull Request: https://projects.blender.org/blender/blender/pulls/128038
2024-10-01 18:03:33 +02:00
Sean Kim
eac36baafd Cleanup: Extract multires modifier operators into separate file
Pull Request: https://projects.blender.org/blender/blender/pulls/128397
2024-10-01 17:51:43 +02:00
Lukas Tönne
e07842de41 GPv3: "Join Objects" operator
Supports the `OB_GREASE_PENCIL` type in the "Join Objects" operator.

Each object is merged into the active object one-by-one. This first
combines the layer trees of the source and destination, adds vertex
groups and materials, and appends the drawings to the destination array.
Then internal references are updated: drawing indices in frame data,
mask layer names, layer parents, material and vertex group indices.

The source curves are transformed into the target object space, so their
world position remains the same. Note that animation data is also
transferred to the new object, but __not__ transformed in case of
diverging object- or layer transforms. This is expected and handled the
same way by other object types.

Pull Request: https://projects.blender.org/blender/blender/pulls/128429
2024-10-01 16:39:49 +02:00
Pratik Borhade
965fdf0d54 Fix #128390: GPv3: Select all toggle preference not working
Case for `SEL_TOGGLE` was not handled in GPv3 edit mode selection.

Pull Request: https://projects.blender.org/blender/blender/pulls/128411
2024-10-01 16:09:28 +02:00
dereck
9221c545af Fix: string attributes not shown properly in spreadsheet
Pull Request: https://projects.blender.org/blender/blender/pulls/127892
2024-10-01 15:45:41 +02:00
Sybren A. Stüvel
66cf63d89b Anim: support layered Actions when animating curve points
Update `ED_curve_updateAnimPaths()` to handle F-Curves from both legacy
and layered Actions.

Ref: #123424

Pull Request: https://projects.blender.org/blender/blender/pulls/128428
2024-10-01 15:43:08 +02:00
Sybren A. Stüvel
ec0ecf08da Refactor: Anim, use blender::listbase_to_vector
Add a `const` version of `blender::listbase_to_vector`, and use it in
`animrig::fcurves_for_action_slot()`.

No functional changes.
2024-10-01 15:43:06 +02:00
Sybren A. Stüvel
b56715de03 Anim: Fix bug updating F-Curves for new Curve (object) points
When modifying a Curve object's points, its animation data is updated to
ensure that changes in point index are reflected in the F-Curve data
paths. This already worked fine for pre-existing Curve points, but
didn't happen correctly for points that were newly added since entering
edit mode.
2024-10-01 15:43:06 +02:00
Sybren A. Stüvel
31fd540048 Refactor: Anim, prepare ED_curve_updateAnimPaths() for legacy Actions
Refactor `ED_curve_updateAnimPaths()` and the static functions it calls,
separating out:

- the manipulation of the F-Curves themselves, and
- the manipulation of whatever container holds those F-Curves.

This will make it considerably easier to convert the code to deal with a
`Span<FCurve *>` later instead of `ListBase`, which in turn is necessary
to handle layered Actions.

The old code used to move F-Curves from one `ListBase` to another, to
avoid visiting the same F-Curve twice. This is now done by tracking
those F-Curves in a `Set<FCurve *>`, so that it doesn't require
manipulation of the storage itself.

No functional changes.
2024-10-01 15:43:06 +02:00
Miguel Pozo
ba4c026215 Fix #128164: Race condition in ShaderCreateInfo::finalize()
We can have deferred and non-deferred shaders (so, different threads)
with the same `additonal_info` dependencies trying to finalize the same
`ShaderCreateInfo`.

This ensures `finalize` always runs from the main thread to avoid race
conditions.

Pull Request: https://projects.blender.org/blender/blender/pulls/128281
2024-10-01 15:35:57 +02:00
Julian Eisel
f57b9b12d2 UI: Increase size of active asset highlight in asset shelf
Generally increases padding of preview widgets a bit (while keeping the
preview size the same), and increases the size of the highlight surface
a bit. The default grease pencil brushes from the essentials asset
library use an opaque background, so the highlight was barely visible
before. It was difficult to identify the active brush from that. Now
it's a lot easier to identify visually.

See PR for comparison screenshots.

Pull Request: https://projects.blender.org/blender/blender/pulls/128432
2024-10-01 15:33:15 +02:00
Jacques Lucke
fd4f864cba Geometry Nodes: improve display of node warnings in modifier
This does the following changes:
* Show info "warnings" in modifier too. Previously those were skipped. The
  different behavior of info/warning/error messages causes confusion.
* Add a new `Warnings` panel that only shows when there are warnings. In its
  title, it shows how many warnings there are.
* In the panel, warnings are sorted by severity and alphabetically.

Pull Request: https://projects.blender.org/blender/blender/pulls/128395
2024-10-01 15:31:50 +02:00
Lukas Tönne
d4cb32caf8 Fix: Add missing Grease Pencil v3 objects in BKE_animdata_main_cb.
This is needed for fcurve callbacks, such as renaming animation data
paths.
2024-10-01 15:29:35 +02:00