Commit Graph

121878 Commits

Author SHA1 Message Date
Harley Acheson 89c3ead7c6 Fix #105388: Default Font Accidentally Kerning
Move the code that disables kerning for the default font so it can't be
re-enabled by the cache subsystem.

Pull Request #105415
2023-03-03 23:17:20 +01:00
Timo Gurr 0d080d1a07 Fix: Build with FFmpeg 6.0
Pull Request #105377
2023-03-03 18:42:35 +01:00
Christoph Lendenfeld 513d31360f Fix #105329: Keyframe handles staying in place when using slider operators
The issue was that when using the `HD_ALIGNED` handle type,
Blender would not automatically move the keyframe handles with the key.
Instead one handle would get stuck in place.
To remedy that manually move the keyframe handles in case the type is `HD_ALIGNED`
This makes it consistent with moving a key with G

Pull Request #105401
2023-03-03 16:41:14 +01:00
Brecht Van Lommel 549cc568b0 Fix various issues with modifiers and edge display in edit mode
Consistently use edge draw flag instead of original index to determine if an
edge should be drawn or not.

In GPU subdivision the edge original index was used for both edge optimal
display and selection mapping to coarse edges, but they are not the same.
Now match the CPU subdivision logic and use a separate edge draw flag VBO.

For cage display, match Blender 3.3 behavior more in showing/hiding of edges
in wireframe mode. That is edges without a mapping to an original edge are
always hidden when there is no distinct cage, and drawn otherwise. This is
not ideal for e.g. the bevel modifier where it will always show some edges on
corners despite all edges being hidden by the user. But we currently have
no good information to decide if these should be hidden or not, so err on
the side of showing too much as it did before.

Fie #103706: bevel modifier edges not drawn correctly
Fix #103700: optimal display can't be turned of with GPU subdivision
Fix wrong edge display with GPU subdivision preceded by other modifiers

Pull Request #105384
2023-03-03 16:38:27 +01:00
Bastien Montagne d66672e17a WM: Fix invalid memory access in wmTimer handling code.
Timer management code often loops over the list of timers, calling
independant callbacks that end up freeing other timers in the list. That
would result in potentail access-after-free errors, as reported in #105160.

The typical identified scenario is wmTimer calling wmJob code, which
calls some of the job's callbacks (`update` or `end` e.g.), which call
`WM_report`, which removes and add another timer.

To address this issue on a general level, the deletion of timers is now
deferred, with the public API `WM_event_remove_timer` only marking the
timer for deletion, and the private new function
`wm_window_delete_removed_timers` effectively removing and deleting all
marked timers.

This implements design task #105369.

Pull Request #105380
2023-03-03 15:24:26 +01:00
Campbell Barton 24f3cb9b5c Fix #105381: Alt-Tab causes Alt to stick with multiple monitors on WIN32
Window activation events on Windows-10 don't seem to be reliable as it's
possible for Alt-Tab to trigger WM_ACTIVATE on a window when switching
away from it. As detecting the keys which are held relies on a valid
active state - this meant Alt could become stuck when using Alt-Tab
to switch between windows.

Disable reading modifiers on activation for WIN32, activating the window
now clears modifiers on WIN32. This isn't ideal as held modifiers wont
be detected, re-introducing the error reported in #40059.
2023-03-03 23:12:28 +11:00
Jason Fielder d3cbfc96e0 Metal: Ensure explicit UBO bind indices
Previously, UBO bind locations were linearly incremented and
relied on  the correct uniform location being queried. This fix
is a future requirement for EEVEE next, however, pulling forward
due to Issue #105280 highlighting a possible flaw with expected
uniform locations.

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #105311
2023-03-03 12:03:43 +01:00
Jason Fielder 06cf84f77f EEVEE: Resolve artifacts in EEVEE with Intel GPUs on macOS.
Intel GPUs exhibit a number of rendering artifacts.
The most substantial being incorrect resolve of reflections.
Splitting the reflections_resolve shader into two passes,
one for SSR and one for light probes ensures correct rendering
and optimal performance on this GPU.

Also resolves an artifact with ambient occlusion wherein
the pow(a, b) function causes excessive precision loss.
Using an alternative method for power calculation on these
platforms resolves the issues.

