Commit Graph

26914 Commits

Author SHA1 Message Date
Julian Eisel
489a5e92b8 Cleanup: Remove now unused asset identifier files
Missed this in 693e590d9f.
2024-07-26 15:12:51 +02:00
Julian Eisel
693e590d9f Refactor: Assets: Remove unnecessary asset identifier class
This was just rather useless level of abstraction. I heard from other
devs that these helper classes caused confusion, so better to avoid
this.

Now the asset representation has all the needed bits to create its full
path, blend-file path and asset library relative path. In fact only the
asset library relative path needs to be stored to make all this
available, since the asset representation already stores a reference to
the asset library owning it, so the paths can be recreated easily.
2024-07-26 15:03:06 +02:00
Sybren A. Stüvel
c7bf1a697e Anim: forward compatibility for F-Curves in layered Actions
When writing a layered Action to disk, take the F-Curves from the
first keyframe strip and write that as `action.curves` as well. This
will make older Blender versions see those curves and load them
properly.

Only the curves for the first slot are written this way. This means
that any legacy Action that was converted to a layered Action will be
loaded again properly by older Blender versions. Of course this is
limited to a single layer, single strip, and single slot -- once the
newer features are used, older versions of Blender will not be able to
see this extra data.

When an Action contains multiple slots, so with animation for multiple
distinct objects, the forward compatibility becomes a bit iffy. Older
versions of Blender will just see a legacy Action, with its legacy
semantics, and thus all objects that use that Action will receive the
exact same animation data. I don't think there's a way around this.
(_Unless we start breaking up Actions into an Action per slot, alter
the assignments, and then store metadata so that modern Blenders can
reassemble them. I do not think this is a good idea._)

Ref: #124714

Pull Request: https://projects.blender.org/blender/blender/pulls/125065
2024-07-26 11:13:40 +02:00
Sean Kim
6568629520 SubdivCCG: Add to_index helper method
This commit adds a method to compute the position of a given
SubdivCCGCoord in an appropriately sized array.

Pull Request: https://projects.blender.org/blender/blender/pulls/125462
2024-07-26 04:35:34 +02:00
Hans Goudey
d24957450c Cleanup: Remove unused BMesh fairing function 2024-07-25 13:45:00 -04:00
Hans Goudey
88b6910d06 Cleanup: Sculpt: Remove unnecessary allocation, use references 2024-07-25 13:45:00 -04:00
Harley Acheson
5bf44c6eb4 UI: Text Style for Tooltips
This gives users the ability to control the size of tooltip text
separately from other text styles. This is an accessibility issue
in that users with low vision can choose to make these larger than
the working text.

Pull Request: https://projects.blender.org/blender/blender/pulls/125147
2024-07-25 19:12:41 +02:00
Hans Goudey
4742fa7f40 Refactor: Sculpt: Remove BMesh custom data offset from BVH tree
Instead just compute the offsets as necessary. This avoids the need
to keep them in sync as the BMesh changes, though it requires passing
a few more arguments in the dynamic topology remeshing code.
2024-07-25 12:40:14 -04:00
Hans Goudey
6155c72237 Refactor: Sculpt: Remove PBVH BMesh log pointer
This log is owned by SculptSession, it's a bit misleading
to store a pointer to it in the sculpt BVH tree, and having
multiple mutable pointers to objects should generally be
avoided anyway. Now just pass it to the remeshing function
which is the oinly place it was needed anyway.
2024-07-25 12:40:13 -04:00
Hans Goudey
3199915f35 Cleanup: Switch to C++ API for 3D cursor transform
Replace the `BKE_scene_cursor` functions with member functions
of the `View3DCursor` DNA struct. This makes using the cursor's
transform simpler, especially in newer C++ code.

Pull Request: https://projects.blender.org/blender/blender/pulls/124903
2024-07-25 17:53:09 +02:00
Falk David
b1f747b19c Curves: Add explanation of magic number in calculate_point_handles
Add an explanation of the math for where the magic `2.5614f` comes from.

Pull Request: https://projects.blender.org/blender/blender/pulls/125302
2024-07-25 17:32:49 +02:00
Falk David
f34a4229e0 Fix: GPv3: Lineart: Conversion from 4.2 not working correctly
There were two issues:
* The target layer name was not copied over
* The thickness setting was being divided by two when it
resulted in thinner strokes.
2024-07-25 12:08:19 +02:00
Falk David
d2714dab7d Cleanup: GPv3: static function name for lineart conversion 2024-07-25 12:08:19 +02:00
Sybren A. Stüvel
651a7522a4 Refactor: Anim, rename leftover 'binding' references to 'slot'
Rename leftover references to action 'bindings' to 'slot':

