Commit Graph

121743 Commits

Author SHA1 Message Date
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
e8f4010611e76e0b88cd 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
Jason Fielder
9f42888552 Fix #104016: Resolve Metal LineLoop emulation.
Metal LineLoop emulation path does not correctly apply
when using SSBO vertex fetch mode alongside 3D line
rendering.

Patch moves line emulation above SSBO
vertex fetch setup to ensure the correct emulation
parameters are passed to the shader.

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #105142
2023-02-26 15:21:54 +01:00
Jason Fielder
fb63e484b9 Fix #103398: Fix Icon sampler initialization in Metal backend.
Resolves issue with nearest filtering on UI Icons. Note that as
Metal does not support LOD bias as a parameter on a sampler
object, the original code has been modified to perform LOD
biasing at the shader level.

As GPU_SAMPLER_ICON is not  widely used, it is more
efficient to apply directly to the  affected shaders, rather
than workaround passing in the sampler LOD bias as a
separate value e.g. uniform or push constant.

Original PR feedback addressed to also refactor ICON
shaders to use consistent style for single and multi
Icon rendering.

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #105145
2023-02-26 13:23:40 +01:00
Pratik Borhade
f9bcd8c7e8 Fix #104992: Crash on calling operation search in outliner
After 7eda9d8dda, crash occurs when operation search is called and no
active tree element is present. Add missing null check in new poll
function to fix the crash.

Pull Request #105004
2023-02-25 18:36:24 +01:00
Joseph Eagar
01d4c8462d Fix #104006 Sculpt box/lasso trim projection errors 2023-02-24 11:46:29 -08:00
Joseph Eagar
a843a9c9bb Sculpt: Add trim orientation to sculpt box trim UI 2023-02-24 11:28:23 -08:00
Joseph Eagar
c517e4a501 Fix #104803: Fix broken deprecated vertex color RNA APIs
Fixed:
* mesh.vertex_colors.active
* mesh.vertex_colors.active_index
* MeshLoopColorLayer.active
* MeshLoopColorLayer.active_render
* MeshVertColorLayer.active
* MeshVertColorLayer.active_render
2023-02-24 11:07:53 -08:00
Pratik Borhade
b789980e27 Fix #105009: Restore GPencil layer drawing in dopesheet
After 49ad91b5ab7b7ac8d8c3fcfdb89ca07d0e4f194a, an extra visibility
toggle is being drawn for grease pencil layer in dopesheet. In this PR,
a condition is added to skip drawing of visibility toggle for GPencil
layer. Also, Grease pencil does not support pinning so restore the offset
added to channel for drawing the pin icon.

