Commit Graph

150077 Commits

Author SHA1 Message Date
Jonas Holzman
fe93de1a91 Obj-C Refactor: Port BLI_delete_soft from objc_* runtime calls to proper Obj-C
Port the macOS version of the `BLI_delete_soft` function from raw
runtime `objc_*` calls function to proper Objective-C for increased
readability and long-term maintainability. This new function is placed
in a new `intern/fileops_apple.mm` file, analogous to the existing
`intern/storage_apple.mm` file.

Pull Request: https://projects.blender.org/blender/blender/pulls/126766
2024-09-03 12:08:20 +02:00
Philipp Oeser
e5e5d5fe73 Fix BMFace/BMLoop.copy_from_face_interp() functions
Resolve incorrect use of `METH_O`.

Ref !127076
2024-09-03 19:53:15 +10:00
Weizhen Huang
77035192c9 Fix #126799: undefined behavior of shader node Arctan2 at (0, 0)
`atan2(0, 0)` is undefined on many platforms. To ensure consistent
result across platforms, we return `0` in this case.

Note only the behavior of the shader node `Artan2` is changed here.
During shading, we might still produce `atan2(0, 0)` internally and
cause different results across platforms, but that usually happens with
single samples and is not obvious, plus checking this condition all the
time is costly. If later we find out it's indeed necessary to change all
the invocation of `atan2(0, 0)`, we could change the wrapper functions
in `metal/compat.h` and `mtl_shader_defines.msl`.

Pull Request: https://projects.blender.org/blender/blender/pulls/126951
2024-09-03 11:44:59 +02:00
Aras Pranckevicius
f40e6c28bf Tests: VSE Color Balance and Curve modifier render tests 2024-09-03 12:40:39 +03:00
Jonas Holzman
8b569bac0d Obj-C Refactor: Autoreleasepool and property dot-notation refactor
Autoreleasepool:
- Replace outdated `NSAutoreleasePool` `init`/`drain` mechanism with
  the modern `@autoreleasepool {}` block. Leading to simpler and
  cleaner code, and more flexible functions return placement.
- Add missing `autoreleasepool` in code.
  The rule being that in an MRR (Manual Retain-Release / non-automatic
  reference counting) environments, "Cocoa expects there to be an
  autorelease pool always available. If a pool is not available,
  autoreleased objects do not get released and you leak memory"
  (quote from Apple Dev Docs).
  As we cannot make safe assumptions about function call sites, and
  cannot rely on a main autoreleasepool like a standard Obj-C
  application, every piece of Objective-C code that calls any sort of
  Cocoa function should be wrapped in an `autoreleasepool {}` block for
  eventual internal `autorelease` call to be honored.
- Add missing `release` / `autorelease`, make correct MRR pairs

A next step would be to start transitioning the Blender Obj-C codebase
from MRR to automatic reference counting (ARC).

Dot-Notation:
- Use Objective-C dot notation to follow modern Objective-C practices,
  and provide a more familiar syntax to programmers coming from C/C++,
  (`foo.prop` instead of `[foo prop]` for access, `foo.prop = bar`
  instead of `[foo setProp:bar]` for setting).
