Commit Graph

114128 Commits

Author SHA1 Message Date
Falk David
9e82331ae6 Fix #130368: GPv3: Canvas overlay incorrect offset
The issue was that if the evaluated object doesn't have an active
layer, the canvas is offset by twice the objects position.

The reason was that the code scaled the whole transformation
matrix by two to match the code in 4.2, but then had to overwrite
the location of the transformation again to counteract the scaling.

The fix is to not counteract the scaling and just scale the 3x3 part
of the matrix instead. This way we can remove the part afterwards
that writes to the location of the transform.

Pull Request: https://projects.blender.org/blender/blender/pulls/130454
2024-11-18 16:24:34 +01:00
Pratik Borhade
e23b710bcf Fix #130376: GPv3: Outline modifier traces flat caps incorrectly
For flat caps, only one point is added in data.positions array for
endpoints of stroke. It results in incomplete outline. To resolve
this, add another point in new curves at the exact opposite position.

Pull Request: https://projects.blender.org/blender/blender/pulls/130437
2024-11-18 16:16:08 +01:00
Sean Kim
28a5a800ee Fix #130422: Expand Active Face Set crashes on Multires mesh
Caused by dcb3391e10

Pull Request: https://projects.blender.org/blender/blender/pulls/130431
2024-11-18 14:31:10 +01:00
Lukas Tönne
a452e2d499 Fix #125559: Eraser does not find intersections at small scales
When points are close together in 2D view space the eraser intersection
function does not have a valid direction vector (zero). This cancels out
terms in the computation that would still contribute to the result and
the function always returns zero intersections.

This patch adds a special case when the direction vector is zero,
so the point distance to the circle is still calculated (just not in
any particular direction).

Pull Request: https://projects.blender.org/blender/blender/pulls/130341
2024-11-18 13:39:10 +01:00
Pratik Borhade
d7d7a6ef97 Fix: GPv3: Hide channel color for layers in dopesheet
This is not implemented yet so remove the callback function which draws
channel color for GPv3 layers. Also `acf_gpl_channel_color` is a legacy function,
it may lead to different channel color as explained in #130370.

