Commit Graph

105023 Commits

Author SHA1 Message Date
Habib Gahbiche
153f14be2b Compositor: Make split viewer a regular split node
Changes:
- Renamed Split Viewer Node to Split Node
- Split Node is now under `Utilities` (similar to Switch node)
- Versioning: split viewer from 4.0 and before is replaced with the new split node connected to a new viewer node.

Pull Request: https://projects.blender.org/blender/blender/pulls/114245
2023-12-03 23:20:44 +01:00
Pratik Borhade
b1ac047af4 Cleanup: to_bools comment 2023-12-03 15:41:04 +05:30
Harley Acheson
8933284518 UI: Icons for Area Join and Swap
Icons provided by Alexey Adamitsky to represent screen area join and
screen area swap.

Pull Request: https://projects.blender.org/blender/blender/pulls/115712
2023-12-02 20:08:01 +01:00
Harley Acheson
da7128c533 Cleanup: Make format
Formatting changes resulting from Make Format
2023-12-02 11:07:25 -08:00
Hans Goudey
ccab01f97f Subdiv: Store multires sculpt grid visibility in BitGroupVector
Instead of allocating a separate bitmap per grid for the hide status, store
all the bits in a recently added C++ data structure that stores all bits in one
contiguous memory chunk. When nothing is hidden, nothing is allocated
(that saves 32 MB for a 16 million vertex multires sculpt). Intuitively it
could have better performance because of the cache benefits of
contiguous memory, but this is hard to measure. It also has a nicer
API than `BLI_bitmap`.

I discussed this with Sergey in person recently. Most of the changes are
just straightforward refactors. The part that isn't is a change to the "show/hide"
operator to structure it similarly to the mesh handling in 4e66769ec0.

Pull Request: https://projects.blender.org/blender/blender/pulls/115687
2023-12-02 20:05:29 +01:00
Bastien Montagne
5736f88e31 BKE main: Add 'merge' utils to merge one Main content into another.
This merge does not rename any ID. In case a conflict happens (an ID of
the same name and library already exists in destination Main), its
counterpart in source Main is not moved, and its usages by other
moved-from-source IDs are remapped accordingly.

Libraries are also properly de-duplicated, and remapped as necessary.

Source Main is always freed by this function, since it is either empty,
or contains left-over IDs very likely to have invalid relationships
after the merge.

NOTE: This commit also enables `main_test.cc` unittests, which was
comitted by mistake in fe3cb11ae4, sorry about that.

Pull Request: https://projects.blender.org/blender/blender/pulls/115671
2023-12-02 16:25:02 +01:00
Bastien Montagne
2064af64e5 BKE lib remap: Add option to allow remapping of ID.lib pointers.
Usually Library pointers should not be affected by remapping, but this
can be needed in some cases.

WARNING: Use with caution, this is potentially a dangerous operation for
Main data integrity/validity.
2023-12-02 16:10:41 +01:00
Aras Pranckevicius
854840b35f VSE: speedup "show overexposed" option
Speedup the "apply zebra stripes" image loop by multi-threading it.
For non-float images, avoid an extra image copy that was not doing
anything useful.

4K UHD resolution, Windows Ryzen 5950X:

- LDR: whole `sequencer_get_scope` 16.4ms -> 5.3ms, just `draw_zebra`
  part: 7.5ms -> 3.3ms
- Float image: whole `sequencer_get_scope` 126.6ms -> 114.1ms, just
  `draw_zebra` part: 22.4ms -> 7.4ms. Whole scope is still expensive
  due to color management work being done.

Pull Request: https://projects.blender.org/blender/blender/pulls/115622
2023-12-02 08:09:49 +01:00
Campbell Barton
32c5ea6262 Cleanup: format 2023-12-02 14:56:12 +11:00
Hans Goudey
a7afc5b1e8 Cleanup: Pass PBVH node grid indices as Span 2023-12-01 14:40:14 -05:00
Hans Goudey
380b7c5dc3 Sculpt: Multithread mesh "show all" operation
Continuation of 4e66769ec0. In a test unhiding a small portion
of a 16 million vertex mesh, this halved the time from 10 to 5 ms.
2023-12-01 14:40:14 -05:00
Bastien Montagne
3acb64e7ac BKE_main: move header to be a fully CPP one.
Pull Request: https://projects.blender.org/blender/blender/pulls/115681
2023-12-01 20:38:54 +01:00
Harley Acheson
0fbc3e956f Fix #115601: Clamp Color Picker Vertical Value Slider Position
The position of the vertical value slider has to be clamped to be
within the area of that slider, otherwise it can draw outside the
range when a value is over 1.

