Commit Graph

113778 Commits

Author SHA1 Message Date
Sybren A. Stüvel
a97fe64c4f Anim: fix Action slot idtype endianness switching
`ActionSlot::idtype` needs some extra care when reading from a blend
file. Blender's generic endian switching needs to be un-done, as the
ID type values are not numerically the same between little and big
endian machines. Due to the way they are defined, they are always in
the same byte order, regardless of hardware/platform endianness.

This is the same for Action Slots as #128129 does for Actions, except
that Action Slots use a `int16_t` instead of `short` and thus don't
need a cast.

Pull Request: https://projects.blender.org/blender/blender/pulls/128438
2024-10-07 10:45:11 +02:00
YimingWu
eec84d16ed Overlay-Next: Check active_base for GPv3 sync
`state.active_base` could be null when checking `active_base->object`,
thus guarding this from happening.
2024-10-07 14:22:20 +08:00
Campbell Barton
98002ce4ad Cleanup: minor simplification to file-selector directory expansion
Instead of setting the directory empty so it's initialized to the root,
use a variable which can be set when there are problems expanding the
path. This is then checked once at the end.

Also avoid inlining platform specific root directory access.
2024-10-07 13:11:51 +11:00
Campbell Barton
c1f18be1ba Merge branch 'blender-v4.3-release' 2024-10-07 13:05:28 +11:00
Campbell Barton
9cda82f3f9 Merge branch 'blender-v4.3-release' 2024-10-07 13:05:24 +11:00
Campbell Barton
f36b303a75 Merge branch 'blender-v4.3-release' 2024-10-07 13:04:26 +11:00
Campbell Barton
a5f121149d Merge branch 'blender-v4.3-release' 2024-10-07 13:02:31 +11:00
Campbell Barton
6039cb17e6 Unix: use getpwuid() to access home when the variable/tilde expand fails
This was already done in GHOST, but not BKE_appdir_folder_home.

Also null check the return value from getpwuid() as it's not
guaranteed to be non-null.
2024-10-07 13:00:56 +11:00
Campbell Barton
1e9206238e Fix crash if expanding the fonts directory fails
Add missing null check for BLI_expand_tilde.
2024-10-07 13:00:53 +11:00
Campbell Barton
ff9d9711d7 Fix crash using "~" in the file selector when the "home" is null 2024-10-07 13:00:52 +11:00
Campbell Barton
e0f036f8f3 Fix inconsistency between *BKE_appdir_folder_{home/default} on macOS
Change from [0] introduced BLI_expand_tilde but missed the change
for BKE_appdir_folder_default.

[0]: 9df13fba69
2024-10-07 12:58:39 +11:00
Jason C. Wenger
262d32b694 Cleanup: improve comments & add error checking asserts
Ref !128610
2024-10-07 12:52:34 +11:00
Campbell Barton
61ea50e9c8 UI: don't resolve // in the file selector for unsaved blend files
Using `//` for unsaved files isn't meaningful, instead of replacing
with a "default" directory, clear the input to avoid confusing
users as to the meaning of the prefix.
2024-10-07 12:21:01 +11:00
Campbell Barton
6df7656fca Cleanup: remove redundant call to BLI_path_abs, reduce variable scope 2024-10-07 12:21:01 +11:00
Campbell Barton
16b839dd5f Docs: expand comments for file selector logic
Some of the assumptions made here weren't so clear,
update comments for clarity.
2024-10-07 12:21:01 +11:00
Campbell Barton
13fdf34e57 Cleanup: early return from file-selector handlers
Also pass arguments Main & FileSelectParams to file_expand_directory
instead of the context as this is a lower level function thats
only ever called when these values are known & doesn't run
the appropriate refresh functions needed to be called on it's own.
2024-10-07 12:21:01 +11:00
Germano Cavalcante
6d5d3ce975 Transform: Simplify and specialize the handling of events
The `transformEvent` function is becoming increasingly complex due to
the inclusion of operation-specific code.

To improve this, remove the `handled` boolean and allow each
`TransModeInfo::handle_event_fn` to determine how to handle already
processed events.

Additionally, move some operation-specific logic to the operators file.

Note:
The `handled` boolean was added in aef307cf31 to fix a bug with the
custom events of the Edge and Vertex Slide operators;
2024-10-05 22:11:07 +02:00
Germano Cavalcante
e82ce39e17 Fix: Snap Toggle not updating snap status after a transform operation
Unlike Snap Invert, Snap Toggle (Shift + Tab) saves the snap status in
ToolSettings.

This is a regression from v3.6
2024-10-05 14:20:29 -03:00
Germano Cavalcante
5eae28e685 Fix: Snap Toggle not updating snap status after a transform operation
Unlike Snap Invert, Snap Toggle (Shift + Tab) saves the snap status in
ToolSettings.

This is a regression from v3.6
2024-10-05 14:18:50 -03:00
Campbell Barton
884b724e08 UI: prevent relative path use in the file selector
It was possible to navigate to a CWD relative path if it was entered
in the directory and it happened to exist
(or entering relative paths: `./`, `../` etc).

