Commit Graph

122737 Commits

Author SHA1 Message Date
Campbell Barton
99d7816d06 Cleanup: suppress clang-tidy warnings in GHOST_Types.h 2023-03-27 11:07:27 +11:00
Campbell Barton
4e51008a82 GHOST: replace multiple functions with a single capabilities flag
Adding checks for platform capabilities involved adding functions
to multiple classes and was too involved.

Replace this with a single GHOST_System::getCapabilities() function.
2023-03-27 11:01:20 +11:00
Omar Emara
2f4a7d67b7 Realtime Compositor: Implement Anti-Aliasing node
This patch implements the Anti-Aliasing node by porting SMAA from
Workbench into a generic library that can be used by the realtime
compositor and potentially other users. SMAA was encapsulated in an
algorithm to prepare it for use by other nodes that require SMAA
support.

Pull Request: https://projects.blender.org/blender/blender/pulls/106114
2023-03-26 16:59:13 +02:00
Joseph Eagar
8c1090aeb0 Merge branch 'blender-v3.5-release' 2023-03-25 14:20:43 -07:00
Joseph Eagar
16cb13b8a0 Fix: Vertex paint filter operators broken undo
Vertex paint's filter operators were not properly going through the SculptSession API.
Undo didn't work; sometimes the operators would do nothing or produce corrupted colors.

The `transform_active_color` helper function now handles all of this.  It ensures a valid
SculptSession exists and executes an undo push.

Reviewed By: Hans Goudey
Pull Request: https://projects.blender.org/blender/blender/pulls/106136
2023-03-25 22:10:10 +01:00
bonj
847bc5c2fd Cleanup: DRW: Utility defines for retopology overlay
Move some retopology overlay logic to defines which can be reused
elsewhere.

Pull Request: https://projects.blender.org/blender/blender/pulls/106129
2023-03-25 15:34:09 +01:00
Omar Emara
9678e6e7e5 Fix: Variable size blur implicitly works with Fast Gaussian
If the variable size option of the Blur node was previously set to true
and the type of blur was later set to Fast Gaussian, variable size blur
will take effect, even though the option is not visible to the user.

This patch fixes the issue by disabling variable size blur when the blur
type is set to Fast Gaussian.
2023-03-25 11:41:22 +02:00
Chris Blackbourn
51bc44420b Cleanup: format 2023-03-25 11:22:36 +13:00
Chris Blackbourn
c685d1935a Fix #106041: fix uv packing performance on aligned quads
More improvements to the xatlas "witness" mechanism.
2023-03-25 11:20:27 +13:00
Germano Cavalcante
18232af3ee Transform: Improve workaround used in #40241
Prefer `invoke` over `modal` to initialize a value that doesn't need to
be computed again.

Also avoid repeated `source_operation` checks.
2023-03-24 17:06:33 -03:00
Harley Acheson
1d84216c09 Fix #105891: Faster Font Fallback Finding
An improved strategy for finding glyphs within our font fallback stack.

Pull Request: https://projects.blender.org/blender/blender/pulls/106011
2023-03-24 19:55:28 +01:00
Clément Foucault
9c8cb823a0 BLI: Fix compilation when importing BLI_math_rotation.hh
It worked until now because `<iostream>` was included by other headers
before the rotation ones. But this didn't work in all cases. This commit
make sure all rotation type headers include it.
2023-03-24 17:42:34 +01:00
Christoph Lendenfeld
4eb24a4da3 Cleanup: Graph Editor "Gauss" to "Gaussian" 2023-03-24 16:18:09 +01:00
Christoph Lendenfeld
c4832af274 Fix: paintface_mouse_select not calling finish()
Every time you selected a face in weight paint mode
it would give a warning.
2023-03-24 15:37:53 +01:00
Christoph Lendenfeld
7eefdad051 Merge branch 'blender-v3.5-release' 2023-03-24 15:14:52 +01:00
Sergey Sharybin
08466a93e3 Fix security warning generated by std::tmpnam
Effectively replicate the behavior of the function in the manner
which is used for autosave file.