Pull Request: https://projects.blender.org/blender/blender/pulls/130445
2024-11-18 12:44:38 +01:00
Falk David
7911f8e6b3 Fix #130353: GPv3: Fill strokes disappear when using bucket fill
The issue was that when the fill strokes were merged into the drawing,
the `fill_opacity` attribute would be created on the drawing
(when it didn't exist before) and initialized to 0. This meant that
all previously drawn fill strokes would disappear.

The fix manaully initializes the `fill_opacity` attribute on the
target geometry before calling `join_geometries`.

Ideally this could be something the attribute system handles
or the `join_geometries` function takes care of by getting
some information about how to initialize attributes.

Pull Request: https://projects.blender.org/blender/blender/pulls/130442
2024-11-18 12:29:51 +01:00
Pratik Borhade
7dfe47164a Fix #130325: GPv3: Update overlay on changing active layer in dopesheet
This is due to missing depsgraph update.

Pull Request: https://projects.blender.org/blender/blender/pulls/130367
2024-11-18 11:55:10 +01:00
Falk David
d3d26233fc Fix: GPv3: Edit Mode: Crash during extrude
The crash was caused by the selection attribute not being
initialized properly. The size was 0.

The fix uses `ed::curves::ensure_selection_attribute` to ensure
the attribute is created and on the right domain.

Extrude should only work for a point selection, so the poll
function of the operator is updated to reflect this.

Pull Request: https://projects.blender.org/blender/blender/pulls/130333
2024-11-15 17:01:06 +01:00
Lukas Tönne
217fa8d09e Fix #130276: Trace operator needs to tag data after curves replacement
1. Trace operator was missing a topology cache tag after replacing the stroke
   data. This caused an invalid normals cache and crash in drawing code.
2. The drawings must not be manipulated outside the main thread. Job data now
   stores a curves geometry array that is used to update the drawings at the end of the job.
3. Since the job data now stores an array it has to be allocated using MEM_new.

Co-authored-by: Falk David <falk@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/130313
2024-11-15 12:52:43 +01:00
Aras Pranckevicius
64198971ea Fix: Reading some old blend files fires assert in Sequencer data read
wdas_cloud.blend file on 4.3+ raises an assert, due to reading some
VSE data:

  readfile.cc:4798, blo_verify_data_address(), at
  'MEM_allocN_len(new_address) >= expected_size' Corrupt .blend
  file, unexpected data size.

This is caused by 30dbb7820d which removed completely unused
data from Sequence struct. But it turns out, Sequence serialization
inside scene_blend_read_data is "somewhat strange", to put it mildly,
and silently assumes that struct offset of seqbase and channels
will never change.

For now, restore the previously expected struct member offset,
ensure it stays like that via static_assert, and add notes on
how someone should fix this in a better way.

Pull Request: https://projects.blender.org/blender/blender/pulls/130296
2024-11-15 11:51:49 +01:00
Harley Acheson
d1171635ff Fix #129414: On linux, Join Use Active Window when Overlapping
On Linux we can't always determine topmost window under cursor,
therefore check for overlapping windows and, if so, only use the
active window.  This allows dragging between windows as long as
they don't overlap

Pull Request: https://projects.blender.org/blender/blender/pulls/130242
2024-11-14 22:31:36 +01:00
Thomas Dinges
b8b3f8e723 Release: Bump 4.3 to rc 2024-11-14 18:53:05 +01:00
Pratik Borhade
3b44f84686 Fix #130182: Unique layer name in move to layer popup box
Set unique name for `target_layer_name` to display in pop-up box when
creating a new layer. For that, `unique_layer_name()` is moved to member
function of `GreasePencil`.

Pull Request: https://projects.blender.org/blender/blender/pulls/130208
2024-11-14 18:30:50 +01:00
Hans Goudey
a9209f10a6 Fix #130250: Modifier copy to selected crash using quick favorites
The rest of this function has null checks for the modifier because it
might not be part of the context and retrieved during invocation later.

Pull Request: https://projects.blender.org/blender/blender/pulls/130272
2024-11-14 16:04:19 +01:00
Hans Goudey
d364441220 Fix #128798: Face corner normals cache not tagged dirty in sculpt undo
Similar to the handling of this cache in `flush_update_step` (after a
brush stroke calculation), the face normals cache needs to be cleared.
Sculpt mode doesn't have granular updates implemented for face corner
normals currently.

Pull Request: https://projects.blender.org/blender/blender/pulls/130248
2024-11-14 12:49:28 +01:00
Julian Eisel
c70e93bd5c Fix: Assert when activating brush asset from the current file
Brush assets from the current file should be supported like other brush
assets.

This assert would fail on startup for example, when opening the
essentials file containing the default brush of this mode.
2024-11-14 11:45:54 +01:00
Bastien Montagne
c107eb5c00 Fix #130260: Add support for linked editable ID filepaths to IMAGE_OT_file_browse.
Similar issues to previous problems in `IMAGE_OT_open` and the
`BKE_image` API... Relative filepaths of linked editable IDs must be
relative to the ID's library blendfile, not the current 'local'
blendfile.
2024-11-14 11:32:45 +01:00
Luna Rood
8f200d96b2 Fix: Nodes: group edit button unintentionally drawn on NodeCustomGroup
Fix regression caused by 6d8d21812b.

Pull Request: https://projects.blender.org/blender/blender/pulls/130204
2024-11-13 17:59:16 +01:00
Clément Foucault
87c990ca30 GPU: Add more explicit message for Mac + Nvidia platform
This fixes the confusion, as the previous message
could let to believe you could make the GPU to work
by upgrading to newer MacOS version.

Rel #130224

Pull Request: https://projects.blender.org/blender/blender/pulls/130231
2024-11-13 17:25:38 +01:00
Julian Eisel
209dc899ea Fix #128649: Tool icon in toolbar shrinked down with non HiDPI screens
Pixelsize and DPI scaling had to be applied correctly.
2024-11-13 17:00:18 +01:00
Bastien Montagne
a090ae3318 Fix #125787: Textures don't load for brushes when using "Use Relative Paths" option.
Use new `_in_lib` BKE_image API to re-use or load an image from/in the
expected library, including using the library path as root path for
relative file paths handling.

Using the new `BKE_image..._in_lib` API also allows to get rid of the
`check_exists` 'hack' introduced in `image_open_exec` (when support to
edit some linked data was added, in 5f9f3116db) to avoid re-using local
Image IDs for editable linked data (brush assets), since
`BKE_image_load_exists_in_lib` will now ensure to only re-use an Image
ID if it matches the target library.

This commit also simplifies/makes `ED_image_filesel_detect_sequences`
signature more to the point. It replaces the `Main` parameter by a mere
`root_path` string. The given `bmain` was indeed only used to extract
(again) a base for relative paths.

NOTE: The general idea of this fix is the same as in PR !130058, thanks
to Sean Kim for the investigation and initial fix.

Pull Request: https://projects.blender.org/blender/blender/pulls/130197
2024-11-13 16:32:33 +01:00
Pratik Borhade
0ec011e78b Fix: Sculpt invert mask crash with multires
Similar to b1bcdf8d53.

Pull Request: https://projects.blender.org/blender/blender/pulls/130212
2024-11-13 16:00:35 +01:00
Julian Eisel
671f08df96 Fix #129267: No brush previews show up with large asset libraries
Previously, we had to fetch all asset previews at once. However the preview
caching system was limited at 8192 previews, so with large asset libraries, many
previews would get dropped. Instead, allow selectively requesting previews and
only request previews of items displayed on screen. This should fix the issue,
and reduce the time it takes to display brush assets in general, especially with
bigger libraries. This should also reduce memory usage quite a lot when
displaying the asset shelf, since not all asset previews are loaded anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/130105
2024-11-13 15:53:52 +01:00
Bastien Montagne
b863369ae9 Refactor: BKE_image: Allow to load or find existing also in a Library.
This commit refactors `BKE_image_load` and `BKE_image_load_exists` APIs:
* Remove the `_ex` versions (the 'exist' boolean return pointer can have
  default `nullptr` value instead).
* Add `_in_lib` versions, which match signature and behavior of the
  generic ID creation code to allow to find or create a new image ID
  directly in a library 'namespace' (as linked data).

This is required by upcommig fixes for Brush Assets, which are using
linked but editable data-blocks.

Fix #130194: When trying to add a new image from the UI (e.g. for a new
texture) for a local ID, if that same exact image was already loaded by
a linked ID, it would trigger an assert in `BKE_id_move_to_same_lib`,
because `BKE_image_load_exists` would return the matching linked Image ID
instead of creating a new local one. In release builds with no assert,
it would result in making a linked ID 'local', while still being used by
original other linked data.