Authored by Apple: Michael Parkin-White

Ref T96261
Pull Request #105240
2023-03-03 11:53:15 +01:00
Jason Fielder 9801f7def8 Fix #105280: DRW: Allow UBO bindpoint of 0 for clipping data.
The check was testing against 0 instead of -1
(invalid location).

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #105310
2023-03-03 11:24:31 +01:00
Jason Fielder 48aac51c35 Fix: EEVEE: Lightcache texture usage flags
Metal backed requires HOST_READ texture usage flag
for irradiance grid. This was correctly in place for the
basic grid, but not for grid_prev.

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #105312
2023-03-03 11:02:37 +01:00
Jason Fielder 7e5cb36e0c Metal: Fix erroneous outvar replacements.
Resolves issue with node_holdout perfomring an outvar
replacement on a function, causing shader compilation
failure.

Ref #96261
Pull Request #105396
2023-03-03 11:01:36 +01:00
Falk David 00ca7c5221 Fix #105109: Pick selection with multi object edit
Pick selection for the Curves object was not considering multi
object editing. Only the active object was considered.

This fix introduces pick selection for Curves for multi object editing.

Pull Request #105184
2023-03-02 15:43:15 +01:00
Philipp Oeser 422f3d0b0f Fix #105278: IDProperty UI missing library overridable toggle
The toggle (for anything but float and int types) was swallowed in
bf948b2cef. Also seems ef68a37e5d discarded
`property_overridable_library_set` for bools.

Now treat the overridable toggle as a general property for all property
types.

Pull Request #105370
2023-03-02 15:13:52 +01:00
Bastien Montagne 9e5275791f Fix #105343: id.make_local() doesn't work for overridden data.
RNA `make_local` call isfairly low-level and by-passes
`BKE_library_make_local`, so it also needs to handle the liboverride
case itself.
2023-03-02 11:02:16 +01:00
Philipp Oeser 2eeec49640 Fix #105339: grease pencil selection can toggle object selection
Grease Pencil (when not in object mode) implements its own selection
opertor. This operator (`gpencil.select`) returns
`OPERATOR_PASS_THROUGH`, then falls though to `view3d.select` which can
toggle object selection (when using shift-click picking).

Removing `OPERATOR_PASS_THROUGH` would fix the object toggling, but this
was added in 62c73db734 with good reason (the tweak tool would not
work then).

Now prevent `view3d.select` from acting on Grease Pencil (when not in
object mode).

NOTE: longer term we could have grease pencil use view3d.select to avoid having to add these awkward exceptions

Pull Request #105342
2023-03-02 09:52:35 +01:00
Campbell Barton 944a6e78f5 Fix #105277: Alt key suck after Alt-Tab on Windows 11
Windows 11 has strange behavior with Alt-Tab.
In some cases an Alt-Press event is sent to the window immediately
after it is de-activated (both Left & Right Alt keys for some reason
even when only one is held).

This meant that:

