Commit Graph

117289 Commits

Author SHA1 Message Date
Jacques Lucke
67c7485bfd Refactor: Geometry Nodes: improve lifetime analysis for anonymous attributes
This refactors the lifetime analysis of anonymous attributes in geometry nodes.
The refactor has a couple of goals:
* Use a better and simpler abstraction that can be used when building the
  lazy-function graph. We currently have a bunch of duplicate code to handle
  "field source" and "caller propagation" attributes. This is now unified so
  that one only has to worry about one kind of "reference sets".
* Make the abstraction compatible with handling bundles and closures in case we
  want to support them in the future. Both types can contain geometries and
  fields so they need to be taken into account when determining lifetimes.
* Make more parts independent of the concept of "anonymous attributes". In
  theory, there could be more kinds of referenced data whose lifetimes need to
  be managed. I don't have any concrete plans for adding any though.

At its core, deterministic anonymous attributes still work the same they have
been since they became deterministic [0]. Even the generated lazy-function graph
is still pretty much or even exactly the same as before.

The patch renames `AnonymousAttributeSet` to the more general
`GeometryNodesReferenceSet` which is more. This also makes more places
independent of the concept of anonymous attributes. Functionally, this still the
same though. It's only used in the internals of geometry nodes nowadays. Most
code just gets an `AttributeFilter` that is based on it.

[0]: https://archive.blender.org/developer/D16858

Pull Request: https://projects.blender.org/blender/blender/pulls/128667
2024-10-07 12:59:39 +02:00
Clément Foucault
9c0321ae9b Metal: Simplify MSL translation
Move most of the string preprocessing used for MSL
compatibility to `glsl_preprocess`.

Enforce some changes like matrix constructor and
array constructor to the GLSL codebase. This is
for C++ compatibility.

Additionally reduce the amount of code duplication
inside the compatibility code.

Pull Request: https://projects.blender.org/blender/blender/pulls/128634
2024-10-07 12:54:10 +02:00
Jacques Lucke
9e604f0e00 Merge branch 'blender-v4.3-release' 2024-10-07 12:45:10 +02:00
Jacques Lucke
218af9b2cc Fix: missing anonymous attribute relations for foreach zone 2024-10-07 12:44:21 +02:00
Clément Foucault
b1cbd9c889 Fix: Build error caused by GLSL processor overriding valid header source
The issue was that the GLSL processor was incorrectly
processing an info.hh file which was also supposed to be
included inside the gpu module. The generated source
was creating build error.
2024-10-07 12:35:47 +02:00
Clément Foucault
754920a92d Cleanup: DRW: Missing include
This Shader lib is unused anyway.
2024-10-07 12:35:47 +02:00
Clément Foucault
42e8cbb921 GPU: Make use of the C++ stubs in some shaders 2024-10-07 12:35:47 +02:00
Clément Foucault
fd47edfb86 GPU: GLSL C++ Stubs: Use create_info namespace to avoid symbol colision 2024-10-07 12:35:47 +02:00
Clément Foucault
5fe608da4b Fix: Overlay: Wrong end macro for named interface 2024-10-07 12:35:47 +02:00
Miguel Pozo
9395ccc6bf Merge branch 'blender-v4.3-release' 2024-10-07 12:14:06 +02:00
Miguel Pozo
88289e8bac Fix #126562: Cycles/EEVEE versioning
Check all scenes to decide between versioning merged settings using
EEVEE or Cycles properties.

Still far from a great solution. :(

Pull Request: https://projects.blender.org/blender/blender/pulls/128554
2024-10-07 12:12:37 +02:00
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