Passing around the intended final destination of the new Image (local or
in a given library) allows `BKE_image_load_exists` to be more specific
when searching for an already loaded matching image ID, and ensures that
a new local Image ID is created in the case described above.

Pull Request: https://projects.blender.org/blender/blender/pulls/130195
2024-11-13 15:29:29 +01:00
Julian Eisel
0f8e4b3516 Fix: UI: Many unneeded assets in file-list cache for asset UIs
Partial fix for #129267.

Avoid creating an entry in the file list cache for every asset when iterating
over the available assets. For this, allow passing a pre-filter function to the
asset iterator, to filter based on `AssetRepresentation` data. The asset shelf
can then pre-filter based on asset type and the active catalog.

Really, the cached file entry is only needed to access the preview image of the
asset, so it can be avoided most of the time.

While this should still be solved properly as outlined in #122439, this is
a general improvement and fix the mentioned report in a minimal way.

Was hoping this would be sufficient to fix #129267, but the whole of
!130105 will be needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/130166
2024-11-13 14:13:45 +01:00
Damien Picard
5f52c5ce46 Fix: I18n: Integer Math node title used wrong translation context
The integer math node items used the proper translation context, but
not the translation for the node label.

Reported by ziweidao.

Pull Request: https://projects.blender.org/blender/blender/pulls/130225
2024-11-13 13:53:57 +01:00
Pratik Borhade
f7ffef07d4 Fix #130189: Crash parenting object to layer
Caused by 71398478b2.
`parsubstr` is nullptr in Layer struct. This results in crash when an
object is parented to a new layer. This can be fixed by passing layer
member function `parent_bone_name()`. It handles the null pointer.

