Commit Graph

102009 Commits

Author SHA1 Message Date
Campbell Barton
c713c70781 CMake: quiet uninitialized warnings 2023-08-17 11:53:56 +10:00
Harley Acheson
d102536b1a Fix #93685: Allow Outliner Drag to Other Windows
Allow dragging items from Outliner to other windows. Disables EdgePan
operator when entering new window. Canceling the drop redraws target
area and resets all modal cursors. But this does not fix incorrect
mouse cursor during operations on the remote target window.

Pull Request: https://projects.blender.org/blender/blender/pulls/105196
2023-08-17 00:48:32 +02:00
Aaron Carlisle
3ea7117ed1 PyAPI Docs: Fix generation after recent node RNA changes
This commit allows both `rna_enum_` and `rna_node_`to be used for enum prefixes

This also fixes one enum by adding `rna_` to the prefix.

Together these changes fix the API documentation generation.
2023-08-16 17:37:41 -04:00
Harley Acheson
0e977a38bc Cleanup: Make format
Formatting changes resulting from Make Format
2023-08-16 14:15:54 -07:00
Guillermo Venegas
84718feb4b Fix potential leaks using SHGetKnownFolderPath
Documentation for `SHGetKnownFolderPath` remarks that the `PWSTR`
parameter should always be freed with `CoTaskMemFree`  even if it
succeeds or not.

Pull Request: https://projects.blender.org/blender/blender/pulls/111128
2023-08-16 23:10:00 +02:00
Harley Acheson
0c7496f74d UI: Increase Color Picker Size
Increase the Color Picker Size by 33%

Pull Request: https://projects.blender.org/blender/blender/pulls/111153
2023-08-16 22:59:14 +02:00
RedMser
f1e7fe5492 UI: Windows "Quick Access" items to File Browser System List
On the Windows platform add any Explorer "Quick Access" items to the
bottom of the File Browser "System" List in the sidebar.

Co-authored-by: Harley Acheson <harley.acheson@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/108431
2023-08-16 22:36:06 +02:00
Brecht Van Lommel
b0424a7cbd Fix #111180: crash adding AOV/light output node with shader node previews
Only happened when the experimental option is enabled.
2023-08-16 18:43:23 +02:00
Bastien Montagne
f1e64781a8 Core: foreach_id: Tweak handling of scene collection in LayerCollection.
Unfortunately, relying only on the 'embedded' flag of the collection ID
pointer to detect the LayerCollection of a Scene embedded collection is
not enough, since this info may not always be available.

So add an extra explicit 'is_master' to the recursive code processing
all LayerCollections ID pointerrs, and double-check with an assert that
this info is coherent with the Collection's embedded flag, when
possible.
2023-08-16 18:23:15 +02:00
Bastien Montagne
28305c2c73 Refactor: Properly formalize special versioning done after most of readfile code.
In a few cases (IPO conversion, Proxy conversion, ...), versioning
implies creating or removing IDs, and/or needs access to the whole Main
data-base.

So far this was done ad-hoc by adding some code at the end of
`setup_app_data`.

This commit formalizes this process by adding a BLO call
(`BLO_read_do_version_after_setup`) that will encapsulate all such
complex versioning code.

NOTE: This commit does not address the existing issue that this
versioning code is never performmed when linking new data (outside of
the 'opening a blendfile' context). This topic would require its own
design task.

NOTE: This commit does not fix the few current evil cases of ID creation in
regular versioning code. This will be addressed separately.

Although this commit does modifies slightly some logic in this specific
versioning process, no behavioral changes are expected here.

Pull Request: https://projects.blender.org/blender/blender/pulls/111147
2023-08-16 16:21:59 +02:00
Falk David
b14a0ee57e Cleanup: GPv3: Refactor usage of TreeNode
Some functionality of `Layer`s and `LayerGroup`s can be shared. This is why the `TreeNode` class exists. It encapsulates all the common methods both `Layer`s and `LayerGroup`s should have.

Up until now, the usage of `TreeNode` was not consistent and often the layers would just access the base c-struct directly.

This refactor makes it so that all of the functions affecting only the `TreeNode` are moved to the `TreeNode` class and only implemented there.

