Commit Graph

87870 Commits

Author SHA1 Message Date
Sybren A. Stüvel b6c3b41d41 Cleanup: use nullptr in C++ 2021-10-19 18:05:02 +02:00
Hans Goudey 7a61916717 Fix T92345: Crash with only pointcloud in attribute transfer node
The distances array is only allocated if there are mesh distances to
compare to, so it is empty when there is only a point cloud.
2021-10-19 10:42:14 -05:00
Sybren A. Stüvel a7ade57e11 Asset Catalogs: allow creating catalog in unsaved blend file
Allow creating a new asset catalog in a yet-to-be-saved blend file. The
problem was caused by `AssetLibrary` not having an `AssetCatalogService`
right after creation; only after loading data from disk was this
instance created. It's now always there.
2021-10-19 16:55:46 +02:00
Sybren A. Stüvel 79a88b5e91 Fix compilation error about undefined `PATH_MAX` 2021-10-19 16:47:17 +02:00
Philipp Oeser 57f1379104 Fix T92265: Outliner crash clicking override warning buttons
`outliner_draw_overrides_buts` uses `uiDefIconBlockBut` but doing so
without defining a function callback to actually build a block.
This will make the button go down the route of spawning a popup, but
without a menu. Crash then happens later accesing the (missing) menu in
`ui_handler_region_menu`.

So while we could dive into making this usage failsafe (carefully
checking `BUTTON_STATE_MENU_OPEN` in combination with
`uiHandleButtonData->menu` being NULL all over), but it seems much more
straightforward to just use `uiDefIconBut` (instead of
`uiDefIconBlockBut`) since this Override Warning buttons seem not to
intend spawning a menu anyways?

Maniphest Tasks: T92265

Differential Revision: https://developer.blender.org/D12917
2021-10-19 16:42:00 +02:00
Bastien Montagne b3b7319de7 Fix T92224: Refactor of append code unexpectedly changed behavior with 'localize all' off.
In 2.93 and before, when appending wityh 'localize all' off, all linked
IDs (including indirectly linked ones) from initial library would be
made local.
In 3.0, after refactor from rB3be5ce4aad5e, only directly linked IDs
(i.e. user-selected IDs) would be made local.

This change was not intentional (result of confusing code and naming in
previous implementation), and old behavior is used in some workflows to
control which data is kept linked and which data is made local.

This commit revert to 2.93 behavior.

NOTE: there is still an (extreme) corner case where behavior is
different between 2.93 and 3.0:
If you append (at the same time) object A from LibA.blend, and object B
from LibB.blend, and object B uses somehow a material from LibA.blend:
* In 2.93, that material would have been made local (because it belonged
  to one of the 'initial' libraries, even though not the initial lib of
  object B).
* In 3.0, this material will remain linked, since from object B
  persective it comes from a different library.
2021-10-19 16:26:26 +02:00
Sybren A. Stüvel 1c5722ba07 Fix T91197: marking assets from Python may crash
When using `asset_mark` function from a Python script and afterwards
updating the preview image, a crash might happen. The preview image is
generated by the `asset_mark` function. This may happen on a background
thread, introducing potential synchronization issues.

This patch fixes this by separating the preview generation
`ID.asset_generate_preview` from the mark as asset `ID.asset_mark`.

Note: this separation of "mark as asset" and "generate preview" also
applies to the `ED_asset_mark_id()` C function; if it is desired to have
previews rendered after marking as asset, a call to
`ED_asset_generate_preview()` is now also required.

Reviewed By: sybren

Maniphest Tasks: T91197

Differential Revision: https://developer.blender.org/D12922
2021-10-19 16:17:04 +02:00
Hans Goudey 0a6cf3ed0c Geometry Nodes: Fields version of the raycast node
This patch includes an updated version of the raycast node that uses
fields instead of attributes for inputs instead of outputs. This makes
the node's UI much clearer. It should be faster too, since the
evaluation system for fields provides multi-threading.

The source position replaces the input geometry (since this node is
evaluated in the context of a geometry like the other field nodes).

Thanks to @guitargeek for an initial version of this patch.

Differential Revision: https://developer.blender.org/D12638
2021-10-19 09:01:39 -05:00
Sybren A. Stüvel 9a1d75e0b9 Asset Library Service: make insensitive to trailing slashes
Make `AssetLibraryService::get_asset_library_on_disk(path)` insensitive
to trailing slashes; i.e. `get_asset_library_on_disk("/path")` and
`get_asset_library_on_disk("/path/¨)` will now return the same
`AssetLibrary*`.
2021-10-19 15:53:11 +02:00
Sybren A. Stüvel a7075a30e2 BKE_callback_remove: prevent crash on Blender exit
`BKE_callback_remove` now checks whether the callback actually is known,
before trying to remove it.