Pull Request: https://projects.blender.org/blender/blender/pulls/130205
2024-11-13 13:38:45 +01:00
Pratik Borhade
16410eab9b Fix: Compiler warning about unused enum in switch case.
Caused by 9a4ce4a0f7

Pull Request: https://projects.blender.org/blender/blender/pulls/130213
2024-11-13 11:04:13 +01:00
Bastien Montagne
cf0c91a545 Fix BKE_id_move_to_same_lib behavior with invalid parameters.
* Early return in case the given `id` is already in the same library as
  its target `owner_id` (in addition to both being local data).
* Assert with message AND return in case the given `id` is a linked ID
  from a different library.

The second point somewhat mitigates the severity of #130194.
2024-11-13 10:14:57 +01:00
Jacques Lucke
917f7e648c Fix #130180: non-screen space dial gizmo scale does not take geometry scale into account
We can't scale the dial gizmo non-uniformly. Therefore, the average of the x/y/z scale
is used to determine the scale of the gizmo.

Pull Request: https://projects.blender.org/blender/blender/pulls/130183
2024-11-12 22:45:51 +01:00
Bastien Montagne
0565f16f18 Fix (unreported) rare assert when loading blendfile using libraries.
There is actually a valid (rare) case where a Library ID can have a `0`
versionfile value during blendfile loading: if that library only
contains 'indirect weak' linked data.

These IDs are only actually read in the library blendfile if they are
also used by some other data, otherwise they are purposedly dropped and
removed, and the library blendfile can end up never being read at all.

This would lead to a completely empty library on blendfile loading,
which can then be removed from the data-base.

NOTE: this _does not_ affect cases where the whole library is missing,
or some linked IDs from that library are not found anymore.
2024-11-12 19:59:32 +01:00
Julian Eisel
a0b2704202 Fix #128138: No paint curves selectable for brush strokes
The data-block selector filters out local data-blocks when trying to
assign to linked data. A lot of data-block management relies on this.

Since these data-blocks are created for the use with brushes only,
create them under the same library that the brush is from, as indirect
data. The UI allows selecting these data-blocks then. We do the same for
textures attached to a brush, and some other data-block types.

Also add paint-curves to the editable data-block types, so they can be
edited despite being considered linked data.

Pull Request: https://projects.blender.org/blender/blender/pulls/130184
2024-11-12 19:13:24 +01:00
Pratik Borhade
9a4ce4a0f7 Fix #128749: GPv3: Dopesheet Move channel to top reverses layer order
The operator to move a channel to the top revered the layer order
by iterating from the top to the bottom and moving selected channels
to the top. Iterate from the bottom to the top instead to keep the right
layer ordering.

Pull Request: https://projects.blender.org/blender/blender/pulls/128793
2024-11-12 18:56:12 +01:00
YimingWu
2e82f95237 Fix: LineArt: Cache mechanism fixes
The cache mechanism for line art is changed during migration to GPv3,
however the code path failed to handle following cases which could lead
to a few problems:

- Line art cache isn't deleted after last line art modifier because it
  coule be hidden, causing memory leaks.
- A modifier inside a multiple line art modifier sequence that doesn't
  use cache would prematurely delete line art cache, causing subsequent
  line art modifier to give empty result.
- When the first line art modifier is hidden (in viewport/render), the
  cache is not created correctly, leading to crashes.

Now the new code logic addresses these problems properly by:

- Making sure the last visible line art modifier deletes cache.
- Giving a fresh cache pointer for modifiers that doesn't use global
  cache.
- Line art cache is correctly ensured when there are modifiers that
  are hidden

Pull Request: https://projects.blender.org/blender/blender/pulls/129953
2024-11-12 18:51:45 +01:00
Julian Eisel
f66b3eeae9 Fix #128774: Setting brush from Properties doesn't change active tool
We need to be careful about not just looking up active tool data from
context, because this code path may also be run from the Properties,
which use the tools of the 3D view. So make sure related code falls back
to the 3D view, like it's already done in some other places.
2024-11-12 18:03:17 +01:00
Richard Antalik
ebe209b8ec Fix #126461: Scene sound does not play
Caused by removing scene sound from "main scene" when other strip using
the same scene is not rendering sequencer strips.

Only remove sound when all strips using particular scene are not
rendering sequencer strips.

Pull Request: https://projects.blender.org/blender/blender/pulls/129768
2024-11-12 17:28:20 +01:00
Falk David
5ecec47280 Fix #130176: GPv3: Fill tool doesn't write to fill_opacity.
The fill tool didn't write to the `fill_opacity` attribute leading
to non-filled strokes in some cases.

This makes sure that the attribute is created with full opacities.

Pull Request: https://projects.blender.org/blender/blender/pulls/130177
2024-11-12 17:26:47 +01:00
Casey Bianco-Davis
155c21d774 Fix: GPv3: Primitive Tool: Control point misalignments when object or layer is moved.
The problem was that the control point positions where not accounting
for the grease pencil objects transform nor the layer transformation.

Pull Request: https://projects.blender.org/blender/blender/pulls/130005
2024-11-12 17:19:43 +01:00
Bastien Montagne
0b3a7cbe69 Cleanup: Move BKE_image.h and related headers to C++.
NOTE: This also required some changes to Cycles code itself, who is now
directly including `BKE_image.hh` instead of declaring a few prototypes
of these functions in its `blender/utils.h` header (due to C++ functions
names mangling, this was not working anymore).

Pull Request: https://projects.blender.org/blender/blender/pulls/130174
2024-11-12 16:53:54 +01:00
Laurynas Duburas
f9d89a0dfb Fix: Prevent bezier handle attribute creation on transform
Prevents Bezier handle attribute creation on transform for
`CurvesGeometry` instances without Bezier curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/130165
2024-11-12 16:51:54 +01:00
Falk David
0a27b3d6ba Fix: GPv3: Fill tool doesn't have a paint cursor
Reverts part of 0872e898bc.
In 4.2, the fill tool had a small paint cursor that could
be turned off using the "Display Cursor" setting.

This makes it so that the cursor for the fill tool behaves
the same as in 4.2.
2024-11-12 16:16:42 +01:00
Clément Foucault
e3a960ef2e Fix #129889: EEVEE: Lightprobe Volume bake is non-deterministic
Turns out the sampling module was not initialized when
computing lighting which resulted in undefined shadow location.
In some cases even producing NaN position which would make the
shadow disappear.

Basically, anything returned by `sampling_rng_nD_get` was returning
garbage, and on some occasion, it could be a negative number and
produce NaN if passed into `sample_disk` or any `sqrt`.

ASAN did not catch it because the uninitialized data load
was done on the GPU.

I ran the render tests and, minor difference aside, they all match.

#### Follow Up:
This raises the concern that we have no assertion for correctly
using some modules. At the very least, we should have some
mechanism to catch uninitialized buffer. Investigating this
was a pain au chocolat.