There might be better a solution which is cross-platform and does
not suffer from the time of check, time of use (TOCTOU) vector of
attack. This seems to be a bigger project to figure out, so until
then silence the warning: it is fine since the directory is only
used to chdir to, so worst case an external attacker can introduce
is a test failure.
2023-03-24 14:52:43 +01:00
Sergey Sharybin
9266469117 Refactor: Use utility function from BLI for temp directory
Should be no functional changes as the utility is based on the
code from the where_is_temp().
2023-03-24 14:52:43 +01:00
Sergey Sharybin
8c38d29feb BLI: Add utility to access system-wide temporary directory
It provides path to a directory suitable for storing temporary files
which satisfies the following conditions:

- The directory exists.
- The return path has trailing directory separator.

It is based on the code used in the appdir.c to get the temporary
directory.

For the C++ people: this is similar to the temp_directory_path()
from the std::filesystem.

No functional changes expected as it is a new code which is planned
to be used on other places as a followup development.
2023-03-24 14:52:43 +01:00
Christoph Lendenfeld
d5d8246441 Fix #106095: FCurves not drawn when Extrapolation is disabled
Bug introduced by c2c67079190acc558d662a02fbf5a149acbbbaf8
Fixing it by undoing the changes to the if statements
at the start of the FCurve drawing functions.

This keeps the intended behavior of the previous path, while fixing the drawing

Pull Request: https://projects.blender.org/blender/blender/pulls/106100
2023-03-24 14:18:00 +01:00
Sergey Sharybin
18a15bafe8 Fix blender_test not re-linked on macOS after changes
The Linux worked due to the libraries provided as a dependency
via `EXTRA_LIBS "${TEST_LIBS}"` with extra whole archive.

While on Windows and macOS the whole-archive is not needed the
dependency from the library to the blender_test is still needed.

Solves the issue when modifying asset_catalog_test.cc on macOS
does not make blender_test to be relinked.

Pull Request: https://projects.blender.org/blender/blender/pulls/106051
2023-03-24 14:11:46 +01:00
Christoph Lendenfeld
d78550634a Fix: Crash when trying to get FCurve segments of baked curve
When using the slider operators in the Graph Editor
the code would try to access `FCurve.bezt` without checking that exists.
When the curve is baked that is a null pointer.

Pull Request: https://projects.blender.org/blender/blender/pulls/106102
2023-03-24 13:52:54 +01:00
Hans Goudey
cef82a1d39 Cleanup: Grammar: "it's" vs "its" 2023-03-24 08:34:21 -04:00
Leon Schittek
22a3eb47ec Fix #106097: Don't offset child nodes when pasting
Nodes inside of frames where pasted with an offset from the cursor.
Since the location of nodes is in parent space, child nodes don't need
to be offset separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/106099
2023-03-24 12:47:54 +01:00
Campbell Barton
03cfa75bcc Merge branch 'blender-v3.5-release' 2023-03-24 22:42:33 +11:00
Campbell Barton
cb4f7cac24 Fix #106040: pasting long text fails in Gnome-Shell/Wayland
Workaround gnome-shell including uninitialized memory when pasting
from the clipboard. Where `read` would not write data into the range
return by the length.

Reading from the pipe into a power-of-two buffer
works around the problem.

It's not clear why this only impacts gnome-shell - as there is no
significant down-side to changing the buffer size, apply a workaround.

Ref !106091.
2023-03-24 22:25:26 +11:00
Christoph Lendenfeld
5d5027db03 Animation: Gaussian Smooth operator for Graph Editor
Add a Gaussian smoothing operator to supersede the current
smoothing operator in the graph editor.

Advantage over the current implementation:
* Supports modal operations
* Is independent of key density
* More options in the redo panel
* More predictable Impulse Response

Option in the redo panel to change

Filter Width: How far out on each side of a key the code checks
to average key values

Sigma: The shape of the bell curve, lower values make a sharper bell curve
reducing the smoothing effect.
Too High values will make the code behave like an average filter as the
curve in the -1/1 range will almost be flat.

On a technical note, the operator needs to store additional data when running in modal
to avoid allocating/deallocating data on every modal run.
For that reason the `tGraphSliderOp` struct has been extended with
`void *operator_data` and `void (*free_operator_data)(void *operator_data)`.
The former is the data and the latter is a function responsible for freeing that data.