- Modifiers could be enabled for de-activated windows
  (so we can't assume de-activated windows have modifiers released).

- Releasing the modifier key would not be sent to the inactive window
  causing the modifier key to be stuck.

- Button events over an inactive window are generated before activation,
  so even though activation reads the correct modifier state,
  the button event uses the "stuck" modifier state.

Now button & drop events on inactive windows always read the modifier
state first instead of relying on the modifier state to be cleared.

This has some advantages:

- If modifiers are held, they will be used as part of the click action.

- While modifier keys on inactive windows should be rare,
  in the case this does happen - stuck keys are avoided.
  So it makes sense to apply these changes for all platforms.
2023-03-02 16:35:46 +11:00
Campbell Barton b61807ebcf Cleanup: split logic for updating event modifiers into functions
Also remove USE_WIN_ACTIVATE & USE_WIN_DEACTIVATE defines as they
were only added when changes to modifier handling failed on WIN32.

This logic has now been tested to work on all platforms.
2023-03-02 16:08:14 +11:00
Campbell Barton ff89dfd6d2 Fix #105328: unit system does not affect cavity 2023-03-01 21:15:11 +11:00
Marc Chéhab 52064bf5da Fix #104824: GPencil natural drawing building with 1 subdivision very slow
1. Changes the subdivision function to not fill in time but add 0 to fix bug #104824
2. Fixes a bug in sanitization function noticed while fixing this bug.

Pull Request #105306
2023-03-01 10:09:23 +01:00
RedMser 337e68aeb5 Test: update bl_rna_defaults
- Remove Group test
- Add Brush, Collection, GreasePencil, HairCurves,
  LightProbe, PointCloud, Volume tests

Ref !105172.
2023-03-01 11:18:47 +11:00
Hans Goudey d90d6f8674 Fix #105259: Copy & paste boolean custom property as driver doesn't work
A copy and paste mistake in ef68a37e5d.
2023-02-28 17:46:26 -05:00
Hans Goudey 079dbf4d1b Fix #105162: Array modifier cap material index ignored
The material indices from the caps were only copied if the base mesh had
a material index attribute. Fix that by copying them manually if the cap
has the attribute.
2023-02-28 15:39:19 -05:00
Hans Goudey 15f59470a3 Fix #105314: Custom node groups missing sockets
`ShaderNodeCustomGroup` and others lost their UI with
7026096099 without a dynamic declaration callback.
2023-02-28 13:59:28 -05:00
Hans Goudey 076a33ccd1 Fix #104219: Node links dragged from wrong socket after selection
Nodes are sorted based on the selection. In some cases (even depending
on processor speed, nodes can be selected and reordered, and another
operation can run before the next redraw). That gives a window where
operators mapped to the same input as selection can run with invalid
socket locations (which aren't updated after the nodes are reordered,
since they are stored in a separate array).

To fix this, move the socket locations from the node editor runtime
data to the node tree, tag them as invalid when the nodes are
reordered, and check for that status in a few more places.

A better longer term solution is not reordering nodes based on
UI status and instead storing the UI drawing order separately.

Pull Request #104420
2023-02-28 11:35:32 -05:00
YimingWu 30a81f1b55 GPencil: UV parameters for the first point in sample modifier.
Simplify modifier sample mode failed to transfer uv parameters for the first point, now fixed.

Continuation of #104942

Pull Request #105284
2023-02-28 12:15:50 +01:00
Michael Jones 7842347ec8 Cycles: Fix hanging unit tests when MetalRT is enabled
This patch fixes hanging unit tests when MetalRT is enabled. It simplifies and fixes the kernel selection logic by baking the MetalRT-specific options into `kernels_md5` rather than expanding out and testing MetalRT bit flags explicitly.

Pull Request #105270
2023-02-28 11:42:08 +01:00
Campbell Barton 9fccd2dc24 Fix #100819: Built-in VFont has an additional user by default
New built-in fonts would have an additional user when added for the
first time.

BKE_vfont_builtin_get now always borrows the reference.
2023-02-28 17:08:23 +11:00
Campbell Barton 9cee0eb7fa Cleanup: format 2023-02-28 15:44:49 +11:00
illua1 e885973ea9 Fix #104894: Toggle comments assumes '#' prefix (failing for OSL)
Add comment line prefix to format struct so each language can define
it's own comment prefix.

Ref !104953.
2023-02-28 15:43:11 +11:00
Campbell Barton 52f521dec4 Fix #105063: Registering existing RNA types overwrote built-in types
When an RNA type was registered, any existing dynamic types with the
same name were unregistered. This didn't account for built-in types
which cannot be unregistered in (most cases) allowing duplicate
operators for e.g. to be registered with the same name as existing
built-in operators (asserting with debug builds with GHash duplicates).

In practice the newly registered operator would be called unless
adding operators caused the GHash to be resized which could cause the
original operator to be used.

As registered RNA type identifiers are meant to be unique, don't allow
duplicate names in the first place. Now all dynamically registerable
RNA types prevent this situation, raising an error when scripts
attempt to register a type with an identifier matching the name of a
type that could not be removed.
2023-02-28 13:58:40 +11:00
Campbell Barton 0965341dcf Fix #105229: Operator tooltips are cut short
Shortened in [0], increase to 1024 with the following changes:

- Use BKE_ST_MAXNAME for translation_context.
- Use OP_MAX_TYPENAME for wmOperatorType.name.

Both these limits were already used elsewhere but happened to use
RNA_DYN_DESCR_MAX (incorrectly).

[0]: f403d9a2b1
2023-02-28 10:28:34 +11:00
Campbell Barton de12ea7226 Cleanup: quiet unused warnings 2023-02-28 10:10:12 +11:00
Campbell Barton d291955665 Fix setting the active vertex color when assigning false
Oversight in c517e4a501.
2023-02-28 10:10:12 +11:00
Bastien Montagne 4d5e68a638 Updated i18n PO files from SVN trunk (r6355). 2023-02-27 16:26:22 +01:00
Bastien Montagne 3dd071e39b Usual i18n/UI messages fixes. 2023-02-27 16:19:16 +01:00
Falk David e6af81c536 Fix #105028: No update exiting curves edit mode
Exiting curves edit mode (going to object mode) would not update the
screen.

The fix adds a case to `ED_object_editmode_load_free_ex` for CURVES
to make sure the function returns properly. This then correctly adds the
notifier in `ED_object_editmode_exit_ex` to update the screen.

Pull Request #105252
2023-02-27 16:14:05 +01:00
Damien Picard c5bbc5db6f I18n: disambiguate a few messages
- "Value" in the sense of color lightness is not the same word in
  Japanese as other usages. See #105113.
- "Double" as a data type vs. a value.

Also extract "Custom Color Presets" in the tracking UI.
Run clang-format as well.

Pull Request #105187
2023-02-27 15:21:00 +01:00
Bastien Montagne 1f6c710463 Fix #105230: Crash when reloading a library when one of its scene is active.
Scene and viewlayers pointers in the link/append context data need to be
updated after reload, otherwise they would keep pointing to old freed
IDs.
2023-02-27 14:12:50 +01:00
Jacques Lucke 79bce99260 Fix #104857: crash when datafiles/assets folder does not exist
This adds some simple null checks to avoid the crash. It might still
be good to improve the error message, but also does not seem as
important as avoiding the crash. Typically, users should not run into
this issue because the assets are shipped with Blender.
2023-02-27 14:02:03 +01:00
Jeroen Bakker 9044ba0ae5 Compositor: Compositor Output should Follow Active Node.
When using multiple compositor output nodes, compositing would fail
, showing a completely black output as it doesn't respect the active
node.

This patch will equalize the implementation with the viewer nodes.

Patch created by @OmarEmaraDev

Fixes: #86836

Pull Request #105235
2023-02-27 12:58:25 +01:00
Jason Fielder f738843362 Metal: Fix possible uniform lookup issue.
Similar to recent issues with gl_shader_interface,
ShaderInput lists need to be sorted to ensure correct
and efficient uniform lookup by name.

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #105239
2023-02-27 12:33:28 +01:00
Bastien Montagne 0c67a90e4f #99807: USD IO: Add support for exporting to USDZ
This commit adds the default .usdz export capability.

The importer already supports usdz so no change is required other than updating the text in menu to match the updated exporter text.

On export, a .usd/a/c file has to be created first, and then converted to .usdz. A weird change of directory is required because of a quirk with the USD conversion to usdz. If an absolute filepath is passed into the `UsdUtilsCreateNewUsdzPackage` function, the usd files inside the usdz archive will have the same directory structure, i.e. if one tries to create a file at `C:\code\BlenderProjects\file.usdz`, when the usdz file is created, inside it will have the structure `\code\BlenderProjects\file.usdc`.

This is counteracted by setting the current working directory to the temporary session directory where both the usdc and usdz files are created, and just passing the file name to `UsdUtilsCreateNewUsdzPackage` without any filepath. Once the usdz file is created it is moved to the intended directory.

There is a separate `UsdUtilsCreateNewARKitUsdzPackage` capability for exporting usdz for iOS devices that will be implemented in a follow up patch as it will require some more small UI changes.

Co-authored-by: Charles Wardlaw (@CharlesWardlaw)
Co-authored-by: Sonny Campbell (@SonnyCampbell_Unity)
Co-authored-by: Bastien Montagne (@mont29)

Pull Request #105185, based on #104556.

Pull Request #105223
2023-02-27 11:59:57 +01:00
Bastien Montagne a1c3061812 Fix OSX implementation of `BLI_current_working_dir` and improve tests.
While some implementations of `getcwd` may return an allocated string
instead of the given char buffer in some cases, this is not the expected
behavior of the BLI wrapper. Not to mention the danger of returning a
pointer to a static char buffer...

Improve `ChangeWorkingDirectoryTest` to be more 'full check' regarding
behavior of both `BLI_current_working_dir` and `BLI_change_working_dir`.
Also move call to `BLI_threadapi_init` into proper `SetUp` method (to
have correct symmetry with the call to `BLI_threadapi_exit` in the
`TearDown` one).

Based on investigation by Charles Wardlaw (@CharlesWardlaw).

Pull Request #105220
2023-02-27 11:03:42 +01:00
Charles Wardlaw c4791ee009 Fix tests for macOS storage_apple.mm functions.
Pull Request #105000
2023-02-27 11:03:42 +01:00
DESKTOP-ON14TH5\Sonny Campbell 561e50f6c6 BLI: add function for changing working directory
Add `BLI_change_working_dir(path)` to change the current working directory.

This change is required for adding USDZ support to Blender. When exporting to that format, we are required to do a weird change of directory because of a quirk with the USD library's USDZ functionality. If an absolute filepath is passed into the `UsdUtilsCreateNewUsdzPackage` function, the USDZ archive will store that full path.

macOS uses `NSFileManager` through some new Mac-only wrapper functions.

Ref #99807

Pull Request #104525
2023-02-27 11:03:42 +01:00
Sergey Sharybin 931b832fb2 Fix `make update` when local branch exists
Apparently `git checkout -t` is only allowed to happen for new branches.
Added a code which checks whether the branch already exists and it so
uses the `git checkout <branch>`.

Pull Request #105234
2023-02-27 10:58:58 +01:00
Hans Goudey 97a8bb450c Fix #103387: Radius affects curves bounding box
e8f4010611 unified the bounds computation for the new curves
object type and the rest of the curves system used by geometry nodes.
In the process, it made bounds affected by the control point radius.
In theory that makes sense; the bounds are supposed to be the extents
of the visible geometry. But in practice the change wasn't expected,
for a few reasons:
 - The radius has never affected the bounds for the legacy curve type
 - The default radius of legacy curve objects is absurdly large at 1.0m
 - Only the new curve object has visible radius, and only in "strip"
   mode or when rendering with Cycles

Currently the bounds are only used for the "Bounding Box" geometry node
and the panel in the 3D viewport sidebar, so there isn't any incentive
to choose less intuitive behavior yet.

Long term, the correct behavior is probably to include the radius in
the bounds, but this commit postpones that change to when it works
better with the rest of the curves system.

Pull Request #105154
2023-02-27 00:01:01 +01:00
Hans Goudey 3db246a3ce Fix #104915: Race condition writing subsurf optimal display edges
Writing to a bitmap from multiple threads causes races when writing to
bits within the same integer. Instead, write to a separate boolean
array while subdividing, then move that to the final mesh bit vector.

Notes:
 - The final copy to the bit vector could be replaced by a generic
   `copy_from(Span<bool>)` call in the future.
 - Theoretically we could entirely replace the `BitVector` with an
   `Array<bool>`, but 1/8 the memory use for edges is likely worth it.

Pull Request #105156
2023-02-26 23:59:02 +01:00
Johannes J a8cc5f6919 Fix #104906: GPU: Fix signed/unsigned mismatches in shader code
Fix error message "initializer of type int cannot be assigned to
variable of type uint" on Blender startup.

Pull Request #105153
2023-02-26 16:13:55 +01:00
Jason Fielder 2b7707b0d0 Fix #105059: Fix Grease pencil fill tool with Metal.
GPencil 3D stroke rendering uses a geometry shader.
This is unsupported by the Metal backend, so implement
fix for this failing compilation by shifting geometry shader
logic into the Vertex shader for Metal backend.

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #105143
2023-02-26 15:22:13 +01:00