Commit Graph

120055 Commits

Author SHA1 Message Date
Campbell Barton
ded36920d7 Cleanup: spelling in comments 2023-12-10 16:33:54 +11:00
Campbell Barton
49c6e4ed5a PyAPI: micro optimization accessing keyword arguments for bpy functions
Check the string length before comparing with memcmp,
gives 20-30% speedup for the lookup function.
2023-12-10 16:18:35 +11:00
Campbell Barton
7ee8de9ba4 Cleanup: replace WM_cursor_set with WM_cursor_wait for image copy/paste
WM_cursor_wait is more common and doesn't assume the current cursor
is WM_CURSOR_DEFAULT.
2023-12-10 15:58:10 +11:00
Richard Antalik
79dff8174b Cleanup: VSE waveform drawing variables
Code had variables `frame_start` and `start_frame` for different purpose
confusing. Variables were sorted and math simplified.

Fixes broken waveform to pixel grid alignment.
2023-12-09 20:53:10 +01:00
Richard Antalik
b5ce6b6de7 Fix #114951: Waveform drawn incorrectly in strips with hold offset
Caused by not applying the offset to start frame calculation.
Also fixes reverse offsetting of waveform when start offset was
negative - content start frame was used instead of handle frame.
2023-12-09 20:18:58 +01:00
ok_what
5e07e9f7e2 Fix (unreported): Set Color Tag broken when inside meta strip
When editing inside a meta strip, running the "Set Color Tag" operator
would set the color tag of the top-most meta strip, rather than that of
the intended strip.

Pull Request: https://projects.blender.org/blender/blender/pulls/115950
2023-12-09 19:37:08 +01:00
Campbell Barton
15cff1fddb BMesh: optimize attribute copying by reusing BMCustomDataCopyMap
Continuation of fix for #115776. Removes attribute copy functions
that calculate the map inline, this is error prone as it's easy to
call these functions from a loop which may result in poor performance.
2023-12-09 23:16:21 +11:00
Hans Goudey
0b1049b41d BMesh: Optimize copying attributes from many elements at once
Fixes #115776

Create a minimal structure that contains the instructions necessary to
copy from one custom data format to another. This structure is similar
to the one used in dfacaf4f40. It should have been used in
9175d9b7c2, which instead introduced quadratic performance
relative to the number of layers when copying every element.

In this commit, copying the entire mesh and adding new custom data
are explicitly changed to use the new map to speed up copying many
elements at a time.

The non-map attribute copy functions are also changed to check for when
the source and result BMeshes are the same. In that case it's much
faster to call the "same format" function from 9175d9b7c2.

For numbers, the timings are arbitrarily influenced by how many layers
I add in my testing. With 50 or so layers, a 10x difference is easily
observable though.

Pull Request: https://projects.blender.org/blender/blender/pulls/115824
2023-12-09 05:37:37 +01:00
Guillermo Venegas
7c5fa8bf6c IO: Add initial support for File Handlers registration
Adds initial support for File Handler registration with the python API
for design task #68935. File Handlers will allow developers to associate
additional UI behavior and capability to operators traditionally used
only within the file browser.