Pull Request: https://projects.blender.org/blender/blender/pulls/105635
2023-03-24 12:11:20 +01:00
Julian Eisel
8069b01c28 Cleanup: Make drop target creation functions non const
These often want to store a non-const reference to its owner, i.e. the
object that created them. I don't really like removing const here, but
it makes sense to enable this use case.
2023-03-24 11:53:49 +01:00
Julian Eisel
64f3afb267 Fix UI view drag target not using correct boundaries with panels
Initial idea was to calculate the view boundaries when finishing the
`uiBlock`, after layout code and such ran. But the panel code applies an
offset later, which breaks this. The view boundaries would be off by
something like 100px.
2023-03-24 11:40:09 +01:00
Philipp Oeser
2fba27e6d8 Fix #105325: crash calling asset_generate_preview() in backgound mode
`.asset_generate_preview()` internally calls `UI_icon_render_id` as a
job -- as opposed to `.preview_ensure()` [which internally also calls
`UI_icon_render_id`, but not as a job] leading to crashes in background
mode.

This might be due to the fact that OpenGL context is not set up
correctly (so there might be other ways to fix this), but there seems to
be other places/comments indicating that icon handling is only for main
thread (see e.g. 13beeb589227).
And while this does not fully explain why doing this with jobs works fine
from the UI, the patch certainly fixes the crashes in background mode for
now (by not using jobs).

Pull Request: https://projects.blender.org/blender/blender/pulls/106046
2023-03-24 09:17:00 +01:00
Jeroen Bakker
08a6361b3f Vulkan: Texture Data Conversions
This PR adds basic support for texture update, read back and clearing
for Vulkan. In Vulkan we need to convert each data type ourselves as
vulkan buffers are untyped. Therefore this change mostly is about data
conversions.

Considerations:
- Use a compute shader to do the conversions:
  - Leads to performance regression as compute pipeline can stall
    graphics pipeline
  - Lead to additional memory usage as two staging buffers are needed
    one to hold the CPU data, and one to hold the converted data.
- Do inline conversion when sending the data to Vulkan using `eGPUDataFormat`
  - Additional CPU cycles required and not easy to optimize as it the
    implementation requires many branches.
- Do inline conversion when sending the data to Vulkan (optimized for CPU)

For this solution it was chosen to implement the 3rd option as it is fast
and doesn't require additional memory what the other options do.

**Use Imath/half.h**
This patch uses `Imath/half.h` (dependency of OpenEXR) similar to
alembic. But this makes vulkan dependent of the availability of
OpenEXR. For now this isn't checked, but when we are closer to
a working Vulkan backend we have to make a decision how to cope with
this dependency.

**Missing Features**

*Framebuffer textures*
This doesn't include all possible data transformations. Some of those
transformation can only be tested after the VKFramebuffer has been
implemented. Some texture types are only available when created for a
framebuffer. These include the depth and stencil variations.

*Component format*
Is more relevant when implementing VKVertexBuffer.

*SRGB textures*
SRGB encoded textures aren't natively supported on all platforms, in
all usages and might require workarounds. This should be done in a
separate PR in a later stage when we are required to use SRGB textures.

**Test cases**
The added test cases gives an overview of the missing bits and pieces of
the patch. When the implementation/direction is accepted more test cases
can be enabled/implemented.

Some of these test cases will skip depending on the actual support of
platform the tests are running on. For example OpenGL/NVidia will skip
the next test as it doesn't support the texture format on OpenGL, although
it does support it on Vulkan.

```
[ RUN      ] GPUOpenGLTest.texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2UI
[  SKIPPED ] GPUOpenGLTest.texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2UI [ RUN      ] GPUVulkanTest.texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2UI
[       OK ] GPUVulkanTest.texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2UI
```

Pull Request: https://projects.blender.org/blender/blender/pulls/105762
2023-03-24 08:09:19 +01:00
Jeroen Bakker
d5df77199b Vulkan: Resource Submission Tracking
In Vulkan multiple commands can be in flight simultaneously.

These commands can share resources like descriptor sets or push
constants. When between commands these resources are updated
a new version of the resources should be created.

