Commit Graph

120055 Commits

Author SHA1 Message Date
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
Omar Emara
d6c88fb799 Merge branch 'blender-v4.3-release' 2024-10-04 15:29:01 +03:00
Omar Emara
99674e36f1 Fix #128551: Distorted cropped render in GPU compositor
Enabling render cropping while using the GPU compositor can cause the
render to be distorted in certain resolution and border configurations.

This is due to a difference in how the compositor and the render
pipeline compute the effective bordered size of the render. While
mathematically identical, difference in rounding can cause off by one
errors in the computed size. The render pipeline computes the integer
bounds of the border then computes the size from that, while the
compositor multiplies the float size of the border to the full size of
the render.

To fix this, we adjust the BKE_render_resolution function to compute the
border size using integer bounds like the render pipeline, which is the
function used by the compositor. The cropped version of that function is
used in two other places in the image editor for displaying render
results, so we should expect no difference in outputs with minimal but
more accurate difference in display.

Pull Request: https://projects.blender.org/blender/blender/pulls/128576
2024-10-04 14:27:27 +02:00
Jeroen Bakker
607093b506 Merge branch 'blender-v4.3-release' 2024-10-04 14:27:16 +02:00
Jeroen Bakker
4334774a68 Fix: Vulkan: Incorrect image view layer size
When attaching a layered image with offset, the size of the attached
layers should be decreased. Otherwise an image view is created that can
access incorrect data.

Pull Request: https://projects.blender.org/blender/blender/pulls/128583
2024-10-04 14:26:22 +02:00
Omar Emara
6ae3232eda Fix #126565: Render region corrupt compositor output
Activating render region while using the CPU compositor produces corrupt
output for areas outside of the region when using the File Output node.
That's because the Full Frame compositor ignored nodes' render_border
flag, so the areas of interest of nodes that didn't consider render
border like the File Output were corrupt, producing uninitialized
outputs.

To fix this, we just consider the render_border flag when determining
output areas for output nodes in the Full Frame compositor.

Pull Request: https://projects.blender.org/blender/blender/pulls/128546
2024-10-04 14:25:31 +02:00
Omar Emara
ccab8005f6 Fix #126604: Legacy Cryptomatte doesn't work in GPU
The Legacy Cryptomatte node doesn't work in GPU execution mode if
Precision is set to Auto. That's because the colors picked from the Pick
layer might be in half precision and thus will not match the colors in
the Cryptomatte layers. This is due to the compositor using the
context's precision for Viewer outputs as opposed to the precision of
the image that actually needs to be viewed in the Viewer node.

To fix this, we set the Viewer node precision to be the precision of its
input, that way, the Cryptomatte pick layer will be output in full
precision as intended.

Pull Request: https://projects.blender.org/blender/blender/pulls/128495
2024-10-04 14:25:16 +02:00
Falk David
70c7fb6da2 Fix: GPv3: Context object has no attribute grease_pencil
When opeing the 2D Animation template, there was a UI error:
`AttributeError: 'Context' object has not attribute 'grease_pencil'`
This was because the context function `grease_pencil` was missing.
The fix adds this function.

Pull Request: https://projects.blender.org/blender/blender/pulls/128580
2024-10-04 14:24:31 +02:00
Falk David
364d62e59b Fix: GPv3: Solid View: Show vertex colors in Draw and Vertex paint mode
There was a bug where vertex colors were not shown in solid view in
draw or vertex paint mode. The check to use `V3D_SHADING_VERTEX_COLOR`
was outdated and checked the wrong mode flags.

The fix makes sure that we use `V3D_SHADING_VERTEX_COLOR` in
draw and vertex paint mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/128581
2024-10-04 14:22:17 +02:00
Jacques Lucke
391955092a Cleanup: Geometry Nodes: reduce boilerplate of drawing active item properties 2024-10-04 13:36:25 +02:00
Lukas Tönne
c1634dbe4b Merge branch 'blender-v4.3-release' 2024-10-04 13:06:44 +02:00
Lukas Tönne
3d6a142162 GPv3: Remove unused GPv2 operators
Removes many of the operators, panels, and menus used exclusively by Grease Pencil v2 that are no longer needed in v3.
No functional changes are expected.

Some operators are still used by the annotations system and have to be kept around. These may be renamed in future.

Pull Request: https://projects.blender.org/blender/blender/pulls/128521
2024-10-04 13:05:09 +02:00
Jeroen Bakker
d829004b1d Merge branch 'blender-v4.3-release' 2024-10-04 12:48:29 +02:00
Jeroen Bakker
f1c0e258af Fix #128575: Vulkan: Fix armature drawing NVIDIA
The armature shape drawing was broken on NVIDIA. The reason is that not
all the elements in of the geometry shader out stages are written to. On
NVIDIA platforms this leads to not storing all the output data.

This could be that geometry shader on those plaforms write directly to
the final location in GPU memory. Other platforms might keep the data in
a local registry and copy it to the final location when emitting the
vertex.

Blender 4.4 might not have this issue as overlay next will remove the
need of the geometry shader.