After this, navigation in the file selector didn't work well, any paths
loaded would depend on the directory Blender was started in.

While CWD relative paths aren't prevented & can even be useful when
using paths passed in by scripts - there is no need for the file
selector to expose them to the user - potentially forwarding CWD
relative paths to operators where they can cause further problems.
2024-10-05 23:46:07 +10:00
Campbell Barton
47f0042942 UI: prevent CWD relative directories being created in the file selector
Entering a single word (for example) in the file selectors directory
would ask to create the director, which then created the directory
relative to the processes CWD, then set a CWD relative path.

From the users perspective this is strange as it's unclear where
the directory was created the path would not show the CWD prefix.

Resolve by checking the path is absolute and at least one of the parent
paths exists before prompting the user to create the path.

Resolve part of the strange behavior from #128567.
2024-10-05 23:16:29 +10:00
Jacques Lucke
3103daab20 Cleanup: avoid unnecessary use of unique_ptr 2024-10-05 12:04:00 +02:00
Campbell Barton
ae261c424c Merge branch 'blender-v4.3-release' 2024-10-05 18:01:33 +10:00
Campbell Barton
9517f69762 Fix BLI_path_is_abs_from_cwd with root/drive-letter paths
The paths `C:` (on WIN32) and `/` on other systems was detecting as
relative. This meant `BLI_path_abs_from_cwd` would make both paths
CWD relative. Also remove duplicate call to BLI_path_is_unc.
2024-10-05 17:58:41 +10:00
Campbell Barton
5776a0b67c Merge branch 'blender-v4.3-release' 2024-10-05 17:54:01 +10:00
Campbell Barton
237f35c350 Cleanup: quiet implicit-fallthrough warning 2024-10-05 17:53:36 +10:00
Campbell Barton
ea2d27cf84 Fix #128567: file selector automatically creates paths & warns
Regression in [0] which didn't account for entering paths in the
file selector which would create paths without confirming,
warning that the "confirm" property was missing.

Entering `*.*` would create `_._` for e.g in the users CWD for example.

Ref !128568

[0]: 6dd0f6627e.
2024-10-05 16:58:21 +10:00
Miguel Pozo
3272b56190 Merge branch 'blender-v4.3-release' 2024-10-05 01:23:36 +02:00
Miguel Pozo
40d20f023a Fix: gpu_shader_create_info_get_unfinalized_copy 2024-10-05 01:22:51 +02:00
Clément Foucault
8165d52f90 Fix: Overlay: Broken shader compilation 2024-10-04 23:32:24 +02:00
Harley Acheson
61ae777fbd Merge branch 'blender-v4.3-release' 2024-10-04 11:13:51 -07:00
Pratik Borhade
826ba8e27a Fix #128231: Wrong padding for gizmo and menu tooltips
This is due to wrong `is_pad` is passed as argument. It should be false
for gizmo tooltips. For menus when fields size is zero i.e. no
element is appended yet, the python message will be at the top of
tooltip region.

Pull Request: https://projects.blender.org/blender/blender/pulls/128243
2024-10-04 20:12:38 +02:00
Falk David
3364cb34ee Merge branch 'blender-v4.3-release' 2024-10-04 19:28:16 +02:00
Falk David
5f5b1b83d0 GPv3: Rename mode enum names and python identifiers
This renames the mode identifiers to be consistent with e.g. the context mode identifiers and other names used for the new Grease Pencil.

For `object.mode`:
* `PAINT_GPENCIL` -> `PAINT_GREASE_PENCIL`
* `SCULPT_GPENCIL` -> `SCULPT_GREASE_PENCIL`
* `VERTEX_GPENCIL` -> `VERTEX_GREASE_PENCIL`
* `WEIGHT_GPENCIL` -> `WEIGHT_GREASE_PENCIL`

For the internal `ob->mode` flag:
* `OB_MODE_PAINT_GPENCIL_LEGACY` -> `OB_MODE_PAINT_GREASE_PENCIL`
* `OB_MODE_SCULPT_GPENCIL_LEGACY` -> `OB_MODE_SCULPT_GREASE_PENCIL`
* `OB_MODE_VERTEX_GPENCIL_LEGACY` -> `OB_MODE_VERTEX_GREASE_PENCIL`
* `OB_MODE_WEIGHT_GPENCIL_LEGACY` -> `OB_MODE_WEIGHT_GREASE_PENCIL`

Resolves #127374.

Pull Request: https://projects.blender.org/blender/blender/pulls/128604
2024-10-04 19:20:00 +02:00
Miguel Pozo
6e6e3da454 Workaround: Allow patching CreateInfos at runtime
Temporary workaround for Overlay Next.

Pull Request: https://projects.blender.org/blender/blender/pulls/128452
2024-10-04 19:16:30 +02:00
Miguel Pozo
3a39121a07 Fix: Finalize CreateInfos at startup
Prevents race conditions on ShaderCreateInfo::finalize.
Previoulsy fixed by #128281, but it doesn't work for the render thread.
2024-10-04 19:16:02 +02:00
Miguel Pozo
ba2faf4285 Workaround: Allow patching CreateInfos at runtime
Temporary workaround for Overlay Next.