- Two comments, and
- bunch of `bind_` variable prefixes, renamed to `slot_`.

No functional changes.
2024-07-25 12:04:05 +02:00
Sybren A. Stüvel
9427ec3f40 Fix #125063: Anim: layered Action data is still loaded in 4.2-release
Add `#ifdef WITH_ANIM_BAKLAVA` to the blend file reading/writing code,
so that the Action layers & slots are ignored when Blender is built
without experimental features.

This ensures that any loaded Action is just treated as 'legacy' (which
is the only kind of Action non-experimental Blender should have to deal
with), which will also properly deal with the forward compatible data
written by !125065.

This fix was committed on the `blender-v4.2-release` branch as
1b7485f20892523942752f81239807b2eab0f00b.

Pull Request: https://projects.blender.org/blender/blender/pulls/125068
2024-07-25 11:38:40 +02:00
Campbell Barton
8418ec4952 CMake: include headers in source lists 2024-07-25 11:24:11 +10:00
Campbell Barton
547b63b69b Cleanup: sort cmake file lists 2024-07-25 11:24:10 +10:00
Campbell Barton
c589634f73 Cleanup: use colon after parameters 2024-07-25 10:17:45 +10:00
Campbell Barton
2edc2393d2 Cleanup: spelling in comments 2024-07-25 10:17:42 +10:00
Sean Kim
53df43e064 Cleanup: Move variable initialization into struct definition
Pull Request: https://projects.blender.org/blender/blender/pulls/125388
2024-07-24 23:45:40 +02:00
Omar Emara
40be124184 Fix #122253: Image saving ignores EXR color format
All image saving mechanisms in Blender ignores the color format for EXR
images, including Render Pipeline, Save Operator, and File Output nodes.

To fix this, we first allow EXR images to be BW for flexibility. Then we
adjust the EXR saving code to take into account the required number of
channels. This is only done for single layer EXR images. Multi-layer EXR
images correctly ignores the option.

Pull Request: https://projects.blender.org/blender/blender/pulls/124807
2024-07-24 14:20:59 +02:00
Hans Goudey
45e4fecf9b Refactor: Separate mesh and multires PBVH building
Though it results in more duplication currently, splitting these
could help to facilitate further performance improvements here
in the future, and it avoids passing a bunch of useless arguments
for the multires case.
2024-07-24 07:54:59 -04:00
Hans Goudey
aa0ea3cf8f Cleanup: Remove "using" statements
The proper solution is to move the relevant code to the Blender
namespace. It should look ugly until then because it is.
2024-07-24 07:54:59 -04:00
Hans Goudey
dca3d87052 Cleanup: Remove unhelpful PBVH debugging utilities
These were mostly getting in the way of refactoring this code.
If the referenced problems actually happen, there would be
more obvious ways to observe the issues anyway.
2024-07-24 07:54:59 -04:00
Hans Goudey
d4f824b5af Cleanup: Reorder functions to group PBVH building 2024-07-24 07:54:59 -04:00
Hans Goudey
9d1b230a55 Cleanup: Sculpt: Pass BVH nodes by reference 2024-07-24 07:54:59 -04:00
Hans Goudey
f9c6fe30db Sculpt: Extract bounds calculation from BVH build, parallelize
This applies the same change as the previous commit to the bounds
of every BVH node. The bounds calculation can be changed to use
the standard functions from the regular BVH deformation.

In a simple test this makes building the sculpt BVH 64% faster.
I observed a change from 762ms to 464ms for a 1.9m vertex mesh.
2024-07-24 07:46:02 -04:00
Hans Goudey
8ab2a139ca Sculpt: Extract visibility calculation from BVH build, parallelize
This simplifies the BVH build process and potentially improves
its performance when parts of the geometry is hidden. The method
used to calculate whether a node is fully hidden is slightly different
too, vertex indices are used instead of triangle indices and a triangle
to face map.
2024-07-24 07:46:02 -04:00
Hans Goudey
0da90f05fe Cleanup: Sculpt: Simplify scratch array usage for BVH build 2024-07-24 07:46:02 -04:00
Hans Goudey
d40751c7b2 Cleanup: Sculpt: Clarify naming of BVH node field 2024-07-24 07:46:01 -04:00
Hans Goudey
2401a022ab Cleanup: Sculpt: Reduce indirection for painting data access
Remove unnecessary structs that just hold pointers to other data
2024-07-24 07:46:01 -04:00
Hans Goudey
eed48ea5eb Cleanup: Sculpt: Remove unused PBVH struct 2024-07-24 07:46:01 -04:00
Campbell Barton
32c721767e Fix failure to toggle filtering for add-ons with long names
Regression from [0] which didn't increase the length of owner_id names.

