Commit Graph

113958 Commits

Author SHA1 Message Date
Philipp Oeser
bdfb3ea6e7 Fix #129727: GPv3: renaming bones does not rename vertex groups
First issue is that `BKE_modifiers_uses_armature` wasnt working for GP
objects and the second one is that vgroup names are stored in
CurvesGeometry for GP (so that needs special handling, now done, same as
in `BKE_object_defgroup_set_name`).

Pull Request: https://projects.blender.org/blender/blender/pulls/129794
2024-11-04 17:00:51 +01:00
Sybren A. Stüvel
6f0cd39eab Fix: GPv3: Crash in transform snapping code
Fix a crash in transform snapping code, where NLA retiming was attempted
on Grease Pencil frames.

Pull Request: https://projects.blender.org/blender/blender/pulls/129808
2024-11-04 16:44:18 +01:00
Omar Emara
a1b489ec71 Fix #129670: Curves not drawn outside of clip range
Curve maps in nodes like RGB Curves are not drawn nor evaluated outside
of clipping range. This is a regression in 8812be59a4, where the range
of the curve didn't account for points that lie outside of the clipping
range. That's because the table_range variable was initialized before
the loop that updates the minimum and maximum points of the table.

To fix this, we move the table_range initialization after the loop that
updates the minimum and maximum points of the table.

Pull Request: https://projects.blender.org/blender/blender/pulls/129777
2024-11-04 16:11:43 +01:00
YimingWu
ecba71ae91 Fix #129738: GPv3: Build modifier use key frame
Build modifier should start building strokes at a key frame, not always
assume a starting frame of 0.

Frame restriction works the same way as GPv2, which uses absolute
frame number.

Pull Request: https://projects.blender.org/blender/blender/pulls/129774
2024-11-04 15:33:11 +01:00
Pratik Borhade
f6bd812c68 Fix #129671: GPv3: Cut tool not respecting material lock setting
Instead of looping over entire curve range, get editable stroke mask to
iterate on curves for finding out whether they intersect with lasso gesture.

Pull Request: https://projects.blender.org/blender/blender/pulls/129714
2024-11-04 14:04:18 +01:00
Pratik Borhade
d943c9f128 Fix #128831: GPv3: Crash when adding action track
When grease pencil has no actions (ale->adt), id data block channel is
still added due to `ANIMFILTER_ANIMDATA`. This would lead to crash if
operator is accessing the AnimData (ale->adt). To fix this, make sure
adt exists before creating an animchannel.

Pull Request: https://projects.blender.org/blender/blender/pulls/128841
2024-11-04 17:59:26 +05:30
Falk David
df0c567380 Fix #129781: GPv3: Memory leak in the edit batch cache
Introduced by 5fff95f519.
The commit forgot to free the `cache->edit_points_vflag`.
The fix frees the buffer in `grease_pencil_batch_cache_clear`.

Pull Request: https://projects.blender.org/blender/blender/pulls/129786
2024-11-04 12:13:04 +01:00
Hans Goudey
af58c223a4 Fix #129598: Resample curves node missing type alignment handling
The 4x4 matrix type has a larger alignment requirement of 16 bytes
than the default, but it was stored in a generic vector of bytes. There
are a few solutions that reduce the memory reuse in this code path--
the chosen solution uses a custom allocator which always allocates
with an alignment that should be large enough for anything.

Generally I think this resampling loop could be rewritten to be a bit
simpler, avoiding these problems in the first place. Some performance
testing would show whether this "fancy" memory use between types
and loop structure is actually worth it. For now though, just correcting
the existing logic seems like the best choice.

Pull Request: https://projects.blender.org/blender/blender/pulls/129628
2024-11-04 11:44:06 +01:00
Damien Picard
edcc5e0e87 I18n: Translate and disambiguate a few messages
Translate
- Extract Grease Pencil modifier subpanel header messages.

Disambiguate
- Integer Math node operation (same as other existing math nodes).

Pull Request: https://projects.blender.org/blender/blender/pulls/128715
2024-11-04 11:15:48 +01:00
Marco Rotili
b6481372b9 Fix #129629: Crash when applying Geometry Nodes modifier on all keyframes on a Grease Pencil object
The input `md_eval` is invalidated when calling `BKE_scene_graph_update_for_newframe`.

The fix uses `BKE_modifier_get_original` to pass the original modifier
to `apply_grease_pencil_for_modifier_all_keyframes` then calls `BKE_modifier_get_evaluated`
after `BKE_scene_graph_update_for_newframe` to ensure the `md_eval` pointer is valid.

