Commit Graph

102876 Commits

Author SHA1 Message Date
Julian Eisel
e6f4e62ea0 Cleanup: Remove unnecessary asset temporary ID consumer override
The override from 733e4d827a makes this one unnecessary.
2023-09-19 15:46:42 +02:00
Julian Eisel
733e4d827a Refactor: Use asset representation from context instead of asset handle
f6a6b27ac1 made the asset representation type available through context
wherever asset handle was previously. This moves us closer to replacing
the asset handle type.

Part of #102877 and #108806.
2023-09-19 15:43:56 +02:00
ChengduLittleA
954ae19b2b Fix #100596: Use sequencer override camera for line art in render
Line art doesn't take sequencer scene override camera into account when
computing line results, now it will try to get override camera info from
render and use that camera if line art override camera itself isn't set.

This will however not fix VSE preview line art result, since the preview
render doesn't give actual camera object, but rather uses a set of clip
planes and matrix info, thus it's probably not possible to do preview
camera override under current architecture.

Pull Request: https://projects.blender.org/blender/blender/pulls/110287
2023-09-19 15:27:47 +02:00
Julian Eisel
dd23e957ea Assets/BPY: Remove unnecessary asset file handle context member
See d973cc7992.
2023-09-19 15:23:45 +02:00
Julian Eisel
d973cc7992 Assets/BPY: Remove unnecessary asset handle related RNA members
The asset handle type is supposed to be replaced by the asset
representation type. It is designed for the asset system as opposed to
the file browser backend. With d421ebac5e, d04cd3f3e6 and f6a6b27ac1, it
can now do everything that is needed in Python to be a replacement.
591a1ae323 removed all usages of these members in the asset handle and
the file entry wrapped by the asset handle. All this should now be
accessed via the `bpy.types.AssetRepresentation` type instead, which is
available everywhere the `AssetHandle` type was available before.

Part of #102877 and #108806.
2023-09-19 15:16:23 +02:00
Julian Eisel
f6a6b27ac1 Assets: Expose asset representation in context RNA/BPY
Makes the asset representation type available in RNA/BPY context
whenever the asset handle type is, so that it can be used instead. See
d04cd3f3e6. With this change we can now replace virtually all usages of
the asset handle type in Python with the asset representation. (Only for
the asset view template we require a collection property taking asset
handles still, for internal reasons.)

Idea is now to first get rid of all usages of asset handle in Python,
so that there's almost no need for further compatibility breaking
changes (unsure if the asset view template can be removed for 4.0
already though). Internal hacks related to it can be removed at any time
still.

Part of #102877 and #108806.
2023-09-19 14:40:01 +02:00
Jeroen Bakker
3a4c238d50 Command Line: Remove Disabling SSBO
Blender has the option to disable SSBO support. This was accessible
as a command line option `--debug-gpu-disable-ssbo`.

Blender 4.0 has a hard requirement for OpenGL 4.3 which includes
SSBO support by default.

This PR removes the command line option as it makes no sense to
have it anymore.

Related to #112224

Pull Request: https://projects.blender.org/blender/blender/pulls/112571
2023-09-19 14:22:32 +02:00
Campbell Barton
5815a00acf Fix duplicate items in edit-mesh select similar enum
The enum contained two instances of NORMAL & FACE,
prefix with VERT/EDGE/FACE for clarity.
2023-09-19 21:26:57 +10:00
Campbell Barton
82be70a95f Fix crashes for some operators poll functions in background mode 2023-09-19 21:19:20 +10:00
Campbell Barton
221182c204 Fix assert accessing bone collection enum
Enum functions shouldn't return null,
use rna_enum_dummy_NULL_items instead.
2023-09-19 21:09:27 +10:00
Julian Eisel
d04cd3f3e6 Assets: Expose more data in the asset representation RNA/BPY
The asset handle type is supposed to be replaced by the asset
representation type. It is designed for the asset system as opposed to
the file browser backend. This commit adds more members to its RNA type
to query data, so more usages of the asset handle type in Python can be
converted.

Part of #102877 and #108806.
2023-09-19 12:24:34 +02:00
Jeroen Bakker
39e6776689 Fix: GPU Incorrect Padding For Globals
A float array use different alignment and reservation rules on
GPU versus CPU. Before this change the _pad1 was aligned to 16 bytes as
it was defined as an array, but on CPU this alignment doesn't
happen.

This is fixed by using 3 floats in stead of a float array for padding.

Pull Request: https://projects.blender.org/blender/blender/pulls/112565
2023-09-19 12:10:31 +02:00
Jeroen Bakker
2d70f46265 Fix: Vulkan Grid Overlay
In Vulkan the grid overlay wasn't rendering correctly. The reason was
a mis alignment in the std430 layout. This PR fixes the std430 layout
so the grid overlay (and perhaps also other sections) would work.

