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
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
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
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
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
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
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
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
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
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.
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
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.
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
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
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
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
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
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
`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