Pull Request #105080
2023-02-24 18:02:35 +01:00
Michael Jones
82ff277528 Fix #100066: Cycles hangs when MSL->AIR compilation fails
This fixes [#100066](https://projects.blender.org/blender/blender/issues/100066) by failing hard when front-end MSL->AIR compilation errors are encountered.

Pull Request #105122
2023-02-24 17:55:27 +01:00
Michael Jones
626c233dd2 Fix #104087: Cycles crashes (Metal / AMD)
This is a workaround for [issue #104087](https://projects.blender.org/blender/blender/issues/104087). We encounter crashes when using shader binary archives on AMD, so this disables them while we investigate a proper fix. Kernels will still be cached automatically by the OS file system cache. This cache may occasionally be purged due to external factors, in which case kernels will get compiled again.

Pull Request #105186
2023-02-24 17:52:35 +01:00
Sergey Sharybin
f30c395a7c Fix make_update switching branches with multiple upstreams
If repository has multiple remotes with the same name of branch
checking out to the branch using simple `git checkout branch` exists
with an error: this is because there is ambiguity w.r.t which remote
to track.

Now the code explicitly provides remote to track, preferring to use
"origin" first (which is to be used for Blender style of workflow,
and Github style workflow when there is a fork available), and use
"upstream" if there is no origin.

Pull Request #105176
2023-02-24 17:08:46 +01:00
Jacques Lucke
2c5434c3f5 Fix: crash in Spline Parameter node with single-point-curves
This was caught by our tests when they are run in a debug build with asserts.
2023-02-24 16:42:02 +01:00
Jacques Lucke
3d10dfb0a3 Fix #105166: Sample UV Surface node does not take index mask into account
The `call` method was reading from and writing to memory that it was
not supposed to access based on the passed in `mask`.
2023-02-24 16:26:07 +01:00
Sergey Sharybin
9b70039014 Fix paths in the auto-formatting tools
Those got missed in the submodule change commit.

Pull Request #105178
2023-02-24 15:52:34 +01:00
Philipp Oeser
b8359ede7d Fix #105168: Entering vertexpaint creates a non-default color attribute
Caused by 6514bb05ea

The new attribute was set active, but not default (camera icon).
Now set it default as well.

Pull Request #105169
2023-02-24 13:19:10 +01:00
Damien Picard
47d4ec5aef Fix #105011: Cannot remove user preset when its name is translated
The preset names were translated before building the UI. This meant
that the translated name was passed to the operator responsible for
deleting the preset file, instead of the original name.

Pull Request #105155
2023-02-24 12:00:19 +01:00
Joseph Eagar
718f78cfca Sculpt: Fix #104618 (again).
SculptAttributeParams.stroke_only wasn't being
    applied to existing attributes properly.
2023-02-24 00:04:50 -08:00
Joseph Eagar
cb7d450de6 Sculpt: Fix 104618: Topology automasking errors
Sculpt island tags are now invalidated whenever the PBVH
    is rebuilt.
2023-02-24 00:04:03 -08:00
Joseph Eagar
0534fff5ab Sculpt: fix 104174, clicking over empty space always pushes undo.
This was actually caused by two problems.  The first is that the
    code actually deliberately detects if nothing happened and pushed
    an undo step, a bugfix for a problem that no longer exists.

    The second was that SCULPT_test_location sometimes does a closest
    point search instead of ray casting and didn't check the result
    against the brush radius.
2023-02-24 00:01:41 -08:00
Joseph Eagar
e9bb3510a1 Sculpt: Fix #104475, data transfer not respecting vgroup for float colors
This might've been a merge error, the result of color mixing
    was being overwritten by a simple copy of source to destination
    inside of layerCopyValue_propcol.
2023-02-24 00:00:22 -08:00
Hans Goudey
f9f29eefc7 Fix #105150: Mesh.vertex_colors.new() returns existing active layer
In 6514bb05ea5a138d8971 I misinterpreted the function's intended
behavior when there was already an existing active layer. The data from
the active layer is just meat to be copied, the function should always
add a new attribute.
2023-02-23 15:30:27 -05:00
Brecht Van Lommel
a1f899754b Fix #105106: inconsistent order of settings in 3D viewport shading popover
Put compositing settings at the bottom for both Cycles and Eevee.
2023-02-23 17:24:45 +01:00
Jacques Lucke
763f1897c2 Fix #103865: keep IDProperties overridable when setting them with Python
Previously, the overridable status was lost when assigning a new value
to a custom property.

Pull Request #105130
2023-02-23 15:55:42 +01:00
Miguel Pozo
e2f0a63e55 Fix #105118: Wrong point size in sculpt density overlay
Missed the GPU_program_point_size call in acd5889e50
2023-02-23 15:15:35 +01:00
Jeroen Bakker
dc9e0f300e GPU: Fix Potential Error in Builtin Resolution.
When using ShaderCreateInfo with builtin uniform(blocks) there are
cases where the current implementation could not find an existing
block. The reason is that it uses name matching and name matching
requires that the shader inputs are sorted based on the name hash.

This change fixes this by first for the sorting of the shader
inputs before resolving the builtins.

Pull Request #105127
2023-02-23 14:40:40 +01:00
Jason Fielder
4bfe4e5d49 Fix: Cycles display without OpenColorIO not working for Metal
Cycles fallback display shader previously did not use viewport.
This would crash or cause the display not to show when using
GPU backends other than OpenGL, if another display shader
was unavailable.

Now use ShaderCreateInfo for Cycles fallback display.

Authored by Apple: Michael Parkin-White

Ref #96261

Pull Request #104987
2023-02-23 14:25:08 +01:00
Hans Goudey
fcdfc0a85b Fix #105089: Curves sculpt add creates invalid resolution
If the resolution attribute exists, it needs to be set to a non-zero
value for the newly added curves. While it might also make sense
to interpolate the value from neighbor curves, for now it's
simplest to just set it to the default value of 12.

Pull Request #105094
2023-02-23 13:46:39 +01:00
Falk David
059ba28b29 Fix #105026: Texture space operators in transform menu
In curves edit mode, the "Move Texture Space" and "Scale Texture Space"
operators where shown in the "Curves > Transform" menu.

Since these are not implemented, the fix removes these operators
from the menu.
2023-02-23 13:30:15 +01:00
Jacques Lucke
be777c9657 Fix: remove unnecessary assert
The code below has to handle the case when `sample_length` is greater
or equal to the total length already anyway, so we can just make that
a valid input. Currently, the snake hook brush for curves also makes
use of passing in larger sample lengths which current results in crashes
in debug builds.
2023-02-23 13:18:05 +01:00
Falk David
2e7bd1dfb1 Fix #105044: Crash when rotating hair curves
When trying to rotate in curves edit mode using proportional editing
and connected only mode, Blender would crash.

This was because the `TransData` structs for disconnected elements
did not have the location field populated, resulting in a null pointer
access.

The fix skips these elements entirely using `TD_SKIP`.
2023-02-23 13:14:00 +01:00
Falk David
061d191677 Fix #105043: Add shortcut for proportional editing 2023-02-23 12:21:39 +01:00
illua1
f2250b7a5b Fix #105078: Regression: Memory leak in driver UI drawing code
Just a missing call to `MEM_freeN()`.

The issue was introduced in c592bff047.
2023-02-23 11:22:04 +01:00
Michael Jones
482fb791ce Fix #105100: Metal using wrong kernels in multi-pass renders
This fixes issue [#105100](https://projects.blender.org/blender/blender/issues/105100) where multi-pass renders can be incorrect due to kernels using stale specialisation constants (e.g. when rendering Pokedstudio).

This patch adds a new group of md5 hashes (`global_defines_md5`) to track whether the injected block of #defines is stale and regenerate the source string as appropriate. It also renames the existing group of md5 hashes from `source_md5` to `kernels_md5` to clarify that these refer to a specific kernel set rather than just the source (which might build an arbitrarily large number of kernel sets).

Pull Request #105103
2023-02-23 11:07:28 +01:00
Damien Picard
e410fb4d3c Fix #105067: Error drawing Copy Rotation Constraint UI
The translation contexts module wasn't imported after c7611d61e8,
which caused an error and prevented some constraints' UI from being
displayed.

Pull Request #105095
2023-02-23 10:42:03 +01:00
Jeroen Bakker
2c391f8877 GPU: Patch GPencil shader for metal support.
The stoke shader of grease pencil uses a geometry shader stage. Apple
devices don't support shaders with geometry shader stage. In the
OpenGL driver there was a pass-through implemented so it didn't fail.

When using the metal backend this needs to be solved more explicitly.
This change patches the grease pencil shader to support both the
backends supporting a geometry stage and those without.

Fixes #105059

Pull Request #105116
2023-02-23 08:26:01 +01:00
Jason Fielder
c760248fc5 Metal: Improve AMD EEVEE Performance
Complex EEVEE nodegraphs, particularly those combining
multiple principledBSDF shader nodes have a tendancy
to require a large number of simultaneous live registers
due to function call depth. In some instances, this
causes substantial performance drop and corruption if
the stack gets too large.

To mitigate this, splitting calls to closure_eval such
that only a single individual closure is evaluated in each
call reduces the number of live registers required. This
is preferred over using compound closure evaluation
functions which require a large amount of in-flight data.

Note that this is generally not more optimal, if the stack
does not spill, as there is an increased instruction count.
The specific trade-off depends on the exact architecture
in question. Hence, this is limited to AMD GPUs.

Authored by Apple: Michael Parkin-White

Ref #96261
Pull Request #104985
2023-02-22 20:57:24 +01:00