[0]: 31cb31d736
2024-07-24 14:49:27 +10:00
Sean Kim
98c96e12a4 Refactor: Remove dead boundary loop calculation code
Originally added in ed9c0464ba.

`last_visited_vertex` was never assigned to inside the flood fill loop,
therefore the following conditional to check if it had been set would
always be false, meaning that `forms_loop` was always false.

Pull Request: https://projects.blender.org/blender/blender/pulls/125344
2024-07-24 05:21:39 +02:00
Sean Kim
06aa1ce7b2 Refactor: Switch vector of PBVHVertRef in SculptBoundary for int
Part of #118145

Both int indices and PBVVertRef objects are used in multiple places
throughout the sculpt_boundary.cc code. This commit removes the
external-facing PBVHVertRef in favor of the int index to make further
refactoring of the methods that use this data easier.

Pull Request: https://projects.blender.org/blender/blender/pulls/125274
2024-07-23 23:19:41 +02:00
Sean Kim
b518172ae5 Refactor: Remove SculptBoundary initial_vert field
Pull Request: https://projects.blender.org/blender/blender/pulls/125273
2024-07-23 23:05:03 +02:00
Sean Kim
6181569a21 Refactor: Replace sparse mesh-sized array with map
Currently, the SculptBounary struct initializes and stores an array of
distances from the original boundary vert. However, this data is only
actually stored and calculated for boundary vertices, every other vertex
is initialized to 0.0f.

Pull Request: https://projects.blender.org/blender/blender/pulls/125278
2024-07-23 23:03:57 +02:00
Sean Kim
338140f1e6 Fix #125157: Sculpt multires crashes on box mask and duplicated stroke
Introduced in d527e3a6bd.

The change to update PBVH normals before destroying the PBVH to fix
shading on duplicate meshes issues had the unfortunate side effect of
causing crashes for multires due to a race condition. This commit
simply avoids performing this flushing for multires to allow for
further iteration in the future instead of reverting the offending
commit entirely.

Pull Request: https://projects.blender.org/blender/blender/pulls/125268
2024-07-23 22:56:26 +02:00
Hans Goudey
7daefd730b Refactor: Sculpt: Change PBVH and PBVHNode to public classes
Part of #118145.

These days we aren't really benefiting from making PBVH an opaque type.
As we remove its responsibilities to focus it on being a BVH tree and look
to improve performance with data-oriented design, that will only become
more true.

There are some other future developments the current header structure
makes difficult:
- Storing selections of nodes with `IndexMask` for simpler iteration, etc.
- Specialization of node type for each PBVH type
- Reducing overhead of access to node data as nodes get smaller
- General C++ cleanliness and consistency

This PR moves `PBVH` to `blender::bke::pbvh::Tree` and moves `PBVHNode`
to `blender::bke::pbvh::Node`. Both are classes visible to elsewhere in Blender
but with private data fields.

The difficult part about the change is that we're in the middle of a transition
removing data from PBVH. Rather than making some data truly private I
chose to just give it the `_` suffix, since it will ideally be removed later.
Other things should be class methods or implemented as part of friend
classes. But the "fake" private status is much simpler for now and avoids
increasing the scope of this PR too much. Though that's a bit ugly, there's a
straightforward way to resolve these issues-- it just looks like the sort of
inconsistency you'd expect in the middle of a large refactor.