Root cause is that the reserve size if an nVec3 is different when used
as an array versus a single attribute. This was not taken into account
where the overlay flag was read from uninitialized memory.

Pull Request: https://projects.blender.org/blender/blender/pulls/112564
2023-09-19 11:52:59 +02:00
Campbell Barton
a288ab45b7 Fix Python exceptions from RNA methods showed twice
When RNA classes called into their Python methods,
exceptions would display twice once when reported and again from
PyErr_Print. This could happen when a Python defined poll method raised
an exception.

It also wasn't possible to suppress by redirecting `sys.stderr` for
example, because reporting printed directly to the stdout.

Resolve these issues by suppressing the reports output,
leaving PyErr_Print to output errors to sys.stderr.
2023-09-19 19:47:40 +10:00
Sybren A. Stüvel
62639080bc Anim: armature edit mode, replace 'bone layers' operator with collections
In armature edit mode, replace the 'bone layers' operator with the 'move
to bone collection' operator. This operator now works in both pose mode
and edit mode, and is available with the 'M' hotkey in either mode.
2023-09-19 11:45:40 +02:00
Lukas Tönne
78315faf8f Fix #112490: Always draw socket icons in "hidden" nodes
In #112326 the socket visibility functions were updated to take the
open/closed state of panels into account for visibility of the socket
icon. However, in "hidden" (collapsed) nodes the panels should be
ignored entirely, drawing all sockets on the root level. This requires
looking at the node flags to determine socket icon visibility, so a
simple method of `bNodeSocket` is not sufficient.

This patch moves the more complex visibility queries for sockets into
`bNode`, where both node and socket flags can be accessed. These should
be used for actual visibility rather than the plain flag accessors on
`bNodeSocket`.

Renamed `is_visible_or_panel_closed` back to just `is_visible`, the
other `is_visible` variant is now integrated in `bNode::is_socket_drawn`.

Pull Request: https://projects.blender.org/blender/blender/pulls/112520
2023-09-19 10:47:21 +02:00
Campbell Barton
75748f9d7a Fix error displaying exceptions in some cases
Replacing PyErr_Print with PyErr_Display in [0] caused string errors
not to display because PyErr_Display doesn't normalize the exception.

Normalizing before displaying the error resolves this.

[0]: 6a0f98aeef
2023-09-19 18:25:28 +10:00
Campbell Barton
097b97518c Fix crash running "Operator Cheat Sheet" 2023-09-19 17:27:42 +10:00
Campbell Barton
9f06aec32f Cleanup: de-duplicate sequencer modifier enum items 2023-09-19 17:22:49 +10:00
Campbell Barton
6b1b41bbd6 Fix #112541: Tooltip for "Set Tool by Name" crashes in operator search 2023-09-19 16:16:17 +10:00
Campbell Barton
d8b8089630 Cleanup: spelling & typo in last commit 2023-09-19 15:53:51 +10:00
Campbell Barton
e8df5cec83 PyAPI: free internal Python data using sys.exit(..)
Previously BPY_python_end wasn't called when scripts called sys.exit()
because BPY_python_end exited the Python interpreter.

Change this behavior to call BPY_python_end without exiting the Python
interpreter while freeing Blender/Python data.

While leaks in the context of sys.exit aren't especially important
it's generally preferable for sys.exit() to match Blender's code-paths
for exiting to avoid unexpected behavior.
2023-09-19 15:50:41 +10:00
Campbell Barton
a8b6c4c826 Docs: update code-comments for sys.exit() & handling SystemExit
Some of the comments for exiting were outdated & vague.
Add additional comments to clarify out SystemExit, sys.exit() & atexit
are used to handle exit requests from Python within Blender.
2023-09-19 15:01:08 +10:00
Campbell Barton
393c365daf Cleanup: code-comment formatting, remove commented prints 2023-09-19 15:00:21 +10:00
Campbell Barton
085b094f18 Cleanup: use const arguments & variables 2023-09-19 11:09:20 +10:00
Lukas Tönne
742f3b233f Nodes: Rename ui_items property to items_tree
DNA names are unchanged, just affects the RNA API.

Resolves #112523