`BKE_blender_atexit()` runs after `BKE_callback_global_finalize()`. When
an at-exit callback tried to unregister its BKE callbacks, these would
already be unregistered, causing a crash of Blender when exiting,
2021-10-19 15:53:11 +02:00
Hans Goudey 219058c213 Geometry Nodes: Remove implicit realizing and conversion
This commit removes the implicit conversion from points to a mesh
that used to happen before the next modifier. It also removes the
implicit realizing of instances that happened before another modifier.

Now we have specific nodes for both of these operations, the
implicit conversions make less sense, and implicit instance
realizing has already been removed in other nodes.

This adds another geometry nodes modifier before modifiers that would
have realized instances implicitly before. Currently adding another
data-block during versioning after linking means that an assert needs
to be changed. That should be made unnecessary by T92333.

Differential Revision: https://developer.blender.org/D12722
2021-10-19 08:39:10 -05:00
Brecht Van Lommel 7fa6794037 Fix failing view layer tests after recent changes to naming convention 2021-10-19 14:55:06 +02:00
Brecht Van Lommel 9e9d003a82 Render: change view layer name convention to ViewLayer_001 to avoid OpenEXR issues
Some compositing applications do not support spaces and dots in layer names, and change
these to other symbols on import. This causes various compatibility issues, including
with Cryptomatte metadata. While technically those could be considered bugs in the
Cryptomatte implementation of other software, where they are not properly accounting for
that layer renaming, it's not ideal.

The OpenEXR channel naming convention is "layer.pass.channel". We get away with dots in
the layer name since we parse this from right to left, but it's a weak assumption.

Now we don't forbid using spaces or dots, and existing files are unchanged. But at
least by default names will be compatible, and hopefully other software catches up in
time to support more flexible layer names.

Ref T68924
2021-10-19 14:30:45 +02:00
Brecht Van Lommel 8e8932c8ff Render: use "_" as delimiter in AOV names to avoid issues with OpenEXR
OpenEXR uses "." to separate layers/passes/channels, so using AOV.001 is
a problem. Other applications will not be able to parse it correctly.

Default to AOV_001 instead, and don't allow using dots in AOV names.

Fixes T89991
Ref T73266
Ref D12871
2021-10-19 12:59:05 +02:00
Brecht Van Lommel abc3128011 Fix T85779: Cycles not using all threads when using OpenImageDenoise
The thread affinity setting in OIDN can break multithreading on some CPUs.
While this leads to somewhat worse performance on CPUs that do work correctly,
it's better than having some CPUs use only half the cores.
2021-10-19 11:39:11 +02:00
Campbell Barton 9c8255d486 Cleanup: use 'e' prefix for enum types 2021-10-19 18:35:39 +11:00
Hans Goudey a76bb1a277 BLI: Support removing keys from a set during iteration
This adds the ability to mark slots as removed while iterating through
a mutable set.

Differential Revision: https://developer.blender.org/D12867
2021-10-18 22:15:52 -05:00
Campbell Barton da949c3574 Fix crash on file load in unregistering bke::AssetLibraryService
Use mutable iterator to support callbacks removing themselves.
2021-10-19 13:22:36 +11:00
Campbell Barton c4f733a76c Fix memory leak in sample tool
When there was no image buffer, sample leaked memory.
2021-10-19 12:50:07 +11:00
Campbell Barton b74f2c7d74 Fix image cache margin calculation
This margin was inconsistently calculated: only taking the
visible region and interface scale into account in some cases.
2021-10-19 12:50:07 +11:00
Hans Goudey a3457704fb Geometry Nodes: De-duplicate index input nodes during evaluation
We do this in other nodes to reduce overhead of using the same node more
than once. I don't think it will make a difference with index nodes
currently, but at least it's consistent.
2021-10-18 20:13:37 -05:00
Ray Molenkamp 482c5f0014 Fix: Build error with MSVC
noise.cc uses std::min and std::max without
including the algorithm header required.

Newer MSVC versions and GCC implicitly include
it somewhere, which isn't something we should
count on. Best to include what you use.
2021-10-18 19:01:18 -06:00
Erik Abrahamsson c1d138dd92 Fix T91979: Don't mark string nodes as supporting fields
Even though these nodes do support fields internally, there are no
input string sockets that support fields currently, so removing
the diamond sockets for now helps avoid confusion.