When a resource is updated it should check the submission id of the
command buffer. If this is different than last known by the resources,
the previous resources should be freed.
If the submission id is the same than previously it has to create a
new version of the resource to not intervene with other commands that
uses the resource before the update.
When the resource wasn't updated between multiple usages in the same
submission id it could reuse the previous resource.

This PR introduces a `ResourceTracker` and a `SubmissionTracker`.
A submission tracker can check if the command buffer is submitted.
In this case all resources of the resource tracker should be freed.
Unmodified resources in the same submission can be shared.

A resource tracker will keep track of all resources that are in
flight. After the resources are used (submission + execution) have
finished the resources can be cleared.

Pull Request: https://projects.blender.org/blender/blender/pulls/105183
2023-03-24 07:47:50 +01:00
Jeroen Bakker
1588f57602 Fix: Targa with Palette Shows Grayscale in Viewport.
Viewport assumes that when the number of planes of the image
buffer is less or equal to 8 it is a gray scale image. In that
case it will optimize the texture to be stored as a grayscale
image on the GPU.

When using a targa file with a palette, the bitplanes were not
extracted from the actual colors, but from the number of colors
that were present in the palette.

Image buffers don't support palettes so that doesn't make sense.
This PR uses the bitdepth of the actual colors inside the palette
to identify the number of planes to use in the image buffer.

Pull Request: https://projects.blender.org/blender/blender/pulls/106047
2023-03-24 07:46:33 +01:00
Campbell Barton
a016d142e8 Fix #106040: pasting long text fails in Gnome-Shell/Wayland
Workaround gnome-shell including uninitialized memory when pasting
from the clipboard. Where `read` woud

Reading from the pipe into a power-of-two buffer
works around the problem.

It's not clear why this only impacts gnome-shell - as there is no
significant down-side to changing the buffer size, apply a workaround.
2023-03-24 17:12:02 +11:00
Campbell Barton
3dcd4df70c UI: support the primary clipboard for console & 3D text selection
Only the text editor supported the primary clipboard & only for modal
selection. Now selecting text in the console & 3D text editing also
sets the primary clipboard under X11 & Wayland.

Notes:

- Pasting from the primary clipboard isn't yet exposed in the key-map
  so in practice it's only useful for pasting text outside of Blender.
- Use skip-save option when pasting from the primary selection
  so this is never used by the regular paste shortcut.
- This commit adds a primary-clipboard flag to WM_capabilities_flag() so
  creating the the copy-buffer is only performed when necessary.
2023-03-24 17:09:39 +11:00
Daniel Salazar
c971adfeef Separate ColorRamp node name into Color Ramp
Node names should be properly separated for easy searching and reading
and for consistency with other (color) nodes.

This commit should only touch UI names which do not need versioning and does not break node setups or py scripts.
2023-03-24 05:00:02 +01:00
Aaron Carlisle
3fe7e1f03b Update RNA to User manual mappings 2023-03-23 21:58:53 -04:00
Aaron Carlisle
6caccf6b9f Update RNA to User manual mappings 2023-03-23 21:57:56 -04:00
Hans Goudey
058a0187f8 Fix #106029: Crash sculpting with dynamic topology
The pbvh->mesh pointer isn't set when dyntopo is enabled.
2023-03-23 21:57:55 -04:00
Chris Blackbourn
f7946b486b Fix #106041: fix uv packing performance on aligned quads
AABB aligned quads would defeat the "witness" accelerator when
using the xatlas packing strategy.

This change reorders the search to allow use of the "witness" technique.
2023-03-24 12:11:00 +13:00
Chris Blackbourn
8a5c9f1f6e Fix #105058: fix UV ABF++ bounds check on large angles
Previous code had a faulty do-while-loop which only checked
bounds on one angle instead of all three.
2023-03-24 11:47:15 +13:00
Weizhen Huang
1111ce3472 Fix rotate around zero vector in #OrientationBounds 2023-03-23 18:42:39 +01:00
Clément Foucault
b57b22388c BLI: Fix drawdata leak on Scene IDs
A call to `DRW_drawdata_free` must be present for all ids that can hold
draw data. The Scene ID was missing one and was leaking data on
EEVEE-Next.
2023-03-23 16:43:50 +01:00
Jeroen Bakker
fda65ad5ca GPU: Renderdoc Frame Capturing
This PR uses renderdoc for frame capturing when enabled.
It enabled an easier workflow for frame capturing.

