Commit Graph

105004 Commits

Author SHA1 Message Date
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
Harley Acheson
2052d167c3 BLF: Fix Shader Type Conversion
Implicit conversion of vec2 is not permitted with Metal.

Pull Request: https://projects.blender.org/blender/blender/pulls/115638
2023-12-01 01:09:52 +01:00
Campbell Barton
731a443354 Cleanup: pass const vectors BKE_lnor_space_define
Pass const references to lnor_space_define(..), one argument wasn't
const because of a local assignment, declare a new variable instead.
2023-12-01 11:05:29 +11:00
Campbell Barton
94de4087e6 Cleanup: assign values for enums that may be stored in blend files 2023-12-01 11:04:47 +11:00
Campbell Barton
afa9a6904d Fix missing null check from !115247 & simplify
- CTX_wm_region(C) must be NULL checked as it's not checked in the
  poll function.
- Add back the removed flag, note it's dirty.
- Replace ternary operators with min/max.
2023-12-01 10:47:21 +11:00
Campbell Barton
8aff65daf2 Cleanup: naming for GPUSelectResult
Prefer the name 'hit_result' since 'result' was sometimes used for
a vector of GPUSelectResult and is often used a functions return value.

Use hit_results for the span/vector and hit_result for a single hit.

Also assign struct members for new GPUSelectResult as it reads better
and avoids depending on struct order.
2023-12-01 09:45:02 +11:00
Hans Goudey
ac6e854335 Cleanup: Small tweaks to C++ style in lib remap code
- Pass Span by value. It is a small struct, and passed by reference
  it acts as a pointer to a pointer.
- Remove unnecessary `= {}`. Vector has a default constructor.
- Use initializer list Span constructor to avoid temporary array.

Pull Request: https://projects.blender.org/blender/blender/pulls/115635
2023-11-30 23:03:39 +01:00
Hans Goudey
8b28bb9882 Cleanup: Remove redundant subdiv pointers from PBVH
These are just duplicates of the pointers in `SubdivCCG`, which are
already quickly accessible. Keeping track of the state is too complex
and bloats the responsibilities of the PBVH too much.
2023-11-30 16:40:09 -05:00
Bastien Montagne
050d48edfc BLI_fileops: Harmonize 'rename' behaviors accross platforms.
This commit aim at making the behaviors of `BLI_rename` and
`BLI_rename_overwrite` more consistent and coherent across all
supported platforms.

* `BLI_rename` now only succeeds in case the target `to` path does not
  exists (similar to Windows `rename` behavior).
* `BLI_rename_overwrite` allows to replace an existing target `to` file
  or (empty) directory (similar to Unix `rename` behavior).

NOTE: In case the target is open by some process on the system, trying
to overwrite it will still fail on Windows, while it should succeed on
Unix-like systems.

The main change for Windows is the usage of `MoveFileExW`
instead of `_wrename`, which allows for 'native support' of file
overwrite (using the `MOVEFILE_REPLACE_EXISTING` flag). Directories
still need to be explicitly removed though.

The main change for *nix systems is the use of `renamex_np` (OSX) or
`renameat2` (most Linux systems) to allow forbidding renaming to an
already existing target in an 'atomic' way.

NOTE: While this commit aims at avoiding the TOC/TOU problem as
much as possible by using available system's primitives for most
common cases, there are some situations where race conditions
(filesystem changes between checks on FS state, and actual rename
operation) remain possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/115096
2023-11-30 22:35:00 +01:00
Bastien Montagne
dfe1a7d039 BKE_lib_remap: Refactor: Replace LinkNode by blender::Span. 2023-11-30 22:21:45 +01:00
Harley Acheson
5d330ddb1f BLF: Support All Render and Bitmap Formats
Add support for all of FreeType's various render formats and output
bitmap formats.

Pull Request: https://projects.blender.org/blender/blender/pulls/115452
2023-11-30 22:17:30 +01:00
Jesse Yurkovich
abf59eb23a Selection: Remove limit on number of items which can be selected at once
This removes the long-standing static limit for the selection buffer in
favor of a dynamic approach.

It replaces the static array with our Vector type where the inline
buffer provides parity with existing code while also providing the
ability to grow as necessary.

Fixes #102487, #109178, #112350, #112493, and https://projects.blender.org/blender/blender-manual/issues/102485

See PR for further notes and links to the different limits remaining.
Pull Request: https://projects.blender.org/blender/blender/pulls/112491
2023-11-30 21:27:15 +01:00
Miguel Pozo
2e27791df3 Fix: EEVEE-Next: Alpha hashed transparency doesn't converge
Use sub-pixel alpha hash scale when the camera is not moving.
This provides cleaner results, while maintaining temporal coherence on
camera movement.

Pull Request: https://projects.blender.org/blender/blender/pulls/115620
2023-11-30 20:18:08 +01:00
Hans Goudey
4e66769ec0 Sculpt: Improve "Hide/Show" operator performance for mesh
Parallelize the implementation and move constant checks out of hot
loops. Only push undo steps for PBVH nodes that actually have changed
hide status. Optimize the "show all" case to remove the hide attributes.
For timings, I recorded some information on a 16 million vertex mesh:
- Hide masked (1/4 of mesh): 171 ms to 33 ms
- Hide small box: 13 ms to 14 ms
- Show all with small box hidden: 226 ms to 10 ms
- Show with all visible: 173 ms to 0.36 ms

There are a few other visbility operators that aren't affected:
- SCULPT_OT_face_set_invert_visibility
- SCULPT_OT_reveal_all
- SCULPT_OT_face_set_change_visibility
In separate steps, they should be moved to use the same structure, or
maybe even removed in the case of "reveal all".

I expect the "gather, change hidden verts, scatter" steps for each node
could be made a bit more efficient, they do some redundant work.
But it was also a simple way to share a reasonable amount of code.
2023-11-30 14:14:02 -05:00
Hans Goudey
7eb8c4cdda Cleanup: use const variables and arguments 2023-11-30 14:14:02 -05:00
Hans Goudey
841864406f Cleanup: Use enum class int paint hide operator 2023-11-30 14:14:02 -05:00
Hans Goudey
11b4e9311f Cleanup: Move paint hide file to namespace 2023-11-30 14:14:02 -05:00
Hans Goudey
68baa04eeb Cleanup: Move enum definition out of header 2023-11-30 14:14:02 -05:00
Hans Goudey
3adcc1378c Cleanup: Avoid using keyword in sculpt header
This approach doesn't scale well, and the right solution is to move
this code to the proper namespace anyway.
2023-11-30 14:14:02 -05:00
Hans Goudey
759d2634fd Cleanup: Pass all nodes to paint hiding functions
Allows specializing the operation more for each PBVH type.
2023-11-30 14:14:02 -05:00