For example, renaming a layer is really just renaming the node. Therefor there shouldn't even be a `rename_layer` and `rename_layer_group` function. These were combined into a `rename_node` function.

Pull Request: https://projects.blender.org/blender/blender/pulls/111177
2023-08-16 16:18:26 +02:00
Bastien Montagne
dd647677b6 Fix (unreported) Scene foreach_id callback skipping some NULL ID pointers.
Not sure how bad that was in practice, was likely harmless. But
foreach_id logic should never decide to not process an ID pointer
because its value is NULL. Callback code is expected to handle NULL
pointers appropriately.
2023-08-16 15:04:33 +02:00
Pratik Borhade
338e4ef090 Fix: GPv3 layer renaming when name is unchanged
When old and new names of layers/groups are same, garbage string is
displayed. This is because `oldname` char pointer is referenced to
`node.name`. After function execution, `oldname` memory is freed in
`interface_handler` (see `after.rename_orig`), thus displays garbage
string.
Fix is to copy the content of `oldname` instead of referencing it.

Pull Request: https://projects.blender.org/blender/blender/pulls/111173
2023-08-16 14:48:46 +02:00
Omar Emara
85a3f61150 BLI: Add 2D transformation matrix decomposition
This patch adds support for 2D transformation matrix decomposition into
translation, rotation, and scale.

Pull Request: https://projects.blender.org/blender/blender/pulls/111178
2023-08-16 14:47:14 +02:00
Aras Pranckevicius
2f060706a4 Cleanup: fewer BLI_color.hh et al includes
Include counts of some headers while making full blender build:
- BLI_color.hh 1771 -> 1718
- BLI_math_color.h 1828 -> 1783
- BLI_math_vector.hh 496 -> 405
- BLI_index_mask.hh 1341 -> 1267
- BLI_task.hh 958 -> 903
- BLI_generic_virtual_array.hh 509 -> 435
- IMB_colormanagement.h 437 -> 130
- GPU_texture.h 806 -> 780
- FN_multi_function.hh 331 -> 257

Note: DNA_node_tree_interface_types.h needs color include only
for the currently unused (but soon to be used) socket_color function.
Future step is to figure out how to include
DNA_node_tree_interface_types.h less.

Pull Request: #111113
2023-08-16 14:48:53 +03:00
Campbell Barton
92c4756d02 Fix replacement of "Blender Foundation" in recent header change
The recent change to header copyrights [0] unintentionally changed
"Blender Foundation" to "Blender Authors" for the WIN32 file path
which blender is installed into.

Revert lines changed that aren't related to copyright text.

[0]: e955c94ed3
2023-08-16 21:21:55 +10:00
Sergey Sharybin
efb2406262 Fix #111165: Regression: Blender Crashes On Scene Switch
The root of the issue is a missing recalculation tag after
changing collection content.

Pull Request: https://projects.blender.org/blender/blender/pulls/111175
2023-08-16 12:22:55 +02:00
Chao Li
27eb6d48d3 GPv3: Select box grease pencil frames
Adapt the `ACTION_OT_select_leftright`, `ACTION_OT_select_box` and `ACTION_OT_select_column` operators to take into account grease pencil layer channels. These operators call `actkeys_select_leftright`, `box_select_elem`, and `markers_selectkeys_between`, respectively. In these three functions, grease pencil layer channels are considered now. This resolves #110522.

Pull Request: https://projects.blender.org/blender/blender/pulls/110939
2023-08-16 11:44:15 +02:00
Alaska
007b7d0353 Shaders: Change IOR soft minimum to 1.0 in Principled BSDF
Pull Request: https://projects.blender.org/blender/blender/pulls/111158
2023-08-16 10:17:57 +02:00
Aras Pranckevicius
acbd952abf Cleanup: fewer iostreams related includes from BLI/BKE headers
Including <iostream> or similar headers is quite expensive, since it
also pulls in things like <locale> and so on. In many BLI headers,
iostreams are only used to implement some sort of "debug print",
or an operator<< for ostream.

Change some of the commonly used places to instead include <iosfwd>,
which is the standard way of forward-declaring iostreams related
classes, and move the actual debug-print / operator<< implementations
into .cc files.