The initial commit should have no user visible changes, but will serve
as the foundation for providing file drag & drop capabilities to
operators that can manage files (#111242).

See the PR for an example of python usage.
See design task #68935 for remaining work to be explored in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/112466
2023-12-09 05:06:10 +01:00
Hans Goudey
85012ccb1f Cleanup: Use simpler positions name in curves selection functions
These functions don't have to know about things like geometry
deformations. As far as they're concerned, they just use the positions
from the argument span instead of the positions stored in the curves.
2023-12-08 20:21:43 -05:00
Hans Goudey
7bfb7af311 Cleanup: Remove excessive use of optimized IndexMask functions
These shouldn't be used when the lambda is non-trivial, it likely
generates too much code and bloats the binary size for no
observable performance gain in these cases.
2023-12-08 20:21:35 -05:00
Harley Acheson
76bf43f44d Fix #115938: BLF Handle Negative Left-Side Bearings
Our glyph bounds clipping test will fail for the first character of a
string if that character has negative left-side bearing. This is not
usual but can happen in some designs for lowercase "j" to have the tail
hook under the preceding character.

Pull Request: https://projects.blender.org/blender/blender/pulls/115965
2023-12-09 01:52:45 +01:00
Harley Acheson
f3c1111836 Fix #114838: Force Full Redraw When Duplicating Areas
Duplicating into a new window needs to tag the new area for full
redraw. Otherwise Outliner will try a partial redraw while the
tree is not yet built.

Pull Request: https://projects.blender.org/blender/blender/pulls/115959
2023-12-08 23:44:19 +01:00
Harley Acheson
639272ef77 Fix #100784: Truncate Text with Ellipsis inside Number Inputs
When a property name is shown inside of a numerical input, truncate
with ellipsis if it cannot fit.

Pull Request: https://projects.blender.org/blender/blender/pulls/115958
2023-12-08 23:40:09 +01:00
Hans Goudey
e0d95b95cc Fix: Build error and format fixes after previous cleanup 2023-12-08 17:19:46 -05:00
Hans Goudey
854cdd1180 Cleanup: Use consistent "mesh" variable name (replace "me")
"mesh" reads much better than "me" since "me" is a different word.
There's no reason to avoid using two more characters here. Replacing
all of these at once is better than encountering it repeatedly and
doing the same change bit by bit.
2023-12-08 16:40:06 -05:00
Hans Goudey
956d00e37a Cleanup: Return sculpt node automasking data by value 2023-12-08 13:09:24 -05:00
Hans Goudey
e5814ab201 Cleanup: Move majority of sculpt paint module to C++ namespaces
And improve naming to remove the inconsistent "SCULPT" prefix in
many cases-- removing redundancy between the namespace name
and the function name. The specific names might need to evolve a bit
still, but it's much less annoying not having to type or read the
namespace all the time. I left out some areas with unclear design.
2023-12-08 13:09:24 -05:00
Hans Goudey
83810e28fc Cleanup: Sculpt explicitly retrieve mesh face visibility attribute
Rather than relying on the pointers in `SculptSession` which should be
removed eventually, to avoid redundant state storage.
2023-12-08 13:09:24 -05:00
Pratik Borhade
2e5d4a8799 GPv3: Clean loose points operator
Similar to the legacy operator. Removes strokes with a number of points less than or equal to the "limit" property.
Resolves #113599.

Pull Request: https://projects.blender.org/blender/blender/pulls/115923
2023-12-08 16:53:09 +01:00
Pratik Borhade
b9cbc5b335 Fix #115909: Walk Navigation Up and Down is interrupted by WASD
Caused by 93f6001683 , 1b3cfcc74f .
Direction flag names was changed but the max value passed to `ENUM_OPERATORS`
wasn't pointing to actual max value.

Pull Request: https://projects.blender.org/blender/blender/pulls/115926
2023-12-08 15:52:03 +01:00
Jeroen Bakker
65e58fe574 CMake: Fix Compiling Shader Builder on macOS
Due to changes in the build environment shader_builder wasn't able to
compile on macOs. This patch reverts several recent changes to CMake files.

* dbb2844ed9
* 94817f64b9
* 1b6cd937ff

The idea is that in the near future shader_builder will run on the buildbot as
part of any regular build to ensure that changes to the CMake doesn't break
shader_builder and we only detect it after a few days.

Pull Request: https://projects.blender.org/blender/blender/pulls/115929
2023-12-08 15:47:14 +01:00
Jeroen Bakker
f355575f1d Vulkan: Add Debug Name To Descriptor Sets
When debugging the descriptor sets are unnamed. This PR sets the
active shader name. This helps when debugging so we don't need
to track down the shader it is complaining about.

```
 the descriptor (VkDescriptorSet 0x66da6f0000001c58[workbench_prepass_mesh_opaque_studio_texture_no_clip_1022]
binding 7, index 0) is being used in draw but has never been updated via vkUpdateDescriptorSets() or a similar call.
```

This message direct directly to the shader including what part is
needed to be checked. No need to add break points and that sort
of things.

Pull Request: https://projects.blender.org/blender/blender/pulls/115944
2023-12-08 15:32:35 +01:00
Hans Goudey
63432f0963 Cleanup: Store sculpt undo nodes with C++ Vector 2023-12-08 09:05:07 -05:00
Hans Goudey
c4436776d1 Cleanup: Use references for sculpt undo nodes 2023-12-08 09:05:07 -05:00
Christoph Lendenfeld
48d35bfe53 Refactor: Pass Keyframe settings as arguments
No functional changes.

Before this PR the interpolation mode of a new keyframe
was read from the User Preference at the deepest level
where the keyframe is created.

In case where this shouldn't be done, the flag
`INSERTKEY_NO_USERPREF` was passed in.
In this case it would fall back to some default values.

In order to make these low level functions
more flexible, the keyframe settings are now passed in.
I've made a new struct `KeyframeSettings` that holds the
* interpolation
* key type
* handle type

and a function `get_keyframe_settings` that allows
you to quickly get this settings struct.

This is a first step that will allow to pass in the
interpolation mode from python in the future.

Part of #113278

Pull Request: https://projects.blender.org/blender/blender/pulls/115898
2023-12-08 13:09:11 +01:00
Falk David
f8b20936c8 Fix #115895: Surface drawing artifacts at borders
The reason for the artifacts was that the depth (`placement_loc_`) was
not initialized in surface draw mode, but used in case we didn't hit a
surface in the projection.

This fixes the issue by using a default depth defined by the object
origin. Also applies for the `NearestStroke` placement.
2023-12-08 13:06:38 +01:00
Campbell Barton
55c5692364 Cleanup: remove unused variable, invalid comment & typo 2023-12-08 23:03:22 +11:00
Falk David
8efff3b2d7 GPv3: Render to Image
This PR refactors parts of the gpv3 engine and implements the `render_to_image` engine callback.

Pull Request: https://projects.blender.org/blender/blender/pulls/115904
2023-12-08 12:51:15 +01:00
Falk David
048ccbe4d2 Cleanup: GPv3: retrieve_editable_* functions 2023-12-08 11:46:49 +01:00
Falk David
8e45ec4896 Fix: GPv3: Compiler error
58041799 introduced a compiler error. This fixes the issue by
making sure to use `editable_material_indices` in the functions
correctly.
2023-12-08 11:35:38 +01:00
Jeroen Bakker
1d60415115 3D Paint Brush: Disable Node Splitting
Node splitting seems to be broken and when triggered it crashes blender. The cause for
this is that SplitNodePair stores a full node and uses assign operators, that can free
unallocated space.

Although node splitting is important for performance point of view, we should reevaluate
how we want node splitting to work.

This PR only disables it, so it won't crash when used.

Pull Request: https://projects.blender.org/blender/blender/pulls/115928
2023-12-08 11:15:06 +01:00
Christoph Lendenfeld
beacdc3f01 Fix #115330: Animation not updating when cancelling modal operators in the Graph Editor
When using any of the operators in `graph_slider_ops.cc` and cancelling the operation,
the location of the object in the 3D viewport might get stuck in the state prior to cancelling.

To fix this, explicitly update the depsgraph when cancelling.

I've only done that in case of cancelling, since that's where the issue came from.
For fear of introducing performance regressions I'm not tagging the depsgraph
for an update at any other point. (It might already do that at some other part of
the operator code though)

Pull Request: https://projects.blender.org/blender/blender/pulls/115810
2023-12-08 11:12:50 +01:00
casey bianco-davis
58041799bc GPv3: Overlay: Only show visible and editable materials
This PR makes it so that locked materials as well as hidden materials will not have their edit points and edit lines visible.

Note: Previously in grease pencil, strokes with hidden materials would still display the edit lines. This behavior is now fixed in GPv3.

Pull Request: https://projects.blender.org/blender/blender/pulls/115740
2023-12-08 10:38:12 +01:00
Campbell Barton
9c5ddd17aa PyAPI: support global window areas with Context.temp_override
Check for the windows global areas as well as screen areas when
validating context members before assigning.
2023-12-08 16:32:16 +11:00
Campbell Barton
1ec10323ff Fix Context.temp_override restoring freed values on exist
Since windowing data may have been freed, validate the members
before restoring them when the context-manager exits.
2023-12-08 16:23:08 +11:00
Campbell Barton
328d5bcc3c Fix Context.temp_override(..) use with temporary screens
Subtle regression in [0] caused context override to fail when
passing in the current context when a temporary screen was used.

While passing in a temporary screen as an override isn't supported,
this shouldn't raise an exception if the argument matches the current
context.

Also added sanity check that the window passed in exists
and code comments to give an explanation of the current behavior.

[0]: 6af92e1360
2023-12-08 16:22:21 +11:00
Campbell Barton
77695da84b Cleanup: minor formatting tweaks 2023-12-08 16:22:14 +11:00
Campbell Barton
5932d38b91 Cleanup: remove unused variables 2023-12-08 16:22:13 +11:00
Hans Goudey
7f6cf068d5 Fix #115924: Sculpt: Draw face sets not working on first try
The ID to draw should start at one, in order to not draw the "1"
face set which displays as white by default. There is still an issue
with dynamic topology drawing, but that's likely unrelated.
2023-12-07 23:48:01 -05:00
Hans Goudey
08d657c874 Cleanup: Move sculpt undo system to C++ namespace
Similar commits:
- 466dca07d5
- 1863533eb6
- 785c49cf44
- ed7b914bd8
2023-12-07 23:43:35 -05:00
Hans Goudey
d742f08cc6 Cleanup: Change some view3d projection functions to use C++ types
These two have been used a lot in C++ code so the benefits are clear.
2023-12-07 23:07:52 -05:00
Germano Cavalcante
e368a72f20 Fix #112394: 'Absolute Grid Snap' not working correctly plane constraint
It is necessary to clear the result of the previous 'target_type' and
apply the constraint before and after snapping to grid.
2023-12-07 21:55:48 -03:00
Hans Goudey
2b0448c91d Cleanup: Write sculpt mask directly when restoring data before stroke
`SculptMaskWriteInfo` is meant as a temporary solution to ease the
transition to code specialized specialized per PBVH type. Remove one
use of it.
2023-12-07 19:25:44 -05:00
Ray Molenkamp
df94b2ef1b Fix: Build error with MSVC
the bots seem to struggle with this test after 7e916474db
doesn't make a whole lot of sense, and i can't repro the
issue locally, but helping it a little to pick the right
template wouldn't hurt.

Pull Request: https://projects.blender.org/blender/blender/pulls/115916
2023-12-08 00:23:07 +01:00
Clément Foucault
71f6228876 EEVEE-Next: HiZBuffer: Add support for 2nd layer
This allows for parallel processing of refraction.
Also fix a limitation of using AO node in
refraction materials.

This is needed for the grouping of raytracing
passes.

This increases VRAM consumption a bit (8MB for fullHD
frame) but has no impact on performance.

This include a needed fix to the `draw::Texture::swap`.

### Later work
- Limit the memory overhead to the cases where it is needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/115912
2023-12-07 22:04:38 +01:00
Brecht Van Lommel
a355488993 Cleanup: make format 2023-12-07 19:59:16 +01:00
Nate Rupsis
f4bc01b6b7 Refactor: Refactor nla_strip_get_color_inside method
Cleanup `nla_strip_get_color_inside` in `nla_draw.cc`.

Pull Request: https://projects.blender.org/blender/blender/pulls/115870
2023-12-07 19:23:22 +01:00
Hans Goudey
3c476979b1 Cleanup: Resolve mix of bool and char warning 2023-12-07 12:14:28 -05:00
Habib Gahbiche
89f7dc9cbe Fix #115779: Compositor Split node factor 0 still shows the other image
At 0% split ratio, the result of the split node still shows the first row or the first column.

Pull Request: https://projects.blender.org/blender/blender/pulls/115844
2023-12-07 18:10:42 +01:00