Pull Request: https://projects.blender.org/blender/blender/pulls/112527
2023-09-18 18:07:26 +02:00
Sybren A. Stüvel
e59944dba4 Anim: armature edit mode 'select by bone color' operator
In the armature edit mode 'select similar' operator, replace the 'select
by same bone group' operator with 'select by same bone color'.
2023-09-18 18:06:06 +02:00
Sybren A. Stüvel
d5329eeea2 Anim: armature edit mode 'select by bone collection' operator
In the armature edit mode 'select similar' operator, replace 'select by
layer' with 'select by bone collection.
2023-09-18 18:06:06 +02:00
Sybren A. Stüvel
c230c52626 Anim: implement 'Select Grouped' by bone color
The pose mode 'Select Grouped' operator can now select by bone color.
This compares either the theme palette index, or the full custom color.
In other words, if custom colors are visually very similar but binary
not equal, they will be treated as different.

The last bytes of the custom colors (so `solid[3]`, `active[3]`, and
`selected[3]`) aren't used for these comparisons, as the values are
inconsistently either 0 or 255 depending on how the color was set. There
is no way to influence this with the color picker in the GUI, and AFAIK
the alpha channel isn't used for drawing either.
2023-09-18 18:06:06 +02:00
Sybren A. Stüvel
e41fbfd6e9 Anim: add 'select grouped: bone collection' pose mode operator
Add 'Bone Collection' to the 'Select Grouped' operator in pose mode.
This removes the 'Same Layer' option, and replaces it with 'Same Bone
Collection'. It selects all the bones that are in the same collections
as the active bone.

When there are multiple armatures in pose mode, the bone collections are
matched by name.
2023-09-18 18:06:06 +02:00
Weizhen Huang
1cb7e29123 Fix: EEVEE: implicit cast from float to bool in Multiscatter GGX 2023-09-18 17:29:10 +02:00
Lukas Tönne
c951464b8a Fix #112521: Socket in_out type specified as a simple enum
This was still using an enum_flag which allows setting multiple items.
The items are already fixed bit combinations, this should be a simple
enum.

Pull Request: https://projects.blender.org/blender/blender/pulls/112525
2023-09-18 15:53:31 +02:00
ChengduLittleA
34877ec38b Fix #112083: Loop cut requires GL only in interactive mode
Loop cut operator should only require OpenGL in interactive mode, this
makes it possible to run background python script calling the operator.

Thanks for the help from Campbell Barton (@ideasman42)

Pull Request: https://projects.blender.org/blender/blender/pulls/112121
2023-09-18 15:45:16 +02:00
Hans Goudey
9184ea415b Fix #112500: Crash setting mesh line vertices to 0
Caused by missing null check in 7344c7875a
2023-09-18 08:53:26 -04:00
Sybren A. Stüvel
7be628b396 Anim: bone collections: make the "(de)select bones" work on linked arms
The "(de)select bones in collection" operators only change the selection
state on the pose (when in pose mode), and thus should be able to work
even when the armature (which contains the bone collections) is read-only.
2023-09-18 14:48:34 +02:00
Sybren A. Stüvel
38871b9728 Anim: (de)select bones in collection, remove 'name' operator property
Simplify the "(de)select bones in collection" operators by removing their
'name' property. They now only operate on the active bone collection. This
means the poll function can be more specific, making the enabled/disabled
state of the buttons more sensible.
2023-09-18 14:48:34 +02:00
Sybren A. Stüvel
8337a19f97 Anim: make it possible to select bone collections on linked armature
Make it possible to select bone collections in the UI, even when the
Armature is linked & not overridden. This opens up the possibility of
(de)selecting bones via read-only bone collections.
2023-09-18 14:48:34 +02:00
Sybren A. Stüvel
02659c0d01 Anim: merge bone collection assignment menus
Remove the Ctrl+G shortcut (remnant of the bone group assignment operator),
and change the 'Pose / Bone Collections' menu so that it handles linked
and overridden data properly. Shift+M now shows that menu too.
2023-09-18 14:48:34 +02:00
Weizhen Huang
e0dacfdda6 EEVEE: use Schlick's approximation instead of real Fresnel for glass
so that we can tint `F0` separately
Ref: #112192 #99447

Mostly affects `IOR < 1`. The overall appearance matches, with some changes in the reflection.

Pull Request: https://projects.blender.org/blender/blender/pulls/112390
2023-09-18 14:26:19 +02:00
Campbell Barton
6a0f98aeef Fix memory leak in PyC_ExceptionBuffer for Py 3.12
Non-matching calls to PyErr_Fetch/Restore cause a leak in v3.12,
so ensure calls are symmetrical or avoid where possible.

Simplify extraction of the exception buffer.