This is not done for templated classes though (it would be possible
to provide explicit operator<< instantiations somewhere in the
source file, but that would lead to hard-to-figure-out linker error
whenever someone would add a different template type). There, where
possible, I changed from full <iostream> include to only the needed
<ostream> part.

For Span<T>, I just removed print_as_lines since it's not used by
anything. It could be moved into a .cc file using a similar approach
as above if needed.

Doing full blender build changes include counts this way:
- <iostream> 1986 -> 978
- <sstream> 2880 -> 925

It does not affect the total build time much though, mostly because
towards the end of it there's just several CPU cores finishing
compiling OpenVDB related source files.

Pull Request: https://projects.blender.org/blender/blender/pulls/111046
2023-08-16 09:51:37 +02:00
Iliya Katueshenock
f50da4040f Fix #111142: bl_static_type is empty for node groups and custom nodes
Caused by f18c45eb69.
Functions `node_type_base` and `node_type_base_custom`
are the same, but last one have been missed in the cleanup.

Pull Request: https://projects.blender.org/blender/blender/pulls/111154
2023-08-16 09:29:46 +02:00
Harley Acheson
a70953242d Cleanup: Calm Warning
Unreferenced variable introduced in 5741a5d433
2023-08-15 17:21:02 -07:00
Harley Acheson
5741a5d433 UI: Allow Eyedropper Outside of Blender
This adds a new Ghost function, GHOST_GetPixelAtCursor, that allows
picking colors from outside of Blender windows. This only has an
implementation for the Windows platform, but this should allow other
platforms to also do so if possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/105324
2023-08-16 01:14:36 +02:00
Almaz-Shinbay
077db81638 Outliner: Port linked object elements to new tree-element code design
No user visible changes expected.

Part of #96713, continuation of work started in 249e4df110 and 2e221de4ce.
Refer to these for a motivation and design overview.

Adds a new class for linked object elements.

Pull Request: https://projects.blender.org/blender/blender/pulls/111130
2023-08-15 22:44:40 +02:00
Sybren A. Stüvel
86085bcb9c Mem: avoid offsetting nullptr
Fix an UBSAN warning about undefined behavior, by preventing additions
to `nullptr`:

```
blender/source/blender/blenlib/intern/BLI_memiter.c:136:42: runtime error:
applying non-zero offset 48 to null pointer
```

No functional changes.
2023-08-15 18:01:11 +02:00
Hoshinova
0702c24a36 Nodes: Add Lacunarity and Normalize inputs to Noise node
This PR adds the Lacunarity and Normalize inputs to the Noise node
similar to the Voronoi node.

The Lacunarity input controls the scale factor by which each
successive Perlin noise octave is scaled. Which was previously hard
coded to a factor of 2.

The Noise node normalizes its output to the [0, 1] range by default.
The Normalize option makes it possible for the user to disable that.
To keep the behavior consistent with past versions it is enabled by
default.

To make the aforementioned normalization control easer to implement,
the fractal noise code now accumulates signed noise and remaps the
final sum, as opposed to accumulating positive [0, 1] noise.

Pull Request: https://projects.blender.org/blender/blender/pulls/110839
2023-08-15 17:38:45 +02:00
Falk David
969de5135a GPv3: Re-evaluate on frame change
This makes it so the `GreasePencil` geometry gets updated on a time
change.
The frame at which the object gets evaluated is stored in runtime as
`eval_frame`. This is for example used to calculate the bounding box
of the geometry as well as invalidating the batch cache for different
frames.

Pull Request: https://projects.blender.org/blender/blender/pulls/111137
2023-08-15 17:31:11 +02:00
Campbell Barton
e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Bastien Montagne
f188d6709f LibOverride: keep some anim data from liboverride when it exists in both IDs.
So far when an anim data had to be created in liboverride (because none
existed in reference ID), and reference ID got an anim data added later,
that reference anim data would simply replace the one from the
liboverride, completely losing all animation-related work done so far in
the liboverride.

This commit fixes that, by adding some custom handling of anim data when
there is a liboverride operation defined on the `animation_data` RNA
property itself.