Pull Request: https://projects.blender.org/blender/blender/pulls/129732
2024-11-04 10:38:46 +01:00
Jesse Yurkovich
673f6dbb7f Fix #129725: Handle case of no animation keys during Collada export
Regression from 629b3ccd42

Guard against `BKE_key_from_object` returning null.

Pull Request: https://projects.blender.org/blender/blender/pulls/129760
2024-11-04 05:28:36 +01:00
Jesse Yurkovich
60d88f46ba Fix: STL import crash when unable to open or read file
Regression from d1455c4138

Ensure we return from `importer_main` if no mesh could be loaded with
`read_stl_file` (e.g. `bpy.ops.wm.stl_import(filepath="<nope>")`)

Pull Request: https://projects.blender.org/blender/blender/pulls/129759
2024-11-04 04:38:15 +01:00
Richard Antalik
2a32b26415 Fix: VSE: Use after free in retiming
Caused by incorrectly initializing temporary range of `for` loop.

Pull Request: https://projects.blender.org/blender/blender/pulls/129659
2024-11-04 03:16:13 +01:00
Campbell Barton
02571da35f PyDoc: correct GPUIndexBuf doc-string & exception 2024-11-04 11:55:41 +11:00
Campbell Barton
3bab869c0d Fix BMeshElemSeq.sort(key=None) argument
Allow passing key=None to BMesh element sorting callback,
matching the doc-string & Python's list sort.
2024-11-04 11:55:37 +11:00
Sean Kim
43bbd9fd2d Fix: Paint: Unified strength value should be off by default
Introduced in 1bc5c488d4

The value used in DNA_scene_defaults.h was out of sync with the actual
default startup value. In all currently supported and in development
versions (3.6 LTS, 4.2 LTS, 4.3, and 4.4), the `UNIFIED_PAINT_ALPHA`
bit value is set to false.

Pull Request: https://projects.blender.org/blender/blender/pulls/129711
2024-11-04 00:07:29 +01:00
Campbell Barton
470173bbc4 PyDoc: use keyword only specifier for bpy.props & bpy.ops 2024-11-03 21:50:33 +11:00
Campbell Barton
091ee2833b PyDoc: replace references to the deprecated "bgl" with "gpu"
Also correct bullet-points in gpu.state.blend_set.
2024-11-03 21:50:33 +11:00
Campbell Barton
b00550916c PyDoc: correct use of single back-ticks 2024-11-03 21:50:33 +11:00
Campbell Barton
3bcfb151c1 PyDoc: use Python's type annotation syntax for doc-strings
Replace plain-text type information with the type syntax used
for Python's type annotations as it's more concise, especially for
callbacks which often didn't include useful type information.

Note that this change only applies to inline doc-strings,
generated doc-strings from RNA need to be updated separately.

Details:

- Many minor corrections were made when "list" was incorrectly used
  instead of "sequence".
- Some type information wasn't defined in the doc-strings and has been
  added.
- Verbose type info would benefit from support for type aliases.
2024-11-03 15:44:35 +11:00
Leon Schittek
3347aa4017 Fix: Geometry Nodes: Matrix socket not connecting after link-drag search
Ensure the matrix socket is made available, when connecting to it via
the link-drag search.

Pull Request: https://projects.blender.org/blender/blender/pulls/129713
2024-11-02 17:03:42 +01:00
Jacques Lucke
0c2a70e970 Fix: crash using Edit Minimum Distance operator
This fixes two crashes related to freeing the operator data incorrectly and too early.
2024-11-02 12:17:41 +01:00
Campbell Barton
a05345e139 PyDoc: various corrections to function doc-strings
Add missing arguments, corrections & remove unchecked type info.
2024-11-02 17:48:21 +11:00
Campbell Barton
4df285ccd5 Cleanup: move function comments into headers or implementation notes
For C/C++ doc-strings should be located in headers,
move function comments into the headers, in some cases merging
with existing doc-strings, in other cases, moving implementation
notes into the function body.
2024-11-02 17:27:09 +11:00
Campbell Barton
c5222a3953 Cleanup: quiet variable unused warning 2024-11-02 15:43:29 +11:00
Campbell Barton
99387c0749 Cleanup: spelling in comments, docs & error 2024-11-02 15:43:27 +11:00
Campbell Barton
e7e6bf1dfe Fix memory leak in mathutils.geometry.box_pack_2d
The set macro doesn't handle the reference count for existing values.
2024-11-02 15:08:42 +11:00
Hans Goudey
c38484107f Fix #129697: Crash renaming node interface input to empty string
Caused by trying to construct a `std::string` from `nullptr`.
2024-11-01 21:27:25 +01:00
Sean Kim
8151105e24 Fix #129645: Sculpt color attribute popover never active
With the brush assets project, many paint tools are no longer specified
by tool. To maintain functionality, this commit inspects the brush type
instead of hardcoding against the paint tool to ensure that no matter
which tool is being used, the UI displays correctly based on the brush.