From Khronos GLSL spec:
```
GS code writes all of the output values for a vertex, then calls EmitVertex().
This tells the system to write those output values to where ever it is that
output vertices get written. After calling this function, all output variables
contain undefined values. So you will need to write to them all again before
emitting the next vertex (if there is a next vertex).
```

Pull Request: https://projects.blender.org/blender/blender/pulls/128578
2024-10-04 12:47:42 +02:00
Falk David
f1ea86bd04 Merge branch 'blender-v4.3-release' 2024-10-04 12:38:08 +02:00
Falk David
c54d5d833b Fix: Compiler warning related to grease_pencil_context_poll
Declare this function in `ED_grease_pencil.hh`.
Move the implementation to `grease_pencil_ops.cc` with the other poll
functions.
2024-10-04 12:36:01 +02:00
Falk David
0d2faedca2 Merge branch 'blender-v4.3-release' 2024-10-04 12:21:54 +02:00
Richard Antalik
77a5478c0f VSE: Add text alignment feature
Previously, alignment did exist, but it only changed whole text block
position in relation to a fixed point. This was later renamed to "Anchor".
Now it correctly aligns each line of text. Alignment works with newline
character and word wrapping.
Currently newline characters can't be entered directly, but this should
be resolved soon.

To keep existing anchoring feature, new DNA fields are added and
values from old alignment are copied there.

This PR is part of bigger change [1], and originally I expected to
implement this feature at later stage. But the design called for drawing
text character by character, which would mean, that I would have to
rewrite text alignment anyway.

To render the text, a struct is built, where position and width of each
character is stored. In addition, width of each line is stored. This allows
to implement proper text alignment feature, instead of existing
anchoring. Text is then drawn character by character in a loop.

There are some small differences in text rendering, since this is only
approximation of how BLF library draws glyphs, but it is very close.
For text bounbox, `BLF_boundbox()` is used on per line basis,
because some fonts do not use their full height and this information
is not available on VSE side.

[1] https://projects.blender.org/blender/blender/issues/126547

Pull Request: https://projects.blender.org/blender/blender/pulls/126660
2024-10-04 12:20:33 +02:00
Julian Eisel
bf52f6f723 UI: Remember asset shelf visibility per mode
After feedback from the brush assets, we want to not only set the
default visibility, but also remember the visibility per mode. This way
we can keep the shelf hidden in modes where there's only one bundled
brush per available tool. While having these tools support brushes can
be useful, we don't expect to bundle more brushes soon. So to avoid a
mostly empy asset shelf for a single brush, allow keeping the shelf
hidden in these modes unless the user expands it. The following commit
will set the default visibility for these modes.

More strictly speaking this is entirely context sensitive, not just per
mode, but with current shelf types is practically per mode.
2024-10-04 12:19:18 +02:00
Jeroen Bakker
b0241d720f Merge branch 'blender-v4.3-release' 2024-10-04 12:13:09 +02:00
Jeroen Bakker
7596a08b2c Vulkan: Add back command reordering for buffer updates.
Related to #126974, which removed command reordering due to some
EEVEE/framebuffer requirements. However buffer can still be reordered
without any artifacts.

Update buffers are common operations and are often isolated; safe to
move them outside the rendering scope.

Pull Request: https://projects.blender.org/blender/blender/pulls/128538
2024-10-04 12:11:40 +02:00
Pratik Borhade
bd4f7acce5 GPv3: Display layers when properties tab is pinned
Layer panel (also mask/ transform etc.) and other operators are gone
when properties tab is pinned and gpv3 object is non-active.
To fix this, get grease pencil pointer from `button_context()`
(done in `grease_pencil_context()`).

Continuation of cd476226d8

Pull Request: https://projects.blender.org/blender/blender/pulls/128475
2024-10-04 11:58:12 +02:00
Falk David
9d9dc3fc8f GPv3: Apply modifier to all frames
This adds an option `all_keyframes` to the `object.modifier_apply` operator.
With the option enabled, the operator will iterate through all the keyframes,
then apply the modifier and merge the result back into the original
object. This is only done for Grease Pencil objects.

This is how the default `Apply` operation worked in GPv2. This adds the
functionality back but also keeps the current `Apply` behavior for consistency
with other object types.

The UI is also changed to show both options in the dropdown menu.
Again, this is only shown for Grease Pencil objects.

With Geometry Nodes it's possible to add new layers to the geometry.
When applying, this will create a single keyframe on the first frame of
evaluation.  Layers with duplicated names in evaluated geometry will
be deduplicated. It's also possible to have layers with empty names.
When applying these get renamed to `Layer` (and `Layer.001` etc.
when such a layer already exists in the original geometry).

Pull Request: https://projects.blender.org/blender/blender/pulls/128487
2024-10-04 11:51:30 +02:00
Lukas Tönne
6e9462e056 Fix #128533: GPv3: Crash on undo
The poll function of the Grease Pencil edit undo system was changed by accident to include other
object modes like sculpt mode as well. In the other modes, undo steps wouldn't be created correctly.
Instead, fix the poll function to only allow the Grease Pencil undo system to take over in edit mode.
In all other modes fall back to the global undo system.

Fixes #128566 as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/128573
2024-10-04 11:36:46 +02:00