Commit Graph

114500 Commits

Author SHA1 Message Date
Clément Foucault
d9ff375e7e GPU: GLSL-C++ Stubs: Make compilation possible
- Add `main` workaournd.
- Define out create info class when compiling with stubs.
- Move interfaces and info namespace to global namespace.
2024-11-01 23:38:22 +01:00
Clément Foucault
01236be188 Cleanup: GPU: Remove unused shader files
These shaders have not been used for a long time.
2024-11-01 23:36:45 +01:00
Hans Goudey
6be43ffb4d Cleanup: Properly handle all subdiv shader cases with enum type
Add asserts for invalid shader types, use a proper enum type,
and move the number of shaders to not be a shader type.
2024-11-01 22:25:27 +01:00
Hans Goudey
f736c1aa93 Merge branch 'blender-v4.3-release' 2024-11-01 21:27:55 +01: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
Clément Foucault
e311c6dd4f Cleanup: Metal: Fix clang tidy warnings
_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/129656
2024-11-01 20:23:18 +01:00
Hans Goudey
2e4da3bf60 Cleanup: Reduce indentation in UI panel function 2024-11-01 20:14:56 +01:00
Hans Goudey
f59b39812b Cleanup: Remove empty namespace section in BKE_paint_bvh.hh 2024-11-01 20:14:36 +01:00
Hans Goudey
4a08d48906 Refactor: Sculpt: Store active vert as int for multires
The impetus is removing the `BKE_subdiv_ccg.hh` include from
`BKE_paint.hh`, but I also think this is a bit of a simplification in
general. There's often no need for a special type to reference a
`SubdivCCG` vertex, which is a lot like `Mesh` but with a different
topology format.

Pull Request: https://projects.blender.org/blender/blender/pulls/129687
2024-11-01 20:01:44 +01:00
Hans Goudey
9b97ba1462 Cleanup: GPU: Avoid raw pointers for shader API strings
Avoid measuring the length of strings repeatedly by passing their
length along with their data with `StringRefNull`. Null termination
seems to be necessary still for passing the shader sources to OpenGL.
Though I doubt this is a bottleneck, it's still nice to avoid overhead from
string operations and this helps move in that direction.

Pull Request: https://projects.blender.org/blender/blender/pulls/127702
2024-11-01 20:00:31 +01:00
Sean Kim
6df437be5f 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 of the
`StrokeCache` is only updated at the beginning of the stroke. It 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.

Additionally, the operator level `pen_flip` property is moved to the
generic paint stroke operator instead of being defined as a property of
the `OperatorStrokeElement` struct. This value is now only calculated
at the beginning of the stroke instead of before each stroke step.

Pull Request: https://projects.blender.org/blender/blender/pulls/129559
2024-11-01 19:43:20 +01:00
Sean Kim
c542241e1c Refactor: Remove PBVHFrustumPlanes
The PBVHFrustumPlanes `struct` is a thin wrapper around a collection of
`float4`s, each representing a plane. This commit removes this concept
in favor of static sized `std::array<float4, 6>` to avoid errors when
indexing into the collection and uses `Span`s when performing tests
against AABBs

Pull Request: https://projects.blender.org/blender/blender/pulls/129609
2024-11-01 19:41:00 +01:00
Sean Kim
d242a969fe Merge branch 'blender-v4.3-release' 2024-11-01 11:26:46 -07: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
Clément Foucault
9ee81411bf GPU: Multithread compilation of shaders during tests 2024-11-01 18:57:22 +01:00
Clément Foucault
d2c378984d Cleanup: GPU: Avoid glsl functions with only one void argument 2024-11-01 18:57:22 +01:00
Julian Eisel
8309c22387 Merge branch 'blender-v4.3-release' 2024-11-01 18:06:02 +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
Hans Goudey
3d6e1c7bac Fix: Mistake in previous paint BVH cleanup commit
55cf0925ec
2024-11-01 17:36:57 +01:00
Hans Goudey
0be2535369 Cleanup: Remame PBVH headers to "paint BVH"
The PBVH struct is now called `bke::pbvh::Tree`. Expanding the acronym
in the file name just a little should help developers find things and make
the connection to the "paint" concept that loosely ties sculpt mode and
other painting modes together a little stronger.

This rename also lets us replace the weird `_api.hh` historical part of
the file name without reusing the old `BKE_pbvh.hh` file name, which
would have probably made understanding the git history a bit harder.

Pull Request: https://projects.blender.org/blender/blender/pulls/129684
2024-11-01 17:27:07 +01:00
Sybren A. Stüvel
bccf622672 Fix #129490: Anim: F-Curve only shown as error when no slot users resolve
Fix a bug where F-Curves in the Action editor were only shown in 'error'
state when none of the slot users could resolve the property.

The error line is now shown whenever the active object (or more
formally, the ID for which the Action editor is drawn) cannot resolve
the F-Curve's RNA path.

The lookup of the RNA path to determine the F-Curve's label is still
looping over all users of the action slot, in a best-effort attempt to
figure out the proper name for the thing. This means that "finding the
name" and "finding the error state" are now at least a little bit
separated from each other.