Pull Request: https://projects.blender.org/blender/blender/pulls/129654
2024-11-01 19:23:16 +01:00
Julian Eisel
a859ed1130 Fix: All asset library not refreshed as available libraries change
Fixes #128751.

As asset libraries were added or removed (through the UI or BPY), the
"All" asset library wouldn't refresh to reflect the changes. In general
this wasn't handled well. Even a manual refresh wouldn't give the right
result.

There were multiple issues really:
- Only the first load of the "All" library would query the preferences
  for the available libraries. Further loads would only refresh the
  catalogs, ignoring any added/removed libraries.
- Operators and BPY functions didn't clear the asset libraries to
  enforce a re-fetch.
- When clearing an asset library, the "All" library wasn't cleared in
  some cases, it would show the old state still.
- The API function to clear an asset library's asset list would not
  clear the storage of asset browsers so they wouldn't refresh. It makes
  no sense to only do one, so let the API handle both cases.

The way we handle asset library updating could be improved generally,
and be more internal to the asset system. For now this explicit clearing
seems fine.

We also need to handle removal of libraries better still, I think they
remain in memory.

Pull Request: https://projects.blender.org/blender/blender/pulls/129541
2024-11-01 18:02:54 +01:00
Julian Eisel
a641001207 Fix: UI previews don't refresh outside of properties editor
The preview template (`UILayout.template_preview()`) to display previews
for materials, textures or similar would only work correctly in the
Properties editor. This had explicit logic to trigger rerendering on
changes. When displaying such previews elsewhere (e.g. in the 3D View
sidebar), the only way to have changes reflected would be by resizing
the preview.

This fix makes sure such previews are tagged as dirty and refreshed on
changes to the underlying ID. We do this the same way as tagging the ID
previews as dirty, through a function called by the dependency graph for
such updates.

Pull Request: https://projects.blender.org/blender/blender/pulls/129641
2024-11-01 15:25:24 +01:00
Hans Goudey
37e35147d8 Fix: PanelType unregister potential use-after-free
There are two issues here. First, the instanced panel freeing uses
the panel type after it's been freed a few lines up in this function.
Second, while panel types are registered for a single space type,
there are cases where they're used in multiple space/region types
anyway. Because of that, removing the dangling pointer of the freed
type from just the registered region & space type combination isn't
enough, we need to process all regions.

Pull Request: https://projects.blender.org/blender/blender/pulls/129676
2024-11-01 12:14:44 +01:00
Jason Fielder
7fbc9e9428 Fix: Metal: Memory leaks identified by Instruments and Xcode memory graph.
Running Xcode memory graphs and the Instruments tools revealed
memory leaks caused, in the main, by over-retained objects.
This removes the unnecessary 'retains' and adds some asserts
to guard against over-retaining in the future.

There are a few memory leaks remaining involving PyUnicode_DecodeUTF8
but I am unable to identify the cause of these at this time.

Authored by Apple: James McCarthy

Pull Request: https://projects.blender.org/blender/blender/pulls/129117
2024-11-01 11:56:51 +01:00
Richard Antalik
9ef6136865 Fix #126273: Retiming movies with mismatched FPS is broken
There were lot of places, where timeline frame was incorrectly
mapped to frame index.

For deleting transitions, internal  function `seq_retiming_add_key`
was added. It can work in frame index domain directly. This is to avoid
adding more complexity, since key positions are stored and re-created
later. Going  through index to frame and back to index would introduce
float precision errors.

Pull Request: https://projects.blender.org/blender/blender/pulls/129305
2024-11-01 02:07:53 +01:00
Richard Antalik
ba59908dc8 Fix #129226: Retiming transition to faster speed does not work
Caused by comparing speed of segment before transition and transition
itself. It should compare speed of segment after transition instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/129610
2024-11-01 02:06:44 +01:00
Richard Antalik
d50d1e757b Fix #129583: Retiming controls are drawn even if strip is too small
Hide retiming controls if strip height or width is smaller than
threshold.

Pull Request: https://projects.blender.org/blender/blender/pulls/129612
2024-11-01 02:04:59 +01:00
Christoph Lendenfeld
d31ec42d24 Fix #129606: inserting keys not deselecting other keys in certain case
The issue was that when inserting a key, other keys weren't deselected
even though that feature was implemented with 6ef77a0d22
That only happened if no FCurve channel was selected in the channel list.

