Commit Graph

21018 Commits

Author SHA1 Message Date
Julian Eisel 7150f919d3 Cleanup: Remove unused headers in asset files
Also move system includes first, like we have it elsewhere in Blender.
2021-11-01 13:21:07 +01:00
Sergey Sharybin 9111ea78ac Localize image mutex lock into runtime field of Image datablock
Allows to avoid a global lock being held while reading files from disk,
solving performance issues when Cycles needs to read a lot of packed
images.

Simple test file F11597666

Differential Revision: https://developer.blender.org/D13032
2021-11-01 12:47:03 +01:00
Jacques Lucke a96b2f39b8 Geometry Nodes: improve check if object has geometry set instances
The improves playback speed in my instance heavy scene from ~3.7 fps to ~3.9 fps.
2021-11-01 12:00:41 +01:00
Campbell Barton 1e749d0602 Cleanup: spelling, use C comments 2021-11-01 14:00:58 +11:00
Campbell Barton b99d6e1bed Fix errors in BKE_appdir_font_folder_default
- Missing NULL check for the HOME environment variable.
- The user preference path was written to even when the
  path didn't exist.
2021-11-01 13:43:35 +11:00
Campbell Barton e2937ff24f Merge branch 'blender-v3.0-release' 2021-11-01 13:15:10 +11:00
Campbell Barton a0633e2484 Fix crash when "HOME" environment variable isn't defined
Accessing the default directory in the file selector
would crash if HOME was undefined.

Add BKE_appdir_folder_default_or_root which never returns NULL.
2021-11-01 13:11:48 +11:00
Harley Acheson 02a9377da0 UI: Default Fonts Folder for Mac and Linux
Initial defaults for userdef->fontdir for Mac and Linux.

See D12802 for more details.

Differential Revision: https://developer.blender.org/D12802

Reviewed by Campbell Barton
2021-10-29 17:15:22 -07:00
Bastien Montagne e1db6dc11b Fix crash on undo after recent lib_query refactor.
Forgot that scene uses part of its ID looping code for specific undo
handling.

Caused by rBe3b2f0fd6ff9.
2021-10-29 12:54:32 +02:00
Bastien Montagne c8c53ceecc LibQuery: Remove last 'bool returns' from public API.
Those were used in a very few places to detect whether iteration should
be stopped or not, but one can use `BKE_lib_query_foreachid_iter_stop`
now for that.

Also fix early break handling in embedded IDs processing.

Fix T90922: Fix return policy inconsistency in `scene_foreach_id`.
2021-10-29 11:32:26 +02:00
Bastien Montagne 259731909c LibQuery: Fix potential memleak in recursive case.
In case `library_foreach_ID_link` would return early in recursive
process, it would not properly free its utils data.

Also add proper iteration break in case some sub-calls requested it.

Finally, make this function return a boolean to know whether iteration
should be stopped or not (will be used in future commit to fix this
handling in embedded IDs case).

Part of T90922: Fix return policy inconsistency in `scene_foreach_id`.
2021-10-29 11:32:26 +02:00
Bastien Montagne e3b2f0fd6f LibQuery: Add macro to help break looping when requested.
The new `BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL` execute the given
statement and then check status of `LibraryForeachIDData` data, and
return in case stop of iteration is requested.

This is very similar to the other `BKE_LIB_FOREACHID_PROCESS_` existing
macros, and allows us to properly break iteration when a sub-function
has requested it.

Part of T90922: Fix return policy inconsistency in `scene_foreach_id`.
2021-10-29 11:32:26 +02:00
Bastien Montagne 51c1c1cd93 Fix potential early-return in WM foreach_id process.
Add a function to check if iteration over ID usages should stop (using
internal `IDWALK_STOP` status flag).

Use it in `BKE_LIB_FOREACHID_PROCESS_` macros, and in
`window_manager_foreach_id` to handle properly the active workspace case
(previous code could skip the call to `BKE_workspace_active_set` in case
iteration over ID usages was stopped by callback on that specific ID
usage).

Part of T90922: Fix return policy inconsistency in `scene_foreach_id`.
2021-10-29 11:32:26 +02:00
Bastien Montagne eae59645de Cleanup: Add some comments to some sub-function of `foreach_id` process. 2021-10-29 11:32:26 +02:00
Bastien Montagne 43bc494892 IDManagement: Remove deprecated `BKE_libblock_relink_to_newid` usages.
Move all usages to new `BKE_libblock_relink_to_newid_new`, and rename
that one to `BKE_libblock_relink_to_newid`.