Pull Request: https://projects.blender.org/blender/blender/pulls/115680
2023-12-01 20:01:22 +01:00
Harley Acheson
1d7ddcc46e Cleanup: Make format
Formatting changes resulting from Make Format
2023-12-01 10:29:59 -08:00
Hans Goudey
aae0b71342 Cleanup: Move constant variable declarations outside of loop 2023-12-01 12:41:09 -05:00
Hans Goudey
f2ed2b82ce Cleanup: Use const arguments for some paint functions 2023-12-01 12:41:09 -05:00
Hans Goudey
0978f9486e Sculpt: Remove redundant "reveal all" operator
This operator (`SCULPT_OT_reveal_all`) is redundant with
the "Hide Show" operator (`PAINT_OT_hide_show`). Since
the latter was recently changed to be much faster, remove the
former and update keymaps and menus. The industry compatible
keymap actually already contains the hide/show operator.

Pull Request: https://projects.blender.org/blender/blender/pulls/115629
2023-12-01 17:32:09 +01:00
Jacques Lucke
5de86fc4f8 Cleanup: make name more specific for simulations
This is necessary for the bake node (#115466).
2023-12-01 17:13:31 +01:00
Jacques Lucke
b7a476ef03 Geometry Nodes: make function for mixing baked data more reusable
The bake node will need this as well (#115466).
2023-12-01 17:13:31 +01:00
Miguel Pozo
f3aab25393 Fix: Depsgraph: Avoid duplicated operation nodes on geometry data
Move the geometry shading add_operation_node call to
build_object_geometry_datablock.
Avoids triggering an assertion when the same geometry data is shared
by multiple objects.

Pull Request: https://projects.blender.org/blender/blender/pulls/115615
2023-12-01 16:26:10 +01:00
Aras Pranckevicius
f3ce0645e4 Color management: multi-thread IMB_colormanagement_transform_from_byte_threaded simple case
This function is only used in Sequencer code to convert source byte images
into float images. For a "simple case" where there is no color space
conversion needed, it was doing that on a single thread, in two passes over
the image (first byte -> float conversion, then alpha premultiply).

VSE 4K resolution playback, with two image strips where one of them has
"convert to float" option, on Windows / Ryzen 5950X:

- Overall playback FPS: 3.40 -> 4.03. Still very slow, and a lot of time
  is spent in allocating, clearing and deleting various temp images, as
  well as final color conversion for display.
- `seq_imbuf_to_sequencer_space` part: 217.9ms -> 86.6ms. Most of
  remaining cost is just in just memory allocation+clear, which is why
  it's not drastically faster due to threading.

Pull Request: https://projects.blender.org/blender/blender/pulls/115628
2023-12-01 16:18:47 +01:00
Omar Emara
5af7d3e2be Fix #115043: Compositor crashes for huge render sizes
The experimental GPU compositor crashes when the render size is huge.
This is just due to GPU texture allocation failing. The patch fixes that
by downscaling the render result when reading, then upscaling it again
when writing. Additionally, the render size was adapted to the
downscaled size since it is used by other input nodes. This is not an
ideal solution, but it a good temporary solution to prevent crashes
until we have proper support for huge textures.

Pull Request: https://projects.blender.org/blender/blender/pulls/115299
2023-12-01 16:16:19 +01:00
Hans Goudey
a86122606c Fix: Crash building sculpt PBVH
Caused by 49f676e6c2. The SubdivCCG pointer was
dereferenced while doing normal face sculpting. Solve by splitting
the function for each PBVH type.
2023-12-01 10:03:05 -05:00
Hans Goudey
f69beb4829 Fix: Sculpt drawing ignores hide status
Caused by retrieving the hide status from the wrong mesh.
2023-12-01 10:03:05 -05:00
Hans Goudey
4c79b87d9a Cleanup: Remove unused threading C-API functions
BLI_task.hh has newer/better equivalents now.

Pull Request: https://projects.blender.org/blender/blender/pulls/115539
2023-12-01 15:29:36 +01:00
Omar Emara
5e370ee643 Fix: Missing compositor update upon changing tree options
The compositor doesn't run when changing node tree options. That was due
to a nullptr notifier reference for RNA node tree edits.

This patch uses the node tree ID for the notifier reference.
Additionally, the listener code was extended to always tag the node tree
when the reference is null, which converts missing updates issues like
this one to superfluous updates, since it is safer.

Pull Request: https://projects.blender.org/blender/blender/pulls/115532
2023-12-01 15:13:04 +01:00
Clément Foucault
fe848ce3ef EEVEE-Next: Optimize GBuffer Layout and writting
This layout is more flexible and polymorphic.

While the worst case is worse (4 + 3 layers),
the common case is more optimized (2 + 2 layers).
The average written closure data is also lower
since we can compact the data for special cases
which are quite frequent.

Some adjustment had to be made in the denoise an
tile classify shaders.

Pull Request: https://projects.blender.org/blender/blender/pulls/115541
2023-12-01 14:41:13 +01:00
Clément Foucault
900f9283a3 Cleanup: MTL: Framebuffer: Make code less verbose
and move declaration of attachment closer to its usage.
2023-12-01 14:27:21 +01:00
Jeroen Bakker
2b83fde034 Cleanup: Rename Glossy To Metallic
Pull Request: https://projects.blender.org/blender/blender/pulls/115656
2023-12-01 14:07:27 +01:00
Hans Goudey
b292449c1c Cleanup: Solve missing declaration warning for grease pencil operator 2023-12-01 07:58:32 -05:00
Daiki Hashimoto
edcac1f48b Fix #44834: Add bone selection icon next to face and vertex selection in weight paint mode
Currently, in weight paint mode, there is an icon for
face and vertex selection mode, but there isn't one
for the default mode where the user can select a bone
in any tool by alt clicking.
This lack of indication might lead to confusion for the users
when they are not able to select a bone by
alt clicking during weight painting.

By adding a bone selection icon when there is a pose
mode armature, we can communicate to the user that:
1. they can select a bone while the bone selection icon is active.
(when they are not in face or vertex selection mode)
2. they have forgot to select an armature when entering
weight paint mode by not showing the bone selection
icon at all when there is no pose mode armature.

When the bone selection icon is inactive,
the user can't select a bone.
(alt clicking selects face and vertex mode's respective element)

When no armature is selected when entering weight paint mode,
the bone selection icon doesn't show up indicating that the user
has forgot to select an armature.
(The user is also unable to select a bone by alt clicking.)

## Selection tool for bone selection mode
Currently, while selection tools exist for face and vertex
selection mode, one doesn't exist for the default mode
(bone selection mode). As the default mode will be getting
a clear indicator that it will function as a bone selection mode,
I added a selection tool entry for the bone selection mode.

Face and vertex selection modes has the shortcut 1 and 2,
so it seemed natural to give bone selection mode the shortcut of 3.

Pull Request: https://projects.blender.org/blender/blender/pulls/115409
2023-12-01 13:38:58 +01:00
Antonio Vazquez
cd6c7c4b23 GPv3: Fix compiler warning and format 2023-12-01 13:16:27 +01:00
Antonio Vazquez
11f606f88f GPv3: Menu to Select Material using U key
This PR includes the popup menu used to select a material pressing `U` key.

The menu is used in Draw, Sculpt and Vertex paint mode in GPv2 but this patch only includes Draw mode because other modes are not avaliable in GPv3 yet.

Related to #114203

Pull Request: https://projects.blender.org/blender/blender/pulls/114694
2023-12-01 13:12:10 +01:00
Matias Mendiola
b8a785b65b GPv3: Show and hide layers operators
- New Operator: GREASE_PENCIL_OT_layer_hide
- New Operator: GREASE_PENCIL_OT_layer_reveal
- Added menus to Edit and Draw Modes
- Added Keymap via _template_items_hide_reveal_actions()

Note: Operator names were changed for consistency with other layers operators that use _layer_ on their names

Pull Request: https://projects.blender.org/blender/blender/pulls/114348
2023-12-01 12:55:30 +01:00
Jacques Lucke
cefdb67db7 Cleanup: return managed pointer when copying geometry component 2023-12-01 11:23:00 +01:00
Jacques Lucke
7730ca2b9d BLI: improve const handling in ImplicitSharingPtr
The constness of the `ImplicitSharingPtr` does not imply the constness of the
referenced data, because that is determined by the user count. Therefore,
`ImplicitSharingPtr` should never give a non-const pointer to the underlying data.
Instead, one always has to check the user count, before one can do a `const_cast`.

Pull Request: https://projects.blender.org/blender/blender/pulls/115652
2023-12-01 11:19:39 +01:00
casey bianco-davis
fb275bc040 GPv3: Duplicate Points operator
Adds the duplicate points operator fallowing the legacy system.

Resolves #113640
Pull Request: https://projects.blender.org/blender/blender/pulls/115389
2023-12-01 10:14:14 +01:00
Hans Goudey
91c936e01c Fix #115108: Object dimensions infinite for armatures
The initialization of min and max was reversed. Switch to C++
numeric limits, which I'm a bit more used to ad this point.
2023-11-30 23:40:34 -05:00
Hans Goudey
8c8ea2ec47 Refactor: Sculpt: Clarify PBVH attribute requests
Avoid reusing the custom data type enum with additional values. Instead
use std::variant and type names to properly distinguish between custom
and generic attribute requests. Use a Vector to hold the requests.

Also attempt to simplify the string key building process for requests
and groups of requests in batches. Previously for every PBVH node it
would rebuild the key 3 times, now it only does it once. It's hard to
measure, but that process did show up in profiles, so performance is
probably slightly improved when many nodes are handled at once.
2023-11-30 23:24:11 -05:00
Hans Goudey
2a94328346 Cleanup: Pass PBVH draw attribute requests as span
Also remove an unused argument to batch retrieval functions
2023-11-30 23:24:11 -05:00
Hans Goudey
2864f3ad3f Cleanup: Remove unused argument to PBVH draw functions
The attributes weren't used by BKE_pbvh_draw_cb.
2023-11-30 23:24:11 -05:00
Hans Goudey
e83b1b8ae0 Cleanup: Use object arguments in many drawing related functions 2023-11-30 23:24:11 -05:00
Hans Goudey
ed7b914bd8 Cleanup: Move draw_pbvh to a C++ namespace 2023-11-30 23:24:11 -05:00
Hans Goudey
00c22b75d2 Cleanup: Move draw_pbvh.h to C++ 2023-11-30 23:24:11 -05:00
Hans Goudey
666a99da8d Cleanup: use references, const arguments for PBVH draw args function 2023-11-30 23:24:11 -05:00
Hans Goudey
4a1c6b28ae Cleanup: Move PBVH draw args function to where it's used
Somehow this function was in the middle of the section of the
file where the code building the PBVH lives.
2023-11-30 23:24:11 -05:00
Hans Goudey
49f676e6c2 Cleanup: Reduce usage of mesh data pointers in PBVH
Pointers to hide status layers and custom data are removed,
since they can be accessed from the mesh as necessary.
Usage of other arrays has been reduced, so the pointers
can eventually be removed.

The reasoning is the same as some other commits in this area:
the goal is less duplication of state, and a more focused design
of the responsibilities of the PBVH class.

Some of the changes are fairly noisy, since we need to add
arguments to functions in a few places. On the nicer side of
things, some functions for syncing the state can be removed.

Not retrieving hide layers with write access also has performance
implications in some cases, since it means the original arrays can
be reused without a copy when they're shared.
2023-11-30 23:24:11 -05:00
Hans Goudey
a5e17dc607 Cleanup: PBVH: Process multiple nodes at once in visibility update
This improves the early out in the mesh case so that it isn't
repeated for every node. Also simplifies using more local
variables that are specific to a certain PBVH type (in this
case, switching to the C++ attribute API and retrieving the
vertex visibility status that way).
2023-11-30 23:24:11 -05:00
Jesse Yurkovich
d304ba7906 Cleanup: Rename GPU_select header to indicate its move to C++
From a prior PR[0] there was a desire to rename this header to more
clearly indicate it's C++ now.

[0] !112491

Pull Request: https://projects.blender.org/blender/blender/pulls/115631
2023-12-01 03:39:03 +01:00
Harley Acheson
c8d1bb5902 BLF: Rename Text Shader Depth to Component Len
Rename text shader glyph "depth" to "glyph_comp_len", as requested
by Clément Foucault.

Pull Request: https://projects.blender.org/blender/blender/pulls/115640
2023-12-01 02:07:57 +01:00