Commit Graph

99948 Commits

Author SHA1 Message Date
Campbell Barton
d3d91b79e0 Fix error from recent refactor failing to save user data on exit
The check from [0] flipped background mode check.

[0]: c803ddab29
2023-05-30 23:01:00 +10:00
Jeroen Bakker
004ce8fc4e Vulkan: Add Support For Texture Buffers
Texture buffers are vbos that can be sampled as textures inside shaders.
This adds support for them to the Vulkan Backend.

Pull Request: https://projects.blender.org/blender/blender/pulls/108193
2023-05-30 13:54:51 +02:00
Brecht Van Lommel
e3ffc8bbfb Cleanup: compiler warnings 2023-05-30 13:51:46 +02:00
Hallam Roberts
b762f8da9c Modeling: Improve Suzanne's UV map
This fixes issues in Suzanne's UV map, making it more symmetrical and adding
the missing face on the ear.

Pull Request: https://projects.blender.org/blender/blender/pulls/106652
2023-05-30 13:51:46 +02:00
Jeroen Bakker
3f89ec2866 Vulkan: Copy Between Textures
This PR adds support for copying between two textures.

Pull Request: https://projects.blender.org/blender/blender/pulls/108413
2023-05-30 13:50:35 +02:00
Jeroen Bakker
e0ad6f1fd8 Vulkan: Missing Compile Directives
MakesRNA uses WITH_VULKAN_BACKEND, but it wasn't included in the
CMakeLists.txt. Also added WITH_METAL_BACKEND. Metal is currently
included as a global compilation directive. We might want to sanitize
that according in a different patch.

This PR makes sure that Vulkan backend can be selected via the PythonAPI.
Note that the changes to user preference UI isn't added to this patch as
the Vulkan backend isn't usable to end users.

