Commit Graph

113939 Commits

Author SHA1 Message Date
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
Campbell Barton
d797e9a203 Fix memory leak in "External File Operation" on non WIN32 systems 2024-10-31 18:45:41 +11:00
Campbell Barton
aeac1ab73e Fix crash calling UV picking actions without an active region 2024-10-31 18:45:40 +11:00
Campbell Barton
891db9a3ec Fix crash calling vertex slide without an active region 2024-10-31 18:45:39 +11:00
Campbell Barton
34ebdfacb0 Fix crash accessing WM capabilities in background mode 2024-10-31 18:45:39 +11:00
Campbell Barton
7a9d3e9973 Fix crash framing the camera to geometry in mesh edit-mode 2024-10-31 18:45:38 +11:00
Sean Kim
f52ee63114 Fix: Anchored, Line, Drag Dot stroke types do not support pen flip mode
While these modes do not use tablet pressure, they should still read
event data so that the pen status is set correctly.

Pull Request: https://projects.blender.org/blender/blender/pulls/129574
2024-10-30 22:57:42 +01:00
Hans Goudey
a48f7f67f7 Fix #129550: Node group default width not working for link-drag-search
When this feature was added we missed accounting for it in
all places where node groups were added.
2024-10-30 17:40:39 +01:00
James Fulop
42657cd1b6 Tests: add BLI_path_slash_* tests
Ref !127304
2024-10-30 13:07:33 +11:00
Hans Goudey
c4d22839b4 Cleanup: Typo in variable name, consistent naming 2024-10-29 23:48:22 +01:00
Hans Goudey
eaafe7218e Fix: Wrong change in refactor of paint smear brush
Mistake in 437cb33a73.
Found while investigating #129504. Personally I don't notice
a change in behavior, but the original code, as convoluted as it
was/is, clearly tried to iterate over neighbors of neighbors rather
than iterating over neighbors twice.

Pull Request: https://projects.blender.org/blender/blender/pulls/129557
2024-10-29 23:45:58 +01:00
Hans Goudey
9a0d4dbd04 Fix #129504: Color smear brush performance regression
For cases where a small fraction of a PBVH node is processed,
missing skipping of vertices outside of the brush radius causes
a noticeable regression. Typically we tried to avoid this sort of
filtering because it should be redundant with lowering the BVH
node size and it interferes with some other code simplicity goals.
But adding factor filtering back is a very small change.
2024-10-29 23:45:38 +01:00
Sean Kim
aa937b1cab Fix #128859: Undoing sculpt with deform modifier active doesn't work
Prior to this commit, there was an attempt to remove extra data stored
at the Sculpt Undo `Node` level, specifically an extra position array
used when a deform modifier was in the stack.

The prior commit attempted to perform the undo step by calculating a
translation between the current positions and the previous unode
position and using that as the input to the deformation process.
However, this resulted in the undo not being completely applied to the
mesh and the data remaining in a weird state.

To fix this, this commit reintroduces some previously removed functions
and constructs to perform this restore step by swapping data if
necessary. We choose to not simply revert the change that applied this
as we want to eventually reinvestigate this path, but for the imminent
4.3 release, it makes more sense to restore previous behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/129496
2024-10-29 22:43:11 +01:00
Sean Kim
d1e78481e2 Fix #129519: Topology automasking stops working on multires level switch
The topology island cache needs to be freed when changing multires
levels so that it can be recalculated and be valid for a given level. To
fix this, this commit adds the `invalidate` call to the
`BKE_sculptsession_free_pbvh` method, which consolidates similar
lifecycle behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/129549
2024-10-29 22:32:53 +01:00
Sean Kim
e48657eb8a Revert "Fix #126939: Smooth / Enhance Details brush crash when using tablet"
This reverts commit 304800db73.
2024-10-29 14:04:34 -07:00
Richard Antalik
1fadc4b5e3 Fix: VSE: Handle tweaking does not work when retiming key is selected
`select_handle` operator did return passthrough when retiming key was
selected. This was incorrect behavior. To prevent translating retiming
keys, retiming selection must be cleared as well.

Reported in #126273

Pull Request: https://projects.blender.org/blender/blender/pulls/129289
2024-10-29 21:20:21 +01:00
Sean Kim
304800db73 Fix #126939: Smooth / Enhance Details brush crash when using tablet
Prior to this commit, the brush action was determined on a step by step
basis by peeking at the `StrokeCache` `bstrength` property and
determining which brush to use based on if the value was negative or
not. The sign of this value, however, was not static across the
entirety of a brush stroke, as it is calculated from three separate
fields, one of which could vary over the course of a stroke when using a
tablet, the `pen_flip` property.

To fix this issue, this commit ensures the `pen_flip` field is only
updated at the beginning of the stroke and also adds a new boolean to
store the initial direction of the stroke to reduce further ambiguity
when comparing the sign of the brush strength.

Pull Request: https://projects.blender.org/blender/blender/pulls/129184
2024-10-29 21:10:19 +01:00
Sean Kim
1bc5c488d4 Sculpt: Use unified color for paint brushes by default
With the introduction of brush assets, there are now two reasons that
motivate turning this setting on by default.

* More paint brushes - Previously, there was a single paint brush in
  Sculpt mode, this made the setting for general usage less needed when
  compared to the 10 brushes that are now included in the essentials
  pack

* Brush settings are lost on reload - Unless the changes to a brush are
  saved to the asset as a default, the color for a brush is now no
  longer persisted between Blender sessions. It makes little sense to
  save a specific color for a specific brush on the asset level unless
  it is needed for the brush functionality.

This commit ensures that the appropriate Scene flag is set for the
unified color and defines the default primary and secondary colors as
000000 and FFFFFF, respectively.

Pull Request: https://projects.blender.org/blender/blender/pulls/129127
2024-10-29 21:08:14 +01:00
Anthony Roberts
3438bb8e3c Windows: Implement warning on Splash Screen regarding emulated builds on ARM64
This adapts the work initially done in #124382 to extend to Windows builds.

Pull Request: https://projects.blender.org/blender/blender/pulls/129521
2024-10-29 17:44:30 +01:00
Falk David
18144705cf Fix #129353: GPv3: Crash when using Catmul-Rom curve type
Introduced by 5fff95f519.
The issue was that the `edit_points_vflag` buffer is of size `total_points_num`
which is based on the number of control points not evaluated positions.
The fix is to use `points_by_curve` instead of `points_by_curve_eval`
to get the right start and end indices.

Pull Request: https://projects.blender.org/blender/blender/pulls/129526
2024-10-29 15:12:20 +01:00