- Capture GPU API calls from test cases
- Capture GPU API calls from background threads
- Capture GPU API calls from background rendering.

Renderdoc is an important GPU debugger used by the Eevee/
Viewport module. Previously we needed to change code in
order to record background rendering, that could on its own
lead to other side-effects.

The integration with renderdoc can be enabled using
`WITH_RENDERDOC=On` compiler option. `GPU_debug_capture_begin`
and `GPU_debug_capture_end` can be added to the section
of the code you want to debug. When running Blender inside
renderdoc this part will automatically be captured.

All GPU test cases are now guarded by these calls. In order
to capture the test cases you need to start the test cases
from renderdoc and the captured GPU API calls will appear
where each capture is a single test case.

Pull Request: https://projects.blender.org/blender/blender/pulls/105921
2023-03-23 16:37:52 +01:00
Sergey Sharybin
0efb7a202e Fix #105954: RIGIDBODY_REBUILD failure on rendering
Happens if a scene has a PointerProperty of type collection which
is set to a collection containing rigid bodies.

The error is printed by the builder of the render pipeline graph,
which contains very minimal subset of the view layer: it includes
custom properties (which gets recursed into), but not the rigid
body simulation.

This fix is mainly suppressing the error print, without changing
the apparent behavior of the graph.

Pull Request: https://projects.blender.org/blender/blender/pulls/106045
2023-03-23 15:51:29 +01:00
a2827af0aa Cleanup: NLA, remove FIXME and other unnecessary comment 2023-03-23 15:08:26 +01:00
831060a2c5 Cleanup: remove no-longer-relevant FIXME
"double check whether ANIMFILTER_LIST_VISIBLE is needed" above code that
doesn't actually use that flag.

No functional changes.
2023-03-23 13:02:16 +01:00
e84ae56621 Refactor: remove enum eAnimFilterFlags
Remove `enum eAnimFilterFlags` from `ED_keyframing.h`, the function
parameters that pass them around, and the code that uses them to filter
things.

Only one of the enum values was actually used, `ANIMFILTER_KEYS_LOCAL`.
It indicates whether to only consider keys on the datablock itself (when
set), or in the case of objects, also consider keys on its materials or
shapekeys (when cleared). However, this flag was *always* set, making it
possible to remove the code that handled it.

Finally there was only one function that received a `filters` parameter
that could be different across calls: it would either have value
`ANIMFILTER_KEYS_LOCAL` or `0`. However, the only flag it actually tested
for was `ANIMFILTER_KEYS_MUTED`, which was never actually set. So all of
that could be removed as well.

Just for grepping-through-history sake, these are the flags that were
removed:

- `ANIMFILTER_KEYS_LOCAL`
- `ANIMFILTER_KEYS_MUTED`
- `ANIMFILTER_KEYS_ACTIVE`
- `ANIMFILTER_KEYS_NOMAT`
- `ANIMFILTER_KEYS_NOSKEY`

Note: this is NOT about the flags defined in `ED_anim_api.h`, in `enum
eAnimFilter_Flags`. Note the different names, the one that's removed
doesn't have an `_`.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/106028
2023-03-23 13:00:56 +01:00
Jeroen Bakker
9c6b0daad5 Python: Limit BGL deprecation messages.
This PR change the number of displayed BGL deprecation messages
from 100 to 10.

Fix: #105997
Pull Request: https://projects.blender.org/blender/blender/pulls/106032
2023-03-23 12:38:36 +01:00
Weizhen Huang
e77b666ae9 Fix normalize zero vector in light tree #OrientationBounds
was assuming such cases are already handled before this function is
called, but seems to be broken on windows and linux. Do
`safe_normalize()` so the tests pass, will check the problem afterwards.
2023-03-23 12:38:25 +01:00
Christoph Lendenfeld
e38ef6aca1 Refactor: Move static functions to the top
No functional changes.
A set of functions to get the bounds of a channel was created
for the `ANIM_OT_channels_view_selected` operator.
Theses functions will be used by other functions in this file,
so they need to move to the top.
2023-03-23 11:55:21 +01:00