- Exception for singleton class properties / methods
  (`[NSPasteboard generalPasteboard]` instead of
  `NSPasteboard.generalPasteboard`) and nested method calls that mix
  property and methods.
  (Example: [NSApp windowWithWindowNumber:[window_number integerValue]]`
   or `[view convertRectToBacking:[view bounds]]`)

When possible, or necessary, refactored functions were simplified or
refactored, in which case the Blender code style was applied. As such
there is some overlap with PR #126770, especially when it comes to const
correctness.

Due to the fact that these two refactors are quite interlinked, and for
easier reviewing / avoiding complicated merge conflicts, they're shipped
in a single PR.

Ref #126772

Pull Request: https://projects.blender.org/blender/blender/pulls/126771
2024-09-03 11:38:32 +02:00
Weizhen Huang
41d394e72c Tests: add test files for Metallic BSDF and Light Tree 2024-09-03 11:34:09 +02:00
Jeroen Bakker
5b16da6246 EEVEE: Fix insecure string literal
Detected by Sergey.
2024-09-03 11:10:27 +02:00
Philipp Oeser
d738d76c12 Fix #126942: Memory Leak when creating Pose Asset without camera
In this case, the `PoseBackup` created by
`action_preview_render_prepare` wasnt cleaned up properly (because
`action_preview_render` was earlied out).

So to resolve, call `action_preview_render_cleanup` as well when
earlying out)

Pull Request: https://projects.blender.org/blender/blender/pulls/127067
2024-09-03 10:44:50 +02:00
Sergey Sharybin
5e6105823f Cleanup: Strict compiler warning
Unused function in BLI_index_mask_test.cc when benchamrks are disabled.
2024-09-03 10:29:08 +02:00
Aras Pranckevicius
4c8f22447f VSE: Faster timeline thumbnail drawing
VSE timeline, when many (hundreds/thousands) of thumbnails were visible, was
very slow to redraw. This PR makes them 3-10x faster to redraw, by stopping
doing things that are slow :) Part of #126087 thumbnail improvements task.

- No longer do mute semitransparency or corner rounding on the CPU, do it in
  shader instead.
- Stop creating a separate GPU texture for each thumbnail, on every repaint,
  and drawing each thumbnail as a separate draw call. Instead, put thumbnails
  into a single texture atlas (using a simple shelf packing algorithm), and
  draw them in batch, passing data via UBO. The atlas is still re-created every
  frame, but that does not seem to be a performance issue. Thumbnails are
  cropped horizontally based on how much of their parts are visible (e.g. a
  narrow strip on screen), so realistically the atlas size is kinda
  proportional to screen size, and ends up being just several megabytes of data
  transfer between CPU -> GPU each frame.

On this Sprite Fright edit timeline view (612 visible thumbnails), time taken
to repaint the timeline window:

- Mac (M1 Max, Metal): 68.1ms -> 4.7ms
- Windows (Ryzen 5950X, RTX 3080Ti, OpenGL): 23.7ms -> 6.8ms

This also fixes a visual issue with thumbnails, where when strips are very
tall, the "rounded corners" that were poked right into the thumbnail bitmap
on the CPU were showing up due to actual bitmap being scaled up a lot.

Pull Request: https://projects.blender.org/blender/blender/pulls/126972
2024-09-03 08:25:15 +02:00
Campbell Barton
3cb95b0be9 Cleanup: avoid repetition in version extraction 2024-09-03 13:44:44 +10:00
Alaska
3196ef1636 Add a script to collect system information when Blender isn't opening
This commit adds a python script that can collect some of the
information necessary to fill out a bug report.

The primary use case is to help users collect system information for
a bug report in the case that Blender can't open.

CMD and sh files are included to help users use the Python script.

Ref !122191
2024-09-03 13:26:54 +10:00
Campbell Barton
d19c13eb82 Cleanup: spelling & punctuation in comments 2024-09-03 12:59:37 +10:00
Guillermo Venegas
7bb8ab8194 Fix #127012: UI popover can not be scrolled upward
Popop overflow can be on top when popup direction is `UI_DIR_UP`, so
this can require a negative scroll.

Pull Request: https://projects.blender.org/blender/blender/pulls/127021
2024-09-02 23:37:55 +02:00
Miguel Pozo
7a55bdeaf9 EEVEE: Enable translation of screen messages
Add `Instance::info_append` so it's easier to log correctly formatted
info, and `Instance::info_append_i18n` to support string localization.

Co-authored-by: Damien Picard
Co-authored-by: Bastien Montagne <mont29@noreply.localhost>
Pull Request: https://projects.blender.org/blender/blender/pulls/124257
2024-09-02 20:13:31 +02:00
Bastien Montagne
483e91e38f I18N: Updated UI translations from git/weblate repository (5b647985dbb49). 2024-09-02 19:36:38 +02:00
Aras Pranckevicius
c4a67ec3c7 Fix #127022: PLY export does not properly clamp vertex colors
PLY always exports vertex colors as bytes currently, but the input
values were not properly clamped to 0..1 range.
2024-09-02 20:28:36 +03:00
Clément Foucault
7d95fed911 Overlay-Next: In-Front support
This adds the missing in-front passes submission
and reorder the passes for better performance.

Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/127020
2024-09-02 19:14:01 +02:00
Xavier Hallade
1a0dbbd242 Fix: Cannot render Victor and Spring with embree disabled on Intel GPUs
The kernel zeroing memory since we've added host memory fallback didn't
expect large inputs, so with these scenes, it was running into
"Provided range is out of integer limits. Pass
`-fno-sycl-id-queries-fit-in-int' to disable range check" error.

This kernel was used instead of memset to avoid some issues with the
free_memory queries not always being updated.
As we can't reproduce these with recent drivers, we now use memset,
which fixes rendering with BVH2.
2024-09-02 18:35:51 +02:00
Sybren A. Stüvel
ea72ed4502 Anim: Fix crash when getting animdata from non-Action editor
Check the space type before casting its data to `SpaceAction*`.

Pull Request: https://projects.blender.org/blender/blender/pulls/127079
2024-09-02 18:07:30 +02:00
Sybren A. Stüvel
433278233e Cleanup: formatting
Just running `make format`, no functional changes.
2024-09-02 18:05:55 +02:00
Bastien Montagne
810f6a1b5c Refactor: Various remaining changes to PointerRNA usages to use C++ code.
This commit mainly replaces a lot of `memset(0)` by empty value
initialization of `PointerRNA` and related data.

It also moves a few remaining areas from C alloc/free to C++ new/delete
memory hanlding.

Part of the effort to make PointerRNA non-trivial (#122431).
2024-09-02 17:40:03 +02:00
Clément Foucault
94608b32ab Overlay-Next: Fix crash in 2D image view 2024-09-02 16:36:23 +02:00
Clément Foucault
1c2918f50f DRW: Fix crash when entering UV editor 2024-09-02 16:17:21 +02:00
Bastien Montagne
b5ea3beaf9 Fix i18n message extraction tool after recent BPY/RNA fix.
Recent fix 21b820cd33 in BPY/RNA code broke introspection code of RNA
data in i18n message extraction code.

Luckily, it actually fixes things, and allows to remove some of the ugly
hacks we had in this code, especially regarding Operators handling.
2024-09-02 15:59:16 +02:00
Nathan Vegdahl
580be3862a Fix: deleting fcurve in a group creates inconsistent group state
This issue only applied to layered actions.

The issue was that the `restore_channel_group_invariants()` method was
being called too early in the remove fcurve function, and thus fcurves'
group pointers could end up inconsistent with the membership specified
in the groups.

This commit fixes the issue by moving the call to
`restore_channel_group_invariants()` to the end of the function, where
it belongs.

Pull Request: https://projects.blender.org/blender/blender/pulls/127075
2024-09-02 15:38:34 +02:00
YimingWu
7c52bbb30a Cleanup: Remove _has_gpv3 condition in python
GPv3 is no longer really a experimental feature now and the
experimental option is also removed already, so it does not
make much sense keeping this branch in the UI.
2024-09-02 21:21:03 +08:00
Jacques Lucke
a40967685a Cleanup: Geometry Nodes: deduplicate code 2024-09-02 14:33:40 +02:00
Sybren A. Stüvel
a6d7e12e22 Anim: New/Un-assign Slot operators
Add two new operators, `anim.slot_new_for_id` and
`anim.slot_unassign_from_id`. These are used in the Action editor and
the Animation panels in the Properties editor, to respectively create a
new Action Slot for an ID and to unassign whatever slot is currently
assigned to that ID.

The latter operator also replaces the C++ operator
`anim.slot_unassign_object`, which was specifically made for the
Dopesheet header. The Python ones are generic enough to be used there
too.

Pull Request: https://projects.blender.org/blender/blender/pulls/126943
2024-09-02 14:10:49 +02:00
Sybren A. Stüvel
e143c0baee Anim: Fix selection of summary keys of Action/Channel Groups
Fix an issue where selecting a key in the dope sheet summary line for a
channel group would deselect all corresponding keys in the F-Curves of that
group. It was caused by an accidental duplication of the `ChannelBag`.

Pull Request: https://projects.blender.org/blender/blender/pulls/127069
2024-09-02 14:06:43 +02:00
Sybren A. Stüvel
094c8b045d Refactor: Anim, use eEditKeyframes_Select instead of short/int
Use `eEditKeyframes_Select` where sensible, instead of a generic `short`
or `int`.

No functional changes.
2024-09-02 14:06:42 +02:00
Nathan Vegdahl
e291f8230a Fix: range selecting any animation channels always selects slots
The issue was that slots are using `templated_selection_state_update()`
for their basic selection logic, which is used in the same places as the
`ACHANNEL_SET_FLAG` macro and was written to do the same job. However,
the logic was not properly reproduced.

Specifically, `ACHANNEL_SET_FLAG` actually *deselects* when passed
the `ACHANNEL_SETFLAG_EXTEND_RANGE` or `ACHANNEL_SETFLAG_TOGGLE`
selection mode flags. This makes no sense at all, but it turns out to
be functionally important in the case of `ACHANNEL_SETFLAG_EXTEND_RANGE`
because of how it's used, resulting in this bug.

This fixes the issue by changing `templated_selection_state_update()` to
exactly match the logic of `ACHANNEL_SET_FLAG`, in all its nonsensical
glory. I've also added a comment explaining the situation, so it's clear
why the logic is so odd.

Pull Request: https://projects.blender.org/blender/blender/pulls/126981
2024-09-02 13:40:49 +02:00
Julian Eisel
a2e580c0c1 Cleanup: Correct comment on memory utility function
Previous comment was wrong/misleading.
2024-09-02 13:09:31 +02:00
Jacques Lucke
9074da6457 Fix: memory leak when converting vfont to curve 2024-09-02 12:39:52 +02:00
Sybren A. Stüvel
f917b60036 Anim: add Action selectors to Material + Camera properties
In the Properties editor, add Action selectors to the Material
properties and the Camera properties.

For the Material, two Action selectors are shown: for the Material
itself and for its shader node tree. Those are separate IDs of different
types, and thus will always have separate Actions (until the Slotted
Actions are commonplace).

When the 'Slotted Actions' experimental feature is enabled, also show
the Action Slot selector underneath each Action selector.

The Animation panel in the Properties editor is (by default) always at
the bottom, just above the Custom Properties panel.

Pull Request: https://projects.blender.org/blender/blender/pulls/125666
2024-09-02 12:10:14 +02:00
Sybren A. Stüvel
a946244e7e Anim: F-Curve icons, return std::nullopt when RNA path cannot be resolved
Use an `std::optional<int>` to return the icon from
`getname_anim_fcurve()`.

This function is used both to get the name and to get the icon of
whatever the F-Curve is animating. Sometimes the animated struct doesn't
have an icon though. In some cases we need to know whether it could
resolve the RNA path correctly or not, and checking for 'no icon' was
not enough because that may be a valid return value.

The returned icon is now wrapped in an `std::optional<int>`, and a
`std::nullopt` is returned whenever the icon cannot be determined.

No functional changes, except in the two places where the icon is
actually used. In case of error there is now always a fallback to the
struct icon of the animated ID (previously this was only a fallback when
the RNA path was there but could not be resolved; now it's also used
when the RNA path is empty, for example).

Pull Request: https://projects.blender.org/blender/blender/pulls/125666
2024-09-02 11:20:55 +02:00
Sybren A. Stüvel
402e87c6d2 Anim: find Action Slot users on embedded IDs
Find Action Slot users on embedded IDs, such as the Node Tree used by a
Material.

Pull Request: https://projects.blender.org/blender/blender/pulls/125666
2024-09-02 11:20:51 +02:00
Jeroen Bakker
835e626a28 Workbench: Fill unused texture slots
Workbench doesn't fill all texture slots. In OpenGL it should match what
the shader is using, where some texture slots that have been defined can
be optimized away when not used. The Vulkan backend however uses all the
resources that has been defined in the shader create info.

When using a texture shader in workbench the shader would raise a
validation warning as there are slots defined that are never uploaded.
This PR fixes this by always set dummy textures in those slots.

Pull Request: https://projects.blender.org/blender/blender/pulls/127064
2024-09-02 11:12:47 +02:00
Pablo Vazquez
2076abba01 UI: Rename Clip Editor Dopesheet to Dope Sheet
Matching the name of the Dope Sheet animation editor.

Pull Request: https://projects.blender.org/blender/blender/pulls/126985
2024-09-02 10:54:50 +02:00
Clément FOUCAULT
895e315f2e Overlay-Next: Add Alt+B clipping support
Add back clipping using the same GL clip planes as before.

The difference is that the clip planes are now stored in the
`GlobalsUboStorage` instead of relying on another separate
UBO.

One annoyance of the current design is that the `overlay::Instance`
has to be created with the clipping state. This could be fixed later
by making the shader module a pointer instead of a reference.

Rel #102179

Pull Request: https://projects.blender.org/blender/blender/pulls/127018
2024-09-02 10:54:10 +02:00
Campbell Barton
a60690e0f3 Fix assertion when curves have co-located points
Scaling 2 points to 0 would assert. Remove the assertion
as this isn't an error.

Also ensure `anim_path_accum_length` is freed when a new
length isn't calculated.
2024-09-02 17:00:47 +10:00
Campbell Barton
ff3949426c Cleanup: spelling in comments 2024-09-02 16:55:19 +10:00
Jesse Yurkovich
cb79df9343 Cleanup: Formatting
Pull Request: https://projects.blender.org/blender/blender/pulls/127063
2024-09-02 05:55:13 +02:00
Howard Trickey
8549bc94de Fix #126511: Crash when Bevel + Mark Seam or Sharp
The code for marking seams or sharp in a bevel was nonsense
for terminal edges (beveled edges that are the only beveled
edge at a vertex). It was written assuming that either the
number of segments is 1 or there is a mesh ADJ pattern, which
is not the case if there is a terminal edge with segments > 1.
The immediate fix for infinite loops is to project against trying
to execute this code for terminal edges.
Also made current code clearer and removed duplication.
It is a future TODO to make it do something sensible for terminal
edges instead of a no-op. Incidentally I notice that it also doesn't
work for mitered booleans, but it won't infinite loop in that case.
To fix both of these cases, we should try to count boundary vertices
to skip rather than edges to skip.
2024-09-01 19:21:12 -04:00
Julien Duroure
780721de19 glTF exporter: fix error message if hook failed 2024-09-01 15:16:27 +02:00
Clément FOUCAULT
b13593e0be GPU: Silence warnings when not building with renderdoc support 2024-09-01 13:15:56 +02:00
Aras Pranckevicius
4b76b398d5 Fix: Vulkan code build failure when Renderdoc is enabled
8ae0264459 broke the build when both Vulkan and Renderdoc options
are on
2024-09-01 12:32:02 +03:00
Aaron Carlisle
7675b5a0b4 Fix: MEM_new/MEM_freeN mismatch in menu search code 2024-08-31 15:33:52 -04:00
Pratik Borhade
de487a6712 Fix #126872: Cannot assign custom preview to node asset
Caused by 03ae57dd8b
Custom preview operator uses `lib_id_preview_editing_poll`. To enable
this operator in UI, move the new condition to `lib_id_generate_preview_poll`
poll function so adding custom preview to unsupported type would
still be possible.

Co-authored-by: Julian Eisel

Pull Request: https://projects.blender.org/blender/blender/pulls/126874
2024-08-31 13:14:24 +02:00
Hans Goudey
d31c633f4c Sculpt: Reduce size of undo node struct
This struct should be split in the future, but for now its size matters
since one is created for every BVH node for every undo step. Removing
the inline buffers for the arrays is a simple way to reduce the size
from 672 to 400 bytes.
2024-08-30 23:54:41 -04:00