Fix T91413.
2021-10-29 10:45:48 +02:00
Jacques Lucke 1688cb27cd Merge branch 'blender-v3.0-release' 2021-10-29 09:49:48 +02:00
Jacques Lucke cf771807b7 Geometry Nodes: do cache invalidation after writing attributes
This is a better and more general fix for T92511 and T92508 than
the ones that I committed before.

Previously, we tagged caches dirty when first accessing attributes.
This led to incorrect caches when under some circumstances. Now
cache invalidation is part of `OutputAttribute.save()`.

A nice side benefit of this change is that it may make things more
efficient in some cases, because we don't invalidate caches when
they don't have to be invalidated.

Differential Revision: https://developer.blender.org/D13009
2021-10-29 09:28:31 +02:00
Campbell Barton 8eb10de739 Merge branch 'blender-v3.0-release' 2021-10-29 10:53:39 +11:00
Hans Goudey b43077ba3a Fix T92552: Spline evaluation with all points at the origin
In this case, the uniform index sampling loop would fail to assign any
data to the samples, so fill the rest with the largest value possible,
corresponding to the end of the spline. Animation Nodes has the same
fix for this case.
2021-10-28 18:23:55 -05:00
Bastien Montagne 5f1107ffaf Merge branch 'blender-v3.0-release' 2021-10-28 12:01:01 +02:00
Bastien Montagne aebb3d3062 Fix (unreported) potential issue in new `BKE_libblock_relink_to_newid_new`
Remapping code could call collection resync code while processing
remapping, which is a good way to crash by accessing no-more-valid
pointers.

Similar issue as with liboverrides resync, fixed the same way by
preventing any collection resync until whole remapping has been done.

This was probably not an issue in practice in current code, since this
is only used by append code currently, which should not affect
layers/collections in current scene yet.
2021-10-28 11:57:20 +02:00
Dalai Felinto bfd2921d38 Revert "Blender 3.0 bcon3 (beta)"
This reverts commit f7a3450e63.
2021-10-27 18:44:28 +02:00
Dalai Felinto 17efd14682 Merge branch 'blender-v3.0-release' 2021-10-27 18:43:18 +02:00
Dalai Felinto f7a3450e63 Blender 3.0 bcon3 (beta) 2021-10-27 18:41:31 +02:00
Dalai Felinto dab3591588 Blender 3.1 bcon1 - alpha
Bump the version number for the new release cycle.
2021-10-27 18:40:49 +02:00
Dalai Felinto f0a37dc31c Revert "Blender 3.1 bcon1 - alpha"
This reverts commit 7b9e3534cf.

This was supposed to go to master, not the 3.0 branch.
2021-10-27 18:40:02 +02:00
Dalai Felinto 7b9e3534cf Blender 3.1 bcon1 - alpha
Bump the version number for the new release cycle.
2021-10-27 18:38:22 +02:00
Pablo Vazquez bfec984cf8 UI: Theme refresh for Blender v3.0
{F11548100, size=full}

To celebrate the beginning of a new series, it feels like the right time to
give the theme a fresh look while improving on what already works.

The aim of this refresh is to keep a familiar look but with polishing touches
here and there. Like new paint on the walls of your well known house.

The theme for Blender 2.8 was well received but presented a few flaws.

* Transparency on menus and tooltips reduce readability
* Mismatch on certain colors, especially outlines of connected widgets
* Active/open menus highlight was not prominent enough
* Header background mismatch in some editors

At the same time we can make use of new features in 3.0:

* Make panels look like panels again (like in v2.3!)
* Make use of roundness in more widgets
* Since nodes are no longer hard-coded to be transparent, tweak opacity and saturation
* Tweak colors for the new dot grid

This update does not include:

* Meshes in edit mode to match greenish object-data color. This needs tweaks in the code to improve contrast.
* A copy of the Blender 2.8x legacy theme. This could be added to the community themes (shouldn't cost much maintenance, I hope)

There will be certainly small tweaks to do here and there, I've been working using this theme
for months but there can be areas that are missing update. The overall style is presented here.

This commit bumps the file subversion.

Reviewed By: #user_interface, Severin

Differential Revision: https://developer.blender.org/D13008
2021-10-27 18:29:18 +02:00
Jacques Lucke 0d6f2cb303 Cleanup: remove unused function declaration 2021-10-27 15:57:20 +02:00
Jacques Lucke 18b6f0d0f1 Fix T92264: incorrect field inferencing when muting link between reroutes
Previously, muted links were just ignored considered by field inferencing.
Now muted links behave like normal links in the inferencing process.
2021-10-27 12:43:04 +02:00
Jacques Lucke c06a86f99f Fix T92328: crash during field inferencing when there is a link cycle
The toposort did not handle link cycles which it should.
2021-10-27 12:29:59 +02:00
Jacques Lucke 8b15b06b20 Fix: missing cache invalidation when there is only one spline
This fixes T92511, but there is still the more general problem
described in T92508.
2021-10-27 11:02:49 +02:00
Bastien Montagne 16e1b18dd8 Cleanup: Rename `scene.c`'s `FOREACHID_PROCESS` macro to `FOREACHID_PROCESS_IDSUPER`.
Follow-up of rBf11ed418e5fa.
2021-10-27 09:15:21 +02:00
Campbell Barton a3b785bc08 Cleanup: clang-format, clang-tidy, spelling 2021-10-27 15:55:36 +11:00
Germano Cavalcante 3e3ff1a464 Revert "Revert "Eevee: support accessing custom mesh attributes""
This reverts commit e7fedf6dba.

And also fix a compilation issue on windows.

Differential Revision: https://developer.blender.org/D12969
2021-10-26 18:23:59 -03:00
Ray Molenkamp e7fedf6dba Revert "Eevee: support accessing custom mesh attributes"
This reverts commit 03013d19d1.

This commit broke the windows build pretty badly and I don't
feel confident landing the fix for this without review.

Will post a possible fix in D12969 and we'll take it from there.
2021-10-26 14:49:22 -06:00
Hans Goudey 7d3d09b69c Geometry Nodes: Get and set nodes for ID attribute
These nodes allow accessing and changing the stable/random ID used
for motion blur with instances and stable randomness.

Since rB40c3b8836b7a, the stable ID is a built-in attribute, so to be
consistent and allow changing it in the node tree like other built-in
attributes, it has get and set nodes.
2021-10-26 15:40:57 -05:00
Julian Eisel 0cf9794c7e Assets: Rename "Default" asset library to "User Library"
Feedback was that "Default" is a bit of a weird name, so switching it to "User
Library". Added versioning code which won't be entirely bullet proof (e.g. will
also rename libraries named "Default" by the user), but it doesn't have to be.

Addresses T90298.
2021-10-26 21:01:44 +02:00
Jacques Lucke 0bfae1b120 Geometry Nodes: geometry component type warning system
Previously, every node had to create warnings for unsupported input
geometry manually. Now this is automated. Nodes just have to specify
the geometry types they support in the node declaration.

Differential Revision: https://developer.blender.org/D12899
2021-10-26 20:00:10 +02:00
Hans Goudey be3e09ecec Fix: Inverted normal for one curve to mesh cap 2021-10-26 12:59:46 -05:00
Hans Goudey 9fa304bf13 Geometry Nodes: Only create instance IDs when they exist
Instance IDs serve no purpose for rendering when they aren't stable from
one frame to the next, and if the index is used in the end anyway, there
is no point in storing a vector of IDs and copying it around.

This commit exposes the `id` attribute on the instances component,
makes it optional-- only generated by default with the distribute points
on faces node.

Since the string to curves node only added the index as each instance's
ID, I removed it. This means that it would be necessary to add the ID
data manually if the initial index actually helps (when deleting only
certain characters, for example).

Differential Revision: https://developer.blender.org/D12980
2021-10-26 12:50:39 -05:00
Kévin Dietrich 03013d19d1 Eevee: support accessing custom mesh attributes
This adds generic attribute rendering support for meshes for Eevee and
Workbench. Each attribute is stored inside of the `MeshBufferList` as a
separate VBO, with a maximum of `GPU_MAX_ATTR` VBOs for consistency with
the GPU shader compilation code.