It then behaves as if everything that is overridable in the existing
liboverride was defined as overrides (and therefore kept), while
everything else is replaced by the reference animdata:
* Action and temp action are kept.
* Settings (extend mode, etc.) are kept.
* Active NLA track and strip are kept, and tracks and strips from the
  liboverride are added at the end of the list of these from the
  reference data.

Note that this behavior is only expected to happen once, on the first
call to 'apply overrides' after anim data has been added to the reference
linked ID. After that, since both IDs have animdata, there should be no
liboverride property defined for the `animation_data` property itself,
but only for paths leading inside that animdata struct.

Implements #110067.
2023-08-15 16:05:25 +02:00
Bastien Montagne
257f21d494 Cleanup: Move Compositor versioning code from Scene's 'lib_link' to actual versioning code.
Not sure when that versioning was added, but nowadays there are the
'after_linking` versioning handlers for that kind of case.
2023-08-15 15:54:21 +02:00
Jeroen Bakker
616e0c8c1d Vulkan: Set Geometry Shader Capability
Vulkan already used geometry stages, but it wasn't set as backend
capability. This resulted that the shader builder didn't validate
shaders that uses geometry stages.

Pull Request: https://projects.blender.org/blender/blender/pulls/111139
2023-08-15 15:53:56 +02:00
Jeroen Bakker
d20f26aeb6 Fix: Memory Reserve Issue in Vulkan/Std140
This PR solves a memory reserve issue when a nvec3 was followed by
a int, bool, float.

Also adds a debug_print method to the push constants for checking
the structure against data in renderdoc.

Pull Request: https://projects.blender.org/blender/blender/pulls/111109
2023-08-15 14:16:26 +02:00
Jeroen Bakker
ab3ae2be4d Fix: Vulkan Use Resource After Free
When immediate mode is used with a temp texture the
draw command was executed after the texture was freed.

This PR ensures that the draw command is executed before
the texture is freed.

Pull Request: https://projects.blender.org/blender/blender/pulls/111111
2023-08-15 14:15:46 +02:00
Jeroen Bakker
dd4ab50065 GPU: Add Dummy Backend For Unsupported Platforms
With the introduction of metal and vulkan we use a different
GPU backend selection which broke the dialog box for unsupported
platforms.

Blender asserted and segfaulted before the dialog was being shown
to the user.

This patch solves this by introducing a dummy GPU backend in case no
GPU backend was supported by OpenGL, Metal and Vulkan Backend.

It also adds the showMessageBox to GHOST_SystemCocoa.

Related to #110335

Pull Request: https://projects.blender.org/blender/blender/pulls/110919
2023-08-15 14:15:12 +02:00
Bastien Montagne
4b98c0aa24 Cleanup: Remove 'read_data' code from Scene's paint 'link_lib' code.
Changes to internal private data of an ID has _nothing_ to do into its
'lib_link' reading code (unless in the extremely rare case where it
would have hard dependency on its ID having valid ID pointers).

In that case, `BKE_paint_runtime_init` was already called in
`BKE_paint_blend_read_data` anyway, so the only actual change was
setting `p->paint_cursor`... *sigh*
2023-08-15 12:02:37 +02:00
Jeroen Bakker
b3ca211bf4 Cleanup: Code formatting 2023-08-15 07:43:03 +02:00
Clément Foucault
dd9a92785a Metal: Fix incorrect texture 2D array read
Authored by Apple: Michael Parkin-White
2023-08-14 23:32:44 +02:00
Michael Kowalski
ccbb185d39 USD import: improve unsupported type warning.
Now including the USD type name in the warning for
unsupported attribute types.
2023-08-14 15:51:00 -04:00
Michael Kowalski
9a084d7c69 USD import: remove unused variable.
Removed unused USDMeshReader::has_uvs_ member.
This fixes Mac build warnings.
2023-08-14 14:51:17 -04:00
Michael Kowalski
4e41acc0d3 Fix #110950: USD import: Crash calling import_asset().
Fixed logic error causing BLI_path_abs() to be called with
null basepath.