Differential Revision: https://developer.blender.org/D12828
2021-10-18 19:08:02 -05:00
Germano Cavalcante d7b231baa8 Cleanup: remove unused member and rearrange function 2021-10-18 18:38:42 -03:00
Richard Antalik 3a898db363 VSE: Improve thumbnail loading speed
Split thumbnail job in 2 passes. First pass will render visible images
and second part renders set of "guaranteed" equally spaced images.

When viewing larger amount of strips, it is likely that only 1 or 2
images will be rendered in first pass, while in second pass it is up to
30 images.

This results (seemingly) in 3x better performance, but zooming before
set of guaranteed images is done will be slightly more inaccurate.
2021-10-18 23:26:16 +02:00
Richard Antalik 06356115b7 VSE: Don't draw thumbnails while rendering
During rendering VSE cache is invalidated, so thumbnails would be
removed and thumbnail job would constantly restart.

Even if thumbnails would be preserved, resources should be dedicated
for rendering job.
2021-10-18 22:25:36 +02:00
Johnny Matthews 5f59bf0044 Geometry Nodes: Sort Children in Collection Info
When the 'Separate Children' option is selected, the children of
the selected collection are inserted into the geometry output
sorted alphabetically by name.

One item to note is that the rename function does not trigger a
depsgraph update. This means that the changes are not reflected
in the spreadsheet until another action triggers the update.

Differential Revision: https://developer.blender.org/D12907
2021-10-18 15:11:04 -05:00
Hans Goudey ec8a9a0d65 Cleanup: Remove unnecessary constructor argument
All attributes should be writeable, it is now only needed for the
legacy `normal` attribute on meshes.
2021-10-18 12:35:27 -05:00
Hans Goudey 9f895fbb97 Geometry Nodes: Optimize curve builtin attribute exists check
Calculating the number of points is overkill here, if there are many splines.
The `exists` check just needs to know if there are any points at all.
2021-10-18 12:31:01 -05:00
Hans Goudey 9a8badc1e4 Cleanup: Rearrange code, rename function
Move the static functions higher in the file so they are usabl
for an upcoming patch, and make it use clearer names instead
of overloading a function name.
2021-10-18 12:22:44 -05:00
Philipp Oeser 3a25501143 Fix T92314: Auto naming of the Vertex Group doesn't work for Grease
Pencil

Not naming the auto-generated vertexgroup after the selected bone was
just confusing (since the group would not have an effect), so now use
similar code that is used for meshes for greasepencil as well.

Maniphest Tasks: T92314

Differential Revision: https://developer.blender.org/D12906
2021-10-18 19:11:19 +02:00
Germano Cavalcante 44c3bb729b Cleanup: use a common prefix in static functions
This helps identify where the function came from.
2021-10-18 13:43:44 -03:00
Germano Cavalcante 2944f3e92b Fix 1 frame delayed orientation in Placement Gizmo
Error in {rB69d6222481b4}
2021-10-18 13:32:56 -03:00
Sybren A. Stüvel 46fe43feca Fix failing `AssetLibraryService` test by removing test code
Remove the code I had hoped to fix in rB3edae09e, the fix was unreliable.

No functional changes to Blender.
2021-10-18 17:29:24 +02:00
Hans Goudey 3cbe921899 Cleanup: Use simpler method to create attribute lookups
Instead of switch statements, make use of generic virtual arrays
so the code is shorter and easier to read.

Differential Revision: https://developer.blender.org/D12908
2021-10-18 10:08:57 -05:00
Philipp Oeser aef8ac7db8 Cleanup: clang format 2021-10-18 17:00:25 +02:00
Philipp Oeser 0071001879 Fix T92246: sculpt crash displaying statistics in certain situations
It seems possible to switch object selection (if `Lock Object Modes` is
turned off) and end up with an object that has a SculptSession but a
NULL PBVH.
(I was not able to repro from scratch, but file from the report was
clearly in that state).

This would crash in displaying scene statistics.

While there might be a deeper fix (making sure PBVH is available early
enough -- possibly using `BKE_sculpt_object_pbvh_ensure`,
`sculpt_update_object` or friends), there are also many checks in tools
for PBVH, so the situation seems to be somewhat vaild/expected also in
other places.
So to fix this, just check for a non-NULL PBVH, returning early
otherwise.
Note: this leaves us with displaying 0/0 Faces & Vertices in the borked
case until an operation takes place that updates the PBVH.

Maniphest Tasks: T92246

Differential Revision: https://developer.blender.org/D12904
2021-10-18 16:52:21 +02:00
Germano Cavalcante b246f81412 Fix T92311: Snap to faces in edit mode with x-ray enabled doesn't work
The `use_occlusion_test` parameter test was accidentally removed in
{rB91c33c8b9952}
2021-10-18 11:41:32 -03:00
Jacques Lucke dd689eeda4 Fix: dangling pointer caused use-after-free
The old code only worked when built-in nodes are only unregistered
at most once while Blender is running. However, this is not the case
when running certain unit tests such as `AbstractHierarchy*`
in `blender_test`.