- Only overwrite the stderr (the stdio isn't used).
- Simplify pyc_exception_buffer_handle_system_exit usage.
- Remove goto's.

Also simplify calling conventions for PyC_ExceptionBuffer functions.
- They must be called when an error has occurred.
- Always return a string, never null since a null return value would
  only happened in rare/unexpected cases which wasn't being checked
  for by some callers, leading to potential crashes.
2023-09-18 22:09:19 +10:00
Campbell Barton
19b9ee7f74 Cleanup: remove commented out PyC_ExceptionBuffer function
The internals of PyErr_Print/PyErr_Display & the traceback module
are different enough that it's not likely the Python traceback
implementation will be used.
2023-09-18 22:09:18 +10:00
Jeroen Bakker
f7ccec2bcc Vulkan: Fix Generate Mipmaps for Array Textures
Array textures stores the array length inside the size of the image. In
vulkan the size mustn't contain the array length, but it should be set
as a separate parameter. This logic wasn't implemented when updating
the mipmap chain.

Patch also includes some smaller fixes where textures would not yet be
allocated on the device, but was expected to be.

Pull Request: https://projects.blender.org/blender/blender/pulls/112518
2023-09-18 13:45:53 +02:00
Jeroen Bakker
231f1a6076 Vulkan: Implement GPU_storagebuf_copy_sub_from_vertbuf
This PR implements `GPU_storagebuf_copy_sub_from_vertbuf`. It can be
used to copy a part of a vertex buffer to a storage buffer.

Pull Request: https://projects.blender.org/blender/blender/pulls/112516
2023-09-18 13:44:03 +02:00
Jeroen Bakker
a54495b347 Vulkan: Upload Uniform Buffer Attached Data
Uniform buffers can have data provided during construction, or as
attached data. Attached data should be uploaded during bind.

This PR implements `GPU_uniformbuf_create_from_list`.

Pull Request: https://projects.blender.org/blender/blender/pulls/112517
2023-09-18 13:43:16 +02:00
Jeroen Bakker
1daecc24d0 Vulkan: Postpone Resource Destruction
Resources can still be in use inside the vulkan command queue, when
they are destroyed. Especially as Vulkan doesn't allow resetting
bindings to nothing.

This PR will collect the resources that needs to be destroyed inside
the VKDevice and actually destroy the resources when on frame end.

The resources currently include:
* VkBuffer
* VkImage
* VkImageView
* VkFramebuffer
* VkRenderPass

Pull Request: https://projects.blender.org/blender/blender/pulls/112514
2023-09-18 13:42:17 +02:00
Jeroen Bakker
0e47a13e3e Vulkan: Fix Namespace Collision Between Shader Resources
Previous implemetation had some limitations that were not working
for complex shaders. This limitations included:

* All bindings should be bound to a location < 16.
* Collision could happen when image locations where read that
  overlapped with the texture locations.

This PR replaces the fixed binding locations with a dynamic vector.
When allocating locations for images the image offset is determined
that it is always clear if the requested locations is already
offsetted or not. This is done by ensuring the offset to larger than
the max slot of samplers, but also of image slots.

When using Eevee-next materials the slot numbers can be very high
as the location of the first material texture is set to
`GPU_max_textures_frag()` On current NVIDIA drivers this number is
set to 1K. Images are stored after the textures slots upwards.

In the future driver could set this to MAX_INT which will not work
with the new implementation. This isn't the case at this moment
and perhaps also not realistic. We don't check for this situation yet.

Pull Request: https://projects.blender.org/blender/blender/pulls/112511
2023-09-18 13:41:50 +02:00
Jeroen Bakker
80dda1168f Vulkan: Submit after Compute Dispatch
This PR adds command submission after performing any compute dispatch.
This is a work around as the vulkan backend doesn't support memory
barriers yet.

Pull Request: https://projects.blender.org/blender/blender/pulls/112505
2023-09-18 13:41:19 +02:00
Pablo Vazquez
a59ec4c936 UI: Rename Eevee to EEVEE in labels/tooltips
Remove ambiguity of Eevee/EEVEE in labels, tooltips, and docs.

The correct spelling is "EEVEE".

Pull Request: https://projects.blender.org/blender/blender/pulls/112501
2023-09-18 12:28:36 +02:00
Sergey Sharybin
10c5c94eaf Fix #112486: VSE: Rendering transparent frames produces errors/crashes
A mistake in some of the previous refactor which was aimed to make the
byte buffer to be stored as uint8_t. One of the array size calculation
was missing multiplication by 4 channels.

Pull Request: https://projects.blender.org/blender/blender/pulls/112508
2023-09-18 12:22:12 +02:00
Sybren A. Stüvel
c6b553d57c Anim: Add bone collections to the outliner
Add bone collections to the outliner, underneath the Armature.

This basically follows the same approach as the bone groups (which were
removed from the outliner in the previous commit).
2023-09-18 12:14:54 +02:00