Pull Request: https://projects.blender.org/blender/blender/pulls/111119
2023-08-14 19:56:22 +02:00
Bastien Montagne
e2a5846d56 Fix (unreported) improper handling of camera's baground image IDs in foreach_id callback.
`foreach_id` callbacks should not decide whether a given ID pointers
should be processed or not (unless maybe some extremely specific cases).

Even if an ID pointer is not currently 'used', it still needs to
increment its ID user count, be remapped to a new pointer, etc. etc.
2023-08-14 18:17:13 +02:00
Falk David
2661747138 Cleanup: GPv3: Move inline Drawing methods
Moves the `blender::bke::greasepencil::Drawing` methods into the
`namespace blender::bke::greasepencil`.
2023-08-14 17:47:12 +02:00
Falk David
ba574097b8 GPv3: Python: Rename groups to layer_groups
The term `groups` is a bit too ambigous and inconsistent with the rest
of the UI.
2023-08-14 17:47:12 +02:00
Falk David
310ccbdc33 GPv3: Initial outliner support
This PR adds support for displaying the content of the GPv3 object in the outliner.

* Displays the grease pencil data, layers and layer groups.
* Data and layer groups have the total layer count displayed next to them. Layer groups also have hierarchy lines.
* Active layer is highlighted and can be changed by clicking on a layer.
* The visibility of layers and layer groups can be toggled by clicking the eye icon.

Note: The icon for layer groups is temporary.

Pull Request: https://projects.blender.org/blender/blender/pulls/111105
2023-08-14 17:40:18 +02:00
Bastien Montagne
7ddea7e90a Cleanup/Fix: Move 'security' check on constraints 'data' into 'read_data' code.
Having this check is likely no more meaningful (it seems to have been
added ages ago), but keeping it around does not hurt either. And it
could avoid crashes in some file corruption cases e.g.

However, having it in 'lib_link' code of constraints is useless for
sure, since that data pointer may have already been accessed in the
'read_data' one. And of course, logically it belongs to 'read_data'
anyway, since it's related (and only affects) private local data, not
pointers to other IDs...

No behavioral change expected here.
2023-08-14 17:28:08 +02:00
Julian Eisel
5c2c95f80d Outliner: Reword warnings when element renaming is not possible
- Avoid the term "cannot", since that sounds like Blender is unable to
  perform the renaming.
- Sequencer names can be modified, just not from the Outliner. Note that
  in the warning.
- Don't use the term "please". We don't add this usually as it's
  unnecessary and can come across demanding.
- The term "master collection" is not used in the UI, should be "scene
  collection". But the warning didn't add much info, so simply give it
  the same generic warning like other such grouping items.
2023-08-14 17:22:05 +02:00
Julian Eisel
99a0ddd4a1 Outliner: Show same warning for all fixed name tree element types
Attempting to rename certain tree elements that have a non-editable
name would display a warning message in some cases, and nothing in
others. The distinction didn't really make sense, it was arbitrary.
Show the same warning for all such cases.
2023-08-14 17:09:38 +02:00
Almaz-Shinbay
e628b5ffe5 Cleanup: remove unnecessary constraint code in pose base expand()
Removes unnecessary lines, which are handled already by `TreeElementConstraintBase` and `TreeElementConstraint` constructors (see 02969de155), in `TreeElementPoseBase::expand()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/111118
2023-08-14 17:07:00 +02:00
Guillermo
391c2ea21c Fix #109081: Ensure NLA swap strips do not overlap each other.
When swapping strips, if the strips overlapped after the swap, one
of them would get deleted.  We now check if they would overlap
ahead of time, and simply abort the swap instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/109980
2023-08-14 17:06:26 +02:00
Bastien Montagne
695995d7cb Refactor: Move 'local data' liboverride flag clearing from 'lib_link' to 'read_data' code.
There is no reason to do that in the 'lib_link' stage of blendfile
reading, whether the owner ID is linked or local is already known info
at the 'read_data' stage of the process. And it is more logical to do
that in code affecting internal private data of an ID, rather than in
code handling updates of it ID pointers.

Note that the camera's baground image case was already handled in the
'read_data' stage.

No behavioral change expected here.
2023-08-14 16:45:18 +02:00