It turns out, that the intent of using the animfilter flags from
the editor was wrong. The animfilter code already checks the editor
flags based on the `bAnimContext` that is passed in.
In fact the drawing code itself has hardcoded flags.

So the fix is to use hardcoded flags as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/129636
2024-10-31 17:39:25 +01:00
Falk David
50f01f4dce Fix #129252: GPv3: Primitive tool doesn't write to fill_opacity attribute
The primitive tool didn't write to the `fill_opacity` attribute meaning that primitives wouldn't
show up correctly when using fill materials with a strength < 1.

The fix does multiple things:
* Make sure to create and write to the `fill_opacity` attribute if necessary.
* Remove the `skipped_attribute_ids` function and build the set of attributes to skip
   where the attributes are written to. This is more flexible.

Pull Request: https://projects.blender.org/blender/blender/pulls/129644
2024-10-31 17:10:48 +01:00
Falk David
ed50dd0efe Fix #129295: GPv3: Snap Cursor to Selected includes locked layers
Snapping the 3D cursor to a grease pencil selection would include
locked layers in the computation of the centroid. This is inconsistent
with 4.2.
The fix makes sure that we skip over layers that are locked.

Pull Request: https://projects.blender.org/blender/blender/pulls/129639
2024-10-31 16:19:13 +01:00
Falk David
e6ade18707 Fix #129266: GPv3: Layer Groups hide masks by default
Previously, we initialized the layers and groups to hide masks.
For layers this makes sense, because they don't have any masks
by default, but for groups it makes more sense to show masks
by default for all the layers inside.

Pull Request: https://projects.blender.org/blender/blender/pulls/129528
2024-10-31 15:38:54 +01:00
Hans Goudey
e65f48e8e2 Fix #128938: Crash duplicating paricle system in particle edit mode
In lieu of fixing the root cause, this commit requires the object to be
in object mode to duplicate particle systems, which works around the
issue because the problem is with particle edit data. This is a pragmatic
choice to focus development efforts on replacing the particle system.
2024-10-31 15:16:09 +01:00
Hans Goudey
443cb9ff9e Fix #128945: Crash switching modes after duplicating particle system
The particle system's mirror cache wasn't cleared on the new system,
so it was freed twice when cleaning up all the particle edit mode data.
2024-10-31 14:31:24 +01:00
Falk David
ab89e367da Fix #129518: GPv3: Crash entering edit mode with locked layers
Introduced with 5fff95f519.
There were several issues:
* The indices into `edit_points_vflag` are incorrect. They need to be offset
  by the start offset of the drawing.
* The code was writing to `edit_points_vflag` even if the layer is locked.
  But the size of the `edit_points_vflag` buffer is not counting locked layers.

Pull Request: https://projects.blender.org/blender/blender/pulls/129625
2024-10-31 12:56:58 +01:00
Campbell Barton
2a2ad0c662 Fix error in recent fix for Rotate Edges
k
Commit [0] accidentally removed a check for edges not to rotate.

[0]: a0491899f0
2024-10-31 21:53:18 +11:00
Falk David
dc80fe879b Fix #129333: GPv3: Crash when selecting bezier curves
Introduced by 74129b648b.
The issue was that the code didn't check if the selection attribute
exists which it might not.

Pull Request: https://projects.blender.org/blender/blender/pulls/129623
2024-10-31 11:48:08 +01:00
Campbell Barton
5b53ff078d Fix "Apply Modifier as Shape" ignoring Alt to apply to selected
The property was set & checked but the operator didn't define it.
2024-10-31 18:45:46 +11:00
Campbell Barton
a0491899f0 Fix "Rotate Edges" iterating over freed edges
Rotating an edge deletes the edge and creates a new edge
however these edges were being iterated over and had their indices
checked.

In practice this wasn't causing use-after-free errors because the
edges are part of a BLI_mempool, nevertheless using freed elements of a
memory-pool should be avoided.
2024-10-31 18:45:45 +11:00
Campbell Barton
29e184596e Fix error accessing invalid stack memory joining areas from a shortcut
Avoid relying on an area lookup with off-screen coordinates,
check if the properties were set instead.
2024-10-31 18:45:44 +11:00
Campbell Barton
2aeba0e8f1 Fix: MEM_freeN/MEM_delete mismatch with the image save operator 2024-10-31 18:45:43 +11:00
Campbell Barton
c9d19422f0 Fix memory leak in edit-font toggle style
FONT_OT_style_toggle returned `true` instead of the canceled flag
causing it to run as a modal operator which leak memory from it's
reports when called from Python.
2024-10-31 18:45:42 +11:00