Commit Graph

114013 Commits

Author SHA1 Message Date
Sybren A. Stüvel
76bddb41df Anim: Fix NLA Strip Action assignment
When creating a new NLA strip for an action, as well as when setting
`strip.action` via RNA, use the generic action-assignment code. This
ensures that the slot selection follows the same logic as other Action
assignments.

If the generic slot selection doesn't find a suitable slot, and there is
a single slot on that Action of a suitable ID type, always assign it.
This is to support the following scenario:

- Python script creates an Action and adds F-Curves via the legacy API.
- This creates a slot 'XXSlot'.
- The script creates multiple NLA strips for that Action.
- The desired result is that these strips get the same Slot assigned as
  well.

The generic code doesn't work for this, because:

- The first strip assignment would see the slot `XXSlot` (`XX`
  indicating "not bound to any ID type yet"). Because that slot has
  never been used, it will be assigned (which is good). This assignment
  would change its name to, for example, `OBSlot`.

- The second strip assignment would not see a 'virgin' slot, and thus
  not auto-select `OBSlot`. This behaviour makes sense when assigning
  Actions in the Action editor (assigning an Action that already
  animates 'Cube' to 'Suzanne' should not assign the 'OBCube' slot to
  Suzanne), but for the NLA I feel that it could be a bit more
  'enthousiastic' in auto-picking a slot to support the above case.

This is preparation for the removal of the 'Slotted Actions'
experimental flag, and getting the new code to run as compatibly as
possible with the legacy code.

The return value of `animrig::nla::assign_action()` has changed a bit.
It used to indicate whether a slot was auto-selected; it now indicates
whether the Action assignment was successful. Whether a slot was
assigned or not can be seen at `strip.action_slot`.

Pull Request: https://projects.blender.org/blender/blender/pulls/128892
2024-10-14 13:45:02 +02:00
Sybren A. Stüvel
ee3aea4caf Anim: When assigning an Action, auto-assign slot if it was never used
When assigning an Action, and it has only one slot that has never been
assigned to anything before, auto-assign that slot.

This is the last option for the slot auto-selection. It is in place mostly
for backward compatibility in the following situation:

- Python script creates a new Action, and adds F-Curves via the legacy API
  `action.fcurves.new(...)`. This automatically creates a slot with
  `id_type = 0`, indicating it is not yet bound to any ID type.
- The script assigns the Action to a data-block.

In this case the implicitly created slot is automatically assigned, and
thus the data-block is animated by the F-Curves created through the legacy
API.

Pull Request: https://projects.blender.org/blender/blender/pulls/128892
2024-10-14 13:44:59 +02:00
Sybren A. Stüvel
86249a6216 Anim: Implement cycle-aware keying for Slotted Actions
Cycle-aware keying on slotted Actions now works the same as on legacy
Actions. In the future this will be improved, but for now it's good enough
to have the same behaviour as before.

Pull Request: https://projects.blender.org/blender/blender/pulls/128892
2024-10-14 13:44:55 +02:00
Sybren A. Stüvel
b7049a7c04 Refactor: Anim: add function to ensure an F-Curve exists in legacy Action
Split the legacy Action handling code of `action_fcurve_ensure()` into a
new function `action_fcurve_ensure_legacy()`. This makes it possible for
unit tests to explicitly create a legacy Action for testing, regardless
of the 'Slotted Actions' experimental feature flag.

When we drop that flag, the unit tests that explicitly test legacy
behaviour will keep running.

Pull Request: https://projects.blender.org/blender/blender/pulls/128892
2024-10-14 13:44:37 +02:00
Omar Emara
f4fc683fc4 Compositor: Add stub CPU implementation for nodes
This patch adds stub implementations for the new CPU mode of the
realtime compositor. Unsupported nodes will return zero results until
they are implemented.
2024-10-14 14:19:14 +03:00
Philipp Oeser
62b7947769 Merge branch 'blender-v4.3-release' 2024-10-14 11:51:52 +02:00
Philipp Oeser
1246baa81b Fix #128935: Preview range to selected keyframes wrong
Depending on from where this functionality was called, it behaved
differently (there are three operators for this).