Found by Sybren, thanks.
2021-10-18 16:19:42 +02:00
Pablo Vazquez ef7e21fd4a UI: Reduce vertical margin between panels
In an attempt to reduce scrolling. This can be re-visited if a kind of switch
between "compact" and "comfortable" UI size is implemented in the future.
2021-10-18 16:16:45 +02:00
Sybren A. Stüvel 3edae09eaa Asset Library Service: fix failing unit test
On GCC in release mode (and maybe also debug mode without ASAN enabled),
allocating an `AssetLibraryService` will reuse the space that should
have just been freed. This made a test fail, as it was testing that new
memory was allocated and not some old instance reused.

To ensure that the calls that should allocate a new block of memory
return a unique pointer, I added some dummy allocation to the test.

No functional changes to Blender
2021-10-18 15:48:06 +02:00
Charlie Jolly 729b2d026d Geometry Nodes: Add shader Musgrave texture node
Port shader node musgrave texture

Differential Revision: https://developer.blender.org/D12701
2021-10-18 14:24:14 +01:00
Jacques Lucke de6bf5d4d2 Nodes: support sharing node declarations between nodes
Previously, every node had its own declaration. This isn't ideal, because
it's often the case that all nodes of the same type have the same declaration.
That's the case for all nodes using declarations currently. It will not be true
for e.g. group nodes in the future.

Sharing node declarations between nodes makes it a bit more efficient.

Differential Revision: https://developer.blender.org/D12898
2021-10-18 15:22:34 +02:00
Clément Foucault e150f171d5 Fix T92250 EEVEE: Render crash with Motion Blur and Overscan
This was caused by `DRW_view_data_texture_list_size_validate` which now
delete everything from the render engine.

This might change in the future but for now we just avoid calling it from
the render loop (when using DRW_cache_restart).
2021-10-18 15:15:04 +02:00
Pablo Dobarro 765b1c6b53 Fix T79005: Vertex color conversion operators changing the colors
CD_PROP_COLOR vertex data is stored in scene linear while legacy vertex
colors are srgb, so both operators also need to do this conversion

Reviewed By: sergey

Maniphest Tasks: T79005

Differential Revision: https://developer.blender.org/D8320
2021-10-18 15:01:37 +02:00
Jan-Willem van Dronkelaar 4de0e2e771 Animation: Motion Paths Refresh All
Adds a button, Update All Paths, to the Motion Paths property tabs and
will always show. The operator goes through all visible objects and
updates their motion paths.

The current implementation has a subtle functional change. Calculating
or updating motion paths for armature objects (through the Object tab,
not Armature tab) now also updates the paths for its bones. We could
preserve the old behavior but it doesn't seem necessary. It seems more
likely that the animator wants to update both anyways.

Reviewed by: sybren

Maniphest Tasks: T83068

Differential Revision: https://developer.blender.org/D11667
2021-10-18 14:36:26 +02:00
Sybren A. Stüvel f9113c4be8 Assets: add global `bke::AssetLibraryService` class
Add `blender::bke::AssetLibraryService` class that acts like a
blendfile-scoped singleton. It's allocated upon the first call to
`BKE_asset_library_load` and destroyed in the LOAD-PRE handler.

The `AssetLibraryService` ensures that edits to asset catalogs are not
lost when the asset browser editor closes (or even reloads). Instead,
the `AssetLibrary` pointers it owns are kept around as long as the blend
file is open.

Reviewed By: Severin

Maniphest Tasks: T92151

Differential Revision: https://developer.blender.org/D12885
2021-10-18 14:21:41 +02:00
Johnny Matthews 1f51037676 Geometry Nodes: Endpoint Selection Nodes
The Endpoint Selection node allows for the Selection of an aribitrary
number of endpoints from each spline in a curve. The start and end
inputs are evaluated on the spline domain. The result is outputted
as a boolean field on the point domain.

Differential Revision: https://developer.blender.org/D12846
2021-10-18 06:45:16 -05:00
Jacques Lucke 6f76bcc12c Fix: missing use-attribute property in geometry nodes modifier
The property was missing when a group input changed from not
supporting fields to supporting fields.
2021-10-18 12:58:30 +02:00
Erik Abrahamsson f9fe755dba Nodes: add default value to string socket declaration
Differential Revision: https://developer.blender.org/D12758
2021-10-18 11:59:49 +02:00