Pull Request: https://projects.blender.org/blender/blender/pulls/124919
2024-07-23 22:31:27 +02:00
Bastien Montagne
f69f920164 Cleanup: BKE Blendfile: Improve PartialWriteContext documentation. 2024-07-23 18:28:51 +02:00
Falk David
ccc5922ece GPv3: Add "Set Curve Resolution" operator
Set the resolution of the selected curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/125235
2024-07-23 15:23:35 +02:00
Falk David
752fad886a Fix #125312: Drawings not cleared after last layer is removed
In the case where the last layer is removed and all the drawings
have zero users, in the `remove_drawings_with_no_users` function
the `find_next_swap_index` lambda would return `false` on the
first call. Both `first_unused_drawing` and `last_used_drawing`
are `0` in this case. This meant that the `drawings_to_remove`
index mask would exclude the first drawing (because
`last_used_drawing` is the index of the first drawing) and not
remove it as it should.

To fix this, we check if `first_unused_drawing` is greater than zero.
If it is not, then we know all the drawings have to be removed.
Otherwise we only remove the drawings after
`last_used_drawing + 1`.

Pull Request: https://projects.blender.org/blender/blender/pulls/125318
2024-07-23 15:22:14 +02:00
Omar Emara
c7fdd46e01 Cleanup: Missing BKE compositor include 2024-07-23 14:05:41 +03:00
Omar Emara
57ff2969b8 Compositor: Support multi-pass compositing for EEVEE
This patch adds support for multi-pass compositing for EEVEE. This is
done by copying the passes used by the compositor node tree to the DRW
view data, which can then be accessed by the viewport compositor.

The viewport compositor will fallback to the viewport texture or an
invalid output of the passes were not initialized, this is currently the
case for any render engine that is not EEVEE.

A future optimization that we can do is eliminate the film pass copy
shaders and only copy the data that EEVEE rendered, which can be a
subset of the viewport for border rendering. This is not done at the
moment because not all engines support passes at the moment, so the
compositor expects full viewport passes.

Depends on: #123685, #123817, #123815.

Pull Request: https://projects.blender.org/blender/blender/pulls/123378
2024-07-23 10:15:13 +02:00
Falk David
d0ff8d89c9 Fix: GPv3: Use correct temporary eraser size
When holding CTRL using the draw tool to erase, the size of the cursor
was using the size of the eraser brush. This is not the expected behavior
when using the eraser from the draw tool. It should respect the size
of the brush used by the draw tool instead.

This fixes the issue by computing the right size when the eraser operation
is invoked. The size is then stored in a runtime field, so that the cursor
rendering callback can use the cached size.

Pull Request: https://projects.blender.org/blender/blender/pulls/125225
2024-07-22 18:08:51 +02:00
Jacques Lucke
3c81984178 Geometry Nodes: add conversion nodes for Grease Pencil and Curves
This adds two new nodes:
* `Grease Pencil to Curves`: Converts each grease pencil layer into an instance
  that contains curves.
* `Curves to Grease Pencil`: Converts top-level curve instances into grease
  pencil layers.

This opens up many new opportunities:
* Use grease pencil as input to other procedural systems that don't necessarily
  output grease pencil.
* Generate grease pencil from scratch using geometry nodes.
* Temporarily convert grease pencil data to curves to use more powerful features
  for curves processing.

Some data on layers are not attributes yet unfortunately, so there is some
special case handling for the `opacity` attribute. This was previously discussed
at the geometry nodes workshop:
https://devtalk.blender.org/t/2024-05-13-geometry-nodes-workshop-notes/34760#grease-pencil-14

Pull Request: https://projects.blender.org/blender/blender/pulls/124279
2024-07-22 12:29:26 +02:00
Casey Bianco-Davis
73338c1553 GPv3: Render evaluated geometry
This allows Grease Pencil to render all the different curve types.
The PR changes the batch cache creation to use the evaluated points.

Pull Request: https://projects.blender.org/blender/blender/pulls/122985
2024-07-22 11:10:07 +02:00
Campbell Barton
e2bc41598d Fix drivers showing "Python restricted for security" when they weren't
Regression from [0], drivers were tagged as being disabled with a flag
that was never cleared. Causing the label to be displayed for files
where the expressions were enabled and in use.

Resolve by clearing this flag on file load and when re-compiling
expressions - since an expressions block flag may be cleared if it
becomes a simple expression.

[0]: 1a8053939b
2024-07-22 10:39:50 +10:00
Campbell Barton
f1e5263423 Cleanup: spelling in comments 2024-07-22 10:16:55 +10:00
Campbell Barton
d3fbc56021 Cleanup: various cppcheck warnings
Avoid shadowing, use const args & match function & declaration args.
2024-07-22 09:58:43 +10:00