Since `DRW_MeshCDMask` is not general enough, attribute requests are
stored in new `DRW_AttributeRequest` structures inside of a convenient
`DRW_MeshAttributes` structure. The latter is used in a similar manner
as `DRW_MeshCDMask`, with the `MeshBatchCache` keeping track of needed,
used, and used-over-time attributes. Again, `GPU_MAX_ATTR` is used in
`DRW_MeshAttributes` to prevent too many attributes being used.

To ensure thread-safety when updating the used attributes list, a mutex
is added to the Mesh runtime. This mutex will also be used in the future
for other things when other part of the rendre pre-processing are multi-threaded.

`GPU_BATCH_VBO_MAX_LEN` was increased to 16 in order to accommodate for
this design.

Since `CD_PROP_COLOR` are a valid attribute type, sculpt vertex colors
are now handled using this system to avoid to complicate things. In the
future regular vertex colors will also use this. From this change, bit
operations for DRW_MeshCDMask are now using uint32_t (to match the
representation now used by the compiler).

Due to the difference in behavior for implicit type conversion for scalar types
between OpenGL and what users expect (a scalar `s` is converted to
`vec4(s, 0, 0, 1)` by OpenGL, vs. `vec4(s, s, s, 1)` in Blender's various node graphs) ,
all scalar types are using a float3 internally for now, which increases memory usage.
This will be resolved during or after the EEVEE rewrite as properly handling
this involves much deeper changes.

Ref T85075

Reviewed By: fclem

Maniphest Tasks: T85075

Differential Revision: https://developer.blender.org/D12969
2021-10-26 18:29:30 +02:00
Hans Goudey 8ddfdfd2b2 Geometry Nodes: Handle multiple grids in the volume to mesh node
In future use cases, a volume can contain many grids that represent the
density information. In this case, it's better if the volume to mesh node
creates a mesh based on all of the grids in the volume.

This is also a benefit to share-ability, since one doesn't have to
specify the grid name in the node. Instead, in the future we can have
a way to split particular grids into separate volumes, if only one
grid should be considered.

The code changes are relatively simple:
 - Move the old volume to mesh node to the legacy folder.
 - Run the volume to mesh node on all instance geometry, like elsewhere.
 - Make the blenkernel's volume to mesh API a bit more specific.

Differential Revision: https://developer.blender.org/D12997
2021-10-26 11:25:44 -05:00
Brecht Van Lommel a90cb41cb9 Cleanup: clang-format 2021-10-26 16:35:26 +02:00
Jacques Lucke fd477e738d Geometry Nodes: remove reference to anonymous attributes in tooltips
This changes socket inspection for fields according to T91881.

Differential Revision: https://developer.blender.org/D13006
2021-10-26 15:32:01 +02:00
Bastien Montagne f11ed418e5 Cleanup: LibQuery: Rename `BKE_LIB_FOREACHID_PROCESS` to `BKE_LIB_FOREACHID_PROCESS_IDSUPER`.
More in-line name with the rest of that macro-based API, especially
since this will be extended in the future.
2021-10-26 10:40:36 +02:00
Bastien Montagne fe68b54edb Cleanup: `else` after `continue`. 2021-10-26 10:28:52 +02:00
Bastien Montagne 9ba22bd1f7 Fix crash in liboverride/pointcache handling code after recent changes.
In some cases code would try to access NULL pointer.

Reported by @dfelinto, thanks.
2021-10-26 10:13:44 +02:00
Bastien Montagne ee743204b0 Cleanup: build warnings.
`NULL` instead of `nullptr` in cpp code, and `else` statements after
returns.
2021-10-26 09:52:08 +02:00
Hans Goudey e463d2c16f UI: Change node editor grid into a dot grid
This patch makes the background grid of the node editor a grid of dots
instead of lines. This makes the background look a bit more subtle and
reduces visual complexity. The dots are meant to provide a reference
when panning and zooming. Based on the design of @pablovazquez, and
a patch originally authored by @fabian_schempp.

The "Grid Levels" controls how many levels of dots are drawn. As the
editor zooms in, the higher levels of dots fade in, making them closer
together visually. The zoom factor at which each grid starts and ends
fading in is controllable in the code, and could be tweaked further
in the future. The new default value is 7, out of a range from 0 to 9.

Differential Revision: https://developer.blender.org/D10345
2021-10-25 21:50:05 -05:00