`bpy.context.preferences.system.gpu_backend = 'VULKAN' should now be
possible. After saving the user preference and restarting Blender it should
initialize the Vulkan backend.

Pull Request: https://projects.blender.org/blender/blender/pulls/108414
2023-05-30 13:48:46 +02:00
Jeroen Bakker
2cc0f94d68 Vulkan: Fix Out of Resources Crash
When a descriptor pool cannot allocate a descriptor set in stead
of resulting `VK_ERROR_OUT_OF_POOL_MEMORY` it is adviced that
drivers will return `VK_ERROR_FRAGMENTED_POOL`.

Before this PR the Vulkan Backend crashed as it only checked the
out of pool memory. According to the Vulkan specification it is
adviced to driver developers to report fragmented pool.

The crash happened as no new pool was allocated and no descriptor
set could be allocated anymore.

This change improved the reliability of the vulkan backend to be
able draw an animation in the 3d viewport for half an hour without
crashing. Before this change Blender would crash in a few seconds.

Pull Request: https://projects.blender.org/blender/blender/pulls/108416
2023-05-30 13:48:17 +02:00
Jeroen Bakker
a08652b56c Vulkan: Area Readback of Framebuffer Textures
This PR adds the ability to only read back an area of a framebuffer
texture. It also adds the ability to read back from the depth
attachment.

Also reduces the amount of needed memory and reduces the CPU cycles
by reading back directly into the memory provided by the user. The
previous implementation wasn't able to do so as the `VKTexture::read`
function always returned a new buffer. The introduced
`VKTexture::read_sub` works on a pre-allocated buffer.

Pull Request: https://projects.blender.org/blender/blender/pulls/108418
2023-05-30 13:47:55 +02:00
Jeroen Bakker
589044a637 Vulkan: Detect AMD Vendor
This PR improves the vendor detection for AMD GPUs. Previously only
older AMD GPUs where detected (ATI). This PR adds support for newer
cards as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/108417
2023-05-30 13:46:36 +02:00
Jeroen Bakker
821b53942e Vulkan: Color Blend State for Multi Attachment Framebuffer
Current implementation of the Color Blend State worked for framebuffers
with a single attachment. This PR adds support for Color Blend State for
multiple attachments. It is assumed that the Blend State is the same for
all attachments.

NOTE: Integer based attachments aren't yet supported. In OpenGL it is
assumed that Integer based attachments aren't blended. It is currently
to early to tell if this is also the case for Vulkan. If this assumption
is incorrect we should use multi blend state.

Pull Request: https://projects.blender.org/blender/blender/pulls/108419
2023-05-30 13:46:11 +02:00
Jeroen Bakker
84cb112b4e Vulkan: Restart Index
This PR adds support for restart indices. Restart indices are for
example used during hair rendering where an index buffer contains
multiple hair strands. When in the index buffer a restart index is
added, a new line will start, instead of continuing extending the
previous line.

Pull Request: https://projects.blender.org/blender/blender/pulls/108421
2023-05-30 13:45:41 +02:00
Brecht Van Lommel
3fece69e6b Merge branch 'blender-v3.6-release' into main 2023-05-30 13:19:59 +02:00
Lukas Tönne
292baa2a1d Fix #108262: Create cache folder only for modifiers with used sim zones
Baking simulations for an object with more than one geonodes modifier
creates cache folders for _all_ modifiers, even if some of them do not
actually have simulation zones. The simulations zones also don't need to
be connected to the output to generate cache folders.

This patch restricts cache folder generation to modifiers which actually
have simulation zones and use them.

Extra cache folders were created because executed modifiers were only
checking if a simulation state exists and not whether it contains actual
zone data (`sim_state->zone_states_.is_empty()`). The modifiers are
always executed if the object is evaluated by  the depsgraph, which
happens if _any_ of the modifiers is time-dependent. Time dependency in
turn is enabled if a simulation zone exists in the tree, regardless of
whether it is used.

Checking for zone states in the cache output during baking lets us
decide if a cache folder is needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/108278
2023-05-30 12:25:22 +02:00
Falk David
d21f4efc8e Cleanup: formatting 2023-05-30 11:18:35 +02:00
Falk David
3aaacd6e30 GPencil 3.0: Initial commit
Adds the initial stage for the grease pencil 3.0 project.

This patch includes:
* New ID and new object type.
* New DNA structures.
* New drawing engine for grease pencil (gpencil-next).
* Tests for the new grease pencil data-type.
* A few operators for conversion, switching modes and (simple) drawing.

Exposed to the user:
* An experimental option to switch to the new grease pencil.
   * This will switch the grease pencil render engine to gpencil-next which can only render the new object type.
     Current grease pencil objects will no longer render.
   * Changing this option currently requires a restart of blender (for the keymap to update).
* A conversion setting in the `Object` > `Convert To` operator.
* A drawing operator in `Draw Mode`.

Pull Request: https://projects.blender.org/blender/blender/pulls/106848
2023-05-30 11:14:16 +02:00
Aras Pranckevicius
0d38fa2422 Externals: compile fmtlib as a library instead of using it with FMT_HEADER_ONLY 2023-05-30 11:17:23 +03:00
Aras Pranckevicius
122c48aed0 Externals: update fmtlib to latest version (10.0.0)
The library is used by OBJ/PLY exporters, and asset_catalog_tree_view.
Performance of OBJ/PLY export seems to be the same. Blender executable
gets a tiny bit smaller (-5kb) on windows.
2023-05-30 10:48:43 +03:00
Campbell Barton
0272ab6cda Cleanup: avoid copy & unnecessary allocation creating temporary path 2023-05-30 16:43:45 +10:00
Campbell Barton
0a5d0c0ef6 Merge branch 'blender-v3.6-release' 2023-05-30 16:02:31 +10:00
Campbell Barton
5b5a1e3581 Fix crash assessing freed memory when pasting materials
- Pasting a material would free the materials local node-tree,
  leaving it in the depsgraph which would then tag the freed ID
  (from deg_graph_clear_id_recalc_flags).
- texpaintslot, gp_style pointers were copied into the clipboard without
  being cleared or duplicated, allowing for freed memory access later on.
- A shallow copy from the cliboard into the material could also cause
  these pointers to be overwritten and leak memory.

Resolve by calling material_free_data before performing a shallow copy
and adding material_clear_data which ensures these pointers aren't
copied into the clipboard.
2023-05-30 15:50:27 +10:00
Campbell Barton
d979d535a6 WM: restore support for calling WM_exit with a NULL context
While currently the context is never null, a null context is meant
to be supported. Apply minor changes needed for this to work again.
2023-05-30 14:58:52 +10:00
Campbell Barton
cb0c4f04d4 Fix material copy-buffer memory leak on exit
Commented [0] (2.5x refactor that disabled many free functions),
for some reason this call was never re-enabled.
Add back the free call along with other clipboard buffers.

[0]: a1c8543f2a
2023-05-30 14:46:39 +10:00
Campbell Barton
c5e9ccba7a Cleanup: minor adjustment to WM_exit_ex
Clarify the purpose of ED_editors_flush_edits and that file save
runs even when its return value is false.
2023-05-30 13:43:32 +10:00
Campbell Barton
c803ddab29 Fix saving a quit.blend on exit when a file failed to load
When a file passed in from the command line failed to load,
blender would exit & save the quit.blend.

Resolve by adding a `do_user_exit_actions` to WM_exit_ex which is
false in backgrounds mode or when an error has occurred.
2023-05-30 13:37:02 +10:00
Campbell Barton
d7d1c524e3 Cleanup: pass the exit-code to WM_exit
Callers to WM_exit needed to set G.is_break for a predictable exit-code.
This is error prone as G.is_break may be set based on the user having
pressed escape during event handling.

Instead, pass the exit code as an argument.
2023-05-30 12:55:10 +10:00
Campbell Barton
be4a9fe4df Merge branch 'blender-v3.6-release' 2023-05-30 12:43:28 +10:00
Campbell Barton
0edb65c3eb Fix failure exit-code after pressing escape
WM_exit calls `exit(G.is_break == true)` which only makes sense in
background mode, pressing escape sets `is_break` which isn't cleared,
causing an error exit-code of 1 on exit.
2023-05-30 12:42:42 +10:00
Campbell Barton
3e5a860a16 Merge branch 'blender-v3.6-release' 2023-05-30 11:54:57 +10:00
Campbell Barton
f6d5a9080b PyAPI: suppress 'bgl' warning for Blender as a Python module
This would print whenever 'bpy' was imported, because in this case
Blender's Python integration loads all modules immediately because it
can't import modules as needed via the inittab mechanism.

Also correct code-comments for why inittab can't be used.
2023-05-30 11:53:37 +10:00
Campbell Barton
3ba28a1961 Cleanup: rename wmWindowManager::initizlied to init_flag
This read like a boolean, also rename enum members to use a shared
`WM_INIT_FLAG_*` prefix.
2023-05-30 11:03:01 +10:00
Campbell Barton
6f94591432 Cleanup: remove redundant braces around for loop 2023-05-30 10:45:39 +10:00
Campbell Barton
99acfea0c4 Cleanup: avoid term 'str' or 'string' for string variables
Use: path, filepath or label instead.
2023-05-30 10:34:10 +10:00
Campbell Barton
edcfdea70a Cleanup: redundant temp string & over sized filename & number buffer 2023-05-30 10:30:57 +10:00
Campbell Barton
65cc4cd774 Merge branch 'blender-v3.6-release' 2023-05-30 10:19:26 +10:00
Campbell Barton
0a125fccf4 Fix sequencer multi-view context check
Own regression caused by [0] made to ensure the string was initialized,
without accounting for it being static & reused between calls.

Replace static variables with a struct that's passed to the function,
this explicitly shares state between calls as this static variable use
depended on BKE_scene_multiview_view_prefix_get always clearing prefix
variables with a zero view_id so future calls would also be cleared.

While this non-obvious behavior could be documented,
use more straightforward logic.

[0]: bdad2c0595
2023-05-30 10:11:46 +10:00
Iliya Katueshenock
30a25a42e6 Move versioning file 2.8 to C++
Changes:
1. `NULL` -> `nullptr`.
2. Cast `void *` to `T *` by using `static_cast`.
3. Using `LISTBASE_FOREACH` instead of manual for-loops.
4. `eNTreeDoVersionErrors` now is `enum class : int8_t`.
5. `eNTreeDoVersionErrors` declaration moved to global scope.
6. `ENUM_OPERATORS` for `eNTreeDoVersionErrors`.

See: https://projects.blender.org/blender/blender/issues/103343
Pull Request: https://projects.blender.org/blender/blender/pulls/108100
2023-05-29 20:56:49 +02:00
Richard Antalik
0542705218 Merge branch 'blender-v3.6-release' 2023-05-29 14:52:50 +02:00
Richard Antalik
97d9e078b3 Fix #108094: VSE relative paths do not work with linked scenes
Use `ID_BLEND_PATH_FROM_GLOBAL` instead of
`BKE_main_blendfile_path_from_global`.

Pull Request: https://projects.blender.org/blender/blender/pulls/108251
2023-05-29 14:50:50 +02:00
Campbell Barton
d6b9df2737 Merge branch 'blender-v3.6-release' 2023-05-29 21:54:50 +10:00
Campbell Barton
21ef4276ee Fix potential buffer overflow in BLI_windows_get_executable_dir
GetModuleFileName size was 256 bytes greater then the argument given.
2023-05-29 20:33:43 +10:00
Brecht Van Lommel
e5c8b92e9c Fix outliner constraint disabling clearing unrelated flags 2023-05-29 11:38:30 +02:00
Campbell Barton
1f3a0fbad8 Command line argument --open-last exists if the file isn't found
Don't create a new empty file when --open-last is used.
2023-05-29 12:54:36 +10:00
Campbell Barton
d958a5dd24 Refactor: split file loading into its own function
Function naming made it seem main_args_setup might need to call
main_args_setup_post, when this was in fact only needed for handing
final arguments.

Call BLI_args_parse directly and expose main_args_handle_load_file
as a public function. Move handle_load_file into a separate function
which is called by --open-last.
2023-05-29 12:49:35 +10:00
Campbell Barton
260eabba8f Merge branch 'blender-v3.6-release' 2023-05-29 12:29:01 +10:00
Campbell Barton
2d81e65703 Fix failure to load a blend file behaving as if a new file is loaded
When a blend file failed to load from the command line,
blender would load a blend file with the path set to the location
that could not be loaded.

Now the command line argument is only treated as a new file
if the file does not already exist. Failure to load a file that
is found always exists with an error.
2023-05-29 11:52:23 +10:00
Campbell Barton
db43b27227 Merge branch 'blender-v3.6-release' 2023-05-29 10:04:55 +10:00
Pratik Borhade
19a9941816 Fix #107011: Support logarithmic scale when values are zero
On click-dragging, property value was not incrementing because new
`data->dragstartx` value is infinite/invalid (when startvalue=0). To
fix this, pick max value between `startvalue` and `log_min`.

Ref !107466.
2023-05-29 09:48:57 +10:00
Campbell Barton
ab73a8abba Help text: corrections & minor changes for the user manual
- BLENDER_STARTUP_FILE was included as a literal instead of expanding
  into 'startup.blend' as intended.
- Single quote cycles device (matching image formats).
- Include all GPU back-ends from bpy.app.help_text(all=True)
- Minor changes to simplify conversion to RST.
2023-05-28 15:08:07 +10:00
Campbell Barton
f39d1f940f Merge branch 'blender-v3.6-release' 2023-05-28 15:07:44 +10:00
Campbell Barton
379ff4befd Fix incorrect help text for the default for script auto-execution
The default changed in [0] but the help text wasn't updated.

[0]: 412c043474
2023-05-28 14:59:59 +10:00