Pull Request: https://projects.blender.org/blender/blender/pulls/129692
2024-11-01 17:26:30 +01:00
Hans Goudey
9a17a6a154 Fix: Deduplicate/correct curves point selection calculation
The grease pencil version of the code had a race condition, appending
to a vector from multiple threads.
2024-11-01 16:59:52 +01:00
Sybren A. Stüvel
bb0be5e4dc Fix #129530: ANIM: FPS drop due to invalid RNA paths
The playback FPS drop was caused by a debug `printf()` call. Its' been
replaced with a call to `CLOG_INFO()` with a log level of `4`, so that it's
available when necessary but no longer eats up performance due to the I/O.

Pull Request: https://projects.blender.org/blender/blender/pulls/129685
2024-11-01 16:31:22 +01:00
Hans Goudey
16b7e5c7dd Cleanup: Sculpt: Remove unnecessary/indirect includes
With the aim of reducing unnecessary header parsing to improve
compile times.
2024-11-01 16:24:45 +01:00
Julian Eisel
68a74c4095 Merge branch 'blender-v4.3-release' 2024-11-01 15:34:39 +01:00
Julian Eisel
ba5eda5068 Revert "Attempt to fix missing asset library refreshes"
This reverts commit c71a6a5304.

Didn't mean to push this commit, it's part of a pull request pending
review (!129541). Just had this commit on my local 4.3 release branch
when merging it into main.
2024-11-01 15:32:20 +01:00
Julian Eisel
75c25a7650 Merge branch 'blender-v4.3-release' 2024-11-01 15:27:17 +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
3909d8e1dc Cleanup: Remove some unnecessary includes from BKE_paint.hh 2024-11-01 15:15:25 +01:00
Hans Goudey
55cf0925ec Cleanup: Sculpt: Move BVH node flag to C++ namespace/class 2024-11-01 15:08:40 +01:00
Hans Goudey
45f28ab599 Cleanup: Sculpt: Simplify arguments to node debug drawing
These are either always a certain value or retrievable from the node.
2024-11-01 15:01:15 +01:00
Hans Goudey
7853f07ca3 Cleanup: Sculpt: Remove redundant PBVH header
There is no need to have both `BKE_pbvh_api.hh` and `BKE_pbvh.hh`.
This commit removes the latter, moving the few remaining items to
the former, which will be renamed later.
2024-11-01 14:31:45 +01:00
Hans Goudey
0a05debe49 Cleanup: Sculpt: Improve some PBVH comments 2024-11-01 13:56:02 +01:00
Clément Foucault
47f7aaa2cc Merge branch 'blender-v4.3-release' 2024-11-01 12:16:38 +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
Hans Goudey
509090e7c3 Subdiv: Remove evaluator C-API wrapper
Similar to 5e46e3d28a.

This commit replaces the C-API version of `OpenSubdiv_Evaluator`
with direct calls to `EvalOutputAPI`. This removes a level of indirection,
theoretically reducing function call overhead, but also making the whole
system easier to understand and easier to modify. The downside is
further spread of `WITH_OPENSUBDIV` into the code, but I think that
can be improved in the future relatively easily once more of this sort
of change is finished.

Pull Request: https://projects.blender.org/blender/blender/pulls/128278
2024-11-01 09:42:33 +01:00
Richard Antalik
63dabd3e37 Merge branch 'blender-v4.3-release' 2024-11-01 02:08:55 +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
Sean Kim
dd7064b2e1 Cleanup: Various non-functional changes for paint_stroke.cc
This commit applies the following changes:
* Use c++ math types instead of float / int arrays where possible
* Use c++ math library where c++ math types are used
* Use const where possible
* Reduces scope of variables where possible
* Clarifies some variable naming (e.g. d prefix to _delta suffix)

The main areas left untouched are anything that is part of a public
function signature to avoid making changes in many different files at
once.

Pull Request: https://projects.blender.org/blender/blender/pulls/129576
2024-10-31 21:11:59 +01:00
Sean Kim
3ff2733279 Cleanup: Sculpt: Remove PBVH frustum plane and related calculation
The recent refactor of sculpt mode drawing (d601bf7e) removed usage of
the update frustum planes. This makes storage of this data inside the
PBVH also unnecessary. If this feature needs to be reimplemented in the
future, the storage of the planes should be outside of the PBVH `struct`

Pull Request: https://projects.blender.org/blender/blender/pulls/129649
2024-10-31 21:10:31 +01:00
Hans Goudey
77a7671f54 Cleanup: Avoid writing sculpt session runtime pointer to files
`SculptSession` is a runtime struct that should really be stored in
`ObjectRuntime` instead of `Object`. Writing pointers to it in files
is misleading because the struct itself isn't serialized.

Pull Request: https://projects.blender.org/blender/blender/pulls/129233
2024-10-31 17:48:57 +01:00
Christoph Lendenfeld
00319f70d0 Merge branch 'blender-v4.3-release' 2024-10-31 17:41:04 +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
859e4c8465 Merge branch 'blender-v4.3-release' 2024-10-31 17:11:44 +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
Sergey Sharybin
981ab904ba Merge branch 'blender-v4.3-release' 2024-10-31 16:05:22 +01:00