- from the GE, it uses `get_graph_keyframe_extents` [which falls back to
existing scene (preview) start/end frames if no real extends are found]
- from the NLA, it uses `get_nlastrip_extents`[which falls back to
existing scene start/end frames if no real extends are found]
- elsewhere (and this was reported in #128935) it uses
`get_keyframe_extents` but did not consider if extends were really
found.

The last case lead to startframe being set higher than endframe causing
a crash on playback.

This PR checks the return value of `get_keyframe_extents` [which tells
us if extends were found] and cancels out early.

NOTE: it would probably be nice if the behavior was consistent across
all editors, but since I think the right behavior is to not do anything
if nothing is selected (after all the description is "based on range of
selected keyframes"), I am going for correct behavior of
`ACTION_OT_previewrange_set` but leave the Graph Editor and NLA editor
operators untouched for the time being.

Pull Request: https://projects.blender.org/blender/blender/pulls/128981
2024-10-14 11:51:24 +02:00
Pratik Borhade
99b876e2bc Fix #128946: GPv3: Can't select materials in Modifier
Should have been `value.data`.

Pull Request: https://projects.blender.org/blender/blender/pulls/128971
2024-10-14 11:20:28 +02:00
YimingWu
dc45169acd Fix #128637: Gizmo line tool not snapping to exactly 45 degrees
Due to rounding errors in `wm_gesture_straightline_do_angle_snap`, it
could give out a snapped result that's meant to be 45 degrees but does
not have equal X/Y distances after converted to integer. Since 45
degrees can be used to make a equal length structure, it's best to make
sure that resulting X/Y values are the same if the angle is multiple of
45 degrees.

This fix would be effective for all tools that uses this "straight line
gizmo".

Pull Request: https://projects.blender.org/blender/blender/pulls/128683
2024-10-14 13:03:03 +08:00
YimingWu
4bbf0986d5 Fix #128637: Gizmo line tool not snapping to exactly 45 degrees
Due to rounding errors in `wm_gesture_straightline_do_angle_snap`, it
could give out a snapped result that's meant to be 45 degrees but does
not have equal X/Y distances after converted to integer. Since 45
degrees can be used to make a equal length structure, it's best to make
sure that resulting X/Y values are the same if the angle is multiple of
45 degrees.

This fix would be effective for all tools that uses this "straight line
gizmo".

Pull Request: https://projects.blender.org/blender/blender/pulls/128683
2024-10-14 07:01:45 +02:00
John Kiril Swenson
3d88019ae3 Merge branch 'blender-v4.3-release' 2024-10-13 22:30:53 -05:00
John Kiril Swenson
e3f9d210d1 Fix #128401: Issues when splitting connected strip
This patch fixes broken connections and effect strips which would arise
in some cases when trying to split connected strips with effects.

This happened in case an effect strip was being split -- first, its
effect chain would be added to a VectorSet of seqs, but then, only the
connected strips of the original seq (in this case the effect strip)
would be added to the VectorSet. Fix by iterating over the entire list
and adding connected strips.

Additionally:

- Add a final SEQ_iterator_set_expand() for SEQ_query_effect_chain() in
  case these connected strips had effects themselves.
- Move the seq_edit_split_operation_permitted() check after the entire
  chain is evaluated to avoid bugs w/ locked strips being editable
  before.

Pull Request: https://projects.blender.org/blender/blender/pulls/128670
2024-10-14 05:26:42 +02:00
Campbell Barton
bd299cad72 Cleanup: quiet unused argument warnings 2024-10-14 12:12:20 +11:00
Campbell Barton
f5e271b2ba Merge branch 'blender-v4.3-release' 2024-10-14 12:06:29 +11:00
Campbell Barton
77b523d317 Fix #128920: Crash calculating geometry nodes that use UV unwrap
Regression in [0], missing null check.

[0]: 788bc5158e
2024-10-14 11:46:34 +11:00
Richard Antalik
3b8d0abbbe Merge branch 'blender-v4.3-release' 2024-10-14 00:51:33 +02:00
John Kiril Swenson
72be365c6b Fix #126191: Both handle seqslide modal cancel
The issue was that if the seqslide was cancelled such that the
`new_frame` of the left handle was greater than its previous
right_handle (before the cancel), `SEQ_time_left_handle_frame_set()`
would clamp this value and so the left handle would not properly restore
itself.

Fix by updating both handles at once (right handle first) if both
handles are selected and the cancel jump travels in the right direction.

This also seems to fix the situation where strips w/ both handles
selected would be erroneously detected as overlapping when moving them
rapidly side to side.

Pull Request: https://projects.blender.org/blender/blender/pulls/128740
2024-10-14 00:49:01 +02:00
Harley Acheson
4a189532bf Merge branch 'blender-v4.3-release' 2024-10-13 11:25:45 -07:00
Harley Acheson
bdee3dfaa2 Fix #128906: Remove Docking Draw Callbacks After Deactivate
If we lose focus while splitting or docking we need to make sure that
the overlay drawing callbacks are stopped.

Pull Request: https://projects.blender.org/blender/blender/pulls/128957
2024-10-13 20:24:35 +02:00
Clément Foucault
191b347f58 Cleanup: GPU: Use function parameters instead of template 2024-10-12 14:21:51 +02:00
Clément Foucault
d9aad850b0 GPU: GLSL preprocess: Remove invalidly processed header
Add assert in the preprocessor that these file don't get
processed.
2024-10-12 14:21:51 +02:00
Campbell Barton
1bc3c24f45 Cleanup: use const args, variable 2024-10-12 22:48:35 +11:00
Campbell Barton
3350eeba62 Merge branch 'blender-v4.3-release' 2024-10-12 22:48:08 +11:00
Campbell Barton
15be0030f6 Cleanup: various non-functional C++ changes
- Avoid shadowing.
- Use default functions.
- Remove unused struct member from GpencilBatchCache.
2024-10-12 22:44:19 +11:00
YimingWu
57ca937a7c Fix #128714: GPv3: Don't erase behind the camera
If points are beind the camera, we don't really want to erase them. This
patch marks invalid coordinates thus preventing them from intersecting
with a eraser.

The reason for using a large value to indicate "invalid coordinate"s are:

- No need to further break down the way we process `src_to_dist` point matching array for `hard_eraser` `soft_eraser`, makes the entire logic much easier.
- No eraser is gonna be touching such a large coordinate of `1e20`.

Technically there's this case where if a segment crosses the near or far clipping plane (to handle this correctly, you'll need to split that segment into two at the clipping plane position and it increases complexity a lot), and then you will have undefined erasing behaviour, however the worse case is that the one segment was completely removed, and in such case I think it's acceptable.

Pull Request: https://projects.blender.org/blender/blender/pulls/128738
2024-10-12 13:24:58 +08:00
Sean Kim
6ff33b7e92 Merge branch 'blender-v4.3-release' 2024-10-11 15:25:07 -07:00
Pratik Borhade
bcf6524ca1 Fix #128601: Redoing move operation crash in sculpt mode
PBVH is null when redoing the move operation. To fix this,
update active object data from evaluated object before sending
undo_push.

Also fixed the crash in cache_init() after updating depsgraph

Pull Request: https://projects.blender.org/blender/blender/pulls/128625
2024-10-12 00:23:49 +02:00
Julian Eisel
d177388979 Sculpt/Paint: Tag brushes for unsaved changes for UI indication
Part of the brush assets project followups, see #116337.

Based on feedback, it seems important to indicate to the user when a brush has
unsaved changes.

There's no reliable updating mechanism we can use or hook into here, except for
RNA "update" callbacks. Brush data gets changed in many places in code, the only
way to do this seems manual tagging every time a brush property gets changed.
This PR introduces `BKE_brush_tag_unsaved_changes()` for this. I spent some time
going through all brush properties to ensure changes call the tagging function.

A known limitation with this will be that changes to dependencies won't be
indicated in the brush. E.g. Changing the texture attached to a brush won't make
the brush be indicated as changed.

The UI to indicate the changed brushes is being discussed still, see #128846.

Pull Request: https://projects.blender.org/blender/blender/pulls/128845
2024-10-11 22:08:14 +02:00
Harley Acheson
8675533448 Fix #128868: Hide Sharp Corners in Docking Split
While splitting areas the two parts are shown with rounded outlines,
but some of the underlying content can show through in the corners,
spoiling the effect. This PR just erases anything in those corners,
making it look cleaner and rounder.

Accidentally merged to main first with c3ea941273.
2024-10-11 12:31:23 -07:00
Harley Acheson
c3ea941273 Fix #128868: Hide Sharp Corners in Docking Split
While splitting areas the two parts are shown with rounded outlines,
but some of the underlying content can show through in the corners,
spoiling the effect. This PR just erases anything in those corners,
making it look cleaner and rounder.

Pull Request: https://projects.blender.org/blender/blender/pulls/128901
2024-10-11 20:57:54 +02:00
Clément Foucault
1c0247c871 Cleanup: GPU: Preprocessor: Use report callback on processing functions 2024-10-11 18:52:34 +02:00
Clément Foucault
2514e119cb Merge branch 'blender-v4.3-release'
# Conflicts:
#	source/blender/draw/intern/shaders/draw_view_info.hh
2024-10-11 18:30:11 +02:00
Bastien Montagne
19e51d5658 Fix RNA invalid cleanup/unregister debug message.
Print in `RNA_struct_free` would crash in ASAN builds because they can often
access memory (struct identifier) that is owned by Python/BPY, and
therefore already freed at exit time.
2024-10-11 18:19:55 +02:00
Clément Foucault
ac1069805c Fix: DRW: Broken multiview support with inverted scale object instances
If a `DrawGroup` contained both inverted and non-inverted scale
the command generate shader would output the `resource_id`
content at conflicting indices. This is because the number of
instances stored inside the `DrawGroup` are the original
count before multiview. Actually, only `start` was taking the
multi-view count into account.

We cannot modify the value on CPU otherwise it would increase
the instance count for each submission. So the fix is to
pass the view count to the command generate shader and
multiply the instance count where needed.

Fix #128085

Pull Request: https://projects.blender.org/blender/blender/pulls/128854
2024-10-11 18:09:57 +02:00
Clément Foucault
3764f53b1b Fix: EEVEE: Point lights with zero radius create in shadow artifact
This is likely caused by local_ray_up being degenerate with
very small radii. This is a temporary fix and should be revisited
later.

The issue is that the real fix is likely to have a higher
performance cost.

Fix #124636
2024-10-11 18:06:47 +02:00
Sybren A. Stüvel
f4f3158a10 Fix: Anim, restore missing automatic F-Curve groups
Restore the automatic F-Curve groups (like "Object Transforms"
when keying loc/rot/scale); 0a74768a98
removed a bit too much code.

Pull Request: https://projects.blender.org/blender/blender/pulls/128891
2024-10-11 17:52:01 +02:00
Campbell Barton
2aa8d3cb4a Merge branch 'blender-v4.3-release' 2024-10-12 00:29:25 +11:00
Campbell Barton
094f7235bb Cleanup: replace own Py_INCREF_RET with CPython's Py_NewRef
These are both simple functions that serve the same purpose.
Py_NewRef didn't exist when Py_INCREF_RET was added to Blender.
2024-10-12 00:20:55 +11:00
Omar Emara
30d3aef477 Compositor: Inline 2D threaded for utility
This patch inlines the 2D threaded for utility used by the compositor
for better performance.
2024-10-11 16:03:16 +03:00
Omar Emara
7f90c16d14 Refactor: Avoid processing arguments directly
Avoid processing function arguments directly and instead create
temporary variables for adjustments. This is done to make it easier to
maintain identical code to CPU.
2024-10-11 15:52:22 +03:00
Campbell Barton
85e29c4ac4 Refactor: simplify join triangles to quads heap-node lookups
- Replace blender::Map with an array to lookup heap-nodes by edge index.
- Only create the array when the topology influence is used.

These gives ~5-9% overall speedup to operator function.
2024-10-11 23:48:30 +11:00
Campbell Barton
80c33bae4a Merge branch 'blender-v4.3-release' 2024-10-11 23:43:03 +11:00
Campbell Barton
02670b1547 Cleanup: correct wording in comments 2024-10-11 23:39:58 +11:00
Campbell Barton
b3e3eaabf0 Cleanup: suppress unknown-warning-option for clang
Also note why the warning isn't valid.
2024-10-11 23:36:19 +11:00
Bastien Montagne
aecdb518db BPY: Add a debug utils to print Python backtrace from C++ code. 2024-10-11 14:17:50 +02:00
Clément Foucault
d8ccaa62fb Merge branch 'blender-v4.3-release'
# Conflicts:
#	tests/data
2024-10-11 14:11:58 +02:00
Jacques Lucke
e7fef63db4 Nodes: improve spacing for panels 2024-10-11 13:38:49 +02:00
Jacques Lucke
a239bfc4dd Refactor: Nodes: improve drawing of nodes based on node declaration
The main goal is to simplify adding support for nested node panels. The patch
makes use of the updated recursive node declarations introduced in
6ffc585fb8.

The main changes are:
* Rewritten node drawing in a way that makes ui design decisions like panel
  visibility and margins more explicit. Especially the handling of margins is
  much better now imo. Previously, it was very hard to change the margin for
  specific cases without accidentally breaking other situations. Now each
  possible case has an explicit margin. This needs a few more lines of code but
  is much easier to work with.
* Rewritten node drawing in panel (sidebar + material properties) using the new
  ways to iterate over the declaration.
* It's possible to add custom layouts at any point in the node declaration now.
  This also replaces the need for having a `draw_buttons` callback for panels.

Pull Request: https://projects.blender.org/blender/blender/pulls/128822
2024-10-11 12:20:58 +02:00
Aras Pranckevicius
bce1ba16ae VSE: Save float image proxies as EXRs to not lose range/precision
Building proxies for images was always saving them as JPG files.
However when input images are floating point (e.g. EXR files), this
loses both range and precision, making the resulting proxies
not really be useful for anything where you'd be using EXR files.

Change this to save float image proxies as EXR instead (FP16 data,
lossy DWAA compression). In my quick tests this does result in about
3x-4x larger proxy file size compared to JPG, however at 50% DWAA
quality that is still 10-30x smaller than original EXRs would be.

Changed proxy image loading to explicitly tell to load metadata. JPGs
were always loading it anyway, but EXRs only load when instructed to
do so.

Pull Request: https://projects.blender.org/blender/blender/pulls/128835
2024-10-11 12:13:14 +02:00
Clément Foucault
300ea9f083 GPU: GLSL: Strip comment at compile time
This speeds up the preprocessor and
will allow for faster load time.

# Conflicts:
#	source/blender/gpu/glsl_preprocess/glsl_preprocess.cc
2024-10-11 11:15:52 +02:00