Pull Request: https://projects.blender.org/blender/blender/pulls/130150
2024-11-12 15:29:17 +01:00
Falk David
43fde8c39c Fix: #130045: Crash in length modifier with 2 point curves
The length modifier was not handling 2 point curves correctly.

This change does two things:
1) Fix the crash by copying the original indices for 2 point curves into `dst_to_src_point`.
2) Fallback to `extend_curves_straight` for extending 2 point curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/130122
2024-11-12 15:11:59 +01:00
Pratik Borhade
22d94df4cf Fix: GPv3: "Only In Multiframe" overlay not working
There were some issues in the code that sets up the draw calls.
The `only_lines` option needs to consider multi frame editing.

Resolves #129873.

Pull Request: https://projects.blender.org/blender/blender/pulls/129944
2024-11-12 14:44:31 +01:00
Omar Emara
a0cfb0b142 Fix #130134: Double Edge Mask uses too much memory
The Double Edge Mask node uses too much memory when it is not connected
to anything in the Full-Frame compositor. That's because it tries to
allocate a buffer of size 131072x131072, which is due to the cumulation
of multiple issues.

1. The Full-Frame compositor evaluates nodes that are not connected to
   the output.
2. The constant folder assigns a bounds of +-65536 to its output memory
   buffers as a maximum possible value.
3. Then the MemoryBuffer::inflate method doesn't know about the constant
   folder special value, so it tries to allocate a buffer of that size.

The safest fix for now is to clear the output and return early if all
inputs are single value.

The problem is that this issue might happen for other nodes that also
satisfy the 3 issues above, that is, uses inflate and can be constant
folded. I manually checked for such nodes and there are no nodes that
satisfy all three, so hopefully this is isolated to the Double Edge Mask
node.

Pull Request: https://projects.blender.org/blender/blender/pulls/130163
2024-11-12 12:53:23 +01:00
Pratik Borhade
4e907829d3 Fix #128099: Outliner isolate collection tweaks linked data
Mistake in e494a44024
Even though collection/object PointerRNA argument is same in most cases,
use `layer_or_collection_prop` in if() before assigning value to
collection property (`base_or_object_prop`argument value is  null in function
call from `_isolate_flag()`).

Pull Request: https://projects.blender.org/blender/blender/pulls/129250
2024-11-12 12:07:59 +01:00
Falk David
32c76ee768 Fix: GPv3: Unused parameter in remove_from_vertex_group
Caused by 5585d29d30.
Forgot to remove the parameter.
2024-11-12 11:56:59 +01:00
Pratik Borhade
5585d29d30 Fix: GPv3: Vertex group functions edit all keyframes
Instead of looping through all drawings in the vertex group kernel
function, loop through all/visible drawings in the operators and
pass a single drawing to `remove_from_vertex_group`.

Continuing !129789.

Co-authored-by: Falk David <falk@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/129890
2024-11-12 10:44:59 +01:00
Sybren A. Stüvel
ae5717905b Fix #130090: Grease Pencil object in NLA cause Blender to crash
Add some missing `nullptr` and `ale->type` checks to ensure the
assmptions the rest of the code makes holds.

The direct cause of this issue is likely
822907a68d. The root cause is the hard to
predict behaviour of the animation filtering system combined with a lot
of pointer casts without testing whether the data is actually of the
expected type.

Pull Request: https://projects.blender.org/blender/blender/pulls/130148
2024-11-12 10:19:27 +01:00
Pratik Borhade
1d14390f99 Fix #129297: Gizmo missing for unlocked layer when autolock inactive is on
`set_active_node` call from `grease_pencil_copy_data` resets inactive
layer again as locked before executing the drawing code. Since property
is only operated on layers, it is possible to remove the code from
`set_active_node()` and only have it in `set_active_layer()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/129465
2024-11-12 09:09:28 +05:30