Pull Request: https://projects.blender.org/blender/blender/pulls/128452
2024-10-04 19:06:37 +02:00
Miguel Pozo
aed1871bd3 Fix: Finalize CreateInfos at startup
Prevents race conditions on ShaderCreateInfo::finalize.
Previoulsy fixed by #128281, but it doesn't work for the render thread.
2024-10-04 19:06:32 +02:00
Clément Foucault
e4c802e53e GPU: Use macros for create infos
Mass rename create info function to use the new macros.
This allows to define resources in C++ inside IDEs'
precompilation system for linting purpose.

This applies the following script and format afterwards:
https://projects.blender.org/blender/blender/pulls/128602#issuecomment-1310597

Rel #127983

Pull Request: https://projects.blender.org/blender/blender/pulls/128602
2024-10-04 19:04:40 +02:00
Clément Foucault
7a36906ecd GPU: CreateInfo: Add macros for C++ stubs
These macros allow to define resources in
C++ inside IDEs' precompilation system for
linting purpose.

The following script can be used to port
existing create info files to the new macros:
https://projects.blender.org/blender/blender/pulls/128602#issuecomment-1310597

Rel #127983

Pull Request: https://projects.blender.org/blender/blender/pulls/128599
2024-10-04 17:45:00 +02:00
Clément Foucault
dcd80dbe15 GPU: GLSL C++ stubs
Allows to compile GLSL code using a C++ compiler. The end result is that
IDE features such as autocompletion and error detection can work with
the GLSL codebase.

Rel #127983

Pull Request: https://projects.blender.org/blender/blender/pulls/128598
2024-10-04 17:44:24 +02:00
Falk David
b7c6ce74eb Merge branch 'blender-v4.3-release' 2024-10-04 17:43:17 +02:00
Falk David
e7b2ec310f Fix: GPv3: Some selection keybinds not working in edit mode
This was due to a wrong mode check. GPv3 uses `OB_MODE_EDIT`.
2024-10-04 17:42:10 +02:00
Sybren A. Stüvel
61bda71083 Anim: Support slotted Actions in 'Push Down' NLA operator
Instead of calling `BKE_nlastrip_new()` (which, due to backward compat
reasons automatically picks a slot), the Push Down operator now calls
`BKE_nlastrip_new_for_slot()`, which explicitly assigns the given slot.

On top of that, the frame range of the slot is used to set the strip's
frame range (instead of the range of the entire Action).

Pull Request: https://projects.blender.org/blender/blender/pulls/128444
2024-10-04 16:20:43 +02:00
Sybren A. Stüvel
b2b0a8ae94 Anim: Fix entering NLA tweak mode with slotted Actions
Instead of using direct property manipulation to enter tweak mode, use
the regular `animrig::assign_…` functions. When used in the right order,
as introduced in this commit, the "disallow assigning an Action in tweak
mode" logic can just stay simple as it is.
2024-10-04 16:20:41 +02:00
Clément Foucault
7e5bc58649 GPU: Change GLSL include directive
This changes the include directive to use the standard C preprocessor
`#include` directive.

The regex to applied to all glsl sources is:
`pragma BLENDER_REQUIRE\((\w+\.glsl)\)`
`include "$1"`

This allow C++ linter to parse the code and allow easier codebase
traversal.

However there is a small catch. While it does work like a standard
include directive when the code is treated as C++, it doesn't when
compiled by our shader backends. In this case, we still use our
dependency concatenation approach instead of file injection.

This means that included files will always be prepended when compiled
to GLSL and a file cannot be appended more than once.

This is why all GLSL lib file should have the `#pragma once` directive
and always be included at the start of the file.

These requirements are actually already enforced by our code-style
in practice.

On the implementation, the source needed to be mutated to comment
the `#pragma once` and `#include`. This is needed to avoid GLSL
compiler error out as this is an extension that not all vendor
supports.

Rel #127983
Pull Request: https://projects.blender.org/blender/blender/pulls/128076
2024-10-04 15:48:22 +02:00
Jacques Lucke
64a0895409 Cleanup: Geometry Nodes: extract zone eval code into separate files 2024-10-04 15:35:18 +02:00
Falk David
ff03857aa3 Merge branch 'blender-v4.3-release' 2024-10-04 14:52:08 +02:00
Falk David
e848bcdbbe Fix: GPv3: Flip primary and secondary toggle and shortcut missing
The `paint.brush_colors_flip` option was not exposed in the vertex color
panel.

This adds the toggle in the panel and also adds the keymap `X` to flip
the colors.
2024-10-04 14:48:09 +02:00
Falk David
9433ffe80a Fix: GPv3: Tint color property and panel
The tint color and panel was not used consistently.
In Vertex Paint mode we're using the unified paint settings,
but in Draw mode, we only use the brush color for tinting.

This fixes the issue by using the unified paint settings
for all the uses of the vertex color.
2024-10-04 14:41:45 +02:00