1
1

Compare commits

...

1831 Commits

Author SHA1 Message Date
f240ac1673 Improve formating 2021-11-24 21:41:25 +01:00
a590474f4c Fix compilation & dependency depth 2021-11-24 20:09:36 +01:00
b2462b6f5c Make shaders sources from draw included in the dependency library. 2021-11-24 19:46:00 +01:00
21ee89c52f Fix compilation issues on MSVC and a bug in builder 2021-11-24 18:56:51 +01:00
2c95da88aa GPUShaderDependency: Initial Commit
This is a prototype to support `#include` directive inside glsl sources.
The sources are aggregated into a list before being translated to byte_array.
This list is used to generate a mapping between the filename and the
associated byte_array. For each byte_array, we search for any `#include`
and store the file to merge.

At runtime, for one input filename we concatenate all byte_arrays that
are needed following the include order and avoiding double include.

This is meant to evolve into a fully supported `#include` system.
2021-11-24 17:58:06 +01:00
7358a5aba2 GPUShaderDescriptor: Initial Commit
This is a first draft of what the Shader Descriptor system could be.

A shader descriptor provides a way to define shader structure, resources
and interfaces. This makes for a quick way to provide backend agnostic
binding informations while also making shader variations easy to declare.
2021-11-24 17:52:39 +01:00
9159295c3c Clang Tidy: ignore some passes that changed or were added in version 13
I get hundreds of clang-tidy errors without ignoring those passes right now.
To not forget about the passes, I added them to T78535.
2021-11-23 19:45:05 +01:00
62a04f7aa6 Cleanup: clang tidy
The parameter name was inconsistent with the declaration.
2021-11-23 19:38:22 +01:00
38a3819171 Merge branch 'blender-v3.0-release' 2021-11-23 19:04:44 +01:00
3844e9dbe7 Fix (unreported): unlinked group input is not logged in geometry nodes
Differential Revision: https://developer.blender.org/D13340
2021-11-23 19:03:16 +01:00
ea93e5df6c Asset: Merge asset library/list refresh operators
In rBdcdbaf89bd11, I introduced a new operator
(`file.asset_library_refresh()`) to handle Asset Browser refreshing more
separate from File Browser refreshing. However, there already was
`asset.asset_list_refresh()`, which at this point only works for asset
view templates, but was intended to cover the Asset Browser case in
future too. This would happen once the Asset Browser uses the asset list
design of the asset view template.

So rather than having two operators for refreshing asset library data,
have one that just handles both cases, until they converge into one.
This avoids changes to the Python API in future (deprecating/changing
operators).

Differential Revision: https://developer.blender.org/D13239
2021-11-23 18:57:25 +01:00
60befc8f02 Clean-up: Fix BLI_rect.h collision with windows.h
windows.h `#defines rct1` as a number which is
problematic if we include `BLI_rect.h` after
`windows.h` .

by renaming `rct1/2` to `rct_a/b` we side step
the collision and straighten up the naming with
the functions directly above it.
2021-11-23 10:51:09 -07:00
62b50c612f Cleanup: Else after return, other simplifications
`std::stringstream` already returns a `std::string`, and there is no
particular reason to use short here instead of int.
2021-11-23 12:49:45 -05:00
9e5aae4215 Asset: Merge asset library/list refresh operators
In rBdcdbaf89bd11, I introduced a new operator
(`file.asset_library_refresh()`) to handle Asset Browser refreshing more
separate from File Browser refreshing. However, there already was
`asset.asset_list_refresh()`, which at this point only works for asset
view templates, but was intended to cover the Asset Browser case in
future too. This would happen once the Asset Browser uses the asset list
design of the asset view template.

So rather than having two operators for refreshing asset library data,
have one that just handles both cases, until they converge into one.
This avoids changes to the Python API in future (deprecating/changing
operators).

Differential Revision: https://developer.blender.org/D13239
2021-11-23 18:40:31 +01:00
c09e8a3590 Merge branch 'blender-v3.0-release' 2021-11-23 18:35:56 +01:00
792badcfef Fix broken handling of constraints reordering with library overrides
Alternative to D13291 (description partially copied from there).

New drag & drop reordering code would call constraints reordering
operator with the generic context, and not the one from the panel's
layout. missing the "constraint" member which is mandatory for poll
function to properly deal with override vs. local constraints.

For this to work in a decent way, there needs to be some panel-wide
context that we can restore when executing callbacks outside of the
normal draw context. So similar to uiLayoutSetContextPointer() to set
context on a layout level, this introduces
UI_panel_context_pointer_set() for panel level context (this calls the
former for the current panel root layout as well).

Differential Revision: https://developer.blender.org/D13308
2021-11-23 18:34:51 +01:00
c0a2b21744 Merge branch 'blender-v3.0-release' 2021-11-23 18:04:28 +01:00
fb4851fbbc Fix: The bounding box gizmo breaks if transform pivot is set to cursor
The bounding box transform code assumed that the pivot would always be
the sequence object transform center.

Rework the code so that this assumption is true even if the general
transform pivot is set to be the 2D cursor.
2021-11-23 18:03:36 +01:00
b40e930ac7 Merge branch 'blender-v3.0-release' 2021-11-23 17:52:30 +01:00
cf266ecaa6 Geometry Nodes: fix attribute propagation in Delete Geometry node
Previously, attribute propagation did not work correctly in when only
deleting edges and faces (but not points). Face and face corner attributes
were propagated wrongly or not at all respectively.

In order to keep the patch relatively small for the release branch,
it does not include some small optimizations. These can be done in 3.1:
* Use a `Span<int>` instead of `IndexMask` to avoid creating an
  unnecessary `Vector<int64_t>`.
* Only prepare index mappings when there are actually attributes to
  propagate.

Differential Revision: https://developer.blender.org/D13338
2021-11-23 17:48:09 +01:00
e4986f92f3 Geometry Nodes: Node execution time overlay
Adds a new overlay called "Timings" to the Geometry Node editor.
This shows the node execution time in milliseconds above the node.
For group nodes and frames, the total time for all nodes inside
(recursively) is shown. Group output node shows the node tree total.
The code is prepared for easily adding new rows of information
to the box above the node in the future.

Differential Revision: https://developer.blender.org/D13256
2021-11-23 17:37:31 +01:00
fab39440e9 Cleanup: Simplify geometry node function names
With this commit, we no longer use the prefixes for every node type
function like `geo_node_translate_instances_`. They just added more
places to change when adding a new node, for no real benefit.

Differential Revision: https://developer.blender.org/D13337
2021-11-23 10:55:51 -05:00
a9eb4e6f59 Merge branch 'blender-v3.0-release' 2021-11-23 16:41:53 +01:00
a6b7f32112 Fix T93297: incorrect eevee motion blur with geometry instances
This disables motion blur for geometry instances in eevee, which did
not work correctly anyway. See code comment for more details.

Differential Revision: https://developer.blender.org/D13334
2021-11-23 16:40:21 +01:00
db450c9320 Merge branch 'blender-v3.0-release' 2021-11-23 16:38:30 +01:00
70424195a8 Cycles: Fix possible access to non-initialized light sample in volume
Happened in barbershop file where number of bounces to the light was
reached.

Differential Revision: https://developer.blender.org/D13336
2021-11-23 16:38:15 +01:00
71c80bd939 Merge branch 'blender-v3.0-release' 2021-11-23 16:32:13 +01:00
2cbb9d7a76 Fix T93322: Freestyle Sinus Displacement Division by Zero Crash
This happens if the Wavelength is set to 0.0f.

Not sure if we really need a do_version patch for old files, as an
alternative we could also force a slight offset in the
SinusDisplacementShader. This patch does not do either, just force a
positive range from now on.

Maniphest Tasks: T93322

Differential Revision: https://developer.blender.org/D13329
2021-11-23 16:29:37 +01:00
b716a771b4 Merge branch 'blender-v3.0-release' 2021-11-23 15:46:28 +01:00
Sayak Biswas
3bb8d173e7 Fix T93109: Cycles HIP missing check for correct driver version
21.Q4 is required, older version should not show devices in the preferences.
This adds a check for the file version of amdhip64.dll file during hipew
initialization.

Differential Revision: https://developer.blender.org/D13324
2021-11-23 15:45:37 +01:00
fca8eb0185 Cleanup: Suppress clang-tidy warning. 2021-11-23 15:41:28 +01:00
2c2b79191f Merge branch 'blender-v3.0-release' 2021-11-23 15:41:09 +01:00
1a7c32a0ab Fix T93320: Freestyle LineStyleModifier blend 'Minimum' error
This was just a typo in {rBb408d8af31c9}
Must be 'MINIMUM' (instead of 'MININUM').

Maniphest Tasks: T93320

Differential Revision: https://developer.blender.org/D13328
2021-11-23 15:38:52 +01:00
4b13dcaf02 Merge branch 'blender-v3.0-release' 2021-11-23 15:35:09 +01:00
ceb25cbeba Fix compilation warnings when building without OpenImageDenoiser
Reported by Sybren, thanks!
2021-11-23 15:34:54 +01:00
8897e0aa8f Fix add-on Preferences using the .blend file icon, not the Blender logo
Intention of the icon is to mark add-ons that are official/bundled.
Doesn't make much sense to use the .blend file icon for that. It's
arguable if the Blender logo should be used for this, but the file icon
is definitely the wrong choice.
2021-11-23 15:30:28 +01:00
5efddc4347 Fix add-on Preferences using the .blend file icon, not the Blender logo
Intention of the icon is to mark add-ons that are official/bundled.
Doesn't make much sense to use the .blend file icon for that. It's
arguable if the Blender logo should be used for this, but the file icon
is definitely the wrong choice.
2021-11-23 15:30:05 +01:00
1df8abff25 Geometry Nodes: add namespace for every file
This puts all static functions in geometry node files into a new
namespace. This allows using unity build which can improve
compile times significantly (P2578).

* The name space name is derived from the file name. That makes
  it possible to write some tooling that checks the names later on.
  The file name extension (`cc`) is added to the namespace name as
  well. This also possibly simplifies tooling but also makes it more
  obvious that this namespace is specific to a file.
* In the register function of every node, I added a namespace alias
  `namespace file_ns = blender::nodes::node_geo_*_cc;`. This avoids
  some duplication of the file name and may also simplify tooling,
  because this line is easy to detect. The name `file_ns` stands for "file
  namespace" and also indicates that this namespace corresponds to
  the current file. In the beginning I used `node_ns` but `file_ns` is more
  generic which may make it more suitable when we want to use unity
  builds outside of the nodes modules in the future.
* Some node files contain code that is actually shared between
  different nodes. For now I left that code in the `blender::nodes`
  namespace and moved it to the top of the file (couldn't move it to
  the bottom in all cases, so I just moved it to the top everywhere).
  As a separate cleanup step, this shared code should actually be
  moved to a separate file.

Differential Revision: https://developer.blender.org/D13330
2021-11-23 14:56:01 +01:00
47276b8470 Geometry Nodes: reduce overhead when processing single values
Currently the geometry nodes evaluator always stores a field for every
type that supports it, even if it is just a single value. This results in a lot
of overhead when there are many sockets that just contain a single
value, which is often the case.

This introduces a new `ValueOrField<T>` type that is used by the geometry
nodes evaluator. Now a field will only be created when it is actually
necessary. See D13307 for more details. In extrem cases this can speed
up the evaluation 2-3x (those cases are probably never hit in practice
though, but it's good to get rid of unnecessary overhead nevertheless).

Differential Revision: https://developer.blender.org/D13307
2021-11-23 14:49:26 +01:00
0bedd5d14f Merge branch 'blender-v3.0-release' 2021-11-23 14:39:55 +01:00
436ce22194 Fix T93296: raycast node uses wrong domain for face corner attributes
This changes what domain is used by the raycast mode. This should fix the
behavior for face corner attributes (but may make it a bit slower for other
attributes). I think for 3.0 this is an acceptable trade off. For 3.1 we can do
what the comment suggests already.

Differential Revision: https://developer.blender.org/D13333
2021-11-23 14:38:02 +01:00
dab04bc053 Fix T93231: crash when overwriting vertex group with other domain
The problem was that we forgot to actually remove the vertex group when
it should be deleted. We only removed all the data that was attached to it.

Differential Revision: https://developer.blender.org/D13326
2021-11-23 14:38:02 +01:00
d7b7cbb047 Merge branch 'blender-v3.0-release' 2021-11-23 14:36:57 +01:00
0479a66313 Fix broken versionning after recent refactor of insertion in liboverrides.
rB33c5e7bcd5e5b79 doversion code was incorrectly dealing with 'insert in
first position' case from older blendfiles.

Specifically, a NULL anchor is valid (it means that the new item is the
first of the stored override data, and should be inserted at start of
the list).

Reported as part of T93321.
2021-11-23 14:36:40 +01:00
611e4ffaab Icons: Replace .blend file icons, add "Current File" icon
The Blender icon must not be used to refer to anything that is not
Blender itself. Using the Blender icon on its own to refer to .blend
files or the currently open file is a no-go, which was brought up by
Ton.

This does the following changes to the icon file:
* Add new "Current File" icon
* Change the .blend file icon to contain a file icon with the Blender
  logo, but not merely the Blender logo.
* Change the backup .blend file icon accordingly.

The new "Current File" icon is used in the Asset Browser, but
could/should be used in the Outliner as well. That needs more design
discussion though.
2021-11-23 14:32:35 +01:00
89b927a720 Cleanup: Silence compilation warning.
For now made DRW_notify_view_update_offscreen static.
2021-11-23 14:30:14 +01:00
fecdf9d44b Merge branch 'blender-v3.0-release'
Conflicts:
	source/blender/editors/transform/transform_generics.c
2021-11-23 10:17:24 -03:00
b7c98c87ac Cleanup: clang-tidy warnings
Silenciate warnings of usage of 'else' after 'return'
2021-11-23 10:15:00 -03:00
a6d1a2d3fc Merge branch 'blender-v3.0-release' 2021-11-23 14:08:53 +01:00
Christian Stolze
bba6fe83e2 Fix T89204: slow repeated rendering with GPUOffscreen.draw_view3d.
Reviewed By: fclem
Differential Revision: D13235
2021-11-23 14:08:38 +01:00
6ab3349bd4 Documentation: Remove deprecated glColor* from bgl module.
glColor isn't supported but still part of the documentation. This
patch removes the glColor from the documentation.

Ref {T93315}
2021-11-23 13:03:12 +01:00
cf299bee80 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-23 13:02:25 +01:00
3e65bb86f9 Cleanup: fix clang-tidy warnings
Fix clang-tidy warnings introduced by a recent commit on the release
branch.

No functional changes.
2021-11-23 13:02:00 +01:00
f392ce50c4 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-23 12:39:26 +01:00
cd2849c89b Asset Browser: add operator for installing asset bundles
Add an operator "Copy to Asset Library" for installing asset bundles
into already-existing asset libraries.

The operator is shown when:
- the "Current File" library is selected,
- the blend file name matches `*_bundle.blend`, and
- the file is not already located in an asset library.

The user can select a target asset library, then gets a "Save As"
dialogue box to select where in that library the file should be saved.
This allows for renaming, saving in a subdirectory, etc.

The Asset Catalogs from the asset bundle are merged into the target
asset library.

The operator will refuse to run when external files are referenced. This
is not done in its poll function, as it's quite an extensive operator
(it loops over all ID datablocks).

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D13312
2021-11-23 12:29:44 +01:00
605cdc4346 BKE LibLink/Append: Add mechanism for external code to loop over link/append context items.
Will be required for python's `bpy.data.libraries.load()` refactor.
2021-11-23 12:18:37 +01:00
0452a04f1a BKE link/append: Add optional blendfile handle to libraries.
This enables calling code to deal with the blendfile handle themselves,
BKE_blendfile_link then just borrows, uses this handle and does not
release it.

Needed e.g. for python's libcontext system to use new
BKE_blendfile_link_append code.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-11-23 12:17:16 +01:00
6c8f73b220 Cleanup: remove unnecessary "extern" 2021-11-23 12:05:50 +01:00
b9b98448a6 Cleanup: add missing pragma once 2021-11-23 12:00:11 +01:00
fbb4a7eb43 BKE link/append: Add optional blendfile handle to libraries.
This enables calling code to deal with the blendfile handle themselves,
BKE_blendfile_link then just borrows, uses this handle and does not
release it.

Needed e.g. for python's libcontext system to use new
BKE_blendfile_link_append code.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-11-23 10:38:51 +01:00
f657356062 Merge branch 'blender-v3.0-release' 2021-11-23 09:44:04 +01:00
b02ac2d8be Fix T93092: incomplete animation rendering of multi-layer exr composition
This was broken by rB0c3b215e7d5456878b155d13440864f49ad1f230.
The caching of loaded exr files needed some special treatment.

Differential Revision: https://developer.blender.org/D13313
2021-11-23 09:43:00 +01:00
84be741329 Fix T92654: missing padding in spreadsheet cells
This was probably broken by rB5c2330203e11e0d916960218b07d88d2193bf526.
For now just add the padding back in a spreadsheet specific way.

Differential Revision: https://developer.blender.org/D13315
2021-11-23 09:35:47 +01:00
6987060f70 Fix T93090: crash with data transfer modifier and geometry nodes
There was a missing normals layer that was requested by the data transfer
modifier from the target object. The normal layer was correctly added to
the target object. However, it never reached the data transfer modifier
because the mesh was copied in `BKE_object_get_evaluated_mesh`
(in the call to `get_mesh_for_write`) and the copy does not include the normals
layer.

The solution is to not use `get_mesh_for_write` here which was only used
because `BKE_object_get_evaluated_mesh` returns a non-const `Mesh *`.
Mid term, it should actually return a `const Mesh *` to avoid the confusion.

Differential Revision: https://developer.blender.org/D13319
2021-11-23 09:32:12 +01:00
28870a8f89 Cleanup: Use new CollectionRef::empty() method
Use the new CollectionRef::empty() method in all locations where
appropriate.

Differential Revision: https://developer.blender.org/D13276
2021-11-22 23:47:26 -08:00
59754ef0b2 Cleanup: silent clang-tidy warning NULL vs nullptr. 2021-11-23 08:39:26 +01:00
Peter Fog
34370d9fdf VSE: Add drag and drop handler for preview area
For some users, dropping assets into preview area may be more practical
due to space constraints or it may be just more intuitive.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D13311
2021-11-23 05:40:08 +01:00
Peter Fog
b42494cf6b VSE: Support drag and drop for datablocks
For using the Outliner and/or the Asset Browser as scene independent
tools to organize a/v source material is necessary for the users to be
able to drag and drop data blocks into the VSE. This was also an
unfulfilled design target for the Outliner Gsoc project.

Datablocks won't be used directly. Path to file will be passed to strip
add operator instead.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D13304
2021-11-23 05:39:10 +01:00
d1a4e043bd Merge branch 'blender-v3.0-release' 2021-11-23 00:57:15 +01:00
Sayak Biswas
f749506163 Fix T93244: Cycles HIP not working with multi GPU rendering
Use the correct device function (hipDeviceGet) for multi GPU setups, instead
of hipGetDevice which just returns the default device.

Differential Revision: https://developer.blender.org/D13323
2021-11-23 00:55:56 +01:00
8600d4491f Fix: Const warning in editmesh_knife.c
Fixes a warning caused by freeing a const pointer.
This commit removes the const modifier.

Differential Revision: https://developer.blender.org/D13321
2021-11-22 23:40:21 +01:00
456d5e14b8 Merge branch 'blender-v3.0-release' 2021-11-22 21:26:39 +01:00
481f032f5c Assets: Generate light preview when making light object an asset
We already supported previews for lights, just didn't actually use them
when making a light object an asset. They were only used when making the
light data itself an asset.
2021-11-22 21:14:11 +01:00
34615cd269 Fix grayed out preview generation button for light objects
Mistake in e7bea3fb6e.

We should only skip preview generation for objects that don't support
preview rendering, not completely forbid accessing preview data of such
IDs.
2021-11-22 21:12:36 +01:00
48c2b4012f Merge branch 'blender-v3.0-release' 2021-11-22 21:06:10 +01:00
29681f186e Fix T93283: Cycles render error with CUDA CPU + GPU after recent optimization
BVH2 triangle intersection was broken on the GPU since packed floats can't
be loaded directly into SSE. The better long term solution for performance
would be to build a BVH2 for GPU and Embree for CPU, similar to what we do
for OptiX.
2021-11-22 21:02:46 +01:00
e2b736aa40 Fix part of T93278: transparent glass option not working with environment pass 2021-11-22 20:58:09 +01:00
Takahiro Shizuki
73b1ad1920 IME: Fix Multi-Window Duplicated First Character
Fix problem with duplicated initial character when initiating or
switching to new windows. This is done by updating our copies of state
and modes from the new window when it receives WM_IME_SETCONTEXT
message. This problem and fix are only for the Windows platform.
2021-11-22 10:44:34 -08:00
bfff9ca5f1 Fix confusing new Cycles UI terminology
* Rename "Auto Tiles" to "Use Tiling", it's not really automatic and
  confusing with the old auto tile size add-on.
* Rename "Adaptive" scrambling distance to "Automatic", to avoid confusion
  with adaptive sampling.
2021-11-22 10:44:34 -08:00
Takahiro Shizuki
ee0277271c IME: Fix Multi-Window Duplicated First Character
Fix problem with duplicated initial character when initiating or
switching to new windows. This is done by updating our copies of state
and modes from the new window when it receives WM_IME_SETCONTEXT
message. This problem and fix are only for the Windows platform.
2021-11-22 10:41:11 -08:00
cc6bcb53b2 Geometry Nodes: Rename legacy node files
This will be useful to solve some issues with unity builds,
which compiles different files together to improve build times.
2021-11-22 13:16:54 -05:00
5ad4ca4e02 CurveEval: Add total_length() and total_control_point_size() methods
Add the following methods to the CurveEval class:
total_length() : returns the total length of the curve without needing to
                    allocate a new array
total_control_point_size() : returns the total number of control points without
                    needing to allocate a new array
2021-11-22 12:07:59 -06:00
8a84a61f6b Fix confusing new Cycles UI terminology
* Rename "Auto Tiles" to "Use Tiling", it's not really automatic and
  confusing with the old auto tile size add-on.
* Rename "Adaptive" scrambling distance to "Automatic", to avoid confusion
  with adaptive sampling.
2021-11-22 18:37:47 +01:00
0129178376 UI: Use a map for block name lookups
Use a map to speed up search for UI block names.
Time to redraw the node editor was decreased from
around 75-120ms to 40-70ms in a tree with many
Geometry Nodes.

Differential Revision: https://developer.blender.org/D13225
2021-11-22 18:23:54 +01:00
55c82d8380 Fix T84493 issue with selection after boolean.
According to Blender selection rules, selections should be flushed
to containing elements. Added an EDMB_select_flush() after edit
mode booleans or intersects are done. Hopefully this doesn't break
any scripts that might have been depending on the old (broken) behavior.
2021-11-22 11:47:46 -05:00
1706bf7780 Merge branch 'blender-v3.0-release' 2021-11-22 17:32:23 +01:00
336ca6796a Fix T90308: Cycles crash copying memory from device to host
Happens when device runs out of memory and Cycles is moving some
textures to the host memory.

The delayed memory free for OptiX BVH was moving data from one
device_memory to another, leaving the original device memory in
an invalid state. This was ruining the allocation map in the CUDA
device which is using pointer to the device_memory.

This change makes it so the memory pointer is stolen from BVH
into the delayed memory free list.

Additionally, forbid copying and moving instances of device_memory
and added sanity checks in the device implementation.

Differential Revision: https://developer.blender.org/D13316
2021-11-22 17:26:59 +01:00
25c83c217b Cleanup: Clang-format of the HIP device implementation 2021-11-22 17:26:52 +01:00
059da44fbc BKE Link/Append: Use BLO's LibraryLink_Params.
This allows to reduce signature of several functions, and make it eaiser
to integrate more higher-level usages later on.

This should be a non-behavioral-change commit.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-11-22 17:14:21 +01:00
d7cf7d4048 Link/Append: Move main linking code (from WM) to use new instantiation code in BKE.
This removes the last main usage of BLO's instantiation code.

Also required some limited refactoring of BKE_blendfile_link_append's
instantiation to make it more modular, and usable by both linking and
appending code paths.

NOTE: This should be a non-behavioral change commit.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-11-22 16:55:36 +01:00
fe274d91a1 Link/Append: Move most of core link/append code from WM to new BKE_blendflie_link_append module.
This will allow to expose all those advanced features of the WM
operators to other parts of the code, like the python library context
manager, copy/paste code, etc.

This is expected to be a strictly no-behavioral-change commit.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.

Maniphest Tasks: T91414

Differential Revision: https://developer.blender.org/D13222
2021-11-22 16:52:17 +01:00
9c2a4d158c Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-22 16:47:50 +01:00
875f24352a Material Preview: Fix Sphere object (squared UV and poles)
A good sphere preview material has a 1:1 UV ratio (so we see squares as
least distorted as possible), as well as good poles.

Square UV:
The original sphere expected a 2:1 panorama to be mapped to it. This
patch changes that (I scaled Y by 0.5) so that square textures look ok.

Poles:
The original sphere had a low initial resolution, so no ammount of
subdivision would fix the poles.

The sphere has a subdivision modifier with 0 resolution. Later (3.1?) I
want to try to change the resolution on-the-fly based on whether the material
has a displacement map.

Old sphere (1.9K vertices):
{F11845752, size=500px}

New sphere (2.0K vertices):
{F11845710, size=500px}

Differential Revision: https://developer.blender.org/D13309
2021-11-22 16:46:49 +01:00
Jeroen Bakker
0624235900 Moviecache: Fix potential memory corruption.
`IMB_moviecache` is implemented as a singleton. When destructing the
singleton via `IMB_moviecache_destruct` it will not be created anymore
resulting inusage of unallocated memory and potentional memory
corruption.

When running blender this doesn't happen, but when creating images in
test cases the moviecache should be able to be recreated after it is
destroyed.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13287
2021-11-22 15:52:30 +01:00
be876b8db6 Painting: Performance curve masks.
This patch separates the static-part from the dynamic-part when
generate brush masks. This makes the generation of brush masks 2-5 times
faster depending on the size of the brush.

More improvements can be done, this was just low hanging fruit.
2021-11-22 15:36:03 +01:00
178947dec3 Merge branch 'blender-v3.0-release' 2021-11-22 09:34:51 -05:00
Henrik Dick
819b9bdfa1 Fix T92631: Fix negative thickness regression in complex solidify
This regression was introduced by D11832, but there was problems before
that as well. I seem to have missed it in review. See the differential
revision for a screenshot of the difference.

Differential Revision: https://developer.blender.org/D13216
2021-11-22 09:33:49 -05:00
77ddc6e350 Fix T93250: Crash in spreadsheet tree view after recent commit
It seems that update_from_old assumed there would be an old
tree view available in the old block. This works for the asset browser
because the tree is always drawn, but for the spreadsheet that depends
on having an active object, which isn't necessarily always true.

Differential Revision: https://developer.blender.org/D13301
2021-11-22 08:47:02 -05:00
7e8f9213e9 Merge branch 'blender-v3.0-release' 2021-11-22 13:49:37 +01:00
7b09213f2f Fix T93198: Frame Selected in greasepencil curve editing does not work
Was not taking into account curve points at all.

Maniphest Tasks: T93198

Differential Revision: https://developer.blender.org/D13281
2021-11-22 13:42:00 +01:00
9b6f3d2d0a Cleanup: Removed unused code in curve mask creation.
Generating curve mask for 2d texture painting had some hard-coded
parameters that eventually weren't used in the algorithm (hardness and
rotation of the brush). This patch removes these parameters.
2021-11-22 11:22:58 +01:00
9bbb5f5a6a Painting: migrated curve mask generation to CPP.
Curve mask generation is done during 2d texture painting. There are some
performance issues in this part of the code. Before addressing those we
move the code to CPP.
2021-11-22 10:46:33 +01:00
29f6ec56e6 Cleanup: Make parameter const (BKE_brush_curve_strength_clamped). 2021-11-22 10:46:33 +01:00
0b246ed813 Revert "Fix (unreported) broken handling of constraints reordering with liboverride."
This reverts commit 6eaa69c66c.

Committed by nistake, sorry for the noise.
2021-11-22 10:39:20 +01:00
31864a40ba Cleanup: use simple data member instead of callback
This really doesn't have to be a callback currently, since it is always
the same `CPPType` for a socket type.
2021-11-22 10:18:08 +01:00
c850189adf Cleanup: make naming more consistent 2021-11-22 09:48:36 +01:00
db20837c3a Merge branch 'blender-v3.0-release' 2021-11-22 09:32:59 +01:00
6c16bb2706 Fix broken NLA RNA code after own rBfa6a913ef19c.
Thanks to @scurest for noticing this mistake!
2021-11-22 09:31:59 +01:00
6eaa69c66c Fix (unreported) broken handling of constraints reordering with liboverride.
New drag&drop reordering code would call constraints reordering operator
with the generic context, and not the one from the panel's layout.
missing the "constraint" member which is mandatory for poll function to
properly deal with override vs. local constraints.

This commit fixes it by generating a temp bContextStore in the panel
re-ordering callback.

NOTE: this fix will have to be extended to modifiers (which happen to
work currently because they have an 'active' status), and gpencil
modifiers (which are also broken currently).

Differential Revision: https://developer.blender.org/D13291
2021-11-22 09:28:27 +01:00
fb470c256a Fix T93256: Instances to points node broken after recent commit
When 97533eede4 added the instance domain, it didn't change
the domain that instance attributes are read from in this node.
2021-11-21 11:37:35 -05:00
873f6148ad Functions: remove test for dynamic name
This was broken in rB6ee2abde82ef121cd6e927995053ac33afdbb438.
2021-11-21 13:08:23 +01:00
940e6525c7 Functions: fix compile error in tests 2021-11-21 13:06:05 +01:00
15011e0b70 Functions: use static string for parameter names
The idea behind this change is the same as in
rB6ee2abde82ef121cd6e927995053ac33afdbb438.

A `MultiFunction::debug_parameter_name` method could be
added separately when necessary.
2021-11-21 12:57:34 +01:00
6ee2abde82 Functions: use static names for multi-functions
Previously, the function names were stored in `std::string` and were often
created dynamically (especially when the function just output a constant).
This resulted in a lot of overhead.

Now the function name is just a `const char *` that should be statically
allocated. This is good enough for the majority of cases. If a multi-function
needs a more dynamic name, it can override the `MultiFunction::debug_name`
method.

In my test file with >400,000 simple math nodes, the execution time improves from
3s to 1s.
2021-11-21 12:48:07 +01:00
d455eadcd8 Cleanup: Move menu search template to C++
This allows the use of better/more readable data structures,
and will also make some refactors to the search button easier.
The build completed on the buildbot for all platforms.
2021-11-20 16:30:53 -05:00
b3ee9f44cf Merge branch 'blender-v3.0-release' 2021-11-20 18:00:46 +01:00
1b2ee3cf20 Fix T92090: Eevee crash with Intel HD 4000 and macOS 10.15.7
A recent security update to macOS 10.15.7 causes crashes when using Eevee and
various other 3D viewport features. It appears that glGenerateMipmap is
broken, causing a crash whenever its commands are flushed/submitted to the GPU.

Ideally this would be fixed in a driver update, however it's unlikely this will
happen. Earlier macOS versions have been receiving security updates for 2 years,
and that window has just passed for 10.15. Further, computers with these GPUs
can't upgrade to a newer macOS version.

As a workaround, disable mipmaps on these GPUs, by setting the mipmap max level
to 0 and not calling glGenerateMipmaps. Effects like depth of field also use
mipmaps, but fill in the mip levels by other means. In those cases we keep the
mipmap level.

Differential Revision: https://developer.blender.org/D13295
2021-11-20 17:50:05 +01:00
e949ac0bfc Cleanup: unset 'FILE_ENTRY_PREVIEW_LOADING' at the end
Although this function only runs on the main thread, it seems safer to
clear the flag only after setting the result.
2021-11-20 10:34:29 -03:00
59ffe1c5b1 Merge branch 'blender-v3.0-release' 2021-11-20 14:05:26 +01:00
Sayak Biswas
f2bb42a095 Fix T92984: Cycles HIP crash with smoke volumes
This fixes the the app crash happening when trying to render smoke as a dense
3D texture. The changes are related to matching up hipew with the actual HIP
headers.

Differential Revision: https://developer.blender.org/D13296
2021-11-20 14:02:38 +01:00
3d447b6335 Merge branch 'blender-v3.0-release' 2021-11-20 12:47:31 +01:00
b20997cb34 Fix T93194: greasepencil channel lists ignoring collection visibility
Same fix as rB0a3b4d4c64f1, but this time for greasepencil.

To repeat: dopesheet in greasepencil mode was ignoring the temporariy
visibility flag of collections. As a result, even though the dopesheet
was supposed to show animation data of visible greasepencils only was
still showing such data of greasepencils that were hidden by hiding
their collection.
2021-11-20 12:31:33 +01:00
3baaab15fc Cleanup: Else after return 2021-11-19 23:48:51 -05:00
411261fb32 Merge branch 'blender-v3.0-release' 2021-11-20 01:45:06 -03:00
092df87534 Fix error in rBfb0ea9
There is no need to multiply the "dash_width" by `UM.pixel size` since the "viewport_size" is already being divided by the DPI.

Ref {rBfb0ea9}
2021-11-20 01:44:35 -03:00
15ecd47b96 Geometry Nodes: Instance attributes in Transfer/Capture nodes
Updates the Transfer Attributes and Capture Attributes nodes
to support attributes from instances.

Differential Revision: https://developer.blender.org/D13292
2021-11-19 23:40:08 +01:00
01df48a983 Refactor: Port spreadsheet data set to UI tree view
This patch removes a bunch of specific code for drawing the spreadsheet
data set region, which was an overly specific solution for a generic UI.
Nowadays, the UI tree view API used for asset browser catalogs is a much
better way to implement this behavior.

To make this possible, the tree view API is extended in a few ways.
Collapsibility can now be turned off, and whether an item should
be active is moved to a separate virtual function.

The only visual change is that the items are now drawn in a box,
just like the asset catalog.

Differential Revision: https://developer.blender.org/D13198
2021-11-19 17:36:11 -05:00
a0780ad625 Fix: Exception in tree view code in new case
This isn't a problem in 3.0 or master, but I'm porting the spreadsheet
data set region to a tree view and ran into this. This line needs to
whether the function is empty before calling it.

Differential Revision: https://developer.blender.org/D13197
2021-11-19 17:28:08 -05:00
cfbc9df60e Cleanup: Use canonical variable name
All `ARegion` variables should be called `region` unless there is
a good reason not to, since that is the convention.
2021-11-19 16:10:37 -05:00
217d0a1524 Cleanup: Use vector instead of linked list 2021-11-19 15:57:31 -05:00
51a7961e09 Cleanup: Simplify node editor link dragging storage
Now that `node_intern.hh` is a C++ header, we can use C++ types
there. This patch replaces the linked list of dragged links with a
vector. Also, the list of drag operator custom data, `nldrag`, doesn't
seem to need to be a list at all, so I just made it a unique pointer.

Differential Revision: https://developer.blender.org/D13252
2021-11-19 15:36:32 -05:00
c3fed4d463 Merge branch 'blender-v3.0-release' 2021-11-19 16:57:33 -03:00
fb0ea94c63 Fix T85855: F-curves too thin on Mac
Use the `GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR` shader instead of `GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR`.
This is just a partial solution as "protected" fcurves still use the dashed shader.

Differential Revision: https://developer.blender.org/D13290
2021-11-19 16:57:05 -03:00
50ad0e15fe Merge branch 'blender-v3.0-release' 2021-11-19 19:24:55 +01:00
00e4d665f4 Fix T91838 Crash when toggling edit mode on object with geometry node modifier, but only if the instanced objects material has a normal map assigned.
This is only a workaround to avoid the crash. The underlying issue is left
unfixed.

New report for tracking the underlying issue is T93223.
2021-11-19 19:24:22 +01:00
fabd088067 Update splash for Blender 3.x development series
CC-BY Blender Studio https://studio.blender.org

Update the splash artwork for the daily builds (`master`) to
celebrate the beginning of a new major series in Blender.

The badges of the Development Fund membership levels have been removed for
a simpler design, and the font matches the one used elsewhere in blender.org
2021-11-19 18:39:14 +01:00
1222c45544 Fix: Use the instances domain in instance transform nodes
Instance attributes exist on the instance domain after rB97533eede44421,
so these fields should be evaluated on that domain.
2021-11-19 12:26:48 -05:00
ba8dd0f24f Spreadsheet: Support instances component viewer node columns
After rB97533eede444217b, instances have their own attribute domain,
but the spreadsheet code worked under the assumption that the component
used the point domain. Old files have to re-select the instances data
source to make it properly active
2021-11-19 12:21:54 -05:00
06a2e2b28c Merge branch 'blender-v3.0-release' 2021-11-19 18:05:17 +01:00
ef687bd7c2 Merge branch 'blender-v3.0-release' 2021-11-19 12:00:35 -05:00
97533eede4 Geometry Nodes: Support custom instance attributes
Adds an attribute provider for instance attributes.
A new domain `ATTR_DOMAIN_INSTANCE` is implemented.
Instance attributes are not yet realized correctly.

Differential Revision: D13149
2021-11-19 17:53:48 +01:00
1b686c60b5 Fix T93046: Cycles world volume rendering very slow in OptiX with some scenes
With very long ray distance, OptiX ends up traversing many BVH nodes due to
a feature that improves precision. However this causes very slow rendering.

We now avoid generating such long rays by rejecting the few samples that have
long ray distances and very low probability of being generated. This should not
meaningfully affect render results.

Thanks to Sergey and Patrick for the investigation.
2021-11-19 17:42:22 +01:00
0f1a200a67 Fix T92682: EEVEE motion blur crash with curve objects
After rBb9febb54a492, the evaluated mesh from a curve is now presented
to render engines as a separate mesh object, but some code still assumed
that a curve object itself could have an evaluated mesh. However, this is
still true for surface objects and metaballs, which don't
use geometry sets yet.

Differential Revision: https://developer.blender.org/D13272
2021-11-19 11:36:29 -05:00
9e3a913b35 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-19 16:39:28 +01:00
1a1ddcb5e2 Asset Browser: don't display linked-in asset datablocks
Datablocks marked as asset, linked from another file, were shown in the
"Current File" asset library. This is now resolved.
2021-11-19 16:29:25 +01:00
ec71054a9b Merge branch 'blender-v3.0-release'
Conflicts:
	source/blender/blenkernel/BKE_blender_version.h
	source/blender/blenloader/intern/versioning_300.c
2021-11-19 16:10:28 +01:00
06ead314b6 Asset Preferences: disallow single file as asset library
Asset libraries should be directories on disk. By manually entering a
file path it was possible to have a single blend file as asset library,
but that was not a designed-for situation, and it doesn't play well
with the asset catalog system.
2021-11-19 16:08:55 +01:00
330290d2a8 Cleanup: typos in comments 2021-11-19 15:55:47 +01:00
33c5e7bcd5 LibOverrides: Refactor how diffing of RNA collections is handled.
Original implementation was a quick prototype which should have never
landed as-is in master. It had very limiting constraints and did not
allow for any real further development.

This commit fixes the internal implementation to make more sensible,
maintainable and evolutive.

NOTE: This commit introduces another forward-incompatibility in the
Blender file format: Files saved after this commit won't open properly
in older versions of blender regarding local inserted constraints or
modifiers into overrides of linked data.

NOTE: Technical details: The 'anchor' item name/index is now stored in
`subitem_reference_` members, and the actual 'source' item name/index is
stored in `subitem_local_` members of the override property operation
data.
Previously, only the `subitem_local_` members were used, storing the
anchor item name/index, and assuming the 'source' item was always the
next in the list.

Milestone I of T82160.

Maniphest Tasks: T82160

Differential Revision: https://developer.blender.org/D13282
2021-11-19 15:41:53 +01:00
d6ea881a74 BLI_listbase: Add utils to search from string or index.
If a valid matching string is found, return that item, otherwise
fallback to the item matching the given index, if any.

This will be useful in RNA override code, and potentially other
areas where data in lists can be referenced by their names or indices.
2021-11-19 15:41:36 +01:00
d7aaa145c6 Merge branch 'blender-v3.0-release' 2021-11-19 15:30:54 +01:00
04ec36f677 Fix T87912: use session id instead of name to identify dropped object
The old code did not work when there were multiple ids with
the same name (which can happen when ids are linked in).
The solution is to use the session ids instead. Those are different
even when two ids have the same name.

Differential Revision: https://developer.blender.org/D11116
2021-11-19 15:28:44 +01:00
0852805ed7 Merge branch 'blender-v3.0-release' 2021-11-19 15:58:37 +02:00
a20e703d1a Fix T93184: Link color not used for custom sockets
D13044 allowed the link color overlay to be used with custom sockets.
This no longer works due to a condition that checks if the socket is
standard or not, which was in place to avoid bad indexing of the
std_node_socket_colors array. Since that array is no longer used, this
condition needs to be removed.

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

Reviewed By: Hans Goudey
2021-11-19 15:55:58 +02:00
06691d1b21 Tests: disable Cycles volume test when WITH_MOD_FLUID is off 2021-11-19 13:21:48 +01:00
1b94c53aa6 Cleanup: fix typos in comments and docs
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D10447
2021-11-19 13:02:16 +01:00
7d5ef64bfb Cleanup: fix typos in comments and docs
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D13264
2021-11-19 12:46:49 +01:00
fa6a913ef1 LibOverride: Add read-only flags accessors for 'local override' status.
Constraints, modifiers and NLA tracks can now report from RNA whether
they are defined as comming from the override's reference linked data,
or are local to the override.
2021-11-19 12:09:28 +01:00
83e245023c Fix (unreported) wrong behavior of constraints in liboverrides.
All constraints were 'made local', including the ones comming from the
reference linked object.
2021-11-19 12:09:28 +01:00
eb071c9ff4 Merge branch 'blender-v3.0-release' 2021-11-19 10:16:30 +01:00
de3fda29c7 Fix T93054: crash when deleting a missed linked file
This is a bit similar to rBb7260ca4c9f4b7618c9c214f1270e31d6ed9886b.
Sometimes a group node may not reference a node group
because it was linked and can't be found.
2021-11-19 10:15:58 +01:00
48e64a5fb5 Merge branch 'blender-v3.0-release' 2021-11-19 10:09:29 +01:00
4ea6b4ba84 Fix crash in VSE versioning code from recent commit
Caused by {rB4d09a692e22a}.
Greenlit by @sergey in chat.
2021-11-19 10:05:18 +01:00
992634427e Nodes: add bf_nodes_geometry library
Separating geometry nodes into a new library will make it
easier to improve compile times with features like unity
builds and precompiled headers.

Differential Revision: https://developer.blender.org/D13261
2021-11-19 09:09:14 +01:00
b8dc845e57 Merge branch 'blender-v3.0-release' 2021-11-19 06:22:47 +01:00
4d09a692e2 Fix T92847: Meta-strip corrupt
Offsets for meta strip were invalid. No steps to reproduce the issue are
available, but it is quite possible that there are files with incorrect
state after issues with meta strips were fixed.

Ensure correct offsets for meta strips in versioning code.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13257
2021-11-19 06:12:09 +01:00
5ed3a5d023 Cleanup: Add an empty() method to RNA's CollectionRef class
The existing RNA CollectionRef class only offers a length() operation
which is sometimes used for checking if the collection is empty. This is
inefficient for certain collection types which do not have a native
length member; the entire list is iterated to find the count.

This patch creates an explicit empty() method to be used in such cases
for better semantics. Additionally, many collection types will behave
more efficiently when using the new method instead of checking length.

Making use of the new method will follow separately.

Differential Revision: https://developer.blender.org/D12314
2021-11-18 14:32:56 -08:00
3f288e9414 Node Editor: Change minimum zoom
Now with Geometry Nodes in Blender,
trees can become much bigger than before.
This changes the minimum zoom value in the node editor.

Differential Revision: https://developer.blender.org/D13254
2021-11-18 21:24:55 +01:00
b2d37c35d0 Node Editor: Skip socket drawing on low zoom
Socket drawing can be heavy with many nodes.
This patch skips drawing them on scale < 0.2
when they are barely visible anyway.

Differential Revision: https://developer.blender.org/D13255
2021-11-18 21:21:10 +01:00
167ee8f2c7 Merge branch 'blender-v3.0-release' 2021-11-18 19:37:48 +01:00
fd2a155d06 Fix T91797: Cycles volume rendering artifact with overlapping volumes
With the new volume rendering code this was no longer accurate, we always
need to use a new dimension for the next volume segment.
2021-11-18 19:27:37 +01:00
f190f2d267 Revert fixes 2021-11-18 14:19:59 -03:00
0c33411bdd Revert "Revert "Revert "Revert "Allow navigating while transforming""""
This reverts commit 717a971035.
2021-11-18 14:15:08 -03:00
ea42c1a22e Revert "Revert "Revert "Revert "Adjust snap source drawing when adding multiple snap points""""
This reverts commit b8bf40ed4b.
2021-11-18 14:14:57 -03:00
f61a73093b Revert "Revert "Revert "Revert "Transform: interactive mode for editing a 'Snap Source'""""
This reverts commit 701f2dfd5b.
2021-11-18 14:14:51 -03:00
ada6742601 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-18 17:58:26 +01:00
701f2dfd5b Revert "Revert "Revert "Transform: interactive mode for editing a 'Snap Source'"""
This reverts commit 25fa6c74b9.
2021-11-18 13:55:24 -03:00
b8bf40ed4b Revert "Revert "Revert "Adjust snap source drawing when adding multiple snap points"""
This reverts commit c7f9a782aa.
2021-11-18 13:55:21 -03:00
717a971035 Revert "Revert "Revert "Allow navigating while transforming"""
This reverts commit 2a9cfdac7e.
2021-11-18 13:55:17 -03:00
Germano Cavalcante
2a9cfdac7e Revert "Revert "Allow navigating while transforming""
This reverts commit 5e6fdaa07f.
2021-11-18 13:52:39 -03:00
c7f9a782aa Revert "Revert "Adjust snap source drawing when adding multiple snap points""
This reverts commit 77df32548b.
2021-11-18 13:52:30 -03:00
Germano Cavalcante
25fa6c74b9 Revert "Revert "Transform: interactive mode for editing a 'Snap Source'""
This reverts commit 805181bffa.
2021-11-18 13:52:18 -03:00
7c4e4d605c Pose Library: clarify apply/blend operator names
The old names had "{verb} Pose Library Pose"; they are now named
"{verb} Pose Asset", which is shorter & clearer.
2021-11-18 17:52:17 +01:00
3531021d1b Cleanup: Simplify declarations in C++ header
Using `struct` everywhere is unnecessary in C++, and the typedefs
are also unnecessary.
2021-11-18 11:46:44 -05:00
12fc395436 Fix T93152: Cycles baking multiple selected object to active not working 2021-11-18 17:43:27 +01:00
Germano Cavalcante
805181bffa Revert "Transform: interactive mode for editing a 'Snap Source'"
This reverts commit f19bd637e2.
2021-11-18 13:42:45 -03:00
77df32548b Revert "Adjust snap source drawing when adding multiple snap points"
This reverts commit cb3ba68ec4.
2021-11-18 13:42:36 -03:00
Germano Cavalcante
5e6fdaa07f Revert "Allow navigating while transforming"
This reverts commit 1d1855e95f.
2021-11-18 13:42:31 -03:00
Germano Cavalcante
1d1855e95f Allow navigating while transforming
This feature has been desired for some time:
- https://rightclickselect.com/p/ui/Tqbbbc/allow-navigating-while-transforming (See comments);
- D1583;
- T37427;

In short, blocking navigation during transform limits the user to move the object only to visible areas within the screen and hinders the allocation of objects within closed meshes.

The node editor is also impaired because some nodes are far between them and the connectors are too small.

The only disadvantage of this patch (as I see it) is the conflict with the existing key map:
MIDDLEMOUSE:
- enable axis constrain in 3D view;

WHEELDOWNMOUSE, WHEELUPMOUSE, PAGEUPKEY, PAGEDOWNKEY:
- change the threshold of the proportional edit;

So the patch solution was to change these keymaps:
- MIDDLEMOUSE to Alt+MIDDLEMOUSE;
- WHEELDOWNMOUSE, WHEELUPMOUSE, PAGEUPKEY, PAGEDOWNKEY to Alt+(corresponding key);

When you use this new keymap for the first time in the proportional edit, it may seem strange due to the custom of using it (both in View2D and View3D).
But quickly the user gets used to it.

Alternatively we can add an option to the user preferences ([] Allow navigating while transforming). (I'm not much fan of this option).

The patch was done on branch2.8. But maybe it's a good idea to apply it to 2.79

Differential Revision: https://developer.blender.org/D2624
2021-11-18 13:14:18 -03:00
cb3ba68ec4 Adjust snap source drawing when adding multiple snap points 2021-11-18 13:14:18 -03:00
Germano Cavalcante
f19bd637e2 Transform: interactive mode for editing a 'Snap Source'
This patch implements part of what was stated in {T66484}, with respect to `Base Point`.

## Introduction

The snapping feature of the transform tools has a variety of applications:
- Organization of nodes.
- Positioning of frames in precise time units.
- Retopology with snap to face
- Creation of armatures with bone positioning through the snap to volume
- Precise positioning of 3D or 2D objects in the surrounding geometry (CAD modeling)

The goal of this document is to make it more powerful for precision modeling and still supporting the old use cases without extra complexity.
The main topic addressed here is the introduction of a **interactive mode for setting a snap source** (See terminology).

## Terminology

* **Snap Source**: 3d coordinate * we want to snap from. (Currently defined by the `Snap With` options: `Closest`, `Center`, `Median` and `Active`).
* **Snap Target**: 3d coordinate*  we want to snap to. (Vertices, Edges, Faces, Grid...)

## Interactive Mode for Editing a Snap Source

Currently the fixed snap point can only be obtained through the `Snap With` options. So it's a little tricky for the user to define a snap source point having so much geometry on an object.
Because of this, the user needs to resort to impractical solutions to get a point in the geometry.
See example of an impractical use:
{F11714181, layout=left, width=960, alt="The user used the cursor (which can be snapped) to choose the snap origin point."}
The user used the cursor (which can be snapped) to choose the snap source point.

While it is possible to work around this current limitation, it is important to reduce the number of steps and allow the user to set a snap source point through an optional interactive mode during a transformation.

The proposed solution is to be able to move the current snap source point through a modal modifier activated with a key (eg. B).
The snap source point can thus "snap" to the elements in the scene (vertex, mid-edge, Lamp, …) during this mode.
{F9122814, layout=left, width=960, alt="Base Point Snap, example of transform operation via the shortcut (not the tool). After pressing g and the snap base change shortcut (e.g., shift + ctrl) the user set the base point. The base point is then visible until the end of the operation. The z axis constrains the final position."}

## Implementation Details

- The feature will only be available in 3D View.
- The feature will only be available for `Move`, `Rotate` and `Scale` transform modes.
- The snap source editing will be enabled with a single click on the modifier key (B).
- Having a snap point indicated, the new snap origin point will be confirmed with the same buttons that confirms the transformation (but the transformation will not be concluded).
- The snap source editing can be canceled with the same key that activated it (B).
- If the transformation is done with "release_confirm" (common for gizmos), the new feature cannot be enabled.
- During the transformation, when enabling the feature, if the snap option is turned off in the scene, the snap will be forced on throughout the rest of the transformation (unless interactive mode is canceled).
- During a transformation, if no snap target is set for an element in the scene (Vertex, Grid...), the snap targets to geometry Vertex, Edge, Face, Center of Edge and Perpendicular of Edge will be set automatically.
- Snap cannot be turned off during the snap source editing.
- Constraint or similar modification features will not be available during the snap source editing.
- Text input will not be available during the snap source editing.
- When adding multiple snap points (A) the new prone snap source point will be indicated with an "X" drawing.
{F11817267}

Maniphest Tasks: T66484

Differential Revision: https://developer.blender.org/D9415
2021-11-18 13:14:18 -03:00
f0be276514 Fix T93082: Cycles baking not handling transparency correctly
For baking, replace transparent BSDF with holdout for baking. This ensure no
objects behind are baked, and that the baked image has alpha.
2021-11-18 17:13:16 +01:00
ed91e759d1 Fix Cryptomatte accurate option showing for Cycles, only needed for Eevee 2021-11-18 17:13:16 +01:00
67b4eecac9 Cleanup: Use const arguments 2021-11-18 11:03:18 -05:00
Nikhil Shringarpurey
dd31b8bd50 UI: Use full word "Start" instead of "Sta"
Differential Revision: https://developer.blender.org/D13098
2021-11-18 10:45:10 -05:00
5816eb4c56 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-18 16:36:11 +01:00
8d1357ea6b Pose Library: add conversion button to old poselib UI
Add the "Convert Old Pose Library" operator to the old pose library (in
the Armature properties editor). This makes it more discoverable; before
it only was available in the Action editor.
2021-11-18 16:35:56 +01:00
beb9e332ca Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-18 16:21:17 +01:00
31afa1bb9a Asset tags: include partial tag matches
When filtering the asset browser, also include results that have partial
tag matches. So searching for "xite" will include results tagged with
"excited".

This brings the tag filtering in line with other search boxes in
Blender. Later we might want to provide users with more options for
prefix-only ("excite" would match "excited", but "xited" would not) or
only exact matches.
2021-11-18 16:21:00 +01:00
0624acf088 Fix T92442: undo removal of Eevee cryptomatte accurate mode option
The Cycles accurate mode was removed, but the Eevee option for this has
a different meaning and should not have been removed. The Eevee accurate
makes cryptomatte accumulate for every sample, which Cycles has always
done regardless of any option.
2021-11-18 15:59:08 +01:00
b926f54f3c Fix: error when materializing curve point attribute
Differential Revision: https://developer.blender.org/D13271
2021-11-18 15:28:04 +01:00
d1f944c186 Cycles: declare constants at program scope on Metal
MSL requires that constant address space literals be declared at program
scope. This patch moves the `blackbody_table_r/g/b` and `cie_colour_match`
constants into separate files so they can be declared at the appropriate scope.

Ref T92212

Differential Revision: https://developer.blender.org/D13241
2021-11-18 14:38:05 +01:00
d19e35873f Cycles: several small fixes and additions for MSL
This patch contains many small leftover fixes and additions that are
required for Metal-enablement:

- Address space fixes and a few other small compile fixes
- Addition of missing functionality to the Metal adapter headers
- Addition of various scattered `__KERNEL_METAL__` blocks (e.g. for
  atomic support & maths functions)

Ref T92212

Differential Revision: https://developer.blender.org/D13263
2021-11-18 14:38:02 +01:00
c0d52db783 Merge branch 'blender-v3.0-release' 2021-11-18 14:33:43 +01:00
f71813204c Cycles: Don't tile if image area fits into tile area
Previously the check was done based on dimension of image and if any
of dimensions were larger than tile size tiling was used.

This change makes it so that if image does not exceed number of pixels
in the tile no tile will be used. Allows to render widescreen images
without tiling.

Differential Revision: https://developer.blender.org/D13206
2021-11-18 14:27:45 +01:00
3ad2bf1327 Cycles: Fix command line render overshooting time limit
The calculation based on preserving device occupancy was conflicting
with the fact that time limit needs to render less samples at the last
round of render work.

For example, rendering BMW27 for 30sec on i9-11900k was actually
rendering for almost a minute. Now the render time limit is respected
much more close.

Differential Revision: https://developer.blender.org/D13269
2021-11-18 14:27:45 +01:00
bd2e3bb7bd Fix T93045: Cycles HIP not rendering OpenVDB volumes
Build HIP kernels with NanoVDB, and patch NanoVDB to work with HIP.

This is a header only library so no rebuild is needed. The changes are being
submitted upstream to openvdb, so this patch should be temporary.

Thanks Thomas for help testing this.
2021-11-18 13:24:56 +01:00
2b63a76041 Merge branch 'blender-v3.0-release' 2021-11-18 11:53:46 +01:00
e5774282b9 Fix asset preview not showing up for current file data-blocks
For data-blocks from the current file, the image-buffer for dragging
wasn't set at all. This wasn't intentional, dragging things in the Asset
Browser should just always show the preview.
2021-11-18 11:47:21 +01:00
William Leeson
e1a3b697ec Merge branch 'blender-v3.0-release' to pick up D13262. 2021-11-18 09:41:11 +01:00
William Leeson
8c0370ef7b Fix T93102: Principled hair shader stack was built incorrectly
stack_assign_if was used in the middle of creating the shader value blocks.
Which caused stack variables to be inserted in the middle of the shader value data.
This resulted in the shader node data no being in sequential order. This was also
the case for the wave texture wave node.

Reviewed By: brecht

Maniphest Tasks: T93102

Differential Revision: https://developer.blender.org/D13262
2021-11-18 09:31:29 +01:00
Félix
9cf3d841a8 VSE: Add meta.separate() Python API function
This function can be used to "dissolve" meta strip anywhere in strip
hierarchy. This has same effect as `meta_separate` operator.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/T91005
2021-11-18 03:55:48 +01:00
f1f7a8b018 Merge branch 'blender-v3.0-release' 2021-11-18 03:03:13 +01:00
a182b05f07 Fix T90390: VSE Jump operator don't work during playback
Tag dependency graph `ID_RECALC_AUDIO_SEEK` update.
2021-11-18 02:59:50 +01:00
032ab0270d Merge branch 'blender-v3.0-release' 2021-11-18 02:23:17 +01:00
Andrea Beconcini
daaa43232d Fix T92445: Thumbnail height without overlay text
This patch changes the thumbnails' height used for image and movie
strips by choosing the proper size according to the VSE's text overlay
settings: i.e. thumbnails use the whole strip's height when no overlay
text is displayed; otherwise, some space is left for the overlay.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D13043
2021-11-18 02:14:11 +01:00
ceec400975 Merge branch 'blender-v3.0-release' 2021-11-18 01:40:37 +01:00
d8fd575af9 Fix T93154: Crash adding multiple movie strips
Some when adding multiple movies at once and only some of them have
audio track, this causes crash on NULL dereference. Issue was introduced
in bdbc7e12a0 to align sound and video properly.

Check if sound is present in movie file. If it's not, don't try to align
sound with video.
2021-11-18 01:32:06 +01:00
d6b5251572 Merge branch 'blender-v3.0-release' 2021-11-18 01:13:22 +01:00
b071083496 Fix T93166: Division by zero when drawing thumbnails
Caused by incorrect step calculation fo too short strips. For these,
step should be equal to strip length not 0.
2021-11-18 01:11:51 +01:00
fa7a6d67a8 Fix Cycles CUDA/HIP compiler error after recent changes 2021-11-17 19:56:18 +01:00
Sebastian Herholz
d9bc8f189c Cycles: add build option to enable a debugging feature for MIS
This patch adds a CMake option "WITH_CYCLES_DEBUG" which builds cycles with
a feature that allows debugging/selecting the direct-light sampling strategy.
The same option may later be used to add other debugging features that could
affect performance in release builds.

The three options are:
* Forward path tracing (e.g., via BSDF or phase function)
* Next-event estimation
* Multiple importance sampling combination of the previous two methods

Such a feature is useful for debugging light different sampling, evaluation,
and pdf methods (e.g., for light sources and BSDFs).

Differential Revision: https://developer.blender.org/D13152
2021-11-17 18:03:56 +01:00
063ad8635e Cycles: reduce triangle memory usage with packed_float3
Depends on D13243

Differential Revision: https://developer.blender.org/D13244
2021-11-17 17:29:41 +01:00
9937d5379c Cycles: add packed_float3 type for storage
Introduce a packed_float3 type for smaller storage that is exactly 3
floats, instead of 4. For computation float3 is still used since it can
use SIMD instructions.

Ref T92212

Differential Revision: https://developer.blender.org/D13243
2021-11-17 17:29:41 +01:00
89d5714d8f Build: match GCC and Clang float conversion warnings in Cycles 2021-11-17 17:29:41 +01:00
ea7efa5569 Merge branch 'blender-v3.0-release' 2021-11-17 15:41:32 +01:00
00a9617f92 Fix: wrong assert in geometry nodes evaluator
It only makes sense to check if all required outputs have been computed
if the node was executed at all.
2021-11-17 15:40:53 +01:00
c3422c48ad Cleanup: remove dummy multi function 2021-11-17 12:33:18 +01:00
e5f05bc7a6 Cleanup: Painting - reduce reallocation of same memory.
Curve mask is freed/allocated every time, but could still reuse the
previous allocated buffer when the diameter of the brush doesn't change.
2021-11-17 12:30:42 +01:00
f5dde382af Cleanup: use same function for updating internal links for all nodes
Previously, node types had a callback that creates internal links. Pretty
much all nodes used the same callback though. The exceptions are the
reroute node (which probably shouldn't be mutable anyway) and some
input/output nodes that are not mutable.

Removing the callback helps with D13246, because it makes it easier
to reason about which internal links are created and when they change.
In the future, the internal links should be part of the node declaration.
2021-11-17 11:52:54 +01:00
83a4d51997 Cleanup: Remove unused show_samples() device code in Cycles. 2021-11-17 11:16:48 +01:00
c2ab47e729 Cleanup: change node socket availability in a single place
This cleans up part of the code that still set the flag manually. Also, this
change helps with D13246 because it makes it easier to tag the node
tree as changed when the availability of a socket changed.
2021-11-17 11:11:28 +01:00
51b8e34fb7 LineArt: Improve certain edge cases in occlusion
This patch includes:
View vector fix for ortho back face.
Point on segment logic correction.
Better handling of boundary cases.

See review page for detailed description.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D13143
2021-11-17 14:31:12 +08:00
473be239c3 LineArt: Improve certain edge cases in occlusion
This patch includes:
View vector fix for ortho back face.
Point on segment logic correction.
Better handling of boundary cases.

See review page for detailed description.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D13143
2021-11-17 14:30:08 +08:00
e3c974b7e4 Merge branch 'blender-v3.0-release' 2021-11-17 05:43:34 +01:00
6e6123b40f Fix T93080: Crash on scrubbing with snapping
Sequencer wasn't initialized, snapping crashed on NULL dereference.
Add Null check.
2021-11-17 05:40:25 +01:00
ecad33f214 UI: Use ampersand instad of 'and' in labels
- When and is used in labels use ampsand
- When used in description use 'and'
2021-11-16 21:38:03 -05:00
61bffa565e Fix T90412: Inconsistency in mask strip color
This seems to be oversight in 271231f58e where strip color was
defined only for light theme.
2021-11-17 03:27:13 +01:00
f72dc00569 Merge branch 'blender-v3.0-release' 2021-11-17 03:12:19 +01:00
9bdf3fa5f0 Fix T91724: Strip height is too limited
This change was introduced in 997b5fe45d, to not display pixelated
thumbnails. However when VSE timeline height is made smaller, this
limits strip height.

Change limit, so one strip can occupy full height of VSE timeline
2021-11-17 02:45:53 +01:00
4c988eb3e1 Fix error with makefiles compilation
Use 'template' keyword to treat 'is' as a dependent template name
2021-11-16 20:46:33 -03:00
luzpaz
dea26253a0 cleanup: fix typos in comments and docs
Followup to https://developer.blender.org/D10288

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D10346
2021-11-16 18:45:10 -05:00
8290edefad Cleanup: Use bool instead of int 2021-11-16 17:20:31 -06:00
2f39b45e8c Merge branch 'blender-v3.0-release' 2021-11-16 17:50:24 -05:00
f829b86039 Cleanup: Correct copy paste error in comment
Mistake from rB2743d746ea4f38c098512f6dd6fc33d5a62429d3
2021-11-16 17:49:51 -05:00
93f26d652e Merge branch 'blender-v3.0-release' 2021-11-16 23:21:13 +01:00
fbf4fe6963 Fix missing Cycles implicit float/double conversion error with Clang
Since these are errors with GCC and Visual Studio.
2021-11-16 23:18:25 +01:00
1e4d1eb398 Fix another Linux build error with double and float comparison 2021-11-16 23:12:50 +01:00
59da22c309 Merge branch 'blender-v3.0-release' 2021-11-16 22:40:08 +01:00
b496c1c721 Cleanup: compiler warnings 2021-11-16 22:29:50 +01:00
3189171a94 Fix build error with strict double to float conversion 2021-11-16 22:25:24 +01:00
cf83719761 Geometry Nodes: Small improvements to object info node
This commit contains a few mostly-related changes to this node:
 -  Add a warning when retrieving the geometry from the modifier object.
 - Only create the output geometry when it is necessary.
 - Decompose transform matrices in a more friendly way.
 - Use default return callbacks like other newer nodes.

Differential Revision: https://developer.blender.org/D13232
2021-11-16 15:09:00 -06:00
c9fb08e075 Merge branch 'blender-v3.0-release' 2021-11-16 14:55:13 -06:00
f30e1fd2f0 Fix T93085: Incorrect geometry nodes modifier warning
It's valid for a node group connected to the modifier not to
have a geometry input, but I didn't consider that case
with the last change I made here, f3bdabbe24.

Differential Revision: https://developer.blender.org/D13231
2021-11-16 14:51:03 -06:00
25d30e6c99 Fix T92857: Deadlock in geometry nodes curve multi-threading
The spline code, especially Bezier splines, often make use of lazily
evaluation and caching. In order to do that, they use mutex locks.
When multi-threading, this can lead to problems. Further detail
can be found in rBfcc844f8fbd0d1.

To fix the deadlock, isolate the task before multi-threading
when holding a lock.

Differential Revision: https://developer.blender.org/D13229
2021-11-16 14:49:58 -06:00
cfd0e96e47 Fix T93125: Cycles wrong remaining render time with high number of samples
Avoid integer overflow.
2021-11-16 20:49:32 +01:00
7293c1b357 Fix T93106: Cycles SSS not working with normals pointing inside 2021-11-16 19:44:45 +01:00
Germano Cavalcante
9d7422b817 File Browser: Improve usage of threads in the creation of thumbnails
Due to asynchronous process, the preview for a given image may be
generated several times.

This regenerates many thumbs unnecessarily.

The solution is to add the `FILE_ENTRY_PREVIEW_LOADING` flag for file
entries that are still in the thread queue.

So this flag is checked not to redraw the thumb when it is still being
created on a different thread.

Differential Revision: https://developer.blender.org/D11150
2021-11-16 14:10:24 -03:00
917218269e Merge branch 'blender-v3.0-release' 2021-11-16 13:59:28 -03:00
1572c4d3d3 Fix T93011: Individual origins being used when pivot point is override
There should be a special `t->around` for this case, but for now let's
just avoid having the individual origins overlap.
2021-11-16 13:56:11 -03:00
bd37553850 Cleanup: better delimit member initialization
The initialization of `t->around` and `t->view` was scattered and with
duplicate code
2021-11-16 13:55:30 -03:00
0335df9384 Transform: better contextualize the status bar
`Remove Last Snap Point` should only be displayed when there is a Snap Point to be removed.
2021-11-16 13:39:10 -03:00
ba6427adfa Merge branch 'blender-v3.0-release' 2021-11-16 17:25:48 +01:00
b3529ecf0e Fix CUDA error when using tiny border in viewport
Need to clamp scaled render buffers window to be above zero
when applying resolution divider.
2021-11-16 17:25:18 +01:00
72ee62e0da Fix crash on freeing hair system
Fix a crash when a hair system's `ParticleSettings` ID datablock was
linked from another file but couldn't be found. This results in default
settings, with `type = PART_EMITTER`, where the particle data still has
a non-NULL `hair` pointer. Previously, copies of such a particle system
would NOT copy hair data for non-hair particle systems, hence the
pointer of the copy pointed to the original data, which got freed (at
least) twice upon closing the blend file.

This is now fixed by always copying the hair data, regardless of the
particle system type.

Reviewed by: mont29

Differential Revision: https://developer.blender.org/D13245
2021-11-16 17:18:01 +01:00
bee7a56687 Cleanup: document that MEM_dupallocN is NULL-safe
Add comment explaining `MEM_dupallocN` is NULL-safe, in that it returns
NULL when it receives a NULL pointer. This is currently true for both
implementations of the function (`MEM_lockfree_dupallocN` and
`MEM_guarded_dupallocN`), and will be expected of other implementations
as well.

No functional changes.
2021-11-16 17:11:45 +01:00
07af45eec5 Asset Browser: hide catalog debug info behind debug option
Add a new "experimental" debug option `show_asset_debug_info`, and use
that to determine the visibility of the active asset's catalog UUID and
simple name. Previously this was only determined by the "Developer
Extras" option, which meant it was visible in too many situations. It's
not really a "developer extra", and really just a debugging tool, so the
new option is more in line with its purpose.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D13242
2021-11-16 16:49:27 +01:00
Michael Jones
64003fa4b0 Cycles: Adapt volumetric lambda functions to work on MSL
This patch adapts the existing volumetric read/write lambda functions for Metal. Lambda expressions are not supported on MSL, so two new macros `VOLUME_READ_LAMBDA` and `VOLUME_WRITE_LAMBDA` have been defined with a default implementation which, on Metal, is overridden to use inline function objects.

This patch also removes the last remaining mention of the now-unused `ccl_addr_space`.

Ref T92212

Reviewed By: leesonw

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D13234
2021-11-16 13:42:23 +00:00
85ac9b8584 Merge branch 'blender-v3.0-release' 2021-11-16 14:39:51 +01:00
ce0d817bb7 UI: Fix hard to read text for drag disabled hints
In 499dbb626a, the background color of drag tooltips were changed so
text becomes more readable. But multiple people were touching the same
code, so the disabled hint tooltips didn't get the same tweak. They
would benefit from them even more, since the red text is even harder to
read on the transparent background than the regular, white text.
2021-11-16 14:37:20 +01:00
12a986c9b5 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-16 13:10:35 +01:00
c7a1e115b5 Tests: fix memory leak of GHOST system paths
Dispose of GHOST system paths when tearing down `BlendfileLoadingBaseTest`
and some other test cases. This prevents a memory leak.

A better solution would be to rework Blender's initialisation & teardown
structure, but that's outside the scope of this fix.

No functional changes to Blender.
2021-11-16 13:07:11 +01:00
faa8aa3bb9 Asset Browser: Forbid dragging catalogs into themselves
While there is nothing technically that would cause issues when moving a
catalog into itself (it just changes the path of the catalog, and the
missing parent catalogs will be created), it seems broken to the user.
So disable this in the drag & drop code for asset catalogs.
2021-11-16 13:01:57 +01:00
052c22199d Asset Browser: use one more refresh operator
Refreshing the assets requires `file_OT_asset_library_refresh` in the
asset browser, and `asset_OT_list_refresh` for the asset view. Both
are now done from `ASSET_OT_open_containing_blend_file`.
2021-11-16 12:35:39 +01:00
7da714f387 Merge branch 'blender-v3.0-release' 2021-11-16 10:57:26 +01:00
Diptangshu Dey
da14a482f2 Fix T90866: Python operator templates are not accessible from menus
Python Operator templates made accessible from respective menus
(required to also use F3 search for quick access)
Also fixed Modal Draw Operator id_name (had duplicate name from other template)

Maniphest Tasks: T90866

Differential Revision: https://developer.blender.org/D13182
2021-11-16 10:45:23 +01:00
d4c868da9f Geometry Nodes: refactor virtual array system
Goals of this refactor:
* Simplify creating virtual arrays.
* Simplify passing virtual arrays around.
* Simplify converting between typed and generic virtual arrays.
* Reduce memory allocations.

As a quick reminder, a virtual arrays is a data structure that behaves like an
array (i.e. it can be accessed using an index). However, it may not actually
be stored as array internally. The two most important implementations
of virtual arrays are those that correspond to an actual plain array and those
that have the same value for every index. However, many more
implementations exist for various reasons (interfacing with legacy attributes,
unified iterator over all points in multiple splines, ...).

With this refactor the core types (`VArray`, `GVArray`, `VMutableArray` and
`GVMutableArray`) can be used like "normal values". They typically live
on the stack. Before, they were usually inside a `std::unique_ptr`. This makes
passing them around much easier. Creation of new virtual arrays is also
much simpler now due to some constructors. Memory allocations are
reduced by making use of small object optimization inside the core types.

Previously, `VArray` was a class with virtual methods that had to be overridden
to change the behavior of a the virtual array. Now,`VArray` has a fixed size
and has no virtual methods. Instead it contains a `VArrayImpl` that is
similar to the old `VArray`. `VArrayImpl` should rarely ever be used directly,
unless a new virtual array implementation is added.

To support the small object optimization for many `VArrayImpl` classes,
a new `blender::Any` type is added. It is similar to `std::any` with two
additional features. It has an adjustable inline buffer size and alignment.
The inline buffer size of `std::any` can't be relied on and is usually too
small for our use case here. Furthermore, `blender::Any` can store
additional user-defined type information without increasing the
stack size.

Differential Revision: https://developer.blender.org/D12986
2021-11-16 10:16:30 +01:00
6d35972b06 Merge branch 'blender-v3.0-release' 2021-11-16 09:58:47 +01:00
7d985d6b69 Fix T93066: Alembic export ignores Mantaflow particles
`ABCPointsWriter::is_supported` already checked for valid particle
system types (liquid, spray, foam, bubbles, ...).

`AbstractHierarchyIterator::make_writers_particle_systems` did not
create a writer for these though, so now bring these in line and also
create writers for these.
2021-11-16 09:41:09 +01:00
57ed435def Cleanup: Use C++ matrix identity constructor 2021-11-15 23:24:16 -06:00
7e42ae7c1a Cleanup: Typo in comments 2021-11-15 22:08:28 +01:00
165cacc6f0 VSE: Use alpha over as default blend mode
With transform tools, it is expected to see backgroud image when overlay
is transformed.

Alpha over caused performance to be not optimal when used with opaque
media. This should be addressed with D12914 at least partially. There
may be some corner cases not addressed.

Differential Revision: https://developer.blender.org/D12952
2021-11-15 21:07:25 +01:00
62da6ffe08 VSE: Use early out for aplha over blending
When scaling down image, users expect to see background, which doesn't
currently happen in VSE. This is because strips use cross blend mode by
default, because alpha over is much slower. Reason is, because any area
of image can be transparent, and therefore it can't have early out
implemented in a way that cross blend mode can.

Flag images rendered by codecs that don't support transparency as fully
opaque and implement a form of early out for alpha over blend mode.

When rendering image stack, 2-input effects are ignored on the
"way down". Alpha over needs rendered overlay image to decide whether it
will use only overlay or background too. Therefore overlay can be
rendered safely before it is used. Image flags can be checked and it can
be freed if needed. Freeing doesn't cause any performance degradation,
because image is always stored in cache.

This feature does not improve blend mode performance. In summary, it
only allowes for having alpha over blend mode on background images
without suffering from lower performance.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D12914
2021-11-15 21:03:43 +01:00
46f5f60c13 Merge branch 'blender-v3.0-release' 2021-11-15 20:33:34 +01:00
a040d2a93a Fix T90592: Incorrect scrollbar range with backdrop
`v2d->tot` rect was set for backdrop drawing. Set range before drawing
scrollbars.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D13099
2021-11-15 20:28:11 +01:00
7e148c45c8 Fix T90415: Missing cache invalidation
Some RNA properties and operators did not invalidate cache or did it
incorrectly.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13101
2021-11-15 20:23:57 +01:00
d3c45e1c39 Fix T91405: Block artefacts in WEBM video
Issue was caused by incorrect FFmpeg asynchronous decoding API. In most
cases, decoder returns 1 frame each time it is fed by 1 packet. Here
decoder wanted to return more frames, but our code always expected only
one.

Before sending new packets to decoder, check if there are frames to
receive. If there are, process them, otherwise continue decoding as
usual.

Reviewed By: zeddb, sergey

Differential Revision: https://developer.blender.org/D13079
2021-11-15 20:20:33 +01:00
ef8240e64c Fix T91992: Incorrect clip strip image size
When proxy size lower than 100% is used, clip strips are rendered with
incorrect image size.

This is because if proxies aren't enabled in movieclip, it automatically
falls back on rendering original media. Sequencer doesn't have knowledge
about this and since 9c99292a16 it assumes that image is proxy,
because it explicitly requested this size.

Check movieclip flag to see if proxies are enabled.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13080
2021-11-15 20:07:46 +01:00
10a6a540af Cleanup: remove unnecessary functions
Those functions were more useful when `FieldInferencingInterface`
was still declared further down in `node.cc`.
2021-11-15 18:04:03 +01:00
8976b72843 Merge branch 'blender-v3.0-release' 2021-11-15 09:10:19 -06:00
62da41d63d Fix: Incorrect socket identifier versioning
There were two issues:
 - The third math node socket does not exist in old enough files.
 - The comment incorrectly referred to the vector math node.

Differential Revision: https://developer.blender.org/D13219
2021-11-15 08:52:58 -06:00
c3472cb11c Fix T93074: Gpencil cutter not using flat caps in middle cuts
When cut an stroke using the option Flat Caps, the falt was not done if the cut was done in the middle of the stroke.

Now the flat is applied to the segments created and also some cleanup of the code done.
2021-11-15 12:17:11 +01:00
Jeroen Bakker
a5c59fb90e Fix T89260: Eevee crashes with custom node sockets.
Cause of this issue is that Custom Node Sockets info type was
initialized as SOCK_FLOAT when registering. Areas within the core that
would ignore custom socket types by checking its type would use the
socket as being a float type.

When custom node sockets have a property called default_value blender
tries to store it as an internal default value what failed in debug
builds.

This patch will set the socket type to SOCK_CUSTOM when registering a
custom socket type and allow, but skip storage of custom default values.
In this case the default values should already be stored as custom
properies.

Reviewed By: campbellbarton, JacquesLucke

Maniphest Tasks: T89260

Differential Revision: https://developer.blender.org/D13174
2021-11-15 08:13:22 +01:00
c2c65cc4bf Merge branch 'blender-v3.0-release' 2021-11-15 02:39:33 +01:00
622e6f05f1 Fix T92750: sculpt vertex colors missing in object mode
The layers were not aliased properly for usage in the shaders.

Regression caused by rB03013d19d167.
2021-11-15 02:38:52 +01:00
7e82c840b7 Fix text editor auto-close with quotes
Back-spacing a quote from the beginning of a line
would delete the quote in-front instead of doing nothing.
2021-11-14 11:26:06 +11:00
2549384baa Cleanup: minor tweaks to auto-close
Spelling and failure to reuse variable missed in review.
2021-11-14 11:11:20 +11:00
73047c69ea BLF: Use Floats for Font Point Sizes
Allow the use of floating-point values for font point sizes, which
allows greater precision and flexibility for text output.

See D8960 for more information, details, and justification.

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

Reviewed by Campbell Barton
2021-11-13 09:39:18 -08:00
e8a8bb67fc Cleanup: Correct order of guard and lock in moviecache_valfree
Fix own mistake in rB7061d1e39fe

In my attempt to quickly address T92838, along with the original bug, I
made a nonsensical choice to use the limiter lock to guard the check
against the cache item itself. While harmless, it is not necessary and
semantically wrong / potentially confusing to future readers of the code.

Differential Revision: https://developer.blender.org/D13122
2021-11-12 20:47:26 -08:00
ab9ec193c3 Fix splash screen showing on startup with files loaded by scripts
Suppressing the splash was only done when passing in an argument from
the command line.

Remove G.file_loaded, as it is misleading, only set once on startup,
replace with G.relbase_valid which is used everywhere else to check
if the file path should be used.
2021-11-13 14:05:27 +11:00
Matheus Santos
c4ea5cb1a3 Text Editor: Auto close relevant characters
Support the ability to close relevant characters like '(', '[' and '{'.

It will also delete the pair character if they're empty.

Ref D13119

Reviewed By: campbellbarton
2021-11-13 13:56:31 +11:00
1143bf281a Cleanup: spelling in comments, comment block formatting 2021-11-13 13:07:13 +11:00
acc800d24d Cleanup: clang-format 2021-11-13 12:47:18 +11:00
dc378bf1a4 Merge branch 'blender-v3.0-release' 2021-11-12 21:57:44 -03:00
0a6f428be7 Fix snapping not performing on selected bones or splines
This is an old issue but never reported as it is only visible in the measure tool snapping.
2021-11-12 21:56:42 -03:00
60b8eb30bb Merge branch 'blender-v3.0-release' 2021-11-12 21:36:35 -03:00
eed48a7322 Cleanup: reference some snap parameters in the snap context itself
This decreases the number of parameters in functions and makes important variables available in more places.
2021-11-12 21:34:19 -03:00
738f4fbc5e Revert "Fix T92636: Vector math node link disconnects when loading old file"
This reverts commit 6b4ca78108.

A simpler fix was used for 3.0, but rBd845ba481c6d2ef already contained
a more complete solution to the problem of inconsistent socket ids.
2021-11-12 17:14:27 -06:00
ebb4aba325 Merge branch 'blender-v3.0-release' 2021-11-12 17:12:39 -06:00
6b4ca78108 Fix T92636: Vector math node link disconnects when loading old file
Previously, unique identifiers for sockets were created automatically,
sometimes using .001 and sometimes _001. Now they are created
manually with the second format, but some files were saved with .001
format. I think this was only an issue in the vector math node.

rBd845ba481c6d fixed this problem in 3.1, but in a more general way.
After I merge this patch to 3.1, I will revert it, since the versioning
added in that commit will make this redundant.

Differential Revision: https://developer.blender.org/D13209
2021-11-12 17:07:38 -06:00
ec432ae998 Merge branch 'blender-v3.0-release' 2021-11-12 14:06:26 -06:00
8d3a771574 Fix: Node Class Type for Select by Handle Type
Change the node class type for Node Select by Handle Type to
NODE_CLASS_INPUT
2021-11-12 14:05:40 -06:00
55c69373e8 Cleanup: split 'initSnappingMode' into more specific functions
This helps to reuse small regions of a function's code elsewhere.

The logic had to be reorganized, theoretically it should behave the same way.
2021-11-12 16:30:01 -03:00
8b13cf5667 Cleanup: move 'imm_drawcircball' to 'gpu_immediate_util.c' 2021-11-12 16:30:01 -03:00
5941c39fbf Cleanup: fix some comments in the transform code 2021-11-12 16:30:01 -03:00
30f9034182 Cleanup: use 't->tsnap.mode' in transform code
This also prevents different snap modes from being used at the same time in the code.
2021-11-12 16:30:01 -03:00
e5a7dd8ab6 Cleanup: unify snap modes to geometry in a single flag
This combination was being repeated in some places.
2021-11-12 16:30:01 -03:00
5b787c24fb Merge branch 'blender-v3.0-release' 2021-11-12 13:26:26 -06:00
888b879f5f Fix: Incorrect transfer attribute error message with curves
The node does support curves, but only in index mode (see T88630)
So add a specific error message for the nearest mode, and let the
node support curves in the declaration.

Differential Revision: https://developer.blender.org/D13205
2021-11-12 13:25:22 -06:00
1b55b911f2 Merge branch 'blender-v3.0-release' 2021-11-12 20:04:05 +01:00
71131b4969 Tests: disable audio system for performance tests 2021-11-12 20:03:46 +01:00
b4d9b8b7f8 Fix T91893, T92455: wrong transmission pass with hair and multiscatter glass
We need to increase GPU memory usage a bit. Unfortunately we can't get away
with writing either reflection or transmission passes because these BSDFs may
scatter in either direction but still must be in a fixed reflection or
transmission category to match up with the color passes.
2021-11-12 20:03:46 +01:00
ef0b8d6306 Fix T92002: no Cycles combined baking support for filter settings 2021-11-12 20:03:46 +01:00
d845ba481c Fix T91826: Inconsistent node socket name identifier separator
Previously both `.` and `_` were used as separators when finding
a unique name for a socket. This removes the use of `.`, since `_`
was more common. It also does versioning for all of a file's node
trees to make sure that they all use the `_` convention.

Differential Revision: https://developer.blender.org/D13181
2021-11-12 12:22:43 -06:00
cbca71a7cf Cleanup: Move remaning node editor files to C++
Differential Revision: https://developer.blender.org/D13200
2021-11-12 12:12:27 -06:00
809ae823b7 Merge branch 'blender-v3.0-release' 2021-11-12 19:00:23 +01:00
9d0d4b8601 Fix T93029: OptiX denoising artifacts at high sample counts in specific scenes
Partially reverts commit rB440a3475b8f5410e5c41bfbed5ce82771b41356f because
"optixDenoiserComputeIntensity" does not currently support input images that are not packed (the
"pixelStrideInBytes" field is not zero). As a result the intensity calculation would take into account
data from other passes in the image, some of which was scaled by the number of samples still and
therefore produce widely incorrect results that then caused artifacts in the denoised image.

Maniphest Tasks: T93029
2021-11-12 18:59:50 +01:00
8a8bf99717 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-12 18:23:44 +01:00
2b394e1108 UI: (Performance) Avoid drawing buttons out of view
The UI was always drawing all buttons in a layout, no matter if they
were scrolled out of view (as in, outside of the visible part of the
region) or not. This means it's doing quite some work that can be
avoided.
UI drawing generally isn't a big bottleneck in Blender, so I don't
expect huge speedups from this. But while playing back animation, we do
redraw a fair bit of the UI, so in cases where there are many buttons
out of view, it may bring a little FPS boost. E.g. say in complex node
trees (the node editor is redrawn on animation playback in case there
are animated values that need updated UI feedback). This also mitigates
the issue in T92922 significantly.

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

Reviewed by: Brecht Van Lommel
2021-11-12 18:21:12 +01:00
Yevgeny Makarov
a89529d8db UI: Do not shade alpha when blending colors
UI_GetThemeColorBlendShade4fv incorrectly changing alpha by the amount
of the shading offset.

See D9944 for more details.

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

Reviewed by Hans Goudey
2021-11-12 08:55:20 -08:00
9f5290e3bc Fix T93007: Cycles not updating for animated Object properties like color 2021-11-12 08:55:20 -08:00
c671b5eee4 Fix Cycles ray visibility panel missing for volume objects 2021-11-12 08:55:20 -08:00
Yevgeny Makarov
896d3f1ce5 UI: Do not shade alpha when blending colors
UI_GetThemeColorBlendShade4fv incorrectly changing alpha by the amount
of the shading offset.

See D9944 for more details.

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

Reviewed by Hans Goudey
2021-11-12 08:51:31 -08:00
76105eb752 Fix T93007: Cycles not updating for animated Object properties like color 2021-11-12 17:09:21 +01:00
d48523cb4d Fix Cycles ray visibility panel missing for volume objects 2021-11-12 16:18:07 +01:00
ddf66cd060 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-12 14:36:55 +01:00
b4cfe80547 Assets: Store Action sub-type in asset metadata
Blender 3.0 will only support single-frame Actions in the pose library.
The goal of this patch is to lay the groundwork for making it possible
for the Asset Browser to reject/hide "animation snippet" Action assets.

Determining whether an Action has one or more frames (i.e. whether it
has a single pose or animation) requires inspecting the Action itself,
and thus loading the data-block itself. This would make it impossible to
quickly determine from the asset browser.

To solve this, the Action is inspected before saving, and a
`"is_single_frame"` boolean (well, 0/1 integer) IDProperty is added.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D13202
2021-11-12 14:36:22 +01:00
c7a88cf91a Merge branch 'blender-v3.0-release' 2021-11-13 00:31:03 +11:00
5f7d5c0809 Gizmo: adjust when gizmo protection flags are displayed
Restore behavior reverted in
0ea60cf6b8 but only for location
as it makes sense to use protection flags in global mode in that case.
2021-11-13 00:28:13 +11:00
a470e3c9d1 Merge branch 'blender-v3.0-release' 2021-11-13 00:20:07 +11:00
0ea60cf6b8 Fix gizmo protection flag use in object mode
Channel protection flags were only used in global mode,
this doesn't make any sense, especially for rotation and scale.

Follow pose-bones, only using protection flags for
local & gimbal orientation.
2021-11-13 00:19:36 +11:00
3fe735d371 Geometry Nodes: Add Outer Points Selection to Star
Adds a boolean field output containing a selection of the
points of the star that are controlled by the outer radius
of the star.

Differential Revision: https://developer.blender.org/D13097
2021-11-12 06:44:41 -06:00
a47359ff36 Merge branch 'blender-v3.0-release' 2021-11-12 11:52:49 +01:00
de8a46c6ad Fix T93008: Cycles: Huge memory spike when saving tile to disk
The root of the problem lies in bug in OIIO which we can work around
from our side (which does not affect pack memory usage).

Thanks Brecht for finding the root cause!

Differential Revision: https://developer.blender.org/D13186
2021-11-12 11:20:01 +01:00
26502f3d89 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-12 10:52:12 +01:00
2b633f12ad Fix crash in asset browser when switching from file browser
When the file browser is in asset browser mode, it sets the callback
`filelist->prepare_filter_fn` to an asset browser specific function. This
function will segfault if there is no current asset library. Switching back
from asset browser to file browser would not reset that callback to
`NULL`, causing it to be called and crash Blender. This is now fixed.
2021-11-12 10:51:09 +01:00
86ca206db8 Cleanup/document BKE_blender_copybuffer.
* Rename the 'copy' functions to make it clear they belong to the same
  'group' and are to be used together.
* Fix `flag` parameter of `BKE_copybuffer_paste` being a short instead
  of an int.
* Improve documentation.
2021-11-12 10:20:49 +01:00
William Leeson
456876208b Fix T92601: Disable profiling when the profiler is deemed not active.
Adds a method to profiler that can be used to check if it is active.
This is used to determine if stop_profiling and start_profiling
should be called.

| patch | Juans Scene UI 256 samples | Juans Scene bg 256 samples | junkshop UI | junkshop bg |
| No patch | 6:16.59 | 4:05.37 | 2:08.48 | 1:59.7 |
| D13187   | 4:12.15 | 3:57.36 | 2:07.25 | 1:58.16 |
| D13185   | 4.11.18 |3:54.74 | 2:07.44 | 1:58.03 |
| D13190   | 4:12.39 | 3:55.42 | 2:07.62 | 1:58.68 |

UI - means rendered from within Blender
bg - means rendered from the command line using ##blender -b scene.blend -f 1##

Reviewed By: sergey, brecht

Maniphest Tasks: T92601

Differential Revision: https://developer.blender.org/D13190
2021-11-12 10:16:01 +01:00
William Leeson
32c7687859 Fix T92601: Disable profiling when the profiler is deemed not active.
Adds a method to profiler that can be used to check if it is active.
This is used to determine if stop_profiling and start_profiling
should be called.

| patch | Juans Scene UI 256 samples | Juans Scene bg 256 samples | junkshop UI | junkshop bg |
| No patch | 6:16.59 | 4:05.37 | 2:08.48 | 1:59.7 |
| D13187   | 4:12.15 | 3:57.36 | 2:07.25 | 1:58.16 |
| D13185   | 4.11.18 |3:54.74 | 2:07.44 | 1:58.03 |
| D13190   | 4:12.39 | 3:55.42 | 2:07.62 | 1:58.68 |

UI - means rendered from within Blender
bg - means rendered from the command line using ##blender -b scene.blend -f 1##

Reviewed By: sergey, brecht

Maniphest Tasks: T92601

Differential Revision: https://developer.blender.org/D13190
2021-11-12 10:01:48 +01:00
a87253942d Cleanup: Remove GHOST_isUpsideDownContext.
GHOST API only has a header definition. No implementation or usage.
2021-11-12 09:38:25 +01:00
ae74ad191c Merge branch 'blender-v3.0-release' 2021-11-12 18:35:22 +11:00
aa1c44a113 Merge branch 'blender-v3.0-release' 2021-11-12 18:35:19 +11:00
5c0d4753cf Merge branch 'blender-v3.0-release' 2021-11-12 18:35:16 +11:00
02333544d1 Merge branch 'blender-v3.0-release' 2021-11-12 18:35:13 +11:00
1061f5a1ba Cleanup: remove redundant loop-index access
Use a counter for loop indices as they're being iterated in order.
2021-11-12 18:33:05 +11:00
1a7757b0bc Fix T91444: Edge Loop Preview fails with two Mirror Modifiers
The mirror modifiers merge option caused unnecessary re-ordering
to the vertex array with original vertices merging into their copies.

While this wasn't an error, it meant creating a 1:1 mapping from input
vertices to their final output wasn't reliable (when looping over
vertices first to last) as is done in
BKE_editmesh_vert_coords_when_deformed.

As merging in either direction is supported, keep the source meshes
vertices in-order since it allows the vertex coordinates to be extracted.
2021-11-12 18:27:47 +11:00
f133c6b094 Fix crash saving blend files in background mode
Reading the windows pixels was attempted in background mode.
2021-11-12 18:05:27 +11:00
d612d92630 Cleanup: use term sequence_strip instead of vse_strip 2021-11-12 17:38:58 +11:00
1e1c870001 Cleanup: Improve comment 2021-11-11 21:57:40 -06:00
0533f2851e Geometry Nodes: change selection output order in Cylinder node
This new order is a bit more intuitive.
2021-11-11 19:53:02 +01:00
d6e682a7b0 Merge branch 'blender-v3.0-release' 2021-11-11 19:50:24 +01:00
bd734cc441 Fix: Attribute Transfer node does not work with a single index
Differential Revision: https://developer.blender.org/D13194
2021-11-11 19:49:20 +01:00
e61da8e4fb Merge branch 'blender-v3.0-release' 2021-11-11 11:47:43 -06:00
f3bdabbe24 Fix: Incorrect modifier warning with non-geometry input first
The code assumed that any geometry input that wasn't the first input
was a second geometry input. Fix by separating the warning for the
first input and for the number of geometry inputs.
2021-11-11 11:47:19 -06:00
50f32025ac Merge branch 'blender-v3.0-release' 2021-11-11 18:27:31 +01:00
393879f30c Fix: wrong field inferencing with unavailable sockets 2021-11-11 18:26:40 +01:00
3d9c8397fc Fix T93005: Cycles shadow catcher not inherited by instances 2021-11-11 18:12:05 +01:00
c9c7658926 Geometry Nodes: Add Offset to Handle Position Node
Adds a vector offset field to the "Curve Handle Position Node".
This vector is added to the incoming position (which is the
implicit handle position if not connected) which will set the
position of the handle. Default is (0,0,0)

Differential Revision: https://developer.blender.org/D13035
2021-11-11 10:58:23 -06:00
3ca41b7312 Merge branch 'blender-v3.0-release' 2021-11-11 10:16:35 -06:00
Peter Sergay
4bc08b79aa UI: Updated Blender Light theme for Spreadsheet
This patch adds list colors to the light theme for the spreadsheet,
which are needed for the data set region. Addresses T92492.

Differential Revision: https://developer.blender.org/D13090
2021-11-11 10:10:28 -06:00
25e7365d0d Cleanup CUDA / HIP comments
Remove outdated CUDA comments for bindless textures and cleanup some HIP comments that still mentioned CUDA.

Differential Revision: https://developer.blender.org/D13189
2021-11-11 16:37:29 +01:00
52c617802f Merge branch 'blender-v3.0-release' 2021-11-11 09:27:42 -06:00
Martijn Versteegh
7aa39b40f4 Fix: Prevent use of uninitialized memory when creating Bezier spline
When Constructing bezier splines from dna, the positions of the
left/right handles were set directly in the internal vectors, by
requesting a reference to them. The problem is that
BezierSpline::handle_positions_left() calls ensure_auto_handles()
before returning the reference. That function does some calculations on
uninitialized memory if the positions array is not yet filled.

Differential Revision: https://developer.blender.org/D13107
2021-11-11 09:25:10 -06:00
ce395c84a3 Merge branch 'blender-v3.0-release' 2021-11-11 15:29:35 +01:00
d26d3cfe19 Fix T92868: Cycles catcher with transparency crashes
The issue was caused by splitting happening twice.

Fixed by checking for split flag which is assigned to the both states
during split.

The tricky part was to write catcher data at the moment of split: the
transparency and shadow catcher sample count is to be accumulated at
that point. Now it is happening in the `intersect_closest` kernel.
The downside is that render buffer is to be passed to the kernel, but
the benefit is that extra split bounce check is not needed now.

Had to move the passes write to shadow catcher header, since include
of `film/passes.h` causes all the fun of requirement to have BSDF
data structures available.

Differential Revision: https://developer.blender.org/D13177
2021-11-11 15:21:35 +01:00
06a74e7816 LibLink/Append tests: Add basic testing of bpy.data.libraries.load code. 2021-11-11 14:54:26 +01:00
9f31b9b7d3 Merge branch 'blender-v3.0-release' 2021-11-11 14:33:28 +01:00
9be6880d02 Fix (unreported) bad handling of reports in libraries.load code.
rB60fee69682ac39 only partially fixed the issue, `BlendFileReadReport
bf_reports` was now properly stored in `BPy_Library` `self` for the
lifetime of the context, but its `reports` member was still referencing
local variable to `bpy_lib_enter` function.
2021-11-11 14:29:14 +01:00
4a98faf9f1 Merge branch 'blender-v3.0-release' 2021-11-11 21:34:05 +11:00
8c240f50b2 Merge branch 'blender-v3.0-release' 2021-11-11 21:34:02 +11:00
b7e2408ea4 Fix T92867: Gimbal rotation broken when used for multiple objects
Support gimbal orientation for objects & bones.
2021-11-11 21:33:09 +11:00
bb64155c63 Cleanup: split gimbal_axis into pose and object
Allow access to a single bones gimbal matrix.
2021-11-11 21:14:08 +11:00
Andrii
c63e735f6b Cycles: Add sample offset option
This patch exposes the sampling offset option to Blender. It is located in the "Sampling > Advanced" panel.
For example, this can be useful to parallelize rendering and distribute different chunks of samples for each computer to render.

---

I also had to add this option to `RenderWork` and `RenderScheduler` classes so that the sample count in the status string can be calculated correctly.

Reviewed By: leesonw

Differential Revision: https://developer.blender.org/D13086
2021-11-11 09:39:25 +01:00
b8d53b703a Merge branch 'blender-v3.0-release' 2021-11-11 15:00:23 +11:00
9787b46f09 Merge branch 'blender-v3.0-release' 2021-11-11 15:00:20 +11:00
03f0be35d6 Merge branch 'blender-v3.0-release' 2021-11-11 15:00:17 +11:00
d753ebd40a Cleanup: spelling in comments 2021-11-11 14:59:30 +11:00
ddf0bacaa9 Cleanup: typo in function name 2021-11-11 14:58:55 +11:00
3929db265f Fix T92954: Loop Cut Tool preview line visible during operation
Apply a local-workaround instead of adding support for this use-case
since pre-selection isn't the intended purpose of gizmos.

This also resolves a glitch where poly-build and loop cut would
briefly show loop-cut or poly-build pre-selection after transforming.

See gizmo_preselect_poll_for_draw note for more details.
2021-11-11 14:58:55 +11:00
e1bd4bbb66 UI: Introduce View pie in more editors
#### Motivation

The View pie menu is a convenient way to access operators such as `Frame Selected` and `Frame All` which are usually mapped to `PERIOD` or `HOME` keys on the right side of most keyboard, making it hard hard to reach with the left hand.

The motivation for this patch comes from working with a 75% keyboard (no numpad). Most laptops face a similar problem.

#### Implementation

The View pie menu has been added to the following editors and sub-modes where applicable:

* Node Editor
* Video Sequencer
* Dopesheet
* Graph
* NLA
* Image
* Clip
* Outliner

More options could definitely be added to this menu for convenience, as long as it maintains the common options in the same place (Frame Selected on the left, Frame All on the right).

For positioning I went with the following layout:
{F11791186, size=full}

I've added `Zoom 1:1`to the Image Editor and the VSE Preview since there is no way to reset the zoom on keyboards without numpad (unless Emulate Numpad is turned on).

The Outliner uses `Show Active` and `Show Hierarchy` which are the closest ones to the equivalent in other editors. Should `Show Active` be renamed to `Frame Selected`?

The shortcut assigned is the same as the 3D Viewport (`ACCENT_GRAVE`).

#### Screenshots

Node Editor
{F11778387, size=full}

Dopesheet
{F11778400, size=full}

Graph
{F11778403, size=full}

Image Editor (Paint and View)
{F11791113, size=full}

Image Editor (Mask)
{F11791114, size=full}

UV Editor
{F11791119, size=full}

Clip Editor (Tracking)
{F11791137, size=full}

Clip Editor (Mask)
{F11791140, size=full}

Clip Editor (Graph)
{F11791151, size=full}
View operators are not yet implemented in Clip Editor Dopesheet mode (left a note about this in the menu poll).

Reviewed By: #user_interface, campbellbarton

Differential Revision: https://developer.blender.org/D13169
2021-11-11 01:18:50 +01:00
f1a8644121 Cleanup: Move interface_region_search.c to C++
This will be helpful for solving a bug with search during animation
playback, T89313. I tested this on all platforms on the buildbot.
2021-11-10 15:49:49 -06:00
1ec7075ff2 Merge branch 'blender-v3.0-release' 2021-11-10 15:44:13 -06:00
22ffd69a91 Fix T89313: Attribute search crash with animation playback
rBc473b2ce8bdbf8fa42 improved the situation somewhat, but
attribute search still crashes during animation playback, because
the UI search data references stale memory. The proper solution
is to allow the search to own data rather than just referencing it,
but I would prefer not to do that for 3.0. In the meantime, just
disable attribute search when animation is playing.

Differential Revision: https://developer.blender.org/D13179
2021-11-10 15:43:18 -06:00
9ca8bf0b29 Merge branch 'blender-v3.0-release' 2021-11-10 22:28:03 +01:00
040630bb9a Fix wrong device check in HIP kernel compile.
Also cleanup some related code, that was falsely copied from CUDA.

Differential Revision: https://developer.blender.org/D13180
2021-11-10 22:24:53 +01:00
3fa86f4b28 Merge branch 'blender-v3.0-release' 2021-11-10 20:19:09 +01:00
7689f501e2 Cycles: enable HIP device and binaries on Windows
We've now done testing to confirm this works with RDNA and RDNA2 AMD GPUs
on Windows. The AMD driver needed for this will soon be released publicly.
2021-11-10 20:16:44 +01:00
Thomas Dinges
e507a789b3 Cycles: disable graphics interop for HIP devices
This is due to a driver bug, so disable it for now until it gets resolved
in a future driver release.

Ref T92972

Differential Revision: https://developer.blender.org/D13167
2021-11-10 20:16:44 +01:00
6b0008129e Fix T92972: Cycles HIP wrong render display after a recent refactor
It's unclear why this fails. Maybe the size of half4 is not the expected
8 bytes and adjacent pixels are overwritten. Or there is some bug in the
HIP compiler writing a struct into global memory, which we probably don't
do elsewhere in the kernel.

Thanks to Thomas, William and Jeroen for helping investigate this.
2021-11-10 20:03:07 +01:00
c8e93da0a7 Fix Cycles assert in denoising fallback to OIDN 2021-11-10 19:56:30 +01:00
abf62d06d1 Merge branch 'blender-v3.0-release' 2021-11-10 11:11:58 -06:00
35ae7ab933 Cleanup: Use bool instead of int 2021-11-10 11:11:35 -06:00
cc17ed26ce Merge branch 'blender-v3.0-release' 2021-11-10 10:52:34 -06:00
20224369d9 Geometry Nodes: Clarify modifier node group errors
This commit adds modifier error messages to some of the cases
where the node group is configured improperly. It also clears the
geometry set when there is an error with the node group. This is
consistent to what we do in nodes themselves, and feels more
intuitive than passing the input geometry through the node group
silently.

Fixes T87142
2021-11-10 10:52:18 -06:00
e9b7e5e0b9 Merge branch 'blender-v3.0-release' 2021-11-10 10:47:09 -06:00
67e5edbaa3 Fix: Incorrect translation search for modifier error messages
This function was renamed in rB2bb9a465e6c0e1ca765, but it looks like
that commit missed changing the corresponding translation regular
expression.

Differential Revision: https://developer.blender.org/D13171
2021-11-10 10:46:49 -06:00
f565620435 Fix T92985: CUDA errors with Cycles film convert kernels
rB3a4c8f406a3a3bf0627477c6183a594fa707a6e2 changed the macros that create the film
convert kernel entry points, but in the process accidentally changed the parameter definition
to one of those (which caused CUDA launch and misaligned address errors) and changed the
implementation as well. This restores the correct implementation from before.

In addition, the `ccl_gpu_kernel_threads` macro did not work as intended and caused the
generated launch bounds to end up with an incorrect input for the second parameter (it was
set to "thread_num_registers", rather than the result of the block number calculation). I'm
not entirely sure why, as the macro definition looked sound to me. Decided to simply go with
two separate macros instead, to simplify and solve this.

Also changed how state is captured with the `ccl_gpu_kernel_lambda` macro slightly, to avoid
a compiler warning (expression has no effect) that otherwise occurred.

Maniphest Tasks: T92985

Differential Revision: https://developer.blender.org/D13175
2021-11-10 15:49:50 +01:00
a6e4cb092e Merge branch 'blender-v3.0-release' 2021-11-10 13:53:44 +01:00
Jeroen Bakker
bc0c06ecbe Fix T91518: crash when recalculating looptris after clearing geometry.
When clearing geometry the runtime mutexes of a mesh were freed. This
resulted in crashes afterwards. The clear geometry is an RNA function so
would only effect when using from scripts.

This patch separates init/freeing of the mutexes from other code so they
can be used when needed.

Reviewed By: mont29

Maniphest Tasks: T91518

Differential Revision: https://developer.blender.org/D13142
2021-11-10 13:50:15 +01:00
53468c2b13 Merge branch 'blender-v3.0-release' 2021-11-10 13:43:08 +01:00
47b8baa5c4 Fix T92864: curve object does not sync correctly in cycles
The issue was that the `object_is_geometry` method was used in two different
contexts that expected the function to behave differently. So a recent change
that fixed `object_is_geometry` for one context, broke it for the other context.
The two contexts are:
* Check if a "real" object can contain a geometry to check if it has to be tagged
  for sync after an update.
* Check if an object/instance actually is a geometry that cycles can work with.

I created a new `object_can_have_geometry` method for the first use case, instead
of trying to adapt the existing object_is_geometry method to serve both uses.
Additionally, I changed it so that a BObjectInfo is passed into `object_is_geometry`
to make it more explicit when this method is supposed to be used.

Differential Revision: https://developer.blender.org/D13135
2021-11-10 13:38:07 +01:00
03e22da665 Merge branch 'blender-v3.0-release' 2021-11-10 12:47:01 +01:00
aa2f6e5977 Fix T92979: Emission Strength Animation read wrong in 3.0
First this was wrong for files written in 2.93 read into blender in 3.0
after the CyclesX merge.
Then this was fixed by versioning in rB6321dd3d4007.
But this caused files written in 3.0 to have this versioning applied as
well (leading to socket shifting).

Now only do the versioning for files created before the CyclesX
merge.

Maniphest Tasks: T92979

Differential Revision: https://developer.blender.org/D13173
2021-11-10 12:45:41 +01:00
ff0c42acfc Merge branch 'blender-v3.0-release' 2021-11-10 21:22:01 +11:00
a49d6a5350 Merge branch 'blender-v3.0-release' 2021-11-10 21:21:58 +11:00
bec72a43ae Fix T92874: Custom normals reset when vertex is deleted
Storing and restoring custom normals was broken by
39b2a7bb7e

This also caused "Sharp Edge" option for Weld by Distance to fail,
reported as T92875.
2021-11-10 21:11:41 +11:00
aa440923c8 Fix: Hide selection value in resample curve node, fix order
Selection sockets are meant to come right after the geometry,
this was missed in review of rBa7672caeb255e3.
Also, the selection value was not hidden.
2021-11-09 17:23:11 -06:00
1f6010e609 Cleanup: Move info_stats.c to C++ 2021-11-09 15:57:58 -06:00
Michael Jones
3a4c8f406a Cycles: Adapt shared kernel/device/gpu layer for MSL
This patch adapts the shared kernel entrypoints so that they can be compiled as MSL (Metal Shading Language). Where possible, the adaptations avoid changes in common code.

In MSL, kernel function inputs are explicitly bound to resources. In the case of argument buffers, we declare a struct containing the kernel arguments, accessible via device pointer. This differs from CUDA and HIP where kernel function arguments are declared as traditional C-style function parameters. This patch adapts the entrypoints declared in kernel.h so that they can be translated via a new `ccl_gpu_kernel_signature` macro into the required parameter struct + kernel entrypoint pairing for MSL.

MSL buffer attribution must be applied to function parameters or non-static class data members. To allow universal access to the integrator state, kernel data, and texture fetch adapters, we wrap all of the shared kernel code in a `MetalKernelContext` class. This is achieved by bracketing the appropriate kernel headers with "context_begin.h" and "context_end.h" on Metal. When calling deeper into the kernel code, we must reference the context class (e.g. `context.integrator_init_from_camera`). This extra prefixing is performed by a set of defines in "context_end.h". These will require explicit maintenance if entrypoints change. We invite discussion on more maintainable ways to enforce correctness.

Lambda expressions are not supported on MSL, so a new `ccl_gpu_kernel_lambda` macro generates an inline function object and optionally capturing any required state. This yields the same behaviour. This approach is applied to all parallel_... implementations which are templated by operation. The lambda expressions in the film_convert... kernels don't adapt cleanly to use function objects. However, these entrypoints can be macro-generated more concisely to avoid lambda expressions entirely, instead relying on constant folding to handle the pixel/channel conversions.

A separate implementation of `gpu_parallel_active_index_array` is provided for Metal to workaround some subtle differences in SIMD width, and also to encapsulate some required thread parameters which must be declared as explicit entrypoint function parameters.

Ref T92212

Reviewed By: brecht

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D13109
2021-11-09 21:43:10 +00:00
7b530c6096 Fix: Incorrect assert in dot grid drawing
It's totally valid for the grid levels to be zero.
2021-11-09 13:15:34 -06:00
4648c4990c Merge branch 'blender-v3.0-release' 2021-11-09 13:08:36 -06:00
44239fa106 Fix: Crash with no active object after recent commit
rBaa13c4b386b13111 added a check for the active object
in drawing code, but it missed adding a check for the active
base before trying to retrieve its object.
2021-11-09 12:59:20 -06:00
7c25399576 tests/benchmarks: Fix operation on windows
The test script did not work on windows
since it had some trouble importing the
api module on the blender side of things.

turning the file path to the module into
a raw string literal sidesteps the
backslash issue in the path.

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

Reviewed by: brecht
2021-11-09 09:58:48 -07:00
a356e4fb3f Merge branch 'blender-v3.0-release' 2021-11-09 17:53:15 +01:00
4f246b8bf9 Fix T92908: print warning when instance recursion limit is reached
Currently we have a fixed instance recursion limit. While we want to lift this
limitation at some point, that is out of scope for a bug fix. For now just print
a warning to make it easier to detect the issue.

Differential Revision: https://developer.blender.org/D13162
2021-11-09 17:52:40 +01:00
7383f95443 Merge branch 'blender-v3.0-release' 2021-11-09 11:43:18 -05:00
74fe19b193 UI: use plural form of "Gizmo" in Gizmo display menus
Because the menus list several gizmo visibility settings it makes grammatical sense that the panel name is plural.

This also matches the "Overlays" menu.
2021-11-09 11:42:26 -05:00
fd0ba6449b Cycles: mark both RDNA and RDNA2 as support for HIP 2021-11-09 17:38:25 +01:00
ed0df0f3c6 Merge branch 'blender-v3.0-release' 2021-11-09 10:15:20 -06:00
aa13c4b386 Viewport: Remove different outline color for instances
With instancing becoming more common with geometry nodes,
instances are less of a separate thing and more of an essential part
of evaluated data. Displaying them with a separate outline, while
helpful in some cases, is not worth the lack of visibility or confusion
about selected/active status. Information about the performance
of the scene due to instancing is always available with the statistics
like vertex count, etc.

The problems were compounded by the fact that the instancing
system is used to output geometry components that don't correspond
to the object's original type. So this patch also fixes that problem.

Fixes T92079, T81010
Ref T91310

Differential Revision: https://developer.blender.org/D13133
2021-11-09 10:12:05 -06:00
e5fb5c9d7b Merge branch 'blender-v3.0-release' 2021-11-09 17:07:41 +01:00
Demeter Dzadik
e452c43fd6 Let Unlink Action operator have an undo step
I noticed while rigging a character and editing actions that the Unlink Action operator had no undo step. Doesn't feel intentional, so this patch adds the necessary flags.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D12346
2021-11-09 16:58:39 +01:00
570331ca96 Fix T92928: Geometry nodes animation decorator wrong for vectors
Decorators were only added for the first item of an array.

Decorators for all items of an array are added:
- if the layout is flagged `UI_ITEM_PROP_DECORATE` automatically in
`uiItemFullR` or
- calling `uiItemDecoratorR` (but only in certain situations, see below)

When calling `uiItemDecoratorR` with an index of 0, the following
happens:
- the index is passed to `uiItemDecoratorR_prop`
- that checks with `ui_item_rna_is_expand` if decorators should be added
to all items of an array
- the check fails (because it only permits RNA_NO_INDEX -- which is -1)

So two things we can do:
- remain using `uiItemDecoratorR` (that would require to pass an index
of RNA_NO_INDEX -- a bad level include -- or -1
- just use `uiLayoutSetPropDecorate` to flag the row properly

This patch does later.

Differential Revision: https://developer.blender.org/D13159
2021-11-09 16:54:50 +01:00
0bdf9d10a4 Merge branch 'blender-v3.0-release' 2021-11-09 16:46:58 +01:00
cc949f0a40 Fix: wrong attribute propagation in Distribute node
Currently the Distribute Points on Faces node does not propagate
non-point attributes correctly. That is because it first interpolates the
attributes to the point domain on the input mesh, and then propagates them.

Differential Revision: https://developer.blender.org/D13148
2021-11-09 16:46:04 +01:00
fb0ae66ee5 Merge branch 'blender-v3.0-release' 2021-11-09 16:10:19 +01:00
Pablo Vazquez
368d794407 Cleanup: Remove SMALL_TRI_RIGHT_VEC icon
Since the recent change to context paths to use the arrow icon instead of the triangle (D13106),
the `SMALL_TRI_RIGHT_VEC`is no longer used. This patch removes the icon and all references.

- Replace `SMALL_TRI_RIGHT_VEC` with `RIGHTARROW` in Freestyle UI
- Remove references to `SMALL_TRI_RIGHT_VEC` and `ICON_SMALL_TRI_RIGHT_VEC`.

Fix for built-in add-ons has been done in rBAcc2f71bfe9b0/rBAa84028f8a89a.

This will be added to the list of breaking changes [[ https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Python_API#Breaking_Changes | in the Wiki ]].

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D13130
2021-11-09 16:09:53 +01:00
8eff3b5fe0 Cycles: add AMD driver version info for HIP on Windows 2021-11-09 15:42:48 +01:00
5f44298280 Fix T92645: Cycles OSL crash due use of uninitialized pointer
Thanks to Ilja Razinkov for identifying the problem and solution.
2021-11-09 15:29:41 +01:00
9dc3f454d9 Merge branch 'blender-v3.0-release' 2021-11-09 11:27:25 -03:00
9b2f212016 Fix T92939: Crash on drop when a curve is the active object
The active object was being set as the edited object even though it was
not in edit mode.
2021-11-09 11:26:45 -03:00
07a4338b3a View3D Snap Cursor: make the pool a little more restrictive
The snap cursor tagged overlapping regions to redrawn even though the
cursor itself is not drawn.
2021-11-09 11:26:41 -03:00
Demeter Dzadik
c092cc35b3 Expose BLI_string_flip_side_name as bpy.utils.flip_name
Expose a new function in `bpy.utils.flip_name(name, strip_number=False)
that allows flipping bone names, eg "Bone.L" -> "Bone.R".

Useful for add-ons to avoid re-implementing Blender's name flipping.

Ref D12322
2021-11-10 01:19:04 +11:00
accdd4c1bc Merge branch 'blender-v3.0-release' 2021-11-09 15:08:37 +01:00
41607ced2b Node Editor: Display warning when using Nishita sky texture with Eevee
Nishita sky is not available in Eevee, display a warning to make this clear inside the Sky texture node.

Differential Revision: https://developer.blender.org/D13161
2021-11-09 15:07:29 +01:00
625349a6bd Cleanup: spelling, C style comments 2021-11-10 00:56:17 +11:00
65bbac6692 Cleanup: clang-format 2021-11-10 00:55:38 +11:00
faeb2cc900 Merge branch 'blender-v3.0-release' 2021-11-09 14:49:47 +01:00
440a3475b8 Cycles: Improve OptiX denoising with dark images and fix crash when denoiser is destroyed
Adds a pass before denoising that calculates the intensity of the image, which can be
passed into the OptiX denoiser for more optimal results for very dark or very bright images.

In addition this also fixes a crash that sometimes occurred on exit. The OptiX denoiser object
has to be destroyed before the OptiX device context object (since it references that). But in
C++ the destructor function of a class is called before its fields are destructed, so
"~OptiXDevice" was always called before "OptiXDevice::~Denoiser" and therefore
"optixDeviceContextDestroy" was called before "optixDenoiserDestroy", hence the crash.

Differential Revision: https://developer.blender.org/D13160
2021-11-09 14:49:00 +01:00
9daf6a69a6 Fix T92472: OptiX denoising artifacts with recent GPU driver 495.29.05 or newer on Linux
Adds a workaround for a driver bug in r495 that causes artifacts with OptiX denoising.
`optixDenoiserSetup` is not working properly there when called with a stream other than the
default stream, so use the default stream for now and force synchronization across the entire
context afterwards to ensure the other stream Cycles uses to enqueue the actual denoising
command cannot execute before the denoising setup has finished.

Maniphest Tasks: T92472

Differential Revision: https://developer.blender.org/D13158
2021-11-09 14:47:26 +01:00
0bcf014bcf Merge branch 'blender-v3.0-release' 2021-11-10 00:38:51 +11:00
65c5ebf577 Fix T91923: Save/Apply as Shape Key ignores shape keys
Support virtual modifiers when using applying the modifier as a shape.
2021-11-10 00:33:22 +11:00
0b01b81754 Tests: disable Cycles tests based on more build options
WITH_OPENCOLORIO and WITH_COMPOSITOR are required to run the tests at all,
since they affect many tests.

WITH_OPENSUBDIV WITH_FREESTYLE, WITH_OPENVDB, WITH_OPENIMAGEDENOISE and
WITH_MOD_FLUID selectively disable some tests.
2021-11-09 13:55:35 +01:00
41b0820ddd Merge branch 'blender-v3.0-release' 2021-11-09 13:31:33 +01:00
45bd98d4cf Fix T92934: crash rendering with wrong image path
These null checks were missing in rB0c3b215e7d5456878b155d13440864f49ad1f230.

Differential Revision: https://developer.blender.org/D13157
2021-11-09 13:31:01 +01:00
6c24cafecc Fix T92876: Cycles incorrect volume emission + absorption handling 2021-11-09 13:13:56 +01:00
cb487b6507 Asset Catalogs: add test for proper shortening of simple names
Catalog simple names are supposed to fit into the DNA field `char
AssetMetaData::catalog_simple_name[64]`, and thus should be shortened
appropriately. This was already happening, but is now also covered by a
test.

No functional changes.
2021-11-09 13:13:30 +01:00
09f1be53d8 Fix T92950: spreadsheet shows 0 instances when there are instances
Fix found by @erik85.
2021-11-09 13:10:13 +01:00
c56cf50bd0 Fix T92876: Cycles incorrect volume emission + absorption handling 2021-11-09 13:04:58 +01:00
Demeter Dzadik
de8e13036b Armature Make/Clear Parent: Grey out options that don't do anything
In armature edit mode, the Make/Clear Parent operators don't do anything
in various cases, but only one of these cases was previously indicated,
and it was indicated by hiding the option completely instead of graying
it out.

Clear Parent (Alt+P) problems fixed:
- "Clear Parent" option always showed up, even when none of the selected
  bones had a parent.
- "Disconnect Bone" option always showed up, even when use_connected on
  all selected bones was already false.

Make Parent (Ctrl+P) problems fixed:
- "Keep Offset" option didn't show up when all selected bones' parent
  was already the active bone. This was correct, and this patch tries to
  make all behaviours consistent with this.
- "Connected" option always showed up, even when all selected bones'
  parent was already the active bone, and they all had use_connect set
  to True.

With this patch all options show up all the time, but in cases where
they would do nothing, they will be grayed out.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D6100
2021-11-09 12:16:30 +01:00
Cody Winchester
4e2478940e Alembic: Allow exporting of animated vertex colors
Allow exporting of animated vertex colors to Alembic.

The changes are made to be in line with the way the UV Maps are written.
Each vertex color gets a OC4fGeomParam created and mapped into the
CDStreamConfig to avoid recreating the Param on each frame.

The time sample index is also stored in the config now and set onto the
UV and Vertex Color params each frame. Without this the exports would
get inconsistent timing results where animated UV maps and Vertex Colors
were not playing back at the original speed.

Reviewed By: sybren

Maniphest Tasks: T88074

Differential Revision: https://developer.blender.org/D11278
2021-11-09 10:54:13 +01:00
6b0a6c2ca9 Merge branch 'blender-v3.0-release' 2021-11-09 10:34:07 +01:00
04b4ec7889 Fix T92318: adding layers (UVs, ...) doesn't notify about limit
When adding certain customdata layers (namely UVs, vertex colors and
sculpt vertex colors), the user does not get notified the specific limit
has been hit (blender just silently does nothing).

Now inform the user [decided to not do this in poll() since it could get
messy once operators are extended to operate on all selected objects, so
left this as a visible error in execute() -- or from python].

Maniphest Tasks: T92318

Differential Revision: https://developer.blender.org/D13147
2021-11-09 10:19:51 +01:00
ad679ee747 Merge branch 'blender-v3.0-release' 2021-11-09 10:07:44 +01:00
Fynn Grotehans
486d1e8510 Fix T92559: Tracking camera presets don't work
New tracking-camera presets d486ee2dbd used wrong code because I
copied them from the camera-presets. Now they set the right properties
again, the values stay the same as before.

Differential Revision: https://developer.blender.org/D13139
2021-11-09 10:06:28 +01:00
a7540f4b36 Merge branch 'blender-v3.0-release' 2021-11-09 17:11:35 +11:00
2eb94f3036 Fix T92384: Wrong UV layers used with Boolean Modifier (Fast Solver)
Ensure the layers from the source mesh are used instead of the
object referenced by the boolean modifier.
2021-11-09 17:07:23 +11:00
2772a033c9 Merge branch 'blender-v3.0-release' 2021-11-09 15:49:41 +11:00
8772a6fb9b Merge branch 'blender-v3.0-release' 2021-11-09 15:49:38 +11:00
b3597f310d Fix T92469: Transform tools inaccessible in weight-paint + pose mode
Expose transform tools when in weight paint mode with pose-mode enabled,
displaying transform tools in the toolbar, as is already done in
object & pose mode.

These are only shown when weight-paint + pose mode are active at once.

This allows single key-strokes to activate tools, needed when
tool-access is set as the default action for G/R/S key bindings.

Reviewed By: JulienKaspar

Ref D13028
2021-11-09 15:43:34 +11:00
Jeducious
d5d97e4169 Fix T92704: Redrawing while saving crashes outside the main thread
If the blend file is saved from a script in another thread,
like the render thread for example, Blender will crash on the call that
redraws the UI.

Ref D13140
2021-11-09 15:28:00 +11:00
Jeducious
afc60f9957 Fix T92704: Redrawing while saving crashes outside the main thread
If the blend file is saved from a script in another thread,
like the render thread for example, Blender will crash on the call that
redraws the UI.

Ref D13140
2021-11-09 15:18:15 +11:00
e0dae0f98f Merge branch 'blender-v3.0-release' 2021-11-08 16:57:19 +01:00
ab7214ca2e Fix performance issues with pose library sidebar and many poses
When the asset view in the sidebar of the pose library would contain
more than a few handful poses, interaction and animation playback
performance would be impacted considerably. This was because our icon
drawing scales image buffers using a rather slow method on the CPU.
This commit changes it so the asset icons are scaled using the GPU.

Note that this is a temporary change. I'd like all icon code to use
GPU-side scaling, see D13144. But such a change is too risky to do in
the release branch at this point, so this fix is specifically for the
3.0 release.
2021-11-08 16:56:42 +01:00
fe2ed4a229 Merge branch 'blender-v3.0-release' 2021-11-08 18:44:39 +03:00
abab16f7c7 Fix T92043: Relax/Push Pose does nothing for quaternion rotation.
As can be confirmed by checking generic code for this operation,
it is supposed to blend between the result of Breakdown based on
actual frame range, and the current pose. However for some reason
the quaternion specific code was blending between the current pose
and the current keyframed pose. This means that the operation does
nothing if invoked without modifying the pose first.

This rewrites the code to match the non-quaternion behavior.

Differential Revision: https://developer.blender.org/D13030
2021-11-08 18:44:21 +03:00
33beec1cec Cleanup: remove redundant arg when forcing zero initialization 2021-11-08 12:41:30 -03:00
e1c4e5df22 GPencil: New option to export PDF full scene
This new mode export all frames of the scene.

Reviewed By: pepeland

Differential Revision: https://developer.blender.org/D13055
2021-11-08 16:03:30 +01:00
c865577643 GPUTest: Add support to test on Windows.
On windows the OpenGL context wasn't activated when created, on Linux it
is. This patch will activate the context in gpu/draw test cases.
2021-11-08 15:49:51 +01:00
Jarrett Johnson
495e60c0da Basic engine shaders test
This patch adds shader compilation tests for the basic engine in `shaders_test.cc`

Addresses T92701

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D13066
2021-11-08 15:43:50 +01:00
bb6547cb5f Merge branch 'blender-v3.0-release' 2021-11-09 00:25:49 +11:00
c55d0ebea5 Merge branch 'blender-v3.0-release' 2021-11-09 00:25:46 +11:00
393ef4d871 Fix T92481: Memory leak with subdivision surface modifier
Interpolation vertex data on loose edges was writing into already
allocated data.

Resolve this by skipping vertex end-points for custom-data interpolation
which has already been copied from the source mesh.

Reviewed By: sergey

Ref D13082
2021-11-09 00:24:03 +11:00
cd8350764b Docs: improve comments & doc-strings for the tool-system 2021-11-09 00:23:55 +11:00
Bastien Montagne
d6e2210935 Fix inconsistent creation of NodeTreeTypeUndefined type of node tree
Currently, when creating a new node tree ID, its `typeinfo` is set to
`NodeTreeTypeUndefined`, but its `type` enum value is left to `0`,
aka `NTREE_SHADER`.

This patch adds a new `NTREE_UNDIFINED` value, and use it for
`NodeTreeTypeUndefined` types of node trees.

NOTE: While it is not clear whether that actually fixes issues currently,
quite a bit of code still relies on the value of `type`, so think it
makes sense to sanitize this.

NOTE: Would have been ideal to reserve `0` value to undefined type,
but at this point this is not possible anymore, so chose to use `-2` instead.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13123
2021-11-08 12:24:47 +01:00
fc373af8f5 Nodes: store socket declaration reference in socket
Previously, to get the declaration of a socket, one had to go
through `node->declaration`. Now this indirection is not necessary
anymore. This makes it easier to add more per-socket information
into the declaration and accessing it in various places.

Currently, this system is used by socket descriptions and node warnings
for unsupported geometry component types.
2021-11-08 12:24:01 +01:00
09cef0fc00 Fix ASAN issue in image editor.
Adding virtual constructors to base classes.
2021-11-08 11:37:42 +01:00
ee4966d146 Merge branch 'blender-v3.0-release' 2021-11-08 17:19:08 +11:00
c3f5fca8a2 Cleanup: avoid error prone struct declarations in C++
Reference struct members by name instead relying on their order.
This also simplifies moving back to named members when all compilers
we use support them.
2021-11-08 17:00:36 +11:00
de581a2302 Fix reading the 3rd value of 2D cursors when transforming
Out of bounds read and potential out-of-bounds write when transforming
the 2D cursor for image editor and sequencer.

While this didn't cause user visible bugs in my tests,
it's error prone and should be avoided.

Use TransData2D for 2D cursors.
2021-11-08 17:00:36 +11:00
fb4b737518 CMake: add missing headers to CMake lists 2021-11-08 17:00:36 +11:00
27b37517f8 Cleanup: use static sets 2021-11-08 17:00:36 +11:00
42df2a7b57 Cleanup: Grammar in comments 2021-11-07 23:20:29 -06:00
0969dcc861 Fix reading the 3rd value of 2D cursors when transforming
Out of bounds read and potential out-of-bounds write when transforming
the 2D cursor for image editor and sequencer.

While this didn't cause user visible bugs in my tests,
it's error prone and should be avoided.

Use TransData2D for 2D cursors.
2021-11-08 15:22:02 +11:00
8fa8e8bc37 Cleanup: quiet compiler warnings 2021-11-08 14:52:27 +11:00
34d289f98c CMake: add missing headers to CMake lists 2021-11-08 14:52:08 +11:00
c516659b5e Cleanup: use static sets 2021-11-08 14:52:08 +11:00
0f80602632 Cleanup: remove references to non-existent 'mtexpoly' 2021-11-08 14:14:16 +11:00
b24a03e635 Cleanup: remove duplicate doc-strings
Internal struct ObTfmBack had out of sync doc-strings
for members duplicated from Object.

Remove the doc-strings as there is this is just temporary storage.
2021-11-08 14:14:15 +11:00
ed24b7d9a2 Cleanup: spelling in comments 2021-11-08 14:14:14 +11:00
3b726cfee8 Cleanup: compiler warnings 2021-11-08 14:14:13 +11:00
0654c41b0c Cleanup: use doxygen for BLF glyph
- Use doxy formatted functions.
- Use doxy sections.
2021-11-08 13:37:51 +11:00
4f387e66ac Merge branch 'blender-v3.0-release' 2021-11-07 20:45:19 -03:00
56ee96349d Fix snap cursor not active even if gizmo is available
Error introduced in rB69d6222481b4 and partially fixed in rB24310441ddc8.

When gizmo was turned on but the scene has more than one 3D viewport, one of them the snap cursor did not appear.
2021-11-07 20:44:20 -03:00
892da668dc Cleanup: Clang tidy 2021-11-07 00:39:20 -05:00
eddf5ad581 BLF: Refactor blf_glyph.c
Cleanup and Simplification of blf_glyph.c

See D13095 for details.

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

Reviewed by Campbell Barton
2021-11-06 11:29:48 -07:00
6002914f14 Cleanup: Convert mesh.c to C++
This commit renames mesh.c to mesh.cc and makes
it compile in C++. Can be useful in the future to be able
to use C++ functionality in existing and new functions.

Differential Revision: https://developer.blender.org/D13134
2021-11-06 19:16:37 +01:00
f315a46982 Nodes: add preview image storage to node group
This is part of T92811.

Differential Revision: https://developer.blender.org/D13105
2021-11-06 16:43:26 +01:00
81baeec59b Cleanup: remove window_manager & editor includes from BLF
Remove the need to include the window manager & editor functions
in low level font rendering code.

- The default font size is now set when changed in the preferences.
- Flushing cache is set as a callback.
2021-11-06 16:28:02 +11:00
a804a11db1 Merge branch 'blender-v3.0-release' 2021-11-05 17:22:06 -05:00
7a5b8cb202 Cleanup: Decrease variable scope, rename functions 2021-11-05 17:17:37 -05:00
48841c479f Merge branch 'blender-v3.0-release' 2021-11-05 18:00:01 -04:00
6c83001143 Update RNA to user manual url mappings 2021-11-05 17:59:17 -04:00
9e611c5616 Merge branch 'blender-v3.0-release' 2021-11-05 16:33:08 -05:00
Leon Leno
9be49a1069 Fix: Property editor icon jittering in some cases
In the tools tab, the tool icon would be offset when it intersected
the bottom of the editor. With some screen resolutions, the icons on
the left side of the editor would also move when intersecting the
bottom of the editor. This happened because of the truncation in
the implicit conversion from float to int. Instead, use explicit
conversion functions.

Differential Revision: https://developer.blender.org/D11097
2021-11-05 16:32:35 -05:00
97ff37bf54 Cycles: perform CPU film reading in the kernel, to use AVX2 half conversion
Adds a bunch of CPU kernel function to process on row of pixels, and use those
instead of calling unoptimized implementations.

Fixes T92598
2021-11-05 22:04:36 +01:00
d1a9425a2f Fix T91733, T92486: Cycles wrong shadow catcher with volumes
Changes:
* After hitting a shadow catcher, re-initialize the volume stack taking
  into account shadow catcher ray visibility. This ensures that volume objects
  are included in the stack only if they are shadow catchers.
* If there is a volume to be shaded in front of the shadow catcher, the split
  is now performed in the shade_volume kernel after volume shading is done.
* Previously the background pass behind a shadow catcher was done as part of
  the regular path, now it is done as part of the shadow catcher path.

For a shadow catcher path with volumes and visible background, operations are
done in this order now:

* intersect_closest
* shade_volume
* shadow catcher split
* intersect_volume_stack
* shade_background
* shade_surface

The world volume is currently assumed to be CG, that is it does not exist in
the footage. We may consider adding an option to control this, or change the
default. With a volume object this control is already possible.

This includes refactoring to centralize the logic for next kernel scheduling
in intersect_closest.h.

Differential Revision: https://developer.blender.org/D13093
2021-11-05 20:50:19 +01:00
f0bc7f3261 Merge branch 'blender-v3.0-release' 2021-11-05 20:40:02 +01:00
4b56eed0f7 Fix T92566: Cycles distant lights too dim in reflections 2021-11-05 20:24:13 +01:00
f24ad274cb Fix T92503: Cycles OSL crash with object attributes
Can't cast to float4 because it might not have correct alignment.
2021-11-05 20:07:03 +01:00
81bee0e75a UI: Fix minor theme mismatch
Pie menu got wrong item highlight and options settings were outdated.
2021-11-05 19:20:47 +01:00
3211c80a31 Fix T92815: Incorrect handling of evaluated meshes from curves
Evaluated meshes from curves are presented to render engines as
separate instance objects now, just like evaluated meshes from other
object types like point clouds and volumes. For that reason, cycles
should not consider curve objects as geometry (previously it did,
meaning it retrieved a second mesh from the curve object as well
as the temporary evaluated mesh geometry).

Further, avoid adding a curve object's evaluated mesh as data_eval,
since that is special behavior for meshes that is arbitrary. Adding an
evaluated mesh there but not an evalauted pointcloud is arbitrary,
for example. Retrieve the evaluated mesh in from the geometry set
in BKE_object_get_evaluated_mesh now, to support that change.

This gets us closer to a place where all of an object's evaluated data
is stored in geometry_set_eval, and we just have helper functions
to access specific geometry components.

Differential Revision: https://developer.blender.org/D13118
2021-11-05 19:20:47 +01:00
ae899e4bb8 UI: Fix minor theme mismatch
Pie menu got wrong item highlight and options settings were outdated.
2021-11-05 19:10:03 +01:00
8d2a0d9b4c UI: Apply recent theme fixes for Preferences saved in 3.1 builds
Followup to e65230f0c0.

Pablo and I decided it's fine to reset themes again when saved with the
recent 3.1 builds.

This needed to be done a bit careful, since a normal version patch
resetting the theme would've reset the theme for anybody opening
preferences of a 3.0 build (even the final release build) in a 3.1
build. So make sure the theme is at least from a 3.1 build (but not
newer then this commit of course).
2021-11-05 19:00:10 +01:00
cc49c479a7 Cleanup: Use reference for non-optional C++ parameter
A reference makes clear that NULL is not an expected value. So it's the
prefered way of passing a `const` input parameter (at least if it may
not be cheap to copy).
2021-11-05 18:27:55 +01:00
1bc655c5aa Fix T92815: Incorrect handling of evaluated meshes from curves
Evaluated meshes from curves are presented to render engines as
separate instance objects now, just like evaluated meshes from other
object types like point clouds and volumes. For that reason, cycles
should not consider curve objects as geometry (previously it did,
meaning it retrieved a second mesh from the curve object as well
as the temporary evaluated mesh geometry).

Further, avoid adding a curve object's evaluated mesh as data_eval,
since that is special behavior for meshes that is arbitrary. Adding an
evaluated mesh there but not an evalauted pointcloud is arbitrary,
for example. Retrieve the evaluated mesh in from the geometry set
in BKE_object_get_evaluated_mesh now, to support that change.

This gets us closer to a place where all of an object's evaluated data
is stored in geometry_set_eval, and we just have helper functions
to access specific geometry components.

Differential Revision: https://developer.blender.org/D13118
2021-11-05 11:51:34 -05:00
aaf86bad87 Merge branch 'blender-v3.0-release' 2021-11-05 11:19:29 -05:00
c473b2ce8b Fix part of T89313: Attribute search crash during animation playback
During animation playback, data-blocks are reallocated, so storing
pointers to the resulting data is not okay. Instead, the data should
be retrieved from the context. This works when the applied search
item is the "dummy" item added for non-matches. However, it still
crashes for every other item, because the memory is owned by the
modifier value log, which has been freed by the time the exec function
runs.

The next part of the solution is to allow uiSearchItems
to own memory for the search items.
2021-11-05 11:19:12 -05:00
212dcd6075 Merge branch 'blender-v3.0-release' 2021-11-05 10:57:04 -05:00
594ee5f160 Fix T92848: Crash when joining curves with spline domain attributes
The point domain attributes (stored on splines) are sorted so they
have a consistent order on all splines after the join. However, spline
domain attributes were included in the new order, which didn't work
because the length of the attribute lists didn't match. The simple fix
is to only include point domain attributes in the new order vector.
2021-11-05 10:55:51 -05:00
bbd8d33453 Merge branch 'blender-v3.0-release' 2021-11-05 16:23:56 +01:00
Pablo Vazquez
7c75529333 UI: Use arrow icon on context paths
The current `ICON_SMALL_TRI_RIGHT_VEC` uses dark hard-coded colors ([`0.2`, `0.2`, `0.2`])
which makes it impossible to theme and hard to see in dark contexts.

Use `ICON_RIGHTARROW` to match the Outliner's breadcrumbs. This icon uses `TH_TEXT` so it's visible as long as the rest of the text is.

##### Master
(Properties editor background made red on purpose to be able to see the triangle icon)
{F11713038, size=full}

#### This patch
{F11713039, size=full}

Reviewed By: #user_interface, Severin, HooglyBoogly

Maniphest Tasks: T92771

Differential Revision: https://developer.blender.org/D13106
2021-11-05 16:23:22 +01:00
87e2154daf Fix: Viewport stats wrong for Geometry Nodes instances
In some cases when geometry is created in Geometry Nodes
the viewport stats will show 0 because runtime data is not filled.
This patch sets the runtime data on instances.

Differential Revision: https://developer.blender.org/D12738
2021-11-05 16:19:09 +01:00
f415b41a94 Merge branch 'blender-v3.0-release' 2021-11-05 09:59:26 -05:00
616594fcb1 Fix T92850: Curve to mesh incorrect for single point profiles
For single point splines that weren't at the origin, the results were
incorrect. Now take into account the tilt, radius, etc. just like the
general case.
2021-11-05 09:52:25 -05:00
625b2f59f0 Fix GCC warnings after own recent commit
Caused by 4e09fd76bc.
2021-11-05 15:32:11 +01:00
2986924301 Cleanup: Remove misleading comment
Python isn't doing any conversion here. We just do a regular lookup of
the given enum identifier in the RNA enum definition.
2021-11-05 15:32:11 +01:00
29efd26e71 Cleanup: Remove redundant scope qualifiers. 2021-11-05 15:18:58 +01:00
885c79915f Merge branch 'blender-v3.0-release' 2021-11-05 15:08:09 +01:00
e65230f0c0 UI: Various theme fixes related to contrast
* Animation channels (Fixes T92612)
* Curve widget (Fixes T92595)
* Pie menu (Fixes T92590)
* Radio and toggle buttons background
* Checkbox background
* Fix highlighted marker name on Dopesheet (text highlight on Dopesheet)


#### Master
{F11697667, size=full}

#### This Patch
{F11697669, size=full}
{F11697849, size=full}
{F11697833, size=full}
{F11697852, size=full}

Reviewed By: #user_interface, campbellbarton, Severin

Maniphest Tasks: T92595, T92612, T92590

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

# Conflicts:
#	source/blender/blenkernel/BKE_blender_version.h
2021-11-05 15:06:37 +01:00
Pablo Vazquez
b4af70563f VSE: Remove separator lines between rows
The VSE grid theme setting is currently used for two things:

* Indicate time intervals (vertical lines)
* As separator between channels (horizontal lines)

This adds visual noise because for the time interval to be visible, the
grid color needs to be bright, resulting in a rectangle-grid backdrop.

Recently, the VSE got a theme setting to customize alternate-row background color.
This should be sufficient to tell the channels apart without the need for a line in between.

Additionally, this patch makes the VSE background use the theme setting as-is,
without hard-coded darkening, to ease the tweaking of themes.  This aligns the style
of the VSE backdrop with the rest of Blender (Outliner rows, File Browser, Spreadsheet,
Info and animation editors).

Related reports: T92581
Related task: T92792

#### Before
{F11680317, size=full}

#### After
{F11694981, size=full}

Reviewed By: #user_interface, Severin

Maniphest Tasks: T92581

Differential Revision: https://developer.blender.org/D13072
2021-11-05 15:06:37 +01:00
a0f50c1890 Merge branch 'blender-v3.0-release' 2021-11-05 15:06:10 +01:00
da97859656 Fix potential uninitialized memory in link/append code. 2021-11-05 15:05:45 +01:00
4e09fd76bc Cleanup (UI): Add/use type for operator context enum
Adds a `wmOperatorCallContext` typedef for the existing `WM_OP_XXX`
operator context enum. This adds type safety, allows the compiler to
produce better warnings and helps understanding what a variable is for.

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

Reviewed by: Campbell Barton
2021-11-05 14:57:26 +01:00
35198606d5 Cleanup: Remove wrong comments in versioning
This comment is from the block at the end of the versioning functions,
where we have an unversioned block to collect versioning code that
doesn't require immediate version bumping. The comment was probably just
copied over with the code when bumping the version eventually.
2021-11-05 14:53:57 +01:00
00734d5724 Fix T92807: Incorrect display planar tracking.
Issue introduced in {7e66616b7e15} where the shader was replaced with a
2d image shader. This patch reverts several commits that removed the 3d
image shader.
2021-11-05 14:51:55 +01:00
32c90d2d7c Cleanup: Split image engine into ImageEngine, SpaceAccessor and DrawingMode.
Image engine is used to draw an image into a space. The current
structure wasn't clear and couldn't be easilly extended. This refactor
spliced the image draw engine into 3 main components.

- Space accessors: contains an interface to communicate with space data
  (Image editor, UV Editor, Node Editor) in a common way. This reduced
  the branching in the code base.
- DrawingMode: contains an interface to the used tactic to draw an image
  inside the space framebuffer. Currently only one mode is implemented;
  in the future there could be a separate drawing mode for huge images.
- ImageEngine: the core that connects the draw manager with the space
  data and drawing mode.
2021-11-05 13:25:00 +01:00
29e5c330cf GPencil: Fix dash modifier missing vertex color.
The original code did not copy vertex color to the generated stroke,
now fixed.
2021-11-05 20:04:14 +08:00
d7f4fdf845 GPencil: Fix dash modifier missing vertex color.
The original code did not copy vertex color to the generated stroke,
now fixed.
2021-11-05 20:02:35 +08:00
016a575002 Merge branch 'blender-v3.0-release' 2021-11-05 16:05:00 +11:00
3a4dade2f8 Merge branch 'blender-v3.0-release' 2021-11-05 16:04:57 +11:00
b9968b83ad Merge branch 'blender-v3.0-release' 2021-11-05 16:04:52 +11:00
40d090cc72 Merge branch 'blender-v3.0-release' 2021-11-05 16:04:43 +11:00
5cc21b095a Merge branch 'blender-v3.0-release' 2021-11-05 16:04:40 +11:00
68e86c4816 Cleanup: use (s) postfix for messages that may be plural
Ref 01c824ac88
2021-11-05 15:58:01 +11:00
9b1882f986 Cleanup: replace face-map reference in gizmo example
Copy-paste error.
2021-11-05 15:52:17 +11:00
445361c2ac Fix T70768: Python gizmo-groups not working in the sequencer 2021-11-05 15:49:33 +11:00
82efcfc188 Correct assert checking gizmo type 2021-11-05 15:49:04 +11:00
c5ace142e6 Fix PyAPI integer conversion error handling
Non integer types raised an OverflowError, even when non-number
types were passed in.

Now the error from Python is kept.
2021-11-05 15:37:17 +11:00
7061d1e39f Fix T92740: Missing lock around the image CacheLimiter
A recent change exposed this long-standing race. Simply protect the
MEM_CacheLimiter with its lock now. Additionally, guard against
unmanaging an already destroyed cache handle.

Ref T92740, T92838
2021-11-04 20:58:32 -07:00
1b6238edba Merge branch 'blender-v3.0-release' 2021-11-05 13:45:32 +11:00
5b7a14c019 Cleanup: use doxy sections in graph editor module 2021-11-05 13:38:58 +11:00
9d2e325694 Cleanup: spelling/typos 2021-11-05 13:38:58 +11:00
50b0503a11 Revert "Fix T92464: Operators fail after opening blend files via an operator"
This reverts commit 9bd97e62ad.

This caused T92818.

Event handling relies on checking for NULL window to detect file load in
enough different areas of the code that this isn't a practical solution.

Revert this change in favor of an alternative approach.
2021-11-05 13:32:53 +11:00
Christoph Lendenfeld
3364a5bea6 Cleanup: move code in graph_slider_ops
Future operators can use the same code,
so it is moved up to disassociate it from decimate

No functional changes

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12489
Ref: D12489
2021-11-04 21:35:28 +00:00
Christoph Lendenfeld
6986b43b3d Cleanup: renames in graph_slider_ops
This patch renames:
* tDecimateGraphOp to tGraphSliderOp
* dgo to gso (to match with the struct rename)
* decimate_reset_bezts to reset_bezts to indicate it can be used by other functions

No functional changes

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12490
Ref: D12490
2021-11-04 21:20:26 +00:00
df3e30398f Merge branch 'blender-v3.0-release' 2021-11-04 16:56:32 -03:00
e7e3431b29 Cleanup: Move object.c to C++
This is useful to allow the use of features made in C++.

Differential Revision: https://developer.blender.org/D13115
2021-11-04 16:51:37 -03:00
e51735d276 Cleanup: fix typo 2021-11-04 20:36:35 +01:00
Brecht Van Lommel
4960ad420b Cycles: add code to check for supported HIP device architectures
RDNA2 only for now to be conservative, but testing more hardware is underway.

Ref T92393

Differential Revision: https://developer.blender.org/D12958
2021-11-04 20:34:21 +01:00
Brian Savery
36f5198282 Fix Cycles HIP Kernels loading on Arch names with extra options
The kernel file names are search for based on the arch name, for example
gfx1010. However HIP's gcnArchName can contain options such as xnack- in
the name. For example gfx1010:sramecc-:xnack-.

This revision tokenizes the info from gcnArchName and just uses the first
token for choosing the Kernel file to use. Kernels are portable across those
features in the arch name.

Also remove the bit for recompiling ptx as clearly that is not relevant.

Differential Revision: https://developer.blender.org/D13117
2021-11-04 20:24:39 +01:00
556c71a84a GPencil: New option to Merge All layers in active one
This new option allows to combine all layers in the active one. Also the merge down option has been improved.

Reviewed By: mendio, pablo vazquez (UI)

Differential Revision: https://developer.blender.org/D13054
2021-11-04 19:40:55 +01:00
5c34e34195 Fix part of T91797: Cycles CPU and GPU render differences with camera inside volume 2021-11-04 19:03:49 +01:00
1c6d3d614a Minor tweaks to new append code.
* Name generated 'append' collection, instead of getting a generic
  meaningless name.
* Do not check if a collections's objects are already instantiated, when
  we already know that we want to instantiate that collection.
2021-11-04 19:00:22 +01:00
101fa4a425 Merge branch 'blender-v3.0-release' 2021-11-04 18:32:37 +01:00
c7fcc50842 Fix T91986: incorrect syncing of geometry instances
The issue was that some geometries were not synced again even when
they changed. This commit adds a map that keeps track of the geometries
that need to be updated when an object has changed.

Differential Revision: https://developer.blender.org/D13020
2021-11-04 18:32:01 +01:00
b7260ca4c9 Fix T92799: handle undefined node group type in field inferencing
A group node could reference an undefined group when the group
was linked and its source file was not found on load. The field
inferencing code did not handle that case before.

With this change, the file provided in T92799 loads successfully.
2021-11-04 18:25:48 +01:00
2373ce7fcf Merge branch 'blender-v3.0-release' 2021-11-04 17:27:51 +01:00
2eed1afd11 Fix T92778: Cloth Point Cache Name disappears after Make Library Override.
Cloth modifier had a unique, weird and weak way of copying its
pointcache, now make it use `BKE_ptcache_copy_list` like done for e.g.
particles or softbody data.
2021-11-04 17:16:49 +01:00
a72b26527d Merge branch 'blender-v3.0-release' 2021-11-04 16:50:53 +01:00
ffe115d1a8 Fix T92450: Cycles wrong render with overlapping glass, transparency and volumes
We need to store the continuation probability used to make the termination
decision in intersect_closest, instead of recomputing it in shade_surface.
Because otherwise a shade_volume in between can change the throughput and
change the probability.
2021-11-04 16:39:49 +01:00
2becb3e9af Merge branch 'blender-v3.0-release' 2021-11-04 10:10:52 -05:00
b646846646 Fix T92812: Startup has "Standard" View Transform Instead of "Filmic"
A repeat of the problem I caused last time I edited the startup file.
Never do it with a lite build! Also align the toolbar widths in all
editors to the smallest size they snap to.
2021-11-04 10:10:02 -05:00
37b862fa6c Cleanup: Remove operator context override for drop-box operators
Drop-boxes should act on the context determined through the exact cursor
location. There should be no need to override that, basically by the
nature of how drop-boxes work.
So Campbell and I agreed on removing this.

If we wanted to support it, we'd have to restore the operator context
when drawing drop-boxes, see
https://developer.blender.org/T92501#1247581.
2021-11-04 16:02:54 +01:00
db43d19c16 Merge branch 'blender-v3.0-release' 2021-11-04 15:32:50 +01:00
Pablo Vazquez
9e71a07547 UI: Fix UIList item using "regular" widget colors while edited
Simply removing the check for `UI_STATE_TEXT_INPUT` makes it inherit
the "List Item" User Interface theme settings. This patch changes the
default theme to match the colors of text input fields.

#### Master
{F11680556, size=full}

#### This patch
{F11680557, size=full}

All the included commmunity themes seem to work well (only Deep Grey might
need more contrast but that's a different patch).

Related reports: T92720

Reviewed By: #user_interface, Severin

Maniphest Tasks: T92720

Differential Revision: https://developer.blender.org/D13073
2021-11-04 15:31:48 +01:00
d3328fabc9 Attempt to fix failing lib link test on windows.
According to https://docs.python.org/3/library/os.html#os.rename,
`os.rename` has os-specific behavior, and will fail in case you attempt
to rename to an existing file on windows.

So using `os.replace` instead, which should be os-agnostic.

NOTE: Fact that temp test directory is not cleared after tests are
sucessfully ran does not sound great...
2021-11-04 15:06:58 +01:00
8eff1eca52 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-04 14:50:48 +01:00
be4478d1f8 Fix T92814: improve automatic linking when inserting Float Curve node
This solves the issue in a more general that can also be used to solve
similar issues for other nodes in the future. Nodes can specify their
"main" socket in their declaration so that we don't have to rely on
heuristics.

Differential Revision: https://developer.blender.org/D13108
2021-11-04 14:44:21 +01:00
ff4959eeaa Fix T92649: incorrect copying of anonymous attributes in many places
Many modifiers and other places use `CustomData_copy_data` to copy data
between different meshes. This function assumes that assumes that the
source and destination `CustomData` objects are "compatible" in some way.
Usually modifiers use `CustomData_copy` to create a compatible new
`CustomData` on the new mesh. The issue was that the optimization I added
for anonymous attributes broke this compatibility. It avoided copying some
attributes when they are no longer used.

This lead to attributes being copied incorrectly.
D13083 contains ideas for how this could be fixed more generally.
For now I just removed the optimization.

Differential Revision: https://developer.blender.org/D13083
2021-11-04 14:41:56 +01:00
Charlie Jolly
b5162638c5 Fix: Geometry Nodes: Math node smoothmax not working
Function arguments were incorrect.

Noted during @simonthommes live stream.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13110
2021-11-04 13:40:42 +00:00
80a46955d8 Fix T92501: Crash when dragging material assets over 3D View regions
Issue was that the context used for dropbox handling and polling didn't
match the one used for drawing the dropbox and generating the tooltip
text (which would determine the material slot under the cursor,
requiring context). The mismatch would happen with overlapping regions.

Actually, this patch includes two fixes, each fixing the crash itself:
* Store the context from handling & polling and restore it for drawing.
* Correct the hovered region lookup for drawing to account for overlayed
  regions.

Note that to properly set up context for drawing, we should also account
for the operator context, which isn't done here, see
https://developer.blender.org/T92501#1247581.
2021-11-04 12:20:37 +01:00
c641107c95 Fix T92800: (UI) Radial control values get wrong color assigned
The global theme state didn't get updated or unset properly when drawing
overlays. Now paint cursors use the theme settings of the space they are
in, while global overlays use the global fallback, which is the main 3D
View region.
2021-11-04 11:52:11 +01:00
978ef093db Cleanup: fix compiler warnings
Those were introduced in rBccead2ed9c6121c42a516712da38a2faec877e2f.
2021-11-04 11:29:16 +01:00
2d6d8fc7ca Attempt fix for new lib reload/relocate tests on windows.
Try splitting them into their own class.
2021-11-04 11:25:30 +01:00
82b20b6975 Merge branch 'blender-v3.0-release' 2021-11-04 10:51:40 +01:00
bfb664b65d Fix T92791: collapsed nodes scaling widget wrong with interface scale
Size, position and scale of the "two-line" widget (the one to scale a
node horizontally) was not taking interface scale into account. In the
case of the report, it could happen it draws behind an output socket.

before (at 2.0 interface scale)
{F11698493}

after (at 2.0 interface scale)
{F11698501}

Maniphest Tasks: T92791

Differential Revision: https://developer.blender.org/D13088
2021-11-04 10:46:53 +01:00
feaf5b95e0 Merge branch 'blender-v3.0-release' 2021-11-04 08:35:46 +01:00
74ef424cb7 Revert "GPencil: Change default template for better contrast in header"
This reverts commit 5d42ea0369.
2021-11-04 08:33:59 +01:00
36a6528723 Merge branch 'blender-v3.0-release' 2021-11-04 18:10:07 +11:00
08c4f134d2 Fix T92783: Light size controller doesn't update position
Resolve by tagging the gizmo group map for refresh
when the modal gizmo group changes.

Regression in fb27a9bb98.
2021-11-04 18:08:23 +11:00
d7f9f083d4 Merge branch 'blender-v3.0-release' 2021-11-04 14:51:58 +11:00
7c188d8241 Merge branch 'blender-v3.0-release' 2021-11-04 14:51:55 +11:00
9cd5b3c9b6 Merge branch 'blender-v3.0-release' 2021-11-04 14:51:52 +11:00
682f1548be Merge branch 'blender-v3.0-release' 2021-11-04 14:51:50 +11:00
b849f290c5 Cleanup: capitalize ON/OFF with CMake 2021-11-04 14:50:24 +11:00
27103c56b4 Versioning: remove use of translations when loading preferences
Add note why translations can't be used while versioning.
2021-11-04 14:49:25 +11:00
c0fdaf700a Fix the GPencil stroke not sticking to other strokes
Issue seen when setting `Stroke Placement` of type `Stroke`.

Regression introduced in {rBaa0ac0035a0d3601672a0c732e3f8f932a36fc04}.
2021-11-03 18:51:25 -03:00
3e6907eb8a Fix T92002: Cycles baking certain light passes does not work
When reading pixels for virtual passes like diffuse, that sum diffuse direct
and indirect passes, we do not need them to exist with an offset in the render
buffer.
2021-11-03 22:09:13 +01:00
915f911daa Fix Cycles wrong ray visibility with old .blend files 2021-11-03 22:09:13 +01:00
0c6b815855 Geometry Nodes: Add Length Output to Curve Parameter Node
Adds a length output to the curve parameter node which returns the
length of a spline at each point, or the length of the curve at
each spline depending on the domain.

Differential Revision: https://developer.blender.org/D12882
2021-11-03 15:05:46 -05:00
d6ed9c2b40 Merge branch 'blender-v3.0-release' 2021-11-03 14:41:50 -05:00
a9bda98519 Fix: Startup file geometry nodes viewport inconsistent orientation
Copy the orientation from the "Layout" workspace 3D view.
2021-11-03 14:40:09 -05:00
431524aebc Geometry Nodes: Selection outputs for Cone and Cylinder
This adds Top, Bottom and Side selections to the Primitive
Mesh nodes Cone and Cylinder.
2021-11-03 20:20:15 +01:00
ccead2ed9c Spreadsheet: Display geometry volume component grids
This shows a geometry's volume grids in the spreadsheet.
Three columns are displayed:
 - Name: The text name of each grid
 - Data type: Float, Vector, etc.
 - Class: Fog volume, Level Set, or unkown

In the future, values of the voxels themselves could be displayed,
but that is a much more complex problem, with important performance
implications, etc.

Differential Revision: https://developer.blender.org/D13049
2021-11-03 13:45:51 -05:00
Nikhil Shringarpurey
4e5537d841 Geometry Nodes: Add tooltips to primitive node inputs
Building on the work in rBef45399f3be0, this commits adds
tooltips to the inputs for the default primitives nodes.

Differential Revision: https://developer.blender.org/D12640
2021-11-03 13:25:44 -05:00
7aaedc09c7 Merge branch 'blender-v3.0-release' 2021-11-03 18:16:16 +01:00
c29f9e14e4 Fix T92780: Lost material in case of local object, and missing linked obdata.
By default, when syncing materials slots between object and its obdata,
the amount of slots in obdata is the reference.

Missing linked obdata is replaced by an empty placeholder that has no
material. In that specific case, if we have a valid object ID, we want
to update the (placeholder) obdata's material count from the object one,
and not the other way around.
2021-11-03 18:15:51 +01:00
e10caf6fe3 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-03 18:07:36 +01:00
d17128520d Simplification: Use generic BKE_object_materials_test in object liblink code.
Better avoid own specific logic here, when we already have a proper
'API' function for that.
2021-11-03 17:56:25 +01:00
a7672caeb2 Geometry Nodes: Add Selection Input to Resample Curves Node
Add a boolean input to the resample curve node that indicates which
splines should be resampled and which should be unchanged.

Differential Revision: https://developer.blender.org/D13064
2021-11-03 11:55:24 -05:00
Colin
a827864e6b Fix T89709: avoid double node links after delete and reconnect
Differential Revision: https://developer.blender.org/D13062
2021-11-03 17:55:06 +01:00
Yevgeny Makarov
1e590234f7 UI: Fix padding of version label in splash screen
Differential Revision: D13018
2021-11-03 17:54:03 +01:00
c5d08aa0a3 Fix: muted nodes not handled correctly
This was an error in rBb55bddde40db3eda3531d98caa99be9a8e88a8ee.
2021-11-03 17:47:05 +01:00
de2988ea1b Cleanup: Remove effect-less const
Using `const` on an enum type returned by value doesn't have an effect.
2021-11-03 17:28:52 +01:00
debf4b70db Cleanup: Avoid redundant template parameter in BLI serializing API
The `ContainerValue` template can obtain the type of the contained value
via the given `Container` type, simply using `Container::value_type`.
Use this as the default way to determine the value type which simplifies
using the template. If necessary the value type can be passed explicitly
still.
2021-11-03 17:28:20 +01:00
ec5d2e6872 Add documentation for some 'hidden' RNA properties.
Even never-shown RNA properties should have at least a description, as
this is used by API doc generation scripts.

NOTE: this is more of an opportunistic set of changes than a proper
complete fix of that loack of documentation.
2021-11-03 16:13:46 +01:00
ef30a876b5 I18n: Add some more acronyms to the spellchecker. 2021-11-03 16:13:46 +01:00
2ecaa971f0 I18n: Fix several issues with UI messages extraction script.
* Fix systematic skipping of labels when they are the same as
  the identifier (Some cases are valid, like `RGB` or `HSV` e.g.).
* Add instead heuristics checks to skip non-UI properties (non-capitalized,
  or same name as identifier and Operator properties, mainly).
* Skip `bl_icon` and `icon` properties.
* Properly search for properties in all parent classes (some cases with
  e.g. `Panel` would break due to intermediary utils classes, leading to
  those internal UI properties not being skipped as expected).

Related to T43295.
2021-11-03 16:13:46 +01:00
Germano Cavalcante
aa0ac0035a GPencil and Annotation: Use cached depth to perform depth testing operations
Operations such as erasing with occlusion and drawing on the surface
require reading the depth buffer.

However, this is being done with minimal efficiency.

Currently, to read the depth corresponding to each point of the new stroke,
a ReadPixel is called to send a message to the GPU and read the depth of
the corresponding pixel in the VRAM.

The communication between GPU and CPU is known to be a slow operation so
it is good to be avoided.

Therefore, save the entire depth buffer in a cache to be read directly
from the RAM.

(Also the `ED_view3d_autodist_depth` and `ED_view3d_autodist_depth_seg` have
been removed since they are no longer used).

Reviewed By: antoniov, fclem

Differential Revision: https://developer.blender.org/D10894
2021-11-03 12:10:37 -03:00
8b516d8712 Include node name for socket animation channel UI
The channel names were often indistingushable in animation editors.
Now include the node _name_ (unfortunately, getting the _label_ could
result in bad performance in some circustances -- see previous version
of D13085).
Similar to what rB77744b581d08 did for some VSE strip properties.

ref. T91917

Maniphest Tasks: T91917

Differential Revision: https://developer.blender.org/D13085
2021-11-03 15:03:40 +01:00
b73993bcc9 UI: Refactor how dragging onto text buttons works, fixing issues
There was a bunch of special handling to support dropping data-blocks onto
string or search-menu buttons, to change the value of these. This refactor
makes that case use the normal drop-box design, where an operator is executed
on drop that gets input properties set by the drop-box. This should also make
it easier to add support for dragging assets into these buttons.

In addition this fixes an issue: Two tooltips were shown when dragging assets
over text buttons. None should be shown, because this isn't supported.
2021-11-03 15:00:17 +01:00
2a88343213 Merge branch 'blender-v3.0-release' 2021-11-03 14:24:33 +01:00
04d35f9315 Merge branch 'blender-v3.0-release' 2021-11-03 10:23:55 -03:00
0d8f1414a2 Fix access to current preferences when version patching read preferences
The version patch for 0cf9794c7e was checking and setting a data name
using the macros for translation. These would access the current
preferences which can mismatch the ones currently being version patched.
See discussion in 0cf9794c7e for details.

Don't handle translation in this version patch, which is more of a
"nice-to-have" version patch, no functionality depends on it.
2021-11-03 14:23:53 +01:00
f81190f85f Fix T92760: Crash erasing GPencil when occlusion test is enabled
`pt0` was read when `NULL` and `is_occluded_pt1` could be read even if
it is not initialized.
2021-11-03 10:22:36 -03:00
3532da44ee Merge branch 'blender-v3.0-release' 2021-11-03 22:26:39 +11:00
42d0107ee5 Fix crash dissolving overlapping faces
In rare cases disolving faces would crash, caused by iterator
variable reuse in b29a8a5dfe.
2021-11-03 22:17:10 +11:00
5095e4fc22 UI: Display disabled-hint when dragging material outside object mode
Display a "disabled hint" (text explaining why something isn't possible)
when dragging a material over the 3D View, while being in edit mode or
so (anything that isn't object mode).
2021-11-03 11:57:05 +01:00
bdf6665e3a Merge branch 'blender-v3.0-release' 2021-11-03 10:54:53 +01:00
b55bddde40 Fix T91862: do type conversion when data enters or exists node group
The geometry node evaluator now has access to the entire socket path
from the node that produces a value to the node that uses it. This allows
the evaluator to make decisions about at which points in the path the
value should be converted. Multiple conversions may be necessary under
some circumstances with nested node groups.

Differential Revision: https://developer.blender.org/D13034
2021-11-03 10:54:17 +01:00
2b12b4cd7d Fix: make sure geometry owns mesh before taking ownership
Differential Revision: https://developer.blender.org/D13075
2021-11-03 10:42:48 +01:00
e1f1b0841d Merge branch 'blender-v3.0-release' 2021-11-03 15:56:11 +11:00
68759625b1 Fix T92053: Industry compatible key-map fallback tools don't work
Caused by c9d9bfa84a.

Support for fallback tools with right-click select needed
the industry compatible key-map to be updated.
2021-11-03 15:52:42 +11:00
cea7ee7582 Merge branch 'blender-v3.0-release' 2021-11-03 11:49:58 +11:00
7996b49cb0 Cleanup: spelling 2021-11-03 11:42:07 +11:00
8dbca01531 Fix T92515: Incorrect translation when scaling pose bones 2021-11-03 11:24:29 +11:00
ac0eefe26f Merge branch 'blender-v3.0-release' 2021-11-02 18:22:50 -05:00
11392829ad Fix T92316: Inconsistent name for Set Curve Tilt node 2021-11-02 17:38:58 -05:00
c4b73847d3 BLF: Remove Thread Locking For Font Metrics
This patch removes the need to lock the thread just to get to some
generic (not glyph-specific) font metrics.

See D12976 for more details.

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

Reviewed by Campbell Barton
2021-11-02 14:28:25 -07:00
f674176d77 Fix T85676: Cycles EXR merging not working with some single layer EXRs
If there is only a layer without a name, use metadata from the first cycles
layer in the metadata, if any.
2021-11-02 21:24:08 +01:00
8c58838f6a Merge branch 'blender-v3.0-release' 2021-11-02 15:23:59 -05:00
a72ed0bb7f Cleanup: Improve curve point attribute assert
This properly checks the order of point domain attributes on each
spline, and avoids the map, which makes the code easier to understand.
The assert is also added to realizing instances and the join node.

Differential Revision: https://developer.blender.org/D13071
2021-11-02 15:22:49 -05:00
18392cef17 Fix T92652: Joining curves breaks point attribute order
Currently the curve to mesh node relies on the order of attributes being
the same on every spline. This is a worthwhile assumption, because it
will allow removing the attribute name storage duplication on every
spline in the future.

However, the join geometry node broke this order, since it just created
new attributes without any regard to the order. To fix this, I added a
"reorder" step after all the merged attributes have been created, the
types have been joined, etc. It should be possible to change this code
so that the attributes are added with the right order in the first
place, but I would like to do that after refactoring spline attribute
storage, and not for 3.0.

Differential Revision: https://developer.blender.org/D13074
2021-11-02 15:16:52 -05:00
5cd1210b52 Merge branch 'blender-v3.0-release' 2021-11-02 13:44:17 -05:00
7aa311e539 Cleanup: Add function to get attribute ID from custom data layer 2021-11-02 13:43:54 -05:00
48e2a15160 Fix T77681, T92634: noise texture artifacts with high detail
We run into float precision issues here, clamp the number of octaves to
one less, which has little to no visual difference. This was empirically
determined to work up to 16 before, but with additional inputs like
roughness only 15 appears to work.

Also adds misisng clamp for the geometry nodes implementation.
2021-11-02 18:56:25 +01:00
3dcd042bfc Merge branch 'blender-v3.0-release' 2021-11-02 18:38:59 +01:00
978f2cb900 Fix T89487: Crash adding Rigid Body to object with shared mesh data
Not sure why this bug was only discovered by such an elaborate steps
and why it took so long to be discovered. The root of the issue is
that in the 956c539e59 the typical flow of tag+flush+evaluate was
violated and tagging for visibility change happened after flush.
2021-11-02 18:36:24 +01:00
53fdde3f64 Merge branch 'blender-v3.0-release' 2021-11-02 18:14:59 +01:00
3a454beae7 Fix T91094: missing update after collection changed
Since rBb67fe05d4bea2d3c9efbd127e9d9dc3a897e89e6 collections
have a geometry component that depends on all the geometries
inside the collection. Contrary to what I originally thought
`ID_RECALC_COPY_ON_WRITE` does not trigger a collection geometry
update. This makes sense because a collection may change in ways
that do not require a geometry update.
Instead, we have to trigger the geometry update manually now by
passing `ID_RECALC_GEOMETRY` when appropriate.
2021-11-02 18:13:01 +01:00
0a254109b8 Merge branch 'blender-v3.0-release' 2021-11-02 17:52:03 +01:00
29dff8f844 Fix lots of missing messages i18n handling in uiItemL calls.
Also fix several wrong usages of `IFACE_` (as a reminder, error/info
messages should use `TIP_`, not `IFACE_`).
2021-11-02 17:50:18 +01:00
242ad4bd0f Merge branch 'blender-v3.0-release' 2021-11-02 17:49:52 +01:00
20b163b533 UIMessages/i18n: Fix incorrect part of rBdabfac37e35274b.
My bad, forgot lower-level UI code does not handle translations itself.

Thanks to Hans Goudey (@HooglyBoogly) for the heads up.
2021-11-02 17:49:32 +01:00
27621490c2 Merge branch 'blender-v3.0-release' 2021-11-02 18:33:25 +02:00
980bc5a707 UI: Use socket type info color to draw links
Currently, colored links overlay only supports standard sockets defined
by Blender. Some add-ons like Animation Nodes defines custom sockets for
everything and hence doesn't get colored sockets.

This patch uses the draw color from the socket type info to draw links
in order to support custom sockets.

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

Reviewed By: Hans Goudey
2021-11-02 18:29:35 +02:00
12bf4adbe3 Merge branch 'blender-v3.0-release' 2021-11-02 17:05:03 +01:00
2c23256288 Merge branch 'blender-v3.0-release' 2021-11-02 16:03:17 +00:00
dabfac37e3 Fix more UI message/i18n issues. 2021-11-02 17:02:33 +01:00
cde982d672 I18n: Fix all new cpp files not being parsed by UI message extractor.
The 'new' `.cc`/`.hh` extensions were never added to UI message
extractor.

Related to T43295.
2021-11-02 17:02:33 +01:00
Charlie Jolly
6981bee2c7 Fix T92736: Hole in mesh after Set Position
The geometry node port of voronoi_smooth_f1 function has a
division by zero when smoothness is set to zero.
Using a safe_divide within the function causes issues
and was noted in the original patch D12725.
Solution in this case is to clamp zero smoothness to FLT_EPSILON.

Reviewed By: JacquesLucke

Maniphest Tasks: T92736

Differential Revision: https://developer.blender.org/D13069
2021-11-02 15:58:17 +00:00
c01b3c534b Merge branch 'blender-v3.0-release' 2021-11-02 15:42:09 +01:00
89c9fa8b73 Fix T92462: Cycles crash calculating hair transparency
Need to make sure images needed for hair shaders are loaded
before running the shader.

The naming is a bit misleading, but this is an internal API
and we can change it easily. Submitting minimal patch needed
to fix logic in the code to make it safer to review for 3.0.

Differential Revision: https://developer.blender.org/D13067
2021-11-02 15:41:54 +01:00
1b2342b4d3 Tests: Add basic unittest for library reload and relocate operators. 2021-11-02 15:33:30 +01:00
698b05fc58 BLI: avoid passing nullptr to strncmp
This resulted in an ASAN warning.
2021-11-02 15:07:50 +01:00
a7e92843f7 Fix: Build error on windows.
External symbols in C files need
to be marked as such otherwise
the linker will not find them.
2021-11-02 07:43:44 -06:00
e64d4d0200 Merge branch 'blender-v3.0-release' 2021-11-02 07:59:35 -05:00
efcf36f2e9 Fix T92532: Missing null checks in IDPropertyManager.update_from
Calling it with a None argument, or no arguments, or with a property
that is missing UI data for some reason would fail. There is no
particular reason why ensuring those things don't happen is helpful,
so just add null checks for safety.

Differential Revision: https://developer.blender.org/D13024
2021-11-02 07:59:10 -05:00
0daf429591 Merge branch 'blender-v3.0-release' 2021-11-02 23:38:01 +11:00
2f0f08bc98 Fix T92733: Error moving a completely locked bone 2021-11-02 23:36:22 +11:00
b7dc667eb2 Merge branch 'blender-v3.0-release' 2021-11-02 12:31:05 +01:00
b1bf884889 Images: fix error in previous refactor
Some compositor tests (e.g. `compositor_color_test`) broke
because of rB0c3b215e7d5456878b155d13440864f49ad1f230.
The issue was a heap-use-after-free bug caused by a missing
call to `MEM_CacheLimiter_unmanage`.
2021-11-02 12:30:27 +01:00
7a4ee2fd4f Merge branch 'blender-v3.0-release' 2021-11-02 22:06:35 +11:00
9bd97e62ad Fix T92464: Operators fail after opening blend files via an operator
Operators such as setting the object mode failed after calling
WM_OT_open_mainfile from Python.

Keep the window after loading a file outside the main event loop.
2021-11-02 22:01:38 +11:00
52f4a908f7 Removed compilation warning nullptr check in image engine. 2021-11-02 12:00:07 +01:00
ffd3dd6376 Merge branch 'blender-v3.0-release' 2021-11-02 11:17:53 +01:00
0c3b215e7d Images: refactor how failed image load attempts are remembered
Previously, `ImageTile->ok` and `ImageUser->ok` were used to indicate
whether an image failed to load. There were three possible values
which (probably) had the following meanings:
* `0`: There was an error while loading the image. Don't try to load again.
* `1`: Default value. Try to load the image.
* `2`: The image was loaded successfully.

This image-wide flag did not make sense unfortunately, because loading
may work for some frames of an image sequence but not for others.
Remember than an image data block can also contain a movie.

The purpose of the `->ok` flag was to serve as an optimization to avoid
trying to load a file over and over again when there is an error (e.g. the
file does not exist or is invalid). To get the optimization back, the patch
is changing `MovieCache` so that it can also cache failed load attempts.
As a consequence, `ibuf` is allowed to be `NULL` in a few more places.
I added the appropriate null checks.

This also solves issues when image sequences are used with the
Image Texture node in Geometry nodes (also see D12827).

Differential Revision: https://developer.blender.org/D12957
2021-11-02 11:17:12 +01:00
a2f5a10129 Merge branch 'blender-v3.0-release' 2021-11-02 11:09:09 +01:00
2b3becf2be Fix typo in Cycles PMJ enum define.
Reported by Raimund58 in the chat, thanks!
2021-11-02 11:07:06 +01:00
223f2b27d1 Merge branch 'blender-v3.0-release' 2021-11-02 09:57:16 +01:00
21e168069d Merge branch 'blender-v3.0-release' 2021-11-02 19:52:01 +11:00
8ca6e51ade Cleanup: clang-tidy 2021-11-02 19:50:53 +11:00
a5b996df88 Fix T92608: Image Editor does not display stereo images
Caused by own {rB5aa3167e48b2}.
Related commit: {rBebaa3fcedd23}.

For stereo renders, `BKE_image_is_multilayer` is true, however we seem
to get to down to `space_image_gpu_texture_get` [where this is called]
from `IMAGE_cache_init` with a NULL Image->RenderResult.

So what then happens is that `BKE_image_multilayer_index` is called and
even though it has an appropriate codepath for stereo, it earlies out
and does not set multi_index correctly.

Still a bit puzzled why RenderResult is NULL for a render, but since
other places also check for a valid RenderResult before going down the
_multilayer_ route (and doing _multiview_ instead), now do the same
thing, BKE_image_multiview_index is now called in these cases (and seems
to behave correctly, checked with layers and passes and all seems to
display correctly, either in stereo or choosing individual eyes).

thx @jbakker & @brecht for double-checking.

Maniphest Tasks: T92608

Differential Revision: https://developer.blender.org/D13063
2021-11-02 09:42:32 +01:00
69a7734b75 UI: always show the cursor while transforming the cursor 2021-11-02 19:35:17 +11:00
47d12268e3 Cleanup: Change image engine to CPP.
Added namespace blender::draw::image_engine. Code is still C-a-like.
Only changed the obvious code style to CPP (structs, nullptr, casts).
2021-11-02 09:16:33 +01:00
9cc05fe9c4 Merge branch 'blender-v3.0-release' 2021-11-02 16:08:13 +11:00
af9e0409f1 Merge branch 'blender-v3.0-release' 2021-11-02 16:08:10 +11:00
7b436ead6b Merge branch 'blender-v3.0-release' 2021-11-02 16:08:07 +11:00
2fb43f08e7 Fix "Alt Tool Access" key-map preference with sequencer preview 2021-11-02 16:04:07 +11:00
4511964594 Fix T92721: "Alt Cursor Access" option fails to drag the cursor 2021-11-02 16:04:06 +11:00
a0edddaa0c Cleanup: clang-tidy 2021-11-02 16:04:06 +11:00
5363437555 Merge branch 'blender-v3.0-release' 2021-11-02 00:46:32 -03:00
24310441dd Fix snap cursor still active even when gizmo is not available
The snap cursor continued to appear even when the workspace is changed for example.

So add the region to check in the cursor pool.
2021-11-02 00:43:48 -03:00
75f5edcaf3 Merge branch 'blender-v3.0-release' 2021-11-01 14:48:20 -05:00
348d7c35a9 Geometry Nodes: Support volumes in the set material node
Even though volumes can only have one material, it is still necessary to
allow assigning a material to a prodecurally created volume. This commit
adds volume support and a warning for when a non-constant selection is
used with a volume.

Fixes T92485

Differential Revision: https://developer.blender.org/D13037
2021-11-01 14:46:48 -05:00
6ddbcaa096 Merge branch 'blender-v3.0-release' 2021-11-01 14:42:49 -05:00
55e68f1b70 Fix T92640: Crash with instance input to reverse curve node
`extract_input` can only run once.
2021-11-01 14:42:19 -05:00
e045249a28 Merge branch 'blender-v3.0-release' 2021-11-01 19:54:58 +01:00
1c0be7da4c Fix Cycles integrator presets.
New presets couldn't be added.
2021-11-01 19:52:27 +01:00
b8c573c9cd Fix T92722: Error when saving new render preset
The preset menu name was not renamed in 4ddad5a7ee.
2021-11-01 19:40:23 +01:00
85176c86f0 Fix T92722: Error when saving new render preset
The preset menu name was not renamed in 4ddad5a7ee.
2021-11-01 19:25:11 +01:00
765c2cc6c7 Merge branch 'blender-v3.0-release' 2021-11-01 13:17:54 -05:00
b6c2deef05 Fix T92662: Curve to mesh start cap invalid topology
rBbe3e09ecec5372f switched the order for vertices referenced by the
start cap's corners, but it failed to account for the offset necessary
for edge indices, since the order changed.
2021-11-01 13:13:44 -05:00
6321dd3d40 Fix T92405: Emission Strength Animation of 2.93.5 inherited wrongly in 3.0
CyclesX introduced two new input sockets for the Principled BSDF node in
rB08031197250a. This change is now handled in the versioning code so that
Animation data targeting those sockets are now updated.

Files created with the last Blender release (2.93) or earlier are now
correctly versioned. Files created with 3.0 alpha/beta may need to be
manually updated.
2021-11-01 18:51:58 +01:00
4ed1e19d2f Cleanup: extract versioning code for remapping node socket animation
When node input sockets are animated, they target the socket by index.
As a result, animation data needs to be updated whenever new sockets are
added (except when they're added at the end of the list). The code for
this is now extracted into its own versioning function, so that it can
be used for other versioning steps as well.

No functional changes.
2021-11-01 18:51:55 +01:00
339fd8027f Merge branch 'blender-v3.0-release' 2021-11-01 17:28:40 +01:00
2f667c2bc9 Fix UI messages, typos, etc. 2021-11-01 17:28:07 +01:00
adc540cf7c Fix T92655: spreadsheet_duplicate Split Exception
Check SpaceSpreadsheet's runtime is not null when trying to duplicate
the data when doing an area split.

See D13047 for further details.

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

Reviewed by Jacques Lucke
2021-11-01 08:52:00 -07:00
69e5042258 Fix T92655: spreadsheet_duplicate Split Exception
Check SpaceSpreadsheet's runtime is not null when trying to duplicate
the data when doing an area split.

See D13047 for further details.

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

Reviewed by Jacques Lucke
2021-11-01 08:48:56 -07:00
1704a394d8 Fix T92689: Assert loading file with a sound.
Dummy mistake in rBc8c53ceecc30 (boolean inversion).
2021-11-01 16:44:12 +01:00
d56d3fc6b1 Merge branch 'blender-v3.0-release' 2021-11-01 16:43:26 +01:00
06b183d1ca Fix T91507: Crash when calling context menu from confirmation popup
A typical issue with popup handling: We have to respect the menu-region
and give it priority over the regular region for handling. In this case
there isn't a regular region in context even.
2021-11-01 16:42:46 +01:00
6acba759e0 Merge branch 'blender-v3.0-release' 2021-11-01 11:58:11 -03:00
8fbbd69946 Fix T92629: Crash on mesh separate after rB43bc494892c3.
rB43bc494892c3 switched `BKE_libblock_relink_to_newid` to use new ID
remapping and libquery code.

However, that new code does protect by default against remapping an
objects's data pointer when that object is in Edit mode, since this is
not a behavior that generic BKE code can handle (due to required editing
data for most obdata types when in edit mode).

So specific code that does create new IDs and need remapping in Edit
mode has to pass specific exception flags to remaping code.

This commit adds those remapping flags to `BKE_libblock_relink_to_newid`
and add said exception flag to the remapping call from
`ED_object_add_duplicate` when the object is in edit mode.
2021-11-01 15:46:28 +01:00
e85e126e3f IDRemap: Add option to force remapping obdata in edit mode.
In theory we should never allow remapping of Objects' obdata ID pointer
when the object is in Edit mode. But there are some cases were this is
needed, so adding yet another exception option to remapping flags.

Preliminary change to fix T92629.
2021-11-01 15:46:28 +01:00
c0fbbc53e8 Fix T92605: Snapping not aligning to face extension
Regression indroduced in rB69d6222481b4342dc2a153e62752145aa37ea101
2021-11-01 11:46:12 -03:00
64de6ad4fe Fix use-after-free in image code 2021-11-01 15:36:09 +01:00
2fb725ea30 Cleanup: Unused argument
Fixes strict compiler warnings.
2021-11-01 15:14:49 +01:00
bb3de31f84 Revert "T78995: Enable keylist threaded drawing."
This reverts commit 7f1fe10595.
Fixes: T92549

Root cause hasn't been discovered but assert failed at
keyframes_keylist.cc#793. Like some data is shared between threads.
2021-11-01 15:08:25 +01:00
9de4f64197 Fix compile error on Windows
Caused by 7150f919d3. This undid part of 79a88b5e91. Added a comment
for why this include is needed, to avoid this error from happening
again.
2021-11-01 14:44:18 +01:00
6897c2141e Merge branch 'blender-v3.0-release' 2021-11-01 13:39:24 +01:00
f85c58ab65 Fix Cycles unit test failing after recent changes 2021-11-01 13:38:13 +01:00
fc01801df7 Fix Python error running regression tests after recent changes 2021-11-01 13:21:29 +01:00
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
0eb63328e8 Merge branch 'blender-v3.0-release' 2021-11-01 13:02:48 +01:00
d5e343be27 Fix T92593: Object preview not re-rendered after "Mark as Asset"
When using "Mark as Asset" the second time on an object (after having
done a "Mark as Asset" and then a "Clear Asset"), the old preview would
be re-used, even if the object was changed meanwhile. This is a bit of a
papercut, so always force previews to be re-rendered on "Mark as Asset".
2021-11-01 13:02:18 +01:00
d07e3bde20 Fix Cycles tests after recent logging changes
The constant folding tests rely on logging sync.
2021-11-01 12:47:03 +01:00
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
b6dd5be213 Merge branch 'blender-v3.0-release' 2021-11-01 22:25:27 +11:00
b5eada7f69 Merge branch 'blender-v3.0-release' 2021-11-01 22:25:24 +11:00
Martijn Versteegh
3df587b798 Fix T92681: resolve use of freed filedescriptor in debug builds
Ref D13053
2021-11-01 22:16:34 +11:00
3f0991266f Merge branch 'blender-v3.0-release' 2021-11-01 12:15:09 +01:00
2a4dfaa0e9 Asset Browser: Correct name & tooltip for asset list refresh operator
The name and tooltip were talking about file-lists, which exposes the
fact that the Asset Browser uses the File Browser code in the UI, which
we shouldn't do. This can confuse users.
Instead have a dedicated operator for the Asset Browser with a proper
name and tooltip.
2021-11-01 12:12:28 +01:00
Jarrett Johnson
81bd49d4fe Pointcloud selection support
This patch adds support for selecting pointclouds.

Since pointclouds were not properly drawn to the selection buffer (as diagonsed by output from `glReadPixels` and Renderdoc), they were not able to be selectable by depth picking or occlusion queries. In `basic_engine`, objects were rendered with a shader which draws to a depth buffer but only assumes a single position vertex attribute. Pointclouds, though, require at least another vertex attribute `pos_inst` which provides the instance offsets. Thus, this patch adds another shader variant for pointclouds which supports these two attributes and renders the points appropriately.

{F11652666}

Addresses T92415

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13059
2021-11-01 12:10:34 +01:00
894096a528 GPUState: Fix enum max value for enum operator macro
Simple oversight.
2021-11-01 12:08:46 +01:00
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
Jarrett Johnson
7dd84f05aa Pointcloud selection support
This patch adds support for selecting pointclouds.

Since pointclouds were not properly drawn to the selection buffer (as diagonsed by output from `glReadPixels` and Renderdoc), they were not able to be selectable by depth picking or occlusion queries. In `basic_engine`, objects were rendered with a shader which draws to a depth buffer but only assumes a single position vertex attribute. Pointclouds, though, require at least another vertex attribute `pos_inst` which provides the instance offsets. Thus, this patch adds another shader variant for pointclouds which supports these two attributes and renders the points appropriately.

{F11652666}

Addresses T92415

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13059
2021-11-01 11:41:13 +01:00
fe44001215 Revert "Pointcloud selection support"
This reverts commit a50f8b3fd8.
2021-11-01 11:40:34 +01:00
Jarrett Johnson
a50f8b3fd8 Pointcloud selection support
This patch adds support for selecting pointclouds.

Since pointclouds were not properly drawn to the selection buffer (as diagonsed by output from `glReadPixels` and Renderdoc), they were not able to be selectable by depth picking or occlusion queries. In `basic_engine`, objects were rendered with a shader which draws to a depth buffer but only assumes a single position vertex attribute. Pointclouds, though, require at least another vertex attribute `pos_inst` which provides the instance offsets. Thus, this patch adds another shader variant for pointclouds which supports these two attributes and renders the points appropriately.

{F11652666}

Addresses T92415

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13059
2021-11-01 11:25:23 +01:00
8379eefafb Cycles: Enable debug symbols for Clang
Debug symbols were disabled for Clang at some point due to link issues.
This is no longer the case for any reasonably modern version of Clang.
So this patch removes the check in question.

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

Reviewed By: brecht
2021-11-01 11:38:03 +02:00
5327413b37 Cleanup: Remove Cycles device checks for half float.
All supported devices support half float now, so we can remove the check.

Differential Revision: https://developer.blender.org/D13021
2021-11-01 10:18:30 +01:00
28eaa81f1e Fix Cycles Python warnings when removed OpenCL device was enabled 2021-11-01 08:36:50 +01:00
William Leeson
0b060905d9 Fix T92575: Cycles black pixels when rendering with > 65k samples
Differential Revision: https://developer.blender.org/D13039
2021-11-01 08:36:50 +01:00
0ab1b19de4 Fix T92684: Cycles does not fall back to OIDN if OptiX is not available 2021-11-01 08:36:50 +01:00
cedc80c08d Fix Cycles denoising depth pass missing in compositor 2021-11-01 08:36:50 +01:00
6bc54cddfb Fix Cycles logging some excessive detail with default --debug-cycles 2021-11-01 08:36:50 +01:00
806521f703 Fix T92671: confusing Cycles debug logs about CPU architecture
Instead of printing debug flags listing various CPU and GPU settings that
may or may not be used, print when we are using them. This include CPU
kernel types, OptiX debugging and CUDA and HIP adaptive compilation. BVH
type was already printed.
2021-11-01 08:36:50 +01:00
289f013e64 Merge branch 'blender-v3.0-release' 2021-11-01 17:48:50 +11:00
154a060777 Fix sequencer preview selection drawing ignoring meta-strips
All selection operations respected the currently displayed meta-strip
except for drawing.
2021-11-01 17:43:21 +11:00
49a0453799 Merge branch 'blender-v3.0-release' 2021-11-01 17:22:44 +11:00
Pratik Borhade
6e26c615af Fix T92663: Snap Selected to Active not working properly
Wrong values were passed for use_offset and pivot_point in
2bcf93bbbe

Maniphest Tasks: T92663

Ref D13056
2021-11-01 17:22:03 +11:00
de4793e0e6 Merge branch 'blender-v3.0-release' 2021-11-01 17:16:53 +11:00
55ce05e0bb Merge branch 'blender-v3.0-release' 2021-11-01 17:16:50 +11:00
346a812d7e Fix scale cage gizmo in pose-mode
The active objects matrix was ignored when calculating the cage.
2021-11-01 17:16:45 +11:00
3cd398f16f Fix T92694: Auto Perspective is inconsistent with axis aligned views
Snapping to an axis aligned view with a 45 degree rotation would
set the view orthographic without setting it back to perspective
when orbiting the view as you would expect with auto-perspective.

Now orthographic is only set for views with rotation of 0, 90, 180, -90.

Notes:

- Partially reverts logic from cebd025e02
  at the time RegionView3D.view_axis_roll had not been added,
  so only setting the orthographic with one particular rotation
  was a bigger limitation than it is now.

- Auto-perspective could be supported when snapping the viewport to
  diagonal angles, however that's a larger project.
2021-11-01 17:09:26 +11:00
d052169e7e Fix scale cage gizmo in pose-mode
The active objects matrix was ignored when calculating the cage.
2021-11-01 15:08:28 +11:00
1e749d0602 Cleanup: spelling, use C comments 2021-11-01 14:00:58 +11:00
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
e2937ff24f Merge branch 'blender-v3.0-release' 2021-11-01 13:15:10 +11:00
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
d4d38e8a34 BLI_path_util: assert to ensure BLI_join_dirfile is used correctly 2021-11-01 12:38:12 +11:00
c312c71969 Fix: Build error on all platforms
Types were used before being declared.
2021-10-31 11:52:24 -06:00
Christoph Lendenfeld
b2e9f35c5e Cleanup: Extract function to store bezt arrays
The code to store an original bezt array previously lived in
`graphkeys_decimate_invoke`.
Since future graph slider operators will need this function as well,
it has been extracted.

No functional changes.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12487
Ref: D12487
2021-10-31 11:28:10 +00:00
Christoph Lendenfeld
1b6daa871d Cleanup: Extract keyframe filter to constant
An int flag is used to filter animation channels for
operators to work on. The flag was duplicated multiple times.
This patch removes the duplication by creating a constant

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12486
Ref: D12486
2021-10-31 11:19:40 +00:00
Christoph Lendenfeld
4e502bb6d2 Merge branch 'blender-v3.0-release' 2021-10-31 11:10:11 +00:00
Christoph Lendenfeld
a06abbac92 fix: pose slider consistent color
Change the way the pose slider gets its color so it is consistent
 between editors
Previously the highlight  color would be different between
the 3D viewport and the graph editor.

Reviewed by: Sybren A. Stüvel, Pablo Vazquez
Differential Revision: https://developer.blender.org/D11878
Ref: D11878
2021-10-31 11:08:57 +00:00
ae9052a33e Cleanup: Simplify logic for adding grid in points to volume node
Instead of creating a separate grid first and then merging the points
to volume grid, use the recently added `BKE_volume_grid_add_vdb`
helper function for this purpose.
2021-10-30 17:26:18 -05:00
9cfffe8468 UI: Open File Browser with Thumbnails for Fonts
When browsing to open a font file, open File Browser in Thumbnail View
and sorting by name, instead of using the last-used states.

See D13040 for more details.

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

Reviewed by Julian Eisel
2021-10-30 14:02:34 -07:00
03a962d8ca Merge branch 'blender-v3.0-release' 2021-10-30 16:45:04 +02:00
945a99386b Fix T92256: rotate Instances node does not take scaling into account correctly
Differential Revision: https://developer.blender.org/D13031
2021-10-30 16:44:17 +02:00
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
fcf1ba18f0 Fix: Incorrect component type warning in points to volume node
This node doesn't only support point clouds, it supports any geometry
component type with points, so meshes, curves, and point clouds.
We could explicitly list them to add a warning for volumes, but
that wouldn't really have any practical benefit, and isn't done
elsewhere.
2021-10-29 13:17:33 -05:00
b5f42029b8 Fix T92592: Cycles stereo render not rendering right view 2021-10-29 19:53:14 +02:00
dcdbaf89bd Asset Browser: Correct name & tooltip for asset list refresh operator
The name and tooltip were talking about file-lists, which exposes the
fact that the Asset Browser uses the File Browser code in the UI, which
we shouldn't do. This can confuse users.
Instead have a dedicated operator for the Asset Browser with a proper
name and tooltip.
2021-10-29 16:55:20 +02:00
0c3da7f370 Merge branch 'blender-v3.0-release' 2021-10-29 09:42:24 -05:00
2383628ee1 Nodes: Add translation markers to new socket names and descriptions
As part of the refactor to the node declaration builders, we had hoped
to add a regular expression specifically for these socket names, but
recent discussions have revealed that using the translation marker
macros is the preferred solution.

If the names and descriptions were exposed to RNA, these would not
be necessary. However, that may be quite complicated, since sockets
are all instances of the same RNA types.

Differential Revision: https://developer.blender.org/D13033
2021-10-29 09:41:08 -05:00
837b72fa83 Merge branch 'blender-v3.0-release' 2021-10-29 11:25:32 -03:00
7e94499bb3 Fix snap cursor not working in regions with transparency
Use `BKE_area_find_region_type` instead of using the context region.
2021-10-29 11:23:56 -03:00
d18d87d3e7 Fix T92576: Crash switching from Asset Browser to File Brower
The asset catalog filtering data needs to be cleared when with the other
asset library data of the file list. This is done when changing between
asset and file browser (and in other cases).
2021-10-29 16:00:43 +02:00
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
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
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
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
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
eae59645de Cleanup: Add some comments to some sub-function of foreach_id process. 2021-10-29 11:32:26 +02:00
c112418e95 Merge branch 'blender-v3.0-release' 2021-10-29 11:05:20 +02:00
f13826a572 Fix T92476: wrong context in spreadsheet when area is maximized
Now, if a spreadsheet editor is maximized, it looks for its context in
the unmaximized screen "below".
2021-10-29 11:04:37 +02:00
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
2d42dc4182 Cleanup: remove unused function 2021-10-29 10:39:05 +02:00
7c860ab9d4 Fix T92499: duplicating geometry nodes modifier causes crash
Calling `remove_unused_references` inside the `modify_geometry_sets` loop
was known to be not entirely reliable before. Now I just moved it out of
the loop which fixes the bug.
2021-10-29 10:29:50 +02:00
fb688c8d5c Merge branch 'blender-v3.0-release' 2021-10-29 10:24:37 +02:00
Ankit Meel
be0d5da341 Fix T88877: 2.93: Crash on recent OSX with a non-English locale.
Looks like OSX changed the default format of its locale, which is not
valid anymore for gettext/boost::locale.

Solution based on investigations and patch by Kieun Mun (@kieuns), with
some further tweaks by Ankit Meel (@ankitm), many thanks.

Also add an exception catcher on `std::runtime_error` in
`bl_locale_set()`, since in OSX catching the ancestor `std::exception`
does not work with `boost::locale::conv::conversion_error` and the like
for some reasons.

Reviewed By: #platform_macos, brecht

Maniphest Tasks: T88877

Differential Revision: https://developer.blender.org/D13019
2021-10-29 10:24:08 +02:00
261bb766fb Merge branch 'blender-v3.0-release' 2021-10-29 10:11:26 +02:00
2887d87232 Fix T92324: crash caused by recursive instancing
This fixes one (of possibly multiple) root issues. The collection passed into
the Collection Info node must not contain the current object, because that
would result in a dependency cycle and recursive instancing.
2021-10-29 10:10:58 +02:00
1688cb27cd Merge branch 'blender-v3.0-release' 2021-10-29 09:49:48 +02:00
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
657923cf93 Merge branch 'blender-v3.0-release' 2021-10-29 15:01:50 +11:00
b546202a9a Gizmo: support showing transform gizmos in pose + weight-paint mode
These can be enabled in the gizmos popover.
2021-10-29 15:00:25 +11:00
57f7650dc7 Merge branch 'blender-v3.0-release' 2021-10-29 14:01:19 +11:00
Gilberto Rodrigues
c8aaa00e00 Report "Startup file saved" in info editor
This is consistent with saving the preferences.

Ref D12896
2021-10-29 13:59:44 +11:00
99fbf1716f Merge branch 'blender-v3.0-release' 2021-10-29 13:54:43 +11:00
38fc19d643 Cleanup: rename blf_utf8_next_fast to blf_glyph_from_utf8_and_step
Calling this 'fast' no longer made sense as the slower code-path
has been removed.
2021-10-29 13:49:31 +11:00
1e2589bfa5 Cleanup: remove redundant BLI_UTF8_ERR check 2021-10-29 13:15:39 +11:00
0e71162e68 Cleanup: resolve cast warnings 2021-10-29 13:14:23 +11:00
70947ebc65 BLF Refactor: blf_utf8_next_fast
Simplification of BLF glyph loading

See D13026 for details.

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

Reviewed by Campbell Barton
2021-10-28 18:49:21 -07:00
59534dbee2 BLF Refactor: blf_kerning_step_fast
Simplification of BLF Kerning

See D13015 for more details.

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

Reviewed by Campbell Barton
2021-10-28 18:20:34 -07:00
bbb5a77896 Cleanup: add sections for tool key-maps 2021-10-29 11:34:20 +11:00
0283a22456 Merge branch 'blender-v3.0-release' 2021-10-29 10:53:42 +11:00
8eb10de739 Merge branch 'blender-v3.0-release' 2021-10-29 10:53:39 +11:00
c1c016b9a4 Fix T92468: Annotation Drag option broken in Node Editors
Also enable fallback tool for link-cut.
2021-10-29 10:52:14 +11:00
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
adf82fe943 Merge branch 'blender-v3.0-release' 2021-10-28 22:42:04 +02:00
fc36772b06 Tests: minor updates to benchmark script for running on buildbot
* graph command accepts folder of json files as input
* reset command clears log files
2021-10-28 22:41:40 +02:00
35f4d254fd Fix T92513: Cycles stereo pole merge not rotating along with camera 2021-10-28 22:38:07 +02:00
f2cc38a62b Fix T92255: Cycles Christensen-Burley render errors with scaled objects 2021-10-28 21:53:30 +02:00
049510f425 Fix T92491: Cycles panoramic camera inside volume fails with near clipping 2021-10-28 21:43:08 +02:00
673984b222 Fix T92158: Cycles crash with Fast GI and area light MIS 2021-10-28 21:33:52 +02:00
731926e70e Merge branch 'blender-v3.0-release' 2021-10-28 14:25:14 -05:00
Leon Leno
eda8065afc Fix: Improve node socket icon scaling group input/output list
This patch makes `widget_nodesocket` base the size of the drawn
socket icon on the rectangle that’s passed in to allow it to scale
with the rest of the interface.

Differential Revision: https://developer.blender.org/D11734
2021-10-28 14:24:42 -05:00
a6af0e570d Merge branch 'blender-v3.0-release' 2021-10-28 21:20:25 +02:00
690300eb4a Fix install paths for blender thumbnailer when not building a portable install
When doing a non portable build of blender, the executable
blender-thumbnailer would be installed in two locations:
/usr/bin/
/usr/

While cleaning up, also make the blender thumbnailer dll optional on
windows to bring the logic in line with what it is on linux and mac.

Reviewed By: Campbell Barton, Ray molenkamp

Differential Revision: http://developer.blender.org/D13014
2021-10-28 21:13:47 +02:00
ec9357a94e Merge branch 'blender-v3.0-release' 2021-10-28 16:02:06 +02:00
db8be0cdfb Cleanup: compiler warnings in with Cycles OSL and clang 2021-10-28 16:01:07 +02:00
3620ce7f67 Fix T92503: Cycles OSL crash with material previews 2021-10-28 16:01:07 +02:00
cefb0122b4 Fix T92526: Cycles viewport denoiser red tint after recent changes 2021-10-28 16:01:07 +02:00
60b278a3bb Merge branch 'blender-v3.0-release' 2021-10-28 15:52:19 +02:00
43f97393bb Fix 92550: GPencil Vertex Group is not apply as expected when is inverted
When use Invert option, the weight must be inverted not omitted. This change invert the value if the point had assigned weight to get the right result.
2021-10-28 15:51:40 +02:00
e96b7c0092 LineArt: Fix(unreported) Material mask panel logic
The logic should be: show material mask panel if in_front is on,
it was inverted unintentionally.
2021-10-28 19:38:45 +08:00
ddb4eb8a89 LineArt: Fix(unreported) depsgraph camera error
This fixes unintentional line art error when custom camera doesn't
exist, now not adding custom camera relation in this case.
2021-10-28 19:38:45 +08:00
5f1107ffaf Merge branch 'blender-v3.0-release' 2021-10-28 12:01:01 +02:00
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
289843119d Python doc generator: add missing selected_ids context key
Add the context key I introduced in rB03c0581c6ed to the Python API docs
generator.

No functional changes to Blender.
2021-10-28 11:24:27 +02:00
2f8ed53d6f Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-10-28 11:23:25 +02:00
be7ce7cb4d View3D Context: use correct data type
`CTX_data_selected_objects()` returns a `ListBase` of
`CollectionPointerLink`, not `PointerRNA`. This caused an alignment
issue, resulting in `owner_id == NULL` reported in T92507. Correcting
the pointer type fixed this.

In the end, the same pointer is used as before this commit, but the way
it is obtained is actually correct.
2021-10-28 11:22:47 +02:00
c1cfb475b3 LineArt: Fix(unreported) Material mask panel logic
The logic should be: show material mask panel if in_front is on,
it was inverted unintentionally.
2021-10-28 17:17:48 +08:00
4b57d5a9a0 LineArt: Fix(unreported) depsgraph camera error
This fixes unintentional line art error when custom camera doesn't
exist, now not adding custom camera relation in this case.
2021-10-28 17:13:22 +08:00
4adde62f60 Python doc generator: add missing selected_ids context key
Add the context key I introduced in rB03c0581c6ed to the Python API docs
generator.

No functional changes to Blender.
2021-10-28 10:32:13 +02:00
2501d00268 Python doc generator: raise explanatory error when context key is missing
When a new key is added to the context, it also needs to be added to the
`sphinx_doc_gen.py` file for generating the Python API documentation.
When this isn't done, the script would raise a generic `KeyError`. Now
it explains what needs to be updated to solve the problem.

No functional changes to Blender.
2021-10-28 10:32:13 +02:00
45439dfe4c Preferences: remove special case for copying previous settings
This was only needed for skipping version numbers when the numbering
scheme changed for 3.0.
2021-10-28 17:59:51 +11:00
5568599015 Merge branch 'blender-v3.0-release' 2021-10-28 17:49:15 +11:00
a7879dea7c Merge branch 'blender-v3.0-release' 2021-10-28 17:49:12 +11:00
8761699eab Cleanup: warning in 2a2d873124 2021-10-28 17:47:56 +11:00
43c603c2ff Merge branch 'blender-v3.0-release' 2021-10-28 17:45:28 +11:00
2a2d873124 Fix T92467: Path Selection broken when Drag is set to Tweak
Ctrl-RMB was getting used by "object" selection in edit-mode.

Remove selection key-map from fallback tools,
rely on the editors key-map for selection.
2021-10-28 17:42:59 +11:00
5aeecc0a29 Fix fallback tools for the sequence editor
Only regions with gizmos were checking for fallback tools.
2021-10-28 17:11:23 +11:00
4979537a65 Merge branch 'blender-v3.0-release' 2021-10-28 16:56:11 +11:00
99b6127b73 Merge branch 'blender-v3.0-release' 2021-10-28 16:56:08 +11:00
f0d20198b2 Sequencer: support basic selection & delete from previews
Expose select & strip menus and shortcuts for sequencer preview.
2021-10-28 16:52:22 +11:00
e1fb7740f8 Cleanup: use sections for key-map definition 2021-10-28 14:40:06 +11:00
c647bd899f Merge branch 'blender-v3.0-release' 2021-10-28 14:08:57 +11:00
16f468fb14 Fix T92514: Edit-mode bone snap to cursor uses the center of the bone
Regression in 2bcf93bbbe.
2021-10-28 14:07:12 +11:00
a2f0f98271 Merge branch 'blender-v3.0-release' 2021-10-27 19:07:40 -03:00
b838eaf2b9 Cleanup: remove 'ED_view3d_cursor_snap_exit'
The callers of `ED_view3d_cursor_snap_active` that must handle the snapping of the cursor.
Forcing release at the end can hide leaks.
2021-10-27 19:07:03 -03:00
b69195dd13 Fix memory leak in cursor snap deactivation
Missed in rB32cc9ff03746
2021-10-27 19:06:47 -03:00
7d2c759054 Merge branch 'blender-v3.0-release' 2021-10-27 23:22:37 +02:00
8f02de3de7 Cleanup: remove redundant variable
`free_tooltip` is no longer needed.
2021-10-27 18:11:47 -03:00
e4a5fd4298 Fix broken Python API doc generation after addition of selected_ids 2021-10-27 22:16:36 +02:00
b02c8a40ff Fix broken Python API doc generation after addition of selected_ids 2021-10-27 21:31:08 +02:00
10789c5329 Cycles: tweak scrambling distance UI grouping, and improve tooltip 2021-10-27 20:52:49 +02:00
a8a1f48479 Build: set correct buildbot submodule and library branches for 3.0 2021-10-27 20:52:49 +02:00
78c9c1012b Asset Browser: Increase size of search button a bit
Before this, the search button was quite small really, not much text would fit
into it. Increase the size a bit, but not too much to still make the layout
work in smaller area sizes.
2021-10-27 19:01:15 +02:00
39c11c03d0 Asset Browser: Increase size of search button a bit
Before this, the search button was quite small really, not much text would fit
into it. Increase the size a bit, but not too much to still make the layout
work in smaller area sizes.
2021-10-27 18:56:41 +02:00
3e32a68f38 UI: Refactor how dragging onto text buttons works, fixing issues
There was a bunch of special handling to support dropping data-blocks onto
string or search-menu buttons, to change the value of these. This refactor
makes that case use the normal drop-box design, where an operator is executed
on drop that gets input properties set by the drop-box. This should also make
it easier to add support for dragging assets into these buttons.

In addition this fixes an issue: Two tooltips were shown when dragging assets
over text buttons. None should be shown, because this isn't supported.
2021-10-27 18:51:44 +02:00
bfd2921d38 Revert "Blender 3.0 bcon3 (beta)"
This reverts commit f7a3450e63.
2021-10-27 18:44:28 +02:00
c346bb1990 Revert "3.0 splashscreen"
This reverts commit 78c1c71988.
2021-10-27 18:43:27 +02:00
17efd14682 Merge branch 'blender-v3.0-release' 2021-10-27 18:43:18 +02:00
78c1c71988 3.0 splashscreen
Credit: Blender Animation Studio
2021-10-27 18:42:24 +02:00
f7a3450e63 Blender 3.0 bcon3 (beta) 2021-10-27 18:41:31 +02:00
dab3591588 Blender 3.1 bcon1 - alpha
Bump the version number for the new release cycle.
2021-10-27 18:40:49 +02:00
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
7b9e3534cf Blender 3.1 bcon1 - alpha
Bump the version number for the new release cycle.
2021-10-27 18:38:22 +02:00
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
71adad288b Asset Browser: Activate catalog after adding
Adding a catalog should also activate it, like we do it for adding other
data in Blender. The tree-view code will make sure the newly added item
will not have collapsed parents.
2021-10-27 18:27:50 +02:00
bca9ec767c Revert "Asset Browser: Ensure parent catalogs are expanded when adding child"
This reverts commit 487faed6d0.

I changed my mind on how to implement this feature. Adding a catalog
should also activate it, like we do it for adding other data in Blender.
The activation will automatically make it visible then. See the
following commit.
2021-10-27 18:27:36 +02:00
487faed6d0 Asset Browser: Ensure parent catalogs are expanded when adding child
When pressing the '+' icon to add a new child catalog, or when adding it
through the context menu, the new catalog should be visible. So the
this change makes sure the parent is uncollapsed if needed.
2021-10-27 18:09:00 +02:00
defc1b8e18 Fix: Realize instances versioning fails for curve to mesh node
It assumed that the last input socket was a geometry socket, but now
it is the fill caps boolean option.
2021-10-27 10:24:29 -05:00
87470169e0 Geometry Nodes: Rename more geometry sockets
This is a followup to rB827d7e7d252d48. After this we should
be consistent everywhere with the hints in the names of geometry
sockets.
2021-10-27 09:33:50 -05:00
dc37990e24 Geometry Nodes: Add Image Socket to Switch Node
Add the image type to the switch node without field support.

Differential Revision: https://developer.blender.org/D13012
2021-10-27 09:03:29 -05:00
Alaska
974002743e Cycles: Update UI for Scrambling Distance Patch
The current UI for the Scramble Distance patch is grayed out
depending on different settings that are enabled. However it
didn't make much sense to me so I have updated when the UI is
grayed out to hopefully make more sense to the end user.

Differential Revision: https://developer.blender.org/D12963
2021-10-27 15:58:39 +02:00
0d6f2cb303 Cleanup: remove unused function declaration 2021-10-27 15:57:20 +02:00
9beb5e38a9 Geometry Nodes: output Index from ID node if the geometry has no id
This is consistent with all the other places where we use the id attribute:
If it does not exist, use the index instead.
2021-10-27 15:57:19 +02:00
212b02b548 Geometry Nodes: Show hint in empty output attributes panel
This is meant to add something to the sub-panel when it is empty
so it looks more purposeful, but also add a hint that might be helpful
when figuring out how to output a named attribute.

Differential Revision: https://developer.blender.org/D12715
2021-10-27 08:54:24 -05:00
b6bed63b5b UI: Hide labels for subdivision surface node enums
The text is just too long, it doesn't fit in the node width,
and the tooltips display the property names well enough,
since they aren't used as often as other settings.
Also display the text in lite builds too, there is no reason not to.
2021-10-27 08:52:46 -05:00
383985a91b Geometry Nodes: use index field implicitly in Set ID node
That makes the node more useful by default.
One use case is to delete some points after the Set ID node, then instance
with some randomness. Now when deleting different points, the
randomness will remain stable.
2021-10-27 15:49:14 +02:00
ef6e03c8e0 Fix: Show "new" attribute name typed in nodes modifier input search
Previously it wouldn't be displayed at all for inputs, now just display
it without an "add" icon.
2021-10-27 08:43:31 -05:00
059e5a8a4c Geometry Nodes: use true as default in Set Shade Smooth node
The node is typically only added to enable smooth shading. So this
default is much more useful.
2021-10-27 15:42:02 +02:00
62928b618a Spreadsheet: make id column a bit wider
Ids can often be relatively large numbers when they are generated automatically.
2021-10-27 15:40:14 +02:00
827d7e7d25 Geometry Nodes: Rename some sockets
Subdivision surface: Both geometry sockets renamed to "Mesh"
Points to Volume: Use "Points" and "Volume" names
Distribute Points on Faces: Use "Mesh" input name

These are meant to provide a hint to users which type each
node is meant to use.
2021-10-27 08:36:59 -05:00
c1936be0c5 Spreadsheet: use "id" instead of "ID" as column name
The lower case name is the internal name and will be exposed more
to the user once we have instance attributes.
2021-10-27 15:34:28 +02:00
cc6d5bc241 Fix: typo in info message 2021-10-27 15:31:00 +02:00
7cbb01f07e Fix: incorrect warning in Instances to Points node 2021-10-27 15:29:03 +02:00
9217f5c7a3 Geometry Nodes: change default raycast direction
Raycasting downwards (e.g. onto some terrain) is more common than
raycasting in the positive z direction.
2021-10-27 15:26:13 +02:00
f5d8339fa5 Sequencer: various preview selection improvements
- Only cycle items when the cursor hasn't moved.

  This matches object-mode behavior, making it possible to tweak-drag
  the current selection without first cycling to the next sequence strip.
  Successive clicks will still cycle sequence strips.

- For center selection, use a penalty for the active strip.

- Use a temporary selection list to avoid moving the sequence
  strips out of the scene during selection
  (changing their order when added back).
2021-10-28 00:24:52 +11:00
aea7e55522 WM: de-duplicate cursor motion checks for selection picking
Replace local static mouse coordinate storage with a single function.
also resolve inconsistencies.

- Edit-mesh selection used equality check (ignoring `U.move_threshold`).
- Motion to clear tooltips checked the value without scaling by the DPI.

Also prevent the unlikely case of the previous motion check matching
a different area by resetting the value when the active region changes.
2021-10-28 00:24:52 +11:00
2a709c82c3 Fix sequencer selection toggle
Sequence strips weren't being deselected while holding shift.
2021-10-28 00:24:52 +11:00
ff2e8d6510 Fix building WITH_FLUID=OFF 2021-10-28 00:24:52 +11:00
bbd6dc55d1 Nodes: fix menu when there is no node tree
Previously, some submenus were empty.
2021-10-27 15:23:27 +02:00
19a559d170 Fix warning after recent fluid modifier changes 2021-10-27 15:14:54 +02:00
332de3a2da Cleanup: Add static assert for tree-view getter template
These kind of static asserts for the base type of a template parameter
are useful, and can avoid wrong API usage.
2021-10-27 14:56:57 +02:00
aae5f15238 Asset Browser: Support dragging catalogs to move them in the hierarchy
Uses the additions to the UI tree-view API from the previous commit to
enable drag & drop of asset catalogs. The catalogs will be moved in the
tree including children.
A remaining issue is that a catalog with children will always be
collapsed when dropping. I need to find a way to fix that in the
tree-view API.

There are a few improvements I can think of for the tree-item drag &
drop support, but time for these is too short. These can be done as
normal cleanups at some point.
2021-10-27 14:56:57 +02:00
1832e11f39 UI: Support dragging tree-view items
Adds the needed bits to the UI tree-view API to support dragging
tree-view items. This isn't used yet, but will be in the following
commit for asset catalogs.

There will probably be some further tweaks to the design at some point,
for now this should work well enough for our use-cases.
2021-10-27 14:56:57 +02:00
8507336e76 Fix T92423: Blender freeze rendering animation with Mantaflow
Mantaflow could steal tasks from dependency graph, which under
certain conditions causes a recursive lock involving GIL.

Isolate threading done in mantaflow when it is interfaced form
the dependency graph.

Isolation done from the modifier, since the deeper calls are
branching out quite quickly.

Differential Revision: https://developer.blender.org/D13011
2021-10-27 14:52:53 +02:00
William Leeson
82cf25dfbf Cycles: Scrambling distance for the PMJ sampler
Adds scrambling distance to the PMJ sampler. This is based
on the work by Mathieu Menuet in D12318 who created the original
implementation for the Sobol sampler.

Reviewed By: brecht

Maniphest Tasks: T92181

Differential Revision: https://developer.blender.org/D12854
2021-10-27 14:21:15 +02:00
William Leeson
7b1c5712f8 Cycles: Replace saturate with saturatef
saturate is depricated in favour of __saturatef this replaces saturate
with __saturatef on CUDA by createing a saturatef function which replaces
all instances of saturate and are hooked up to the correct function on all
platforms.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13010
2021-10-27 14:05:46 +02:00
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
051bb46c55 Fix T92241: curve radius and tilt swapped after resampling
This only happened when the spline contained a single point.
2021-10-27 12:36:42 +02:00
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
d161b5d204 UI: Add padding to the left of tree-rows labels without icon
The label was placed right at the left border of the row highlight,
which looked weird. So add some padding to tree-row labels without icon
or collapse chevron, which makes it look more polished. As additional
benefit, it alignes the labels better with icons of other rows on the
same tree level. And the padding makes it more clear that a child is
indeed a child, not just a sibling without icon.
2021-10-27 12:14:47 +02:00
e16bc136f9 Cleanup: Make UI tree-view item constructor explicit
Constructors that can be called with a single argument should be
explicit, unless there's a reason not to, to avoid unintended
constructions.
2021-10-27 12:14:47 +02:00
933215d6da Cleanup: Move 2.80 doversion code under a MAIN_VERSION_ATLEAST check 2021-10-27 11:44:57 +02:00
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
4d605ef2f4 Fix T92427: Adding new nodes does no edge-panning
Unlike translating existing nodes [which disables cursor wrapping and
enables edge-panning instead since rBSa1cc7042a74], adding new nodes
would still show the old behavior of cursor wrapping.

This has been disabled for the case when the node whould be added
outside (due to menus overlapping other editors).

Now enable edge-panning for adding new nodes as well and make sure
this only starts once the mouse has returned into the inside rect once.

Maniphest Tasks: T92427

Differential Revision: https://developer.blender.org/D13005
2021-10-27 10:22:06 +02:00
b94447a298 Fix T92494: Node Editor dot grid not respecting display resolution scale
This seems wrong and was especially noticeable since transform snapping
does account for it (which was reported in T92494).
Now divide the `DotGridLevelInfo` `step_factor` by the default of 20 for
`U.widget_unit` and scale it later by the actual interface scale.

note: when zooming, this will still always snap to the smallest dot
level (not sure, with a bit more work it could be possible to only snap
to the lowest visible level after fading?)

Maniphest Tasks: T92494

Differential Revision: https://developer.blender.org/D13002
2021-10-27 09:56:58 +02:00
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
ec77228f0f Fix T92402: copy_particle_systems use_active fails outside the
Properties Editor

Similar to rBf9308a585ecd, use `psys_get_current` if we cant get the
active psys from context (which is only defined for the Properties
Editor). Other solution would be to define a "particle_system" context
member in other editors, but for now, stick with the simplest solution.

thx @mano-wii for additional input

Maniphest Tasks: T92402

Differential Revision: https://developer.blender.org/D13000
2021-10-27 08:50:37 +02:00
b3b2cd1fa9 Fix T88443: Lattice still shows edges with "Bounds" display type
Lattice wires are drawn as part of "Extras". Unlike the other types
details (Cameras, Lights, Lightprobes and Speakers), Lattices actually
have boundingboxes defined, so hide the lattice wires if only the
boundingbox is requested.

Maniphest Tasks: T88443

Differential Revision: https://developer.blender.org/D11343
2021-10-27 08:35:50 +02:00
d9799e7706 Cleanup: use UNUSED_FUNCTION(..) attribute
Otherwise this function may fail to compile when other changes are made.
2021-10-27 17:20:38 +11:00
55dda9fdb3 Cleanup: use 'use_' prefix for RNA naming in grease pencil modifiers 2021-10-27 17:19:00 +11:00
526e60d4f0 Cleanup: remove underscore prefix from variable
Avoid using underscore prefix since these typically mean the variable
shouldn't be accessed directly (it may be accessed from a macro,
or memory on the stack which is assigned to a pointer).

In this case a more meaningful name can be used for the argument
that was shadowed.
2021-10-27 17:10:39 +11:00
9cb4624296 Cleanup: add missing break 2021-10-27 16:52:50 +11:00
0d155f274f Docs: add docstring for wmWindowManger.winactive
Also justify rounding up font width.
2021-10-27 15:55:36 +11:00
a3b785bc08 Cleanup: clang-format, clang-tidy, spelling 2021-10-27 15:55:36 +11:00
44ac5830c5 Nodes: Cleanup code for header underline alpha
Use `UI_GetThemeColorBlend4f` instead of manually setting alpha opaque.
2021-10-27 04:33:19 +02:00
99a2a73706 win/make.bat: Add svnfix convenience target
SVN seems to die randomly *a lot* during
large updates for some users, and I'm no
closer to finding out why that keeps happening.

"The internet" seems to imply some AV vendors
may be at fault here but nothing conclusive.

The solution however is repeatedly running
`svn cleanup`and `svn update` in the library
folder to repair the corruption and finish the
update.

This change adds a small convenience helper
to automate the repair.

This is done inside the make.bat code rather
than the shared python based update code, since
python lives in the library folder and may
or may not exist when this corruption occurs.
2021-10-26 17:48:16 -06:00
8d8ce64435 Nodes: Cleanup setting node header alpha
Always draw header opaque, set transparency only once after getting
the color. Helps to unify the color and alpha values.
2021-10-27 01:24:19 +02:00
f195a3a30d Asset Browser: Reduce paddings & margins between previews
The paddings and margins were more than needed, this reduces them a bit. That
way space is used more efficiently, the small differences add up so that more
items fit into a row.
The File Browser should not be affected.

Before/after comparisons:
{F11529986} {F11529988}
{F11529987} {F11529989}
2021-10-27 00:07:17 +02:00
2c2d4bc3a3 Knife: Preserve right click cancel functionality
Currently, the knife does not use right click cancel.
It causes users to accidentally delete entire cuts easily.

This patch allows right click cancel when no cuts have been made.
This makes it consistent with other tools when switching between them.
More info: https://devtalk.blender.org/t/gsoc-2021-knife-tool-improvements-feedback/19047/175?u=hobbesos
2021-10-26 22:30:21 +01:00
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
485c634c4c Cleanup: Confusion with knife xray functionality 2021-10-26 21:53:00 +01:00
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
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
b37caa3f06 Fix: Knife unused function warning 2021-10-26 21:21:22 +01:00
71fd0f7b7b Fix: Knife measurements broken when a cut point is in space
Knife angle measurements were mis-aligned if a cut point was in space.
Specifically, the arc drawing would not match with the cut line.

Fixed by removing a correction for kcd->prev.cage.
This correction was originally added for panning with measurements to work.
In hindsight it is not needed and only introduces issues like this.
2021-10-26 21:12:48 +01:00
ca2ae350ec Asset Browser: Improve hint for asset library that isn't found
We already show a message when showing an asset library whose path can't be
found on disk. The red text was making it look like some fatal error happened.
And the message could be a bit more useful generally.

So this removes the red color of the text, (arguably) improves the text and
adds a button as shortcut to open the Preferences with the asset library
settings.

Differential Revision: https://developer.blender.org/D12894
2021-10-26 21:57:38 +02:00
d040493cd4 UI: Rename operator to open Preferences window
Renames the operator from "Show Preferences" to "Open Preferences...".  "Open"
is more clear than "Show" (since they could be shown in-place). "..." is
usually used in Blender to indicate that a new Window or popup will be opened.

Note that vanilla Blender doesn't actually show this name anywhere, so this
change shouldn't be visible. That may change, see D12894.
2021-10-26 21:57:38 +02:00
8422b24e1c Fix: Build issue on windows
Empty initializer is not appreciated by MSVC.
2021-10-26 13:44:26 -06:00
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
319de793d7 Fix T92508: cache invalidation bug in Set Position node
The call to `attribute_try_get_for_output` does some cache invalidation
internally. Under some circumstances the call to `position_evaluator.evaluate()`
recomputed the caches (e.g. when the Normal node was used, the evaluated
handle positions cache on curves were updated). After the positions have
been updated in the Set Position node, the cache was not invalidated again.,
leading to incorrect rendering.

The proper solution will be to do the cache invalidation in `OutputAttribute.save()`
again. That is a bit more involved though. For now just reorder the code a bit
to do the cache invalidation after the field has been computed.
There is a follow up task: T92509.
2021-10-26 20:52:18 +02:00
35aa3bf22d Cleanup: Restore alphabetical order 2021-10-26 13:39:09 -05:00
f81c514bd2 Assets: Disable snap-dragging for linking object assets
The location of a linked object isn't editable, or at least it will be reset
when reloading the file. So the drag & drop shouldn't even pretend like this
would work, so disable the snapping of the object and the bounding-box to show
the snapped object location while dragging.
2021-10-26 20:30:51 +02:00
18ace3b541 Fix linked objects not appearing after dragging in from Asset Browser
When the Asset Browser import type was set to "Link", after dragging in an
object asset the object wouldn't actually appear in the viewport. Do the same
depsgraph tagging (and TODO comment) as the `OBJECT_OT_add_named` operator,
which does similar things.
2021-10-26 20:30:51 +02:00
63de6078da Fix objects not appearing in Outliner after dragging in from Asset Browser
When dragging in an object from an external asset library from the Asset
Browser, the Outliner wouldn't update.
2021-10-26 20:30:51 +02:00
4db4a97355 Node Editor: Style update to nodes
This patch changes how nodes look visually, in an attempt to fix a number of issues:
* The header background is currently drawn using a theme color fully opaque, this limits the colors we can use because the node name/label is drawn on top.
* Hard-coded transparency makes nodes hard to read. The node backdrop already has alpha so if the user wants it they can set it. This patch uses alpha from the theme.
* Better muted status indicator, instead of simply making everything transparent and the wires inside red, draw a red outline around the node, darken the header and backdrop.
* On muted nodes, display wires behind the backdrop to not interfere with text/widgets inside the node.

Nodes:

* Darken header to improve readability of node label.
* Draw a line under the header
* Thicker outline.
* Do not hard-code transparency on nodes, use the theme's node backdrop alpha component.
* Use angle icon instead of triangle (to be consistent with the [[ https://developer.blender.org/D12814 | changes ]] to panels)

Style adjustment to sockets drawing:

* Do not hard-code the socket outline color to black, use `TH_WIRE` instead
* Do not use `TH_TEXT_HI` for selected sockets, use `TH_ACTIVE` (active node outline)
* Do not draw sockets background transparent on muted nodes.
* Thicker outline to help contrast and readability

{F11496707, size=full}

Reviewed By: #user_interface, HooglyBoogly

Differential Revision: https://developer.blender.org/D12884
2021-10-26 20:19:24 +02:00
c7b27f45ae Fix: Show node editor dot grid when there is no node tree 2021-10-26 13:03:09 -05:00
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
be3e09ecec Fix: Inverted normal for one curve to mesh cap 2021-10-26 12:59:46 -05:00
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
b6d2bee28f Geometry Nodes: Support instances in the remove attribute node
This node is still hidden, but allowing removing the `id` attribute is
useful for testing, and possibly optimization in the future.
2021-10-26 12:45:47 -05:00
6871f8482b 3D View, Objects menu: Always show Assets sub-menu
Now that object assets are no longer considered experimental, the Assets
submenu can always be shown (regardless of the Extended Asset Browser
experimental feature).
2021-10-26 19:27:01 +02:00
3286150ac9 Assets: Enable object asset support by default
The two blocking issues for object assets are addressed, see T92111 and T90198.
So now, objects can be marked as assets and be used in the Asset Browser.
2021-10-26 19:24:46 +02:00
7bffddfa6e Don't deselect assets in ED_fileselect_activate_by_id
`ED_fileselect_activate_by_id()` activates an asset (i.e. marks it as
the active asset in the asset browser). To avoid an "active but not
selected" state, it also selects it.

Before this commit, the function would also deselect all other assets,
but that's considered doing too much. If deselection is required, the
`ED_fileselect_deselect_all()` function can be called.

Manifest Task: T92152
2021-10-26 19:21:22 +02:00
a062d86230 Drop object assets and associated objects at the cursor location
When dropping asset objects, place them under the mouse-cursor
along with any other objects they link in.

Ref D12935

Reviewed By: Severin
2021-10-27 04:19:45 +11:00
eaed38cbd3 Add Assets menu to 3D View's Object menu
In the 3D Viewport, add an "Assets" submenu to the Objects menu, for the
same operators as available in the outliner: Mark as Asset, Clear Asset,
Clear Asset (Set Fake User).

Since object assets are still considered experimental, the menu is only
shown when the Extended Asset Browser experimental feature is enabled.
2021-10-26 18:56:13 +02:00
730de2e7fd Asset Browser: Show disabled-hint when dragging external assets over catalog
There's now a message displayed in red next to the cursor explaining that only
assets from the current file can be moved between catalogs.

The previous commit prepared this.
2021-10-26 18:55:27 +02:00
11e8a2ec5f UI: Support disabled-hint for dropping in the tree-view API
A tree-view item's drop controller can now return a message for the user
explaining why dropping isn't possible with the dropped data. This is then
displayed in red text next to the cursor.

This isn't actually used yet, the follow up commit will do that.
2021-10-26 18:55:27 +02:00
03c0581c6e Assets: allow Mark/Clear Asset operators from 3D Viewport
Make it possible to run `ASSET_OT_mark` and `ASSET_OT_clear` operators from
the 3D Viewport. There is no menu entry, just compatibility with pressing
F3 and executing the operators from the operator search.
2021-10-26 18:35:13 +02:00
2d5c9e0baf Cleanup: 3D View context, early returns for clearer flow
Refactor `view3d_context()` to use early `return`s instead of a bundle of
`if`/`else if`/`else`, some of which had `return`s and some not.

No functional changes.
2021-10-26 18:35:13 +02:00
5acbc01d0d Cleanup: 3D View context, use enum values
Use explicit enum values instead of returning 0/1 from `view3d_context()`.

No functional changes.
2021-10-26 18:35:13 +02:00
26e3045eb9 3D View context: return "ok" when fetching view3d context dir
`view3d_context()` would return `-1` ("found but not available") when
fetching the context dir. This is incorrect; it should return 1 ("ok").

This is a semantic change in preparation of further cleanup of the code.
2021-10-26 18:35:13 +02:00
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
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
7979dff9dc UI: Let object drop operator display hint why it's disabled
When dragging an object in non-object mode into a 3D View, there will now be
red text explaining that this is only possible in object mode.
The previous commit enabled this.
2021-10-26 18:14:17 +02:00
df2e053935 UI: Improved feedback when dropping is not possible on drag 'n drop
* Allow operators to show a "disabled hint" in red text explaining why dropping
  at the current location and in current context doesn't work. Should greatly
  help users to understand what's the problem.
* Show a "stop" cursor when dropping isn't possible, like it's common on OSes.

Differential Revision: https://developer.blender.org/D10358
2021-10-26 18:14:17 +02:00
ec831ce5df LineArt: Trimming edges right at the image border
This option allows the edge to end right at the border
instead of extending beyond.
Useful when having multiple camera setup where you
want the border to be clean.
Also moved overscan option down inside "Composition" sub panel
so it makes more sense.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12126
2021-10-27 00:10:49 +08:00
3371a4c472 UI: Improve node editor breadcrumbs display
This patch upgrades node editor breadcrumbs to have slightly more
visual weight, to including the base path of object/modifier/world,
etc, have more visually pleasing spacing, and contain icons.

In the code, a generic "context path" is added to interface code.
The idea is that this could be used to draw other breadcrumbs in areas
like the property editor or the spreadsheet, and features could be added
to all of those areas at the same time.

Ideally we would be able to control the color of the breadcrumbs with a
specific theme color, but since they are drawn with the regular layout
system, that is not easily possible.

Thanks to @fabian_schempp for the original patch.

Differential Revision: https://developer.blender.org/D10413
2021-10-26 11:05:11 -05:00
f1a662c157 Fix: Assert on startup from incorrect float property min 2021-10-26 11:03:45 -05:00
01d7211380 Fix T92505: previewing specific node outputs did not work anymore
This was missing from my refactor in rB5bfe09df2244cb9de0b6554a378eecef77b1e75d.
2021-10-26 17:53:41 +02:00
efbd36429a LineArt: Custom Camera
Allows line art camera to be different from scene active camera,
useful when baking multiple shots in different angle as
well as for motion graphics effect.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12047
2021-10-26 23:44:13 +08:00
773f5065f3 LineArt: Fix prop range for stroke_depth_offset. 2021-10-26 23:44:13 +08:00
c3ef1c15f5 LineArt: Stroke offset towards camera.
Allows the user to turn off in_front option for grease pencil object
and offset strokes towards camera to allow depth interaction of the
rest of the scene.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12046
2021-10-26 23:02:17 +08:00
Charlie Jolly
52ccb44501 Geometry Nodes: Add Brick Texture node
Port brick shader node to GN

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12783
2021-10-26 15:39:53 +01:00
a90cb41cb9 Cleanup: clang-format 2021-10-26 16:35:26 +02:00
d89c4999a7 Fix Cycles runtime GPU kernel compilation after recent refactor 2021-10-26 16:22:50 +02:00
dde11219c6 Cleanup: remove files that should not have been added in file renames 2021-10-26 16:22:50 +02:00
William Leeson
366262bef5 Distance Scrambling for for Cycles X - Sobol version
Cycles:Distance Scrambling for Cycles Sobol Sampler

This option implements micro jittering an is based on the INRIA
research paper [[ https://hal.inria.fr/hal-01325702/document | on micro jittering ]]
and work by Lukas Stockner for implementing the scrambling distance.
It works by controlling the correlation between pixels by either using
a user supplied value or an adaptive algorithm to limit the maximum
deviation of the sample values between pixels.

This is a follow up of https://developer.blender.org/D12316

The PMJ version can be found here: https://developer.blender.org/D12511

Reviewed By: leesonw

Differential Revision: https://developer.blender.org/D12318
2021-10-26 16:11:27 +02:00
4094868f73 Fix T92502: Position Pass broken
The kernel was writing it for the first sample only, while the film
accessor was thinking it needs to be filtered.
2021-10-26 16:06:35 +02:00
Dorian
f41d4735e9 Nodes: support transparency for link highlight color
Node links that are connected to selected nodes are highlighted
using the Wire Select theme color. Now it is possible to change the
transparency of this color to allow the actual link color to be visible
through the highlight (or to turn of the highlight entirely).

Differential Revision: https://developer.blender.org/D12973
2021-10-26 15:55:44 +02:00
567bcb9387 Cleanup: skip unnecessary OIIO image setup when not using tiled render 2021-10-26 15:39:58 +02:00
b937b6d069 Cleanup: silence address sanitizer warning about NULL + 0 2021-10-26 15:39:25 +02:00
8de942b11d Cleanup: compiler warning when building without OpenSubdiv 2021-10-26 15:38:37 +02:00
949dbb08d2 Cleanup: remove useless WITH_CYCLES_DEVICE_MULTI 2021-10-26 15:37:59 +02:00
fd25e883e2 Cycles: remove prefix from source code file names
Remove prefix of filenames that is the same as the folder name. This used
to help when #includes were using individual files, but now they are always
relative to the cycles root directory and so the prefixes are redundant.

For patches and branches, git merge and rebase should be able to detect the
renames and move over code to the right file.
2021-10-26 15:37:04 +02:00
d7d40745fa Cycles: changes to source code folders structure
* Split render/ into scene/ and session/. The scene/ folder now contains the
  scene and its nodes. The session/ folder contains the render session and
  associated data structures like drivers and render buffers.
* Move top level kernel headers into new folders kernel/camera/, kernel/film/,
  kernel/light/, kernel/sample/, kernel/util/
* Move integrator related kernel headers into kernel/integrator/
* Move OSL shaders from kernel/shaders/ to kernel/osl/shaders/

For patches and branches, git merge and rebase should be able to detect the
renames and move over code to the right file.
2021-10-26 15:36:39 +02:00
b698fe1e04 Cleanup: compiler warnings 2021-10-26 15:35:31 +02:00
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
b8b9023d8c Fix drop of dimensionless objects in 3DView
The matrix and location were not being calculated in this case.
2021-10-26 10:07:58 -03:00
af26720b21 UI: Use text highlight theme color for active tab
Currently, both inactive and active tabs are using the `Region Text` theme property.
This patch makes it so active tabs use `Region Text Highlight`.

Since this check is done in other places already but was simply missing in this case, I believe this was just an oversight and not a design decision.

Top is master, bottom is this patch:

{F11520838, size=full}

This allows this kind of tab highlight, not possible before since all tabs would have white text.

{F11520873, size=full}

Reviewed By: #user_interface, Severin

Differential Revision: https://developer.blender.org/D13003
2021-10-26 15:00:46 +02:00
75704091fc Cycles: add additive AO support through Fast GI settings
Add a Fast GI Method, either Replace for the existing behavior, or Add
to add ambient occlusion like the old world settings.

This replaces the old Ambient Occlusion settings in the world properties.
2021-10-26 14:56:43 +02:00
eb1fed9d60 Cycles: restore Denoising Depth pass, when enabling Denoising Data passes
This is still useful in some cases even if not used by OpenImageDenoise. In
the future this may be replaced with a more generic system to control render
passes and filtering, but for now this just does what it did before.
2021-10-26 14:48:44 +02:00
16a8d0fab0 Cycles: change Position render pass to be not antialiased
Similar to the Depth, for compositing the interpolated values between a far
and near object can be non-sensical.
2021-10-26 14:48:44 +02:00
118664e463 Fix custom property editing with Python 3.10 2021-10-26 22:26:35 +11:00
6d3d2988fa Cleanup: spelling in comments 2021-10-26 22:26:35 +11:00
Jeroen Bakker
ddf97d6270 BlenLib: Add JSON Serialization/Deserialization Abstraction Layer.
Adds an abstraction layer to switch between serialization formats.
Currently only supports JSON. The abstraction layer supports
`String`, `Int`, `Array`, `Null`, `Boolean`, `Float` and `Object`. This
feature is only CPP complaint.

To write from a stream, the structure can be built by creating a value
(any subclass of `blender::io::serialize::Value` can do, and pass it to
the `serialize` method of a `blender::io::serialize::Formatter`. The
formatter is abstract and there is one implementation for JSON
(`JsonFormatter`).

To read from a stream use the `deserialize` method of the formatter.

{D12693} uses this abstraction layer to read/write asset indexes.

Reviewed By: Severin, sybren

Maniphest Tasks: T91430

Differential Revision: https://developer.blender.org/D12544
2021-10-26 13:09:10 +02:00
d20fa6c4d4 Geometry Nodes: don't log full fields when not necessary
Previously, the field on every socket was logged for later use. This had
two main negative consequences:
* Increased memory usage, because the fields may contain a lot of data
  under some circumstances (e.g. a Ray Cast field contains the target geometry).
* Decreased performance, because anonymous attributes could not be
  removed from geometry automatically, because there were still fields that
  referenced them.

Now most fields are not logged anymore. Only those that are viewed by a
spreadsheet and constant fields. The required inputs of a field are still
logged in string form to keep socket inspection working.
2021-10-26 12:48:43 +02:00
bird_d
41a4c62c31 Animation UI: Make Ctrl+F use textbox instead of pop-up
Avoid blocking the UI when searching for animation channels with Ctrl+F.

Instead of showing a single text input in a blocking popup, Ctrl+F now
just focuses the search box above the channel list. It feels nicer to
use and has the niceties that come from using that textbox, like
searching per keystroke, compared to the old pop-up method.

As the behaviour of the operator has changed considerably, this also
changes the operator name from `anim.channels_find` to
`anim.channels_select_filter` and updates the keymaps.

Reviewed By: ChrisLend, sybren

Differential Revision: https://developer.blender.org/D12146
2021-10-26 11:56:45 +02:00
816d3f830b CMake: expand instructions for accidental 'cmake' run in source dir
Our CMake setup refuses to run from the source directory (i.e. Blender does
not support in-source builds). Instead, it shows instructions on how to
clean up after an accidental `cmake` invocation. These instructions missed
one directory that should also be removed (`CMakeFiles`), so that's been
added to the message now.

No functional changes to Blender or the build.
2021-10-26 11:46:57 +02:00
5bfe09df22 Geometry Nodes: support viewing field values in spreadsheet
The viewer node has been expanded to have a field input next to the
geometry input. When both are connected (by ctrl+shift clicking on a node)
the spreadsheet will show the evaluated field on the geometry.

The operator to link to the viewer has become a bit smarter. It automatically
detects if it should link to the geometry or field input. In the future some more
smartness could be added, such as automatically relinking the "right" geometry
when viewing a field.

Internally, there are two major changes:
* Refactor of what happens when ctrl+shift clicking on a node to link to
  a viewer. The behavior of the geometry nodes viewer is a bit more complex
  than that of the compositor viewers. The behavior in compositing nodes
  should not have changed. Any change should be reported as a bug (and then
  we can decide if it's worse than before or if it needs fixing).
*  Evaluation, display and caching of fields in the spreadsheet editor.

Differential Revision: https://developer.blender.org/D12938
2021-10-26 11:25:32 +02:00
fee2cedb33 GPencil: Fix(unreported) Dash modifier wrong logic.
When the modifier iterates to an empty layer with no frame it will return,
while the correct logic is to continue.
2021-10-26 17:11:51 +08:00
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
fe68b54edb Cleanup: else after continue. 2021-10-26 10:28:52 +02:00
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
7bc7d1747c Cleanup: forgot to remove empty line in previous commit. 2021-10-26 09:58:03 +02:00
ee743204b0 Cleanup: build warnings.
`NULL` instead of `nullptr` in cpp code, and `else` statements after
returns.
2021-10-26 09:52:08 +02:00
5f9b00a07e Cleanup: Remove unused parameter 2021-10-26 15:05:25 +09:00
89637f40df Cleanup: Improve description for XR absolute tracking 2021-10-26 13:42:09 +09:00
9dbfa05c44 XR: Only show ref space warnings in debug-xr mode
This avoids spamming the console for users who have not set up a
tracking space/boundary for their headsets.
2021-10-26 13:41:02 +09:00
9db13c8d79 XR: Fix potential crash when toggling session 2021-10-26 13:38:59 +09:00
4c0512bc32 XR: Versioning for session draw flags, base scale 2021-10-26 13:37:31 +09:00
7ae2810848 XR: View adjustments for variable viewer scale
This adjusts some calculations and visibility flags for XR viewports in
order to account for a possible scale factor in the XR view matrix.

This scale factor can be introduced via the XR session settings base
scale, which allows a viewer to begin their session at a specific
reference scale, or the XR session state navigation scale, which allows
a viewer to adjust their scale relative to the reference scale during
the session.

Reviewed by Severin as part of D11501, but requested to be committed
separately.
2021-10-26 13:35:12 +09:00
3434a991ec XR Controller Support Step 5: Navigation
Adds navigation transforms (pose, scale) to the XR session state that
will be applied to the viewer/controller poses. By manipulating these
values, a viewer can move through the VR viewport without the need to
physically walk through it.

Add-ons can access these transforms via Python
(XrSessionState.navigation_location/rotation/scale) to use with custom
operators.

Also adds 3 new VR navigation operators that will be exposed to users
as default actions in the VR Scene Inspection add-on. While all three
of these operators have custom properties that can greatly influence
their behaviors, for now these properties will not be accessible by
users from the UI. However, other add-ons can still set these custom
properties if they desire.

1). Raycast-based teleport
Moves the user to a location pointed at on a mesh object. The result
can optionally be constrained to specific axes, for example to achieve
"elevation snapping" behavior by constraining to the Z-axis. In
addition, one can specify an interpolation factor and offset.

Credit to KISKA for the elevation snapping concept.

2). "Grab" navigation
Moves the user through the viewport by pressing inputs on one or two
held controllers and applying deltas to the navigation matrix based on
the displacement of these controllers. When inputs on both controllers
are pressed at the same time (bimanual interaction), the user can scale
themselves relative to the scene based on the distance between the
controllers.

Also supports locks for location, rotation, and scale.

3). Fly navigation
Navigates the viewport by pressing a button and moving/turning relative to
navigation space or the VR viewer or controller. Via the operator's
properties, one can select from a variety of these modes as well as
specify the min/max speed and whether to lock elevation.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D11501
2021-10-26 13:34:58 +09:00
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
Aaron Carlisle
6f5bf8aa3b Sequencer: Expose preview transform operators in menu
The also moves all the image operators into one menu.
The goal here is to expose the operators in the UI so they
work with the operator search and to make the UI consistent.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D12808
2021-10-25 22:19:30 -04:00
4e22a9ab9e Cleanup: Clang format 2021-10-25 22:18:45 -04:00
32cc9ff037 View3D Snap Cursor: don't limit the number of states
The benefit of a flat array in this case is small and limiting, so use a linklist.
2021-10-25 20:16:28 -03:00
40f59b5dad View3D Snap Cursor: sanitize and increase the maximum amount of states
3 is a small amount as each viewport creates a gizmo that creates its own state

Now if the state is not created, the gizmos use the last state.
2021-10-25 19:40:08 -03:00
4468c34378 Geometry Nodes: Optimise Voronoi texture node
This patch improves performance by only assigning
or calculating data for connected sockets.

It is recommended that artists use the lowest dimensions setting
for noise based textures. E.g. Use 2D instead of 3D where possible.

Using a scoped timer and single thread on 256,000 points.
Smooth F1 3D : Debug build
Timer 'Optimised' took 9.39991 s
Timer 'Normal' took 16.1531 s

This optimisation is only for GN and not shaders.

Differential Revision: https://developer.blender.org/D12985
2021-10-25 22:54:49 +01:00
348b5f98f0 UI: Don't use colons at the end of property labels
This was a 2.7x design, now with property split we omit the colon.
2021-10-25 17:23:44 -04:00
8f1284ab78 UI: Make the mesh to volume node slightly narrower
Also use consistent UI names for properties that are similar between
that node and the points to volume node (which happen to be shorter,
allowing the node to be narrower).
2021-10-25 14:20:44 -05:00
3be91d6da5 Cleanup: Remove unused functions, make functions static 2021-10-25 13:39:19 -05:00
046a99d580 Cleanup: silence warnings
```
warning: assignment discards ‘const’ qualifier from pointer target
warning: declaration of ‘co’ shadows a parameter
```
2021-10-25 12:57:05 -03:00
08a1492ae5 Asset Browser: apply search filter to tags as well
The search bar in the asset browser now also matches on asset tags.

- Matching is done on entire tags, so searching for "redder" will not
  show assets tagged with "red".
- All assets are shown that have at least one matching tag. So searching
  for "red green" will show all assets with either "red" or "green" tags
  (or both, of course).
- Searching is case-insensitive.
- Only assets from the active catalog are shown; if all assets should be
  searched through, users can select the "All" catalog.

Manifest Task: T82679
2021-10-25 17:12:56 +02:00
972677b25e UI: Improve layout of custom property edit panel
This patch makes the layout of the custom property panel more coherent
with the rest of the property editor interface, makes it less busy,
allows more space for the buttons for the actual properties, and
simplifies editing values of unsupported property types or long arrays.

 - Remove the box around each property.
 - Use an non-embossed X icon for deleting.
 - Use an "edit" icon instead of the text for the meta-data edit operator.
   The "gear" icon used for editing isn't ideal here.
 - Increase the max array length for drawing the values directly to 8.
 - Add an "Edit Property Value" operator for dictionaries or longer arrays.
 - Replace the "Library Override" text with an icon.
 - Use a proper split factor, the same as the rest of the UI.

Differential Revision: https://developer.blender.org/D12805
2021-10-25 10:01:07 -05:00
Germano Cavalcante
a84f1c02d2 Assets: Snapping with visual feedback while dragging
The drag and drop feature of objects in 3D View has been modified to include:
- Snap the object being dragged.
- Visual feedback through a box and the placement tool grid.

Maniphest Tasks: T90198

Differential Revision: https://developer.blender.org/D12912
2021-10-25 11:57:26 -03:00
b17038db31 Drag Drop: allow customizable drawing 2021-10-25 11:57:26 -03:00
e8027ec2a0 UI Drag Drop: allow customizable drawing
No functional changes.

This commit adds 3 callbacks for `wmDropBox` which allow custom drawing
without affecting the internal dropbox API.

Differential Revision: https://developer.blender.org/D12948
2021-10-25 11:57:26 -03:00
2a7b9f2d45 Cleanup: silence warning in recent commit
Thanks to Dr. Sybren for pointing it out!
2021-10-25 16:52:27 +02:00
6da63b19ff Fix T87627: Asset Browser Search Bar not working
The asset browser search bar was filtering on the filename containing the
asset, and not the asset name. This is now fixed.
2021-10-25 16:39:14 +02:00
1267dfee7c Cleanup: refactor filelist filter functions
Perform a few cleanups:

- Add documentation to explain what returned bools mean.
- Early returns so that flow is clearer and some checks on `is_filtered`
  are no longer necessary.
- Split up `is_filtered_file` and `is_filtered_id_file`, so that they can
  reuse common code, and such that the different filter checks they
  perform can be separated from each other.

The latter is done not only to reduce code duplication, but also as
preparation to fix the asset browser filtering. For that, it helps when
the "filter by file name" and "filter by file type" parts are separate.

No functional changes.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D12991
2021-10-25 16:39:14 +02:00
4758a7d357 UI: Use flat colors for NLA strip drawing
The NLA editor is in need of a design overhaul, hopefully for 3.1 or 3.2.

This should be a project on itself, however, the worst offender currently is the use of
gradients on strips. Something that can be fixed easily.

{F11390293, size=full, loop, autoplay}

A simple replace of `UI_draw_roundbox_shade_x` for `UI_draw_roundbox_4fv` brings strips
in line with how other areas are drawn.

This patch also:
* Remove embossed lines around active action channel.
* Highlight the strip while being moved.

This patch does not include any theme changes. This will be tackled separately.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D12968
2021-10-25 16:29:26 +02:00
1bc28fc73b Fix T92466: Crash snapping to text objects with XRay shading
Should have been addressed along with {rB6cff1d648030}
2021-10-25 11:26:01 -03:00
bc2f4dd8b4 Geometry Nodes: Add "Fill Caps" option to curve to mesh node
This adds an option to fill the ends of the generated mesh for
each spline combination with an N-gon. The resulting mesh is
manifold, so it can be used for operations like Boolean.

Differential Revision: https://developer.blender.org/D12982
2021-10-25 09:10:44 -05:00
4b1ad2dc17 Fix T92361: Zooming nodes clips text labels
While c7d94a7827 exposed this bug,
this was caused by text widths being calculated without taking the zoom
level into account since drawing at a smaller size is often wider than
the width of the larger text scaled by the zoom.
2021-10-26 00:25:29 +11:00
cfde1f9f3b Geometry Nodes: Keep Add menu sorted alphabetically 2021-10-25 15:14:40 +02:00
b15e1861ac Fix T92460: crash when instancing on curves generated from string
Issue is that the Instance on Points node currently expects that all
instance references are used (see `remove_unused_references`).
This should be fixed at some point, but for now make sure that
the String to Curves node does not output unused references.
2021-10-25 15:12:50 +02:00
bd7f1c5cce Fix non-capitalized UI message. 2021-10-25 14:41:47 +02:00
cdcca917cf Tests: assets, add BKE callback init/finalize to test setup/teardown
Add calls to `BKE_callback_global_init()` and `BKE_callback_global_finalize()`
to ensure unit tests mimick Blender (and don't trip the assertions added
in rBbeea601e7253).

No functional changes to Blender.
2021-10-25 14:21:43 +02:00
4100a79219 Assets: Add Author field to asset metadata
This is information you'd typically want to be visible in the UI. It's optional
of course, so if not relevant, it can just remain unset.
2021-10-25 13:51:14 +02:00
e7bea3fb6e Assets/IDs: Don't generate previews for object types with no real geometry
Object types like empties, cameras or lamps will just end up as empty preview
images. We can think about ways to visualize them still, but meanwhile, don't
create such an empty preview.

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

Reviewed by: Bastien Montagne, Sybren Stüvel
2021-10-25 13:33:16 +02:00
60e2103507 Fix: crash in previously added versioning code 2021-10-25 13:30:00 +02:00
5c2330203e Fix T92293: Clipped labels for graph editor modifiers
While c7d94a7827 exposed this bug,
this was caused by a discrepancy in padding where labels would
have additional padding when drawing without emboss.
The padding made widget drawing behave as if the text took up more
room causing it to be clipped.

Now labels are considered the same width with/without emboss.
2021-10-25 22:28:06 +11:00
8cecf88dca Cleanup: clang-tidy, spelling 2021-10-25 22:28:06 +11:00
61bb70e0c7 GPencil: Fix unreported double stroke color in materials panel
There was an extra stroke color in the side panel, but this prop must be visible only in Topbar.
2021-10-25 13:14:54 +02:00
039094c1ec Geometry Nodes: new Image Texture node
This adds a new image texture node for geometry nodes. It does not
reuse the same node that is used in shading, because we want to be
able to expose the image and frame as sockets.

There is a known update issue when a movie or image sequence is
used. That will be fixed separately (also see D12957).

Currently, the image socket is just a pointer to an Image ID data block.
This can contain single images but also movies and image sequences.
In the future, the definition of an image socket can be expanded to
include images that are generated from scratch in the node tree.
For more details read the discussion in D12827.

Some of the code is a direct port from cycles and should be cleaned
up a bit in the future. For example `image_cubic_texture_lookup`.

For still images, the frame input is ignored. Otherwise, the frame
has to be in a valid range for the node to work. In the future we
may add e.g. automatic looping functionality.

Differential Revision: https://developer.blender.org/D12827
2021-10-25 13:03:57 +02:00
2b91445ddd Cleanup: rename Outliner function
Seems like typos in rB32dc085289ac

outline_batch_delete_hierarchy --> outliner_batch_delete_hierarchy

Differential Revision: https://developer.blender.org/D12989
2021-10-25 12:58:52 +02:00
3c2e4f4cfd Fix T91411: Outliner crash using contextmenu operators from a shortcut
Oversight in {rBb0741e1dcbc5}.

This was guarded by an assert in `get_target_element`, but it can be
valid to have these assigned to a shortcut (and then perform the action
without an active outliner element).

Now remove the assert and let the operator polls check if we really have
a target element.

note: this basically makes `get_target_element` obsolete, could call
`outliner_find_element_with_flag` instead in all cases.

Maniphest Tasks: T91411

Differential Revision: https://developer.blender.org/D12495
2021-10-25 12:58:43 +02:00
06ae3c98eb Spreadsheet: fix updating active domain when component type changes
The mesh and instances case wasn't handled before.
2021-10-25 12:46:39 +02:00
892e5f4a9f Asset Catalogs: be more accepting of backslashes as separators
Asset Catalog Paths should only contain forward slashes as separators, but
now the UI is more resilient to people using blackslashes instead.

Manifest Task: T90553
2021-10-25 12:37:35 +02:00
550cbec5c4 Cleanup: asset catalog path test, improve sub-test separation
Put related lines in a block of their own, such that each block doesn't
have access to the variables of the previous blocks.

This makes it easier to correctly copy-paste some tests, as the compiler
forces you to update the code afterwards.
2021-10-25 12:37:35 +02:00
31f6e78370 Fix T92073: Cycles flicker when panning in camera view with border render
Panning in camera view makes the border to be modified, which was causing
the Cycles display to believe the rendered result is unusable.

The solution is to draw the render result at the display parameters it was
updated for. This allows to avoid flickering during panning, zooming, and
camera FOV changes. The suboptimal aspect of this is that it has some jelly
effect, although it is on the same level as jelly effect of object outline
so it is not terrible.

Differential Revision: https://developer.blender.org/D12970
2021-10-25 12:12:10 +02:00
beea601e72 BKE Callbacks: more explicit initialisation check
Add static boolean to track whether the callbacks system has been
initialised. This makes it possible to make the `BKE_callback_remove()`
function more noisy in case of programming errors, and avoids accessing
`funcstore->alloc` when `funcstore` was potentially already freed.

Thanks @campbellbarton for pointing this out.
2021-10-25 12:08:08 +02:00
8e56f3e8a3 Image: Fix Crash During Undo.
Fixes T91294.
2021-10-25 11:41:49 +02:00
b3ca926aa8 Geometry Nodes: use vector socket for offset in Set Position node
This replaces the boolean Offset input in the Set Position node with
a vector input. This makes the node easier to use. Using a "Position"
input as an "Offset" sounds wrong anyway.

The Position and Offset inputs are evaluated at the same time.

The versioning only works correctly when the Offset input was not connected
to something else before.

Differential Revision: https://developer.blender.org/D12983
2021-10-25 11:37:45 +02:00
1ecb4e6fd8 Fix T92446: node editor overlays reset automatically
Caused by rBcf72b10075758be971f9806b97db01f98383aba2.

The fix is to only enable the flags when a new node editor is actually created.
2021-10-25 11:30:41 +02:00
15762e9611 Fix T92430: Infinite recursion in some cases in new append code.
Shapekeys, always shapekeys... Since we cannot deal with them as regular
IDs, we need to handle potential recursion cases ourselves here. sigh.
2021-10-25 10:57:41 +02:00
d16e732638 UI: Refactor dropping support for the tree-view API
Introduces a dropping-controller API for the tree-view items,
`AbstractTreeViewItemDropController`. This reduces responsibilities of the main
tree-view item classes, which are already getting quite big. As I expect even
more functionality to be needed for it (e.g. drag support), it's better to
start introducing such controller types already.
2021-10-25 10:46:52 +02:00
c4fa17c67a Cycles: More accurate volume stack size calculation
The idea is to allow having a lot of non-intersecting volumes without
allocating volume stack to its full size.

With the F11285472 file the memory usage goes from 1400 MiB to 1000
on the RTX6000 card.

The fix makes it so the integrator work memory is allocated after
scene update which has downside of possible less efficient update
when some textures don't fit GPU memory, but has an advantage of
making proper decision and having a clear and consistent internal API.

Fixes memory part of T92014.

Differential Revision: https://developer.blender.org/D12966
2021-10-25 09:27:21 +02:00
8733d310e5 Cycles: Revert all host update specific changes
The approach didn't turn out to be that useful after all as there
are unavoidable dependencies of data from the device. For example,
to know whether object intersects volume or not it is required to
run displacement kernels.

The way of splitting host and device updates caused state where
some data is not yet available, causing confusion and leaving
code to be error-prone.
2021-10-25 09:27:21 +02:00
b714f9bf43 Fix T91931: Thumbnail Missing Region
Fixes a crash when blend thumbnails set to Camera View when there is
no camera, which resulted in use of a null region.

See D12748 for more details.

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

Reviewed by Campbell Barton
2021-10-24 22:12:20 -07:00
Andrea Beconcini
82ae7b990a Fix T90633: Frame all doesn't use meta range
This commit fixes T90633, it changes the behavior of the `Frame All`
operation when the user is tabbed into a metastrip: instead of using
the scene timeline's range, `Frame All` uses the current metastrip's
range.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D12974
2021-10-25 06:47:51 +02:00
84f7bf56a8 Fix T90855: Transform effect gives inconsistent output
When using downscaled preview size with proxies, transform effect
doesn't compensate for fact, that pixels are effectively larger. There
was compensation for scene render size already.

Use same compensation method as text effect uses for font size.
2021-10-25 05:35:54 +02:00
4266538ab9 Fix T90835: Strip snaps to first and second frame
This was caused by strips with single frame input like single image
strip or color strip. their length is always 1, and so content length
was calculated to end after first frame.

There was code handling this case, but it was also checking for
`anim_endofs` and `endstill` values. Anim offset values have no effect
on these strips and still frame value was used incorrectly. So these
chacks can be removed completely.
2021-10-25 04:33:43 +02:00
28ad680ff0 Fix T90836: Strip snaps to empty space
This was caused by snap to hold offset feature, which calculates strip
content boundary, but it can be outside of strip boundary.

Clamp content start and end values so they are always inside of strip.
2021-10-25 04:24:41 +02:00
3e75f70acd Geometry Nodes: Remove repeated instance attribute names in search
This commit makes sure that each attribute name is only added once
when logging geometry values for attribute search.

The `attribute_foreach` function for a single geometry component
deduplicated names, but a much more common situation is to have
more than one component in the instances of a geometry set.

Differential Revision: https://developer.blender.org/D12959
2021-10-24 13:24:02 -05:00
6f0dd4f0f0 Fix: memory leak after type conversion in geometry nodes group
The leak happened when two things were true:
* Inside of a node group a socket is linked to a Group Input that has
  a different type.
* The corresponding input on the parent Group node is not linked.

The conversion happened correctly, but the original value wasn't
destructed.
2021-10-24 19:26:07 +02:00
665657812d Cleanup: quiet asan warning because of uninitialized variable 2021-10-24 18:20:06 +02:00
cc388651eb Fix T92327: use default value when field is passed into data socket
Previously, the computed value passed into the data socket could depend
on the actual field a bit. However, given that the link is marked as invalid
in the ui, the user should not depend on this behavior.
Using a default value is consistent with other cases when there are
invalid links.
2021-10-24 17:53:19 +02:00
6ce383a9df Cleanup: cross-reference right pointing arrow literal
This value is defined in the UI module, but happens to be used
in string_search.cc too. Note that these references need to be kept in
sync. Use escaped utf-8 sequence since the literal can be avoided.

Also replace BLI_str_utf8_as_unicode calls with constant assignments
as these values are known there is no need to decode a utf-8 sequence.
2021-10-24 22:38:25 +11:00
1411118055 Cleanup: spelling in comments 2021-10-24 21:04:04 +11:00
e288e392a8 Cleanup: line length in Python scripts 2021-10-24 21:04:04 +11:00
Erik Abrahamsson
dc2524eaae Geometry Nodes: Rename node "String Substring"
This patch renames the node "String Substring" to "Slice String"
to conform to the "verb first" naming convention.
Default length is also changed to 10 to make it easier for users
to understand what the node does.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D12931
2021-10-24 11:43:54 +02:00
8c21667f3c Cleanup: remove unused function
It doesn't have definition either.
2021-10-23 22:02:26 +02:00
a3d0b50d75 Cleanup: use underscore suffix for private data members 2021-10-23 22:02:26 +02:00
dd505a7ebb Fix T92400: Denoise node Prefilter output is always "Fast"
Caused by an accidental renaming in {rB1c42d4930a24d639b3aa561b9a8b4bbc}
2021-10-23 22:02:26 +02:00
7a0cad0989 Fix: Add missing TBB define to geometry module 2021-10-23 12:31:48 -05:00
9ad642c59a Assets/UI: Improve asset library Preferences UI
* Open File Browser when pressing "Add Asset Library". This just makes sense,
  since users have to select a directory for the asset library anyway.
* Move '+' icon back to the right side of the box. Then it is right under the
  'x' icons for each indivdual library, which seems like the more natural
  place.
* Correct tooltip for the "Add Asset Library" operator.
* Mark empty asset library name or paths field in red, to make clear that these
  need to be set.
2021-10-23 18:07:48 +02:00
50e7645211 Fix: Asset using selection in instances to points node
Caused by my own incorrect cleanup when committing the patch.
2021-10-23 00:42:07 -05:00
3bcd264141 GitHub: add PR template
Differential Revision: https://developer.blender.org/D12890
2021-10-23 10:49:51 +05:30
Jarrett Johnson
3af597d16b Geometry Nodes: Add Instances to Points Node
This node takes a geometry set with instances as input and outputs
points located on the origins of the top level of instances in the
geometry set (not nested instances). It also has position and radius
inputs to allow overriding the default, and a selection input to only
generate points for some instances.

The use case for this node is a method to use geometry proximity on
instance origins, but in a more generic way that is flexible and useful
in other situations.

Differential Revision: https://developer.blender.org/D12893
2021-10-23 00:01:59 -05:00
2a7a8a04e3 Fix: Empty geometry nodes input menu with legacy nodes enabled
Caused by a misplaced comma at the end of a line in Python.
2021-10-22 22:35:27 -05:00
231d66d8ba Fix: Support swapped inputs properly in trim curve node
Previously, when the start input was greater than the end input,
the spline was resized to a single point. That is correct, but the
single point wasn't placed properly along the spline. Now, it is
placed according to the "Start" value, as if the trim started, but
couldn't continue because the "End" value was smaller.

This behavior is handled with a separate code path to keep each
simpler and avoid special cases. Any cleanup to reduce duplication
should focus on making each code path shorter separately rather
than merging them.

Also included are some changes to `lookup_control_point_position`
to support cyclic splines, though this single-point method is still
disabled on cyclic splines for consistency.
2021-10-22 17:32:21 -05:00
Xavier Cho
62d64bec2a Docs: Fixes and improvements in API documentation
Fixes several notable mistakes and missing information
regarding the API documentation (*.rst).

This will allow API stub generators like bpystubgen or
fake-bpy-module to produce more accurate result.

Differential Revision: https://developer.blender.org/D12639
2021-10-22 18:27:16 -04:00
1d9e2dc954 Fix: Cyclic single point bezier splines have multiple evaluated points
Because `segment_is_vector` didn't handle the combined cyclic and
single control point case, it returned false, that the "segment" should
have the resolution evaluated point count. To avoid checking the size in
every call, add an assert for the size and check it elsewhere.
2021-10-22 17:13:26 -05:00
cfc64261c1 Asset Browser: Filter options for specific ID types
Adds a filter popup to the header that allows specifiying which data-block
types to show. The menu automatically reflects all supported ID types, so it
shows a checkbox for materials, worlds and actions currently by default, and
all ID types with the "Extended Asset Browser" experimental feature enabled.
2021-10-22 23:56:05 +02:00
c51eac24fe UI: Correct icons of File Browser Link/Append ID filter settings
Wasn't using the same icons as usually used for these IDs, which can be
confusing. Corrected them to be consistent with other usages of these IDs.
2021-10-22 23:54:03 +02:00
ca5d84b31d UI: Show ID filter settings in Link/Append File Browser as icon & checkbox
The checkboxes integrate better with the surrounding layout and are not that
attention grabbing. To my knowledge the only reason not to use checkboxes was
so the icons could be displayed. But this does it just like the Outliner filter
settings: Show the icon before the checkbox.

Also widen the popover a bit to fit longer labels (didn't fit before this patch
even).
2021-10-22 23:53:11 +02:00
3e1fd26828 Fix: Assert for unused field evaluator in resample curve node
Declare it at a lower scope so it doesn't go unused in evaluated mode.
2021-10-22 16:39:39 -05:00
8cd4cee0d5 Fix: Double calculation of UVs in cone primitive 2021-10-22 16:21:37 -05:00
cf72b10075 UI: Turn on overlays by default in new node editors
This was missed in the initial commit adding the node editor overlays.
2021-10-22 16:21:16 -05:00
742b7adbad Cleanup: Remove unused function 2021-10-22 16:01:48 -05:00
7ac4e874db Fix panel pinning showing for instanced panels (e.g. FCurve modifiers)
This was reported for FCurve modifiers, but was also true (in theory) for
other instanced panels (regular modifiers, spreadsheet filters, ...),
these would not show pinning for other reasons (no caterories).

So in the case of the Graph Editor the follwing happens:

`graph_buttons_register` only registers `GRAPH_PT_modifiers`, the panel
itself has no header (PANEL_TYPE_NO_HEADER), further panels for
individual modifiers are added dynamically in `graph_panel_modifiers`.
So when pinning a particular modifier, we would pin e.g. `GRAPH_PT_noise`
(not `GRAPH_PT_modifiers`).
ED_region_panels_layout_ex would only collect panels known to
`graph_buttons_register` (so is not aware of the specific panels of
modifiers). So while I think it should be possible to pin
`GRAPH_PT_modifiers` on top of an individual modifier's panel this would
result in all modifiers being shown in other categories [which would also
be weird]. Panel header layout was also not correct (drawing the pin
icon over the modifier delete icon).

So to resolve this, just dont use pinning for these type of panels.

part of T92293.

Maniphest Tasks: T92293

Differential Revision: https://developer.blender.org/D12965
2021-10-22 19:23:18 +02:00
cca811de98 Fix test print wording that confuses build bot highlighting. 2021-10-22 18:26:12 +03:00
7ef3fe492e Asset Browser: fix issue rebuilding the visible asset filter 2021-10-22 16:40:24 +02:00
cd6fc651ce Asset Browser: add notifiers on catalog edits
Send out notifications on catalog edits. This way all asset browsers will
refresh when catalogs are edited.
2021-10-22 16:35:18 +02:00
85312f2236 Asset Browser: Show "orphaned" assets in "Unassigned" catalog
Show assets that have an unknown catalog ID assigned in the "Unassigned"
catalog.

Another catalog named "Orphans" was considered as well, but that would
clash with the usual handling of Blender (discarding orphan data on
save) and thus that idea was discarded.

Manifest Task: T91949
2021-10-22 16:32:05 +02:00
70aad5f498 Asset Catalogs: support reloading without losing local changes
Keep track of unsaved asset catalog changes, in a more granular way than
just one boolean per asset library. Individual catalogs can now be
marked with a flag `has_unsaved_changes`. This is taken into account
when reloading data from the catalog definition file (CDF):

- New catalog in CDF: gets loaded
- Already-known catalog in CDF:
    - local unsaved changes: on-disk catalog is ignored
    - otherwise: on-disk catalog replaces in-memory one
- Already-known catalog that does not exist in CDF:
    - local unsaved changes: catalog is kept around
    - otherwise: catalog is deleted.

Because this saving-is-also-loading behaviour, the "has unsaved changes"
flags are all stored in the undo buffer; undoing after saving will not
change the CDF, but at least it'll undo the loading from disk, and it'll
re-mark any changes as "not saved".

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12967
2021-10-22 16:31:32 +02:00
16ffa7bb6e Asset Catalogs: push undo step before saving to disk
Since writing asset catalogs to disk also means loading any on-disk
changes, it's a good idea to store an undo step.
2021-10-22 16:31:32 +02:00
76ebc10794 Increase assert epsilon in versioning for D9551.
The epsilon was too optimistic. Snapping to hard-coded (0,-1,0) at
singularity should produce max delta 0.0005, but double it to be safe.
This only affects debug builds obviously.
2021-10-22 17:17:21 +03:00
39f88480bb Cleanup: improve consistency between function node implementations 2021-10-22 15:34:53 +02:00
0c16ac9ddf Cleanup: restore alphabetic ordering 2021-10-22 15:27:10 +02:00
Dorian
781289e31f Geometry Nodes: add Boolean and Integer Input nodes
These nodes just output a single value of their respective types,
making it possible to control multiple inputs with the same value.

Differential Revision: https://developer.blender.org/D12932
2021-10-22 15:01:28 +02:00
01e2a532f5 Fix T92290: Linked Color Palette datablocks can not be used.
* Forbid editing linked palettes.
* Make `color` RNA property of ColorPalette '`LIB_EXCEPTION`', so that
  the color buttons in the palette template remain active on linked data.

NOTE: This incidently makes linked palettes' colors editable from RNA,
not from UI though, so think this is OK for now.
2021-10-22 14:59:40 +02:00
Gilberto Rodrigues
029cf23d71 UI: Fix misaligned icons
This patch corrects the misalignment of some icons.
Some of them can't be centered because they would look blurry, but look better if shifted to the right instead of shifted to the left.

{F10864196 size=full} {F10864202 size=full}

{F10864216} {F10864228}

{F10864231 size=full} {F10864234 size=full}

{F10867008 size=full} {F10867015 size=full}

Reviewed By: #user_interface, pablovazquez

Differential Revision: https://developer.blender.org/D12789
2021-10-22 14:34:22 +02:00
c4b02bb6bc Fix Cycles HIP binaries always recompiling 2021-10-22 14:32:24 +02:00
269f4a3024 Fix VSE left crop not working
Caused by using 3D math on 2D vectors, violating memory boundaries.

Use temporary float[3] variable.
2021-10-22 14:31:04 +02:00
ab1909fe06 Deps: Python, install Cython package
Cython was already bundled with Blender's libraries in SVN (as dependency
of Numpy, see rB5bddfde217b1), but was never actually installed in the
CMake install step. As a result, `import cython` would fail. This is
now fixed.
2021-10-22 14:01:47 +02:00
282516e53e Cleanup: refactor float/half conversions for clarity 2021-10-22 13:03:03 +02:00
65dbeb1d81 Fix T90638: Inconsistent object data behavior when link-duplicating collections.
Camera, lattice and speaker object types were missing there own proper
`USER_DUP_` flags, leading to not properly handling duplication of their
object data.

NOTE: We could probably simply opions here, by using categories (like
'GEOMETRY', 'SHADING', etc.) instead of exact object types. But this is
beyond bugfix scope.
2021-10-22 12:35:40 +02:00
Sayak Biswas
d092933abb Cycles: various fixes for HIP and compilation of HIP binaries
* Additional structs added to the hipew loader for device props
* Adds hipRTC functions to the loader for future usage
* Enables CPU+GPU usage for HIP
* Cleanup to the adaptive kernel compilation process
* Fix for kernel compilation failures with HIP with latest master

Ref T92393, D12958
2021-10-22 12:15:29 +02:00
d1fcf93f03 Geometry Nodes: disable attribute search for non-attribute string sockets
This is a simplified version of D12730 by @erik85.

I added attribute search only to one legacy node for testing purposes.
2021-10-22 11:56:19 +02:00
675a22b341 Nodes: fix link drawing for some socket types
The type of sockets is `-1` in some cases, resulting in a crash
when accessing the `std_node_socket_colors` array.
2021-10-22 11:56:19 +02:00
1133b1478e Cleanup/Fix (unreported) 'make single user' handling of actions.
Actions of duplicated objects would not be properly made single user,
unlike obdata and materials.

Further more, there is no reason to manually handle such animdata
copying here, `BKE_id_copy_ex` can do that for us with the proper flags.
2021-10-22 10:19:15 +02:00
c37121f16c Fix T91410: Make Single User operation ignores linked data-blocks.
Now 'Make Single User' will also create local copy of linked data as
needed.

IMPORTANT: Unlike with local data, this always happen, even if linked
data has only one user. This avoids e.g. cases like two local objects
sharing a same linked mesh, then when calling 'Make Single User ->
Object and ObData' on both objects, yu expect both of your objects to
get localized meshes, not one of them keeping its linked, un-editable
mesh.
2021-10-22 09:59:36 +02:00
622d8b77a6 Cycles: improve communication of supported GPUs in preferences
Mention required CUDA and OptiX compute capability and minimum driver
version. For HIP there is a placeholder until we know the supported
architectures.
2021-10-22 08:56:13 +02:00
fa688fbf06 Build: improve descriptions and organization of Cycles build options 2021-10-22 08:34:31 +02:00
b0d64841d2 Cycles: keep HIP device disabled until we have binaries
And clear communication about supported hardware.

Ref T92397
2021-10-22 08:18:53 +02:00
05ab3356a7 Cleanup: spelling in comments, use C style comments 2021-10-22 10:28:56 +11:00
3e1baa7d53 Fix T92357: assert changing scenes while in edit mode
ScrArea.runtime.tool needs to be updated after switching scenes.
2021-10-22 10:18:59 +11:00
bdbaf0301d Fix crash when creating a new window fails
Also add operator error report.
2021-10-22 10:18:59 +11:00
d9ebe25a0c Fix errors in be171b295f
´´´
error C4133: 'function': incompatible types - from 'float [2]' to 'int *'
error C4133: 'function': incompatible types - from 'const int [2]' to 'const float *'
´´´
2021-10-21 18:23:46 -03:00
f45470472f Cleanup: Compile warnings 2021-10-21 17:00:38 -04:00
94fb47e572 Assets: Enable material and world assets by default
Both material and world assets should be ready to use as non-experimental
feature. They were not enabled by default yet because the work from the
previous commit was needed first.
Objects should follow soon.

Maniphest Task: https://developer.blender.org/T91752
2021-10-21 22:18:59 +02:00
a286148799 Assets: Allow specific data-block types to be enabled by default
Updates UI code so that we can enable the asset UI for specific data-block
types by default, i.e. irrespective of the "Extended Asset Browser"
experimental feature.
"Mark as Asset" and "Clear Asset" are always visible in the Outliner context
menu now, but are grayed out if not applicable and show a disabled hint in the
tooltip.

A known side-effect of this: The "Mark as Asset" and "Clear Asset" operators
are enabled for action data-blocks now, even though only pose actions created
through the Pose Libraries add-on are supported. If this is something worth
addressing is being discussed still.

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

Reviewed by: Sybren Stüvel
2021-10-21 22:18:59 +02:00
9aab1a4626 Cleanup: unused code
Also fixes incompatible types.
2021-10-21 22:02:45 +02:00
0c66885276 View3D Snap Cursor: Fix drawing state incorrectly reset
The viewport was being changed, so it needs to be reset.
2021-10-21 16:37:41 -03:00
be171b295f Cleanup: Use array utility for cursor events 2021-10-21 15:30:17 -04:00
be558d2d97 Fix T92363: OptiX fails with ambient occlusion node, after recent changes
This triggered a compiler bug where it does not handle the sub.s16 PTX
instruction. Instead refactor the code so we don't need to do uint16_t
subtraction at all.

Also update OptiX device to remove the AO pass direct callable.

Thanks Patrick Mours for figuring this out.
2021-10-21 21:25:34 +02:00
aea2287af3 Tests: updated Python bundled modules test
Add the new zstandard module, as well as previously missing ones.

Ref D12777, T88438
2021-10-21 21:25:34 +02:00
0a63297a88 Nodes: Fix missing variable 2021-10-21 21:22:43 +02:00
Pablo Vazquez
9b1b4b9e32 Node Editor: Introduce color overlay and dashed wires theme setting
This patch includes code from D9891 and D12754, so credit goes to Juanfran and Dalai.
I updated the patches to work with `master` and with the new overlay toggle.

The reason to include both changes as part of one patch is that the dimmed dashed lines work much better together with colored wires.

Theme setting for dash opacity:
{F11370574, size=full}

{F11286177, size=full, autoplay, loop}

{F11149912, size=full}

For adding the overlay I used `SpaceImageOverlay` as reference, although I'm not familiar with this code so there might be mistakes.

Reviewed By: #user_interface, HooglyBoogly

Differential Revision: https://developer.blender.org/D12886
2021-10-21 21:00:38 +02:00
1d96a48267 Geometry Nodes: Attribute search in the modifier
This adds attribute search to the geometry nodes modifier
for the input and output attributes. The "New" search item
is only shown for the output attributes.

Some of the attribute search code is extracted to a new file
in the interface code, to avoid some code duplication.

The UI code required two fixes so that the search would work
for dynamic length strings (IDProperties do not have a fixed size).

Since this does changes to the UI layout of the modifier, I also
addressed T91485 here.

Differential Revisiion: https://developer.blender.org/D12788
2021-10-21 13:54:48 -05:00
65490e6270 Fix T92371: Move AZONE_REGION When Overlapped
Overlapped regions have transparent backgrounds, so when placing
AZONE_REGION we need to move them in to the content edge.

See D12956 for details and examples.

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

Reviewed by Hans Goudey
2021-10-21 11:17:38 -07:00
3858bf5c6f Cleanup: Use common define for menu separator arrow 2021-10-21 12:52:08 -05:00
7b9319adf9 Geometry Nodes: Update bounding box to work on individual instances
This commit makes the bounding box node work on each unique geometry
(including instances) individually instead of making one large bounding
box for everything. This makes the node much faster, and is often the
desired result anyway. For the old behavior, a realize instances node
can be used in front of this node (versioning adds it automatically).

The min and max outputs now only output the values from the realized
geometry.

Differential Revision: https://developer.blender.org/D12951
2021-10-21 11:51:56 -05:00
deb7ec312a Suppress the unused parameter warning from D9551.
The parameter is only used in an assert.
2021-10-21 19:27:30 +03:00
594c857f65 Fix tooltip disabled hint not using correct context from the button
To display the "disabled hint" (text explaining why a button is disabled) in a
tooltip, it would run the operator poll callback, which could then set a poll
message. But the context for the poll check wasn't the one from the button, so
the poll may give a different result (and disabled hint) than the check of the
button itself did.
Make sure it uses the exact context from the button.
2021-10-21 16:36:35 +02:00
16c79d3b82 Asset Catalogs: add test for backslashed catalog paths
No functional changes necessary, test already succeeds.
2021-10-21 16:23:56 +02:00
ff46afb4dd Fix: Curve trim crash on splines with no edges 2021-10-21 09:16:58 -05:00
4b48b1079d Asset Catalogs: refresh simple name when renaming catalog
When renaming an asset catalog, also update its simple name.

Catalogs will most likely be created from within Blender, so via the
catalog tree in the asset browser. Here catalogs are always named
"Catalog" until the user renames them, which was reflected in all simple
names being "Catalog".
2021-10-21 16:06:14 +02:00
5ccec8ec6b Asset Catalogs: treat first-loaded catalog as main catalog
When there are multiple catalogs with the same path (so different UUIDs
all mapped to the same catalog path), treat the first-loaded one as the
main catalog for that path, and the rest as aliases.

This ensures that the UUID of a catalog (as chosen in the tree UI and thus
interacted with by users) is stable, regardless of whether by some coincidence
later another catalog with the same UUID is created.
2021-10-21 15:53:16 +02:00
9a1fce698b Cleanup: rename & restructure AssetCatalogPathCmp
Rename `AssetCatalogPathCmp` to `AssetCatalogLessThan`:
- it compares more than paths (so no more `Path` in the name), and
- performs a less-than operation (so no more `Cmp` in the name).

Also restructure its code to make an extra upcoming comparison easier to
add.

No functional changes.
2021-10-21 15:53:16 +02:00
090be2775e Geometry Nodes: fix force-computing multiple non-output sockets
There were some issues when multiple inputs of the same node
were forced to be computed (e.g. for the spreadsheet), but none
of the node outputs (if existant) were used. Essentially the node
was marked as "finished" too early in this case.

This fix is necessary for the improved viewer node (T92167).
2021-10-21 15:50:04 +02:00
6600ae3aa7 Nodes: add utility to find NodeRef for node
In the future `NodeTreeRef` could have a lazy initialized map,
but for now this is good enough.
2021-10-21 15:50:04 +02:00
Brecht Van Lommel
df00463764 Cycles: add shadow path compaction for GPU rendering
Similar to main path compaction that happens before adding work tiles, this
compacts shadow paths before launching kernels that may add shadow paths.

Only do it when more than 50% of space is wasted.

It's not a clear win in all scenes, some are up to 1.5% slower. Likely caused
by different order of scheduling kernels having an unpredictable performance
impact. Still feels like compaction is just the right thing to avoid cases
where a few shadow paths can hold up a lot of main paths.

Differential Revision: https://developer.blender.org/D12944
2021-10-21 15:38:03 +02:00
fd560ef2af Windows: Fix finding python for build helpers
It was still looking for the 3.7 folder
rather than 3.9
2021-10-21 07:36:21 -06:00
7681326acd IDManagement: Assign current Main's lib to newly created IDs.
This is mainly for doversion code, when it needs to create new IDs those
should be considered as part of the same library as the current Main's
one.

No practical changes are expected here, this is more of a general
consistency fix, and a pre-requisite for {T92333}.
2021-10-21 15:22:35 +02:00
10fb5cc58d Fix T92355: Quadriflow crashes with zero length edges
Add a check for zero length edges to the manifold check as quadriflow
doesn't handle meshes with these.
2021-10-21 15:15:29 +02:00
91b4c1841a Fix T92272: Rigid Body Copy to Selected "Margin" crash
Caused by {rB43167a2c251b}

Code from above commit called RNA updates with a NULL scene.
This was already commented (and mostly handled) in rB5949d598bc33, but
the reported case was missing in that commit.

This fixes the crash in a similar manner as rB5949d598bc33.

Maniphest Tasks: T92272

Differential Revision: https://developer.blender.org/D12953
2021-10-21 14:40:04 +02:00
ab0195c78f Fix T92169: "View Selected" on Custom Boneshape with transform wrong
Since the introduction in rBfc5bf09fd88c, `BKE_pose_minmax` was not
taking these custom transforms into account (making "View Selected"
ignoring these as well and focusing on the bone instead).

Now consider these transforms in `BKE_pose_minmax`.

Maniphest Tasks: T92169

Differential Revision: https://developer.blender.org/D12942
2021-10-21 14:39:42 +02:00
a5917175d8 Deps: Python, bundle zstandard package
This package allows Python scripts to handle compressed blend files (see
rB2ea66af742bc). This is for example needed by Blender Asset Tracer to
send files to a Flamenco render farm.

This change includes a new `WITH_PYTHON_INSTALL_ZSTANDARD` build-time
option, to control whether to actually install the package. For this the
already-existing approach for Requests was copied.

Reviewed By: LazyDodo, mont29, brecht

Differential Revision: https://developer.blender.org/D12777
2021-10-21 13:46:33 +02:00
417ce7ffc1 Deps: Python, bump bundled packages to their latest versions
certifi : 2020.12.5 → 2021.10.8
chardet : 4.0.0     → charset-normalizer 2.0.6
cython  : 0.29.21   → 0.29.24
idna    : 2.10      → 3.2
numpy   : 1.19.5    → 1.21.2 (which makes it possible to remove our patch)
requests: 2.25.1    → 2.26.0
urllib3 : 1.26.3    → 1.26.7

Nowadays `requests` no longer depends on `chardet` but on
`charset-normalizer`. That project describes itself as:

> A library that helps you read text from an unknown charset encoding.
> Motivated by chardet, I'm trying to resolve the issue by taking a new
> approach. All IANA character set names for which the Python core library
> provides codecs are supported.

Reviewed By: LazyDodo, mont29, brecht

Differential Revision: https://developer.blender.org/D12777
2021-10-21 13:46:28 +02:00
f81f56751a Deps: Bump Python 3.9.2 → 3.9.7
Bump Python from 3.9.2 to 3.9.7, which is the latest 3.9 release at this
moment.

Updates to bundled Python packages will follow in a separate commit.

Reviewed By: LazyDodo, mont29, brecht

Differential Revision: https://developer.blender.org/D12777
2021-10-21 13:46:16 +02:00
39810b3f51 Cleanup: make HIP and CUDA code more consistent
Ref D12834
2021-10-21 13:08:10 +02:00
Yevgeny Makarov
6ef8c9e646 Fix T65532: can't assign a key on Italian apple keyboards.
Apple's international keyboards have an additional `kVK_ISO_Section`
key. With some (Italian, Spanish) keyboard layouts, this is `\`, `[` keys
which Blender keymap can use.

Right now this key is explicitly set as `Unknown`.

Note that `kVK_ANSI_Grave` is located in a different location.

Differential Revision: https://developer.blender.org/D12905
2021-10-21 13:07:05 +02:00
f6af3d9197 Build: remove cmake messages about disabled tests when feature is disabled
No need to report this, it just adds noise to the cmake config. The messages
that we need to keep are the ones about disabling tests when the test file or
idiff are missing.
2021-10-21 13:06:57 +02:00
641a5be50e IDManagement: Add option to clear asset data when making ID local.
When appending an asset from the asset browser, its asset data needs to
be cleared.

However, linking an asset (or regular append from the file browser)
should not clear such data. In linking case, it would be there again
after a blend file reload anyway.

So this commit introduces a new `BLO_LIBLINK_APPEND_ASSET_DATA_CLEAR`
option.

NOTE: in case the appended ID needs to be copied from its linked data
(instead of making the later directly local), asset data is lost anyway
since it is never copied with the ID currently.

Ref. {T91749} and D11768.
2021-10-21 12:55:15 +02:00
17a96051cf Re-bundle Libmv to ensure it is in sync with the repo 2021-10-21 12:39:28 +02:00
84bb6d7c02 UI: Header / Tool Settings: Show tool icon when tools are collapsed
Show the scaled down tool icon when the tool region is collapsed. Show a
blank space when the tool region is visible.

* Minimize the UI flickering when changing the active tool.
* Show the active tool when the tool region is collapsed.
* Smaler header footprint (the tool name is not visible).

This is a follow up for T91536.

Differential Revision: https://developer.blender.org/D12939
2021-10-21 12:12:05 +02:00
e79e86018e Fix T92387: crash in legacy point distribute node
This was caused by rB40c3b8836b7a36303ea9c78b0932758cbf277f93.
The same fix exists in the Distribute Points on Faces node.
2021-10-21 12:07:03 +02:00
2eb2e861a3 Install_deps: Rename _VERSION_MAX to _VERSION_MEX variables.
We define the minimum exclusive number for our supported dependencies
versions, and not the maximum inclusive number.

Thanks to @sybren for raising this point and finding the 'mex' math
term.
2021-10-21 11:58:06 +02:00
8d2cabcb97 Cleanup: VSE code docstring 2021-10-21 11:28:12 +02:00
98e1c6e935 Cleanup: clang-format 2021-10-21 18:27:46 +11:00
f0f1198867 Cleanup: unused functuion warnings 2021-10-21 17:14:33 +11:00
cfbac9032b Docs: note why BLI_string_join_arrayN needs to nil terminate 2021-10-21 17:10:19 +11:00
5faa333e78 Cleanup: match cursor hide option with naming for the 3D viewport 2021-10-21 17:01:15 +11:00
d71c423c28 Cleanup: Use array as a parameter for event x/y functions
This change simplifies the parameter list for these functions
and reduces the chance of typos mixing up array indices.

Missed in rB69102786047dccdcbaee0df6307a8c3364d28fe0.
2021-10-21 16:57:53 +11:00
3a2b7f35f4 LibLink: ensure objects are selectable when "Select" is enabled
Appended objects could be hidden, making any further operations
potentially skip the newly added objects.

Now FILE_AUTOSELECT asserts when newly added options aren't selectable.
2021-10-21 16:57:53 +11:00
063c4e467d Cleanup: de-duplicate function to instantiate objects
De-duplicates wm_append_loose_data_instantiate_object_base_instance_init
and object_base_instance_init.

Add BLO_object_instantiate_object_base_instance_init which also adds to
a collection since all callers did this.
2021-10-21 16:57:53 +11:00
2a047fadc0 Fix type error in 5297bf318e 2021-10-21 16:57:53 +11:00
33d6d7c6e3 VSE: Add 2D cursor overlay option
Since 2D cursor will be used rarely in VSE and it is adding visual
noise, it will be hidden by default.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12933
2021-10-21 07:49:12 +02:00
ec31f31749 Cleanup: Remove dead code 2021-10-21 01:01:31 -04:00
5297bf318e Cleanup: Use array as a parameter for event x/y functions
This change simplifies the parameter list for these functions
and reduces the chance of typos mixing up array indices.

Missed in rB69102786047dccdcbaee0df6307a8c3364d28fe0
2021-10-21 00:56:31 -04:00
035dcdad90 Cleanup: use underscore separators for event struct members
Improve readability using underscores for separators, e.g.
prev_click_time instead of prevclicktime.
2021-10-21 13:24:17 +11:00
6910278604 Cleanup: Use array as a parameter for event x/y functions
This change simplifies the parameter list for these functions
and reduces the chance of typos mixing up array indices.

Reviewed By: campbellbarton

Ref D12950
2021-10-21 13:15:41 +11:00
2905b493fe Fix failing 'script_validate_keymap' after recent changes
Properties with `_funcs_runtime` are always saved when exporting keymaps.

This is an error since changing one changes all others.

For now, work around the problem by setting the `PROP_IDPROPERTY` flag.
2021-10-20 20:49:59 -03:00
15e71f3d97 Cleanup: Set default snap cursor values during build time 2021-10-20 20:49:59 -03:00
6b761c59d2 Fix: Empty id attribute on curve control points
No virtual array should be returned instead of returning an empty span.
2021-10-20 17:45:14 -05:00
3f8b45d8d1 Fix: Builtin curve attributes unavailable
After the addition of the `id` attribute in rB40c3b8836b7a, the `exists`
function assumed that all attributes were stored in the custom data.
2021-10-20 16:54:04 -05:00
98c53f660a Fix T92369: Raycast node crash with no target attribute
The corrected hit mask should only be generated when there is
data to transfer. Also correct two of the warning messages.
2021-10-20 14:22:25 -05:00
William Leeson
f0df0e9e07 Fix: Add cast to atof for CYCLES_CONCURRENT_STATES_FACTOR env variable parsing.
The conversion from double to float was causing a build failure.

Differential Revision: https://developer.blender.org/D12946
2021-10-20 21:01:39 +02:00
704d077d8f Fix: Crash when retrieving output "id" attribute
The attribute provider needs to handle the case where the data is stored
with just a data type, and the case where it is stored with a name.
2021-10-20 13:15:37 -05:00
010e675b1b Fix missing null-terminator in BLI_string_join_arrayN
Although the documentation says so, the null-terminator was missing.
This could cause crashes when logging shader linking errors as shader
sources are empty in this case.
2021-10-20 20:03:17 +02:00
1de8374374 UI: Remove extra padding on Annotate tool settings
For some reason the Annotate tool has an extra padding when compared to
other tools. This makes the UI to flicker a bit (specially with D12939
applied).

Differential Revision: https://developer.blender.org/D12943
2021-10-20 19:01:53 +02:00
Peter Sergay
9959c5315f Geometry Nodes: Add warnings for instances input in two nodes
Certain geometry nodes don't work properly on inputs that contain
instances, but don't display any warning that they aren't working.

The nodes now will display a warning that explains the situtation
iff the input contains any instances.

Differential Revision: https://developer.blender.org/D12858
2021-10-20 11:48:53 -05:00
7d111f4ac2 Cleanup: remove unused code 2021-10-20 18:15:21 +02:00
0baa876b83 New test for USD import.
Added a basic test for importing a primitive hierarchy from a USDA
file into Blender.  This was reviewed by Sybren in patch D12479.
2021-10-20 12:07:28 -04:00
40c3b8836b Geometry Nodes: Make Random ID a builtin attribute, remove sockets
In order to address feedback that the "Stable ID" was not easy enough
to use, remove the "Stable ID" output from the distribution node and
the input from the instance on points node. Instead, the nodes write
or read a builtin named attribute called `id`. In the future we may
add more attributes like `edge_id` and `face_id`.

The downside is that more behavior is invisible, which is les
expected now that most attributes are passed around with node links.
This behavior will have to be explained in the manual.

The random value node's "ID" input that had an implicit index input
is converted to a special implicit input that uses the `id` attribute
if possible, but otherwise defaults to the index. There is no way to
tell in the UI which it uses, except by knowing that rule and checking
in the spreadsheet for the id attribute.

Because it isn't always possible to create stable randomness, this
attribute does not always exist, and it will be possible to remove it
when we have the attribute remove node back, to improve performance.

Differential Revision: https://developer.blender.org/D12903
2021-10-20 10:54:54 -05:00
1a96045eec Fix T92367: missing Subsurface Anisotropy and IOR sockets with factory startup 2021-10-20 17:50:31 +02:00
0c52eed863 Cycles: more accurately count main paths for adding work tiles
Easy now thanks to the main and shadow path decoupling. Doesn't help
in an benchmark scene except Spring, where it reduces render time by
maybe 2-3%.

Ref T87836
2021-10-20 17:50:31 +02:00
52c5300214 Cleanup: some renaming to better distinguish main and shadow paths 2021-10-20 17:50:31 +02:00
cccfa597ba Cycles: make ambient occlusion pass take into account transparency again
Taking advantage of the new decoupled main and shadow paths. For CPU we
just store two nested structs in the integrator state, one for direct light
shadows and one for AO. For the GPU we restrict the number of shade surface
states to be executed based on available space in the shadow paths queue.

This also helps improve performance in benchmark scenes with an AO pass,
since it is no longer needed to use the shader raytracing kernel there,
which has worse performance.

Differential Revision: https://developer.blender.org/D12900
2021-10-20 17:50:31 +02:00
001f548227 Cycles: reduce kernel reserved local memory when not using shader raytracing
Ref T87836
2021-10-20 17:50:31 +02:00
Charlie Jolly
2537b32392 Geometry Nodes: Add Checker Texture
Port checker shader to GN

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12762
2021-10-20 16:45:35 +01:00
334a8d9b3e Geometry Nodes: Fields version of Curve to Points node
This commit adds an updated version of the curve to points that
supports fields. Only the position and radius are transferred
by default now, which should improve performance. The other outputs
like tangent and rotation are outputted with anonymous attributes.

I took the opportunity to change a few other small things:

 - Name geometry sockets "Curve" and "Points" like other nodes.
 - Remove the radius multiple of 0.1, which was confusing.

Thanks to @Johnny Matthews (guitargeek) for an initial patch.

Differential Revision: https://developer.blender.org/D12887
2021-10-20 10:25:49 -05:00
e00bf04c0f Fix T89771: Cloth disk cache is not read on library overrides when original linked data is already set to use 'Disk Cache'
Yet another try at that hairy issue... See comment in commit for
details, essentially this extend the workaround introduced in Objects'
`lib_override_apply_post` callback to try to also properly 're-use'
`OUTDATED` and `BAKED` flags from old source liboverride into new
destination one.
2021-10-20 17:21:30 +02:00
990b912fd7 Cleanup: Add check whether to remove an anonymous atttribute
Add a higher level check that can be used instead of checking whether
the attribute ID is anonymous and checking whether it has any strong
references.
2021-10-20 09:57:54 -05:00
494c3fb1bd Fix T92368: LMB mouse events (Selecting, doubleclicks etc) are broken 2021-10-20 16:33:20 +02:00
2d46cef2e8 Fix T92347: Append function excludes Collections that do not contain Objects directly.
Collections directly selected by the user should always be
instantiated.

Regression from recent append code refactor.
2021-10-20 15:22:26 +02:00
4539c7cc57 Cleanup: silence Warnings
Warning	C4100 unreferenced formal parameter
Warning	C4242 conversion from 'int' to 'short', possible loss of data
2021-10-20 10:04:03 -03:00
2743d746ea Cleanup: use an array for wmEvent cursor position variables
Use arrays for wmEvent coordinates, this quiets warnings with GCC11.

- `x, y` -> `xy`.
- `prevx, prevy` -> `prev_xy`.
- `prevclickx, prevclicky` -> `prev_click_xy`.

There is still some cleanup such as using `copy_v2_v2_int()`,
this can be done separately.

Reviewed By: campbellbarton, Severin

Ref D12901
2021-10-21 00:00:01 +11:00
3435ea014d Cleanup: unused parameters, nullptr instead of NULL in cpp code... 2021-10-20 14:56:18 +02:00
dfb193f634 Fix T91243: Object modes are not loaded correctly in inactive scenes.
Do not try to preserve edit modes of objects in non-active scenes (at
least for now), except for Pose mode.

Code was also slitghly refactored (reducing indent levels), and
comments about expected behaviors and known limitations were added.
2021-10-20 14:50:41 +02:00
f855e2e06e Cleanup: unused function 2021-10-20 09:19:05 -03:00
40180c3500 Fix crash when reloading with placement tool enabled
Paint Cursors are already released at this stage.
2021-10-20 09:07:41 -03:00
Sayak Biswas
ba4e227def HIP device code cleanup and fix for high VRAM usage
This patch cleans up code for HIP device and makes it more consistent with the CUDA code.
It also fixes the issue with high VRAM usage on AMD cards using HIP allowing better performance and usage on cards like 6600XT.
Added a check in intern/cycles/kernel/bvh/bvh_util.h to prevent compiler error with hipcc

Reviewed By: brecht, leesonw

Maniphest Tasks: T92124

Differential Revision: https://developer.blender.org/D12834
2021-10-20 14:04:28 +02:00
d28aaf6139 Asset Browser: Show current file assets in other asset libraries if contained
If the current file is saved within an asset library, showing that asset
library in the Asset Browser will also display the assets from this current
file now. In fact, it's the latest state of the open file, including all
unsaved modifications.
These assets will show a little Blender icon in the preview image, which is our
usual icon for current file data.

Note that this means an important design change: The "Current File" asset
library isn't the only place to edit assets from anymore. From now on assets
from the current file can also be edited in the context of the full asset
library. See T90193 for more info.

Technical info:
Besides just including the assets from the current `Main`, this requires
partial clearing and reading of file-lists, so that asset operations (e.g.
removing an asset data-block) doesn't require a full reload of the asset
library.

Maniphest Task: https://developer.blender.org/T90193
2021-10-20 13:38:51 +02:00
4f15c24705 Fix T62325, T91990: changing Cycles presets does not update the Blender UI 2021-10-20 13:34:17 +02:00
9001dd7f29 View3D: Cursor Snap Refactor
Make the snap system consistent with the placement tool and leak-safe.

**Changes:**
- Store `SnapCursorDataIntern` in a `static` variable;
- Initialize (lazily) `SnapCursorDataIntern` only once (for the keymap).
- Move setup members of `V3DSnapCursorData` to a new struct `V3DSnapCursorState`
- Merge `ED_view3d_cursor_snap_activate_point` and `ED_view3d_cursor_snap_activate_plane` into `state = ED_view3d_cursor_snap_active()`
- Merge `ED_view3d_cursor_snap_deactivate_point` and `ED_view3d_cursor_snap_deactivate_plane` into `ED_view3d_cursor_snap_deactive(state)`
- Be sure to free the snap context when closing via `ED_view3d_cursor_snap_exit`
- Use RNA properties callbacks to update the properties of the `"Add Primitive Object"` operator
2021-10-20 08:28:58 -03:00
690e1baf72 Fix T91808: Batch Generate Previews fails
Caused by the Cycles-X merge.

The old style of tile rendering was removed, leaving the script to error
out trying to set the tile size.

Tile rendering came back in a new form (but only really relevant for
large resolution rendering), so now leave setting auto_tile & tile_size
alone (since previews are rendered at PREVIEW_RENDER_DEFAULT_HEIGHT 128
-- which should never make a difference here).

Maniphest Tasks: T91808

Differential Revision: https://developer.blender.org/D12937
2021-10-20 12:38:33 +02:00
f605ce7e9a Cleanup: Remove unused file-list array info members 2021-10-20 12:31:55 +02:00
dd728e1539 Asset Browser: UI polish for the asset metadata sidebar
* Show asset path in a (read only) text button. Makes it possible to see the
  full path in the tooltip, brings support for copying the path and integrates
  better with the sourrounding layout. Previous label needed lots of space to
  show the full path without clipping.
* Remove "Details" panel, it only contained one item (description). That is
  moved next to the name and asset path button.
* Use property split layout for name source and description buttons. Now that
  there are multiple buttons, it's better to have a label for them.
* Always show operators for asset previews, just gray them out if not
  applicable instead of hiding. Keeps the layout consistent and graying out is
  less confusing than hiding UI elements.
2021-10-20 12:31:54 +02:00
381965eb56 UI: Activate parent when active child is collapsed
Previously, when an item was active and its parent (or grand parent, etc.) was
collapsed, the active item would simply not be visible anymore. It seemed like
there was no active item. So instead, change the just collapsed parent to be
the active item then, so the active item stays visible.
2021-10-20 12:31:54 +02:00
16eafdadf6 Fix precision issues and a bug in vec_roll_to_mat3_normalized.
When the input vector gets close to -Y, y and theta becomes totally
unreliable. It is thus necessary to compute the result in a different
way based on x and z. The code already had a special case, but:

- The threshold for using the special case was way too low.
- The special case was not precise enough to extend the threshold.
- The special case math had a sign error, resulting in a jump.

This adds tests for the computation precision and fixes the issues
by adjusting the threshold, and replacing the special case with one
based on a quadratic Taylor expansion of sqrt instead of linear.

Replacing the special case fixes the bug and results in a compatibility
break, requiring versioning for the roll of affected bones.

Differential Revision: https://developer.blender.org/D9551
2021-10-20 12:58:19 +03:00
Gaia Clary
df445cc571 Fix T82455: vec_roll_to_mat3_normalized returns NaN when nor close to -Y.
In this case theta is completely unsafe to use, so a different
threshold based on x and z has to be used to avoid division by zero.

Ref D9551
2021-10-20 12:58:19 +03:00
dfa1c7e554 Split and extend unit tests for vec_roll_to_mat3_normalized.
Separate the huge test into huge logical parts and add more cases
to check. Also add a utility to check that the matrix is orthogonal,
with arbitrary epsilon values and calculations in double.

A couple of tests deliberately fail, to be fixed in following commits.

Ref D9551
2021-10-20 12:58:19 +03:00
6cd191a660 Link/Append tests: properly support and test with/without 'recursive' behaviors.
This requires adding an extra ('indirect') library to the test cases for
append.

Aftermath of T92224.
2021-10-20 11:58:06 +02:00
25c173ffd1 Tracking: support editing all selected tracks
This patch adds a "selected_movieclip_tracks" context member and enables
editing properties of multiple selected tracks via the usual Alt-click
editing (as well as the "Copy To Selected" operator). Both use
UI_context_copy_to_selected_list() to gather a list of other selected
items [which are now taken via said new context member]. Strictly
speaking, this could be done without the context member as well [just
gathering other selected tracks in UI_context_copy_to_selected_list()
without relying on a context member], but this might come in handy in
other places (e.g. Addons).

note: some could be desired for markers (e.g. editing pattern/search
areas of all selected track markers, but since this is burried in a
uiTemplate, this is a bit more work for another patch).

Differential Revision: https://developer.blender.org/D12923
2021-10-20 11:36:33 +02:00
2bcf93bbbe View3D: expose snap selection as a utility funciton
This makes it convenient to position appended objects, see: T92111.
2021-10-20 18:21:14 +11:00
943debfab5 View3D: snap with active pivot doesn't need to require a 3D view 2021-10-20 18:01:49 +11:00
6ed93391c4 Fix : Set Curve Handle Position Node Auto Convert
When trying to auto convert Vector to Free or Auto to Align, the
old handle positions needed to be baked in first.
2021-10-19 23:23:14 -05:00
fd7510984a CMake: add WITH_BLENDER_THUMBNAILER option
Make building the thumbnail extraction executable optional,
disable on macOS as this was not linking, further, macOS doesn't use
this for thumbnail extraction so it could be left disabled.
2021-10-20 12:15:33 +11:00
b280699078 Cleanup: use elem macros 2021-10-20 11:16:43 +11:00
ef9269bd62 Thumbnails: refactor extraction to use one code-path for all platforms
Thumbnail extraction now shares code between Linux/Windows,
allowing thumbnails from Zstd compressed blend files to be extracted.

The main logic is placed in blendthumb_extract.cc and is built as static
library. For windows there is DLL which is registered during blender
install and which then reads and generates thumbnails.

For other platforms there is blender-thumbnailer executable file which
takes blend file as an input and generates PNG file. As a result
Python script blender-thumbnailer.py is no longer needed.

The thumbnail extractor shares the same code-path as Blenders file
reading, so there is no need to duplicate any file reading logic.
This means reading compressed blend files is supported (broken since
the recent move Zstd compression - D5799).

This resolves T63736.

Contributors:

- @alausic original patch.
- @LazyDodo windows fixes/support.
- @campbellbarton general fixes/update.
- @lukasstockner97 Zstd support.

Reviewed By: sybren, mont29, LazyDodo, campbellbarton

Ref D6408
2021-10-20 10:31:30 +11:00
bca2701236 GNUmakefile: clarify that order isn't important for multiple targets
Also include example.
2021-10-20 10:04:14 +11:00
93197c4660 Cleanup: spelling in comments 2021-10-20 09:19:21 +11:00
967fec6883 Cleanup: sort cmake file lists 2021-10-20 09:17:46 +11:00
d73f664790 Cleanup: trailing space, use single quotes for enums 2021-10-20 09:17:25 +11:00
d7b4350749 Fix T92354: Missing raycast node in geometry nodes add menu
Was removed by mistake in rB0a6cf3ed0c64
2021-10-19 16:27:37 -05:00
Erik Abrahamsson
a83b405a45 Geometry Nodes: Replace String node
This commit adds a node that can be used to find and replace strings
inside of the input string. One initial use case is to have an easier
way to add line breaks to strings to the string to curves node.

Differential Revision: https://developer.blender.org/D12721
2021-10-19 15:27:47 -05:00
85c8dd6c96 Fix: Display color sockets without labels correctly
Don't build a manual property split layout when the label
for the socket is hidden.
2021-10-19 14:04:03 -05:00
fccc530003 Fix asset catalog operators disabled without experimental feature flag
If the Extended Asset Browser experimental feature was disabled, the asset
catalog operators wouldn't work. This wasn't intentional, catalogs aren't
considered experimental.
2021-10-19 18:54:30 +02:00
Charlie Jolly
67dbb42236 Geometry Nodes: Add Wave texture node
Port shader wave texture node

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12733
2021-10-19 17:30:24 +01:00
Charlie Jolly
56bf34aa17 Geometry Nodes: Add Magic texture node
Port shader node magic texture

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12732
2021-10-19 17:18:33 +01:00
823996b034 Asset Browser: Improved workflow for asset catalog saving
No longer save asset catalogs on blendfile save. Instead:

- extend the confirmation prompt for unsaved changes to show unsaved
  catalogs.
- In the confirmation prompt, make catalog saving explicit & optional,
  just like we do it for external images. {F10881736}
- In the Asset Browser catalog tree, show an operator icon to save the
  catalogs to disk. It's grayed out if there are no changes to save, or
  if the .blend wasn't saved yet (required to know where to save the
  catalog definitions to). {F10881743}

Much of the work was done by @Severin and reviewed by me, then we
swapped roles.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12796
2021-10-19 18:07:22 +02:00
b6c3b41d41 Cleanup: use nullptr in C++ 2021-10-19 18:05:02 +02:00
a3d4ed20f9 Fix liblink tests after recent commit.
NOTE: This needs new tests, no time now, will do tomorrow.
2021-10-19 18:01:26 +02:00
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
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
79a88b5e91 Fix compilation error about undefined PATH_MAX 2021-10-19 16:47:17 +02:00
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
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
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
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
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
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
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
cd36f59027 Cleanup: trailing whitespace 2021-10-19 15:30:46 +02:00
fd77a28031 Cycles: bake transparent shadows for hair
These transparent shadows can be expansive to evaluate. Especially on the
GPU they can lead to poor occupancy when only some pixels require many kernel
launches to trace and evaluate many layers of transparency.

Baked transparency allows tracing a single ray in many cases by accumulating
the throughput directly in the intersection program without recording hits
or evaluating shaders. Transparency is baked at curve vertices and
interpolated, for most shaders this will look practically the same as actual
shader evaluation.

Fixes T91428, performance regression with spring demo file due to transparent
hair, and makes it render significantly faster than Blender 2.93.

Differential Revision: https://developer.blender.org/D12880
2021-10-19 15:11:09 +02:00
d06828f0b8 Cycles: avoid intermediate stack array for writing shadow intersections
Helps save one OptiX payload and is a bit more efficient.

Differential Revision: https://developer.blender.org/D12909
2021-10-19 15:10:55 +02:00
Brecht Van Lommel
943e73b07e Cycles: decouple shadow paths from main path on GPU
The motivation for this is twofold. It improves performance (5-10% on most
benchmark scenes), and will help  to bring back transparency support for the
ambient occlusion pass.

* Duplicate some members from the main path state in the shadow path state.
* Add shadow paths incrementally to the array similar to what we do for
  the shadow catchers.
* For the scheduling, allow running shade surface and shade volume kernels
  as long as there is enough space in the shadow paths array. If not, execute
  shadow kernels until it is empty.

* Add IntegratorShadowState and ConstIntegratorShadowState typedefs that
  can be different between CPU and GPU. For GPU both main and shadow paths
  juse have an integer for SoA access. Bt with CPU it's a different pointer
  type so we get type safety checks in code shared between CPU and GPU.
* For CPU, add a separate IntegratorShadowStateCPU struct embedded in
  IntegratorShadowState.
* Update various functions to take the shadow state, and make SVM take either
  type of state using templates.

Differential Revision: https://developer.blender.org/D12889
2021-10-19 15:09:29 +02:00
6e473a897c Tests: update Cycles GPU tests blacklist so all tests pass
More tests are matching now, mainly due to unified volume sampling.
2021-10-19 15:06:04 +02:00
7fa6794037 Fix failing view layer tests after recent changes to naming convention 2021-10-19 14:55:06 +02:00
5b6dacb9eb Fix splash screen showing language when building without that feature 2021-10-19 14:48:37 +02:00
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
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
6ee181ec24 Cycles: improve sampling pattern description regarding adaptive sampling 2021-10-19 12:59:05 +02:00
a395a1b36b Cleanup: fix compiler warnings 2021-10-19 12:59:05 +02:00
c107a3c4d9 Fix invalid principled diffuse in Cycles OSL
Need to initialize components for the full Diffuse BSDF.

Steps to reproduce:
- Default cube scene
- Switch to Cycles renderer
- Enable OSL backend
- Start viewport render
- Observe cube being much black

Differential Revision: https://developer.blender.org/D12921
2021-10-19 12:10:29 +02:00
765eba5a6e Cleanup: More readable Cycles OSL BSDF definition
A  Clang-Format configuration to make the closure definition block to
be properly recognized as such.

Also small wrapper macro to avoid comma in the actual definition code
which was causing unwanted indentation of parameters definition.

Requires Clang-Format 7 or newer. The version we ship in the libs is
12, so for recommended development setup it should all be good.

Differential Revision: https://developer.blender.org/D12920
2021-10-19 11:59:26 +02:00
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
d6b54068d4 Cleanup: Unused device argument in host update functions
Better not to tempt anyone from using unsafe access to device
functionality during host update.
2021-10-19 11:30:27 +02:00
6e859f7ff8 Fix invalid OSL shader compilation state
The lookup tables are to be initialized after device free.

On Linux was only noticeable when rendering default cube scene with
an extra assert. On Windows it was causing an assert in STL in debug
builds.

Differential Revision: https://developer.blender.org/D12918
2021-10-19 11:29:39 +02:00
9c8255d486 Cleanup: use 'e' prefix for enum types 2021-10-19 18:35:39 +11:00
695dc07cb1 Cleanup: clang-format 2021-10-19 18:31:15 +11:00
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
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
c4f733a76c Fix memory leak in sample tool
When there was no image buffer, sample leaked memory.
2021-10-19 12:50:07 +11:00
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
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
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
d7b231baa8 Cleanup: remove unused member and rearrange function 2021-10-18 18:38:42 -03:00
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
41eba47a87 Revert "Cycles: optimize volume stack copying for shadow catcher/compaction"
This reverts commit 3065d26097. Causing crashes
in the spring scene.
2021-10-18 22:38:33 +02:00
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
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
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
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
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
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
a9cb330815 Cleanup: minor refactoring in preparation of main and shadow path decoupling
Ref D12889
2021-10-18 19:02:10 +02:00
2430f75279 Cycles: reduce GPU state memory a little
* isect Ng is no longer needed for shadows, for main path needed for SSS only
* Reduce rng_offset and queued_kernel to 16 bits

Ref D12889
2021-10-18 19:02:10 +02:00
3065d26097 Cycles: optimize volume stack copying for shadow catcher/compaction
Only copy the number of items used instead of the max items.

Ref D12889
2021-10-18 19:02:10 +02:00
a184d0dd02 Cleanup: fix outdated comment and use of atomics
This is only used by a single device, not need for thread safety.
2021-10-18 19:02:10 +02:00
fc4b1fede3 Cleanup: consistently use uint32_t for path flag 2021-10-18 19:02:10 +02:00
Brecht Van Lommel
1df3b51988 Cycles: replace integrator state argument macros
* Rename struct KernelGlobals to struct KernelGlobalsCPU
* Add KernelGlobals, IntegratorState and ConstIntegratorState typedefs
  that every device can define in its own way.
* Remove INTEGRATOR_STATE_ARGS and INTEGRATOR_STATE_PASS macros and
  replace with these new typedefs.
* Add explicit state argument to INTEGRATOR_STATE and similar macros

In preparation for decoupling main and shadow paths.

Differential Revision: https://developer.blender.org/D12888
2021-10-18 19:02:10 +02:00
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
2944f3e92b Fix 1 frame delayed orientation in Placement Gizmo
Error in {rB69d6222481b4}
2021-10-18 13:32:56 -03:00
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
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
aef8ac7db8 Cleanup: clang format 2021-10-18 17:00:25 +02:00
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
fb88ff8f0c Cleanup: fix compiler warning 2021-10-18 16:45:06 +02:00
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
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
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
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
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
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
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
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
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
eb0d216dc1 Geometry Nodes: decouple multi-function lifetimes from modifier
Previously, some multi-functions were allocated in a resource scope.
This was fine as long as the multi-functions were only needed during
the current evaluation of the node tree. However, now cases arise
that require the multi-functions to be alive after the modifier is finished.
For example, we want to evaluate fields created with geometry nodes
outside of geometry nodes.

To make this work, `std::shared_ptr` has to be used in a few more places.
Realistically, this shouldn't have a noticable impact on performance.
If this does become a bottleneck in the future, we can think about ways
to make this work without using `shared_ptr` for multi-functions that
are only used once.
2021-10-18 11:46:21 +02:00
746ee29d36 Fix T91700: Strips can be transformed in scope display modes
Hide gizmos & prevent transform & selection in scope display.
2021-10-18 19:29:36 +11:00
4f3f79c382 Keymap: support key-activates-tools for shrink-fatten 2021-10-18 18:42:35 +11:00
3f4ba64ae3 Cleanup: use depends-on-cursor for "Object Transfer Mode" operator
Replace modal operator with the OPTYPE_DEPENDS_ON_CURSOR flag.

This has the advantage of showing the shortcut in the menu.
2021-10-18 17:20:06 +11:00
2a8e5128c1 WM: support setting the operators idle cursor
Support setting a cursor when an operator is waiting for input.
2021-10-18 17:18:48 +11:00
6bf8c95e52 UI: expose additional cursors to the Python API 2021-10-18 17:09:26 +11:00
59c95a8ca2 Cleanup: de-duplicate operator registration
Operators and operator-macros duplicated RNA properties.
2021-10-18 17:09:26 +11:00
Germano Cavalcante
69d6222481 Snap and Placement Gizmo Refactor
Move most of the gizmo snap and placement code to `view_cursor_snap.c`.

Simplify and extend the snap API.

Differential Revision: https://developer.blender.org/D12868
2021-10-18 01:58:00 -03:00
be22e36692 Fix key-shortcut path for sequencer overlay 2021-10-18 15:47:31 +11:00
f5edc69150 Fix frame overlay not refreshing the sequencer preview
Regression in 46aa70cb48
2021-10-18 15:47:29 +11:00
e538b2c3a3 Cleanup: internal sequencer naming for overlays
- Rename RNA SpaceSeq.show_strip_overlay to show_overlays
  matching the 3D View, the term "strip" was misleading as this is used
  for the preview as well.

- Rename various RNA overlay settings to overlay_frame
  since "Frame Offset" is a specific feature, avoid having both
  Editor.show_overlay and SpaceSeq.show_overlays.

- Rename Editing `over_*` -> `overlay_frame_*` in DNA,
  as well as flags.
2021-10-18 15:47:28 +11:00
c5a13ffcb4 Cleanup: spelling in comments 2021-10-18 12:13:10 +11:00
Pablo Vazquez
452c78757f UI: Improve contrast on playhead
Add an outine around the playhead, matching the color of the background (slightly darkened)
to improve the readability of the current frame line when placed against curves or strips
with a similar color.

{F10944336, size=full}

Differential Revision: https://developer.blender.org/D12810
2021-10-17 19:10:31 +02:00
Pablo Vazquez
962b17b3ca UI: Adjust header color when active instead of inactive
Currently, the background color of headers gets darkened when the editor is not active,
this makes it hard to theme, and adds contrast/noise when it's not needed.

This patch makes headers use the regular theme color when the editor is not active, so it
can be made to flush with the background more easily. And lightens the header (by +10,
same value as before) when the editor is active, providing the wanted highlight.

The motivations behind this change are:
* Simplify picking a theme color for headers.
* Widgets already become lighter on mouse hover, this change creates a connection with that concept.

Left: current master, inactive header is darkened.
Right: this patch, inactive header gets the theme color, active editor gets header in a slightly lighter color (like most widgets)

{F11052503, size=full, loop, autoplay}

Reviewed By: #user_interface, HooglyBoogly

Differential Revision: https://developer.blender.org/D12856
2021-10-17 18:49:59 +02:00
93544b641b UI: Visual style update to panels
Back in Blender 2.30, the GUI project brought panels into Blender among other important visual updates.
For the first time it was possible to move the wall of buttons around. Providing a clear separation
between sections (it even allowed the grouping of panels in tabs!)

During the 2.5 redesign, the separation between panels became a line on top of each panel, and panels received
theme settings for background and header colors. The default theme used the same color for both.

In 2.8 the background color of panels was different from headers in the default theme, so the separator
line was removed. While the separator line wasn't elegant (only on top, non-themeable, hard-coded emboss effect),
it provided a sort of separation between panels.

This patch solves the panels-separation by simply adding a margin space around them (not visible in default theme yet).
Even though the margin reduces the width of the working area slightly, it makes room for the upcoming always-visible scrollbars.

Other adjustments:
* Use arrow icon instead of triangle to collapse/expand
* Use rounded corners to match the rest of the UI (editor corners, nodes, etc).

{F10953929, size=full}

Margin on panels makes use of the `style->panelouter` property that hasn't been
used in a while. Also slight tweaks to `boxspace` and `templatespace` style properties so they
are multiples of 2 and operations on them round better.

There is technically no need to update the themes for them to work, so no theme changes are included in this patch.

{F10953931, size=full}

{F10953933, size=full}

{F10953934, size=full}

{F10954003, size=full}

----

A new theme setting under Style controls the roundness of all panels (added it to Style instead of ThemeSpace because I think controlling the panel roundness per editor is a bit overkill):
{F11091561, size=full, autoplay, loop}

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D12814
2021-10-17 18:31:24 +02:00
19740b25c7 Geometry Nodes: bring back lazy evaluation for field types in Switch node
Differential Revision: https://developer.blender.org/D12878
2021-10-17 15:56:37 +02:00
6b0719c0f3 Geometry Nodes: change field visualization when there is an error
This does not change the behavior when there are no mistakes in the node tree.
The visualization does change when a field is connected to an input that cannot
be a field.

Differential Revision: https://developer.blender.org/D12877
2021-10-17 15:51:33 +02:00
3c36803189 Cleanup: Fix unused variable warning in lite build 2021-10-16 22:58:30 -05:00
4a00faca1a Fix: Geometry Nodes Subdiv Surface Crash
If there are no edges in the mesh, the process would crash.
Returning in this case.
2021-10-16 07:26:57 -05:00
5c961b3b58 Revert "Fix T62325, T91990: changing Cycles presets does not update the Blender UI"
This reverts commit 1b6752e599. It is causing
constant redraws due to some ID properties seemingly being edited on every
redraw.
2021-10-16 13:54:29 +02:00
b3c469153e Asset Browser: Use single column for asset library menu
Feedback was that the two column menu felt odd, and that the "Custom" and
"Built-in" headings for each column were more confusing than helpful. So
changing this to a single column menu with separator lines instead of headings.
2021-10-16 09:55:31 +02:00
73753e1a67 Asset Browser: Change default name of tags
Use "Tag" instead of "Unnamed Tag" as default name for tags. Other default
names in Blender also don't add "Unnamed" or similar.
2021-10-16 09:28:05 +02:00
1c18f05f0b Fix T92252: User after free when opening file after Blender starts
Oversight in 6e4ab5b761
2021-10-16 15:35:36 +11:00
4586688323 Fix nonnull-compare warning in DNA_view3d_types.h
Was introduced in rB93a8fd1249f
2021-10-15 19:17:06 -07:00
5fed3aec4a VSE: Fix crash when scene strip is added to meta
Caused by 81514b0e91, missed sanitizing `sound->offset_time` usage in
`seq_update_sound_bounds_recursive_impl()`.
2021-10-16 01:28:59 +02:00
138fdf78ba PyAPI Docs: Fix example not using keyword parameter
Fixes T92238
2021-10-15 17:55:31 -04:00
73fbd3eebd VSE: Hide tool header by default
Tools currently used by VSE don't have much useful settings, but they
use a lot of space. Therefore these headers will be hidden by default.

Property `show_region_tool_header` was added to view menu to enable tool
settings.

This could be resolved by region overlap, but it isn't working well
currently.

Differential Revision: https://developer.blender.org/D12875
2021-10-15 23:42:26 +02:00
Jarrett Johnson
41dc558747 Geometry Nodes: Rotate Euler: Use "Local" instead of "Point"
Since points aren't relevant in function nodes, replace all mentions
of it with "local" to illustrate rotations done in local-space instead.

Differential Revision: https://developer.blender.org/D12881
2021-10-15 16:33:27 -05:00
Josef Raschen
c383397d07 Fix versioning for sequencer color balance modifier.
Commit 213554f24a added slope/offset/power controls to the sequencer
color balance modifier, but colors in this mode were not initialized
with old files.

Initialize colors to default values.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D12806
2021-10-15 23:20:45 +02:00
e11b33fec3 Remove math for 2D affine transform
Commit e1665c3d31 added math to do 2D affine transformations with 3x3
matrices, but these matrices are also used for 3D transformations.

Remove added functions and use 4x4 matrices for 2D transformation.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12510
2021-10-15 23:20:45 +02:00
81514b0e91 Fix T91012: Scene strip doesn't play audio
Issue was caused by adding `seq->sound` check in ded68fb102 in
function `BKE_sound_scene_add_scene_sound` as `offset_time` field was
introduced to resolve sub-frame a/v misalignment.

Scene strips don't have `bSound` allocated but also don't suffer from
a/v misalignment.

Remove `seq->sound` check and don't apply any offset for scene strips.

Reviewed By: zeddb, sergey

Differential Revision: https://developer.blender.org/D12819
2021-10-15 23:20:45 +02:00
9a3c7da934 Fix T92184: Cage gizmo doesn't with area light
This is caused by removing `gizmo_cage2d_modal()` code in 482806c816.

Some areas use cage gizmo to modify RNA properties without using
transform operator like area light, image empty, and compositor preview.
This functionality is implemented in code that was removed.

Add this code back.

Reviewed By: zeddb, campbellbarton

Differential Revision: https://developer.blender.org/D12859
2021-10-15 23:20:45 +02:00
9b1b1d9269 Cleanup: remove unused functions 2021-10-15 22:23:30 +02:00
5b9a911c4b Fix T72583: Sun Beams node artifacts
The artifacts are due to the loss of precision when doing some
calculations with float precision.
2021-10-15 22:23:21 +02:00
Jarrett Johnson
88d295f952 Geometry Nodes: Updated Subdivision Surface Node
Replaces the old Subdivision Surface Node.

Changes:
 - Removes implicit instance realization, instead the node runs once
   per unique instance.
 - "Use Creases" becomes a crease field input applied to edges.
   The values are clamped between zero and one.

Addresses T91763

Differential Revision: https://developer.blender.org/D12830
2021-10-15 15:12:04 -05:00
19bab2a536 Geometry Nodes: Object info node optional instance output
The object info node output an instance as a performance optimization.
Before that optimization was (almost) invisible to the user, but now
that we aren't automatically realizing instances, it isn't intuitive
for a single object to become an instance.

I refactored the transform node so its ability to translate/transform
an entire geometry set was more usable from elsewhere and exposed the
function to get a geometry set from an object.

Differential Revision: https://developer.blender.org/D12833
2021-10-15 14:20:53 -05:00
76f386a37a Geometry Nodes: Fields transfer attribute node
This commit adds an updated version of the old attribute transfer node.
It works like a function node, so it works in the context of a
geometry, with a simple data output.

The "Nearest" mode finds the nearest element of the specified domain on
the target geometry and copies the value directly from the target input.

The "Nearest Face Interpolated" finds the nearest point on anywhere on
the surface of the target mesh and linearly interpolates the value on
the target from the face's corners.

The node also has a new "Index" mode, which can pick data from specific
indices on the target geometry. The implicit default is to do a simple
copy from the target geometry, but any indices could be used. It is also
possible to use a single value for the index to to retrieve a single
value from an attribute at a certain index.

Differential Revision: https://developer.blender.org/D12785
2021-10-15 14:09:08 -05:00
47a72ac4fd Cleanup: Refactor use of implicit inputs in geometry nodes
Instead of checking whether the socket value was hidden, use the proper
node declaration to check whether the socket has an implicit input. The
remaining larger change to make is allowing nodes to specify what their
implicit input should actually be.
2021-10-15 13:57:00 -05:00
4682aad432 Fix: Field type inference considers unavailable sockets
If a node had unused/unavailable inputs, they were still considered
when deciding whether the output is a field or not.
2021-10-15 13:54:08 -05:00
Leon Leno
45e16a6c96 UI: Remove extra padding around curve widget
This commit removes the constant padding around to the left and
right of the curve widget. The padding worked in screen space and
didn't take UI scale/zoom into account. This makes the curve widget
consistent with the more recently added curve profile widget used
for bevel profiles.

Differential Revision: https://developer.blender.org/D12883
2021-10-15 13:30:50 -05:00
d9e697fbbd Cleanup: remove accidental comment 2021-10-15 19:07:10 +02:00
1b6752e599 Fix T62325, T91990: changing Cycles presets does not update the Blender UI
Checking RNA_MAGIC is not enough to identify the ID property case which always
needs updates. If the property is already resolved to an RNA property we need
to check the flag too.
2021-10-15 19:00:19 +02:00
4ba7201546 Asset Browser: Hide Import Types menu for "Current File" asset library
This menu doesn't have an effect on the importing while in the "Current File"
asset library. This can be quite confusing.

However, just hiding the menu may be a temporary solution. Decision
actually to instead show a different menu, that allows choosing between
duplicating and reusing data on drop. This is being reviewed here
https://developer.blender.org/D12879.
Meanwhile (or in case we end up rejecting that), this change should
avoid some confusion.

Differential Revision: https://developer.blender.org/D12752
2021-10-15 18:53:55 +02:00
b66b3f547c Fix T92032: Cycles panoramic cameras do not support shift 2021-10-15 18:25:45 +02:00
7bf9c70b14 Fix T92083: Crash renaming bone used in Armature modifier on curve
This is caused by {rB3b6ee8cee708}.

Since rigging curves with armatures only works with envelopes (if I am
not mistaken), this stirs up the question again why we actually give the
choice for vertex groups in parenting. Anyways, curves can have armature
modifiers and renaming bones should not crash.

Now make sure we only go down the route of `BKE_object_defgroup_list`
and `BKE_object_defgroup_find_name` if vertex groups are actually
supported.

Maniphest Tasks: T92083

Differential Revision: https://developer.blender.org/D12876
2021-10-15 16:57:15 +02:00
Charlie Jolly
104887800c Geometry Nodes: Add Voronoi Texture
Port shader Voronoi to GN

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12725
2021-10-15 15:28:20 +01:00
6e4ab5b761 Fix crash handling tool-keymap events
There was a rare crash in WM_event_get_keymap_from_toolsystem_fallback
when wm->winactive was NULL.

This could happen when the event was handled
immediately after closing a window.
2021-10-16 01:13:28 +11:00
Charlie Jolly
d4f1bc5f39 Geometry Nodes: Port shader gradient texture node
Reviewed By: HooglyBoogly, JacquesLucke

Differential Revision: https://developer.blender.org/D12717
2021-10-15 15:03:21 +01:00
Charlie Jolly
78b5050ff4 Cycles: Voronoi noise, fix uninitialised variable
Caused a debug crash in Windows MSVS.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D12873
2021-10-15 15:01:10 +01:00
2f36762def Cleanup: refactor BVH2 shadow intersection for upcoming changes 2021-10-15 15:42:44 +02:00
5d565062ed Cleanup: refactor OptiX shadow intersection for upcoming changes 2021-10-15 15:42:44 +02:00
509b637d59 Cleanup: don't copy constant memory to GPU multiple times for displacement 2021-10-15 15:42:44 +02:00
eb71157e2a Cleanup: add utility functions for packing integers 2021-10-15 15:42:44 +02:00
2ba7c3aa65 Cleanup: refactor to make number of channels for shader evaluation variable 2021-10-15 15:42:44 +02:00
70376154a0 Fix Cycles Python error with pinned materials in properties editor 2021-10-15 15:42:44 +02:00
53f25df5bc Fix T92128: Cycles CUDA wrong hair attributes, after recent changes 2021-10-15 15:42:44 +02:00
f834939ceb Geometry Nodes: fix getting mutable geometry component
The previous code did not take into account that they geometry
component may not be mutable because it is shared between
multiple geometry sets.
2021-10-15 13:39:26 +02:00
da3946b710 Fix wrong DNA struct element lookup in versioning
The type of the element is `short`, not `int`. Harmless since this was checking
for a specific version anyway.
2021-10-15 12:38:10 +02:00
aca38148ad Fix T92131: handle node declaration in material properties
The issue was that this menu was only looking at socket templates,
but not at the new node declarations. This fix is to just check those
as well. The fix comes with a small refactor that makes the memory
management a bit simpler.

Differential Revision: https://developer.blender.org/D12866
2021-10-15 12:12:56 +02:00
e46055ae9d UI: Fix offset of vertical scale indicators
`BLF_height_max()` uses the tallest character in the font, and many characters
in our font are taller than numbers. Use `BLF_height` with `0` as reference instead.

Fix by @harley, thanks!
2021-10-15 11:54:07 +02:00
Jesse Yurkovich
93a8fd1249 Cleanup: Commonize code for checking scene lights/world settings
There were several places attempting to check to see if scene lights
and world were enabled for display. This tries to find a common place
for both of these to reduce duplication.

Honestly, I couldn't find a really good spot for these and settled on
DRW_engine. It's not the best spot since they're not strictly drawing
related, but let's start here.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D12658
2021-10-15 11:42:44 +02:00
30bed8761d Fix T92226 EEVEE: AO misaligned on first sample
Caused by tricky state tracking. `GPU_framebuffer_bind()` is updating
the framebuffer on first time and will reset the viewport state of it.
2021-10-15 11:24:10 +02:00
3022e190a2 Fix is_repeat being set for in between mouse-move events 2021-10-15 20:17:51 +11:00
d649b4b066 Fix crash using menu search without an active area 2021-10-15 17:52:01 +11:00
9a76dd2454 Fix some property shortcuts not showing in tooltip
Shortcut lookups for property buttons were only supported for a subset
of RNA types.

Replace inline data-path calculation with
WM_context_path_resolve_property_full.

Now the shortcut for the 3D View's overlay toggle (for e.g.) is shown.
2021-10-15 16:34:15 +11:00
beecd24fc6 Cleanup: use const for context argument 2021-10-15 16:32:06 +11:00
3ca2697001 Cleanup: clang-tidy 2021-10-15 16:32:06 +11:00
3ccdee7532 UI: View2D: Align vertical indicators to view
In editors with vertical scale indicators, such as Graph Editor,
Drivers, or VSE, display the values aligned to the view.

Also add a shadow (similar to the 3D View info) to improve readability when the text is on top of curves, strips, or other content.

{F10987240, size=full}

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12809
2021-10-15 02:54:10 +02:00
2055ef107a Geometry Nodes: Order selection inputs after geometry inputs
While there may be arguments for different positions of the selection
inputs, it's important to be consistent, and putting them right after
the corresponding geometry works well when there are multiple
geometry inputs. Addresses T91646.
2021-10-14 15:36:24 -05:00
89c7c115ce Geometry Nodes: Create empty components less often
Avoiding creating empty components can be a hassle for code that
interacts with a geometry set. One easy way to do that was calling
the functions that retrieved mutable access to geometry data directly,
like get_mesh_for_write. This commit makes it so that sort of direct
function does not create an empty component if there is no data.

Another way to create an empty component was calling the replace_*
methods with a null pointer. It's more convenient to have a nice API
that handles those cases without creating an empty component.

It's still convenient that the regular get_component_for_write adds
the component if it doesn't exist, because that's often a nice way to
add data to the geometry set.

Differential Revision: https://developer.blender.org/D12862
2021-10-14 12:43:36 -05:00
cddda70618 Geometry Nodes: Merge Conflict Cleanup
Removing a line that remained from a merge.
2021-10-14 12:22:33 -05:00
42a05ff6ea Geometry Nodes: Rename Nodes ID Names + Menu Org
Re-alphabetize the main add menu.

Rename Node ID Names:
FloatCompare => CompareFloats
AttributeCapture => CaptureAttribute
Boolean => MeshBoolean
CurveFill => FillCurve
CurveFillet => FilletCurve
CurveReverse => ReverseCurve
CurveSample => SampleCurve
CurveResmaple => ResampleCurve
CurveSubdivide => SubdivideCurve
CurveTrim => TrimCurve
MaterialReplace => ReplaceMaterial
MeshSubdivide => SubdivideMesh
EdgeSplit => SplitEdges

Differential Revision: https://developer.blender.org/D12865
2021-10-14 12:10:52 -05:00
17b8da7196 Geometry Nodes: Field version of mesh to curve node
This commit adds a fields version of the mesh to curve node, with a
field for the input selection. In order to reduce code duplication,
it adds the mesh to curve conversion to the new geometry module
and calls that implementation from both places.

More details on the geometry module can be found here: T86869

Differential Revision: https://developer.blender.org/D12579
2021-10-14 12:06:48 -05:00
1996efe7aa Python API: implement PoseBone.children via Bone.children.
Currently `PoseBone.children` is implemented by a linear scan of
the list of armature bones. This is doubly inefficient, since
not only is it scanning all bones, the `obj.data.bones` list
is actually synthetic and generated from Bone children lists.

Instead, use the `Bone.children` native RNA property.

Differential Revision: https://developer.blender.org/D12727
2021-10-14 19:44:37 +03:00
497d0400bd Fix another error in rB5e12e62a6a4e
The code was ignoring the icremental with small distances.
2021-10-14 13:31:17 -03:00
328b6f672b Fix error in rB5e12e62a6a4e 2021-10-14 13:27:23 -03:00
2289295555 GPUTexture: Fix assert when using stereo viewport with EEVEE
Stereo viewport means the depth buffer is use twice as often as a
framebuffer attachment.
2021-10-14 18:20:49 +02:00
5e12e62a6a Fix regression with incremental snap in Graph Editor
Regression introduced in {rBb0d9e6797fb8}.

Previously the Graphics Editor had a conflict with two different snap
types. Auto-Snap and Snap with Ctrl.

It is now clearer which snap should prevail.
2021-10-14 13:10:19 -03:00
b42ce0c54c Functions: Generic array data structure
Sometimes it's useful to pass around a set of values with a generic
type. The virtual array data structures allow this, but they don't
have logical ownership. My initial use case for this is as a return
type for the functions that interpolate curve attributes to evaluated
points, but a need for this data structure has come up in a few other
places as well. It also reduced the need for templates.

Differential Revision: https://developer.blender.org/D11103
2021-10-14 11:06:18 -05:00
5e8775a8da Fix T92030: crash when hovering over socket
This is the same fix as in rB24a965bb16c22e33752dfb6c22105b96a8649aeb.
2021-10-14 18:02:22 +02:00
a0f269f682 Cycles: Kernel address space changes for MSL
This is the first of a sequence of changes to support compiling Cycles kernels as MSL (Metal Shading Language) in preparation for a Metal GPU device implementation.

MSL requires that all pointer types be declared with explicit address space attributes (device, thread, etc...). There is already precedent for this with Cycles' address space macros (ccl_global, ccl_private, etc...), therefore the first step of MSL-enablement is to apply these consistently. Line-for-line this represents the largest change required to enable MSL. Applying this change first will simplify future patches as well as offering the emergent benefit of enhanced descriptiveness.

The vast majority of deltas in this patch fall into one of two cases:

- Ensuring ccl_private is specified for thread-local pointer types
- Ensuring ccl_global is specified for device-wide pointer types

Additionally, the ccl_addr_space qualifier can be removed. Prior to Cycles X, ccl_addr_space was used as a context-dependent address space qualifier, but now it is either redundant (e.g. in struct typedefs), or can be replaced by ccl_global in the case of pointer types. Associated function variants (e.g. lcg_step_float_addrspace) are also redundant.

In cases where address space qualifiers are chained with "const", this patch places the address space qualifier first. The rationale for this is that the choice of address space is likely to have the greater impact on runtime performance and overall architecture.

The final part of this patch is the addition of a metal/compat.h header. This is partially complete and will be extended in future patches, paving the way for the full Metal implementation.

Ref T92212

Reviewed By: brecht

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D12864
2021-10-14 16:14:43 +01:00
47caeb8c26 Fix T91743: Unify behavior of 'Auto Set Preview Range'
This is available in the DopeSheet, GraphEditor, and NLA Editor.

Currently:
- Dopesheet advertises to take selection into account...
-- ...but doesnt - which might be a mistake in rBe3842d1ca4dd
- Graph Editor does not mention selection...
-- ...and also does not take it into account
- NLA does not mention selection...
-- ...but takes it into account

Now:
- make them **all** take selection into account (you can still do a
quick 'Select All' prior to get the full range -- better than not being
able to set this based on selection)
- mention this for all in the tooltip
- also reword to 'Set Preview Range to Selected' since using the term
'Auto' impilies this would change on selection change.

Maniphest Tasks: T91743

Differential Revision: https://developer.blender.org/D12651
2021-10-14 16:29:04 +02:00
Charlie Jolly
2341ca990c Geometry Nodes: Add White Noise texture
Port White Noise shader to geometry nodes.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12719
2021-10-14 14:56:48 +01:00
55cf9bb5e6 Cleanup: fix const discard warning
No functional changes.
2021-10-14 15:34:29 +02:00
Charlie Jolly
25a255c32a Nodes: add boilerplate for image sockets
The sockets are not exposed in any nodes yet.
They work similar to the Object/Collection/Texture sockets,
which also just reference a data block.

Based on rB207472930834

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12861
2021-10-14 14:19:32 +01:00
138aa20959 Cleanup: asset browser, remove invalid assertion
Remove `BLI_assert_unreachable()` in a spot that is actually easily
reachable. To reach, follow these steps:
- Configure three asset libraries (say A, B, and C) in preferences
- Set the asset browser to library C and save the file
- Remove asset library C from the preferences
- Reopen the file.
2021-10-14 15:16:16 +02:00
Paul Golter
240345842d Filebrowser: Expose file select functions for File Browser to Python API.
This patch adds activate_file_by_relative_path(relative_path="") and
deselect_all() function to the space api of the File Browser. While the
first sets the active file and adds it to the selection based on a
relative path to the current File Browser directory the second one
deselects all files but does not change the active file.

Differential Revision: https://developer.blender.org/D12826
Reviewed by: Julian Eisel
2021-10-14 14:42:43 +02:00
9ca567bc4e Geometry Nodes: Reorganize Add Menu
- Move Converters to 'From' menus
  - Create Instances Menu
  - Realphabetize the Curve Menu

  Differential Revision: https://developer.blender.org/D12860
2021-10-14 06:41:52 -05:00
56b35991bc Alembic: avoid crash when Cycles is not enabled
The Alembic/CacheFile modifier supports Cycles procedurals when Cycles
is configured to use experimental features; the check for this would
segfault on builds with `WITH_CYCLES=OFF`. This is now fixed by adding
an extra NULL check.
2021-10-14 12:55:33 +02:00
42d79a6041 Fix T91398 Overlay: Camera BG jitter offset (regression)
This was caused by camera background being rendered in world space, causing
floating point imprecision issues when camera was far from origin.

Adding a uniform to change vertex shader to process everything in viewspace
to fix the problem.
2021-10-14 11:49:34 +02:00
583939c54d Fix T92200: VSE: 2D Cursor position missing viewport update
Was using notifier from wrong space (copy-paste error in rBd04d27b406b8).
2021-10-14 11:03:44 +02:00
aa46459543 Fix shadow catcher behind transparent object on GPU
The assumption about absent shadow path was wrong.

The rest of the changes are to ensure shadow paths are finished prior
to the split, so that they write to the proper passes.

The issue was caught by running regression tests on OptiX.

Differential Revision: https://developer.blender.org/D12857
2021-10-14 09:39:38 +02:00
4f5ef3b018 WM: quiet output of delete object operator
Object deletion was reporting the number of objects deleted,
causing tests to print noisy output.

Now this is information is only included when invoked.
2021-10-14 16:41:40 +11:00
3be2d6078f Cleanup: remove historic reference from makesdna.c
We have mostly removed information about original authors,
as this information isn't so useful.
2021-10-14 16:41:38 +11:00
a620ce7e54 Cleanup: use dot-points for appdir platform specific paths 2021-10-14 16:41:37 +11:00
f12ea3d52e Cleanup: reserve C++ comments for disabled code 2021-10-14 16:41:35 +11:00
5fec6eda55 Cleanup: silence Clang missing-braces warning. 2021-10-14 10:06:16 +05:30
a059d16f65 Geometry Nodes: Add Offset Option to Set Postion
Add a boolean field to the Set Position Node. This value allows
for each point to either have its position set to the input position
value or have the input value added to the current position.

Differential Revision: https://developer.blender.org/D12773
2021-10-13 23:33:46 -05:00
5401fda412 Cleanup: avoid using size for array length in naming
Confusing when array allocation takes two kinds of size arguments.
2021-10-14 14:06:49 +11:00
576142dc85 Cleanup: pass the sizeof(..) as the second arg for array allocation
By argument naming and convention this is the intended argument order.
2021-10-14 13:00:24 +11:00
c6e956bbb1 Fix compile error with 'WITH_CXX_GUARDEDALLOC' 2021-10-13 22:00:21 -03:00
9dff3de6ac Cleanup: clang-tidy, clang-format & spelling 2021-10-14 08:57:50 +11:00
685ceaa2f7 Fix reference counting error for world drag & drop
Error in 986d60490c
2021-10-14 08:57:14 +11:00
8434aa1b78 Fix invalid arguments to ED_gizmotypes_snap_3d_context_ensure 2021-10-14 08:57:13 +11:00
8278ad3dfb Fix T90799: Box/Ellipse Mask node masking is off-centered
This is especially noticeable when using the default center with full
width and height as some borders are masked by 1 pixel.

The relative coordinates are now calculated respect the last ones
instead of the dimensions for centering, and the limits
are inclusive to mask more accurately.
2021-10-13 23:41:14 +02:00
a3610c451a Fix Compositor stack use after scope
Caused by {rBf84fb12f5d72433780a96} after changing
`get_areas_to_render` to return a vector instead of a span.
2021-10-13 23:41:14 +02:00
f609b05b11 Cleanup: use _ suffix for non-public data members in Compositor
For code style and clarity.
2021-10-13 23:41:14 +02:00
1c42d4930a Cleanup: convert camelCase naming to snake_case in Compositor
To convert old code to the current convention and
use a single code style.
2021-10-13 23:41:14 +02:00
a2ee3c3a9f Cleanup: replace members m_ prefix by _ suffix in Compositor
To convert old code to the current convention and
use a single code style.
2021-10-13 23:41:14 +02:00
ea79efef70 Cleanup: remove this-> for m_ prefixed members in Compositor
For cleaning old code style as new code usually omit it.
2021-10-13 23:41:14 +02:00
ecb8a574c7 Cleanup: remove unused includes in Compositor
And move unneeded includes in frequently used headers
to source files.

Slightly reduces compile time.
2021-10-13 23:41:14 +02:00
91c33c8b99 Cleanup: Snap Context Refactor
Move runtime parameters out of context creation.

Not being able to choose another region and v3d limits the use of the
snap API.
2021-10-13 17:43:29 -03:00
988b9bc40c Fix T92192: Inconsistent curve circle primitive direction
Switch sin and cosine so that the points in the circle have the same
direction in both radius and points modes.
2021-10-13 14:34:14 -05:00
1ae79b704a Fix T92180: Curve subdivide incorrect result for poly splines
The node shifted all new points forward in the spline, so the first
point would appear to be removed.
2021-10-13 14:28:05 -05:00
10abaf3ddf Fix T88766 EEVEE: Missing glossy reflections with Shader to RGB & SSR is active.
This was due to the shading evaluation being outdated inside the ShaderToRGBA
glsl code.
2021-10-13 20:51:15 +02:00
d39cd851c0 Fix T89777 EEVEE: Contact Shadows causes wrong shading in Reflection Plane
The planar reflections being rendered at the same resolution as the HiZ max
buffer, do not need any uv correction during raytracing.

However, the GTAO horizon buffer being at output resolution do need the
uv factors in order to match the pixels visible on screen. To avoid many
complication, we increase the size of the GTAO texture up to the hiz buffer
size. This way, if planar reflections need GTAO the texture is big enough.
We change the viewport of the GTAO framebuffer for the main view in order
to not have to modify Uvs in many places.
2021-10-13 19:58:14 +02:00
98a62a5c08 Geometry Nodes: Material Index - minor cleanup
- Add a versioning comment
  - Indexes to Indices
2021-10-13 12:32:28 -05:00
366cea95c5 Geometry Nodes: Fields version of edge split node
This changes the edge split node to have a selection input, which is
more aligned with the other design changes. This loses the ability to
split edges based on an angle, but the edge angle can be added as a
field input node in the future, which will make for a much more
flexible system.

Differential Revision: https://developer.blender.org/D12829
2021-10-13 11:34:29 -05:00
96876305e1 Geometry Nodes: Make attribute capture work on instances
Previously the attribute capture node only worked on realized geometry,
which was very confusing when other nodes worked on each individual
instance. The realize instances node is the way to explicitly change
between the two behaviors. Addresses T92155.

Differential Revision: https://developer.blender.org/D12841
2021-10-13 11:26:23 -05:00
Erik Abrahamsson
78445ebd5f Geometry Nodes: Rotate Instances Node
Adds a node that can rotate each of a geometry's instances in global
(to the modifier object) or local space (of each point) by a specified
angle around a pivot point.

In the future, separating the local-global choice for the pivot and the
rotation might be useful. However, for now the node is kept simple.

Differential Revision: https://developer.blender.org/D12682
2021-10-13 09:42:10 -05:00
51ea08487b Fix T92185: GPencil memory leak removing stroke from python
The API was not removing the weights, points and traingulation data. Only it was removing the stroke itself.
2021-10-13 16:22:31 +02:00
Jesse Yurkovich
92b7bf4856 Cleanup: Remove data duplication from SMAA lookup tables
These 2 large tables, `areaTexBytes` and `searchTexBytes`, contributed
~176kb worth of duplicate data into the `blender` executable due to the
header being used in multiple places. We were lucky that only 2
translation units had included this header so only 1 duplicate copy of
each was wasted.

Define the tables as `extern` to address this.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D12723
2021-10-13 16:20:51 +02:00
Erik Abrahamsson
6c11b320c4 Geometry Nodes: Scale Instances Node
Adds a node that can scale a geometry's instances. With "Local" turned
on, the instance is scaled individually from the center point input,
while when local space is turned off, it's more like the transform
node, except it scales outward from the center point instead of only
from the origin.

Differential Revision: https://developer.blender.org/D12681
2021-10-13 09:10:06 -05:00
d0a4a41b5d Geometry Nodes: Add Selection to Instance on Points
Add a boolean selection field to the Instance on Points node.
This will select which points from the source geometry will be used
to create the instances.

Differential Revision: https://developer.blender.org/D12847
2021-10-13 09:06:09 -05:00
Erik Abrahamsson
9d49fc2ba0 Geometry Nodes: Translate Instances Node
Adds a node that can translate instances in the transform space of
the modifier object, or the local space of their original transform.
One reason to have a special node for instances is that they always
have the existing transform, unlike mesh or point cloud points.

Differential Revision: https://developer.blender.org/D12679
2021-10-13 09:02:29 -05:00
356dce13f0 Fix T92136: Leak accessing evaluated depsgraph data from Python
Copy-on-write data blocks could be referenced from python but were not
properly managing python reference counting.

This would leak memory for any evaluated data-blocks accessed by Python.

Reviewed By: sergey

Ref D12850
2021-10-14 00:53:09 +11:00
c29f20a521 Cleanup: Remove unused code paths in the depsgraph copy-on-write
Seems to be residue from an early 2.80 days: the placeholder code path
is no longer used.

Remove all the tricky code for this, and make it clear that the
`deg_expand_copy_on_write_datablock` is used on an non-expanded
datablock.

Should be no functional changes. And should help simplify D12850.

Differential Revision: https://developer.blender.org/D12852
2021-10-13 15:47:07 +02:00
e659f78d3e Cleanup: use typedef struct for BLODataBlockInfo. 2021-10-13 15:44:36 +02:00
24cc552cf4 Geometry Nodes: Material Index, Set Material
Add Get/Set Nodes for Material Index
Rename Assign Material to Set Material

Differential Revision: https://developer.blender.org/D12837
2021-10-13 08:41:35 -05:00
d4e8390e95 Fix T92153: use-after-free with anonymous attributes
Differential Revision: https://developer.blender.org/D12851
2021-10-13 15:37:17 +02:00
Pablo Vazquez
5183653951 UI: Make menu item use theme roundness
Menu items ignore the roundness setting since they spread left to right.
This patch makes it so menu items use the theme preference instead of
hardcoded square corners. Providing more flexibility to themes.

All built-in and included themes already have this set so no need to update them. For the default themes (Dark/Light) roundness is 0.4.

{F10950727, size=full}

The motivations behind this change are:
* To be more consistent with other widgets.
* Improve themes flexibility.
* Match padding with other elements that have like the Search field:

{F10950746, size=full}

Reviewed By: #user_interface, Severin

Differential Revision: https://developer.blender.org/D12813
2021-10-13 14:31:03 +02:00
72e81a45c4 Extern: Add modifications diff for TinyGLTF
This should have been added in ee49991999.
2021-10-13 20:56:27 +09:00
Bastien Montagne
59113df8ec Fix T92113: On assets, replace "Fake User" button with "Clear Asset" button.
Change is simple enough, but we abuse a bit the UI code here to get a
similar 'look' as the fake user button for the new Asset one, while
still being able to call an operator instead of editing directly a RNA
value.

Reviewed By: Severin, sybren

Maniphest Tasks: T92113

Differential Revision: https://developer.blender.org/D12839
2021-10-13 13:35:17 +02:00
8c0698460b Revert "Fix T92136: Leak accessing evaluated depsgraph data from Python"
This reverts commit 0558907ae6.

Based on discussion with Sergey, having Python references to un-expanded
data should not happen - this change needs to be reconsidered.
2021-10-13 21:29:30 +11:00
f71d479556 Fix Cycles viewport after session reset
Happens i.e. when changing compute device.

A more proper follow-up to the on-demand display driver creation change.
2021-10-13 12:01:18 +02:00
0558907ae6 Fix T92136: Leak accessing evaluated depsgraph data from Python 2021-10-13 20:59:56 +11:00
86536e7859 Fix Cycles assert in viewport after recent change
Create display early on, so that ready_to_reset() passes assert test
for use for display actually configured.
2021-10-13 11:46:38 +02:00
f12513a21c Fix Cycles backing issues when using multiple devices
The pixel accessor was not aware of possible offset in the
pixel padding causing some slices of the result not being
properly padded.
2021-10-13 11:20:25 +02:00
9c412b6e2d Fix possible integer overflow in Cycles baking
Ensure math happens on size_t type instead of int followed by a cast
to the size_t.
2021-10-13 11:20:25 +02:00
William Leeson
3021babf38 Fix: Stops assert when baking in debug mode.
When baking in a debug build running gdb it kept asserting because a GL context was being created outside the main thread.

To fix this the patch only creates the GL context is only created for rendering (when it is actually used).

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D12767
2021-10-13 11:09:22 +02:00
53af51ad50 Geometry Nodes: Add "XYZ" label to instance on points scale 2021-10-12 17:43:41 -05:00
9e3c84a5d6 Geometry Nodes: Add units to set radius node inputs 2021-10-12 17:33:59 -05:00
Erik Abrahamsson
351721d0ea BLI: Overload float4x4 multiplication-assignment operator
This looks a lot nicer than writing `mul_m4_m4_post` instead.

Differential Revision: https://developer.blender.org/D12844
2021-10-12 16:59:06 -05:00
f18ab3470f Fix T91809: Crash on undo with empty field inferencing
Some runtime data that stores which sockets can be fields and which
can't is not stored in the file, but only calculated when necessary.
When opening a file, the node tree update function was called, which
recalculated this data, but that was explicily turned off for undo.

This exposes a fundamental issue with undo, the ID caching system for
undo, and how it relates to node trees in particular. Ideally this call
couldn't be necessary at all. In the future it could be removed by
adding a runtime struct to node trees, and calculating its contents
on-demand instead of preemtively.

Differential Revision: https://developer.blender.org/D12699
2021-10-12 15:38:56 -05:00
9d03990e32 Fix T92160: Geometry Proximity node can produce invalid values
Check when the node fails to create BVH trees, and fill the result
with zero in that case, which is most likely the expected value when
the node encounters an error. Warnings will be added with a separate
patch.
2021-10-12 15:28:11 -05:00
eb56e8cd78 Cleanup: Fix comment formatting and grammar 2021-10-12 14:14:09 -05:00
a6da1884ba Asset Catalogs: Refresh catalog simple name when assigning catalog ID
When assigning a new catalog ID to an asset, also refresh the "catalog
simple name". This "simple name" is stored on the asset metadata next to
the catalog UUID, to allow some emergency data recovery when the catalog
definition file is somehow lost.
2021-10-12 18:07:58 +02:00
Wannes Malfait
5e3877e0c8 Fix T92149: Crash in delete geometry node after curve fill node
There was only a check for the component but not for if it was empty.
Because the curve fill node produces an empty curve component, a
nullptr was read, causing a crash. Generally nodes shouldn't produce
empty components, but currently we cannot rely on that fact.

Differential Revision: https://developer.blender.org/D12838
2021-10-12 10:58:38 -05:00
Wannes Malfait
0c7e836a1d Fix T92150: Incorrect invert in Delete Geometry node
The selection was inverted when deleting points from a spline.

Differential Revision: https://developer.blender.org/D12840
2021-10-12 10:57:12 -05:00
ad80248875 Revert "GHOST: Unify behavior of offscreen context creation"
Commited by mistake

This reverts commit 6535779c92.
2021-10-12 17:54:52 +02:00
72a47fea5d Fix dragging objects from Outliner to 3D View broken
A dragged & dropped wouldn't be duplicated anymore, it would just be moved to
the drop position.

Caused by c8fcea0c33.
2021-10-12 17:49:59 +02:00
c63fb657c8 Cleanup: use nullptr instead of NULL in C++ code. 2021-10-12 17:16:20 +02:00
45f167237f Fix T91981: Crash when using operators that needs scene depth
There was a double lock in the object depth drawing function.
Also the texture read was not reading the texture with the right
format. Now it needs a conversion.

Fix T91981 Particle Edit make Blender Crash
Fix T92006 Light spot interactively point can't use
2021-10-12 16:47:42 +02:00
6535779c92 GHOST: Unify behavior of offscreen context creation
This makes sure the previously bound context is restored after creating a
new context. This follows what is already happening on windows.

All system backend are patched.

This also removes the goto and some code duplication.

Differential Revision: https://developer.blender.org/D12455
2021-10-12 16:47:41 +02:00
a2daf92a57 Fix warning about deleted default constructor declared as default
Since `AssetCatalogPath` isn't default constructible (unlike the
previous `CatalogPath`, alias `std::string`), `AssetCatalog` isn't
default constructible either. But its default constructor is declared
with `= default` which Apple Clang was warning about.

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

Reviewed by: Sybren Stüvel
2021-10-12 16:40:02 +02:00
1db42c9b79 Address warning about breaking copy elision of temporary object
Using `std::move()` on temporary objects prevents copy elision done by
compilers. Apple Clang warns about this.

Generally `std::move()` should be used sparingly:
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
2021-10-12 16:28:48 +02:00
aaf3a63dca Cleanup: Typo in comment. 2021-10-12 16:18:50 +02:00
c1a1644db7 Cleanup: Attempt to fix benign macOS compile warnings 2021-10-12 09:13:21 -05:00
30cd1d10a9 Asset Browser: Remove catalog deletion confirm prompt
This confirmation popup was added when deletion was a destructive action that
would be written to disk immediately, with no way to undo. Now we only write
such changes to disk on .blend file save, plus there's undo/redo support for
catalog edits now. In such cases confirmation popups should be avoided.
2021-10-12 15:49:57 +02:00
b7b2103cf7 Asset Catalogs Undo: add Ctrl+Z and Ctrl+Shift+Z as hotkeys for undo/redo
Allow undo/redo of asset catalog edits with Ctrl+Z/Ctrl+Shift+Z. These
keys are registered in the 'screen' keymap, so that they can take
priority over the global undo/redo operators.

Updated both Blender Default and Industry Compatible keymaps.
2021-10-12 15:12:48 +02:00
7867feae56 Asset Catalogs: mark 'undo push' operator as internal
Mark the `ASSET_OT_catalog_undo_push` operator as internal, as it's not
meant for artists to use directly.
2021-10-12 15:11:13 +02:00
a7300a217d Asset Catalog Undo: send notifiers to redraw the catalog tree
Send notifiers to redraw the catalog tree after undo/redo.
2021-10-12 15:10:50 +02:00
74ea21ec9d Asset Catalogs: expose undo/redo operators to UI
Ensure that catalog operations create an undo snapshot, and show
undo/redo operators in the asset browser.

A hidden operator `ASSET_OT_catalog_undo_push` is also added such that
add-ons can also set undo snapshots if they need.
2021-10-12 14:45:11 +02:00
f1d97a308d Cleanup: asset catalogs, rename store_undo_snapshot to undo_push
Rename `bke::AssetCatalogService::store_undo_snapshot` to `undo_push`.
This makes the function named the same way as the global Blender "undo
push" function.

No functional changes.
2021-10-12 14:42:36 +02:00
3a03d6c851 Fix: Incorrect error message in set spline resolution node
Caused by my own refactoring before committing the patch.
2021-10-12 07:24:25 -05:00
a06435e43a Asset Catalogs: undo stack for catalog edits
Add an undo stack for catalog edits. This only implements the backend,
no operators or UI yet.

A bunch of `this->xxx` has been replaced by `catalog_collection_->xxx`.
Things are getting a bit long, and the class is turning into a god
object; refactoring the class is tracked in T92114.

Reviewed By: Severin

Maniphest Tasks: T92047

Differential Revision: https://developer.blender.org/D12825
2021-10-12 12:42:44 +02:00
b67a937394 Assets: hide low-level catalog info behind "developer extra's"
Hide the catalog UUID and the catalog simple name from the Asset Browser
side-panel, unless "Developer Extra's" is enabled in the user prefs.
2021-10-12 12:17:47 +02:00
cc04399937 Fix missing Cycles volume stack re-allocation
Need to check allocation size, as the features do not change with
volume stack depth detection.
2021-10-12 11:55:23 +02:00
ad1735f8ed Asset Catalogs: recursive deletion of catalogs & children
Recursively delete asset catalogs with `AssetCatalogService:prune_...`
functions. This deletes the catalog and all of its children.

The old `delete_catalog` function has been renamed to
`delete_catalog_by_id()`, and is now a lower-level function (no deletion
of children, no rebuilding of the tree). The `prune_catalogs_by_path()`
and `prune_catalogs_by_id()` do delete children and do rebuild the
catalog tree.

Manifest task: T91634
2021-10-12 11:28:16 +02:00
ac657bee01 Tests: simplify asset catalog tree testing code
Simplify the testing code that verifies the asset catalog tree. It now
prints clearer error messages when things go wrong, and it gets simpler
data to test (instead of having to explicitly pass the parent count, it
just counts the number of separators in the expected path).

No functional changes to Blender.
2021-10-12 11:25:24 +02:00
Jeroen Bakker
29e5dc1b19 WindowManager: Keep track or the source library when appending.
Keep track of the source library allowing other parts of the code to
to make better decisions. This is needed to localize external files.

In this case the file paths are updated when `making local`.
But we should decide based on the source library if we want to
copy the file relative to the new blend file. See D12423.

Reviewed By: mont29, Severin

Differential Revision: https://developer.blender.org/D12765
2021-10-12 09:50:04 +02:00
690382bef5 Fix incorrect commet in appdir.c about cache locations. 2021-10-12 09:46:46 +02:00
e8dc02aa3f Fix build error due to conflicting types 2021-10-12 16:36:56 +09:00
9dda65455b XR Controller Support Step 4: Controller Drawing
Addresses T77127 (Controller Drawing).

Adds VR controller visualization and custom drawing via draw
handlers. Add-ons can draw to the XR surface (headset display) and
mirror window by adding a View3D draw handler of region type 'XR' and
draw type 'POST_VIEW'.  Controller drawing and custom overlays can be
toggled individually as XR session options, which will be added in a
future update to the VR Scene Inspection add-on.

For the actual drawing, the OpenXR XR_MSFT_controller_model extension
is used to load a glTF model provided by the XR runtime. The model's
vertex data is then used to create a GPUBatch in the XR session
state. Finally, this batch is drawn via the XR surface draw handler
mentioned above.

For runtimes that do not support the controller model extension, a
a simple fallback shape (sphere) is drawn instead.

Reviewed By: Severin, fclem

Differential Revision: https://developer.blender.org/D10948
2021-10-12 16:18:05 +09:00
cfa59b3fab Cleanup: remove unused parameter 2021-10-12 16:13:24 +09:00
eb8afc39f8 Tests: remove noisy output from bl_pyapi_idprop_datablock
As part of expected behavior this printed an exception,
making it seem as if there was an error in the test.

Now the exception is suppressed from the output, ensuring it matches
an the expected output.
2021-10-12 17:58:52 +11:00
6139782d81 Tests: script_pyapi_idprop now cleans up after it's self
This test left blend files in the users temporary directory.
2021-10-12 17:58:52 +11:00
3d35d4a9e5 Tests: support running ID-property test without numpy 2021-10-12 17:57:38 +11:00
7b0b050dd5 Tests: quiet warning for UIList class name 2021-10-12 17:57:37 +11:00
fe958d7d99 Fix leak on exit when WITH_PYTHON_SAFETY is enabled
The lead only occurred when Python references were leaking as well.
2021-10-12 17:55:02 +11:00
c1c6c11ca6 Cleanup: spelling in comments 2021-10-12 17:55:02 +11:00
a91c6f1804 Cleanup: quiet undefined warning 2021-10-12 17:52:33 +11:00
Jeroen Bakker
70fd6a313e GHOST: Add option to request (user) cache folder.
Introduces `BKE_appdir_folder_caches` to get the folder that
can be used to store caches. On different OS's different folders
are used.

- Linux: `~/.cache/blender/`.
- MacOS: `Library/Caches/Blender/`.
- Windows: `(%USERPROFILE%\AppData\Local)\Blender Foundation\Blender\Cache\`.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12822
2021-10-12 08:42:25 +02:00
8f66f40318 Silence compilation warning in wm_xr_session. 2021-10-12 08:41:12 +02:00
cdeb506008 XR Controller Support Step 3: XR Events
Integrates XR input actions with the WM event system. With this commit,
all VR action functionality (operator execution, pose querying, haptic
application), with the exception of custom drawing, is enabled.

By itself, this does not bring about any changes for regular users,
however it is necessary for the upcoming VR add-on update that will
expose default controller actions to users.

For add-on developers, this updates the Python API with access to XR
event data (input states, controller poses, etc.), which can be
obtained via the "xr" property added to the bpy.types.Event struct.
For XR events, this property will be non-null and the event will have
the type XR_ACTION.

Further details:
XR-type window events are queued to the regular window queues after
updating and interpreting VR action states. An appropriate window is
found by either using the window the VR session was started in or a
fallback option.

When handling XR events, mouse-specific processing is skipped and
instead a dedicated XR offscreen area and region (see 08511b1c3d) is
used to execute XR event operators in the proper context.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D10944
2021-10-12 13:48:12 +09:00
4b31a21bcd Geometry Nodes: Use a separator in the add menu input category
This can help separate the field inputs from the other nodes,
like some other categories.
2021-10-11 18:14:03 -05:00
Charlie Jolly
f7ef68514b Geometry Nodes: Add Color input node
Adds a color input node with picker.

Differential Revision: https://developer.blender.org/D12793
2021-10-11 23:43:01 +01:00
Charlie Jolly
e005ad5b54 Fix T92103: Update BLI hash_float_to_float functions to be shader compatible
Previously the functions called `hash_float` instead of `uint_to_float_01`.
This meant that the float was hashed twice instead of once.
The new functions are also compatible with Cycles/Eevee.

Differential Revision: https://developer.blender.org/D12832
2021-10-11 22:59:04 +01:00
Jarrett Johnson
ca8e8fd8d4 Fix T92102: Issues with align euler to vector node
For fixed pivots, make sure the correct pivot axis is being used.
Also add continues or invalid rotations.

Differential Revision: https://developer.blender.org/D12824
2021-10-11 13:26:31 -05:00
d993c7b503 Fix recently added File Browser name/path getters not allowing unicode
The `FileSelectEntry.name` and `FileSelectEntry.relative_path` members
should support unicode strings like any file names & paths, but didn't.
2021-10-11 18:28:34 +02:00
db851ccd2a Fix T92056: empty sampling pattern in Cycles when opening some existing files 2021-10-11 18:22:54 +02:00
a94343a8af Cycles: improve SSS Fresnel and retro-reflection in Principled BSDF
For details see the "Extending the Disney BRDF to a BSDF with Integrated
Subsurface Scattering" paper.

We split the diffuse BSDF into a lambertian and retro-reflection component.
The retro-reflection component is always handled as a BSDF, while the
lambertian component can be replaced by a BSSRDF.

For the BSSRDF case, we compute Fresnel separately at the entry and exit
points, which may have different normals. As the scattering radius decreases
this converges to the BSDF case.

A downside is that this increases noise for subsurface scattering in the
Principled BSDF, due to some samples going to the retro-reflection component.
However the previous logic (also in 2.93) was simple wrong, using a
non-sensical view direction vector at the exit point. We use an importance
sampling weight estimate for the retro-reflection to try to better balance
samples between the BSDF and BSSRDF.

Differential Revision: https://developer.blender.org/D12801
2021-10-11 18:22:54 +02:00
73a05ff9e8 Cycles: restore Christensen-Burley SSS
There is not enough time before the release to improve Random Walk to handle
all cases this was used for, so restore it for now.

Since there is no more path splitting in cycles-x, this can increase noise in
non-flat areas for the sample number of samples, though fewer rays will be traced
also. This is fundamentally a trade-off we made in the new design and why Random
Walk is a better fit. However the importance resampling we do now does help to
reduce noise.

Differential Revision: https://developer.blender.org/D12800
2021-10-11 18:22:54 +02:00
40360253ae Fix T86671: Background Scene Dupliface Not Instanced.
Use depsgraph's objects iterator to find sources of dupliobjects,
instead of looping over bases of a viewlayer.
2021-10-11 18:18:51 +02:00
bb6cc67d05 UI: Reduce whitespace in custom node categories
This makes the long "Curve" category take up less space.
2021-10-11 11:10:39 -05:00
Johnny Matthews
c1b4abf527 Geometry Nodes: Add Nodes to Get/Set Built-in Attributes
This commit implements T91780, adding nodes to get and set builtin
attributes. Individual set nodes are used so that the values can be
exposed for direct editing, which is useful for attributes like shade
smooth and spline resolution. Individual input nodes are used to allow
reusing nodes for multiple components, and to allow grouping multiple
outputs conceptually in the same node in the future.

Input Nodes
 - Radius
 - Curve Tilt
 - Curve Handle Positions
 - Is Shade Smooth
 - Spline Resolution
 - Is Spline Cyclic

'Set' Nodes
 - Curve Radius
 - Point Radius
 - Curve Tilt
 - Curve Handle Positions
 - Is Shade Smooth
 - Spline Resolution
 - Is Spline Cyclic

Using hardcoded categories is necessary to add separators to the node
menu.

Differential Revision: https://developer.blender.org/D12687
2021-10-11 11:03:57 -05:00
83f87d9f21 Cleanup: Asset Catalogs, add divider between sections in code
No functional changes.
2021-10-11 18:00:11 +02:00
3de76a067a Cleanup: Asset Catalogs, add type alias for asset catalog maps
Add alias for `Map<CatalogID, std::unique_ptr<AssetCatalog>>` to make the
rest of the code a bit simpler.

No functional changes.
2021-10-11 18:00:11 +02:00
ecedef09e7 Geometry Nodes: Rename 12 Nodes to be "Verb First"
Attribute Capture => Capture Attribute
Curve Fill => Fill Curve
Curve Fillet => Fillet Curve
Curve Reverse => Reverse Curve
Curve Sample => Sample Curve
Curve Subdivide => Subdivide Curve
Curve Trim => Trim Curve
Material Assign => Assign Material
Material Replace => Replace Material
Mesh Subdivide => Subdivide Mesh
Float Compare => Compare Float
Boolean => Mesh Boolean

Differential Revision: https://developer.blender.org/D12798
Task: https://developer.blender.org/T91682
2021-10-11 10:38:45 -05:00
cae4d8637c Cleanup: match parameter name in function declaration and implementation. 2021-10-11 16:08:28 +02:00
4703e125bf Fix active pixels overlay for Cycles viewport
It got missed in some of previous development.

Can not see a reason why the line needed to be removed, maybe just some
accident.
2021-10-11 15:59:07 +02:00
Wannes Malfait
9c00486451 Geometry Nodes: Separate and Delete Geometry for fields
Delete Geometry:
This adds a copy of the old node in the legacy folder and updates the
node to work with fields. The invert option is removed, because it is
something that should be very easy with fields, and to be consistent
with other nodes which have a selection. There is also a dropdown to
select the domain, because the domain can't be determined from the
field input. When the domain does not belong on any of the components
an info message is displayed.

Separate Geometry:
A more general version of the old Point Separate node. The "inverted"
output is the same as using the delete geometry node.

Differential Revision: https://developer.blender.org/D12574
2021-10-11 08:38:02 -05:00
275d0d3397 Cleanup: Spelling in comment 2021-10-11 14:01:42 +02:00
eca2a41964 Cycles: Improve volume stack size calculation
Only count volume objects after shader optimization.

Allows to discard objects which don't have effective volume
BSDF connected to the shader output (i.e. constant folded,
or non-volume BSDF used by mistake).

Solves memory regression reported in T92014.

There is still possibility to improve memory even further
for cases when there are a lot of non-intersecting volume
objects, but that requires a deeper refactor of update
process. Will happen as a followup development.

Differential Revision: https://developer.blender.org/D12797
2021-10-11 14:01:42 +02:00
a82c9e1e40 Fix T91169: bpy_extras.io_utils.create_derived_objects -> duplis error
This function now takes a depsgraph and a list of objects to avoid
inefficient O(n^2) iteration when extracting instances from all objects
in the scene. Returning an object -> instance map.

Note that keeping compatibility with the existing API wasn't practical
in this case since instances can no longer be generated from the scene
and it's objects.
2021-10-11 21:35:38 +11:00
0ceded7bc9 Cycles: Introduce scene host_update function
The longer-term goal is to separate host-only scene update
from device update: make it possible to make kernel features
depend on actual scene state and flags.

This change makes it so shaders are compiled before kernel
load, making checks like "has_volume" available at the
kernel features calculation state.

No functional changes are expected at this point.

Differential Revision: https://developer.blender.org/D12795
2021-10-11 12:27:28 +02:00
Pratik Borhade
f9755add65 Fix T91785: Change max input limit for knife tool angle snapping
Patch changes the Knife Tool angle snapping input limit to 180.

Differential Revision: https://developer.blender.org/D12728
2021-10-11 11:10:37 +01:00
cc6ca13852 Fix T90634: Gizmo.target_set_value() crash without a valid property
Raise an exception when target properties have not been set.
2021-10-11 20:19:19 +11:00
a6d34f4c3f Cleanup: add utility functions to parse gizmos and target properties 2021-10-11 20:14:15 +11:00
6e92a2d591 Cleanup: make format (VSE) 2021-10-11 10:10:54 +02:00
813ca82f1e Fix T92080: Background of Node editors appear brighter than before
In the original code depth=0 meant that there was no parents. But with
BLI_listbase_count we have depth 1 in those cases.

Differential Revision: https://developer.blender.org/D12817
2021-10-11 10:10:13 +02:00
a282efecbc Cleanup: Add const keyword to BKE_packedfile_id_check. 2021-10-11 09:40:22 +02:00
bdd2a7f466 Doc: expand on docstring for PyC_Long_AsBool 2021-10-11 15:33:42 +11:00
fef4dc7269 Fix starting Blender with Python 3.10
URL presets weren't working, raising a Python exception
when the splash screen was displayed.
2021-10-11 12:58:12 +11:00
d2454487d1 Fix: Incorrect custom property edit string to int change
This fixed an error in a corner case, and is a reasonable check anyway.
2021-10-10 20:53:56 -05:00
1bfa9539d3 Fix T91889 Exact boolean sometimes drops triangles.
The problem is that the fast triangulator (based on polyfill)
sometimes makes degenerate triangles. Commit 8115f0c5bd91f had
a check for degenerate triangles but it wasn't thorough enough.
This commit uses a more thorough (and pessimistic) test for
degenerate triangles, using the exact triangulator in those cases.
2021-10-10 19:54:02 -04:00
Jarrett Johnson
79425ed326 Geometry Nodes: Align Euler to Vector Node
This commit introduces the Align Euler to Vector function node which
rotates to a body into a given direction. The node replaces the legacy
"Align Rotation to Vector" node, which only worked on an attribute
named `rotation` internally. The "Euler" in the name is meant to make
it clearer that the rotation isn't interchangeable with a regular
vector.

Addresses T91374.

Differential Revision: https://developer.blender.org/D12726
2021-10-09 14:40:37 -05:00
2561145da8 Fix T91096: VSE use after free with overwrite enabled
Strip was flagged for deletion in `seq_transform_handle_overwrite()`
on `STRIP_OVERLAP_IS_FULL`. Then it is removed in
`SEQ_edit_strip_split()` before it should be.

Handle `STRIP_OVERLAP_IS_FULL` in separate loop.

This may not be complete solution, because in example file overlap is
caused between 2 transformed strips and one that is "static".
Such operation should not be possible in first place. This fixes the
crash at lest, so improvement in behavior can be handled separately.

Differential Revision: https://developer.blender.org/D12751
2021-10-09 10:11:10 +02:00
e541f37529 Fix T91978: VSE box select substract doesn't work
Substract and add modes were not implemented. Add logic to handle these
modes.
2021-10-09 10:08:31 +02:00
27ac80f068 VSE: rename flag for Frame Overlay feature
Rename `SEQ_EDIT_OVERLAY_SHOW` to `SEQ_EDIT_USE_FRAME_OVERLAY` to avoid
confusion between `SEQ_SHOW_OVERLAY` of `SpaceSeq.flag`
2021-10-09 08:41:07 +02:00
13df8616ce VSE: Fix 2D cursor not visible
This was caused by confusing naming of frame overlay feature.
Correct flag to use is `sseq->flag & SEQ_SHOW_OVERLAY`, not
`ed->over_flag & SEQ_EDIT_OVERLAY_SHOW`.
2021-10-09 08:41:07 +02:00
6391949601 Cleanup: Change variable name, comment formatting 2021-10-09 01:01:44 -05:00
728e31e18a Fix: Typo in UI error message 2021-10-09 00:55:11 -05:00
886196b888 Fix T92037: Custom property edit issues with integer soft range
- Fix a typo that used the max instead of the min for the soft max
- Assign the correct "last property type" when the operator starts
- Only check values for the soft range when use soft range is turned on
2021-10-08 15:02:23 -05:00
8f8982d57c Asset Browser: Context menu for catalogs
The context menu is a standard way to expose operations of the clicked
item to the user. They expect it to be there, and we can make use of it
as a place to put more advanced operations in.

The menu contains:
* New Catalog
* Delete Catalog
* Rename

Also removes the 'x' icon to delete a catalog from the right side of a
row. This was just placed there temporarily until the context menu is
there. It's too easy to accidentally delete catalogs with this.
2021-10-08 20:09:42 +02:00
17c928e975 UI: Add context menu support for tree-view items
Tree-view items can now easily define their own context menu. This works
by overriding the `ui::AbstractTreeViewItem::build_context_menu()`
function. See the documentation:
https://wiki.blender.org/wiki/Source/Interface/Views#Context_Menus

Consistently with the Outliner and File Browser, the right-clicked item
also gets activated. This makes sure the correct context is set for the
operators and makes it clear to the user which item is operated on.

An operator to rename the active item is also added, which is something
you'd typically want to put in the context menu as well.
2021-10-08 20:08:22 +02:00
7bd0de9240 Asset Browser: Avoid per-asset context menu on right click in sidebar
The right-click keymap item to display the context menu was added for
the entire area, not just the main region.
2021-10-08 19:48:14 +02:00
3a65571195 Fix T90666: Toggling motion blur while persistent data is enabled results in artifacts
Enabling or disabling motion blur requires rebuilding the BVH of affected geometry and
uploading modified vertices to the device (since without motion blur the transform is
applied to the vertex positions, whereas with motion blur this is done during traversal).
Previously neither was happening when persistent data was enabled, since the relevant
node sockets were not tagged as modified after toggling motion blur.

The change to blender_object.cpp makes it so `geom->set_use_motion_blur()` is always
called (regardless of motion blur being toggled on or off), which will tag the geometry
as modified if that value changed and ensures the BVH is updated.
The change to hair.cpp/mesh.cpp was necessary since after motion blur is disabled,
the transform is applied to the vertex positions of a mesh, but those changes were not
uploaded to the device. This is fixed now that they are tagged as modified.

Maniphest Tasks: T90666

Differential Revision: https://developer.blender.org/D12781
2021-10-08 18:03:06 +02:00
94d2736dfb Fix T92046: Mesh to GPencil fails because materials are not created
This bug was introduced in D12190 because the list of types that support materials did not include GPencil and this caused all materials to be removed after they were created during conversion.
2021-10-08 16:49:45 +02:00
ff57ce8617 UI: Support showing superimposed icons as disabled (with disabled hint)
If the operator poll of a superimposed icon returned `false`, the
superimposed icon would just draw normally and fail silently. Instead it
will now be drawn grayed out, plus the tooltip of the icon can show the
usual "disabled hint" (a hint explaining why the button is disabled).
2021-10-08 16:31:16 +02:00
38c4888f09 Fix crash in the node editor in cases where nodetree was empty
This seems to happen only in a few files, and not so trivial to
reproduce from scratch.

The crash is real though, and this fixes it.

It also fix a wrong comment style that was introduced in the same faulty
commit.

Bug introduced on ebe2374528.

Differential Revision: https://developer.blender.org/D12794
2021-10-08 16:17:08 +02:00
0c684a7046 Fix T91999: wrong Cycles updates with mesh deformation, after recent changes 2021-10-08 16:11:02 +02:00
736be7cf58 Fix T91997: Cycles glass + SSS not rendering correctly 2021-10-08 16:11:02 +02:00
4d71138738 Docs: note that message-bus subscribers are reset on file load 2021-10-09 00:56:00 +11:00
bff3dcf330 WM: always reset message-bus on file load
Previously this was only happening when "Load UI" was enabled,
making it difficult for Python script authors to know when
re-registering subscribers was needed.
2021-10-09 00:55:47 +11:00
f01c4f27f9 Fix Cycles speed regression after dynamic volume stack change
Only copy required part of volume stack instead of entire stack.

Solves time regression introduced by D12759 and avoids need in
implementing volume stack calculation to exactly match what the
path tracing will do (as well as potentially makes scenes with
a lot of volumes ans a tiny bit of deeply nested ones render
faster).

Still need to look into memory aspect of the regression, but
that is for separate patch.

Ref T92014

Maniphest Tasks: T92014

Differential Revision: https://developer.blender.org/D12790
2021-10-08 15:44:03 +02:00
ff9587d28e User Interface: Use theme alpha for the nodes frames background
This bump subversion.
2021-10-08 15:37:43 +02:00
ebe2374528 User Interface: Make the background inside a node group brighter
The breadcrumbs alone may not be enough to indicate that a user is
inside a nodegroup. The original dark green color was a bit overwhelming
but having a different background helps.

This is a follow up to 919e513fa8.
2021-10-08 15:36:18 +02:00
601a6a7dc6 Theme: Fix Blender Light wire color
When using the Blender Light theme the wires seemed too thick.

This is a left over from 4a0ddeb62b.
2021-10-08 15:36:18 +02:00
596446dbc6 Fix wrong Cycles tile highlight with region render
In previous Blender version the tile highlight was stored in the
full frame (un-cropped)  space. This was changed with the Cycles X
development and now the tiles and render result are always measured
relative to the cropped region.

Differential Revision: https://developer.blender.org/D12779
2021-10-08 15:28:53 +02:00
7afde7cd22 Cleanup: asset catalogs, alphabetically order forward declarations
No functional changes.
2021-10-08 15:28:00 +02:00
092424dae3 install_deps: Fix OIIO depending on (system...) openVDB. 2021-10-08 14:52:06 +02:00
2aca08fc1c UI: Support tooltips for superimposed icons
In a couple of places in the UI, we show superimposed icons on buttons
to execute an operation (called "Extra Icons" internally). Hovering them
would show the tooltip of the underlying button, which is misleading and
confusing.
There are cases where it's not obvious what an icon does, so a tooltip
would be quite useful here. It's likely we are going to use superimposed
icons in more places in the future, e.g. see D11890.

The extra icon basically acts as an override for the button in the
tooltip code.

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

Reviewed by: Campbell Barton
2021-10-08 14:18:10 +02:00
86643a4e73 Py doc: document msgbus subscriptions clearing on blendfile load
Document that `bpy.msgbus.subscribe_rna()`-registered messagebus
subscriptions will be cleared whenever a new blend file is loaded.

Passing `options={'PERSISTENT'}` has no influence on this behaviour.
2021-10-08 14:06:30 +02:00
04ad42d83b UI/Assets: Disable undo for tree item buttons
Disables undo for:
* The tree row collapsing - which doesn't make sense to undo, isn't
  supported by the undo system, and just triggers the confirmation
  prompt when closing the file.
* Renaming items - While this may make sense in some cases, users of the
  tree-view API can explicitly do an undo push. For asset catalogs it's
  not supported.
2021-10-08 12:35:19 +02:00
5da58f48ae Cleanup: asset catalogs, move functions to their siblings
Moved function definitions around so that all members of a class are
next to each other. Previously some functions of one class were sitting
between functions of another class.

No functional changes.
2021-10-08 12:34:58 +02:00
482806c816 VSE: Implement the bounding box (xform) tool in the seq preview window
Make the "xform" tool/gizmo available for strip transformations in the
sequencer preview window.

Because of the amount of hacks needed to make the gizmo work nicely with
multiple strips at the same time, it was decided to only show the
translate gizmo when multiple strips are selected.

This is because the transforms with multiple strips would appear buggy
because of our lack of shearing support in the transform system.
There is also currently no way to properly sync the gizmo drawing with
the transform when using multiple strips.

Reviewed By: Richard Antalik, Campbell Barton

Differential Revision: http://developer.blender.org/D12729
2021-10-08 12:14:45 +02:00
a3e2cc0bb7 Asset Catalogs: Fix unit test on Windows
Force native slashes before comparing paths; on Windows mixing
separators caused a unit test to fail.

No functional changes.
2021-10-08 11:32:22 +02:00
bd65d3ce97 Cleanup: Explicit specifier for single argument constructor 2021-10-08 10:01:20 +02:00
3284b5bbde Cleanup: Else after return in Cycles 2021-10-08 10:01:20 +02:00
6c11733dfb Fix T91190: Remove gaps operator not working
Caused by mistake in f49d438ced - `SEQ_query_all_strips()` is not
meant to be recursive.
2021-10-08 09:30:07 +02:00
741fb0d6c9 Sequencer: hide gizmos & cursor during scrubbing & playback
This was distracting prevented easily viewing an animation.
2021-10-08 18:06:50 +11:00
415098abc3 Fix crash switching scenes with sequencer gizmos displayed 2021-10-08 17:24:45 +11:00
ebe216f532 Sequencer: add option to toggle gizmos
Use shortcut matching the 3D view & popover in the header
2021-10-08 17:07:56 +11:00
de07bf2b13 Cleanup: spelling 2021-10-08 13:23:19 +11:00
8f4697e570 Sequencer: only show the 2D cursor with overlays enabled
Also hide when displaying scopes.
2021-10-08 13:20:19 +11:00
2f9fab716d Cleanup: remove deprecated SEQ_DRAW_SEQUENCE value
While drawing cleared this value (as part of temporary fix from 2009),
this was still being checked until recently.

Remove this value in versioning code.

Also clear unused text space flag.
2021-10-08 13:15:19 +11:00
f9f88f50cb Fix sequencer preview/strip checks
- Drawing annotations used a deprecated value to detect
  if drawing was supported.
- ED_space_sequencer_check_show_strip was checking the preview
  image type (which doesn't impact strip display).

Signed-off-by: Campbell Barton <ideasman42@gmail.com>
2021-10-08 13:15:19 +11:00
29e496e768 Cleanup: remove redundant cursor copy, print 2021-10-08 11:57:42 +11:00
23791db145 Fix Cycles random walk SSS differences between CPU and GPU
The Embree logic did not match the GPU.
2021-10-07 21:35:24 +02:00
4ee97f129a Cleanup: remove unnecessary data from LocalIntersection 2021-10-07 21:35:24 +02:00
9708b1f317 Cleanup: Rename enum values
This makes the diff for adding a new version of the attribute transfer
node slightly smaller.
2021-10-07 14:00:11 -05:00
e9daca77d6 Fix: Missing field markers for curve fillet node inputs 2021-10-07 13:44:06 -05:00
0cd3d46246 Nodes: Move texture nodes to C++
Move texture nodes to C++ and use new socket declaration

Brick, Checker, Image, Magic and Wave

Differential Revision: https://developer.blender.org/D12778
2021-10-07 19:19:20 +01:00
ba4e5399fc Fix screenshot editor showing status text in the editor
This caused problems calling screenshot from menu-search
which included the status text in the screenshot.

Now the status text is shown in the global status bar
for any operators called from a screen context.
2021-10-08 04:01:59 +11:00
d04d27b406 Sequencer: 2D cursor for the preview & transform
- Use 2D cursor in the preview space using shortcuts
  matching the UV editor and 3D view.
- Add Cursor tool, cursor transform.
- Support for cursor and bound-box pivot.
- Add pivot pie menu.
2021-10-08 03:27:55 +11:00
919e513fa8 User Interface: Remove the green background when inside a node group
The current background color and parent nodetrees is too distracting and noisy.
It drastically affect the readability of the nested node-trees.

Other techniques (better bread crumbs) can be used instead to indicate
to users that they are inside a node group.

---

The background drawing was introduced in 4638e5f99a as part of the
Python Nodes branch merge. This made its debut in Blender 2.67
(30/May/2021).

At the time the color used for the background was a light gray. Over the
years the color changed to the current dark green, aggravating the
problem further.

Before that, the (expanded) nodegroup already had the partially
transparent background, mingling with the other nodes. The Python Nodes
branch brought this concept with its changes, and would always draw up
to two levels up in the background (the parent nodetree, and its parent
nodetree).

To read the original inspiration for all the changes introduced then:
https://code.blender.org/2012/01/improving-node-group-interface-editing/

Differential Revision: https://developer.blender.org/D12780
2021-10-07 17:35:40 +02:00
cc6a3509a0 Asset Catalogs: change rules for saving catalog definition files
Change the rules for determining where to save a new catalog definition
file (CDF).

Old situation (T91681): if a `blender_assets.cats.txt` file already
exists in the same directory as the blend file, write to that. If not,
see if the blend file is contained in an asset library, and write to its
top-level CDF.

The new situation swaps the rules: first see if the blend file is
contained in an asset library, and if so write to its top-level CDF. If
not, write a CDF next to the blend file.

As before, any pre-existing CDF is not just bluntly overwritten, but
merged with the in-memory catalogs.
2021-10-07 17:04:47 +02:00
1de922f88c Cleanup: asset catalog tests, move teardown function
Move `AssetCatalogTest::TearDown` close to the corresponding `SetUp`
function, so that it's easier to find.

No functional changes.
2021-10-07 17:04:47 +02:00
1b79b4dd30 Fix sequencer preview poll function
sequencer_view_preview_poll returned true even when in the
"Sequence" view.

Now check the preview is visible, also check the region
is expected type so preview actions aren't possible for mixed
sequence/preview display.
2021-10-08 01:58:32 +11:00
c7b237e7d1 Asset Browser: Move Asset Library selector to navigation bar
The menu to select the active Asset Library is now in the left bar (so called
"Source List", although I'd prefer "Navigation-Bar").

This has some benefits:
* All Asset Library navigation is in the left sidebar now, giving nice grouping
  and a top-to-bottom & left-to-right flow of the layout. The header is focused
  on view set-up now.
* Catalogs are stored inside the asset library. Makes sense to have them right
  under that.
* Less content in the header allows for less wide Asset Browsers without
  extensive scrolling.
* This location gives more space to add options or operators for Asset
  Libraries.

Main downside I see is that the side-bar needs to be opened to change
libraries, which takes quite some space. In practice there shouldn't be need to
do this often though.
2021-10-07 16:29:02 +02:00
9f9e2dd25d Cleanup: clang-tidy 2021-10-08 01:25:23 +11:00
0d4c53ecfe Fix wrong tile size calculated in Cycles
Was causing extra overscan pixels, and was confusing multiple workers
check after fix T91994.
2021-10-07 16:21:28 +02:00
0f58cc1594 Cleanup: make format 2021-10-07 16:11:40 +02:00
719c319055 Fix Cycles long start on scene without volumes
The state template iteration had difficult time dealing with 0-sized
arrays, causing iteration for until integer overflows.
2021-10-07 15:54:56 +02:00
c0a5b13b5e Asset Browser: Rework layout & behavior of catalog tree-view
This reworks how tree rows are constructed in the layout and how they
behave in return.

* To open or collapse a row, the triangle/chevron icon has to be clicked
  now. The previous behavior of allowing to do it on the entire row, but
  only if the item was active already, was just too unusual and felt
  weird.
* Reduce margin between chevron icon and the row label.
* Indent child items without chevron some more, otherwise they feel like
  a row on the same level as their parent, just without chevron.
* Fix renaming button taking entire row width. Respect indentation now.
* Fix double-clicking to rename toggling collapsed state on each click.

Some hacks/special-handling was needed so tree-rows always highlight
while the mouse is hovering them, even if the mouse is actually hovering
another button inside the row.
2021-10-07 15:30:59 +02:00
13a28d9e6f Fix proxy to override code being called on undos. 2021-10-07 15:20:54 +02:00
123255be6b Fix T91994: Cycles crash when rendering on multiple devices
The overscan change from D12599 lacked proper handling of window
when slicing buffer for multiple devices.
2021-10-07 15:07:25 +02:00
7fc11744e6 Revert commit, turns out this isn't a bug? 2021-10-07 04:11:49 -07:00
87a36cba1a UI: Fix alignment of buttons in Grease Pencil tool settings
Small fix reviewed on blender.chat by the Grease Pencil team.
2021-10-07 11:44:29 +02:00
00bd631c7c Fix mask expand not properly supporting
both inverse and keep mask modes being on
at the same time.
2021-10-07 02:27:09 -07:00
eadbacdbb0 Fix T91670: Strip text position is incorrect
Use `sseq->timeline_overlay.flag` instead of `sseq->flag`.
Caused oversight in 7cb65e4581.
2021-10-07 06:35:16 +02:00
70cc80ea1c Cleanup: Move VSE disk cache code into own file
No functional changes.
2021-10-07 03:04:34 +02:00
439c9b0b84 Cleanup: VSE iterator semantics
Use `BLI_gset_ensure_p_ex()` instead of `BLI_gset_insert()` after
checking `BLI_gset_lookup()`.
2021-10-07 00:38:33 +02:00
877ba6b251 Fix T91972: Meta changes length when adding strip
`SequencesMeta.new_movie()` API function caused meta strip to change
length. Similar issue has been fixed in transform code by checking
if `MetaStack` exists. `MetaStack` is not used when changing data in
python.

Provide `seqbase` to `SEQ_time_update_sequence()` so the function can
check if change happens inside of meta strip.

This patch also merges `seq_time_update_sequence_bounds()` into
`SEQ_time_update_sequence()`. This is because same issue applies for
both functions and it is confusing to have more time update
functions.re if this will lead anywhere.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D12763
2021-10-07 00:10:37 +02:00
306e9bff46 Fix VSE pan property text printing
Move text into separate label.
2021-10-07 00:04:26 +02:00
04857cc8ef Cycles: fully decouple triangle and curve primitive storage from BVH2
Previously the storage here was optimized to avoid indirections in BVH2
traversal. This helps improve performance a bit, but makes performance
and memory usage of Embree and OptiX BVHs a bit worse also. It also adds
code complexity in other parts of the code.

Now decouple triangle and curve primitive storage from BVH2.
* Reduced peak memory usage on all devices
* Bit better performance for OptiX and Embree
* Bit worse performance for CUDA
* Simplified code:
** Intersection.prim/object now matches ShaderData.prim/object
** No more offset manipulation for mesh displacement before a BVH is built
** Remove primitive packing code and flags for Embree and OptiX
** Curve segments are now stored in a KernelCurve struct
* Also happens to fix a bug in baking with incorrect prim/object

Fixes T91968, T91770, T91902

Differential Revision: https://developer.blender.org/D12766
2021-10-06 17:52:04 +02:00
0fd0b0643a Build: search for hipcc in HIP_ROOT_DIR/bin 2021-10-06 17:44:25 +02:00
8a6f224e26 Fix logic error when trying to find hovered item
Was just comparing this item's and the parent item's names. But if an item has
no parents, only its own name has to match for the check to return true. Make
sure that the number of parents also matches.
2021-10-06 16:55:51 +02:00
bbfa6a92cf Fix T91987: Linking overrides does not apply overrides rules.
Just a matter of calling `BKE_lib_override_library_main_update` in
`library_link_end`.
2021-10-06 16:53:20 +02:00
b7dc0346aa BMain: Add utils to check if a Main is empty or not.
Mostly intended for debug code (asserts).
2021-10-06 16:53:20 +02:00
0194e54fd3 Fix compilation error with MSVC
MSVC does not support variable size array definition.
Use maximum possible stack, similar to the GPU case.

Not expected to have user-measurable difference.
2021-10-06 16:51:07 +02:00
75fbf6f17e Asset Browser: Show catalog add & delete icons on mouse hover (only)
Now the icons to add or delete catalogs are only shown when mouse hovering a
catalog item in the tree. This is convenient for quick creation of catalogs,
and doesn't require activating a catalog to edit it first.

Determining if a tree item is hovered isn't trivial actually. The UI tree-view
code has to find the matching tree-row button in the previous layout to do so,
since the new layout isn't calculated yet.
2021-10-06 16:36:20 +02:00
536109b4ec Fix possibly wrong matching of tree-view item buttons
The UI code to ensure consistent button state over redraws was just comparing
the name of the item, ignoring the parent names. So with multiple items of the
same name, there might have been glitches (didn't see any myself though).

There's a leftover to-do though, we don't check yet if the matched buttons are
actually from the same tree. Added TODO comment.
2021-10-06 16:36:20 +02:00
2012d541ae Asset Browser: Always show icon to add catalog next to "All" item
Feedback was that it's unclear sometimes how to add a new item and that some
people expect a button to add a new item next to the "All" item.
2021-10-06 16:36:20 +02:00
Jacob Lewallen
12c66854bd Pass correct array size to BKE_object_material_remap_calc
This was patch D12460 from jlewallen and fixes T91339 and T90818.
2021-10-06 10:26:15 -04:00
c6275da852 Fix T91922: Cycles artifacts with high volume nested level
Make volume stack allocated conditionally, potentially based on the
actual nested level of objects in the scene.

Currently the nested level is estimated by number of volume objects.
This is a non-expensive check which is probably enough in practice
to get almost perfect memory usage and performance.

The conditional allocation is a bit tricky.

For the CPU we declare and define maximum possible volume stack,
because there are only that many integrator states on the CPU.

On the GPU we declare outer SoA to have all volume stack elements,
but only allocate actually needed ones. The actually used volume
stack size is passed as a pre-processor, which seems to be easiest
and fastest for the GPU state copy.

There seems to be no speed regression in the demo files on RTX6000.

Note that scenes with high nested level of volume will now be slower
but correct.

Differential Revision: https://developer.blender.org/D12759
2021-10-06 15:46:32 +02:00
e41dddd29a Gizmo: remove wmGizmoGroup.use_fallback_keymap
This ended up being a copy of:
`toolsettings->workspace_tool_type == SCE_WORKSPACE_TOOL_FALLBACK`
requiring boiler plate assignment in gizmos refresh callbacks.

Remove this struct member and check `toolsettings->workspace_tool_type`
directly, since so far there has been no advantage in gizmo-groups
being able to control this themselves.
2021-10-07 00:08:23 +11:00
cda20a7af8 Keymap: ignore the fallback keymap when "Active Tool" is set
Resolve regression in c9d9bfa84a,
which added support for tools to be tagged as using a fallback too.

In these cases the "Active Tool" setting was ignored and the fallback
tool would be used (the spin tool would box select for example).
2021-10-07 00:06:45 +11:00
539575b585 Assets: Support Renaming Catalogs in the UI
Catalogs can now be renamed by double clicking them in the Asset
Browser. This is mostly done through the tree-view API, the asset
specific code is very little.

There is some polish left to be done here, e.g. the double click
currently also collapses/uncollapses and activates the clicked item. And
the rename button takes the full width of the row. But addressing these
is better done as part of some other behavioral changes that are planned
anyway.
2021-10-06 14:25:26 +02:00
335f40ebfa Tests: include device type in benchmark graph labels 2021-10-06 14:21:26 +02:00
03f8c1abd0 Build: add ccache support for CUDA kernels on Linux 2021-10-06 14:21:26 +02:00
18c6314e26 Cleanup: don't detect duplicate intersections in Embree
It's unclear why this code was added in the first place, but it seems
unnecessary, it can be restored if we find this breaks something.

The Embree docs mention that the same primitive may be hit multiple times, but
my understanding is that about e.g. curves where both the frontside and backside
may be hit. However those hits would be at different distances.

The context for this change is that we want to add an optimization where we
can immediately update throughput for transparent shadows instead of recording
intersections, and avoid duplicate would require extra work. However there is
an Embree example that does something similar without worrying about duplicate
hits either.
2021-10-06 14:21:11 +02:00
3c4537cd38 Cleanup: Improve readability & comments in UI tree-view header 2021-10-06 13:08:45 +02:00
ac9ec52e9e UI: Draw tree-views (e.g. asset catalogs) in a box
Makes things look more appealing visually. Plus it's a way to visually
group the tree rows together, which can be important if there are more
widgets surrounding the tree.
2021-10-06 13:08:45 +02:00
4ab8212e1a Fix errors in 68dc970219
Swapped preview/timeline keymap and incorrect center measurement.
2021-10-06 21:42:09 +11:00
9ed19db539 Fix handling of overrides during append.
Liboverride references need a special handling during append, since
those pointers should never be made local, nor reampped to newly
localized data. And liboverride references should never be directly made
local either, to ensure their liboverride usages remain pointing to
linked data and not local one.

Issue was reported by the studio, and also probably as part of T91892.
2021-10-06 11:43:42 +02:00
b5ea3d2c09 Fix possible use-after-free when cancelling temporary rename button
If a renaming button was removed via `UI_but_active_only_ex()` and that
button was placed using the layout system, the button was still in the
layout.
So far this didn't cause issues, because all cases where the button may
be removed were not using the layout system.
2021-10-06 11:24:24 +02:00
Mikhail Matrosov
ca0450feef Fix T91064: Cycles low poly meshes having black edges when shade smoothed
Fixes:{T91064}

Caused by {rBcd118c5581f482afc8554ff88b5b6f3b552b1682}

- Applies `ensure_valid_reflection()` to the normal input on all BSDFs for CPU and GPU.
- This doesn't affect hair.
- Removes `ensure_valid_reflection()` from the output of Bump Map and Normal Map nodes for CPU/GPU as it is not needed.
- The fix doesn't touch OSL.

Reviewed By: brecht, leesonw

Maniphest Tasks: T91064

Differential Revision: https://developer.blender.org/D12403
2021-10-06 10:25:09 +02:00
85267ec1ae Correct error in 68dc970219
Included invalid keyword argument.
2021-10-06 18:12:01 +11:00
68dc970219 Sequencer: improvements to preview selection
- Support toggle/deselect/deselect_all options
  (matching 3D viewport object selection).
- Support legacy selection behavior.
- Support selecting by the center in preview views (holding Ctrl).
2021-10-06 18:01:27 +11:00
82f0e4948c UI: Boolean rename "Self" to "Self Intersection"
Better to be more explicit here, also this matches the recent Boolean Node.
2021-10-06 00:00:07 -04:00
ce66075d00 UI: add sequencer preview context menu
This is mostly a place-holder since many items
have not yet been implemented.
2021-10-06 14:54:05 +11:00
c73a550e90 UI: rename sequencer "Select" to "Tweak"
This matches the tweak tool elsewhere.

Match names since this name is shown prominently
in the fall back tool selector.
2021-10-06 14:54:05 +11:00
876b250499 Keymap: fallback tool support for the sequencer
Note that sample is no longer in the sequencer preview keymap,
it is still accessible as a tool.

This conflicted with click-drag to transform.
2021-10-06 14:54:05 +11:00
ba95cf6234 Keymap: remove selection from the common sequencer map
Needed for further changes as selection behaves differently
in the preview region.
2021-10-06 14:54:05 +11:00
8e2a21e862 Keymap: show sequencer tools in key-map editor
Re-order common sequencer key-map to be at the top level
(shared by preview and sequence view).

Without this sequencer tools would be displayed at different levels
in the hierarchy which is confusing and doesn't represent the separation
between "Sequencer" and "SequencerPreview" key-maps.
2021-10-06 14:54:05 +11:00
9161993e02 Sequencer: use pass-through for preview select
Needed for select-drag action as done in the 3D view and UV editor.
2021-10-06 14:54:05 +11:00
0e590f9078 Fix sequencer sample poll function
Sequencer poll was succeeding outside of a preview region.

This meant it couldn't be used in tool key maps which are currently
shared between preview & sequencer regions.
2021-10-06 14:54:05 +11:00
df8f507f41 Cleanup: spelling in comments 2021-10-06 14:54:05 +11:00
bf35dba7fb Nodes: Composite: Fix wrong socket type for color ramp node 2021-10-05 23:28:24 -04:00
b534806ecb VSE: Reduce memory footprint when using thumbnails
Free strip `anim` data immediately after rendering. This doesn't affect
rendering performance, because each new loop would have to seek to start
of strip. Also strips are now freed anyway, but after rendering loop
ends.

With SF edit file, thumbnail rendering used around 60GB of memory.
Now it uses few hundreds MB (depends on movie file resolution, codec,
etc.)

Freeing of strips caused UI to be unresponsive for brief period. This
issue is not removed, but is more spread out so it is less noticable.
2021-10-06 05:07:51 +02:00
0d68d7baa3 Cleanup: clang-format, correct doxy groups 2021-10-06 13:23:13 +11:00
8113b8391a Cleanup: VSE: Move thumbnail drawing to own file
No functional changes.
2021-10-06 04:21:01 +02:00
76de3ac4ce Cleanup: Remove data duplication from various lookup tables in Cycles
This effectively undoes some of the following commit:
rB4537e8558468c71a03bf53f59c60f888b3412de2

The tables in question were duplicated 5-6 times into the blender
executable due to the headers being used in multiple translation units.
This contributes ~6.3kb worth of duplicate data into the binary.

Some further details are in the below revision.

Differential Revision: https://developer.blender.org/D12724
2021-10-05 19:09:01 -07:00
11d31addf8 Cleanup: missing verb in comment 2021-10-06 02:42:18 +02:00
c148eba16f Fix crash when reading non standard Alembic velocity attribute type
Some software may export velocity as a different type than 3D vectors
(e.g. as colors or flat arrays or floats), so we need to explicitely
check for this.

A more robust attribute handling system allowing us to cope with other
software idiosyncrasies is on the way, so this fix will do for now.
2021-10-06 02:42:18 +02:00
b93e947306 Cleanup: rename BKE_font.h -> BKE_vfont.h
Match API naming prefix (BKE_vfont_*) and DNA_vfont_types.h.
2021-10-06 11:18:16 +11:00
dcac86f4f1 Cleanup: remove unused flag argument 2021-10-06 10:55:54 +11:00
fd592538d9 Cleanup: move BLI_vfontdata.h to BKE_vfontdata.h
This didn't belong on blenlib since it uses DNA data types
and included a bad-level call to BKE_curve.h.

It also meant linking in blenlib would depend on the freetype library,
noticeable for thumbnail extraction (see D6408).
2021-10-06 10:55:34 +11:00
26dac33ce1 Cleanup: simplify ED_imbuf_sample_poll
Access the space data directly from the area.

Also remove redundant NULL check.
2021-10-06 09:29:09 +11:00
6d2b486e43 Cleanup: spelling in comments 2021-10-06 09:28:00 +11:00
7b5835c793 Fix: Add missing function node declaration for RGB and Float Curve nodes 2021-10-05 22:38:41 +01:00
432d5bc692 Cleanup: Remove unused DerivedMesh functions
The long term goal is completely removing DerivedMesh, and these
functions are making some refactoring of mesh normals (T91186) more
complicated. They are not used anywhere.
2021-10-05 13:16:50 -05:00
16e7a7b5b1 Cleanup: Clang tidy 2021-10-05 13:15:31 -05:00
88c02bf826 VSE: Free animation strip data if they are not visible
Previously we would only free animation strip data when doing final
renders. If not doing a final render or simply just playing back videos
in the VSE, we would not free decoders or non VSE cache data from the
strips.

This would lead to memory usage exploding in complex VSE scenes.

Now we instead use the dumb apporach of freeing everything that is not
currently visible.
2021-10-05 18:53:58 +02:00
0a1a173e57 Cleanup: Make anim_getnew in the VSE less confusing
It was using dummy image buffers to indicate if an animation container
could be initialized or not.

Use booleans instead.
2021-10-05 18:53:58 +02:00
6eefcd7d78 GPencil: Remove unused spacetype check in Paint operator
The Paint operator only works in SPACE_VIEW3D and this is checked in the poll mtehod, so it's not logic check again.

These checkings were part of the old grease pencil but it was not removed.
2021-10-05 17:11:21 +02:00
11be9edae2 Fix missing proper 'make local' call for liboverrides from outliner.
Also includes minor improvements to
`BKE_lib_override_library_make_local` itself.

This is a complement to rB37458798fa02c.
2021-10-05 17:07:06 +02:00
c11585a82f Add missing "CUDA_ERROR_UNSUPPORTED_PTX_VERSION" to CUEW
This is required for Cycles to report a meaningful error message when it fails to load a PTX module
created with a newer CUDA toolkit version than the driver supports.

Ref T91879
2021-10-05 16:36:33 +02:00
6e268a749f Fix adaptive sampling artifacts on tile boundaries
Implement an overscan support for tiles, so that adaptive sampling can
rely on the pixels neighbourhood.

Differential Revision: https://developer.blender.org/D12599
2021-10-05 16:19:14 +02:00
758f3f7456 Fix T91940: Asset Browser catalogs continuously redraw
Issue was that the `on_activate()` callback of tree-items were
continuously called, because the active-state was queried before we
fully reconstructed the tree and its state from the previous redraw.
Such issues could happen in more places, so I've refactored the API a
bit to reflect the requirements for state queries, and include some
sanity checks.
The actual fix for the issue is to delay the state change until the tree
is fully reconstructed, by letting the tree-items pass a callback to
check if they should be active.
2021-10-05 16:10:27 +02:00
dbe3981b0a Cleanup: Better way to pass activate callbacks to Tree-View items
The `ui::BasicTreeViewItem` took a function-like object to execute on
item activation via the constructor. This was mainly intended to be used
with lambdas. However, it's confusing to just have this lambda there,
with no indication of what it's for (activation).
Instead, assign the function-like object via an explicit `on_activate()`
function.
2021-10-05 16:10:27 +02:00
9a0850c8c2 Cycles: Fix wrong GPU state calculation
Currently was only used for logging, but better to fix the size so
that it matches reality.

The issue was caused by decoupling number of shadow intersections
and using much higher number for CPU. This caused the total state
on GPU to be logged as 10s of gigabytes instead of 100s of megabytes.

Differential Revision: https://developer.blender.org/D12755
2021-10-05 16:09:31 +02:00
b1e6e63c22 Cleanup: Geometry Nodes dashed lines
No functional change, just cleaning up the shader code a bit.

Part of this is removing dead code (the discard was never called), and
part is shuffling mix/max around based on feedback by Sybren Stüvel.
2021-10-05 15:38:09 +02:00
55b8fc718a Cycles: improve detection of HIP compiler for buildbot
And fix various broken things in the HIP kernel compilation.
2021-10-05 13:47:50 +02:00
71cf9f4b3f Fix T91955: Cycles crash with denoising on non-available device
For example, crash when attempting to use OptiX denoiser on systems
without OptiX-capable device.

Perform check that scene update happened without errors.

Note that `et_error` makes progress to cancel, so the code was
simplified a bit.
2021-10-05 10:52:35 +02:00
b6ad0735a6 Fix T86379: When using "Append" not handling properly RigidBody constraints
This was simply never handled apparently.

Also fixes a regression from recent append refactor that prevented RB
objects to to properly handled too (since we instantiate loose objects
in append step now, we need to handle RigidBody ones after that
instantiation stage, otherwise nothing will happen since loose objects
won't be in any scene).
2021-10-05 10:48:10 +02:00
7df6f66ea2 Silenced compilation warning when compiling using ASAN. 2021-10-05 10:36:45 +02:00
9824df49c0 Fix memory leak when running test cases.
Issue is that test cases re-uses draw manager. The new
`DRWRegisteredDrawEngine` struct is only freed when a
valid opengl context was found. what isn't the case
when running test cases.

Also made sure that re-using draw manager would use re-inited
values.
2021-10-05 10:36:45 +02:00
7a66a9f22e Cleanup: remove unused parameter 2021-10-05 16:54:25 +09:00
1d49293b80 DRW: Move buffer & temp textures & framebuffer management to DrawManager
This is a necessary step for EEVEE's new arch. This moves more data
to the draw manager. This makes it easier to have the render or draw
engines manage their own data.

This makes more sense and cleans-up what the GPUViewport holds

Also rewrites the Texture pool manager to be in C++.

This also move the DefaultFramebuffer/TextureList and the engine related
data to a new `DRWViewData` struct. This struct manages the per view
(as in stereo view) engine data.

There is a bit of cleanup in the way the draw manager is setup.
We now use a temporary DRWData instead of creating a dummy viewport.

Development: fclem, jbakker

Differential Revision: https://developer.blender.org/D11966
2021-10-05 09:39:54 +02:00
08511b1c3d XR: Add runtime window area for XR events
This adds an offscreen View3D window area for the VR view in order to
execute XR events/operators in the proper context. The area is created
as runtime data before XR events are dispatched and set as the active
area during XR event handling.

Since the area is runtime-only, it will not be saved in files and since
the area is offscreen, it will not interfere with regular window areas.
The area is removed with the rest of the XR runtime data on exit, file
read, or when stopping the VR session.

Note: This also adds internal types (EVT_DATA_XR, EVT_XR_ACTION) and
structs (wmXrActionData) for XR events.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12472
2021-10-05 16:05:12 +09:00
300403a38b Fix syntax error in caac532565 2021-10-05 17:41:23 +11:00
caac532565 Cleanup: add Params.select_tweak_event
Convenience, use for tool key-maps to avoid overly verbose expressions.
2021-10-05 16:35:05 +11:00
Erik Abrahamsson
1b22650fbf Geometry Nodes: Rename "String Join" node to "Join Strings"
Rename the "String Join" node to "Join Strings" to
go with the verb first naming convention.

Differential Revision: https://developer.blender.org/D12678
2021-10-04 23:54:21 -05:00
2b66b372bc Cleanup: use doxygen sections 2021-10-05 11:10:25 +11:00
2dace5f3ef Cleanup: use 3D dot product (not 4D) when comparing pose-bone axes
Also use more meaningful variable name.
2021-10-05 11:09:31 +11:00
92c449776d Cleanup: quiet shadow warning, trailign space 2021-10-05 10:59:48 +11:00
18959c502d Fix field type in curve resample node 2021-10-04 15:40:09 -05:00
c38d2513c5 Fix T91725: Waveforms are not displayed
Use `sseq->timeline_overlay.flag` for `SEQ_TIMELINE_ALL_WAVEFORMS`
instead of `sseq->flag`.
2021-10-04 22:17:05 +02:00
d1ade756a9 Fix T91920: Missing decorate buttons in sound panel
Add back decorate buttons, move mono and display waveforms to bottom as
they were before.
2021-10-04 22:10:17 +02:00
655ce5dc3e Cleanup: Use LISTBASE_FOREACH macro 2021-10-04 21:57:39 +02:00
c8d59b60b5 Make keyframe inserts/removals less verbose when called from python.
Following operators now only report messages back when they are called via their invoke-methods:

- ANIM_OT_keyframe_insert
- ANIM_OT_keyframe_insert_by_name
- ANIM_OT_keyframe_insert_menu
- ANIM_OT_keyframe_delete
- ANIM_OT_keyframe_clear_v3d
- ANIM_OT_keyframe_delete_v3d

Also removed the attribute confirm_success from the following operators:

- ANIM_OT_keyframe_insert
- ANIM_OT_keyframe_insert_by_name
- ANIM_OT_keyframe_insert_menu
- ANIM_OT_keyframe_delete
- ANIM_OT_keyframe_delete_by_name

Note: addons/scripts possibly need to be updated if they use the above operators AND set the "confirm_success" attribute

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12697
2021-10-04 21:23:44 +02:00
3391a2ef1d Assets: Show all assets indirectly nested inside the active catalog
The asset catalog design was always that the active catalog would also
display all assets of its child catalogs (or grand-childs, etc.). This
is one of the main characteristics that differentiates catalogs from
usual directories.

Sybren prepared this on the asset catalog backend side with
56ce51d1f7. This integrates it into the Asset Browser backend and the
UI.
2021-10-04 20:24:25 +02:00
ffa20de050 Cleanup: Remove unused variable and include 2021-10-04 13:03:13 -05:00
65b5023df4 Fix: Geometry Nodes Handle Type Selection Fix
Fix the selection logic on the Handle Type Selection node to work
as intended:

(Left is Selected AND Left is ChosenType)
OR
(Right is Selected AND Right is ChosenType)
2021-10-04 12:47:35 -05:00
076d797bda Geometry Nodes: Curve Trim Node Update
This update allows the Trim Curve node to use float field inputs
for the start and end inputs. These fields are evaluated on the
spline domain.

Differential Revision: https://developer.blender.org/D12744
2021-10-04 12:01:29 -05:00
301ee97b93 Fix: Unable to select left and right in set handle type node
The "enum" RNA flag was missing.
2021-10-04 11:10:08 -05:00
f2c896a9ad GPencil: Simplify code removing extra function
The function was not doing anything and only was calling another function.
2021-10-04 17:08:16 +02:00
2b6f2072f1 UI Tree-View API: Enforce active item to be un-collapsed
Makes sure that the active item of a tree never has collapsed parent
items, which can be confusing if it happens. E.g. for the asset catalogs
UI, the active catalog decides which assets are visible. Having it
hidden while being the main factor deciding which assets are visible is
quite confusing.

I think it makes sense to have this at the UI Tree-View level, rather
than doing it manually in the asset catalog code for example. Seems like
something you'd commonly want. We can make it optional in the API if
needed.

Renamed the `set_active()` function to make clear that it is more than a
mere setter.
2021-10-04 17:03:12 +02:00
4fd7ce321d GPencil: Remove unused flag
This flag was used in older versions, but now is not used anymore.
2021-10-04 16:43:07 +02:00
0bc4056455 Nodes: Revert some socket declarations to previos API
See T91826, there is a bug in the code where both `.` and `_` are used as a seperator for `BLI_uniquename_cb`.

This resulted in some nodes becoming disconnected on file load.
Until this is resolved, the chnages are reverted to prevent data loss.
2021-10-04 10:35:11 -04:00
4a3464050c Assets: Support dragging assets on "Unassigned" catalog
Dragging assets onto the "Unassigned" catalog tree item will effectively
move the assets out of any catalog. Technically this means unsetting the
Catalog-ID stored in the asset metadata, or more precisely setting the
UUID to be all zeros.
2021-10-04 16:17:09 +02:00
b536605e78 Cleanup: Use static function for asset catalog tree-view helper 2021-10-04 15:29:39 +02:00
4882208633 Cleanup: Separate interface & implementation for asset catalog tree-view
Should make the code a bit more organized and help getting an overview
of the interfaces more quickly.
2021-10-04 15:29:39 +02:00
cc636db8f2 Fix T91823: Regression not showing idblocks when recursion is set to Blend file
Introduced by fc7beac8d6. During code review it wasn't clear why this
branch was needed, so we removed it. Now it is clear why it is needed
so we added it back and added a comment why the branch is needed.

Patch provided by @Severin.
2021-10-04 15:25:40 +02:00
f806bd8261 Fix T91861: Black environment behind shadow catcher
Always sample background pass behind shadow catcher (if the pass
exists, of course), regardless of whether shadow catcher will be
used as approximate or accurate.

Allows to combine accurate shadows into an environment map.

Differential Revision: https://developer.blender.org/D12747
2021-10-04 15:07:32 +02:00
fc4886a314 Fix T91894: Cycles baking normal maps of transformed objects not working 2021-10-04 13:58:37 +02:00
326bd76d3b Fix T89759: baking normals does not take into account mirror modifier 2021-10-04 13:58:37 +02:00
a80a2f07b7 Fix T90815: wrong Cycles OSL normal map render after recent optimization 2021-10-04 13:58:37 +02:00
76238af213 Fix Cycles render time pass being available in UI, but it was removed
This previously only work for CPU rendering, and isn't that practical to get
working in the new architecture.
2021-10-04 13:58:37 +02:00
8ca7250982 Fix T91911: error in image dithering code after recent changes
Thanks to Patrik Olsson for spotting this.
2021-10-04 13:58:37 +02:00
dc4c2815a6 Cleanup: Reverting submodules hash
This partially reverts commit e62ce9e08e.
2021-10-04 12:42:07 +02:00
Simon Lenz
e62ce9e08e Fix camera border bug in passepartout render view
{F10761402}

With active viewport render from camera view, the camera border shows up, even when passepartout and overlays are disabled.

By moving the line-drawing code to the passepartout section, it is effectively disabled when passepartout is off.

Reviewed By: sebastian_k

Differential Revision: https://developer.blender.org/D12745
2021-10-04 12:21:40 +02:00
23d9953c80 I18n tools: Fix issue when extracting messages on release builds.
This was also affecting prototype of buildbot-driven UI messages
extraction...
2021-10-04 12:17:50 +02:00
ce6a24976a Cleanup: Redundant space at the end of comment 2021-10-04 12:02:14 +02:00
f2b86471ea Fix session uuid ghash comparison return value
Because of legacy reasons (C string compare function returning 0 when
strings are equal), the ghash compare function is expected to return
false when hashes are equal.
2021-10-04 11:55:09 +02:00
37003cbbc1 Fix T91867: Error reading tiles with Persistent Data ON 2021-10-04 11:54:11 +02:00
87a3cb3bff Cleanup: Neighbour -> Neighbor. and other minor UI messages fixes.
Blender English should use 'American' variants, not 'British' variants.
2021-10-04 11:14:57 +02:00
8c55333a8e Cleanup: tag unused parameters as such. 2021-10-04 09:43:40 +02:00
fc6228bd85 Fix T91873: Crash when opening properties panel
This patch fixes a crash that was recently introduced by rB5cebcb415e76.
The reason were missing poll functions in the UI and operator.

Reviewed By: ISS

Maniphest Tasks: T91873

Differential Revision: https://developer.blender.org/D12736
2021-10-04 08:15:03 +02:00
93e92ac126 Cleanup: remove unused assignments 2021-10-04 13:15:15 +11:00
357acd1d50 Cleanup: pass arguments as const 2021-10-04 13:15:15 +11:00
e43fcc014a Cleanup: remove redundant assignment 2021-10-04 13:15:15 +11:00
3c3669894f Cleanup: use system includes 2021-10-04 13:14:58 +11:00
6e48a51af7 check_cppcheck: use quiet output
Without this, each cppcheck invocation included all defines/includes
flooding the console with unhelpful information.

Also remove nonexistent directory to exclude.
2021-10-04 13:12:37 +11:00
606271966e check_cppcheck: use '--cppcheck-build-dir'
Use a temporary directory for faster performance.
2021-10-04 13:12:36 +11:00
e0e7a5522f project_source_info: queue_processes() now waits for jobs to finish
queue_processes() - used for some of the "make check_*" utilities,
wasn't waiting for all jobs to finish before returning.

This conflicted with running cleanup operations.
2021-10-04 13:12:35 +11:00
e7274dedc4 Fix possible NULL pointer deference
The pointer was referenced before being checked.
2021-10-04 13:12:34 +11:00
cc8fa3ee90 Fix T91904: Assert when loading empty CurveProfile
Somehow, the file from T71329 has an empty curve profile. While that may
be a problem in itself, it's reasonable to avoid asserts or crashes when
loading or drawing such a CurveProfile. This commit just makes sure the
table always has a single vertex, and adds some checks in drawing code.
2021-10-03 20:28:31 -05:00
dfdc9c6219 Cleanup: Make more functions static
This simplifies the surface of the API for a CurveProfile.
2021-10-03 19:52:59 -05:00
b6195f6664 Cleanup: Replace macro with function 2021-10-03 18:54:52 -05:00
272a38e0c2 Cleanup: Make function static 2021-10-03 18:31:56 -05:00
c9af025936 Cleanup: Add doxygen sections, rearrange functions 2021-10-03 18:23:58 -05:00
1e5cfebf66 Fix key-map with fall-back tool on RMB select
Regression in bffda4185d.
2021-10-04 09:28:33 +11:00
57272d598d Cleanup: rename eRegionType -> eRegion_Type
Match eSpace_Type.
2021-10-04 09:28:33 +11:00
ee79bde54d Keymap: print more verbose output for --debug-handlers
Include the short-cut text and the operator properties to make it easier
to track down the key-map item source that matched the event.
2021-10-04 09:28:33 +11:00
c4dca65228 Asset Browser: Support dragging assets into catalogs
With this it is possible to select any number of assets in the Asset
Browser and drag them into catalogs. The assets will be moved to that
catalog then. However, this will only work in the "Current File" asset
library, since that is the only library that allows changing assets,
which is what's done here.

While dragging assets over the tree row, a tooltip is shown explaining
what's going to happen.

In preparation to this, the new UI tree-view API was already extended
with custom drop support, see 4ee2d9df42.

----

Changes here to the `wmDrag` code were needed to support dragging multiple
assets. Some of it is considered temporary because a) a proper #AssetHandle
design should replace some ugly parts of this patch and b) the multi-item
support in `wmDrag` isn't that great yet. The entire API will have to be
written anyway (see D4071).

Maniphest Tasks: T91573

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

Reviewed by: Sybren Stüvel
2021-10-03 23:58:20 +02:00
3b1a243039 Cleanup: Rename file-list function to better match what it's doing 2021-10-03 23:18:04 +02:00
2305f270c5 Geometry Nodes: Handle Type Selection Node Update
This node creates a boolean field selection of bezier spline points
that have a handle of the given type on the selected 'side' of the
contol point. This is evaluated on the point domain.

Differential Revision: https://developer.blender.org/D12559
2021-10-03 15:01:30 -05:00
adc084a3e9 Cleanup: Move curveprofile.c to C++ 2021-10-03 14:40:08 -05:00
ae86584404 Geometry Nodes: Points to Volume Fields fixes
A few items when OpenVDB is not enabled.
  - Cleanup a compiler warning
  - Add a node warning message
  - Return an empty geometry set
2021-10-03 13:43:51 -05:00
98fe05fb5b Fix T91810 Bevel not working well with certain unbeveled edge positions.
A previous commit, c56526d8b6, which sometimes didn't drop offsets
into 'in plane' faces, as a fix to T71329, was overly aggressive.
If all the intermediate edges are in the same plane then it is fine
to just put the meeting point on the plane of the start and end edges.
2021-10-03 11:30:40 -04:00
1833ebea31 Cleanup: move as_span method out of header
This method does not have to be in a header and results in a relatively
large number of symbols to be generated (42).
2021-10-03 17:07:26 +02:00
bf354cde96 Cleanup: move special methods of geometry set out of header
This reduces the compile time, because fewer symbols have to be generated
in translation units using geometry sets.
2021-10-03 16:58:33 +02:00
64d07ffcc3 Cleanup: move methods out of field classes
This makes it easier to scan through the classes and simplifies
testing the compile time impact of having these methods in the header.
2021-10-03 16:47:54 +02:00
17e2d54a3d Cleanup: use extern templates for typed output attribute
This is very similar to rBa812fe8ceb75fd2b.
This time the number of symbols decreases further from 1335 to 928.
Compile time of the distribute node decreases from ~2.4s to ~2.3s.
2021-10-03 16:30:14 +02:00
a812fe8ceb Nodes: use extern templates for socket declarations
The new socket declaration api generates a surprising amount
of symbols in each translation unit where it is used. This resulted
in a measurable compile time increase.

This commit reduces the number of symbols that are generated in
each translation unit significantly. For example, in
`node_geo_distribute_points_on_faces.cc` the number of symbols
decreased from 1930 to 1335. In my tests, this results in a 5-20%
compile time speedup when this and similar files are compiled
in isolation (measured by executing the command in `compile_commands.json`).

Compiling the distribute points on faces node sped up from ~2.65s to ~2.4s.
2021-10-03 16:05:19 +02:00
2f52f5683c Cleanup: move more method definitions out of their class
This makes it easier to test the impact of moving them out
of the header later.
2021-10-03 15:24:21 +02:00
06c3bac23b Cleanup: move more methods out of classes 2021-10-03 15:14:03 +02:00
fb34cdc7da Geometry Nodes: Points to Volume Fields Update
This update of the Points to Volume node allows a field to populate the
radius input of the node and removes the implicit realization of
instances.

Differential Revision: https://developer.blender.org/D12531
2021-10-03 08:03:46 -05:00
0998856c92 Cleanup: use movable output attribute instead of optional
This simplifies the code a bit and improves compile times a bit.
2021-10-03 15:01:02 +02:00
8fc97a871f Cleanup: make typed output attribute movable
This comes at a small performance cost due to an additional
memory allocation, but that is not significant currently.
2021-10-03 14:49:15 +02:00
5d5a753d96 Cleanup: move AttributeIDRef and OutputAttribute methods out of class
This makes the classes easier to read and simplifies testing
the compile time impact of defining these methods in the header.
2021-10-03 14:39:17 +02:00
e1e75bd62c Cleanup: move resource scope method definitions out of class 2021-10-03 14:23:26 +02:00
a8d6a86981 Cleanup: move StringRef method definitions out of class
This makes the classes more appealing to look at and makes
it easier to see what different methods are available.
2021-10-03 14:10:26 +02:00
c206fa9627 Cleanup: add nolint comment to move semantic test 2021-10-03 14:03:53 +02:00
f2da98d816 Cleanup: remove unused functions 2021-10-03 13:44:44 +02:00
d3afe0c126 Geometry Nodes: Resample Curve Fields Update
This update of the Resample Curve node allows a field to populate the
count or length input of the node depending on the current mode. The
field is evaluated on the spline domain.

Differential Revision: https://developer.blender.org/D12735
2021-10-02 21:45:51 -05:00
e863e05697 Data Transfer: Remove unnecessary noisy error message
I've seen requests to remove this or complaints about this error message
quite frequently. In lots of production files it's just always going off.
It's not an actionable warning, and since "slow" is relative, it isn't
always even correct.

Differential Revision: https://developer.blender.org/D12694
2021-10-02 20:33:15 -05:00
b57b4dfab1 Cleanup: clang-format 2021-10-03 12:13:29 +11:00
f49dff97d4 Cleanup: spelling in strings 2021-10-03 12:13:29 +11:00
74f45ed9c5 Cleanup: spelling in comments 2021-10-03 12:13:29 +11:00
Jarrett Johnson
c5c94e3eae Geometry Nodes: Add Rotate Euler Node
This commit introduces the Rotate Euler function node which modifies
an input euler rotation. The node replaces the "Point Rotate" node.

Addresses T91375.

Differential Revision: https://developer.blender.org/D12531
2021-10-02 20:04:45 -05:00
34cf33eb12 Geometry Nodes: Switch Node Fields Update
This update of the Switch node allows for field compatible types
to be switched through the node. This includes the following:

Float, Int, Bool, String, Vector, and Color

The remaining types are processed with the orginal code:

Geometry, Object, Collection, Texture, and Material

Because the old types require a diffent "switch" socket than the
field types, versioning for old files is included to move links
of those types to a new switch socket. Once fields of other types
are supported, this node can be updated to support them as well.

Differential Revision: https://developer.blender.org/D12642
2021-10-02 17:34:47 -05:00
Leon Leno
54927caf4f Geometry Nodes: Add side and fill segments to Cone/Cylinder nodes
This commit extends the 'Cone' and 'Cylinder' mesh primitive nodes,
with two inputs to control the segments along the side and in the fill.
This makes the nodes more flexible and brings them more in line with
the improved cube node.

Differential Revision: https://developer.blender.org/D12463
2021-10-02 17:29:25 -05:00
12e8c78353 Fix T91888: Pivot point settings shown in timeline
Added to timeline by accident in f9e0981976.
2021-10-01 23:26:59 +02:00
1476d35870 Geometry Nodes: Set Handle Type Node Field Update
This update of the Set Handle Type node allows for a bool field to be
used as the selection of the affected control point handles for
bezier splines. If no bezier splines are provided a info message is
shown.

Differential Revision: https://developer.blender.org/D12526
2021-10-01 14:22:24 -05:00
1fb364491b Geometry Nodes: Set Spline Type Node Field Update
This update of the Set Spline Type node allows for a bool field to be
used as the selection of the affected splines.

Differential Revision: https://developer.blender.org/D12522
2021-10-01 11:59:29 -05:00
eacdc0ab4a VSE: Draw active strips with a different color in the preview window 2021-10-01 18:03:18 +02:00
dc30a9087c Geometry Nodes: Spline Length Input Node
The Spline Length Input node provides a field containing the
length of the current evaluated spline to the Point and Spline
domains.

Differential Revision: https://developer.blender.org/D12706
2021-10-01 09:58:49 -05:00
9e456ca695 Asset Browser: expose current catalog ID in RNA
Add read-only access to the active catalog ID via
`context.space_data.params.catalog_id` in the Asset Browser context.

The UUID is exposed as string to Python.
2021-10-01 16:47:16 +02:00
aae96176e8 Geometry Nodes: Curve Subdivide Node with Fields
The curve subdivide node can now take an int field to specify the
number of subdivisions to make at each curve segment.

Reviewed by: Hans Goudey
Differential Revision: https://developer.blender.org/D12534
2021-10-01 09:43:04 -05:00
e1952c541a Cleanup: unused function declaration
This should have been removed during the recent velocity attribute
refactor.
2021-10-01 16:41:50 +02:00
Johan Walles
fb820496f5 Tracking: Sort motion tracking tracks by start and end frames
Enable sorting motion tracking tracks by start / end times.

Help identifying what cases reconstructed camera jumps, based
on information about whether any track starts/ends at the frame.

Based on revision eb0eb54d96.

{F10563305}

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D12621
2021-10-01 16:29:38 +02:00
f497e471f8 Asset Catalogs: always have an Asset Catalog Tree available
Always create an `AssetCatalogTree` in the `AssetCatalogService`. This
ensures that newly-created catalogs are immediately visible in the UI
(because they insert themselves into an already-existing tree).
2021-10-01 16:15:50 +02:00
3be4cb5b27 Cleanup: Asset Catalog Test, fix clang-tidy warnings
No functional changes.
2021-10-01 15:24:04 +02:00
56ce51d1f7 Asset Catalogs: add catalog filter for the asset browser
Given an "active catalog" (i.e. the one selected in the UI), construct
an `AssetCatalogFilter` instance. This filter can determine whether an
asset should be shown or not. It returns `true` when The asset's catalog
ID is:

- the active catalog,
- an alias of the active catalog (so different UUID that maps to the
  same path),
- a sub-catalog of the active catalog.

Not yet hooked up to the UI.
2021-10-01 15:22:05 +02:00
1c7ce7e0b4 Cleanup: asset catalogs, make function const
Declare `AssetCatalogService::find_catalog()` as `const`, as it's not
requiring modification off the service object.

No functional changes.
2021-10-01 15:22:05 +02:00
271210126e Fix T91834: Appending objects with shape keys into new file is broken.
Recent append refactor 'broke' this, we need special recursive care and
handling of those nasty shpae keys... again.
2021-10-01 14:49:04 +02:00
f9acf21063 Python API Docs: add an example of Bone.convert_local_to_pose usage.
The use case for this method is quite obscure and difficult to
understand without an example. Despite how big looks, this is
actually the simplest example that makes sense.
2021-10-01 15:47:30 +03:00
bdc66c9569 GPU: set 'GL_PACK_ALIGNMENT' 1 as default
This fixes T91828.

The current value of `GL_PACK_ALIGNMENT` may result in crash in the `gpu` module if the buffer is not aligned.

Differential Revision: https://developer.blender.org/D12720
2021-10-01 09:11:37 -03:00
eb3a8fb4e8 Fix T91872: incorrect socket inspection on group nodes
This bug was introduced in rBef45399f3be0955ba8.
2021-10-01 13:21:03 +02:00
798e593002 Fix T87189: Copy/pasting IDs does not handle properly instantiation.
Copy/Paste uses its own code path for ID linking, which was not setting
`LIB_TAG_DOIT` for proper instantiation later on.

Would be nice the make this logic closer to the rest of the link/append
code at some point, but for now this fix will do.
2021-10-01 12:21:08 +02:00
21c29480c3 Fix paste code linking 'direct' IDs with 'INDIRECT' flag.
No idea why this was done that way (it originate from initial paste
commit, rB12b642062c6f).

But the IDs 'selected' as direct paste in `BLO_library_link_copypaste`
should be 'directly' linked, it's similar case to actual append of
selected IDs by the user.

Related to T87189.
2021-10-01 12:21:08 +02:00
928d644895 Append: Fix appended objects potentially auto-instantiated in more than one collection.
Related to T87189.
2021-10-01 12:21:08 +02:00
af0b7925db Fix T87536: incorrect socket types in reroute nodes
This refactors and fixes the code that propagates socket types
through reroute nodes. In my tests it is faster than the previous
code. The difference becomes larger the more reroute nodes
there are, because the old code had O(n^2) runtime, while the
new code runs in linear time.

Differential Revision: https://developer.blender.org/D12716
2021-10-01 11:42:00 +02:00
7843cd63d8 Fix T91839: incorrect active vertex group index
Differential Revision: https://developer.blender.org/D12712
2021-10-01 11:36:10 +02:00
ae4b45145c Cleanup: Asset Catalog Paths, move default constructor to header file
No functional changes.
2021-10-01 10:58:33 +02:00
2e6c6426d3 Asset Catalogs: test that missing catalogs are created once
Add asset catalogs test, to ensure missing catalogs are only created once,
and not for every originally defined catalog.

No functional changes to Blender (the code was already doing the right
thing).
2021-10-01 10:58:16 +02:00
bdb7d262aa Cleanup: clang-tidy warnings 2021-10-01 16:20:31 +10:00
b559fb178e Gizmo: hide 2D gizmos while transforming
Hide gizmos in the sequencer & UV editor while transforming.
2021-10-01 16:19:12 +10:00
4485dc483c Cleanup: use C-style comments, nullptr for C++
Minor changes extracted from D6408
2021-10-01 10:45:09 +10:00
Vitor Boschi
3a59ddb292 Fix: Incorrect warning in curve to mesh node with instances
The node was setting a warning when used with instances on input,
even though it worked fine.

Differential Revision: https://developer.blender.org/D12718
2021-09-30 18:27:58 -05:00
66fe1c79f3 Compositor: Fix Composite node using alpha when "Use Alpha" is off
Alpha input was not receiving the final composite canvas 
as preferred causing a Translate operation being inserted 
for centering. This resulted in a transparent background.
The issue only affects Full Frame mode.
2021-09-30 23:56:53 +02:00
e2df5c8a56 Compositor: Fix Flip node not flipping translation on Full Frame
To match tiled implementation, flip center should not be translated
when canvas has offset. Instead the canvas offset needs to be flipped.
2021-09-30 23:56:53 +02:00
f3274bfa70 Compositor: Fix Dilate/Erode node crash with Step option
It was writing the buffer out of bounds.
Only "Full Frame" mode was affected.
2021-09-30 23:56:53 +02:00
4569d9c0c3 Compositor: Fix Movie Distortion node rendering an empty image
Input area of interest calculation was incorrect because `m_margin`
was uninitialized.
Only "Full Frame" mode was affected.
2021-09-30 23:10:27 +02:00
Pratik Borhade
33dc584b37 Fix T91285: Bad tooltip for VSE Slip operator
This patch is created to change the tooltip for Slip Strip Contents
As per the present info, only active strip will be affected.
But in reality selected strips can be trimmed with this operator.

Word Trim changed to Slip in tooltip

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12450
2021-09-30 21:11:09 +02:00
Josef Raschen
213554f24a VSE: Add ASC CDL color correction method
Add Offset/Slope/Power controls to the color balance modifier. This is
already available in compositor.

Reviewed By: sergey, ISS

Differential Revision: https://developer.blender.org/D12575
2021-09-30 21:09:47 +02:00
8d60ac2bb0 Cleanup: Fix unused variable warning 2021-09-30 14:01:56 -05:00
Brecht Van Lommel
1a134c4c30 Cycles: refactor API for render output
* Add OutputDriver, replacing function callbacks in Session.
* Add PathTraceTile, replacing tile access methods in Session.
* Add more detailed comments about how this driver should be implemented.
* Add OIIOOutputDriver for Cycles standalone to output an image.

Differential Revision: https://developer.blender.org/D12627
2021-09-30 20:53:27 +02:00
a754e35198 Cycles: refactor API for GPU display
* Split GPUDisplay into two classes. PathTraceDisplay to implement the Cycles side,
  and DisplayDriver to implement the host application side. The DisplayDriver is now
  a fully abstract base class, embedded in the PathTraceDisplay.
* Move copy_pixels_to_texture implementation out of the host side into the Cycles side,
  since it can be implemented in terms of the texture buffer mapping.
* Move definition of DeviceGraphicsInteropDestination into display driver header, so
  that we do not need to expose private device headers in the public API.
* Add more detailed comments about how the DisplayDriver should be implemented.

The "driver" terminology might not be obvious, but is also used in other renderers.

Differential Revision: https://developer.blender.org/D12626
2021-09-30 20:48:08 +02:00
ac582056e2 Geometry Nodes: Swap order of geometry proximity inputs
"Target" is the most important, so it goes at the top.
2021-09-30 13:41:55 -05:00
Charlie Jolly
be70827e6f Nodes: Add Float Curve for GN and Shader nodes.
Replacement for float curve in legacy Attribute Curve Map node.

Float Curve defaults to [0.0-1.0] range.

Reviewed By: JacquesLucke, brecht

Differential Revision: https://developer.blender.org/D12683
2021-09-30 19:24:40 +01:00
827e30bd15 Geometry Nodes: Change default for mesh to points node
While "Vertices" may be less useful since mesh vertices are already
points, the output is more easily understandable, so it's a better
default.
2021-09-30 11:53:48 -05:00
6cff1d6480 Fix T91734: Crash snapping mesh if a beveled curve is present
`BKE_mesh_boundbox_get` cannot be called for objects of type Curve.

The BoundBox however does not match the object seen in the scene.
This will be dealt with in another commit.
2021-09-30 02:48:02 -03:00
dd3391dd99 Asset Catalogs: create missing parent catalogs
For every known catalog, ensure its parent catalog also exists. This
ensures that assets can be assigned to parent catalogs, even when they
didn't exist in the Catalog Definition File yet.
2021-09-30 17:34:58 +02:00
4389067929 Fix possible use-after-free in drag-drop handling logic
Would happen when there were multiple drag items in parallel. There was
a listbase constructed with twice the same item, even though that item
would be deleted after it was handled the first time.
2021-09-30 16:39:09 +02:00
4ee2d9df42 UI: Support easy dropping into/onto rows in new tree-view API
Adds an easy way to add drop support for tree-view rows.

Most of the work is handled by the tree-view UI code. The tree items can
simply override a few functions (`can_drop()`, `on_drop()`,
`drop_tooltip()`) to implement their custom drop behavior.

While dragging over a tree-view item that can be dropped into/onto, the
item can show a custom and dynamic tooltip explaining what's gonna
happen on drop.

This isn't used yet, but will soon be for asset catalogs.

See documentation here:
https://wiki.blender.org/wiki/Source/Interface/Views#Further_Customizations
2021-09-30 16:39:09 +02:00
42ce88f15c Cleanup: remove CatalogPath alias
The `CatalogPath` name was an alias for `std::string`, so that it could
be easily switched over to something else. This happened in the previous
commit (switched to `AssetCatalogPath`), so the alias is no longer
necessary.

This commit removes the `CatalogPath` alias.

No functional changes.
2021-09-30 16:34:30 +02:00
628fab696c Asset Catalog: introduce AssetCatalogPath class
So far we have used `std::string` for asset catalog paths. Some
operations are better described on a dedicated class for this, though.
This commits switches catalog paths from using `std::string` to a
dedicated `blender::bke::AssetCatalogPath` class.

The `using CatalogPath = AssetCatalogPath` alias is still there, and
will be removed in a following cleanup commit.

New `AssetCatalogPath` code reviewed by @severin in D12710.
2021-09-30 16:29:14 +02:00
5d42ea0369 GPencil: Change default template for better contrast in header
Patch created by Pablo Vazquez

This change darkens the header area a bit to create more contrast with the texts.

Differential Revision: https://developer.blender.org/D12711
2021-09-30 16:14:44 +02:00
d754d85845 Fix RigidBodyWorld copy using NO_MAIN instead of COW flag for cache handling.
We only want to share caches in case of CoW copying for the depsgraph,
not for regular `NO_MAIN` data.
2021-09-30 16:00:29 +02:00
1a72744ddc Fix T90246: Full Copy'ing a scene confuses physics in the original scene.
Handling of RigidBody data in duplicate of scenes/collections was very
wrong. This commit:
 - Add handling of duplication of RB collections when fully duplicating
   a scene.
 - Fix Object duplication trying to add duplicated RB objects to
   matching RBW collections.

While the later behavior is desired when only duplicated objects, when
duplicating their collections and/or scenes it is actually very bad, as
it would add back new object duplicates to old (RBW) collections.
2021-09-30 16:00:29 +02:00
779ea49af7 Cleanup: move node_common.c to c++
Buildbot compiled without problems.
2021-09-30 15:44:08 +02:00
07c5d02a11 Asset Browser: Support activating catalogs in the "Current File" library
If the "Current File" asset library is selected in the Asset Browser,
now asssets are filtered based on the active asset catalog. Previously
it would just show all assets. This was marked as a TODO in the code
already.

Maniphest Task: https://developer.blender.org/T91820
2021-09-30 15:23:13 +02:00
3453b22b1e Fix: Curve to Mesh node outputs original curve
It should only output the new mesh (and potentially instances
that are processed separately).
2021-09-30 13:33:21 +02:00
9628ef4135 Fix: wrong field input deduplication with Material Selection node 2021-09-30 12:51:09 +02:00
80d7cac22d Fix T91773: improve numerical stability in Curve Spiral node 2021-09-30 12:33:34 +02:00
ae0f944a57 Fix Cycles viewport flickering
Caused by a lack of synchronization between update process which sets
clear flag and the draw code checking the flag outside of a lock.
2021-09-30 11:44:53 +02:00
5f632f9f6e Fix color width regression in 66e24ce35b
Color buttons were drawing single icon width.
2021-09-30 17:45:09 +10:00
af13168a3f Cleanup: remove unused SpaceImage.curtile 2021-09-30 17:32:48 +10:00
e9dac3eab8 Cleanup: reduce Sequence size by 8 bytes
Also use int8_t for color tag.
2021-09-30 17:32:46 +10:00
fdcae48663 Cleanup: isolate UDIM parameters into a struct
Passing multiple UDIM arguments into the packing function
is awkward especially since the caller may not be using UDIM.

Use an argument to store UDIM packing parameters which can be NULL,
which operates without any UDIM support.

Add a function that extracts these parameters out of the image space
allowing for multiple functions to take UDIM parameters in the future.
2021-09-30 17:32:45 +10:00
2c2516bfc9 Fix(unreported): LineArt curve objects garbled result.
This is caused by line art loading curve objects twice from curve and converted mesh instances (when instance option is on). Now only load mesh when instance option is on.
2021-09-30 13:30:10 +08:00
66e24ce35b Fix menu width regression in c7d94a7827
Icon only popup buttons needed to be adjusted too,
add an uiTextIconPadFactor.icon_only to support this.
2021-09-30 12:43:52 +10:00
84dcf12ceb UI: Increase Area Resize Edge Hit Size
This patch increases the size of the Area BORDERPADDING a bit to make
it easier to hit the edges when initiating area resizing.

See D11925 for details and examples.

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

Reviewed by Campbell Barton
2021-09-29 15:05:58 -07:00
81f552e9ad Geometry Nodes: Expose Bezier handle positions as an attribute
This commit exposes left and right bezier handles as an attribute.
Interaction basically works like edit mode. If you move an aligned
handle, it also moves the opposite handle of the control point.
The difference is that you can't edit "Auto" or "Vector" handles,
you have to first use the "Set Handle Type" node. That gives the handle
types a bit more meaning in the node tree-- changing them in edit mod
is more like a "UI override".

The attributes are named `handle_start` and `handle_end`,
which is the same name used in the curve RNA API.

A new virtual array implementation is added which handles the case of
splines that don't have these attributes, and it also calls two new
functions on `BezierSpline` to set the handle position accounting
for aligned handles.

The virtual arrays and attribute providers will be refactored
(probably templated) in the future, as a next step after the last
built-in curve attribute provider has landed.

Differential Revision: https://developer.blender.org/D12005
2021-09-29 15:29:29 -05:00
cd03f5b6e5 Add RNA path funcs for VolumeRender & VolumeDisplay
Without proper RNA paths, Alt-click editing properties on multiple
selected objects doesn not work (as well as the 'Copy To Selected'
operator).

Fixes T91806.

Maniphest Tasks: T91806

Differential Revision: https://developer.blender.org/D12700
2021-09-29 21:39:56 +02:00
0cddbcf1d7 Fix T91803: Freestyle rendering as pass broken after recent changes 2021-09-29 21:14:37 +02:00
a2e321aa6d Cleanup: Compositor: Migrate most converter nodes to new socket builder
This migrates most nodes except for the switch view node.
This node requires dynamic sockets so its implementation will be more involved.
2021-09-29 14:48:30 -04:00
d3d021601d Nodes: Fix Split View missing identifier
Mistake from rB84251acfcc4534059d6ccd6682f8e37d529b9063
2021-09-29 14:48:30 -04:00
19785cb022 Fix Cycles CPU performance regression after recent change for intersections size
This struct is much bigger now, and does not actually need to be fully zero
initialized.
2021-09-29 20:25:16 +02:00
Himanshi Kalra
22c61e8060 Tests: Disable tests for non-compiled libraries
This diff disables tests for Boolean, subdivision surface and volume
when GMP, Opensubdiv and Openvdb are not compiled respectively.
It also changes the existing file structure and adds sub-folders for
boolean and subdivison tests. The volume folder only has one test and
is as unchanged structure-wise.

Reviewed By: JacquesLucke, LazyDodo

Differential Revision: https://developer.blender.org/D12448
2021-09-29 23:52:52 +05:30
6f23e4484d Fix non-finite curve normal causing Cycles to crash
Similar to the previous change in the area: need to avoid ray
point and direction becoming a non-finite value.

Use the view direction when the geometrical normal can not be
calculated.

Collaboration and sanity inspiration with Brecht!

Differential Revision: https://developer.blender.org/D12703
2021-09-29 19:49:59 +02:00
1d478851f8 GPencil: Avoid double depsgraph tag
The eval data is updated at the end of the function and this call just adds a calculation not used.
2021-09-29 19:21:54 +02:00
214baf5422 Assets: Enable recursive reading for the asset view template as well
This makes asset view templates, e.g. as used by the Pose Library add-on
use recursive asset loading, see

Also works around an issue that made assets not show up at all anymore
since fc7beac8d6. I'm creating a separate report for that regression,
but in the Asset Browser and Viewer it shouldn't be apparent currently.
2021-09-29 18:51:10 +02:00
45a312fd8f Fix build failure on Windows + wrong buffer size
Was using `NAME_MAX` which is defined in `limits.h`, which again may be
implicitly included by the compiler. Intend was to use the Blender
define `MAX_NAME`.
2021-09-29 17:49:42 +02:00
9d9f205dc4 Asset Browser: Initial Asset Catalog UI
The Asset Browser now displays a tree with asset catalogs in the left
sidebar.
This replaces the asset categories. It uses the new UI tree-view API
(https://wiki.blender.org/wiki/Source/Interface/Views#Tree-View).
Buttons are displayed for adding and removing of catalogs. Parent items
can be collapsed, but the collapsed/uncollapsed state is not stored in
files yet.
Note that edits to catalogs (e.g. new or removed catalogs) are only
written to the asset library's catalog definition files when saving a
.blend.

In the "Current File" asset library, we try to show asset catalogs from
a parent asset library, or if that fails, from the directory the file is
stored in. See adaf4f56e1.

There are plenty of TODOs and smaller glitches to be fixed still. Plus a
UI polishing pass should be done.

Important missing UI features:
* Dragging assets into catalogs (WIP, close to being ready).
* Renaming catalogs
* Proper handling of catalogs in the "Current File" asset library
  (currently not working well).

The "Current File" asset library is especially limited still. Since this
is the only place where you can assign assets to a catalog, this makes
the catalogs very cumbersome in general. To assign an asset to a
catalog, one has to manually copy the Catalog ID (a random hash like
number) to the asset metadata through a temporary UI in the Asset
Browser Sidebar. These limitations should be addressed over the next few
days, they are high priority.

Differential Revision: https://developer.blender.org/D12670
2021-09-29 17:15:23 +02:00
df9120b365 Fix T89864: Adding an asset referencing other objects adds it to scene but only adds data-blocks of referenced objects.
Link/append code needs proper access to scene/view3d data to handle
collections/objects instantiation.

Note that this is a temporary hack more than a proper fix, which would require
a deeper redesign of drag&drop code.

Also note that this will not handle 'properly' (i.e. as user would
expect it) cases like implicitely appended parent objects, in that only
the explicitely appended object will be dropped to the nes location, the
others will remain at their original coordinates.

Differential Revision: https://developer.blender.org/D12696
2021-09-29 17:10:42 +02:00
6aac892fad Cleanup: Enforce C linkage for internal File Browser header
This will be used by C++ code in the upcoming asset catalog UI commit.
2021-09-29 16:59:48 +02:00
367775ac6a Fix Cycles use of uninitialized value in volume stack intersection on CPU
Could cause an actual bug but probability is low in practice.
2021-09-29 16:37:32 +02:00
4d4113adc2 Cycles: record large number of transparent shadow intersections on CPU
So we can do fewer intersection calls, only on the GPU do we need to save
memory and do this in small steps.

Ref T87836
2021-09-29 16:37:32 +02:00
2750 changed files with 119360 additions and 70921 deletions

View File

@@ -180,6 +180,7 @@ ForEachMacros:
- CTX_DATA_BEGIN_WITH_ID
- DEG_OBJECT_ITER_BEGIN
- DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN
- DRW_ENABLED_ENGINE_ITER
- DRIVER_TARGETS_LOOPER_BEGIN
- DRIVER_TARGETS_USED_LOOPER_BEGIN
- FOREACH_BASE_IN_EDIT_MODE_BEGIN
@@ -267,3 +268,10 @@ ForEachMacros:
StatementMacros:
- PyObject_HEAD
- PyObject_VAR_HEAD
StatementMacros:
- GPU_STAGE_INTERFACE_CREATE
- GPU_SHADER_DESCRIPTOR
MacroBlockBegin: "^BSDF_CLOSURE_CLASS_BEGIN$"
MacroBlockEnd: "^BSDF_CLOSURE_CLASS_END$"

View File

@@ -12,6 +12,8 @@ Checks: >
-readability-avoid-const-params-in-decls,
-readability-simplify-boolean-expr,
-readability-make-member-function-const,
-readability-suspicious-call-argument,
-readability-redundant-member-init,
-readability-misleading-indentation,
@@ -25,6 +27,8 @@ Checks: >
-bugprone-branch-clone,
-bugprone-macro-parentheses,
-bugprone-reserved-identifier,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-sizeof-expression,
-bugprone-integer-division,
@@ -40,7 +44,8 @@ Checks: >
-modernize-pass-by-value,
# Cannot be enabled yet, because using raw string literals in tests breaks
# the windows compiler currently.
-modernize-raw-string-literal
-modernize-raw-string-literal,
-modernize-return-braced-init-list
CheckOptions:
- key: modernize-use-default-member-init.UseAssignment

5
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,5 @@
This repository is only used as a mirror of git.blender.org. Blender development happens on
https://developer.blender.org.
To get started with contributing code, please see:
https://wiki.blender.org/wiki/Process/Contributing_Code

View File

@@ -30,7 +30,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
"CMake generation for blender is not allowed within the source directory!"
"\n Remove \"${CMAKE_SOURCE_DIR}/CMakeCache.txt\" and try again from another folder, e.g.:"
"\n "
"\n rm CMakeCache.txt"
"\n rm -rf CMakeCache.txt CMakeFiles"
"\n cd .."
"\n mkdir cmake-make"
"\n cd cmake-make"
@@ -156,6 +156,15 @@ get_blender_version()
option(WITH_BLENDER "Build blender (disable to build only the blender player)" ON)
mark_as_advanced(WITH_BLENDER)
if(APPLE)
# Currently this causes a build error linking, disable.
set(WITH_BLENDER_THUMBNAILER OFF)
elseif(WIN32)
option(WITH_BLENDER_THUMBNAILER "Build \"BlendThumb.dll\" helper for Windows explorer integration" ON)
else()
option(WITH_BLENDER_THUMBNAILER "Build \"blender-thumbnailer\" thumbnail extraction utility" ON)
endif()
option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
option(WITH_PYTHON "Enable Embedded Python API (only disable for development)" ON)
@@ -388,6 +397,10 @@ if(WITH_PYTHON_INSTALL)
set(PYTHON_REQUESTS_PATH "" CACHE PATH "Path to python site-packages or dist-packages containing 'requests' module")
mark_as_advanced(PYTHON_REQUESTS_PATH)
endif()
option(WITH_PYTHON_INSTALL_ZSTANDARD "Copy zstandard into the blender install folder" ON)
set(PYTHON_ZSTANDARD_PATH "" CACHE PATH "Path to python site-packages or dist-packages containing 'zstandard' module")
mark_as_advanced(PYTHON_ZSTANDARD_PATH)
endif()
option(WITH_CPU_SIMD "Enable SIMD instruction if they're detected on the host machine" ON)
@@ -395,37 +408,49 @@ mark_as_advanced(WITH_CPU_SIMD)
# Cycles
option(WITH_CYCLES "Enable Cycles Render Engine" ON)
option(WITH_CYCLES_OSL "Build Cycles with OpenShadingLanguage support" ON)
option(WITH_CYCLES_EMBREE "Build Cycles with Embree support" ON)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
option(WITH_CYCLES_DEBUG "Build Cycles with options useful for debugging (e.g., MIS)" OFF)
option(WITH_CYCLES_STANDALONE "Build Cycles standalone application" OFF)
option(WITH_CYCLES_STANDALONE_GUI "Build Cycles standalone with GUI" OFF)
option(WITH_CYCLES_OSL "Build Cycles with OSL support" ON)
option(WITH_CYCLES_EMBREE "Build Cycles with Embree support" ON)
option(WITH_CYCLES_CUDA_BINARIES "Build Cycles CUDA binaries" OFF)
option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF)
option(WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF)
mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
set(CYCLES_TEST_DEVICES CPU CACHE STRING "Run regression tests on the specified device types (CPU CUDA OPTIX)" )
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for")
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
option(WITH_CYCLES_DEBUG_NAN "Build Cycles with additional asserts for detecting NaNs and invalid values" OFF)
option(WITH_CYCLES_NATIVE_ONLY "Build Cycles with native kernel only (which fits current CPU, use for development only)" OFF)
option(WITH_CYCLES_KERNEL_ASAN "Build Cycles kernels with address sanitizer when WITH_COMPILER_ASAN is on, even if it's very slow" OFF)
set(CYCLES_TEST_DEVICES CPU CACHE STRING "Run regression tests on the specified device types (CPU CUDA OPTIX HIP)" )
mark_as_advanced(WITH_CYCLES_KERNEL_ASAN)
mark_as_advanced(WITH_CYCLES_CUBIN_COMPILER)
mark_as_advanced(WITH_CYCLES_LOGGING)
mark_as_advanced(WITH_CYCLES_DEBUG_NAN)
mark_as_advanced(WITH_CYCLES_NATIVE_ONLY)
option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles CUDA compute support" ON)
option(WITH_CYCLES_DEVICE_OPTIX "Enable Cycles OptiX support" ON)
option(WITH_CYCLES_DEVICE_HIP "Enable Cycles HIP support" OFF)
mark_as_advanced(WITH_CYCLES_DEVICE_HIP)
# NVIDIA CUDA & OptiX
option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles NVIDIA CUDA compute support" ON)
option(WITH_CYCLES_DEVICE_OPTIX "Enable Cycles NVIDIA OptiX support" ON)
mark_as_advanced(WITH_CYCLES_DEVICE_CUDA)
option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime" ON)
option(WITH_CYCLES_CUDA_BINARIES "Build Cycles NVIDIA CUDA binaries" OFF)
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for")
option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF)
option(WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF)
option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime (for developers, makes cuda-gdb work)" ON)
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
mark_as_advanced(WITH_CYCLES_CUBIN_COMPILER)
mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
mark_as_advanced(WITH_CUDA_DYNLOAD)
# AMD HIP
if(WIN32)
option(WITH_CYCLES_DEVICE_HIP "Enable Cycles AMD HIP support" ON)
else()
option(WITH_CYCLES_DEVICE_HIP "Enable Cycles AMD HIP support" OFF)
endif()
option(WITH_CYCLES_HIP_BINARIES "Build Cycles AMD HIP binaries" OFF)
set(CYCLES_HIP_BINARIES_ARCH gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 gfx1032 gfx1034 CACHE STRING "AMD HIP architectures to build binaries for")
mark_as_advanced(WITH_CYCLES_DEVICE_HIP)
mark_as_advanced(CYCLES_HIP_BINARIES_ARCH)
# Draw Manager
option(WITH_DRAW_DEBUG "Add extra debug capabilities to Draw Manager" OFF)
mark_as_advanced(WITH_DRAW_DEBUG)
@@ -622,7 +647,7 @@ if(WIN32)
option(WITH_WINDOWS_PDB "Generate a pdb file for client side stacktraces" ON)
mark_as_advanced(WITH_WINDOWS_PDB)
option(WITH_WINDOWS_STRIPPED_PDB "Use a stripped PDB file" On)
option(WITH_WINDOWS_STRIPPED_PDB "Use a stripped PDB file" ON)
mark_as_advanced(WITH_WINDOWS_STRIPPED_PDB)
endif()
@@ -1045,7 +1070,7 @@ if(MSVC)
add_definitions(-D__LITTLE_ENDIAN__)
# OSX-Note: as we do cross-compiling with specific set architecture,
# endianess-detection and auto-setting is counterproductive
# endianness-detection and auto-setting is counterproductive
# so we just set endianness according CMAKE_OSX_ARCHITECTURES
elseif(CMAKE_OSX_ARCHITECTURES MATCHES i386 OR CMAKE_OSX_ARCHITECTURES MATCHES x86_64 OR CMAKE_OSX_ARCHITECTURES MATCHES arm64)
@@ -1723,13 +1748,19 @@ if(WITH_PYTHON)
elseif(WITH_PYTHON_INSTALL_REQUESTS)
find_python_package(requests "")
endif()
if(WIN32 OR APPLE)
# pass, we have this in lib/python/site-packages
elseif(WITH_PYTHON_INSTALL_ZSTANDARD)
find_python_package(zstandard "")
endif()
endif()
# Select C++17 as the standard for C++ projects.
set(CMAKE_CXX_STANDARD 17)
# If C++17 is not available, downgrading to an earlier standard is NOT OK.
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Do not enable compiler specific language extentions.
# Do not enable compiler specific language extensions.
set(CMAKE_CXX_EXTENSIONS OFF)
# Make MSVC properly report the value of the __cplusplus preprocessor macro
@@ -1994,6 +2025,7 @@ if(FIRST_RUN)
endif()
info_cfg_option(WITH_PYTHON_INSTALL)
info_cfg_option(WITH_PYTHON_INSTALL_NUMPY)
info_cfg_option(WITH_PYTHON_INSTALL_ZSTANDARD)
info_cfg_option(WITH_PYTHON_MODULE)
info_cfg_option(WITH_PYTHON_SAFETY)

View File

@@ -27,7 +27,7 @@
define HELP_TEXT
Blender Convenience Targets
Provided for building Blender, (multiple at once can be used).
Provided for building Blender (multiple targets can be used at once).
* debug: Build a debug binary.
* full: Enable all supported dependencies & options.
@@ -40,6 +40,8 @@ Blender Convenience Targets
* ninja: Use ninja build tool for faster builds.
* ccache: Use ccache for faster rebuilds.
Note: when passing in multiple targets their order is not important.
So for a fast build you can for e.g. run 'make lite ccache ninja'.
Note: passing the argument 'BUILD_DIR=path' when calling make will override the default build dir.
Note: passing the argument 'BUILD_CMAKE_ARGS=args' lets you add cmake arguments.
@@ -49,7 +51,7 @@ Other Convenience Targets
* config: Run cmake configuration tool to set build options.
* deps: Build library dependencies (intended only for platform maintainers).
The existance of locally build dependancies overrides the pre-built dependencies from subversion.
The existance of locally build dependencies overrides the pre-built dependencies from subversion.
These must be manually removed from '../lib/' to go back to using the pre-compiled libraries.
Project Files

View File

@@ -17,7 +17,7 @@
# ***** END GPL LICENSE BLOCK *****
########################################################################
# Copy all generated files to the proper strucure as blender prefers
# Copy all generated files to the proper structure as blender prefers
########################################################################
if(NOT DEFINED HARVEST_TARGET)

View File

@@ -42,6 +42,7 @@ ExternalProject_Add(nanovdb
URL_HASH ${NANOVDB_HASH_TYPE}=${NANOVDB_HASH}
PREFIX ${BUILD_DIR}/nanovdb
SOURCE_SUBDIR nanovdb
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/nanovdb/src/nanovdb < ${PATCH_DIR}/nanovdb.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/nanovdb ${DEFAULT_CMAKE_FLAGS} ${NANOVDB_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/nanovdb
)

View File

@@ -38,7 +38,6 @@ ExternalProject_Add(external_numpy
PREFIX ${BUILD_DIR}/numpy
PATCH_COMMAND ${NUMPY_PATCH}
CONFIGURE_COMMAND ""
PATCH_COMMAND COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/numpy/src/external_numpy < ${PATCH_DIR}/numpy.diff
LOG_BUILD 1
BUILD_COMMAND ${PYTHON_BINARY} ${BUILD_DIR}/numpy/src/external_numpy/setup.py build ${NUMPY_BUILD_OPTION} install --old-and-unmanageable
INSTALL_COMMAND ""

View File

@@ -39,7 +39,7 @@ endif()
set(DOWNLOAD_DIR "${CMAKE_CURRENT_BINARY_DIR}/downloads" CACHE STRING "Path for downloaded files")
# This path must be hard-coded like this, so that the GNUmakefile knows where it is and can pass it to make_source_archive.py:
set(PACKAGE_DIR "${CMAKE_CURRENT_BINARY_DIR}/packages")
option(PACKAGE_USE_UPSTREAM_SOURCES "Use soures upstream to download the package sources, when OFF the blender mirror will be used" ON)
option(PACKAGE_USE_UPSTREAM_SOURCES "Use sources upstream to download the package sources, when OFF the blender mirror will be used" ON)
file(TO_CMAKE_PATH ${DOWNLOAD_DIR} DOWNLOAD_DIR)
file(TO_CMAKE_PATH ${PACKAGE_DIR} PACKAGE_DIR)

View File

@@ -24,7 +24,7 @@ if(MSVC)
add_custom_command(
OUTPUT ${PYTARGET}/bin/python${PYTHON_POSTFIX}.exe
COMMAND echo packaging python
COMMAND echo this should ouput at ${PYTARGET}/bin/python${PYTHON_POSTFIX}.exe
COMMAND echo this should output at ${PYTARGET}/bin/python${PYTHON_POSTFIX}.exe
COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTARGET}/libs
COMMAND ${CMAKE_COMMAND} -E copy ${PYSRC}/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}.lib ${PYTARGET}/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}.lib
COMMAND ${CMAKE_COMMAND} -E copy ${PYSRC}/python.exe ${PYTARGET}/bin/python.exe
@@ -43,7 +43,7 @@ if(MSVC)
add_custom_command(
OUTPUT ${PYTARGET}/bin/python${PYTHON_POSTFIX}.exe
COMMAND echo packaging python
COMMAND echo this should ouput at ${PYTARGET}/bin/python${PYTHON_POSTFIX}.exe
COMMAND echo this should output at ${PYTARGET}/bin/python${PYTHON_POSTFIX}.exe
COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTARGET}/libs
COMMAND ${CMAKE_COMMAND} -E copy ${PYSRC}/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}${PYTHON_POSTFIX}.lib ${PYTARGET}/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}${PYTHON_POSTFIX}.lib
COMMAND ${CMAKE_COMMAND} -E copy ${PYSRC}/python${PYTHON_POSTFIX}.exe ${PYTARGET}/bin/python${PYTHON_POSTFIX}.exe

View File

@@ -18,14 +18,20 @@
if(WIN32 AND BUILD_MODE STREQUAL Debug)
set(SITE_PACKAGES_EXTRA --global-option build --global-option --debug)
# zstandard is determined to build and link release mode libs in a debug
# configuration, the only way to make it happy is to bend to its will
# and give it a library to link with.
set(PIP_CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}_d.lib ${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}.lib)
else()
set(PIP_CONFIGURE_COMMAND echo ".")
endif()
ExternalProject_Add(external_python_site_packages
DOWNLOAD_COMMAND ""
CONFIGURE_COMMAND ""
CONFIGURE_COMMAND ${PIP_CONFIGURE_COMMAND}
BUILD_COMMAND ""
PREFIX ${BUILD_DIR}/site_packages
INSTALL_COMMAND ${PYTHON_BINARY} -m pip install ${SITE_PACKAGES_EXTRA} cython==${CYTHON_VERSION} idna==${IDNA_VERSION} chardet==${CHARDET_VERSION} urllib3==${URLLIB3_VERSION} certifi==${CERTIFI_VERSION} requests==${REQUESTS_VERSION} --no-binary :all:
INSTALL_COMMAND ${PYTHON_BINARY} -m pip install ${SITE_PACKAGES_EXTRA} cython==${CYTHON_VERSION} idna==${IDNA_VERSION} charset-normalizer==${CHARSET_NORMALIZER_VERSION} urllib3==${URLLIB3_VERSION} certifi==${CERTIFI_VERSION} requests==${REQUESTS_VERSION} zstandard==${ZSTANDARD_VERSION} --no-binary :all:
)
if(USE_PIP_NUMPY)

View File

@@ -189,11 +189,11 @@ set(OSL_HASH 1abd7ce40481771a9fa937f19595d2f2)
set(OSL_HASH_TYPE MD5)
set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
set(PYTHON_VERSION 3.9.2)
set(PYTHON_VERSION 3.9.7)
set(PYTHON_SHORT_VERSION 3.9)
set(PYTHON_SHORT_VERSION_NO_DOTS 39)
set(PYTHON_URI https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz)
set(PYTHON_HASH f0dc9000312abeb16de4eccce9a870ab)
set(PYTHON_HASH fddb060b483bc01850a3f412eea1d954)
set(PYTHON_HASH_TYPE MD5)
set(PYTHON_FILE Python-${PYTHON_VERSION}.tar.xz)
@@ -215,17 +215,18 @@ set(NANOVDB_HASH e7b9e863ec2f3b04ead171dec2322807)
set(NANOVDB_HASH_TYPE MD5)
set(NANOVDB_FILE nano-vdb-${NANOVDB_GIT_UID}.tar.gz)
set(IDNA_VERSION 2.10)
set(CHARDET_VERSION 4.0.0)
set(URLLIB3_VERSION 1.26.3)
set(CERTIFI_VERSION 2020.12.5)
set(REQUESTS_VERSION 2.25.1)
set(CYTHON_VERSION 0.29.21)
set(IDNA_VERSION 3.2)
set(CHARSET_NORMALIZER_VERSION 2.0.6)
set(URLLIB3_VERSION 1.26.7)
set(CERTIFI_VERSION 2021.10.8)
set(REQUESTS_VERSION 2.26.0)
set(CYTHON_VERSION 0.29.24)
set(ZSTANDARD_VERSION 0.15.2 )
set(NUMPY_VERSION 1.19.5)
set(NUMPY_SHORT_VERSION 1.19)
set(NUMPY_VERSION 1.21.2)
set(NUMPY_SHORT_VERSION 1.21)
set(NUMPY_URI https://github.com/numpy/numpy/releases/download/v${NUMPY_VERSION}/numpy-${NUMPY_VERSION}.zip)
set(NUMPY_HASH f6a1b48717c552bbc18f1adc3cc1fe0e)
set(NUMPY_HASH 5638d5dae3ca387be562912312db842e)
set(NUMPY_HASH_TYPE MD5)
set(NUMPY_FILE numpy-${NUMPY_VERSION}.zip)

View File

@@ -371,71 +371,78 @@ NO_BUILD=false
NO_CONFIRM=false
USE_CXX11=true
# Note about versions: Min is inclusive, Max is exclusive (i.e. XXX_VERSION_MIN <= ACTUAL_VERSION < XXX_VERSION_MAX)
# Note about versions: Min is inclusive, Mex is 'minimum exclusive' (i.e. XXX_VERSION_MIN <= ACTUAL_VERSION < XXX_VERSION_MEX)
# XXX_VERSION is officially supported/used version in official builds.
# XXX_VERSION_SHORT is used for various things, like preferred version (when distribution provides several of them),
# and to name shortcuts to built libraries' installation directories...
CLANG_FORMAT_VERSION_MIN="6.0"
CLANG_FORMAT_VERSION_MAX="10.0"
CLANG_FORMAT_VERSION_MEX="10.0"
PYTHON_VERSION="3.9.2"
PYTHON_VERSION="3.9.7"
PYTHON_VERSION_SHORT="3.9"
PYTHON_VERSION_MIN="3.7"
PYTHON_VERSION_MAX="3.11"
PYTHON_VERSION_MEX="3.11"
PYTHON_VERSION_INSTALLED=$PYTHON_VERSION_SHORT
PYTHON_FORCE_BUILD=false
PYTHON_FORCE_REBUILD=false
PYTHON_SKIP=false
# Additional Python modules.
PYTHON_IDNA_VERSION="2.9"
PYTHON_IDNA_VERSION="3.2"
PYTHON_IDNA_VERSION_MIN="2.0"
PYTHON_IDNA_VERSION_MAX="3.0"
PYTHON_IDNA_VERSION_MEX="4.0"
PYTHON_IDNA_NAME="idna"
PYTHON_CHARDET_VERSION="3.0.4"
PYTHON_CHARDET_VERSION_MIN="3.0"
PYTHON_CHARDET_VERSION_MAX="5.0"
PYTHON_CHARDET_NAME="chardet"
PYTHON_CHARSET_NORMALIZER_VERSION="2.0.6"
PYTHON_CHARSET_NORMALIZER_VERSION_MIN="2.0.6"
PYTHON_CHARSET_NORMALIZER_VERSION_MEX="2.1.0" # requests uses `charset_normalizer~=2.0.0`
PYTHON_CHARSET_NORMALIZER_NAME="charset-normalizer"
PYTHON_URLLIB3_VERSION="1.25.9"
PYTHON_URLLIB3_VERSION="1.26.7"
PYTHON_URLLIB3_VERSION_MIN="1.0"
PYTHON_URLLIB3_VERSION_MAX="2.0"
PYTHON_URLLIB3_VERSION_MEX="2.0"
PYTHON_URLLIB3_NAME="urllib3"
PYTHON_CERTIFI_VERSION="2020.4.5.2"
PYTHON_CERTIFI_VERSION_MIN="2020.0"
PYTHON_CERTIFI_VERSION_MAX="2021.0"
PYTHON_CERTIFI_VERSION="2021.10.8"
PYTHON_CERTIFI_VERSION_MIN="2021.0"
PYTHON_CERTIFI_VERSION_MEX="2023.0"
PYTHON_CERTIFI_NAME="certifi"
PYTHON_REQUESTS_VERSION="2.23.0"
PYTHON_REQUESTS_VERSION_MIN="2.0"
PYTHON_REQUESTS_VERSION_MAX="3.0"
PYTHON_REQUESTS_VERSION_MEX="3.0"
PYTHON_REQUESTS_NAME="requests"
PYTHON_NUMPY_VERSION="1.19.5"
PYTHON_ZSTANDARD_VERSION="0.15.2"
PYTHON_ZSTANDARD_VERSION_MIN="0.15.2"
PYTHON_ZSTANDARD_VERSION_MEX="0.16.0"
PYTHON_ZSTANDARD_NAME="zstandard"
PYTHON_NUMPY_VERSION="1.21.2"
PYTHON_NUMPY_VERSION_MIN="1.14"
PYTHON_NUMPY_VERSION_MAX="2.0"
PYTHON_NUMPY_VERSION_MEX="2.0"
PYTHON_NUMPY_NAME="numpy"
# As package-ready parameters (only used with distro packages).
PYTHON_MODULES_PACKAGES=(
"$PYTHON_IDNA_NAME $PYTHON_IDNA_VERSION_MIN $PYTHON_IDNA_VERSION_MAX"
"$PYTHON_CHARDET_NAME $PYTHON_CHARDET_VERSION_MIN $PYTHON_CHARDET_VERSION_MAX"
"$PYTHON_URLLIB3_NAME $PYTHON_URLLIB3_VERSION_MIN $PYTHON_URLLIB3_VERSION_MAX"
"$PYTHON_CERTIFI_NAME $PYTHON_CERTIFI_VERSION_MIN $PYTHON_CERTIFI_VERSION_MAX"
"$PYTHON_REQUESTS_NAME $PYTHON_REQUESTS_VERSION_MIN $PYTHON_REQUESTS_VERSION_MAX"
"$PYTHON_NUMPY_NAME $PYTHON_NUMPY_VERSION_MIN $PYTHON_NUMPY_VERSION_MAX"
"$PYTHON_IDNA_NAME $PYTHON_IDNA_VERSION_MIN $PYTHON_IDNA_VERSION_MEX"
"$PYTHON_CHARSET_NORMALIZER_NAME $PYTHON_CHARSET_NORMALIZER_VERSION_MIN $PYTHON_CHARSET_NORMALIZER_VERSION_MEX"
"$PYTHON_URLLIB3_NAME $PYTHON_URLLIB3_VERSION_MIN $PYTHON_URLLIB3_VERSION_MEX"
"$PYTHON_CERTIFI_NAME $PYTHON_CERTIFI_VERSION_MIN $PYTHON_CERTIFI_VERSION_MEX"
"$PYTHON_REQUESTS_NAME $PYTHON_REQUESTS_VERSION_MIN $PYTHON_REQUESTS_VERSION_MEX"
"$PYTHON_ZSTANDARD_NAME $PYTHON_ZSTANDARD_VERSION_MIN $PYTHON_ZSTANDARD_VERSION_MEX"
"$PYTHON_NUMPY_NAME $PYTHON_NUMPY_VERSION_MIN $PYTHON_NUMPY_VERSION_MEX"
)
# As pip-ready parameters (only used when building python).
PYTHON_MODULES_PIP=(
"$PYTHON_IDNA_NAME==$PYTHON_IDNA_VERSION"
"$PYTHON_CHARDET_NAME==$PYTHON_CHARDET_VERSION"
"$PYTHON_CHARSET_NORMALIZER_NAME==$PYTHON_CHARSET_NORMALIZER_VERSION"
"$PYTHON_URLLIB3_NAME==$PYTHON_URLLIB3_VERSION"
"$PYTHON_CERTIFI_NAME==$PYTHON_CERTIFI_VERSION"
"$PYTHON_REQUESTS_NAME==$PYTHON_REQUESTS_VERSION"
"$PYTHON_ZSTANDARD_NAME==$PYTHON_ZSTANDARD_VERSION"
"$PYTHON_NUMPY_NAME==$PYTHON_NUMPY_VERSION"
)
@@ -443,7 +450,7 @@ PYTHON_MODULES_PIP=(
BOOST_VERSION="1.73.0"
BOOST_VERSION_SHORT="1.73"
BOOST_VERSION_MIN="1.49"
BOOST_VERSION_MAX="2.0"
BOOST_VERSION_MEX="2.0"
BOOST_FORCE_BUILD=false
BOOST_FORCE_REBUILD=false
BOOST_SKIP=false
@@ -452,7 +459,7 @@ TBB_VERSION="2020"
TBB_VERSION_SHORT="2020"
TBB_VERSION_UPDATE="_U2" # Used for source packages...
TBB_VERSION_MIN="2018"
TBB_VERSION_MAX="2022"
TBB_VERSION_MEX="2022"
TBB_FORCE_BUILD=false
TBB_FORCE_REBUILD=false
TBB_SKIP=false
@@ -460,7 +467,7 @@ TBB_SKIP=false
OCIO_VERSION="2.0.0"
OCIO_VERSION_SHORT="2.0"
OCIO_VERSION_MIN="2.0"
OCIO_VERSION_MAX="3.0"
OCIO_VERSION_MEX="3.0"
OCIO_FORCE_BUILD=false
OCIO_FORCE_REBUILD=false
OCIO_SKIP=false
@@ -468,7 +475,7 @@ OCIO_SKIP=false
OPENEXR_VERSION="2.5.5"
OPENEXR_VERSION_SHORT="2.5"
OPENEXR_VERSION_MIN="2.4"
OPENEXR_VERSION_MAX="3.0"
OPENEXR_VERSION_MEX="3.0"
OPENEXR_FORCE_BUILD=false
OPENEXR_FORCE_REBUILD=false
OPENEXR_SKIP=false
@@ -477,7 +484,7 @@ _with_built_openexr=false
OIIO_VERSION="2.2.15.1"
OIIO_VERSION_SHORT="2.2"
OIIO_VERSION_MIN="2.1.12"
OIIO_VERSION_MAX="2.3.0"
OIIO_VERSION_MEX="2.3.0"
OIIO_FORCE_BUILD=false
OIIO_FORCE_REBUILD=false
OIIO_SKIP=false
@@ -485,7 +492,7 @@ OIIO_SKIP=false
LLVM_VERSION="12.0.0"
LLVM_VERSION_SHORT="12.0"
LLVM_VERSION_MIN="11.0"
LLVM_VERSION_MAX="13.0"
LLVM_VERSION_MEX="13.0"
LLVM_VERSION_FOUND=""
LLVM_FORCE_BUILD=false
LLVM_FORCE_REBUILD=false
@@ -495,7 +502,7 @@ LLVM_SKIP=false
OSL_VERSION="1.11.14.1"
OSL_VERSION_SHORT="1.11"
OSL_VERSION_MIN="1.11"
OSL_VERSION_MAX="2.0"
OSL_VERSION_MEX="2.0"
OSL_FORCE_BUILD=false
OSL_FORCE_REBUILD=false
OSL_SKIP=false
@@ -504,7 +511,7 @@ OSL_SKIP=false
OSD_VERSION="3.4.3"
OSD_VERSION_SHORT="3.4"
OSD_VERSION_MIN="3.4"
OSD_VERSION_MAX="4.0"
OSD_VERSION_MEX="4.0"
OSD_FORCE_BUILD=false
OSD_FORCE_REBUILD=false
OSD_SKIP=false
@@ -515,7 +522,7 @@ OPENVDB_BLOSC_VERSION="1.5.0"
OPENVDB_VERSION="8.0.1"
OPENVDB_VERSION_SHORT="8.0"
OPENVDB_VERSION_MIN="8.0"
OPENVDB_VERSION_MAX="8.1"
OPENVDB_VERSION_MEX="8.1"
OPENVDB_FORCE_BUILD=false
OPENVDB_FORCE_REBUILD=false
OPENVDB_SKIP=false
@@ -524,7 +531,7 @@ OPENVDB_SKIP=false
ALEMBIC_VERSION="1.7.16"
ALEMBIC_VERSION_SHORT="1.7"
ALEMBIC_VERSION_MIN="1.7"
ALEMBIC_VERSION_MAX="2.0"
ALEMBIC_VERSION_MEX="2.0"
ALEMBIC_FORCE_BUILD=false
ALEMBIC_FORCE_REBUILD=false
ALEMBIC_SKIP=false
@@ -532,7 +539,7 @@ ALEMBIC_SKIP=false
USD_VERSION="21.02"
USD_VERSION_SHORT="21.02"
USD_VERSION_MIN="20.05"
USD_VERSION_MAX="22.00"
USD_VERSION_MEX="22.00"
USD_FORCE_BUILD=false
USD_FORCE_REBUILD=false
USD_SKIP=false
@@ -540,7 +547,7 @@ USD_SKIP=false
OPENCOLLADA_VERSION="1.6.68"
OPENCOLLADA_VERSION_SHORT="1.6"
OPENCOLLADA_VERSION_MIN="1.6.68"
OPENCOLLADA_VERSION_MAX="1.7"
OPENCOLLADA_VERSION_MEX="1.7"
OPENCOLLADA_FORCE_BUILD=false
OPENCOLLADA_FORCE_REBUILD=false
OPENCOLLADA_SKIP=false
@@ -548,7 +555,7 @@ OPENCOLLADA_SKIP=false
EMBREE_VERSION="3.10.0"
EMBREE_VERSION_SHORT="3.10"
EMBREE_VERSION_MIN="3.10"
EMBREE_VERSION_MAX="4.0"
EMBREE_VERSION_MEX="4.0"
EMBREE_FORCE_BUILD=false
EMBREE_FORCE_REBUILD=false
EMBREE_SKIP=false
@@ -556,7 +563,7 @@ EMBREE_SKIP=false
OIDN_VERSION="1.4.1"
OIDN_VERSION_SHORT="1.4"
OIDN_VERSION_MIN="1.4.0"
OIDN_VERSION_MAX="1.5"
OIDN_VERSION_MEX="1.5"
OIDN_FORCE_BUILD=false
OIDN_FORCE_REBUILD=false
OIDN_SKIP=false
@@ -566,7 +573,7 @@ ISPC_VERSION="1.16.0"
FFMPEG_VERSION="4.4"
FFMPEG_VERSION_SHORT="4.4"
FFMPEG_VERSION_MIN="3.0"
FFMPEG_VERSION_MAX="5.0"
FFMPEG_VERSION_MEX="5.0"
FFMPEG_FORCE_BUILD=false
FFMPEG_FORCE_REBUILD=false
FFMPEG_SKIP=false
@@ -575,7 +582,7 @@ _ffmpeg_list_sep=";"
XR_OPENXR_VERSION="1.0.17"
XR_OPENXR_VERSION_SHORT="1.0"
XR_OPENXR_VERSION_MIN="1.0.8"
XR_OPENXR_VERSION_MAX="2.0"
XR_OPENXR_VERSION_MEX="2.0"
XR_OPENXR_FORCE_BUILD=false
XR_OPENXR_FORCE_REBUILD=false
XR_OPENXR_SKIP=false
@@ -1141,10 +1148,11 @@ You may also want to build them yourself (optional ones are [between brackets]):
* Python $PYTHON_VERSION (from $PYTHON_SOURCE).
** [IDNA $PYTHON_IDNA_VERSION] (use pip).
** [Chardet $PYTHON_CHARDET_VERSION] (use pip).
** [Charset Normalizer $PYTHON_CHARSET_NORMALIZER_VERSION] (use pip).
** [Urllib3 $PYTHON_URLLIB3_VERSION] (use pip).
** [Certifi $PYTHON_CERTIFI_VERSION] (use pip).
** [Requests $PYTHON_REQUESTS_VERSION] (use pip).
** [ZStandard $PYTHON_ZSTANDARD_VERSION] (use pip).
** [NumPy $PYTHON_NUMPY_VERSION] (use pip).
* Boost $BOOST_VERSION (from $BOOST_SOURCE, modules: $BOOST_BUILD_MODULES).
* TBB $TBB_VERSION (from $TBB_SOURCE).
@@ -1818,7 +1826,7 @@ compile_OCIO() {
# Force linking against static libs
#rm -f $_inst/lib/*.so*
# Additional depencencies
# Additional dependencies
#cp ext/dist/lib/libtinyxml.a $_inst/lib
#cp ext/dist/lib/libyaml-cpp.a $_inst/lib
@@ -2013,7 +2021,7 @@ compile_OIIO() {
fi
# To be changed each time we make edits that would modify the compiled result!
oiio_magic=17
oiio_magic=18
_init_oiio
# Force having own builds for the dependencies.
@@ -2088,6 +2096,7 @@ compile_OIIO() {
cmake_d="$cmake_d -D USE_PYTHON=OFF"
cmake_d="$cmake_d -D USE_FFMPEG=OFF"
cmake_d="$cmake_d -D USE_OPENCV=OFF"
cmake_d="$cmake_d -D USE_OPENVDB=OFF"
cmake_d="$cmake_d -D BUILD_TESTING=OFF"
cmake_d="$cmake_d -D OIIO_BUILD_TESTS=OFF"
cmake_d="$cmake_d -D OIIO_BUILD_TOOLS=OFF"
@@ -4027,7 +4036,7 @@ install_DEB() {
INFO "Forced Python building, as requested..."
_do_compile_python=true
else
check_package_version_ge_lt_DEB python3-dev $PYTHON_VERSION_MIN $PYTHON_VERSION_MAX
check_package_version_ge_lt_DEB python3-dev $PYTHON_VERSION_MIN $PYTHON_VERSION_MEX
if [ $? -eq 0 ]; then
PYTHON_VERSION_INSTALLED=$(echo `get_package_version_DEB python3-dev` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
@@ -4040,8 +4049,8 @@ install_DEB() {
module=($module)
package="python3-${module[0]}"
package_vmin=${module[1]}
package_vmax=${module[2]}
check_package_version_ge_lt_DEB "$package" $package_vmin $package_vmax
package_vmex=${module[2]}
check_package_version_ge_lt_DEB "$package" $package_vmin $package_vmex
if [ $? -eq 0 ]; then
install_packages_DEB "$package"
else
@@ -4067,7 +4076,7 @@ install_DEB() {
INFO "Forced Boost building, as requested..."
compile_Boost
else
check_package_version_ge_lt_DEB libboost-dev $BOOST_VERSION_MIN $BOOST_VERSION_MAX
check_package_version_ge_lt_DEB libboost-dev $BOOST_VERSION_MIN $BOOST_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_DEB libboost-dev
@@ -4088,7 +4097,7 @@ install_DEB() {
INFO "Forced TBB building, as requested..."
compile_TBB
else
check_package_version_ge_lt_DEB libtbb-dev $TBB_VERSION_MIN $TBB_VERSION_MAX
check_package_version_ge_lt_DEB libtbb-dev $TBB_VERSION_MIN $TBB_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_DEB libtbb-dev
clean_TBB
@@ -4105,7 +4114,7 @@ install_DEB() {
INFO "Forced OpenColorIO building, as requested..."
compile_OCIO
else
check_package_version_ge_lt_DEB libopencolorio-dev $OCIO_VERSION_MIN $OCIO_VERSION_MAX
check_package_version_ge_lt_DEB libopencolorio-dev $OCIO_VERSION_MIN $OCIO_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_DEB libopencolorio-dev
clean_OCIO
@@ -4122,7 +4131,7 @@ install_DEB() {
INFO "Forced ILMBase/OpenEXR building, as requested..."
compile_OPENEXR
else
check_package_version_ge_lt_DEB libopenexr-dev $OPENEXR_VERSION_MIN $OPENEXR_VERSION_MAX
check_package_version_ge_lt_DEB libopenexr-dev $OPENEXR_VERSION_MIN $OPENEXR_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_DEB libopenexr-dev
OPENEXR_VERSION=`get_package_version_DEB libopenexr-dev`
@@ -4143,7 +4152,7 @@ install_DEB() {
INFO "Forced OpenImageIO building, as requested..."
compile_OIIO
else
check_package_version_ge_lt_DEB libopenimageio-dev $OIIO_VERSION_MIN $OIIO_VERSION_MAX
check_package_version_ge_lt_DEB libopenimageio-dev $OIIO_VERSION_MIN $OIIO_VERSION_MEX
if [ $? -eq 0 -a "$_with_built_openexr" = false ]; then
install_packages_DEB libopenimageio-dev openimageio-tools
clean_OIIO
@@ -4163,7 +4172,7 @@ install_DEB() {
INFO "Forced LLVM building, as requested..."
_do_compile_llvm=true
else
check_package_version_ge_lt_DEB llvm-dev $LLVM_VERSION_MIN $LLVM_VERSION_MAX
check_package_version_ge_lt_DEB llvm-dev $LLVM_VERSION_MIN $LLVM_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_DEB llvm-dev clang libclang-dev
have_llvm=true
@@ -4194,7 +4203,7 @@ install_DEB() {
INFO "Forced OpenShadingLanguage building, as requested..."
_do_compile_osl=true
else
check_package_version_ge_lt_DEB libopenshadinglanguage-dev $OSL_VERSION_MIN $OSL_VERSION_MAX
check_package_version_ge_lt_DEB libopenshadinglanguage-dev $OSL_VERSION_MIN $OSL_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_DEB libopenshadinglanguage-dev
clean_OSL
@@ -4232,7 +4241,7 @@ install_DEB() {
INFO "Forced OpenVDB building, as requested..."
compile_OPENVDB
else
check_package_version_ge_lt_DEB libopenvdb-dev $OPENVDB_VERSION_MIN $OPENVDB_VERSION_MAX
check_package_version_ge_lt_DEB libopenvdb-dev $OPENVDB_VERSION_MIN $OPENVDB_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_DEB libopenvdb-dev libblosc-dev
clean_OPENVDB
@@ -4294,7 +4303,7 @@ install_DEB() {
_do_compile_embree=true
else
# There is a package, but it does not provide everything that Blender needs...
#~ check_package_version_ge_lt_DEB libembree-dev $EMBREE_VERSION_MIN $EMBREE_VERSION_MAX
#~ check_package_version_ge_lt_DEB libembree-dev $EMBREE_VERSION_MIN $EMBREE_VERSION_MEX
#~ if [ $? -eq 0 ]; then
#~ install_packages_DEB libembree-dev
#~ clean_Embree
@@ -4336,7 +4345,7 @@ install_DEB() {
# XXX Debian Testing / Ubuntu 16.04 finally includes FFmpeg, so check as usual
check_package_DEB ffmpeg
if [ $? -eq 0 ]; then
check_package_version_ge_lt_DEB ffmpeg $FFMPEG_VERSION_MIN $FFMPEG_VERSION_MAX
check_package_version_ge_lt_DEB ffmpeg $FFMPEG_VERSION_MIN $FFMPEG_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_DEB libavdevice-dev
clean_FFmpeg
@@ -4670,7 +4679,7 @@ install_RPM() {
INFO "Forced Python building, as requested..."
_do_compile_python=true
else
check_package_version_ge_lt_RPM python3-devel $PYTHON_VERSION_MIN $PYTHON_VERSION_MAX
check_package_version_ge_lt_RPM python3-devel $PYTHON_VERSION_MIN $PYTHON_VERSION_MEX
if [ $? -eq 0 ]; then
PYTHON_VERSION_INSTALLED=$(echo `get_package_version_RPM python3-devel` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
@@ -4682,8 +4691,8 @@ install_RPM() {
module=($module)
package="python3-${module[0]}"
package_vmin=${module[1]}
package_vmax=${module[2]}
check_package_version_ge_lt_RPM "$package" $package_vmin $package_vmax
package_vmex=${module[2]}
check_package_version_ge_lt_RPM "$package" $package_vmin $package_vmex
if [ $? -eq 0 ]; then
install_packages_RPM "$package"
else
@@ -4710,7 +4719,7 @@ install_RPM() {
INFO "Forced Boost building, as requested..."
_do_compile_boost=true
else
check_package_version_ge_lt_RPM boost-devel $BOOST_VERSION_MIN $BOOST_VERSION_MAX
check_package_version_ge_lt_RPM boost-devel $BOOST_VERSION_MIN $BOOST_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_RPM boost-devel
clean_Boost
@@ -4737,7 +4746,7 @@ install_RPM() {
INFO "Forced TBB building, as requested..."
compile_TBB
else
check_package_version_ge_lt_RPM tbb-devel $TBB_VERSION_MIN $TBB_VERSION_MAX
check_package_version_ge_lt_RPM tbb-devel $TBB_VERSION_MIN $TBB_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_RPM tbb-devel
clean_TBB
@@ -4755,7 +4764,7 @@ install_RPM() {
compile_OCIO
else
if [ "$RPM" = "SUSE" ]; then
check_package_version_ge_lt_RPM OpenColorIO-devel $OCIO_VERSION_MIN $OCIO_VERSION_MAX
check_package_version_ge_lt_RPM OpenColorIO-devel $OCIO_VERSION_MIN $OCIO_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_RPM OpenColorIO-devel
clean_OCIO
@@ -4775,7 +4784,7 @@ install_RPM() {
INFO "Forced ILMBase/OpenEXR building, as requested..."
compile_OPENEXR
else
check_package_version_ge_lt_RPM openexr-devel $OPENEXR_VERSION_MIN $OPENEXR_VERSION_MAX
check_package_version_ge_lt_RPM openexr-devel $OPENEXR_VERSION_MIN $OPENEXR_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_RPM openexr-devel
OPENEXR_VERSION=`get_package_version_RPM openexr-devel`
@@ -4793,7 +4802,7 @@ install_RPM() {
INFO "Forced OpenImageIO building, as requested..."
compile_OIIO
else
check_package_version_ge_lt_RPM OpenImageIO-devel $OIIO_VERSION_MIN $OIIO_VERSION_MAX
check_package_version_ge_lt_RPM OpenImageIO-devel $OIIO_VERSION_MIN $OIIO_VERSION_MEX
if [ $? -eq 0 -a $_with_built_openexr == false ]; then
install_packages_RPM OpenImageIO-devel OpenImageIO-utils
clean_OIIO
@@ -4818,7 +4827,7 @@ install_RPM() {
else
CLANG_DEV="clang-devel"
fi
check_package_version_ge_lt_RPM llvm-devel $LLVM_VERSION_MIN $LLVM_VERSION_MAX
check_package_version_ge_lt_RPM llvm-devel $LLVM_VERSION_MIN $LLVM_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_RPM llvm-devel $CLANG_DEV
have_llvm=true
@@ -4854,7 +4863,7 @@ install_RPM() {
else
OSL_DEV="openshadinglanguage-devel"
fi
check_package_version_ge_lt_RPM $OSL_DEV $OSL_VERSION_MIN $OSL_VERSION_MAX
check_package_version_ge_lt_RPM $OSL_DEV $OSL_VERSION_MIN $OSL_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_RPM $OSL_DEV
clean_OSL
@@ -4949,7 +4958,7 @@ install_RPM() {
_do_compile_embree=true
else
# There is a package, but it does not provide everything that Blender needs...
#~ check_package_version_ge_lt_RPM embree-devel $EMBREE_VERSION_MIN $EMBREE_VERSION_MAX
#~ check_package_version_ge_lt_RPM embree-devel $EMBREE_VERSION_MIN $EMBREE_VERSION_MEX
#~ if [ $? -eq 0 ]; then
#~ install_packages_RPM embree-devel
#~ clean_Embree
@@ -4988,7 +4997,7 @@ install_RPM() {
INFO "Forced FFMpeg building, as requested..."
compile_FFmpeg
else
check_package_version_ge_lt_RPM ffmpeg-devel $FFMPEG_VERSION_MIN $FFMPEG_VERSION_MAX
check_package_version_ge_lt_RPM ffmpeg-devel $FFMPEG_VERSION_MIN $FFMPEG_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_RPM ffmpeg ffmpeg-devel
clean_FFmpeg
@@ -5213,7 +5222,7 @@ install_ARCH() {
INFO "Forced Python building, as requested..."
_do_compile_python=true
else
check_package_version_ge_lt_ARCH python $PYTHON_VERSION_MIN $PYTHON_VERSION_MAX
check_package_version_ge_lt_ARCH python $PYTHON_VERSION_MIN $PYTHON_VERSION_MEX
if [ $? -eq 0 ]; then
PYTHON_VERSION_INSTALLED=$(echo `get_package_version_ARCH python` | sed -r 's/^([0-9]+\.[0-9]+).*/\1/')
@@ -5226,8 +5235,8 @@ install_ARCH() {
module=($module)
package="python-${module[0]}"
package_vmin=${module[1]}
package_vmax=${module[2]}
check_package_version_ge_lt_ARCH "$package" $package_vmin $package_vmax
package_vmex=${module[2]}
check_package_version_ge_lt_ARCH "$package" $package_vmin $package_vmex
if [ $? -eq 0 ]; then
install_packages_ARCH "$package"
else
@@ -5253,7 +5262,7 @@ install_ARCH() {
INFO "Forced Boost building, as requested..."
compile_Boost
else
check_package_version_ge_lt_ARCH boost $BOOST_VERSION_MIN $BOOST_VERSION_MAX
check_package_version_ge_lt_ARCH boost $BOOST_VERSION_MIN $BOOST_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_ARCH boost
clean_Boost
@@ -5270,7 +5279,7 @@ install_ARCH() {
INFO "Forced TBB building, as requested..."
compile_TBB
else
check_package_version_ge_lt_ARCH intel-tbb $TBB_VERSION_MIN $TBB_VERSION_MAX
check_package_version_ge_lt_ARCH intel-tbb $TBB_VERSION_MIN $TBB_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_ARCH intel-tbb
clean_TBB
@@ -5287,7 +5296,7 @@ install_ARCH() {
INFO "Forced OpenColorIO building, as requested..."
compile_OCIO
else
check_package_version_ge_lt_ARCH opencolorio $OCIO_VERSION_MIN $OCIO_VERSION_MAX
check_package_version_ge_lt_ARCH opencolorio $OCIO_VERSION_MIN $OCIO_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_ARCH opencolorio
clean_OCIO
@@ -5304,7 +5313,7 @@ install_ARCH() {
INFO "Forced ILMBase/OpenEXR building, as requested..."
compile_OPENEXR
else
check_package_version_ge_lt_ARCH openexr $OPENEXR_VERSION_MIN $OPENEXR_VERSION_MAX
check_package_version_ge_lt_ARCH openexr $OPENEXR_VERSION_MIN $OPENEXR_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_ARCH openexr
OPENEXR_VERSION=`get_package_version_ARCH openexr`
@@ -5323,7 +5332,7 @@ install_ARCH() {
INFO "Forced OpenImageIO building, as requested..."
compile_OIIO
else
check_package_version_ge_lt_ARCH openimageio $OIIO_VERSION_MIN $OIIO_VERSION_MAX
check_package_version_ge_lt_ARCH openimageio $OIIO_VERSION_MIN $OIIO_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_ARCH openimageio
clean_OIIO
@@ -5343,7 +5352,7 @@ install_ARCH() {
INFO "Forced LLVM building, as requested..."
_do_compile_llvm=true
else
check_package_version_ge_lt_ARCH llvm $LLVM_VERSION_MIN $LLVM_VERSION_MAX
check_package_version_ge_lt_ARCH llvm $LLVM_VERSION_MIN $LLVM_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_ARCH llvm clang
have_llvm=true
@@ -5374,7 +5383,7 @@ install_ARCH() {
INFO "Forced OpenShadingLanguage building, as requested..."
_do_compile_osl=true
else
check_package_version_ge_lt_ARCH openshadinglanguage $OSL_VERSION_MIN $OSL_VERSION_MAX
check_package_version_ge_lt_ARCH openshadinglanguage $OSL_VERSION_MIN $OSL_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_ARCH openshadinglanguage
clean_OSL
@@ -5400,7 +5409,7 @@ install_ARCH() {
INFO "Forced OpenSubdiv building, as requested..."
compile_OSD
else
check_package_version_ge_lt_ARCH opensubdiv $OSD_VERSION_MIN $OSD_VERSION_MAX
check_package_version_ge_lt_ARCH opensubdiv $OSD_VERSION_MIN $OSD_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_ARCH opensubdiv
clean_OSD
@@ -5417,7 +5426,7 @@ install_ARCH() {
INFO "Forced OpenVDB building, as requested..."
compile_OPENVDB
else
check_package_version_ge_lt_ARCH openvdb $OPENVDB_VERSION_MIN $OPENVDB_VERSION_MAX
check_package_version_ge_lt_ARCH openvdb $OPENVDB_VERSION_MIN $OPENVDB_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_ARCH openvdb
clean_OPENVDB
@@ -5483,7 +5492,7 @@ install_ARCH() {
_do_compile_embree=true
else
# There is a package, but it does not provide everything that Blender needs...
#~ check_package_version_ge_lt_ARCH embree $EMBREE_VERSION_MIN $EMBREE_VERSION_MAX
#~ check_package_version_ge_lt_ARCH embree $EMBREE_VERSION_MIN $EMBREE_VERSION_MEX
#~ if [ $? -eq 0 ]; then
#~ install_packages_ARCH embree
#~ clean_Embree
@@ -5522,7 +5531,7 @@ install_ARCH() {
INFO "Forced FFMpeg building, as requested..."
compile_FFmpeg
else
check_package_version_ge_lt_ARCH ffmpeg $FFMPEG_VERSION_MIN $FFMPEG_VERSION_MAX
check_package_version_ge_lt_ARCH ffmpeg $FFMPEG_VERSION_MIN $FFMPEG_VERSION_MEX
if [ $? -eq 0 ]; then
install_packages_ARCH ffmpeg
clean_FFmpeg

View File

@@ -0,0 +1,374 @@
Index: nanovdb/nanovdb/NanoVDB.h
===================================================================
--- a/nanovdb/nanovdb/NanoVDB.h (revision 62751)
+++ b/nanovdb/nanovdb/NanoVDB.h (working copy)
@@ -152,8 +152,8 @@
#endif // __CUDACC_RTC__
-#ifdef __CUDACC__
-// Only define __hostdev__ when using NVIDIA CUDA compiler
+#if defined(__CUDACC__) || defined(__HIP__)
+// Only define __hostdev__ when using NVIDIA CUDA or HIP compiler
#define __hostdev__ __host__ __device__
#else
#define __hostdev__
@@ -461,7 +461,7 @@
/// Maximum floating-point values
template<typename T>
struct Maximum;
-#ifdef __CUDA_ARCH__
+#if defined(__CUDA_ARCH__) || defined(__HIP__)
template<>
struct Maximum<int>
{
@@ -1006,10 +1006,10 @@
using Vec3i = Vec3<int>;
/// @brief Return a single precision floating-point vector of this coordinate
-Vec3f Coord::asVec3s() const { return Vec3f(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
+inline __hostdev__ Vec3f Coord::asVec3s() const { return Vec3f(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
/// @brief Return a double precision floating-point vector of this coordinate
-Vec3d Coord::asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
+inline __hostdev__ Vec3d Coord::asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
// ----------------------------> Vec4 <--------------------------------------
@@ -1820,7 +1820,7 @@
}; // Map
template<typename Mat4T>
-void Map::set(const Mat4T& mat, const Mat4T& invMat, double taper)
+__hostdev__ void Map::set(const Mat4T& mat, const Mat4T& invMat, double taper)
{
float * mf = mMatF, *vf = mVecF;
float* mif = mInvMatF;
@@ -2170,7 +2170,7 @@
}; // Class Grid
template<typename TreeT>
-int Grid<TreeT>::findBlindDataForSemantic(GridBlindDataSemantic semantic) const
+__hostdev__ int Grid<TreeT>::findBlindDataForSemantic(GridBlindDataSemantic semantic) const
{
for (uint32_t i = 0, n = blindDataCount(); i < n; ++i)
if (blindMetaData(i).mSemantic == semantic)
@@ -2328,7 +2328,7 @@
}; // Tree class
template<typename RootT>
-void Tree<RootT>::extrema(ValueType& min, ValueType& max) const
+__hostdev__ void Tree<RootT>::extrema(ValueType& min, ValueType& max) const
{
min = this->root().valueMin();
max = this->root().valueMax();
@@ -2336,7 +2336,7 @@
template<typename RootT>
template<typename NodeT>
-const NodeT* Tree<RootT>::getNode(uint32_t i) const
+__hostdev__ const NodeT* Tree<RootT>::getNode(uint32_t i) const
{
static_assert(is_same<TreeNodeT<NodeT::LEVEL>, NodeT>::value, "Tree::getNode: unvalid node type");
NANOVDB_ASSERT(i < DataType::mCount[NodeT::LEVEL]);
@@ -2345,7 +2345,7 @@
template<typename RootT>
template<int LEVEL>
-const typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i) const
+__hostdev__ const typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i) const
{
NANOVDB_ASSERT(i < DataType::mCount[LEVEL]);
return reinterpret_cast<const TreeNodeT<LEVEL>*>(reinterpret_cast<const uint8_t*>(this) + DataType::mBytes[LEVEL]) + i;
@@ -2353,7 +2353,7 @@
template<typename RootT>
template<typename NodeT>
-NodeT* Tree<RootT>::getNode(uint32_t i)
+__hostdev__ NodeT* Tree<RootT>::getNode(uint32_t i)
{
static_assert(is_same<TreeNodeT<NodeT::LEVEL>, NodeT>::value, "Tree::getNode: invalid node type");
NANOVDB_ASSERT(i < DataType::mCount[NodeT::LEVEL]);
@@ -2362,7 +2362,7 @@
template<typename RootT>
template<int LEVEL>
-typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i)
+__hostdev__ typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i)
{
NANOVDB_ASSERT(i < DataType::mCount[LEVEL]);
return reinterpret_cast<TreeNodeT<LEVEL>*>(reinterpret_cast<uint8_t*>(this) + DataType::mBytes[LEVEL]) + i;
@@ -2370,7 +2370,7 @@
template<typename RootT>
template<typename NodeT>
-uint32_t Tree<RootT>::getNodeID(const NodeT& node) const
+__hostdev__ uint32_t Tree<RootT>::getNodeID(const NodeT& node) const
{
static_assert(is_same<TreeNodeT<NodeT::LEVEL>, NodeT>::value, "Tree::getNodeID: invalid node type");
const NodeT* first = reinterpret_cast<const NodeT*>(reinterpret_cast<const uint8_t*>(this) + DataType::mBytes[NodeT::LEVEL]);
@@ -2380,7 +2380,7 @@
template<typename RootT>
template<typename NodeT>
-uint32_t Tree<RootT>::getLinearOffset(const NodeT& node) const
+__hostdev__ uint32_t Tree<RootT>::getLinearOffset(const NodeT& node) const
{
return this->getNodeID(node) + DataType::mPFSum[NodeT::LEVEL];
}
@@ -3366,7 +3366,7 @@
}; // LeafNode class
template<typename ValueT, typename CoordT, template<uint32_t> class MaskT, uint32_t LOG2DIM>
-inline void LeafNode<ValueT, CoordT, MaskT, LOG2DIM>::updateBBox()
+inline __hostdev__ void LeafNode<ValueT, CoordT, MaskT, LOG2DIM>::updateBBox()
{
static_assert(LOG2DIM == 3, "LeafNode::updateBBox: only supports LOGDIM = 3!");
if (!this->isActive()) return;
Index: nanovdb/nanovdb/util/SampleFromVoxels.h
===================================================================
--- a/nanovdb/nanovdb/util/SampleFromVoxels.h (revision 62751)
+++ b/nanovdb/nanovdb/util/SampleFromVoxels.h (working copy)
@@ -22,7 +22,7 @@
#define NANOVDB_SAMPLE_FROM_VOXELS_H_HAS_BEEN_INCLUDED
// Only define __hostdev__ when compiling as NVIDIA CUDA
-#ifdef __CUDACC__
+#if defined(__CUDACC__) || defined(__HIP__)
#define __hostdev__ __host__ __device__
#else
#include <cmath> // for floor
@@ -136,7 +136,7 @@
template<typename TreeOrAccT>
template<typename Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const Vec3T& xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const Vec3T& xyz) const
{
const CoordT ijk = Round<CoordT>(xyz);
if (ijk != mPos) {
@@ -147,7 +147,7 @@
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const CoordT& ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const CoordT& ijk) const
{
if (ijk != mPos) {
mPos = ijk;
@@ -158,7 +158,7 @@
template<typename TreeOrAccT>
template<typename Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, false>::operator()(const Vec3T& xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, false>::operator()(const Vec3T& xyz) const
{
return mAcc.getValue(Round<CoordT>(xyz));
}
@@ -195,7 +195,7 @@
}; // TrilinearSamplerBase
template<typename TreeOrAccT>
-void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) const
+__hostdev__ void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) const
{
v[0][0][0] = mAcc.getValue(ijk); // i, j, k
@@ -224,7 +224,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
+__hostdev__ typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
{
#if 0
auto lerp = [](ValueT a, ValueT b, ValueT w){ return fma(w, b-a, a); };// = w*(b-a) + a
@@ -239,7 +239,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
+__hostdev__ Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
{
static_assert(std::is_floating_point<ValueT>::value, "TrilinearSampler::gradient requires a floating-point type");
#if 0
@@ -270,7 +270,7 @@
}
template<typename TreeOrAccT>
-bool TrilinearSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[2][2][2])
+__hostdev__ bool TrilinearSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[2][2][2])
{
static_assert(std::is_floating_point<ValueT>::value, "TrilinearSampler::zeroCrossing requires a floating-point type");
const bool less = v[0][0][0] < ValueT(0);
@@ -363,7 +363,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mVal);
@@ -370,7 +370,7 @@
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(const CoordT &ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(const CoordT &ijk) const
{
return ijk == mPos ? mVal[0][0][0] : BaseT::mAcc.getValue(ijk);
}
@@ -377,7 +377,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, true>::gradient(Vec3T<RealT> xyz) const
+__hostdev__ Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, true>::gradient(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::gradient(xyz, mVal);
@@ -393,7 +393,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {
@@ -406,7 +406,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -418,7 +418,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
{
auto lerp = [](ValueT a, ValueT b, RealT w) { return a + ValueT(w) * (b - a); };
@@ -463,7 +463,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-inline Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, false>::gradient(Vec3T<RealT> xyz) const
+inline __hostdev__ Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, false>::gradient(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -473,7 +473,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-bool SampleFromVoxels<TreeOrAccT, 1, false>::zeroCrossing(Vec3T<RealT> xyz) const
+__hostdev__ bool SampleFromVoxels<TreeOrAccT, 1, false>::zeroCrossing(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -510,7 +510,7 @@
}; // TriquadraticSamplerBase
template<typename TreeOrAccT>
-void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][3][3]) const
+__hostdev__ void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][3][3]) const
{
CoordT p(ijk[0] - 1, 0, 0);
for (int dx = 0; dx < 3; ++dx, ++p[0]) {
@@ -526,7 +526,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[3][3][3])
+__hostdev__ typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[3][3][3])
{
auto kernel = [](const ValueT* value, double weight)->ValueT {
return weight * (weight * (0.5f * (value[0] + value[2]) - value[1]) +
@@ -545,7 +545,7 @@
}
template<typename TreeOrAccT>
-bool TriquadraticSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[3][3][3])
+__hostdev__ bool TriquadraticSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[3][3][3])
{
static_assert(std::is_floating_point<ValueT>::value, "TrilinearSampler::zeroCrossing requires a floating-point type");
const bool less = v[0][0][0] < ValueT(0);
@@ -624,7 +624,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mVal);
@@ -631,7 +631,7 @@
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(const CoordT &ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(const CoordT &ijk) const
{
return ijk == mPos ? mVal[1][1][1] : BaseT::mAcc.getValue(ijk);
}
@@ -646,7 +646,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {
@@ -657,7 +657,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator()(Vec3T<RealT> xyz) const
{
ValueT val[3][3][3];
CoordT ijk = Floor<CoordT>(xyz);
@@ -667,7 +667,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-bool SampleFromVoxels<TreeOrAccT, 2, false>::zeroCrossing(Vec3T<RealT> xyz) const
+__hostdev__ bool SampleFromVoxels<TreeOrAccT, 2, false>::zeroCrossing(Vec3T<RealT> xyz) const
{
ValueT val[3][3][3];
CoordT ijk = Floor<CoordT>(xyz);
@@ -710,7 +710,7 @@
}; // TricubicSampler
template<typename TreeOrAccT>
-void TricubicSampler<TreeOrAccT>::stencil(const CoordT& ijk, ValueT (&C)[64]) const
+__hostdev__ void TricubicSampler<TreeOrAccT>::stencil(const CoordT& ijk, ValueT (&C)[64]) const
{
auto fetch = [&](int i, int j, int k) -> ValueT& { return C[((i + 1) << 4) + ((j + 1) << 2) + k + 1]; };
@@ -929,7 +929,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mC);
@@ -937,7 +937,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 3, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 3, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {

View File

@@ -1,27 +0,0 @@
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
index ba2b1f4..b10f7df 100644
--- a/numpy/distutils/system_info.py
+++ b/numpy/distutils/system_info.py
@@ -2164,8 +2164,8 @@ class accelerate_info(system_info):
'accelerate' in libraries):
if intel:
args.extend(['-msse3'])
- else:
- args.extend(['-faltivec'])
+# else:
+# args.extend(['-faltivec'])
args.extend([
'-I/System/Library/Frameworks/vecLib.framework/Headers'])
link_args.extend(['-Wl,-framework', '-Wl,Accelerate'])
@@ -2174,8 +2174,8 @@ class accelerate_info(system_info):
'veclib' in libraries):
if intel:
args.extend(['-msse3'])
- else:
- args.extend(['-faltivec'])
+# else:
+# args.extend(['-faltivec'])
args.extend([
'-I/System/Library/Frameworks/vecLib.framework/Headers'])
link_args.extend(['-Wl,-framework', '-Wl,vecLib'])

View File

@@ -79,6 +79,9 @@ set STAGING=%BUILD_DIR%\S
rem for python module build
set MSSdk=1
set DISTUTILS_USE_SDK=1
rem if you let pip pick its own build dirs, it'll stick it somewhere deep inside the user profile
rem and cython will refuse to link due to a path that gets too long.
set TMPDIR=c:\t\
rem for python externals source to be shared between the various archs and compilers
mkdir %BUILD_DIR%\downloads\externals

View File

@@ -0,0 +1,81 @@
# - Find HIP compiler
#
# This module defines
# HIP_HIPCC_EXECUTABLE, the full path to the hipcc executable
# HIP_VERSION, the HIP compiler version
#
# HIP_FOUND, if the HIP toolkit is found.
#=============================================================================
# Copyright 2021 Blender Foundation.
#
# Distributed under the OSI-approved BSD 3-Clause License,
# see accompanying file BSD-3-Clause-license.txt for details.
#=============================================================================
# If HIP_ROOT_DIR was defined in the environment, use it.
if(NOT HIP_ROOT_DIR AND NOT $ENV{HIP_ROOT_DIR} STREQUAL "")
set(HIP_ROOT_DIR $ENV{HIP_ROOT_DIR})
endif()
set(_hip_SEARCH_DIRS
${HIP_ROOT_DIR}
)
find_program(HIP_HIPCC_EXECUTABLE
NAMES
hipcc
HINTS
${_hip_SEARCH_DIRS}
PATH_SUFFIXES
bin
)
if(HIP_HIPCC_EXECUTABLE AND NOT EXISTS ${HIP_HIPCC_EXECUTABLE})
message(WARNING "Cached or directly specified hipcc executable does not exist.")
set(HIP_FOUND FALSE)
elseif(HIP_HIPCC_EXECUTABLE)
set(HIP_FOUND TRUE)
set(HIP_VERSION_MAJOR 0)
set(HIP_VERSION_MINOR 0)
set(HIP_VERSION_PATCH 0)
# Get version from the output.
execute_process(COMMAND ${HIP_HIPCC_EXECUTABLE} --version
OUTPUT_VARIABLE HIP_VERSION_RAW
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Parse parts.
if(HIP_VERSION_RAW MATCHES "HIP version: .*")
# Strip the HIP prefix and get list of individual version components.
string(REGEX REPLACE
".*HIP version: ([.0-9]+).*" "\\1"
HIP_SEMANTIC_VERSION "${HIP_VERSION_RAW}")
string(REPLACE "." ";" HIP_VERSION_PARTS "${HIP_SEMANTIC_VERSION}")
list(LENGTH HIP_VERSION_PARTS NUM_HIP_VERSION_PARTS)
# Extract components into corresponding variables.
if(NUM_HIP_VERSION_PARTS GREATER 0)
list(GET HIP_VERSION_PARTS 0 HIP_VERSION_MAJOR)
endif()
if(NUM_HIP_VERSION_PARTS GREATER 1)
list(GET HIP_VERSION_PARTS 1 HIP_VERSION_MINOR)
endif()
if(NUM_HIP_VERSION_PARTS GREATER 2)
list(GET HIP_VERSION_PARTS 2 HIP_VERSION_PATCH)
endif()
# Unset temp variables.
unset(NUM_HIP_VERSION_PARTS)
unset(HIP_SEMANTIC_VERSION)
unset(HIP_VERSION_PARTS)
endif()
# Construct full semantic version.
set(HIP_VERSION "${HIP_VERSION_MAJOR}.${HIP_VERSION_MINOR}.${HIP_VERSION_PATCH}")
unset(HIP_VERSION_RAW)
else()
set(HIP_FOUND FALSE)
endif()

View File

@@ -168,7 +168,7 @@ def function_parm_wash_tokens(parm):
# if tokens[-1].kind == To
# remove trailing char
if tokens[-1].kind == TokenKind.PUNCTUATION:
if tokens[-1].spelling in (",", ")", ";"):
if tokens[-1].spelling in {",", ")", ";"}:
tokens.pop()
# else:
# print(tokens[-1].spelling)
@@ -179,7 +179,7 @@ def function_parm_wash_tokens(parm):
t_spelling = t.spelling
ok = True
if t_kind == TokenKind.KEYWORD:
if t_spelling in ("const", "restrict", "volatile"):
if t_spelling in {"const", "restrict", "volatile"}:
ok = False
elif t_spelling.startswith("__"):
ok = False # __restrict

View File

@@ -180,7 +180,7 @@ def create_nb_project_main():
f.write(' </logicalFolder>\n')
f.write(' </logicalFolder>\n')
# default, but this dir is infact not in blender dir so we can ignore it
# default, but this dir is in fact not in blender dir so we can ignore it
# f.write(' <sourceFolderFilter>^(nbproject)$</sourceFolderFilter>\n')
f.write(r' <sourceFolderFilter>^(nbproject|__pycache__|.*\.py|.*\.html|.*\.blend)$</sourceFolderFilter>\n')

View File

@@ -24,6 +24,7 @@ import project_source_info
import subprocess
import sys
import os
import tempfile
from typing import (
Any,
@@ -35,7 +36,6 @@ USE_QUIET = (os.environ.get("QUIET", None) is not None)
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
CHECKER_BIN = "cppcheck"
@@ -47,13 +47,19 @@ CHECKER_ARGS = [
"--max-configs=1", # speeds up execution
# "--check-config", # when includes are missing
"--enable=all", # if you want sixty hundred pedantic suggestions
# Quiet output, otherwise all defines/includes are printed (overly verbose).
# Only enable this for troubleshooting (if defines are not set as expected for example).
"--quiet",
# NOTE: `--cppcheck-build-dir=<dir>` is added later as a temporary directory.
]
if USE_QUIET:
CHECKER_ARGS.append("--quiet")
def main() -> None:
def cppcheck() -> None:
source_info = project_source_info.build_info(ignore_prefix_list=CHECKER_IGNORE_PREFIX)
source_defines = project_source_info.build_defines_as_args()
@@ -78,7 +84,10 @@ def main() -> None:
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.flush()
sys.stdout.write("%s " % percent_str)
sys.stdout.write("%s %s\n" % (
percent_str,
os.path.relpath(c, project_source_info.SOURCE_DIR)
))
return subprocess.Popen(cmd)
@@ -90,5 +99,11 @@ def main() -> None:
print("Finished!")
def main() -> None:
with tempfile.TemporaryDirectory() as temp_dir:
CHECKER_ARGS.append("--cppcheck-build-dir=" + temp_dir)
cppcheck()
if __name__ == "__main__":
main()

View File

@@ -9,6 +9,7 @@ set(WITH_INSTALL_PORTABLE ON CACHE BOOL "" FORCE)
set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)
set(WITH_AUDASPACE OFF CACHE BOOL "" FORCE)
set(WITH_BLENDER_THUMBNAILER OFF CACHE BOOL "" FORCE)
set(WITH_BOOST OFF CACHE BOOL "" FORCE)
set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE)
set(WITH_BULLET OFF CACHE BOOL "" FORCE)

View File

@@ -81,4 +81,5 @@ if(NOT APPLE)
set(WITH_CYCLES_DEVICE_OPTIX ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_CUDA_BINARIES ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_CUBIN_COMPILER OFF CACHE BOOL "" FORCE)
set(WITH_CYCLES_HIP_BINARIES ON CACHE BOOL "" FORCE)
endif()

View File

@@ -529,7 +529,7 @@ function(SETUP_LIBDIRS)
# NOTE: For all new libraries, use absolute library paths.
# This should eventually be phased out.
# APPLE plaform uses full paths for linking libraries, and avoids link_directories.
# APPLE platform uses full paths for linking libraries, and avoids link_directories.
if(NOT MSVC AND NOT APPLE)
link_directories(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH})

View File

@@ -27,7 +27,7 @@ if(NOT MSVC)
endif()
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(MSVC_CLANG On)
set(MSVC_CLANG ON)
set(VC_TOOLS_DIR $ENV{VCToolsRedistDir} CACHE STRING "Location of the msvc redistributables")
set(MSVC_REDIST_DIR ${VC_TOOLS_DIR})
if(DEFINED MSVC_REDIST_DIR)
@@ -53,7 +53,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
endif()
if(WITH_WINDOWS_STRIPPED_PDB)
message(WARNING "stripped pdb not supported with clang, disabling..")
set(WITH_WINDOWS_STRIPPED_PDB Off)
set(WITH_WINDOWS_STRIPPED_PDB OFF)
endif()
endif()
@@ -159,7 +159,7 @@ endif()
if(WITH_COMPILER_ASAN AND MSVC AND NOT MSVC_CLANG)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.28.29828)
#set a flag so we don't have to do this comparison all the time
SET(MSVC_ASAN On)
SET(MSVC_ASAN ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fsanitize=address")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fsanitize=address")
string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG " /INCREMENTAL:NO")
@@ -179,22 +179,22 @@ endif()
if(WITH_WINDOWS_SCCACHE AND CMAKE_VS_MSBUILD_COMMAND)
message(WARNING "Disabling sccache, sccache is not supported with msbuild")
set(WITH_WINDOWS_SCCACHE Off)
set(WITH_WINDOWS_SCCACHE OFF)
endif()
# Debug Symbol format
# sccache # MSVC_ASAN # format # why
# On # On # Z7 # sccache will only play nice with Z7
# On # Off # Z7 # sccache will only play nice with Z7
# Off # On # Zi # Asan will not play nice with Edit and Continue
# Off # Off # ZI # Neither asan nor sscache is enabled Edit and Continue is available
# ON # ON # Z7 # sccache will only play nice with Z7
# ON # OFF # Z7 # sccache will only play nice with Z7
# OFF # ON # Zi # Asan will not play nice with Edit and Continue
# OFF # OFF # ZI # Neither asan nor sscache is enabled Edit and Continue is available
# Release Symbol format
# sccache # MSVC_ASAN # format # why
# On # On # Z7 # sccache will only play nice with Z7
# On # Off # Z7 # sccache will only play nice with Z7
# Off # On # Zi # Asan will not play nice with Edit and Continue
# Off # Off # Zi # Edit and Continue disables some optimizations
# ON # ON # Z7 # sccache will only play nice with Z7
# ON # OFF # Z7 # sccache will only play nice with Z7
# OFF # ON # Zi # Asan will not play nice with Edit and Continue
# OFF # OFF # Zi # Edit and Continue disables some optimizations
if(WITH_WINDOWS_SCCACHE)
@@ -288,7 +288,7 @@ if(CMAKE_GENERATOR MATCHES "^Visual Studio.+" AND # Only supported in the VS IDE
"EnableMicrosoftCodeAnalysis=false"
"EnableClangTidyCodeAnalysis=true"
)
set(VS_CLANG_TIDY On)
set(VS_CLANG_TIDY ON)
endif()
# Mark libdir as system headers with a lower warn level, to resolve some warnings
@@ -469,7 +469,7 @@ if(WITH_PYTHON)
set(PYTHON_INCLUDE_DIR ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/include)
set(PYTHON_NUMPY_INCLUDE_DIRS ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/lib/site-packages/numpy/core/include)
set(NUMPY_FOUND On)
set(NUMPY_FOUND ON)
unset(_PYTHON_VERSION_NO_DOTS)
# uncached vars
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
@@ -853,18 +853,18 @@ if(WITH_GMP)
set(GMP_INCLUDE_DIRS ${LIBDIR}/gmp/include)
set(GMP_LIBRARIES ${LIBDIR}/gmp/lib/libgmp-10.lib optimized ${LIBDIR}/gmp/lib/libgmpxx.lib debug ${LIBDIR}/gmp/lib/libgmpxx_d.lib)
set(GMP_ROOT_DIR ${LIBDIR}/gmp)
set(GMP_FOUND On)
set(GMP_FOUND ON)
endif()
if(WITH_POTRACE)
set(POTRACE_INCLUDE_DIRS ${LIBDIR}/potrace/include)
set(POTRACE_LIBRARIES ${LIBDIR}/potrace/lib/potrace.lib)
set(POTRACE_FOUND On)
set(POTRACE_FOUND ON)
endif()
if(WITH_HARU)
if(EXISTS ${LIBDIR}/haru)
set(HARU_FOUND On)
set(HARU_FOUND ON)
set(HARU_ROOT_DIR ${LIBDIR}/haru)
set(HARU_INCLUDE_DIRS ${HARU_ROOT_DIR}/include)
set(HARU_LIBRARIES ${HARU_ROOT_DIR}/lib/libhpdfs.lib)

View File

@@ -27,7 +27,7 @@ if(WITH_WINDOWS_BUNDLE_CRT)
# Install the CRT to the blender.crt Sub folder.
install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ./blender.crt COMPONENT Libraries)
# Generating the manifest is a relativly expensive operation since
# Generating the manifest is a relatively expensive operation since
# it is collecting an sha1 hash for every file required. so only do
# this work when the libs have either changed or the manifest does
# not exist yet.

View File

@@ -243,7 +243,9 @@ def build_defines_as_args() -> List[str]:
# use this module.
def queue_processes(
process_funcs: Sequence[Tuple[Callable[..., subprocess.Popen[Any]], Tuple[Any, ...]]],
*,
job_total: int =-1,
sleep: float = 0.1,
) -> None:
""" Takes a list of function arg pairs, each function must return a process
"""
@@ -271,14 +273,20 @@ def queue_processes(
if len(processes) <= job_total:
break
else:
time.sleep(0.1)
time.sleep(sleep)
sys.stdout.flush()
sys.stderr.flush()
processes.append(func(*args))
# Don't return until all jobs have finished.
while 1:
processes[:] = [p for p in processes if p.poll() is None]
if not processes:
break
time.sleep(sleep)
def main() -> None:
if not os.path.exists(join(CMAKE_DIR, "CMakeCache.txt")):

View File

@@ -3,7 +3,7 @@ for %%X in (svn.exe) do (set SVN=%%~$PATH:X)
for %%X in (cmake.exe) do (set CMAKE=%%~$PATH:X)
for %%X in (ctest.exe) do (set CTEST=%%~$PATH:X)
for %%X in (git.exe) do (set GIT=%%~$PATH:X)
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\37\bin\python.exe
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe
if NOT "%verbose%" == "" (
echo svn : "%SVN%"
echo cmake : "%CMAKE%"

View File

@@ -10,7 +10,7 @@ exit /b 1
echo found clang-format in %CF_PATH%
if EXIST %PYTHON% (
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\37\bin\python.exe
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe
goto detect_python_done
)

View File

@@ -116,6 +116,9 @@ if NOT "%1" == "" (
) else if "%1" == "doc_py" (
set DOC_PY=1
goto EOF
) else if "%1" == "svnfix" (
set SVN_FIX=1
goto EOF
) else (
echo Command "%1" unknown, aborting!
goto ERR

View File

@@ -0,0 +1,26 @@
if "%BUILD_VS_YEAR%"=="2017" set BUILD_VS_LIBDIRPOST=vc15
if "%BUILD_VS_YEAR%"=="2019" set BUILD_VS_LIBDIRPOST=vc15
if "%BUILD_VS_YEAR%"=="2022" set BUILD_VS_LIBDIRPOST=vc15
set BUILD_VS_SVNDIR=win64_%BUILD_VS_LIBDIRPOST%
set BUILD_VS_LIBDIR="%BLENDER_DIR%..\lib\%BUILD_VS_SVNDIR%"
echo Starting cleanup in %BUILD_VS_LIBDIR%.
cd %BUILD_VS_LIBDIR%
:RETRY
"%SVN%" cleanup
"%SVN%" update
if errorlevel 1 (
set /p LibRetry= "Error during update, retry? y/n"
if /I "!LibRetry!"=="Y" (
goto RETRY
)
echo.
echo Error: Download of external libraries failed.
echo This is needed for building, please manually run 'svn cleanup' and 'svn update' in
echo %BUILD_VS_LIBDIR% , until this is resolved you CANNOT make a successful blender build
echo.
exit /b 1
)
echo Cleanup complete

View File

@@ -38,7 +38,7 @@ PROJECT_NAME = Blender
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = V3.0
PROJECT_NUMBER = V3.1
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@@ -11,7 +11,7 @@ import queue
execution_queue = queue.Queue()
# This function can savely be called in another thread.
# This function can safely be called in another thread.
# The function will be executed when the timer runs the next time.
def run_in_main_thread(function):
execution_queue.put(function)

View File

@@ -0,0 +1,40 @@
"""
This method enables conversions between Local and Pose space for bones in
the middle of updating the armature without having to update dependencies
after each change, by manually carrying updated matrices in a recursive walk.
"""
def set_pose_matrices(obj, matrix_map):
"Assign pose space matrices of all bones at once, ignoring constraints."
def rec(pbone, parent_matrix):
matrix = matrix_map[pbone.name]
## Instead of:
# pbone.matrix = matrix
# bpy.context.view_layer.update()
# Compute and assign local matrix, using the new parent matrix
if pbone.parent:
pbone.matrix_basis = pbone.bone.convert_local_to_pose(
matrix,
pbone.bone.matrix_local,
parent_matrix=parent_matrix,
parent_matrix_local=pbone.parent.bone.matrix_local,
invert=True
)
else:
pbone.matrix_basis = pbone.bone.convert_local_to_pose(
matrix,
pbone.bone.matrix_local,
invert=True
)
# Recursively process children, passing the new matrix through
for child in pbone.children:
rec(child, matrix)
# Scan all bone trees from their roots
for pbone in obj.pose.bones:
if not pbone.parent:
rec(pbone, None)

View File

@@ -42,8 +42,13 @@ class SimpleMouseOperator(bpy.types.Operator):
self.y = event.mouse_y
return self.execute(context)
# Only needed if you want to add into a dynamic menu
def menu_func(self, context):
self.layout.operator(SimpleMouseOperator.bl_idname, text="Simple Mouse Operator")
# Register and add to the view menu (required to also use F3 search "Simple Mouse Operator" for quick access)
bpy.utils.register_class(SimpleMouseOperator)
bpy.types.VIEW3D_MT_view.append(menu_func)
# Test call to the newly defined operator.
# Here we call the operator and invoke it, meaning that the settings are taken

View File

@@ -43,7 +43,7 @@ def menu_func(self, context):
self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")
# Register and add to the file selector
# Register and add to the file selector (required to also use F3 search "Text Export Operator" for quick access)
bpy.utils.register_class(ExportSomeData)
bpy.types.TOPBAR_MT_file_export.append(menu_func)

View File

@@ -27,8 +27,14 @@ class DialogOperator(bpy.types.Operator):
wm = context.window_manager
return wm.invoke_props_dialog(self)
# Only needed if you want to add into a dynamic menu
def menu_func(self, context):
self.layout.operator(DialogOperator.bl_idname, text="Dialog Operator")
# Register and add to the object menu (required to also use F3 search "Dialog Operator" for quick access)
bpy.utils.register_class(DialogOperator)
bpy.types.VIEW3D_MT_object.append(menu_func)
# Test call.
bpy.ops.object.dialog_operator('INVOKE_DEFAULT')

View File

@@ -41,8 +41,13 @@ class CustomDrawOperator(bpy.types.Operator):
col.prop(self, "my_string")
# Only needed if you want to add into a dynamic menu
def menu_func(self, context):
self.layout.operator(CustomDrawOperator.bl_idname, text="Custom Draw Operator")
# Register and add to the object menu (required to also use F3 search "Custom Draw Operator" for quick access)
bpy.utils.register_class(CustomDrawOperator)
bpy.types.VIEW3D_MT_object.append(menu_func)
# test call
bpy.ops.object.custom_draw('INVOKE_DEFAULT')

View File

@@ -55,8 +55,13 @@ class ModalOperator(bpy.types.Operator):
context.window_manager.modal_handler_add(self)
return {'RUNNING_MODAL'}
# Only needed if you want to add into a dynamic menu
def menu_func(self, context):
self.layout.operator(ModalOperator.bl_idname, text="Modal Operator")
# Register and add to the object menu (required to also use F3 search "Modal Operator" for quick access)
bpy.utils.register_class(ModalOperator)
bpy.types.VIEW3D_MT_object.append(menu_func)
# test call
bpy.ops.object.modal_operator('INVOKE_DEFAULT')

View File

@@ -31,8 +31,13 @@ class SearchEnumOperator(bpy.types.Operator):
context.window_manager.invoke_search_popup(self)
return {'RUNNING_MODAL'}
# Only needed if you want to add into a dynamic menu
def menu_func(self, context):
self.layout.operator(SearchEnumOperator.bl_idname, text="Search Enum Operator")
# Register and add to the object menu (required to also use F3 search "Search Enum Operator" for quick access)
bpy.utils.register_class(SearchEnumOperator)
bpy.types.VIEW3D_MT_object.append(menu_func)
# test call
bpy.ops.object.search_enum_operator('INVOKE_DEFAULT')

View File

@@ -22,8 +22,13 @@ class HelloWorldOperator(bpy.types.Operator):
print("Hello World")
return {'FINISHED'}
# Only needed if you want to add into a dynamic menu
def menu_func(self, context):
self.layout.operator(HelloWorldOperator.bl_idname, text="Hello World Operator")
# Register and add to the view menu (required to also use F3 search "Hello World Operator" for quick access)
bpy.utils.register_class(HelloWorldOperator)
bpy.types.VIEW3D_MT_view.append(menu_func)
# test call to the newly defined operator
bpy.ops.wm.hello_world()

View File

@@ -32,7 +32,7 @@ def draw():
context.region,
view_matrix,
projection_matrix,
True)
do_color_management=True)
gpu.state.depth_mask_set(False)
draw_texture_2d(offscreen.texture_color, (10, 10), WIDTH, HEIGHT)

View File

@@ -106,24 +106,6 @@ including advanced features.
floating-point values. These values are interpreted as a plane equation.
.. function:: glColor (red, green, blue, alpha):
B{glColor3b, glColor3d, glColor3f, glColor3i, glColor3s, glColor3ub, glColor3ui, glColor3us,
glColor4b, glColor4d, glColor4f, glColor4i, glColor4s, glColor4ub, glColor4ui, glColor4us,
glColor3bv, glColor3dv, glColor3fv, glColor3iv, glColor3sv, glColor3ubv, glColor3uiv,
glColor3usv, glColor4bv, glColor4dv, glColor4fv, glColor4iv, glColor4sv, glColor4ubv,
glColor4uiv, glColor4usv}
Set a new color.
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glColor.xhtml>`__
:type red, green, blue, alpha: Depends on function prototype.
:arg red, green, blue: Specify new red, green, and blue values for the current color.
:arg alpha: Specifies a new alpha value for the current color. Included only in the
four-argument glColor4 commands. (With '4' colors only)
.. function:: glColorMask(red, green, blue, alpha):
Enable and disable writing of frame buffer color components

View File

@@ -728,7 +728,7 @@ Abusing RNA property callbacks
------------------------------
Python-defined RNA properties can have custom callbacks. Trying to perform complex operations
from there, like calling an operator, may work, but is not officialy recommended nor supported.
from there, like calling an operator, may work, but is not officially recommended nor supported.
Main reason is that those callback should be very fast, but additionally, it may for example
create issues with undo/redo system (most operators store an history step, and editing an RNA

View File

@@ -1101,14 +1101,18 @@ context_type_map = {
"scene": ("Scene", False),
"sculpt_object": ("Object", False),
"selectable_objects": ("Object", True),
"selected_asset_files": ("FileSelectEntry", True),
"selected_bones": ("EditBone", True),
"selected_editable_bones": ("EditBone", True),
"selected_editable_fcurves": ("FCurve", True),
"selected_editable_keyframes": ("Keyframe", True),
"selected_editable_objects": ("Object", True),
"selected_editable_sequences": ("Sequence", True),
"selected_ids": ("ID", True),
"selected_files": ("FileSelectEntry", True),
"selected_ids": ("ID", True),
"selected_nla_strips": ("NlaStrip", True),
"selected_movieclip_tracks": ("MovieTrackingTrack", True),
"selected_nodes": ("Node", True),
"selected_objects": ("Object", True),
"selected_pose_bones": ("PoseBone", True),
@@ -1220,7 +1224,10 @@ def pycontext2sphinx(basepath):
while char_array[i] is not None:
member = ctypes.string_at(char_array[i]).decode(encoding="ascii")
fw(".. data:: %s\n\n" % member)
try:
member_type, is_seq = context_type_map[member]
except KeyError:
raise SystemExit("Error: context key %r not found in context_type_map; update %s" % (member, __file__)) from None
fw(" :type: %s :class:`bpy.types.%s`\n\n" % ("sequence of " if is_seq else "", member_type))
unique.add(member)
i += 1
@@ -2247,7 +2254,7 @@ def main():
# First monkey patch to load in fake members.
setup_monkey_patch()
# Perform changes to Blender it's self.
# Perform changes to Blender itself.
setup_data = setup_blender()
# eventually, create the dirs

View File

@@ -290,7 +290,7 @@ PyDoc_STRVAR(M_aud_Sound_buffer_doc,
".. classmethod:: buffer(data, rate)\n\n"
" Creates a sound from a data buffer.\n\n"
" :arg data: The data as two dimensional numpy array.\n"
" :type data: numpy.ndarray\n"
" :type data: :class:`numpy.ndarray`\n"
" :arg rate: The sample rate.\n"
" :type rate: double\n"
" :return: The created :class:`Sound` object.\n"

View File

@@ -609,6 +609,7 @@ typedef enum cudaError_enum {
CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = 219,
CUDA_ERROR_NVLINK_UNCORRECTABLE = 220,
CUDA_ERROR_JIT_COMPILER_NOT_FOUND = 221,
CUDA_ERROR_UNSUPPORTED_PTX_VERSION = 222,
CUDA_ERROR_INVALID_SOURCE = 300,
CUDA_ERROR_FILE_NOT_FOUND = 301,
CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302,

View File

@@ -736,6 +736,7 @@ const char *cuewErrorString(CUresult result) {
case CUDA_ERROR_INVALID_GRAPHICS_CONTEXT: return "Invalid graphics context";
case CUDA_ERROR_NVLINK_UNCORRECTABLE: return "Nvlink uncorrectable";
case CUDA_ERROR_JIT_COMPILER_NOT_FOUND: return "Jit compiler not found";
case CUDA_ERROR_UNSUPPORTED_PTX_VERSION: return "Unsupported PTX version";
case CUDA_ERROR_INVALID_SOURCE: return "Invalid source";
case CUDA_ERROR_FILE_NOT_FOUND: return "File not found";
case CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND: return "Link to a shared object failed to resolve";

View File

@@ -24,9 +24,13 @@ extern "C" {
#include <stdlib.h>
#define HIP_IPC_HANDLE_SIZE 64
#define hipHostMallocDefault 0x00
#define hipHostMallocPortable 0x01
#define hipHostMallocMapped 0x02
#define hipHostMallocWriteCombined 0x04
#define hipHostMallocNumaUser 0x20000000
#define hipHostMallocCoherent 0x40000000
#define hipHostMallocNonCoherent 0x80000000
#define hipHostRegisterPortable 0x01
#define hipHostRegisterMapped 0x02
#define hipHostRegisterIoMemory 0x04
@@ -421,6 +425,105 @@ typedef struct HIPdevprop_st {
int textureAlign;
} HIPdevprop;
typedef struct {
// 32-bit Atomics
unsigned hasGlobalInt32Atomics : 1; ///< 32-bit integer atomics for global memory.
unsigned hasGlobalFloatAtomicExch : 1; ///< 32-bit float atomic exch for global memory.
unsigned hasSharedInt32Atomics : 1; ///< 32-bit integer atomics for shared memory.
unsigned hasSharedFloatAtomicExch : 1; ///< 32-bit float atomic exch for shared memory.
unsigned hasFloatAtomicAdd : 1; ///< 32-bit float atomic add in global and shared memory.
// 64-bit Atomics
unsigned hasGlobalInt64Atomics : 1; ///< 64-bit integer atomics for global memory.
unsigned hasSharedInt64Atomics : 1; ///< 64-bit integer atomics for shared memory.
// Doubles
unsigned hasDoubles : 1; ///< Double-precision floating point.
// Warp cross-lane operations
unsigned hasWarpVote : 1; ///< Warp vote instructions (__any, __all).
unsigned hasWarpBallot : 1; ///< Warp ballot instructions (__ballot).
unsigned hasWarpShuffle : 1; ///< Warp shuffle operations. (__shfl_*).
unsigned hasFunnelShift : 1; ///< Funnel two words into one with shift&mask caps.
// Sync
unsigned hasThreadFenceSystem : 1; ///< __threadfence_system.
unsigned hasSyncThreadsExt : 1; ///< __syncthreads_count, syncthreads_and, syncthreads_or.
// Misc
unsigned hasSurfaceFuncs : 1; ///< Surface functions.
unsigned has3dGrid : 1; ///< Grid and group dims are 3D (rather than 2D).
unsigned hasDynamicParallelism : 1; ///< Dynamic parallelism.
} hipDeviceArch_t;
typedef struct hipDeviceProp_t {
char name[256]; ///< Device name.
size_t totalGlobalMem; ///< Size of global memory region (in bytes).
size_t sharedMemPerBlock; ///< Size of shared memory region (in bytes).
int regsPerBlock; ///< Registers per block.
int warpSize; ///< Warp size.
int maxThreadsPerBlock; ///< Max work items per work group or workgroup max size.
int maxThreadsDim[3]; ///< Max number of threads in each dimension (XYZ) of a block.
int maxGridSize[3]; ///< Max grid dimensions (XYZ).
int clockRate; ///< Max clock frequency of the multiProcessors in khz.
int memoryClockRate; ///< Max global memory clock frequency in khz.
int memoryBusWidth; ///< Global memory bus width in bits.
size_t totalConstMem; ///< Size of shared memory region (in bytes).
int major; ///< Major compute capability. On HCC, this is an approximation and features may
///< differ from CUDA CC. See the arch feature flags for portable ways to query
///< feature caps.
int minor; ///< Minor compute capability. On HCC, this is an approximation and features may
///< differ from CUDA CC. See the arch feature flags for portable ways to query
///< feature caps.
int multiProcessorCount; ///< Number of multi-processors (compute units).
int l2CacheSize; ///< L2 cache size.
int maxThreadsPerMultiProcessor; ///< Maximum resident threads per multi-processor.
int computeMode; ///< Compute mode.
int clockInstructionRate; ///< Frequency in khz of the timer used by the device-side "clock*"
///< instructions. New for HIP.
hipDeviceArch_t arch; ///< Architectural feature flags. New for HIP.
int concurrentKernels; ///< Device can possibly execute multiple kernels concurrently.
int pciDomainID; ///< PCI Domain ID
int pciBusID; ///< PCI Bus ID.
int pciDeviceID; ///< PCI Device ID.
size_t maxSharedMemoryPerMultiProcessor; ///< Maximum Shared Memory Per Multiprocessor.
int isMultiGpuBoard; ///< 1 if device is on a multi-GPU board, 0 if not.
int canMapHostMemory; ///< Check whether HIP can map host memory
int gcnArch; ///< DEPRECATED: use gcnArchName instead
char gcnArchName[256]; ///< AMD GCN Arch Name.
int integrated; ///< APU vs dGPU
int cooperativeLaunch; ///< HIP device supports cooperative launch
int cooperativeMultiDeviceLaunch; ///< HIP device supports cooperative launch on multiple devices
int maxTexture1DLinear; ///< Maximum size for 1D textures bound to linear memory
int maxTexture1D; ///< Maximum number of elements in 1D images
int maxTexture2D[2]; ///< Maximum dimensions (width, height) of 2D images, in image elements
int maxTexture3D[3]; ///< Maximum dimensions (width, height, depth) of 3D images, in image elements
unsigned int* hdpMemFlushCntl; ///< Addres of HDP_MEM_COHERENCY_FLUSH_CNTL register
unsigned int* hdpRegFlushCntl; ///< Addres of HDP_REG_COHERENCY_FLUSH_CNTL register
size_t memPitch; ///<Maximum pitch in bytes allowed by memory copies
size_t textureAlignment; ///<Alignment requirement for textures
size_t texturePitchAlignment; ///<Pitch alignment requirement for texture references bound to pitched memory
int kernelExecTimeoutEnabled; ///<Run time limit for kernels executed on the device
int ECCEnabled; ///<Device has ECC support enabled
int tccDriver; ///< 1:If device is Tesla device using TCC driver, else 0
int cooperativeMultiDeviceUnmatchedFunc; ///< HIP device supports cooperative launch on multiple
///devices with unmatched functions
int cooperativeMultiDeviceUnmatchedGridDim; ///< HIP device supports cooperative launch on multiple
///devices with unmatched grid dimensions
int cooperativeMultiDeviceUnmatchedBlockDim; ///< HIP device supports cooperative launch on multiple
///devices with unmatched block dimensions
int cooperativeMultiDeviceUnmatchedSharedMem; ///< HIP device supports cooperative launch on multiple
///devices with unmatched shared memories
int isLargeBar; ///< 1: if it is a large PCI bar device, else 0
int asicRevision; ///< Revision of the GPU in this device
int managedMemory; ///< Device supports allocating managed memory on this system
int directManagedMemAccessFromHost; ///< Host can directly access managed memory on the device without migration
int concurrentManagedAccess; ///< Device can coherently access managed memory concurrently with the CPU
int pageableMemoryAccess; ///< Device supports coherently accessing pageable memory
///< without calling hipHostRegister on it
int pageableMemoryAccessUsesHostPageTables; ///< Device accesses pageable memory via the host's page tables
} hipDeviceProp_t;
typedef enum HIPpointer_attribute_enum {
HIP_POINTER_ATTRIBUTE_CONTEXT = 1,
HIP_POINTER_ATTRIBUTE_MEMORY_TYPE = 2,
@@ -701,31 +804,29 @@ typedef enum hipDeviceP2PAttr {
} hipDeviceP2PAttr;
typedef struct HIP_MEMCPY3D {
size_t srcXInBytes;
size_t srcY;
size_t srcZ;
size_t srcLOD;
unsigned int srcXInBytes;
unsigned int srcY;
unsigned int srcZ;
unsigned int srcLOD;
hipMemoryType srcMemoryType;
const void* srcHost;
hipDeviceptr_t srcDevice;
hArray * srcArray;
void* reserved0;
size_t srcPitch;
size_t srcHeight;
size_t dstXInBytes;
size_t dstY;
size_t dstZ;
size_t dstLOD;
hArray srcArray;
unsigned int srcPitch;
unsigned int srcHeight;
unsigned int dstXInBytes;
unsigned int dstY;
unsigned int dstZ;
unsigned int dstLOD;
hipMemoryType dstMemoryType;
void* dstHost;
hipDeviceptr_t dstDevice;
hArray * dstArray;
void* reserved1;
size_t dstPitch;
size_t dstHeight;
size_t WidthInBytes;
size_t Height;
size_t Depth;
hArray dstArray;
unsigned int dstPitch;
unsigned int dstHeight;
unsigned int WidthInBytes;
unsigned int Height;
unsigned int Depth;
} HIP_MEMCPY3D;
typedef struct HIP_MEMCPY3D_PEER_st {
@@ -776,7 +877,7 @@ typedef struct HIP_RESOURCE_DESC_st {
hipResourceType resType;
union {
struct {
hArray * h_Array;
hArray h_Array;
} array;
struct {
hipMipmappedArray_t hMipmappedArray;
@@ -947,13 +1048,34 @@ typedef enum HIPGLmap_flags_enum {
HIP_GL_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02,
} HIPGLmap_flags;
/**
* hipRTC related
*/
typedef struct _hiprtcProgram* hiprtcProgram;
typedef enum hiprtcResult {
HIPRTC_SUCCESS = 0,
HIPRTC_ERROR_OUT_OF_MEMORY = 1,
HIPRTC_ERROR_PROGRAM_CREATION_FAILURE = 2,
HIPRTC_ERROR_INVALID_INPUT = 3,
HIPRTC_ERROR_INVALID_PROGRAM = 4,
HIPRTC_ERROR_INVALID_OPTION = 5,
HIPRTC_ERROR_COMPILATION = 6,
HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE = 7,
HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = 8,
HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = 9,
HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID = 10,
HIPRTC_ERROR_INTERNAL_ERROR = 11
} hiprtcResult;
/* Function types. */
typedef hipError_t HIPAPI thipGetErrorName(hipError_t error, const char** pStr);
typedef hipError_t HIPAPI thipInit(unsigned int Flags);
typedef hipError_t HIPAPI thipDriverGetVersion(int* driverVersion);
typedef hipError_t HIPAPI thipGetDevice(hipDevice_t* device, int ordinal);
typedef hipError_t HIPAPI thipGetDevice(int* device);
typedef hipError_t HIPAPI thipGetDeviceCount(int* count);
typedef hipError_t HIPAPI thipGetDeviceProperties(hipDeviceProp_t* props, int deviceId);
typedef hipError_t HIPAPI thipDeviceGet(hipDevice_t* device, int ordinal);
typedef hipError_t HIPAPI thipDeviceGetName(char* name, int len, hipDevice_t dev);
typedef hipError_t HIPAPI thipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attrib, hipDevice_t dev);
typedef hipError_t HIPAPI thipDeviceComputeCapability(int* major, int* minor, hipDevice_t dev);
@@ -989,7 +1111,7 @@ typedef hipError_t HIPAPI thipMalloc(hipDeviceptr_t* dptr, size_t bytesize);
typedef hipError_t HIPAPI thipMemAllocPitch(hipDeviceptr_t* dptr, size_t* pPitch, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes);
typedef hipError_t HIPAPI thipFree(hipDeviceptr_t dptr);
typedef hipError_t HIPAPI thipMemGetAddressRange(hipDeviceptr_t* pbase, size_t* psize, hipDeviceptr_t dptr);
typedef hipError_t HIPAPI thipHostMalloc(void** pp, size_t bytesize);
typedef hipError_t HIPAPI thipHostMalloc(void** pp, size_t bytesize, unsigned int flags);
typedef hipError_t HIPAPI thipHostFree(void* p);
typedef hipError_t HIPAPI thipMemHostAlloc(void** pp, size_t bytesize, unsigned int Flags);
typedef hipError_t HIPAPI thipHostGetDevicePointer(hipDeviceptr_t* pdptr, void* p, unsigned int Flags);
@@ -1067,6 +1189,16 @@ typedef hipError_t HIPAPI thipGraphicsMapResources(unsigned int count, hipGraphi
typedef hipError_t HIPAPI thipGraphicsUnmapResources(unsigned int count, hipGraphicsResource* resources, hipStream_t hStream);
typedef hipError_t HIPAPI thipGraphicsGLRegisterBuffer(hipGraphicsResource* pCudaResource, GLuint buffer, unsigned int Flags);
typedef hipError_t HIPAPI thipGLGetDevices(unsigned int* pHipDeviceCount, int* pHipDevices, unsigned int hipDeviceCount, hipGLDeviceList deviceList);
typedef hiprtcResult HIPAPI thiprtcGetErrorString(hiprtcResult result);
typedef hiprtcResult HIPAPI thiprtcAddNameExpression(hiprtcProgram prog, const char* name_expression);
typedef hiprtcResult HIPAPI thiprtcCompileProgram(hiprtcProgram prog, int numOptions, const char** options);
typedef hiprtcResult HIPAPI thiprtcCreateProgram(hiprtcProgram* prog, const char* src, const char* name, int numHeaders, const char** headers, const char** includeNames);
typedef hiprtcResult HIPAPI thiprtcDestroyProgram(hiprtcProgram* prog);
typedef hiprtcResult HIPAPI thiprtcGetLoweredName(hiprtcProgram prog, const char* name_expression, const char** lowered_name);
typedef hiprtcResult HIPAPI thiprtcGetProgramLog(hiprtcProgram prog, char* log);
typedef hiprtcResult HIPAPI thiprtcGetProgramLogSize(hiprtcProgram prog, size_t* logSizeRet);
typedef hiprtcResult HIPAPI thiprtcGetCode(hiprtcProgram prog, char* code);
typedef hiprtcResult HIPAPI thiprtcGetCodeSize(hiprtcProgram prog, size_t* codeSizeRet);
/* Function declarations. */
@@ -1075,6 +1207,8 @@ extern thipInit *hipInit;
extern thipDriverGetVersion *hipDriverGetVersion;
extern thipGetDevice *hipGetDevice;
extern thipGetDeviceCount *hipGetDeviceCount;
extern thipGetDeviceProperties *hipGetDeviceProperties;
extern thipDeviceGet* hipDeviceGet;
extern thipDeviceGetName *hipDeviceGetName;
extern thipDeviceGetAttribute *hipDeviceGetAttribute;
extern thipDeviceComputeCapability *hipDeviceComputeCapability;
@@ -1183,11 +1317,23 @@ extern thipGraphicsUnmapResources *hipGraphicsUnmapResources;
extern thipGraphicsGLRegisterBuffer *hipGraphicsGLRegisterBuffer;
extern thipGLGetDevices *hipGLGetDevices;
extern thiprtcGetErrorString* hiprtcGetErrorString;
extern thiprtcAddNameExpression* hiprtcAddNameExpression;
extern thiprtcCompileProgram* hiprtcCompileProgram;
extern thiprtcCreateProgram* hiprtcCreateProgram;
extern thiprtcDestroyProgram* hiprtcDestroyProgram;
extern thiprtcGetLoweredName* hiprtcGetLoweredName;
extern thiprtcGetProgramLog* hiprtcGetProgramLog;
extern thiprtcGetProgramLogSize* hiprtcGetProgramLogSize;
extern thiprtcGetCode* hiprtcGetCode;
extern thiprtcGetCodeSize* hiprtcGetCodeSize;
enum {
HIPEW_SUCCESS = 0,
HIPEW_ERROR_OPEN_FAILED = -1,
HIPEW_ERROR_ATEXIT_FAILED = -2,
HIPEW_ERROR_OLD_DRIVER = -3,
};
enum {

View File

@@ -70,6 +70,8 @@ thipInit *hipInit;
thipDriverGetVersion *hipDriverGetVersion;
thipGetDevice *hipGetDevice;
thipGetDeviceCount *hipGetDeviceCount;
thipGetDeviceProperties *hipGetDeviceProperties;
thipDeviceGet* hipDeviceGet;
thipDeviceGetName *hipDeviceGetName;
thipDeviceGetAttribute *hipDeviceGetAttribute;
thipDeviceComputeCapability *hipDeviceComputeCapability;
@@ -178,6 +180,17 @@ thipGraphicsResourceGetMappedPointer *hipGraphicsResourceGetMappedPointer;
thipGraphicsGLRegisterBuffer *hipGraphicsGLRegisterBuffer;
thipGLGetDevices *hipGLGetDevices;
thiprtcGetErrorString* hiprtcGetErrorString;
thiprtcAddNameExpression* hiprtcAddNameExpression;
thiprtcCompileProgram* hiprtcCompileProgram;
thiprtcCreateProgram* hiprtcCreateProgram;
thiprtcDestroyProgram* hiprtcDestroyProgram;
thiprtcGetLoweredName* hiprtcGetLoweredName;
thiprtcGetProgramLog* hiprtcGetProgramLog;
thiprtcGetProgramLogSize* hiprtcGetProgramLogSize;
thiprtcGetCode* hiprtcGetCode;
thiprtcGetCodeSize* hiprtcGetCodeSize;
static DynamicLibrary dynamic_library_open_find(const char **paths) {
@@ -201,6 +214,36 @@ static void hipewHipExit(void) {
}
}
#ifdef _WIN32
static int hipewHasOldDriver(const char *hip_path) {
DWORD verHandle = 0;
DWORD verSize = GetFileVersionInfoSize(hip_path, &verHandle);
int old_driver = 0;
if(verSize != 0) {
LPSTR verData = (LPSTR)malloc(verSize);
if(GetFileVersionInfo(hip_path, verHandle, verSize, verData)) {
LPBYTE lpBuffer = NULL;
UINT size = 0;
if(VerQueryValue(verData, "\\", (VOID FAR * FAR *)&lpBuffer, &size)) {
if(size) {
VS_FIXEDFILEINFO *verInfo = (VS_FIXEDFILEINFO *)lpBuffer;
/* Magic value from
* https://docs.microsoft.com/en-us/windows/win32/api/verrsrc/ns-verrsrc-vs_fixedfileinfo */
if(verInfo->dwSignature == 0xfeef04bd) {
unsigned int fileVersionLS0 = (verInfo->dwFileVersionLS >> 16) & 0xffff;
unsigned int fileversionLS1 = (verInfo->dwFileVersionLS >> 0) & 0xffff;
/* Corresponds to versions older than AMD Radeon Pro 21.Q4. */
old_driver = ((fileVersionLS0 < 3354) || (fileVersionLS0 == 3354 && fileversionLS1 < 13));
}
}
}
}
free(verData);
}
return old_driver;
}
#endif
static int hipewHipInit(void) {
/* Library paths. */
#ifdef _WIN32
@@ -228,6 +271,14 @@ static int hipewHipInit(void) {
return result;
}
#ifdef _WIN32
/* Test for driver version. */
if(hipewHasOldDriver(hip_paths[0])) {
result = HIPEW_ERROR_OLD_DRIVER;
return result;
}
#endif
/* Load library. */
hip_lib = dynamic_library_open_find(hip_paths);
@@ -242,6 +293,8 @@ static int hipewHipInit(void) {
HIP_LIBRARY_FIND_CHECKED(hipDriverGetVersion);
HIP_LIBRARY_FIND_CHECKED(hipGetDevice);
HIP_LIBRARY_FIND_CHECKED(hipGetDeviceCount);
HIP_LIBRARY_FIND_CHECKED(hipGetDeviceProperties);
HIP_LIBRARY_FIND_CHECKED(hipDeviceGet);
HIP_LIBRARY_FIND_CHECKED(hipDeviceGetName);
HIP_LIBRARY_FIND_CHECKED(hipDeviceGetAttribute);
HIP_LIBRARY_FIND_CHECKED(hipDeviceComputeCapability);
@@ -346,6 +399,16 @@ static int hipewHipInit(void) {
HIP_LIBRARY_FIND_CHECKED(hipGraphicsGLRegisterBuffer);
HIP_LIBRARY_FIND_CHECKED(hipGLGetDevices);
#endif
HIP_LIBRARY_FIND_CHECKED(hiprtcGetErrorString);
HIP_LIBRARY_FIND_CHECKED(hiprtcAddNameExpression);
HIP_LIBRARY_FIND_CHECKED(hiprtcCompileProgram);
HIP_LIBRARY_FIND_CHECKED(hiprtcCreateProgram);
HIP_LIBRARY_FIND_CHECKED(hiprtcDestroyProgram);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetLoweredName);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetProgramLog);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetProgramLogSize);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetCode);
HIP_LIBRARY_FIND_CHECKED(hiprtcGetCodeSize);
result = HIPEW_SUCCESS;
return result;
}

View File

@@ -574,6 +574,8 @@ Dbl2 AreaDiag::area(Dbl2 p1, Dbl2 p2, int left)
Dbl2 d = p2 - p1;
if (d.x == 0.0)
return Dbl2(0.0, 1.0);
if (d.y == 0.0)
return Dbl2(1.0, 0.0);
double x1 = (double)(1 + left);
double x2 = x1 + 1.0;

BIN
extern/tinygltf/patches/TinyGLTF.diff vendored Normal file

Binary file not shown.

View File

@@ -226,6 +226,9 @@ add_definitions(
-DCCL_NAMESPACE_END=}
)
if(WITH_CYCLES_DEBUG)
add_definitions(-DWITH_CYCLES_DEBUG)
endif()
if(WITH_CYCLES_STANDALONE_GUI)
add_definitions(-DWITH_CYCLES_STANDALONE_GUI)
endif()
@@ -295,13 +298,6 @@ if(WITH_OPENIMAGEDENOISE)
)
endif()
if(WITH_CYCLES_STANDALONE)
set(WITH_CYCLES_DEVICE_CUDA TRUE)
set(WITH_CYCLES_DEVICE_HIP TRUE)
endif()
# TODO(sergey): Consider removing it, only causes confusion in interface.
set(WITH_CYCLES_DEVICE_MULTI TRUE)
# Logging capabilities using GLog library.
if(WITH_CYCLES_LOGGING)
add_definitions(-DWITH_CYCLES_LOGGING)
@@ -341,7 +337,7 @@ else()
endif()
# Warnings
if(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID MATCHES "Clang")
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_float_conversion "-Werror=float-conversion")
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_double_promotion "-Werror=double-promotion")
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_no_error_unused_macros "-Wno-error=unused-macros")
@@ -400,7 +396,8 @@ add_subdirectory(doc)
add_subdirectory(graph)
add_subdirectory(integrator)
add_subdirectory(kernel)
add_subdirectory(render)
add_subdirectory(scene)
add_subdirectory(session)
add_subdirectory(subd)
add_subdirectory(util)

View File

@@ -25,7 +25,8 @@ set(INC_SYS
set(LIBRARIES
cycles_device
cycles_kernel
cycles_render
cycles_scene
cycles_session
cycles_bvh
cycles_subd
cycles_graph
@@ -64,6 +65,8 @@ if(WITH_CYCLES_STANDALONE)
cycles_standalone.cpp
cycles_xml.cpp
cycles_xml.h
oiio_output_driver.cpp
oiio_output_driver.h
)
add_executable(cycles ${SRC} ${INC} ${INC_SYS})
unset(SRC)
@@ -73,7 +76,7 @@ if(WITH_CYCLES_STANDALONE)
if(APPLE)
if(WITH_OPENCOLORIO)
set_property(TARGET cycles APPEND_STRING PROPERTY LINK_FLAGS " -framework IOKit")
set_property(TARGET cycles APPEND_STRING PROPERTY LINK_FLAGS " -framework IOKit -framework Carbon")
endif()
if(WITH_OPENIMAGEDENOISE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
# OpenImageDenoise uses BNNS from the Accelerate framework.

View File

@@ -18,13 +18,13 @@
#include "device/device.h"
#include "util/util_args.h"
#include "util/util_foreach.h"
#include "util/util_logging.h"
#include "util/util_path.h"
#include "util/util_stats.h"
#include "util/util_string.h"
#include "util/util_task.h"
#include "util/args.h"
#include "util/foreach.h"
#include "util/log.h"
#include "util/path.h"
#include "util/stats.h"
#include "util/string.h"
#include "util/task.h"
using namespace ccl;

View File

@@ -17,27 +17,30 @@
#include <stdio.h>
#include "device/device.h"
#include "render/buffers.h"
#include "render/camera.h"
#include "render/integrator.h"
#include "render/scene.h"
#include "render/session.h"
#include "scene/camera.h"
#include "scene/integrator.h"
#include "scene/scene.h"
#include "session/buffers.h"
#include "session/session.h"
#include "util/util_args.h"
#include "util/util_foreach.h"
#include "util/util_function.h"
#include "util/util_image.h"
#include "util/util_logging.h"
#include "util/util_path.h"
#include "util/util_progress.h"
#include "util/util_string.h"
#include "util/util_time.h"
#include "util/util_transform.h"
#include "util/util_unique_ptr.h"
#include "util/util_version.h"
#include "util/args.h"
#include "util/foreach.h"
#include "util/function.h"
#include "util/image.h"
#include "util/log.h"
#include "util/path.h"
#include "util/progress.h"
#include "util/string.h"
#include "util/time.h"
#include "util/transform.h"
#include "util/unique_ptr.h"
#include "util/version.h"
#include "app/cycles_xml.h"
#include "app/oiio_output_driver.h"
#ifdef WITH_CYCLES_STANDALONE_GUI
# include "util/util_view.h"
# include "util/view.h"
#endif
#include "app/cycles_xml.h"
@@ -54,6 +57,7 @@ struct Options {
bool quiet;
bool show_help, interactive, pause;
string output_filepath;
string output_pass;
} options;
static void session_print(const string &str)
@@ -89,30 +93,6 @@ static void session_print_status()
session_print(status);
}
static bool write_render(const uchar *pixels, int w, int h, int channels)
{
string msg = string_printf("Writing image %s", options.output_path.c_str());
session_print(msg);
unique_ptr<ImageOutput> out = unique_ptr<ImageOutput>(ImageOutput::create(options.output_path));
if (!out) {
return false;
}
ImageSpec spec(w, h, channels, TypeDesc::UINT8);
if (!out->open(options.output_path, spec)) {
return false;
}
/* conversion for different top/bottom convention */
out->write_image(
TypeDesc::UINT8, pixels + (h - 1) * w * channels, AutoStride, -w * channels, AutoStride);
out->close();
return true;
}
static BufferParams &session_buffer_params()
{
static BufferParams buffer_params;
@@ -147,9 +127,14 @@ static void scene_init()
static void session_init()
{
options.session_params.write_render_cb = write_render;
options.output_pass = "combined";
options.session = new Session(options.session_params, options.scene_params);
if (!options.output_filepath.empty()) {
options.session->set_output_driver(make_unique<OIIOOutputDriver>(
options.output_filepath, options.output_pass, session_print));
}
if (options.session_params.background && !options.quiet)
options.session->progress.set_update_callback(function_bind(&session_print_status));
#ifdef WITH_CYCLES_STANDALONE_GUI
@@ -160,6 +145,11 @@ static void session_init()
/* load scene */
scene_init();
/* add pass for output. */
Pass *pass = options.scene->create_node<Pass>();
pass->set_name(ustring(options.output_pass.c_str()));
pass->set_type(PASS_COMBINED);
options.session->reset(options.session_params, session_buffer_params());
options.session->start();
}

View File

@@ -22,27 +22,27 @@
#include "graph/node_xml.h"
#include "render/background.h"
#include "render/camera.h"
#include "render/film.h"
#include "render/graph.h"
#include "render/integrator.h"
#include "render/light.h"
#include "render/mesh.h"
#include "render/nodes.h"
#include "render/object.h"
#include "render/osl.h"
#include "render/scene.h"
#include "render/shader.h"
#include "scene/background.h"
#include "scene/camera.h"
#include "scene/film.h"
#include "scene/integrator.h"
#include "scene/light.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "scene/osl.h"
#include "scene/scene.h"
#include "scene/shader.h"
#include "scene/shader_graph.h"
#include "scene/shader_nodes.h"
#include "subd/subd_patch.h"
#include "subd/subd_split.h"
#include "subd/patch.h"
#include "subd/split.h"
#include "util/util_foreach.h"
#include "util/util_path.h"
#include "util/util_projection.h"
#include "util/util_transform.h"
#include "util/util_xml.h"
#include "util/foreach.h"
#include "util/path.h"
#include "util/projection.h"
#include "util/transform.h"
#include "util/xml.h"
#include "app/cycles_xml.h"
@@ -333,6 +333,7 @@ static void xml_read_shader_graph(XMLReadState &state, Shader *shader, xml_node
}
snode = (ShaderNode *)node_type->create(node_type);
snode->set_owner(graph);
}
xml_read_node(graph_reader, snode, node);

View File

@@ -0,0 +1,71 @@
/*
* Copyright 2021 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "app/oiio_output_driver.h"
CCL_NAMESPACE_BEGIN
OIIOOutputDriver::OIIOOutputDriver(const string_view filepath,
const string_view pass,
LogFunction log)
: filepath_(filepath), pass_(pass), log_(log)
{
}
OIIOOutputDriver::~OIIOOutputDriver()
{
}
void OIIOOutputDriver::write_render_tile(const Tile &tile)
{
/* Only write the full buffer, no intermediate tiles. */
if (!(tile.size == tile.full_size)) {
return;
}
log_(string_printf("Writing image %s", filepath_.c_str()));
unique_ptr<ImageOutput> image_output(ImageOutput::create(filepath_));
if (image_output == nullptr) {
log_("Failed to create image file");
return;
}
const int width = tile.size.x;
const int height = tile.size.y;
ImageSpec spec(width, height, 4, TypeDesc::FLOAT);
if (!image_output->open(filepath_, spec)) {
log_("Failed to create image file");
return;
}
vector<float> pixels(width * height * 4);
if (!tile.get_pass_pixels(pass_, 4, pixels.data())) {
log_("Failed to read render pass pixels");
return;
}
/* Manipulate offset and stride to convert from bottom-up to top-down convention. */
image_output->write_image(TypeDesc::FLOAT,
pixels.data() + (height - 1) * width * 4,
AutoStride,
-width * 4 * sizeof(float),
AutoStride);
image_output->close();
}
CCL_NAMESPACE_END

View File

@@ -0,0 +1,42 @@
/*
* Copyright 2021 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "session/output_driver.h"
#include "util/function.h"
#include "util/image.h"
#include "util/string.h"
#include "util/unique_ptr.h"
#include "util/vector.h"
CCL_NAMESPACE_BEGIN
class OIIOOutputDriver : public OutputDriver {
public:
typedef function<void(const string &)> LogFunction;
OIIOOutputDriver(const string_view filepath, const string_view pass, LogFunction log);
virtual ~OIIOOutputDriver();
void write_render_tile(const Tile &tile) override;
protected:
string filepath_;
string pass_;
LogFunction log_;
};
CCL_NAMESPACE_END

View File

@@ -29,37 +29,39 @@ set(INC_SYS
)
set(SRC
blender_camera.cpp
blender_device.cpp
blender_image.cpp
blender_geometry.cpp
blender_gpu_display.cpp
blender_light.cpp
blender_mesh.cpp
blender_object.cpp
blender_object_cull.cpp
blender_particles.cpp
blender_curves.cpp
blender_logging.cpp
blender_python.cpp
blender_session.cpp
blender_shader.cpp
blender_sync.cpp
blender_texture.cpp
blender_viewport.cpp
blender_volume.cpp
camera.cpp
device.cpp
display_driver.cpp
image.cpp
geometry.cpp
light.cpp
mesh.cpp
object.cpp
object_cull.cpp
output_driver.cpp
particles.cpp
curves.cpp
logging.cpp
python.cpp
session.cpp
shader.cpp
sync.cpp
texture.cpp
viewport.cpp
volume.cpp
CCL_api.h
blender_device.h
blender_gpu_display.h
blender_id_map.h
blender_image.h
blender_object_cull.h
blender_sync.h
blender_session.h
blender_texture.h
blender_util.h
blender_viewport.h
device.h
display_driver.h
id_map.h
image.h
object_cull.h
output_driver.h
sync.h
session.h
texture.h
util.h
viewport.h
)
set(LIB
@@ -67,7 +69,8 @@ set(LIB
cycles_device
cycles_graph
cycles_kernel
cycles_render
cycles_scene
cycles_session
cycles_subd
cycles_util
@@ -135,11 +138,6 @@ endif()
blender_add_lib(bf_intern_cycles "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# avoid link failure with clang 3.4 debug
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS '3.4')
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -gline-tables-only")
endif()
add_dependencies(bf_intern_cycles bf_rna)
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${ADDON_FILES}" ${CYCLES_INSTALL_PATH})

View File

@@ -211,7 +211,6 @@ def list_render_passes(scene, srl):
if crl.use_pass_shadow_catcher: yield ("Shadow Catcher", "RGB", 'COLOR')
# Debug passes.
if crl.pass_debug_render_time: yield ("Debug Render Time", "X", 'VALUE')
if crl.pass_debug_sample_count: yield ("Debug Sample Count", "X", 'VALUE')
# Cryptomatte passes.
@@ -234,6 +233,7 @@ def list_render_passes(scene, srl):
if crl.denoising_store_passes:
yield ("Denoising Normal", "XYZ", 'VECTOR')
yield ("Denoising Albedo", "RGB", 'COLOR')
yield ("Denoising Depth", "Z", 'VALUE')
# Custom AOV passes.
for aov in srl.aovs:

View File

@@ -40,10 +40,10 @@ class AddPresetIntegrator(AddPresetBase, Operator):
"cycles.transparent_max_bounces",
"cycles.caustics_reflective",
"cycles.caustics_refractive",
"cycles.blur_glossy"
"cycles.use_fast_gi"
"cycles.ao_bounces"
"cycles.ao_bounces_render"
"cycles.blur_glossy",
"cycles.use_fast_gi",
"cycles.ao_bounces",
"cycles.ao_bounces_render",
]
preset_subdir = "cycles/integrator"

View File

@@ -86,8 +86,8 @@ enum_use_layer_samples = (
)
enum_sampling_pattern = (
('SOBOL', "Sobol", "Use Sobol random sampling pattern"),
('PROGRESSIVE_MUTI_JITTER', "Progressive Multi-Jitter", "Use Progressive Multi-Jitter random sampling pattern"),
('SOBOL', "Sobol", "Use Sobol random sampling pattern", 0),
('PROGRESSIVE_MULTI_JITTER', "Progressive Multi-Jitter", "Use Progressive Multi-Jitter random sampling pattern", 1),
)
enum_volume_sampling = (
@@ -125,6 +125,11 @@ enum_texture_limit = (
('8192', "8192", "Limit texture size to 8192 pixels", 7),
)
enum_fast_gi_method = (
('REPLACE', "Replace", "Replace global illumination with ambient occlusion after a specified number of bounces"),
('ADD', "Add", "Add ambient occlusion to diffuse surfaces"),
)
# NOTE: Identifiers are expected to be an upper case version of identifiers from `Pass::get_type_enum()`
enum_view3d_shading_render_pass = (
('', "General", ""),
@@ -213,6 +218,12 @@ enum_denoising_prefilter = (
('ACCURATE', "Accurate", "Prefilter noisy guiding passes before denoising color. Improves quality when guiding passes are noisy using extra processing time", 3),
)
enum_direct_light_sampling_type = (
('MULTIPLE_IMPORTANCE_SAMPLING', "Multiple Importance Sampling", "Multiple importance sampling is used to combine direct light contributions from next-event estimation and forward path tracing", 0),
('FORWARD_PATH_TRACING', "Forward Path Tracing", "Direct light contributions are only sampled using forward path tracing", 1),
('NEXT_EVENT_ESTIMATION', "Next-Event Estimation", "Direct light contributions are only sampled using next-event estimation", 2),
)
def update_render_passes(self, context):
scene = context.scene
view_layer = context.view_layer
@@ -320,6 +331,13 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default=1024,
)
sample_offset: IntProperty(
name="Sample Offset",
description="Number of samples to skip when starting render",
min=0, max=(1 << 24),
default=0,
)
time_limit: FloatProperty(
name="Time Limit",
description="Limit the render time (excluding synchronization time)."
@@ -332,9 +350,27 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
sampling_pattern: EnumProperty(
name="Sampling Pattern",
description="Random sampling pattern used by the integrator",
description="Random sampling pattern used by the integrator. When adaptive sampling is enabled, Progressive Multi-Jitter is always used instead of Sobol",
items=enum_sampling_pattern,
default='PROGRESSIVE_MUTI_JITTER',
default='PROGRESSIVE_MULTI_JITTER',
)
scrambling_distance: FloatProperty(
name="Scrambling Distance",
default=1.0,
min=0.0, max=1.0,
description="Reduce randomization between pixels to improve GPU rendering performance, at the cost of possible rendering artifacts if set too low. Only works when not using adaptive sampling",
)
preview_scrambling_distance: BoolProperty(
name="Scrambling Distance viewport",
default=False,
description="Uses the Scrambling Distance value for the viewport. Faster but may flicker",
)
auto_scrambling_distance: BoolProperty(
name="Automatic Scrambling Distance",
default=False,
description="Automatically reduce the randomization between pixels to improve GPU rendering performance, at the cost of possible rendering artifacts. Only works when not using adaptive sampling",
)
use_layer_samples: EnumProperty(
@@ -392,6 +428,13 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default=0,
)
direct_light_sampling_type: EnumProperty(
name="Direct Light Sampling Type",
description="The type of strategy used for sampling direct light contributions",
items=enum_direct_light_sampling_type,
default='MULTIPLE_IMPORTANCE_SAMPLING',
)
min_light_bounces: IntProperty(
name="Min Light Bounces",
description="Minimum number of light bounces. Setting this higher reduces noise in the first bounces, "
@@ -724,6 +767,14 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
description="Approximate diffuse indirect light with background tinted ambient occlusion. This provides fast alternative to full global illumination, for interactive viewport rendering or final renders with reduced quality",
default=False,
)
fast_gi_method: EnumProperty(
name="Fast GI Method",
default='REPLACE',
description="Fast GI approximation method",
items=enum_fast_gi_method
)
ao_bounces: IntProperty(
name="AO Bounces",
default=1,
@@ -739,8 +790,8 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
)
use_auto_tile: BoolProperty(
name="Auto Tiles",
description="Automatically render high resolution images in tiles to reduce memory usage, using the specified tile size. Tiles are cached to disk while rendering to save memory",
name="Using Tiling",
description="Render high resolution images in tiles to reduce memory usage, using the specified tile size. Tiles are cached to disk while rendering to save memory",
default=True,
)
tile_size: IntProperty(
@@ -1197,12 +1248,6 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
pass_debug_render_time: BoolProperty(
name="Debug Render Time",
description="Render time in milliseconds per sample and pixel",
default=False,
update=update_render_passes,
)
pass_debug_sample_count: BoolProperty(
name="Debug Sample Count",
description="Number of samples/camera rays per pixel",
@@ -1335,7 +1380,7 @@ class CyclesPreferences(bpy.types.AddonPreferences):
elif entry.type == 'CPU':
cpu_devices.append(entry)
# Extend all GPU devices with CPU.
if compute_device_type != 'CPU' and compute_device_type != 'HIP':
if len(devices) and compute_device_type != 'CPU':
devices.extend(cpu_devices)
return devices
@@ -1353,12 +1398,18 @@ class CyclesPreferences(bpy.types.AddonPreferences):
self.refresh_devices()
return None
def get_compute_device_type(self):
if self.compute_device_type == '':
return 'NONE'
return self.compute_device_type
def get_num_gpu_devices(self):
import _cycles
device_list = _cycles.available_devices(self.compute_device_type)
compute_device_type = self.get_compute_device_type()
device_list = _cycles.available_devices(compute_device_type)
num = 0
for device in device_list:
if device[1] != self.compute_device_type:
if device[1] != compute_device_type:
continue
for dev in self.devices:
if dev.use and dev.id == device[2]:
@@ -1379,8 +1430,18 @@ class CyclesPreferences(bpy.types.AddonPreferences):
if not found_device:
col = box.column(align=True)
col.label(text="No compatible GPUs found for path tracing", icon='INFO')
col.label(text="Cycles will render on the CPU", icon='BLANK1')
col.label(text="No compatible GPUs found for Cycles", icon='INFO')
if device_type == 'CUDA':
col.label(text="Requires NVIDIA GPU with compute capability 3.0", icon='BLANK1')
elif device_type == 'OPTIX':
col.label(text="Requires NVIDIA GPU with compute capability 5.0", icon='BLANK1')
col.label(text="and NVIDIA driver version 470 or newer", icon='BLANK1')
elif device_type == 'HIP':
import sys
col.label(text="Requires discrete AMD GPU with RDNA architecture", icon='BLANK1')
if sys.platform[:3] == "win":
col.label(text="and AMD Radeon Pro 21.Q4 driver or newer", icon='BLANK1')
return
for device in devices:
@@ -1390,15 +1451,16 @@ class CyclesPreferences(bpy.types.AddonPreferences):
row = layout.row()
row.prop(self, "compute_device_type", expand=True)
if self.compute_device_type == 'NONE':
compute_device_type = self.get_compute_device_type()
if compute_device_type == 'NONE':
return
row = layout.row()
devices = self.get_devices_for_type(self.compute_device_type)
self._draw_devices(row, self.compute_device_type, devices)
devices = self.get_devices_for_type(compute_device_type)
self._draw_devices(row, compute_device_type, devices)
import _cycles
has_peer_memory = 0
for device in _cycles.available_devices(self.compute_device_type):
for device in _cycles.available_devices(compute_device_type):
if device[3] and self.find_existing_device_entry(device).use:
has_peer_memory += 1
if has_peer_memory > 1:

View File

@@ -26,27 +26,31 @@ from bpy.types import Panel
from bl_ui.properties_grease_pencil_common import GreasePencilSimplifyPanel
from bl_ui.properties_view_layer import ViewLayerCryptomattePanel, ViewLayerAOVPanel
class CyclesPresetPanel(PresetPanel, Panel):
COMPAT_ENGINES = {'CYCLES'}
preset_operator = "script.execute_preset"
class CYCLES_PT_sampling_presets(PresetPanel, Panel):
@staticmethod
def post_cb(context):
# Modify an arbitrary built-in scene property to force a depsgraph
# update, because add-on properties don't. (see T62325)
render = context.scene.render
render.filter_size = render.filter_size
class CYCLES_PT_sampling_presets(CyclesPresetPanel):
bl_label = "Sampling Presets"
preset_subdir = "cycles/sampling"
preset_operator = "script.execute_preset"
preset_add_operator = "render.cycles_sampling_preset_add"
COMPAT_ENGINES = {'CYCLES'}
class CYCLES_PT_viewport_sampling_presets(PresetPanel, Panel):
class CYCLES_PT_viewport_sampling_presets(CyclesPresetPanel):
bl_label = "Viewport Sampling Presets"
preset_subdir = "cycles/viewport_sampling"
preset_operator = "script.execute_preset"
preset_add_operator = "render.cycles_viewport_sampling_preset_add"
COMPAT_ENGINES = {'CYCLES'}
class CYCLES_PT_integrator_presets(PresetPanel, Panel):
class CYCLES_PT_integrator_presets(CyclesPresetPanel):
bl_label = "Integrator Presets"
preset_subdir = "cycles/integrator"
preset_operator = "script.execute_preset"
preset_add_operator = "render.cycles_integrator_preset_add"
COMPAT_ENGINES = {'CYCLES'}
class CyclesButtonsPanel:
@@ -283,9 +287,22 @@ class CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel):
row.prop(cscene, "use_animated_seed", text="", icon='TIME')
col = layout.column(align=True)
col.active = not(cscene.use_adaptive_sampling)
col.active = not (cscene.use_adaptive_sampling and cscene.use_preview_adaptive_sampling)
col.prop(cscene, "sampling_pattern", text="Pattern")
col = layout.column(align=True)
col.prop(cscene, "sample_offset")
layout.separator()
heading = layout.column(align=True, heading="Scrambling Distance")
heading.active = not (cscene.use_adaptive_sampling and cscene.use_preview_adaptive_sampling)
heading.prop(cscene, "auto_scrambling_distance", text="Automatic")
sub = heading.row()
sub.active = not cscene.use_preview_adaptive_sampling
sub.prop(cscene, "preview_scrambling_distance", text="Viewport")
heading.prop(cscene, "scrambling_distance", text="Multiplier")
layout.separator()
col = layout.column(align=True)
@@ -461,8 +478,7 @@ class CYCLES_RENDER_PT_light_paths_fast_gi(CyclesButtonsPanel, Panel):
layout.active = cscene.use_fast_gi
col = layout.column(align=True)
col.prop(cscene, "ao_bounces", text="Viewport Bounces")
col.prop(cscene, "ao_bounces_render", text="Render Bounces")
col.prop(cscene, "fast_gi_method", text="Method")
if world:
light = world.light_settings
@@ -470,6 +486,11 @@ class CYCLES_RENDER_PT_light_paths_fast_gi(CyclesButtonsPanel, Panel):
col.prop(light, "ao_factor", text="AO Factor")
col.prop(light, "distance", text="AO Distance")
if cscene.fast_gi_method == 'REPLACE':
col = layout.column(align=True)
col.prop(cscene, "ao_bounces", text="Viewport Bounces")
col.prop(cscene, "ao_bounces_render", text="Render Bounces")
class CYCLES_RENDER_PT_motion_blur(CyclesButtonsPanel, Panel):
bl_label = "Motion Blur"
@@ -792,7 +813,6 @@ class CYCLES_RENDER_PT_passes_data(CyclesButtonsPanel, Panel):
col.prop(view_layer, "use_pass_material_index")
col = layout.column(heading="Debug", align=True)
col.prop(cycles_view_layer, "pass_debug_render_time", text="Render Time")
col.prop(cycles_view_layer, "pass_debug_sample_count", text="Sample Count")
layout.prop(view_layer, "pass_alpha_threshold")
@@ -982,8 +1002,8 @@ class CYCLES_PT_context_material(CyclesButtonsPanel, Panel):
row.prop(slot, "link", text="", icon=icon_link, icon_only=True)
elif mat:
split.template_ID(space, "pin_id")
split.separator()
layout.template_ID(space, "pin_id")
layout.separator()
class CYCLES_OBJECT_PT_motion_blur(CyclesButtonsPanel, Panel):
@@ -1034,7 +1054,7 @@ class CYCLES_OBJECT_PT_motion_blur(CyclesButtonsPanel, Panel):
def has_geometry_visibility(ob):
return ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LIGHT'}) or
return ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LIGHT', 'VOLUME', 'POINTCLOUD', 'HAIR'}) or
(ob.instance_type == 'COLLECTION' and ob.instance_collection))

View File

@@ -86,7 +86,7 @@ def do_versions(self):
# Device might not currently be available so this can fail
try:
if system.legacy_compute_device_type == 1:
prop.compute_device_type = 'OPENCL'
prop.compute_device_type = 'NONE' # Was OpenCL
elif system.legacy_compute_device_type == 2:
prop.compute_device_type = 'CUDA'
else:
@@ -97,6 +97,12 @@ def do_versions(self):
# Init device list for UI
prop.get_devices(prop.compute_device_type)
if bpy.context.preferences.version <= (3, 0, 40):
# Disable OpenCL device
prop = bpy.context.preferences.addons[__package__].preferences
if prop.is_property_set("compute_device_type") and prop['compute_device_type'] == 4:
prop.compute_device_type = 'NONE'
# We don't modify startup file because it assumes to
# have all the default values only.
if not bpy.data.is_saved:
@@ -235,8 +241,9 @@ def do_versions(self):
cscene.use_denoising = False
if not cscene.is_property_set("use_preview_denoising"):
cscene.use_preview_denoising = False
if not cscene.is_property_set("sampling_pattern"):
cscene.sampling_pattern = 'PROGRESSIVE_MUTI_JITTER'
if not cscene.is_property_set("sampling_pattern") or \
cscene.get('sampling_pattern') >= 2:
cscene.sampling_pattern = 'PROGRESSIVE_MULTI_JITTER'
# Removal of square samples.
cscene = scene.cycles

View File

@@ -14,13 +14,13 @@
* limitations under the License.
*/
#include "render/camera.h"
#include "render/scene.h"
#include "scene/camera.h"
#include "scene/scene.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "blender/sync.h"
#include "blender/util.h"
#include "util/util_logging.h"
#include "util/log.h"
CCL_NAMESPACE_BEGIN
@@ -80,8 +80,9 @@ struct BlenderCamera {
int render_height;
BoundBox2D border;
BoundBox2D pano_viewplane;
BoundBox2D viewport_camera_border;
BoundBox2D pano_viewplane;
float pano_aspectratio;
float passepartout_alpha;
@@ -123,10 +124,11 @@ static void blender_camera_init(BlenderCamera *bcam, BL::RenderSettings &b_rende
bcam->motion_position = Camera::MOTION_POSITION_CENTER;
bcam->border.right = 1.0f;
bcam->border.top = 1.0f;
bcam->pano_viewplane.right = 1.0f;
bcam->pano_viewplane.top = 1.0f;
bcam->viewport_camera_border.right = 1.0f;
bcam->viewport_camera_border.top = 1.0f;
bcam->pano_viewplane.right = 1.0f;
bcam->pano_viewplane.top = 1.0f;
bcam->pano_aspectratio = 0.0f;
bcam->passepartout_alpha = 0.5f;
bcam->offscreen_dicing_scale = 1.0f;
bcam->matrix = transform_identity();
@@ -358,9 +360,21 @@ static void blender_camera_viewplane(BlenderCamera *bcam,
}
if (bcam->type == CAMERA_PANORAMA) {
/* set viewplane */
/* Set viewplane for panoramic camera. */
if (viewplane != NULL) {
*viewplane = bcam->pano_viewplane;
/* Modify viewplane for camera shift. */
const float shift_factor = (bcam->pano_aspectratio == 0.0f) ?
1.0f :
*aspectratio / bcam->pano_aspectratio;
const float dx = bcam->shift.x * shift_factor;
const float dy = bcam->shift.y * shift_factor;
viewplane->left += dx;
viewplane->right += dx;
viewplane->bottom += dy;
viewplane->top += dy;
}
}
else {
@@ -375,8 +389,8 @@ static void blender_camera_viewplane(BlenderCamera *bcam,
*viewplane = (*viewplane) * bcam->zoom;
/* modify viewplane with camera shift and 3d camera view offset */
float dx = 2.0f * (*aspectratio * bcam->shift.x + bcam->offset.x * xaspect * 2.0f);
float dy = 2.0f * (*aspectratio * bcam->shift.y + bcam->offset.y * yaspect * 2.0f);
const float dx = 2.0f * (*aspectratio * bcam->shift.x + bcam->offset.x * xaspect * 2.0f);
const float dy = 2.0f * (*aspectratio * bcam->shift.y + bcam->offset.y * yaspect * 2.0f);
viewplane->left += dx;
viewplane->right += dx;
@@ -625,7 +639,7 @@ void BlenderSync::sync_camera_motion(
/* TODO(sergey): De-duplicate calculation with camera sync. */
float fov = 2.0f * atanf((0.5f * sensor_size) / bcam.lens / aspectratio);
if (fov != cam->get_fov()) {
VLOG(1) << "Camera " << b_ob.name() << " FOV change detected.";
VLOG(3) << "Camera " << b_ob.name() << " FOV change detected.";
if (motion_time == 0.0f) {
cam->set_fov(fov);
}
@@ -652,7 +666,8 @@ static void blender_camera_view_subset(BL::RenderEngine &b_engine,
int width,
int height,
BoundBox2D *view_box,
BoundBox2D *cam_box);
BoundBox2D *cam_box,
float *view_aspect);
static void blender_camera_from_view(BlenderCamera *bcam,
BL::RenderEngine &b_engine,
@@ -682,6 +697,7 @@ static void blender_camera_from_view(BlenderCamera *bcam,
if (!skip_panorama && bcam->type == CAMERA_PANORAMA) {
/* in panorama camera view, we map viewplane to camera border */
BoundBox2D view_box, cam_box;
float view_aspect;
BL::RenderSettings b_render_settings(b_scene.render());
blender_camera_view_subset(b_engine,
@@ -693,9 +709,11 @@ static void blender_camera_from_view(BlenderCamera *bcam,
width,
height,
&view_box,
&cam_box);
&cam_box,
&view_aspect);
bcam->pano_viewplane = view_box.make_relative_to(cam_box);
bcam->pano_aspectratio = view_aspect;
}
else {
/* magic zoom formula */
@@ -743,17 +761,18 @@ static void blender_camera_view_subset(BL::RenderEngine &b_engine,
int width,
int height,
BoundBox2D *view_box,
BoundBox2D *cam_box)
BoundBox2D *cam_box,
float *view_aspect)
{
BoundBox2D cam, view;
float view_aspect, cam_aspect, sensor_size;
float cam_aspect, sensor_size;
/* Get viewport viewplane. */
BlenderCamera view_bcam;
blender_camera_init(&view_bcam, b_render);
blender_camera_from_view(&view_bcam, b_engine, b_scene, b_v3d, b_rv3d, width, height, true);
blender_camera_viewplane(&view_bcam, width, height, &view, &view_aspect, &sensor_size);
blender_camera_viewplane(&view_bcam, width, height, &view, view_aspect, &sensor_size);
/* Get camera viewplane. */
BlenderCamera cam_bcam;
@@ -768,7 +787,7 @@ static void blender_camera_view_subset(BL::RenderEngine &b_engine,
&cam_bcam, cam_bcam.full_width, cam_bcam.full_height, &cam, &cam_aspect, &sensor_size);
/* Return */
*view_box = view * (1.0f / view_aspect);
*view_box = view * (1.0f / *view_aspect);
*cam_box = cam * (1.0f / cam_aspect);
}
@@ -785,8 +804,18 @@ static void blender_camera_border_subset(BL::RenderEngine &b_engine,
{
/* Determine camera viewport subset. */
BoundBox2D view_box, cam_box;
blender_camera_view_subset(
b_engine, b_render, b_scene, b_ob, b_v3d, b_rv3d, width, height, &view_box, &cam_box);
float view_aspect;
blender_camera_view_subset(b_engine,
b_render,
b_scene,
b_ob,
b_v3d,
b_rv3d,
width,
height,
&view_box,
&cam_box,
&view_aspect);
/* Determine viewport subset matching given border. */
cam_box = cam_box.make_relative_to(view_box);
@@ -927,6 +956,9 @@ BufferParams BlenderSync::get_buffer_params(
params.height = height;
}
params.window_width = params.width;
params.window_height = params.height;
return params;
}

View File

@@ -14,19 +14,20 @@
* limitations under the License.
*/
#include "render/attribute.h"
#include "render/camera.h"
#include "render/curves.h"
#include "render/hair.h"
#include "render/object.h"
#include "render/scene.h"
#include "blender/sync.h"
#include "blender/util.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "scene/attribute.h"
#include "scene/camera.h"
#include "scene/curves.h"
#include "scene/hair.h"
#include "scene/object.h"
#include "scene/scene.h"
#include "util/util_foreach.h"
#include "util/util_hash.h"
#include "util/util_logging.h"
#include "util/color.h"
#include "util/foreach.h"
#include "util/hash.h"
#include "util/log.h"
CCL_NAMESPACE_BEGIN
@@ -198,7 +199,7 @@ static bool ObtainCacheParticleUV(Hair *hair,
b_mesh->uv_layers.begin(l);
float2 uv = zero_float2();
if (b_mesh->uv_layers.length())
if (!b_mesh->uv_layers.empty())
b_psys.uv_on_emitter(psmd, *b_pa, pa_no, uv_num, &uv.x);
CData->curve_uv.push_back_slow(uv);
@@ -260,7 +261,7 @@ static bool ObtainCacheParticleVcol(Hair *hair,
b_mesh->vertex_colors.begin(l);
float4 vcol = make_float4(0.0f, 0.0f, 0.0f, 1.0f);
if (b_mesh->vertex_colors.length())
if (!b_mesh->vertex_colors.empty())
b_psys.mcol_on_emitter(psmd, *b_pa, pa_no, vcol_num, &vcol.x);
CData->curve_vcol.push_back_slow(vcol);
@@ -303,10 +304,6 @@ static void ExportCurveSegments(Scene *scene, Hair *hair, ParticleCurveData *CDa
}
}
if (num_curves > 0) {
VLOG(1) << "Exporting curve segments for mesh " << hair->name;
}
hair->reserve_curves(hair->num_curves() + num_curves, hair->get_curve_keys().size() + num_keys);
num_keys = 0;
@@ -355,7 +352,7 @@ static void ExportCurveSegments(Scene *scene, Hair *hair, ParticleCurveData *CDa
/* check allocation */
if ((hair->get_curve_keys().size() != num_keys) || (hair->num_curves() != num_curves)) {
VLOG(1) << "Allocation failed, clearing data";
VLOG(1) << "Hair memory allocation failed, clearing data.";
hair->clear(true);
}
}
@@ -411,16 +408,11 @@ static void export_hair_motion_validate_attribute(Hair *hair,
if (num_motion_keys != num_keys || !have_motion) {
/* No motion or hair "topology" changed, remove attributes again. */
if (num_motion_keys != num_keys) {
VLOG(1) << "Hair topology changed, removing attribute.";
}
else {
VLOG(1) << "No motion, removing attribute.";
VLOG(1) << "Hair topology changed, removing motion attribute.";
}
hair->attributes.remove(ATTR_STD_MOTION_VERTEX_POSITION);
}
else if (motion_step > 0) {
VLOG(1) << "Filling in new motion vertex position for motion_step " << motion_step;
/* Motion, fill up previous steps that we might have skipped because
* they had no motion, but we need them anyway now. */
for (int step = 0; step < motion_step; step++) {
@@ -436,16 +428,12 @@ static void export_hair_motion_validate_attribute(Hair *hair,
static void ExportCurveSegmentsMotion(Hair *hair, ParticleCurveData *CData, int motion_step)
{
VLOG(1) << "Exporting curve motion segments for hair " << hair->name << ", motion step "
<< motion_step;
/* find attribute */
Attribute *attr_mP = hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
bool new_attribute = false;
/* add new attribute if it doesn't exist already */
if (!attr_mP) {
VLOG(1) << "Creating new motion vertex position attribute";
attr_mP = hair->attributes.add(ATTR_STD_MOTION_VERTEX_POSITION);
new_attribute = true;
}
@@ -681,10 +669,6 @@ static void export_hair_curves(Scene *scene, Hair *hair, BL::Hair b_hair)
const int num_keys = b_hair.points.length();
const int num_curves = b_hair.curves.length();
if (num_curves > 0) {
VLOG(1) << "Exporting curve segments for hair " << hair->name;
}
hair->reserve_curves(num_curves, num_keys);
/* Export curves and points. */
@@ -742,15 +726,11 @@ static void export_hair_curves(Scene *scene, Hair *hair, BL::Hair b_hair)
static void export_hair_curves_motion(Hair *hair, BL::Hair b_hair, int motion_step)
{
VLOG(1) << "Exporting curve motion segments for hair " << hair->name << ", motion step "
<< motion_step;
/* Find or add attribute. */
Attribute *attr_mP = hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
bool new_attribute = false;
if (!attr_mP) {
VLOG(1) << "Creating new motion vertex position attribute";
attr_mP = hair->attributes.add(ATTR_STD_MOTION_VERTEX_POSITION);
new_attribute = true;
}

View File

@@ -14,11 +14,11 @@
* limitations under the License.
*/
#include "blender/blender_device.h"
#include "blender/blender_session.h"
#include "blender/blender_util.h"
#include "blender/device.h"
#include "blender/session.h"
#include "blender/util.h"
#include "util/util_foreach.h"
#include "util/foreach.h"
CCL_NAMESPACE_BEGIN

View File

@@ -14,11 +14,11 @@
* limitations under the License.
*/
#include "blender/blender_gpu_display.h"
#include "blender/display_driver.h"
#include "device/device.h"
#include "util/util_logging.h"
#include "util/util_opengl.h"
#include "util/log.h"
#include "util/opengl.h"
extern "C" {
struct RenderEngine;
@@ -273,17 +273,17 @@ uint BlenderDisplaySpaceShader::get_shader_program()
}
/* --------------------------------------------------------------------
* BlenderGPUDisplay.
* BlenderDisplayDriver.
*/
BlenderGPUDisplay::BlenderGPUDisplay(BL::RenderEngine &b_engine, BL::Scene &b_scene)
BlenderDisplayDriver::BlenderDisplayDriver(BL::RenderEngine &b_engine, BL::Scene &b_scene)
: b_engine_(b_engine), display_shader_(BlenderDisplayShader::create(b_engine, b_scene))
{
/* Create context while on the main thread. */
gl_context_create();
}
BlenderGPUDisplay::~BlenderGPUDisplay()
BlenderDisplayDriver::~BlenderDisplayDriver()
{
gl_resources_destroy();
}
@@ -292,19 +292,18 @@ BlenderGPUDisplay::~BlenderGPUDisplay()
* Update procedure.
*/
bool BlenderGPUDisplay::do_update_begin(const GPUDisplayParams &params,
bool BlenderDisplayDriver::update_begin(const Params &params,
int texture_width,
int texture_height)
{
/* Note that it's the responsibility of BlenderGPUDisplay to ensure updating and drawing
/* Note that it's the responsibility of BlenderDisplayDriver to ensure updating and drawing
* the texture does not happen at the same time. This is achieved indirectly.
*
* When enabling the OpenGL context, it uses an internal mutex lock DST.gl_context_lock.
* This same lock is also held when do_draw() is called, which together ensure mutual
* exclusion.
*
* This locking is not performed at the GPU display level, because that would cause lock
* inversion. */
* This locking is not performed on the Cycles side, because that would cause lock inversion. */
if (!gl_context_enable()) {
return false;
}
@@ -335,7 +334,7 @@ bool BlenderGPUDisplay::do_update_begin(const GPUDisplayParams &params,
/* Update PBO dimensions if needed.
*
* NOTE: Allocate the PBO for the the size which will fit the final render resolution (as in,
* NOTE: Allocate the PBO for the size which will fit the final render resolution (as in,
* at a resolution divider 1. This was we don't need to recreate graphics interoperability
* objects which are costly and which are tied to the specific underlying buffer size.
* The downside of this approach is that when graphics interoperability is not used we are
@@ -358,10 +357,12 @@ bool BlenderGPUDisplay::do_update_begin(const GPUDisplayParams &params,
* centralized place. */
texture_.need_update = true;
texture_.params = params;
return true;
}
void BlenderGPUDisplay::do_update_end()
void BlenderDisplayDriver::update_end()
{
gl_upload_sync_ = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
glFlush();
@@ -369,54 +370,18 @@ void BlenderGPUDisplay::do_update_end()
gl_context_disable();
}
/* --------------------------------------------------------------------
* Texture update from CPU buffer.
*/
void BlenderGPUDisplay::do_copy_pixels_to_texture(
const half4 *rgba_pixels, int texture_x, int texture_y, int pixels_width, int pixels_height)
{
/* This call copies pixels to a Pixel Buffer Object (PBO) which is much cheaper from CPU time
* point of view than to copy data directly to the OpenGL texture.
*
* The possible downside of this approach is that it might require a higher peak memory when
* doing partial updates of the texture (although, in practice even partial updates might peak
* with a full-frame buffer stored on the CPU if the GPU is currently occupied). */
half4 *mapped_rgba_pixels = map_texture_buffer();
if (!mapped_rgba_pixels) {
return;
}
if (texture_x == 0 && texture_y == 0 && pixels_width == texture_.width &&
pixels_height == texture_.height) {
const size_t size_in_bytes = sizeof(half4) * texture_.width * texture_.height;
memcpy(mapped_rgba_pixels, rgba_pixels, size_in_bytes);
}
else {
const half4 *rgba_row = rgba_pixels;
half4 *mapped_rgba_row = mapped_rgba_pixels + texture_y * texture_.width + texture_x;
for (int y = 0; y < pixels_height;
++y, rgba_row += pixels_width, mapped_rgba_row += texture_.width) {
memcpy(mapped_rgba_row, rgba_row, sizeof(half4) * pixels_width);
}
}
unmap_texture_buffer();
}
/* --------------------------------------------------------------------
* Texture buffer mapping.
*/
half4 *BlenderGPUDisplay::do_map_texture_buffer()
half4 *BlenderDisplayDriver::map_texture_buffer()
{
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, texture_.gl_pbo_id);
half4 *mapped_rgba_pixels = reinterpret_cast<half4 *>(
glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY));
if (!mapped_rgba_pixels) {
LOG(ERROR) << "Error mapping BlenderGPUDisplay pixel buffer object.";
LOG(ERROR) << "Error mapping BlenderDisplayDriver pixel buffer object.";
}
if (texture_.need_clear) {
@@ -431,7 +396,7 @@ half4 *BlenderGPUDisplay::do_map_texture_buffer()
return mapped_rgba_pixels;
}
void BlenderGPUDisplay::do_unmap_texture_buffer()
void BlenderDisplayDriver::unmap_texture_buffer()
{
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
@@ -442,9 +407,9 @@ void BlenderGPUDisplay::do_unmap_texture_buffer()
* Graphics interoperability.
*/
DeviceGraphicsInteropDestination BlenderGPUDisplay::do_graphics_interop_get()
BlenderDisplayDriver::GraphicsInterop BlenderDisplayDriver::graphics_interop_get()
{
DeviceGraphicsInteropDestination interop_dst;
GraphicsInterop interop_dst;
interop_dst.buffer_width = texture_.buffer_width;
interop_dst.buffer_height = texture_.buffer_height;
@@ -456,12 +421,12 @@ DeviceGraphicsInteropDestination BlenderGPUDisplay::do_graphics_interop_get()
return interop_dst;
}
void BlenderGPUDisplay::graphics_interop_activate()
void BlenderDisplayDriver::graphics_interop_activate()
{
gl_context_enable();
}
void BlenderGPUDisplay::graphics_interop_deactivate()
void BlenderDisplayDriver::graphics_interop_deactivate()
{
gl_context_disable();
}
@@ -470,27 +435,21 @@ void BlenderGPUDisplay::graphics_interop_deactivate()
* Drawing.
*/
void BlenderGPUDisplay::clear()
void BlenderDisplayDriver::clear()
{
texture_.need_clear = true;
}
void BlenderGPUDisplay::set_zoom(float zoom_x, float zoom_y)
void BlenderDisplayDriver::set_zoom(float zoom_x, float zoom_y)
{
zoom_ = make_float2(zoom_x, zoom_y);
}
void BlenderGPUDisplay::do_draw(const GPUDisplayParams &params)
void BlenderDisplayDriver::draw(const Params &params)
{
/* See do_update_begin() for why no locking is required here. */
const bool transparent = true; // TODO(sergey): Derive this from Film.
if (texture_.need_clear) {
/* Texture is requested to be cleared and was not yet cleared.
* Do early return which should be equivalent of drawing all-zero texture. */
return;
}
if (!gl_draw_resources_ensure()) {
return;
}
@@ -499,6 +458,16 @@ void BlenderGPUDisplay::do_draw(const GPUDisplayParams &params)
gl_context_mutex_.lock();
}
if (texture_.need_clear) {
/* Texture is requested to be cleared and was not yet cleared.
*
* Do early return which should be equivalent of drawing all-zero texture.
* Watch out for the lock though so that the clear happening during update is properly
* synchronized here. */
gl_context_mutex_.unlock();
return;
}
if (gl_upload_sync_) {
glWaitSync((GLsync)gl_upload_sync_, 0, GL_TIMEOUT_IGNORED);
}
@@ -580,7 +549,7 @@ void BlenderGPUDisplay::do_draw(const GPUDisplayParams &params)
}
}
void BlenderGPUDisplay::gl_context_create()
void BlenderDisplayDriver::gl_context_create()
{
/* When rendering in viewport there is no render context available via engine.
* Check whether own context is to be created here.
@@ -609,7 +578,7 @@ void BlenderGPUDisplay::gl_context_create()
}
}
bool BlenderGPUDisplay::gl_context_enable()
bool BlenderDisplayDriver::gl_context_enable()
{
if (use_gl_context_) {
if (!gl_context_) {
@@ -624,7 +593,7 @@ bool BlenderGPUDisplay::gl_context_enable()
return true;
}
void BlenderGPUDisplay::gl_context_disable()
void BlenderDisplayDriver::gl_context_disable()
{
if (use_gl_context_) {
if (gl_context_) {
@@ -637,7 +606,7 @@ void BlenderGPUDisplay::gl_context_disable()
RE_engine_render_context_disable(reinterpret_cast<RenderEngine *>(b_engine_.ptr.data));
}
void BlenderGPUDisplay::gl_context_dispose()
void BlenderDisplayDriver::gl_context_dispose()
{
if (gl_context_) {
const bool drw_state = DRW_opengl_context_release();
@@ -649,7 +618,7 @@ void BlenderGPUDisplay::gl_context_dispose()
}
}
bool BlenderGPUDisplay::gl_draw_resources_ensure()
bool BlenderDisplayDriver::gl_draw_resources_ensure()
{
if (!texture_.gl_id) {
/* If there is no texture allocated, there is nothing to draw. Inform the draw call that it can
@@ -676,7 +645,7 @@ bool BlenderGPUDisplay::gl_draw_resources_ensure()
return true;
}
void BlenderGPUDisplay::gl_resources_destroy()
void BlenderDisplayDriver::gl_resources_destroy()
{
gl_context_enable();
@@ -699,7 +668,7 @@ void BlenderGPUDisplay::gl_resources_destroy()
gl_context_dispose();
}
bool BlenderGPUDisplay::gl_texture_resources_ensure()
bool BlenderDisplayDriver::gl_texture_resources_ensure()
{
if (texture_.creation_attempted) {
return texture_.is_created;
@@ -736,7 +705,7 @@ bool BlenderGPUDisplay::gl_texture_resources_ensure()
return true;
}
void BlenderGPUDisplay::texture_update_if_needed()
void BlenderDisplayDriver::texture_update_if_needed()
{
if (!texture_.need_update) {
return;
@@ -750,8 +719,23 @@ void BlenderGPUDisplay::texture_update_if_needed()
texture_.need_update = false;
}
void BlenderGPUDisplay::vertex_buffer_update(const GPUDisplayParams &params)
void BlenderDisplayDriver::vertex_buffer_update(const Params & /*params*/)
{
/* Draw at the parameters for which the texture has been updated for. This allows to always draw
* texture during bordered-rendered camera view without flickering. The validness of the display
* parameters for a texture is guaranteed by the initial "clear" state which makes drawing to
* have an early output.
*
* Such approach can cause some extra "jelly" effect during panning, but it is not more jelly
* than overlay of selected objects. Also, it's possible to redraw texture at an intersection of
* the texture draw parameters and the latest updated draw parameters (although, complexity of
* doing it might not worth it. */
const int x = texture_.params.full_offset.x;
const int y = texture_.params.full_offset.y;
const int width = texture_.params.size.x;
const int height = texture_.params.size.y;
/* Invalidate old contents - avoids stalling if the buffer is still waiting in queue to be
* rendered. */
glBufferData(GL_ARRAY_BUFFER, 16 * sizeof(float), NULL, GL_STREAM_DRAW);
@@ -763,23 +747,23 @@ void BlenderGPUDisplay::vertex_buffer_update(const GPUDisplayParams &params)
vpointer[0] = 0.0f;
vpointer[1] = 0.0f;
vpointer[2] = params.offset.x;
vpointer[3] = params.offset.y;
vpointer[2] = x;
vpointer[3] = y;
vpointer[4] = 1.0f;
vpointer[5] = 0.0f;
vpointer[6] = (float)params.size.x + params.offset.x;
vpointer[7] = params.offset.y;
vpointer[6] = x + width;
vpointer[7] = y;
vpointer[8] = 1.0f;
vpointer[9] = 1.0f;
vpointer[10] = (float)params.size.x + params.offset.x;
vpointer[11] = (float)params.size.y + params.offset.y;
vpointer[10] = x + width;
vpointer[11] = y + height;
vpointer[12] = 0.0f;
vpointer[13] = 1.0f;
vpointer[14] = params.offset.x;
vpointer[15] = (float)params.size.y + params.offset.y;
vpointer[14] = x;
vpointer[15] = y + height;
glUnmapBuffer(GL_ARRAY_BUFFER);
}

View File

@@ -22,12 +22,14 @@
#include "RNA_blender_cpp.h"
#include "render/gpu_display.h"
#include "util/util_unique_ptr.h"
#include "session/display_driver.h"
#include "util/thread.h"
#include "util/unique_ptr.h"
CCL_NAMESPACE_BEGIN
/* Base class of shader used for GPU display rendering. */
/* Base class of shader used for display driver rendering. */
class BlenderDisplayShader {
public:
static constexpr const char *position_attribute_name = "pos";
@@ -96,11 +98,11 @@ class BlenderDisplaySpaceShader : public BlenderDisplayShader {
uint shader_program_ = 0;
};
/* GPU display implementation which is specific for Blender viewport integration. */
class BlenderGPUDisplay : public GPUDisplay {
/* Display driver implementation which is specific for Blender viewport integration. */
class BlenderDisplayDriver : public DisplayDriver {
public:
BlenderGPUDisplay(BL::RenderEngine &b_engine, BL::Scene &b_scene);
~BlenderGPUDisplay();
BlenderDisplayDriver(BL::RenderEngine &b_engine, BL::Scene &b_scene);
~BlenderDisplayDriver();
virtual void graphics_interop_activate() override;
virtual void graphics_interop_deactivate() override;
@@ -110,22 +112,15 @@ class BlenderGPUDisplay : public GPUDisplay {
void set_zoom(float zoom_x, float zoom_y);
protected:
virtual bool do_update_begin(const GPUDisplayParams &params,
int texture_width,
int texture_height) override;
virtual void do_update_end() override;
virtual bool update_begin(const Params &params, int texture_width, int texture_height) override;
virtual void update_end() override;
virtual void do_copy_pixels_to_texture(const half4 *rgba_pixels,
int texture_x,
int texture_y,
int pixels_width,
int pixels_height) override;
virtual void do_draw(const GPUDisplayParams &params) override;
virtual half4 *map_texture_buffer() override;
virtual void unmap_texture_buffer() override;
virtual half4 *do_map_texture_buffer() override;
virtual void do_unmap_texture_buffer() override;
virtual GraphicsInterop graphics_interop_get() override;
virtual DeviceGraphicsInteropDestination do_graphics_interop_get() override;
virtual void draw(const Params &params) override;
/* Helper function which allocates new GPU context. */
void gl_context_create();
@@ -152,13 +147,13 @@ class BlenderGPUDisplay : public GPUDisplay {
* This buffer is used to render texture in the viewport.
*
* NOTE: The buffer needs to be bound. */
void vertex_buffer_update(const GPUDisplayParams &params);
void vertex_buffer_update(const Params &params);
BL::RenderEngine b_engine_;
/* OpenGL context which is used the render engine doesn't have its own. */
void *gl_context_ = nullptr;
/* The when Blender RenderEngine side context is not available and the GPUDisplay is to create
/* The when Blender RenderEngine side context is not available and the DisplayDriver is to create
* its own context. */
bool use_gl_context_ = false;
/* Mutex used to guard the `gl_context_`. */
@@ -193,6 +188,9 @@ class BlenderGPUDisplay : public GPUDisplay {
/* Dimensions of the underlying PBO. */
int buffer_width = 0;
int buffer_height = 0;
/* Display parameters the texture has been updated for. */
Params params;
} texture_;
unique_ptr<BlenderDisplayShader> display_shader_;

View File

@@ -15,17 +15,17 @@
* limitations under the License.
*/
#include "render/curves.h"
#include "render/hair.h"
#include "render/mesh.h"
#include "render/object.h"
#include "render/volume.h"
#include "scene/curves.h"
#include "scene/hair.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "scene/volume.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "blender/sync.h"
#include "blender/util.h"
#include "util/util_foreach.h"
#include "util/util_task.h"
#include "util/foreach.h"
#include "util/task.h"
CCL_NAMESPACE_BEGIN

View File

@@ -19,12 +19,12 @@
#include <string.h>
#include "render/geometry.h"
#include "render/scene.h"
#include "scene/geometry.h"
#include "scene/scene.h"
#include "util/util_map.h"
#include "util/util_set.h"
#include "util/util_vector.h"
#include "util/map.h"
#include "util/set.h"
#include "util/vector.h"
CCL_NAMESPACE_BEGIN

View File

@@ -16,9 +16,9 @@
#include "MEM_guardedalloc.h"
#include "blender/blender_image.h"
#include "blender/blender_session.h"
#include "blender/blender_util.h"
#include "blender/image.h"
#include "blender/session.h"
#include "blender/util.h"
CCL_NAMESPACE_BEGIN

View File

@@ -19,7 +19,7 @@
#include "RNA_blender_cpp.h"
#include "render/image.h"
#include "scene/image.h"
CCL_NAMESPACE_BEGIN

View File

@@ -16,12 +16,12 @@
* limitations under the License.
*/
#include "render/light.h"
#include "scene/light.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "blender/sync.h"
#include "blender/util.h"
#include "util/util_hash.h"
#include "util/hash.h"
CCL_NAMESPACE_BEGIN

View File

@@ -15,7 +15,7 @@
*/
#include "blender/CCL_api.h"
#include "util/util_logging.h"
#include "util/log.h"
void CCL_init_logging(const char *argv0)
{

View File

@@ -14,25 +14,26 @@
* limitations under the License.
*/
#include "render/camera.h"
#include "render/colorspace.h"
#include "render/mesh.h"
#include "render/object.h"
#include "render/scene.h"
#include "blender/session.h"
#include "blender/sync.h"
#include "blender/util.h"
#include "blender/blender_session.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "scene/camera.h"
#include "scene/colorspace.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "scene/scene.h"
#include "subd/subd_patch.h"
#include "subd/subd_split.h"
#include "subd/patch.h"
#include "subd/split.h"
#include "util/util_algorithm.h"
#include "util/util_disjoint_set.h"
#include "util/util_foreach.h"
#include "util/util_hash.h"
#include "util/util_logging.h"
#include "util/util_math.h"
#include "util/algorithm.h"
#include "util/color.h"
#include "util/disjoint_set.h"
#include "util/foreach.h"
#include "util/hash.h"
#include "util/log.h"
#include "util/math.h"
#include "mikktspace.h"
@@ -554,7 +555,7 @@ static void attr_create_vertex_color(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh,
/* Create uv map attributes. */
static void attr_create_uv_map(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh)
{
if (b_mesh.uv_layers.length() != 0) {
if (!b_mesh.uv_layers.empty()) {
for (BL::MeshUVLoopLayer &l : b_mesh.uv_layers) {
const bool active_render = l.active_render();
AttributeStandard uv_std = (active_render) ? ATTR_STD_UV : ATTR_STD_NONE;
@@ -618,7 +619,7 @@ static void attr_create_uv_map(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh)
static void attr_create_subd_uv_map(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, bool subdivide_uvs)
{
if (b_mesh.uv_layers.length() != 0) {
if (!b_mesh.uv_layers.empty()) {
BL::Mesh::uv_layers_iterator l;
int i = 0;
@@ -950,7 +951,7 @@ static void create_mesh(Scene *scene,
N = attr_N->data_float3();
/* create generated coordinates from undeformed coordinates */
const bool need_default_tangent = (subdivision == false) && (b_mesh.uv_layers.length() == 0) &&
const bool need_default_tangent = (subdivision == false) && (b_mesh.uv_layers.empty()) &&
(mesh->need_attribute(scene, ATTR_STD_UV_TANGENT));
if (mesh->need_attribute(scene, ATTR_STD_GENERATED) || need_default_tangent) {
Attribute *attr = attributes.add(ATTR_STD_GENERATED);

View File

@@ -14,26 +14,26 @@
* limitations under the License.
*/
#include "render/alembic.h"
#include "render/camera.h"
#include "render/graph.h"
#include "render/integrator.h"
#include "render/light.h"
#include "render/mesh.h"
#include "render/nodes.h"
#include "render/object.h"
#include "render/particles.h"
#include "render/scene.h"
#include "render/shader.h"
#include "blender/object_cull.h"
#include "blender/sync.h"
#include "blender/util.h"
#include "blender/blender_object_cull.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "scene/alembic.h"
#include "scene/camera.h"
#include "scene/integrator.h"
#include "scene/light.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "scene/particles.h"
#include "scene/scene.h"
#include "scene/shader.h"
#include "scene/shader_graph.h"
#include "scene/shader_nodes.h"
#include "util/util_foreach.h"
#include "util/util_hash.h"
#include "util/util_logging.h"
#include "util/util_task.h"
#include "util/foreach.h"
#include "util/hash.h"
#include "util/log.h"
#include "util/task.h"
CCL_NAMESPACE_BEGIN
@@ -62,31 +62,46 @@ bool BlenderSync::BKE_object_is_modified(BL::Object &b_ob)
return false;
}
bool BlenderSync::object_is_geometry(BL::Object &b_ob)
bool BlenderSync::object_is_geometry(BObjectInfo &b_ob_info)
{
BL::ID b_ob_data = b_ob.data();
BL::ID b_ob_data = b_ob_info.object_data;
if (!b_ob_data) {
return false;
}
BL::Object::type_enum type = b_ob.type();
BL::Object::type_enum type = b_ob_info.iter_object.type();
if (type == BL::Object::type_VOLUME || type == BL::Object::type_HAIR) {
/* Will be exported attached to mesh. */
return true;
}
else if (type == BL::Object::type_CURVE) {
/* Skip exporting curves without faces, overhead can be
* significant if there are many for path animation. */
BL::Curve b_curve(b_ob_data);
return (b_curve.bevel_object() || b_curve.extrude() != 0.0f || b_curve.bevel_depth() != 0.0f ||
b_curve.dimensions() == BL::Curve::dimensions_2D || b_ob.modifiers.length());
/* Other object types that are not meshes but evaluate to meshes are presented to render engines
* as separate instance objects. Metaballs and surface objects have not been affected by that
* change yet. */
if (type == BL::Object::type_SURFACE || type == BL::Object::type_META) {
return true;
}
else {
return (b_ob_data.is_a(&RNA_Mesh) || b_ob_data.is_a(&RNA_Curve) ||
b_ob_data.is_a(&RNA_MetaBall));
return b_ob_data.is_a(&RNA_Mesh);
}
bool BlenderSync::object_can_have_geometry(BL::Object &b_ob)
{
BL::Object::type_enum type = b_ob.type();
switch (type) {
case BL::Object::type_MESH:
case BL::Object::type_CURVE:
case BL::Object::type_SURFACE:
case BL::Object::type_META:
case BL::Object::type_FONT:
case BL::Object::type_HAIR:
case BL::Object::type_POINTCLOUD:
case BL::Object::type_VOLUME:
return true;
default:
return false;
}
}
@@ -104,23 +119,22 @@ void BlenderSync::sync_object_motion_init(BL::Object &b_parent, BL::Object &b_ob
array<Transform> motion;
object->set_motion(motion);
Scene::MotionType need_motion = scene->need_motion();
if (need_motion == Scene::MOTION_NONE || !object->get_geometry()) {
Geometry *geom = object->get_geometry();
if (!geom) {
return;
}
Geometry *geom = object->get_geometry();
int motion_steps = 0;
bool use_motion_blur = false;
Scene::MotionType need_motion = scene->need_motion();
if (need_motion == Scene::MOTION_BLUR) {
motion_steps = object_motion_steps(b_parent, b_ob, Object::MAX_MOTION_STEPS);
if (motion_steps && object_use_deform_motion(b_parent, b_ob)) {
use_motion_blur = true;
}
}
else {
else if (need_motion != Scene::MOTION_NONE) {
motion_steps = 3;
}
@@ -162,6 +176,11 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
if (is_instance) {
persistent_id_array = b_instance.persistent_id();
persistent_id = persistent_id_array.data;
if (!b_ob_info.is_real_object_data()) {
/* Remember which object data the geometry is coming from, so that we can sync it when the
* object has changed. */
instance_geometries_by_object[b_ob_info.real_object.ptr.data].insert(b_ob_info.object_data);
}
}
/* light is handled separately */
@@ -188,7 +207,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
}
/* only interested in object that we can create meshes from */
if (!object_is_geometry(b_ob)) {
if (!object_is_geometry(b_ob_info)) {
return NULL;
}
@@ -275,7 +294,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
object->set_visibility(visibility);
object->set_is_shadow_catcher(b_ob.is_shadow_catcher());
object->set_is_shadow_catcher(b_ob.is_shadow_catcher() || b_parent.is_shadow_catcher());
float shadow_terminator_shading_offset = get_float(cobject, "shadow_terminator_offset");
object->set_shadow_terminator_shading_offset(shadow_terminator_shading_offset);
@@ -561,6 +580,7 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
else {
geometry_motion_synced.clear();
}
instance_geometries_by_object.clear();
/* initialize culling */
BlenderObjectCulling culling(scene, b_scene);

View File

@@ -16,10 +16,10 @@
#include <cstdlib>
#include "render/camera.h"
#include "scene/camera.h"
#include "blender/blender_object_cull.h"
#include "blender/blender_util.h"
#include "blender/object_cull.h"
#include "blender/util.h"
CCL_NAMESPACE_BEGIN

View File

@@ -17,8 +17,8 @@
#ifndef __BLENDER_OBJECT_CULL_H__
#define __BLENDER_OBJECT_CULL_H__
#include "blender/blender_sync.h"
#include "util/util_types.h"
#include "blender/sync.h"
#include "util/types.h"
CCL_NAMESPACE_BEGIN

View File

@@ -0,0 +1,126 @@
/*
* Copyright 2021 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "blender/output_driver.h"
CCL_NAMESPACE_BEGIN
BlenderOutputDriver::BlenderOutputDriver(BL::RenderEngine &b_engine) : b_engine_(b_engine)
{
}
BlenderOutputDriver::~BlenderOutputDriver()
{
}
bool BlenderOutputDriver::read_render_tile(const Tile &tile)
{
/* Get render result. */
BL::RenderResult b_rr = b_engine_.begin_result(tile.offset.x,
tile.offset.y,
tile.size.x,
tile.size.y,
tile.layer.c_str(),
tile.view.c_str());
/* Can happen if the intersected rectangle gives 0 width or height. */
if (b_rr.ptr.data == NULL) {
return false;
}
BL::RenderResult::layers_iterator b_single_rlay;
b_rr.layers.begin(b_single_rlay);
/* layer will be missing if it was disabled in the UI */
if (b_single_rlay == b_rr.layers.end()) {
return false;
}
BL::RenderLayer b_rlay = *b_single_rlay;
vector<float> pixels(tile.size.x * tile.size.y * 4);
/* Copy each pass.
* TODO:copy only the required ones for better performance? */
for (BL::RenderPass &b_pass : b_rlay.passes) {
tile.set_pass_pixels(b_pass.name(), b_pass.channels(), (float *)b_pass.rect());
}
b_engine_.end_result(b_rr, false, false, false);
return true;
}
bool BlenderOutputDriver::update_render_tile(const Tile &tile)
{
/* Use final write for preview renders, otherwise render result wouldn't be be updated
* quickly on Blender side. For all other cases we use the display driver. */
if (b_engine_.is_preview()) {
write_render_tile(tile);
return true;
}
/* Don't highlight full-frame tile. */
if (!(tile.size == tile.full_size)) {
b_engine_.tile_highlight_clear_all();
b_engine_.tile_highlight_set(tile.offset.x, tile.offset.y, tile.size.x, tile.size.y, true);
}
return false;
}
void BlenderOutputDriver::write_render_tile(const Tile &tile)
{
b_engine_.tile_highlight_clear_all();
/* Get render result. */
BL::RenderResult b_rr = b_engine_.begin_result(tile.offset.x,
tile.offset.y,
tile.size.x,
tile.size.y,
tile.layer.c_str(),
tile.view.c_str());
/* Can happen if the intersected rectangle gives 0 width or height. */
if (b_rr.ptr.data == NULL) {
return;
}
BL::RenderResult::layers_iterator b_single_rlay;
b_rr.layers.begin(b_single_rlay);
/* Layer will be missing if it was disabled in the UI. */
if (b_single_rlay == b_rr.layers.end()) {
return;
}
BL::RenderLayer b_rlay = *b_single_rlay;
vector<float> pixels(tile.size.x * tile.size.y * 4);
/* Copy each pass. */
for (BL::RenderPass &b_pass : b_rlay.passes) {
if (!tile.get_pass_pixels(b_pass.name(), b_pass.channels(), &pixels[0])) {
memset(&pixels[0], 0, pixels.size() * sizeof(float));
}
b_pass.rect(&pixels[0]);
}
b_engine_.end_result(b_rr, true, false, true);
}
CCL_NAMESPACE_END

View File

@@ -0,0 +1,40 @@
/*
* Copyright 2021 Blender Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "MEM_guardedalloc.h"
#include "RNA_blender_cpp.h"
#include "session/output_driver.h"
CCL_NAMESPACE_BEGIN
class BlenderOutputDriver : public OutputDriver {
public:
explicit BlenderOutputDriver(BL::RenderEngine &b_engine);
~BlenderOutputDriver();
virtual void write_render_tile(const Tile &tile) override;
virtual bool update_render_tile(const Tile &tile) override;
virtual bool read_render_tile(const Tile &tile) override;
protected:
BL::RenderEngine b_engine_;
};
CCL_NAMESPACE_END

View File

@@ -14,14 +14,14 @@
* limitations under the License.
*/
#include "render/mesh.h"
#include "render/object.h"
#include "render/particles.h"
#include "scene/particles.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "blender/sync.h"
#include "blender/util.h"
#include "util/util_foreach.h"
#include "util/foreach.h"
CCL_NAMESPACE_BEGIN

View File

@@ -18,28 +18,28 @@
#include "blender/CCL_api.h"
#include "blender/blender_device.h"
#include "blender/blender_session.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "blender/device.h"
#include "blender/session.h"
#include "blender/sync.h"
#include "blender/util.h"
#include "render/denoising.h"
#include "render/merge.h"
#include "session/denoising.h"
#include "session/merge.h"
#include "util/util_debug.h"
#include "util/util_foreach.h"
#include "util/util_logging.h"
#include "util/util_md5.h"
#include "util/util_opengl.h"
#include "util/util_openimagedenoise.h"
#include "util/util_path.h"
#include "util/util_string.h"
#include "util/util_task.h"
#include "util/util_tbb.h"
#include "util/util_types.h"
#include "util/debug.h"
#include "util/foreach.h"
#include "util/log.h"
#include "util/md5.h"
#include "util/opengl.h"
#include "util/openimagedenoise.h"
#include "util/path.h"
#include "util/string.h"
#include "util/task.h"
#include "util/tbb.h"
#include "util/types.h"
#ifdef WITH_OSL
# include "render/osl.h"
# include "scene/osl.h"
# include <OSL/oslconfig.h>
# include <OSL/oslquery.h>
@@ -157,8 +157,6 @@ static PyObject *init_func(PyObject * /*self*/, PyObject *args)
DebugFlags().running_inside_blender = true;
VLOG(2) << "Debug flags initialized to:\n" << DebugFlags();
Py_RETURN_NONE;
}
@@ -885,8 +883,6 @@ static PyObject *debug_flags_update_func(PyObject * /*self*/, PyObject *args)
debug_flags_sync_from_scene(b_scene);
VLOG(2) << "Debug flags set to:\n" << DebugFlags();
debug_flags_set = true;
Py_RETURN_NONE;
@@ -896,7 +892,6 @@ static PyObject *debug_flags_reset_func(PyObject * /*self*/, PyObject * /*args*/
{
debug_flags_reset();
if (debug_flags_set) {
VLOG(2) << "Debug flags reset to:\n" << DebugFlags();
debug_flags_set = false;
}
Py_RETURN_NONE;

View File

@@ -17,35 +17,36 @@
#include <stdlib.h>
#include "device/device.h"
#include "render/background.h"
#include "render/buffers.h"
#include "render/camera.h"
#include "render/colorspace.h"
#include "render/film.h"
#include "render/integrator.h"
#include "render/light.h"
#include "render/mesh.h"
#include "render/object.h"
#include "render/scene.h"
#include "render/session.h"
#include "render/shader.h"
#include "render/stats.h"
#include "scene/background.h"
#include "scene/camera.h"
#include "scene/colorspace.h"
#include "scene/film.h"
#include "scene/integrator.h"
#include "scene/light.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "scene/scene.h"
#include "scene/shader.h"
#include "scene/stats.h"
#include "session/buffers.h"
#include "session/session.h"
#include "util/util_algorithm.h"
#include "util/util_color.h"
#include "util/util_foreach.h"
#include "util/util_function.h"
#include "util/util_hash.h"
#include "util/util_logging.h"
#include "util/util_murmurhash.h"
#include "util/util_path.h"
#include "util/util_progress.h"
#include "util/util_time.h"
#include "util/algorithm.h"
#include "util/color.h"
#include "util/foreach.h"
#include "util/function.h"
#include "util/hash.h"
#include "util/log.h"
#include "util/murmurhash.h"
#include "util/path.h"
#include "util/progress.h"
#include "util/time.h"
#include "blender/blender_gpu_display.h"
#include "blender/blender_session.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "blender/display_driver.h"
#include "blender/output_driver.h"
#include "blender/session.h"
#include "blender/sync.h"
#include "blender/util.h"
CCL_NAMESPACE_BEGIN
@@ -128,7 +129,7 @@ void BlenderSession::create_session()
/* reset status/progress */
last_status = "";
last_error = "";
last_progress = -1.0f;
last_progress = -1.0;
start_resize_time = 0.0;
/* create session */
@@ -157,13 +158,6 @@ void BlenderSession::create_session()
b_v3d, b_rv3d, scene->camera, width, height);
session->reset(session_params, buffer_params);
/* Create GPU display. */
if (!b_engine.is_preview() && !headless) {
unique_ptr<BlenderGPUDisplay> gpu_display = make_unique<BlenderGPUDisplay>(b_engine, b_scene);
gpu_display_ = gpu_display.get();
session->set_gpu_display(move(gpu_display));
}
/* Viewport and preview (as in, material preview) does not do tiled rendering, so can inform
* engine that no tracking of the tiles state is needed.
* The offline rendering will make a decision when tile is being written. The penalty of asking
@@ -276,96 +270,8 @@ void BlenderSession::free_session()
delete session;
session = nullptr;
}
void BlenderSession::read_render_tile()
{
const int2 tile_offset = session->get_render_tile_offset();
const int2 tile_size = session->get_render_tile_size();
/* get render result */
BL::RenderResult b_rr = b_engine.begin_result(tile_offset.x,
tile_offset.y,
tile_size.x,
tile_size.y,
b_rlay_name.c_str(),
b_rview_name.c_str());
/* can happen if the intersected rectangle gives 0 width or height */
if (b_rr.ptr.data == NULL) {
return;
}
BL::RenderResult::layers_iterator b_single_rlay;
b_rr.layers.begin(b_single_rlay);
/* layer will be missing if it was disabled in the UI */
if (b_single_rlay == b_rr.layers.end())
return;
BL::RenderLayer b_rlay = *b_single_rlay;
vector<float> pixels(tile_size.x * tile_size.y * 4);
/* Copy each pass.
* TODO:copy only the required ones for better performance? */
for (BL::RenderPass &b_pass : b_rlay.passes) {
session->set_render_tile_pixels(b_pass.name(), b_pass.channels(), (float *)b_pass.rect());
}
b_engine.end_result(b_rr, false, false, false);
}
void BlenderSession::write_render_tile()
{
const int2 tile_offset = session->get_render_tile_offset();
const int2 tile_size = session->get_render_tile_size();
const string_view render_layer_name = session->get_render_tile_layer();
const string_view render_view_name = session->get_render_tile_view();
b_engine.tile_highlight_clear_all();
/* get render result */
BL::RenderResult b_rr = b_engine.begin_result(tile_offset.x,
tile_offset.y,
tile_size.x,
tile_size.y,
render_layer_name.c_str(),
render_view_name.c_str());
/* can happen if the intersected rectangle gives 0 width or height */
if (b_rr.ptr.data == NULL) {
return;
}
BL::RenderResult::layers_iterator b_single_rlay;
b_rr.layers.begin(b_single_rlay);
/* layer will be missing if it was disabled in the UI */
if (b_single_rlay == b_rr.layers.end()) {
return;
}
BL::RenderLayer b_rlay = *b_single_rlay;
write_render_result(b_rlay);
b_engine.end_result(b_rr, true, false, true);
}
void BlenderSession::update_render_tile()
{
if (!session->has_multiple_render_tiles()) {
/* Don't highlight full-frame tile. */
return;
}
const int2 tile_offset = session->get_render_tile_offset();
const int2 tile_size = session->get_render_tile_size();
b_engine.tile_highlight_clear_all();
b_engine.tile_highlight_set(tile_offset.x, tile_offset.y, tile_size.x, tile_size.y, true);
display_driver_ = nullptr;
}
void BlenderSession::full_buffer_written(string_view filename)
@@ -441,18 +347,9 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_)
return;
}
/* set callback to write out render results */
session->write_render_tile_cb = [&]() { write_render_tile(); };
/* Use final write for preview renders, otherwise render result wouldn't be be updated on Blender
* side. */
/* TODO(sergey): Investigate whether GPUDisplay can be used for the preview as well. */
if (b_engine.is_preview()) {
session->update_render_tile_cb = [&]() { write_render_tile(); };
}
else {
session->update_render_tile_cb = [&]() { update_render_tile(); };
}
/* Create driver to write out render results. */
ensure_display_driver_if_needed();
session->set_output_driver(make_unique<BlenderOutputDriver>(b_engine));
session->full_buffer_written_cb = [&](string_view filename) { full_buffer_written(filename); };
@@ -598,10 +495,13 @@ void BlenderSession::render_frame_finish()
path_remove(filename);
}
/* clear callback */
session->write_render_tile_cb = function_null;
session->update_render_tile_cb = function_null;
/* Clear driver. */
session->set_output_driver(nullptr);
session->full_buffer_written_cb = function_null;
/* All the files are handled.
* Clear the list so that this session can be re-used by Persistent Data. */
full_buffer_files_.clear();
}
static PassType bake_type_to_pass(const string &bake_type_str, const int bake_filter)
@@ -706,9 +606,8 @@ void BlenderSession::bake(BL::Depsgraph &b_depsgraph_,
pass->set_type(bake_type_to_pass(bake_type, bake_filter));
pass->set_include_albedo((bake_filter & BL::BakeSettings::pass_filter_COLOR));
session->read_render_tile_cb = [&]() { read_render_tile(); };
session->write_render_tile_cb = [&]() { write_render_tile(); };
session->set_gpu_display(nullptr);
session->set_display_driver(nullptr);
session->set_output_driver(make_unique<BlenderOutputDriver>(b_engine));
if (!session->progress.get_cancel()) {
/* Sync scene. */
@@ -716,6 +615,24 @@ void BlenderSession::bake(BL::Depsgraph &b_depsgraph_,
sync->sync_camera(b_render, b_camera_override, width, height, "");
sync->sync_data(
b_render, b_depsgraph, b_v3d, b_camera_override, width, height, &python_thread_state);
/* Filtering settings for combined pass. */
if (pass->get_type() == PASS_COMBINED) {
Integrator *integrator = scene->integrator;
integrator->set_use_direct_light((bake_filter & BL::BakeSettings::pass_filter_DIRECT) != 0);
integrator->set_use_indirect_light((bake_filter & BL::BakeSettings::pass_filter_INDIRECT) !=
0);
integrator->set_use_diffuse((bake_filter & BL::BakeSettings::pass_filter_DIFFUSE) != 0);
integrator->set_use_glossy((bake_filter & BL::BakeSettings::pass_filter_GLOSSY) != 0);
integrator->set_use_transmission(
(bake_filter & BL::BakeSettings::pass_filter_TRANSMISSION) != 0);
integrator->set_use_emission((bake_filter & BL::BakeSettings::pass_filter_EMIT) != 0);
}
/* Always use transpanent background for baking. */
scene->background->set_transparent(true);
/* Load built-in images from Blender. */
builtin_images_load();
}
@@ -751,43 +668,7 @@ void BlenderSession::bake(BL::Depsgraph &b_depsgraph_,
session->wait();
}
session->read_render_tile_cb = function_null;
session->write_render_tile_cb = function_null;
}
void BlenderSession::write_render_result(BL::RenderLayer &b_rlay)
{
if (!session->copy_render_tile_from_device()) {
return;
}
const int2 tile_size = session->get_render_tile_size();
vector<float> pixels(tile_size.x * tile_size.y * 4);
/* Copy each pass. */
for (BL::RenderPass &b_pass : b_rlay.passes) {
if (!session->get_render_tile_pixels(b_pass.name(), b_pass.channels(), &pixels[0])) {
memset(&pixels[0], 0, pixels.size() * sizeof(float));
}
b_pass.rect(&pixels[0]);
}
}
void BlenderSession::update_render_result(BL::RenderLayer &b_rlay)
{
if (!session->copy_render_tile_from_device()) {
return;
}
const int2 tile_size = session->get_render_tile_size();
vector<float> pixels(tile_size.x * tile_size.y * 4);
/* Copy combined pass. */
BL::RenderPass b_combined_pass(b_rlay.passes.find_by_name("Combined", b_rview_name.c_str()));
if (session->get_render_tile_pixels("Combined", b_combined_pass.channels(), &pixels[0])) {
b_combined_pass.rect(&pixels[0]);
}
session->set_output_driver(nullptr);
}
void BlenderSession::synchronize(BL::Depsgraph &b_depsgraph_)
@@ -807,6 +688,8 @@ void BlenderSession::synchronize(BL::Depsgraph &b_depsgraph_)
create_session();
}
ensure_display_driver_if_needed();
/* increase samples and render time, but never decrease */
session->set_samples(session_params.samples);
session->set_time_limit(session_params.time_limit);
@@ -894,8 +777,10 @@ void BlenderSession::draw(BL::SpaceImageEditor &space_image)
draw_state_.last_pass_index = pass_index;
}
if (display_driver_) {
BL::Array<float, 2> zoom = space_image.zoom();
gpu_display_->set_zoom(zoom[0], zoom[1]);
display_driver_->set_zoom(zoom[0], zoom[1]);
}
session->draw();
}
@@ -974,7 +859,7 @@ void BlenderSession::get_status(string &status, string &substatus)
session->progress.get_status(status, substatus);
}
void BlenderSession::get_progress(float &progress, double &total_time, double &render_time)
void BlenderSession::get_progress(double &progress, double &total_time, double &render_time)
{
session->progress.get_time(total_time, render_time);
progress = session->progress.get_progress();
@@ -982,10 +867,10 @@ void BlenderSession::get_progress(float &progress, double &total_time, double &r
void BlenderSession::update_bake_progress()
{
float progress = session->progress.get_progress();
double progress = session->progress.get_progress();
if (progress != last_progress) {
b_engine.update_progress(progress);
b_engine.update_progress((float)progress);
last_progress = progress;
}
}
@@ -994,7 +879,7 @@ void BlenderSession::update_status_progress()
{
string timestatus, status, substatus;
string scene_status = "";
float progress;
double progress;
double total_time, remaining_time = 0, render_time;
float mem_used = (float)session->stats.mem_used / 1024.0f / 1024.0f;
float mem_peak = (float)session->stats.mem_peak / 1024.0f / 1024.0f;
@@ -1038,7 +923,7 @@ void BlenderSession::update_status_progress()
last_status_time = current_time;
}
if (progress != last_progress) {
b_engine.update_progress(progress);
b_engine.update_progress((float)progress);
last_progress = progress;
}
@@ -1110,4 +995,27 @@ void BlenderSession::free_blender_memory_if_possible()
b_engine.free_blender_memory();
}
void BlenderSession::ensure_display_driver_if_needed()
{
if (display_driver_) {
/* Driver is already created. */
return;
}
if (headless) {
/* No display needed for headless. */
return;
}
if (b_engine.is_preview()) {
/* TODO(sergey): Investigate whether DisplayDriver can be used for the preview as well. */
return;
}
unique_ptr<BlenderDisplayDriver> display_driver = make_unique<BlenderDisplayDriver>(b_engine,
b_scene);
display_driver_ = display_driver.get();
session->set_display_driver(move(display_driver));
}
CCL_NAMESPACE_END

View File

@@ -17,19 +17,21 @@
#ifndef __BLENDER_SESSION_H__
#define __BLENDER_SESSION_H__
#include "MEM_guardedalloc.h"
#include "RNA_blender_cpp.h"
#include "device/device.h"
#include "render/bake.h"
#include "render/scene.h"
#include "render/session.h"
#include "scene/bake.h"
#include "scene/scene.h"
#include "session/session.h"
#include "util/util_vector.h"
#include "util/vector.h"
CCL_NAMESPACE_BEGIN
class BlenderGPUDisplay;
class BlenderDisplayDriver;
class BlenderSync;
class ImageMetaData;
class Scene;
@@ -70,20 +72,7 @@ class BlenderSession {
const int bake_width,
const int bake_height);
void write_render_result(BL::RenderLayer &b_rlay);
void write_render_tile();
void update_render_tile();
void full_buffer_written(string_view filename);
/* update functions are used to update display buffer only after sample was rendered
* only needed for better visual feedback */
void update_render_result(BL::RenderLayer &b_rlay);
/* read functions for baking input */
void read_render_tile();
/* interactive updates */
void synchronize(BL::Depsgraph &b_depsgraph);
@@ -93,7 +82,7 @@ class BlenderSession {
void tag_redraw();
void tag_update();
void get_status(string &status, string &substatus);
void get_progress(float &progress, double &total_time, double &render_time);
void get_progress(double &progress, double &total_time, double &render_time);
void test_cancel();
void update_status_progress();
void update_bake_progress();
@@ -119,7 +108,7 @@ class BlenderSession {
string last_status;
string last_error;
float last_progress;
double last_progress;
double last_status_time;
int width, height;
@@ -159,13 +148,15 @@ class BlenderSession {
*/
void free_blender_memory_if_possible();
void ensure_display_driver_if_needed();
struct {
thread_mutex mutex;
int last_pass_index = -1;
} draw_state_;
/* NOTE: The BlenderSession references the GPU display. */
BlenderGPUDisplay *gpu_display_ = nullptr;
/* NOTE: The BlenderSession references the display driver. */
BlenderDisplayDriver *display_driver_ = nullptr;
vector<string> full_buffer_files_;
};

View File

@@ -14,26 +14,26 @@
* limitations under the License.
*/
#include "render/background.h"
#include "render/colorspace.h"
#include "render/graph.h"
#include "render/integrator.h"
#include "render/light.h"
#include "render/nodes.h"
#include "render/osl.h"
#include "render/scene.h"
#include "render/shader.h"
#include "scene/shader.h"
#include "scene/background.h"
#include "scene/colorspace.h"
#include "scene/integrator.h"
#include "scene/light.h"
#include "scene/osl.h"
#include "scene/scene.h"
#include "scene/shader_graph.h"
#include "scene/shader_nodes.h"
#include "blender/blender_image.h"
#include "blender/blender_sync.h"
#include "blender/blender_texture.h"
#include "blender/blender_util.h"
#include "blender/image.h"
#include "blender/sync.h"
#include "blender/texture.h"
#include "blender/util.h"
#include "util/util_debug.h"
#include "util/util_foreach.h"
#include "util/util_set.h"
#include "util/util_string.h"
#include "util/util_task.h"
#include "util/debug.h"
#include "util/foreach.h"
#include "util/set.h"
#include "util/string.h"
#include "util/task.h"
CCL_NAMESPACE_BEGIN
@@ -279,7 +279,7 @@ static ShaderNode *add_node(Scene *scene,
array<float3> curve_mapping_curves;
float min_x, max_x;
curvemapping_color_to_array(mapping, curve_mapping_curves, RAMP_TABLE_SIZE, true);
curvemapping_minmax(mapping, true, &min_x, &max_x);
curvemapping_minmax(mapping, 4, &min_x, &max_x);
curves->set_min_x(min_x);
curves->set_max_x(max_x);
curves->set_curves(curve_mapping_curves);
@@ -292,12 +292,25 @@ static ShaderNode *add_node(Scene *scene,
array<float3> curve_mapping_curves;
float min_x, max_x;
curvemapping_color_to_array(mapping, curve_mapping_curves, RAMP_TABLE_SIZE, false);
curvemapping_minmax(mapping, false, &min_x, &max_x);
curvemapping_minmax(mapping, 3, &min_x, &max_x);
curves->set_min_x(min_x);
curves->set_max_x(max_x);
curves->set_curves(curve_mapping_curves);
node = curves;
}
else if (b_node.is_a(&RNA_ShaderNodeFloatCurve)) {
BL::ShaderNodeFloatCurve b_curve_node(b_node);
BL::CurveMapping mapping(b_curve_node.mapping());
FloatCurveNode *curve = graph->create_node<FloatCurveNode>();
array<float> curve_mapping_curve;
float min_x, max_x;
curvemapping_float_to_array(mapping, curve_mapping_curve, RAMP_TABLE_SIZE);
curvemapping_minmax(mapping, 1, &min_x, &max_x);
curve->set_min_x(min_x);
curve->set_max_x(max_x);
curve->set_curve(curve_mapping_curve);
node = curve;
}
else if (b_node.is_a(&RNA_ShaderNodeValToRGB)) {
RGBRampNode *ramp = graph->create_node<RGBRampNode>();
BL::ShaderNodeValToRGB b_ramp_node(b_node);
@@ -476,6 +489,9 @@ static ShaderNode *add_node(Scene *scene,
SubsurfaceScatteringNode *subsurface = graph->create_node<SubsurfaceScatteringNode>();
switch (b_subsurface_node.falloff()) {
case BL::ShaderNodeSubsurfaceScattering::falloff_BURLEY:
subsurface->set_method(CLOSURE_BSSRDF_BURLEY_ID);
break;
case BL::ShaderNodeSubsurfaceScattering::falloff_RANDOM_WALK_FIXED_RADIUS:
subsurface->set_method(CLOSURE_BSSRDF_RANDOM_WALK_FIXED_RADIUS_ID);
break;
@@ -592,6 +608,9 @@ static ShaderNode *add_node(Scene *scene,
break;
}
switch (b_principled_node.subsurface_method()) {
case BL::ShaderNodeBsdfPrincipled::subsurface_method_BURLEY:
principled->set_subsurface_method(CLOSURE_BSSRDF_BURLEY_ID);
break;
case BL::ShaderNodeBsdfPrincipled::subsurface_method_RANDOM_WALK_FIXED_RADIUS:
principled->set_subsurface_method(CLOSURE_BSSRDF_RANDOM_WALK_FIXED_RADIUS_ID);
break;
@@ -1356,6 +1375,7 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
{
Background *background = scene->background;
Integrator *integrator = scene->integrator;
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
BL::World b_world = b_scene.world();
@@ -1447,14 +1467,8 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
graph->connect(background->output("Background"), out->input("Surface"));
}
/* Visibility */
if (b_world) {
/* AO */
BL::WorldLighting b_light = b_world.light_settings();
integrator->set_ao_factor(b_light.ao_factor());
integrator->set_ao_distance(b_light.distance());
/* visibility */
PointerRNA cvisibility = RNA_pointer_get(&b_world.ptr, "cycles_visibility");
uint visibility = 0;
@@ -1466,16 +1480,38 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
background->set_visibility(visibility);
}
else {
integrator->set_ao_factor(1.0f);
integrator->set_ao_distance(10.0f);
}
shader->set_graph(graph);
shader->tag_update(scene);
}
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
/* Fast GI */
if (b_world) {
BL::WorldLighting b_light = b_world.light_settings();
enum { FAST_GI_METHOD_REPLACE = 0, FAST_GI_METHOD_ADD = 1, FAST_GI_METHOD_NUM };
const bool use_fast_gi = get_boolean(cscene, "use_fast_gi");
if (use_fast_gi) {
const int fast_gi_method = get_enum(
cscene, "fast_gi_method", FAST_GI_METHOD_NUM, FAST_GI_METHOD_REPLACE);
integrator->set_ao_factor((fast_gi_method == FAST_GI_METHOD_REPLACE) ? b_light.ao_factor() :
0.0f);
integrator->set_ao_additive_factor(
(fast_gi_method == FAST_GI_METHOD_ADD) ? b_light.ao_factor() : 0.0f);
}
else {
integrator->set_ao_factor(0.0f);
integrator->set_ao_additive_factor(0.0f);
}
integrator->set_ao_distance(b_light.distance());
}
else {
integrator->set_ao_factor(0.0f);
integrator->set_ao_additive_factor(0.0f);
integrator->set_ao_distance(10.0f);
}
background->set_transparent(b_scene.render().film_transparent());
if (background->get_transparent()) {

View File

@@ -14,33 +14,33 @@
* limitations under the License.
*/
#include "render/background.h"
#include "render/camera.h"
#include "render/curves.h"
#include "render/film.h"
#include "render/graph.h"
#include "render/integrator.h"
#include "render/light.h"
#include "render/mesh.h"
#include "render/nodes.h"
#include "render/object.h"
#include "render/procedural.h"
#include "render/scene.h"
#include "render/shader.h"
#include "scene/background.h"
#include "scene/camera.h"
#include "scene/curves.h"
#include "scene/film.h"
#include "scene/integrator.h"
#include "scene/light.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "scene/procedural.h"
#include "scene/scene.h"
#include "scene/shader.h"
#include "scene/shader_graph.h"
#include "scene/shader_nodes.h"
#include "device/device.h"
#include "blender/blender_device.h"
#include "blender/blender_session.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "blender/device.h"
#include "blender/session.h"
#include "blender/sync.h"
#include "blender/util.h"
#include "util/util_debug.h"
#include "util/util_foreach.h"
#include "util/util_hash.h"
#include "util/util_logging.h"
#include "util/util_opengl.h"
#include "util/util_openimagedenoise.h"
#include "util/debug.h"
#include "util/foreach.h"
#include "util/hash.h"
#include "util/log.h"
#include "util/opengl.h"
#include "util/openimagedenoise.h"
CCL_NAMESPACE_BEGIN
@@ -162,19 +162,19 @@ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d
/* Object */
else if (b_id.is_a(&RNA_Object)) {
BL::Object b_ob(b_id);
const bool is_geometry = object_is_geometry(b_ob);
const bool is_light = !is_geometry && object_is_light(b_ob);
const bool can_have_geometry = object_can_have_geometry(b_ob);
const bool is_light = !can_have_geometry && object_is_light(b_ob);
if (b_ob.is_instancer() && b_update.is_updated_shading()) {
/* Needed for e.g. object color updates on instancer. */
object_map.set_recalc(b_ob);
}
if (is_geometry || is_light) {
if (can_have_geometry || is_light) {
const bool updated_geometry = b_update.is_updated_geometry();
/* Geometry (mesh, hair, volume). */
if (is_geometry) {
if (can_have_geometry) {
if (b_update.is_updated_transform() || b_update.is_updated_shading()) {
object_map.set_recalc(b_ob);
}
@@ -183,6 +183,15 @@ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d
(object_subdivision_type(b_ob, preview, experimental) != Mesh::SUBDIVISION_NONE)) {
BL::ID key = BKE_object_is_modified(b_ob) ? b_ob : b_ob.data();
geometry_map.set_recalc(key);
/* Sync all contained geometry instances as well when the object changed.. */
map<void *, set<BL::ID>>::const_iterator instance_geometries =
instance_geometries_by_object.find(b_ob.ptr.data);
if (instance_geometries != instance_geometries_by_object.end()) {
for (BL::ID geometry : instance_geometries->second) {
geometry_map.set_recalc(geometry);
}
}
}
if (updated_geometry) {
@@ -340,18 +349,37 @@ void BlenderSync::sync_integrator(BL::ViewLayer &b_view_layer, bool background)
cscene, "sampling_pattern", SAMPLING_NUM_PATTERNS, SAMPLING_PATTERN_SOBOL);
integrator->set_sampling_pattern(sampling_pattern);
bool use_adaptive_sampling = false;
if (preview) {
integrator->set_use_adaptive_sampling(
RNA_boolean_get(&cscene, "use_preview_adaptive_sampling"));
use_adaptive_sampling = RNA_boolean_get(&cscene, "use_preview_adaptive_sampling");
integrator->set_use_adaptive_sampling(use_adaptive_sampling);
integrator->set_adaptive_threshold(get_float(cscene, "preview_adaptive_threshold"));
integrator->set_adaptive_min_samples(get_int(cscene, "preview_adaptive_min_samples"));
}
else {
integrator->set_use_adaptive_sampling(RNA_boolean_get(&cscene, "use_adaptive_sampling"));
use_adaptive_sampling = RNA_boolean_get(&cscene, "use_adaptive_sampling");
integrator->set_use_adaptive_sampling(use_adaptive_sampling);
integrator->set_adaptive_threshold(get_float(cscene, "adaptive_threshold"));
integrator->set_adaptive_min_samples(get_int(cscene, "adaptive_min_samples"));
}
int samples = get_int(cscene, "samples");
float scrambling_distance = get_float(cscene, "scrambling_distance");
bool auto_scrambling_distance = get_boolean(cscene, "auto_scrambling_distance");
if (auto_scrambling_distance) {
scrambling_distance *= 4.0f / sqrtf(samples);
}
/* only use scrambling distance in the viewport if user wants to and disable with AS */
bool preview_scrambling_distance = get_boolean(cscene, "preview_scrambling_distance");
if ((preview && !preview_scrambling_distance) || use_adaptive_sampling)
scrambling_distance = 1.0f;
if (scrambling_distance != 1.0f) {
VLOG(3) << "Using scrambling distance: " << scrambling_distance;
}
integrator->set_scrambling_distance(scrambling_distance);
if (get_boolean(cscene, "use_fast_gi")) {
if (preview) {
integrator->set_ao_bounces(get_int(cscene, "ao_bounces"));
@@ -364,6 +392,12 @@ void BlenderSync::sync_integrator(BL::ViewLayer &b_view_layer, bool background)
integrator->set_ao_bounces(0);
}
#ifdef WITH_CYCLES_DEBUG
DirectLightSamplingType direct_light_sampling_type = (DirectLightSamplingType)get_enum(
cscene, "direct_light_sampling_type", DIRECT_LIGHT_SAMPLING_NUM, DIRECT_LIGHT_SAMPLING_MIS);
integrator->set_direct_light_sampling_type(direct_light_sampling_type);
#endif
const DenoiseParams denoise_params = get_denoise_params(b_scene, b_view_layer, background);
integrator->set_use_denoise(denoise_params.use);
@@ -541,12 +575,11 @@ static PassType get_blender_pass_type(BL::RenderPass &b_pass)
MAP_PASS("Denoising Normal", PASS_DENOISING_NORMAL);
MAP_PASS("Denoising Albedo", PASS_DENOISING_ALBEDO);
MAP_PASS("Denoising Depth", PASS_DENOISING_DEPTH);
MAP_PASS("Shadow Catcher", PASS_SHADOW_CATCHER);
MAP_PASS("Noisy Shadow Catcher", PASS_SHADOW_CATCHER);
MAP_PASS("Debug Render Time", PASS_RENDER_TIME);
MAP_PASS("AdaptiveAuxBuffer", PASS_ADAPTIVE_AUX_BUFFER);
MAP_PASS("Debug Sample Count", PASS_SAMPLE_COUNT);
@@ -604,10 +637,6 @@ void BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay, BL::ViewLayer &b_v
PointerRNA crl = RNA_pointer_get(&b_view_layer.ptr, "cycles");
/* Debug passes. */
if (get_boolean(crl, "pass_debug_render_time")) {
b_engine.add_pass("Debug Render Time", 1, "X", b_view_layer.name().c_str());
pass_add(scene, PASS_RENDER_TIME, "Debug Render Time");
}
if (get_boolean(crl, "pass_debug_sample_count")) {
b_engine.add_pass("Debug Sample Count", 1, "X", b_view_layer.name().c_str());
pass_add(scene, PASS_SAMPLE_COUNT, "Debug Sample Count");
@@ -676,6 +705,9 @@ void BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay, BL::ViewLayer &b_v
b_engine.add_pass("Denoising Albedo", 3, "RGB", b_view_layer.name().c_str());
pass_add(scene, PASS_DENOISING_ALBEDO, "Denoising Albedo", PassMode::NOISY);
b_engine.add_pass("Denoising Depth", 1, "Z", b_view_layer.name().c_str());
pass_add(scene, PASS_DENOISING_DEPTH, "Denoising Depth", PassMode::NOISY);
}
/* Custom AOV passes. */
@@ -809,18 +841,25 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine &b_engine,
/* samples */
int samples = get_int(cscene, "samples");
int preview_samples = get_int(cscene, "preview_samples");
int sample_offset = get_int(cscene, "sample_offset");
if (background) {
params.samples = samples;
params.sample_offset = sample_offset;
}
else {
params.samples = preview_samples;
if (params.samples == 0)
if (params.samples == 0) {
params.samples = INT_MAX;
}
params.sample_offset = 0;
}
/* Clamp sample offset. */
params.sample_offset = clamp(params.sample_offset, 0, Integrator::MAX_SAMPLES);
/* Clamp samples. */
params.samples = min(params.samples, Integrator::MAX_SAMPLES);
params.samples = clamp(params.samples, 0, Integrator::MAX_SAMPLES - params.sample_offset);
/* Viewport Performance */
params.pixel_size = b_engine.get_preview_pixel_size(b_scene);
@@ -839,7 +878,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine &b_engine,
/* Time limit. */
if (background) {
params.time_limit = get_float(cscene, "time_limit");
params.time_limit = (double)get_float(cscene, "time_limit");
}
else {
/* For the viewport it kind of makes more sense to think in terms of the noise floor, which is

View File

@@ -22,17 +22,17 @@
#include "RNA_blender_cpp.h"
#include "RNA_types.h"
#include "blender/blender_id_map.h"
#include "blender/blender_util.h"
#include "blender/blender_viewport.h"
#include "blender/id_map.h"
#include "blender/util.h"
#include "blender/viewport.h"
#include "render/scene.h"
#include "render/session.h"
#include "scene/scene.h"
#include "session/session.h"
#include "util/util_map.h"
#include "util/util_set.h"
#include "util/util_transform.h"
#include "util/util_vector.h"
#include "util/map.h"
#include "util/set.h"
#include "util/transform.h"
#include "util/vector.h"
CCL_NAMESPACE_BEGIN
@@ -208,7 +208,8 @@ class BlenderSync {
/* util */
void find_shader(BL::ID &id, array<Node *> &used_shaders, Shader *default_shader);
bool BKE_object_is_modified(BL::Object &b_ob);
bool object_is_geometry(BL::Object &b_ob);
bool object_is_geometry(BObjectInfo &b_ob_info);
bool object_can_have_geometry(BL::Object &b_ob);
bool object_is_light(BL::Object &b_ob);
/* variables */
@@ -225,6 +226,8 @@ class BlenderSync {
set<Geometry *> geometry_synced;
set<Geometry *> geometry_motion_synced;
set<Geometry *> geometry_motion_attribute_synced;
/** Remember which geometries come from which objects to be able to sync them after changes. */
map<void *, set<BL::ID>> instance_geometries_by_object;
set<float> motion_times;
void *world_map;
bool world_recalc;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
#include "blender/blender_texture.h"
#include "blender/texture.h"
CCL_NAMESPACE_BEGIN

View File

@@ -17,7 +17,7 @@
#ifndef __BLENDER_TEXTURE_H__
#define __BLENDER_TEXTURE_H__
#include "blender/blender_sync.h"
#include "blender/sync.h"
#include <stdlib.h>
CCL_NAMESPACE_BEGIN

View File

@@ -17,16 +17,16 @@
#ifndef __BLENDER_UTIL_H__
#define __BLENDER_UTIL_H__
#include "render/mesh.h"
#include "scene/mesh.h"
#include "util/util_algorithm.h"
#include "util/util_array.h"
#include "util/util_map.h"
#include "util/util_path.h"
#include "util/util_set.h"
#include "util/util_transform.h"
#include "util/util_types.h"
#include "util/util_vector.h"
#include "util/algorithm.h"
#include "util/array.h"
#include "util/map.h"
#include "util/path.h"
#include "util/set.h"
#include "util/transform.h"
#include "util/types.h"
#include "util/vector.h"
/* Hacks to hook into Blender API
* todo: clean this up ... */
@@ -171,12 +171,11 @@ static inline void curvemap_minmax_curve(/*const*/ BL::CurveMap &curve, float *m
}
static inline void curvemapping_minmax(/*const*/ BL::CurveMapping &cumap,
bool rgb_curve,
int num_curves,
float *min_x,
float *max_x)
{
// const int num_curves = cumap.curves.length(); /* Gives linking error so far. */
const int num_curves = rgb_curve ? 4 : 3;
*min_x = FLT_MAX;
*max_x = -FLT_MAX;
for (int i = 0; i < num_curves; ++i) {
@@ -196,6 +195,28 @@ static inline void curvemapping_to_array(BL::CurveMapping &cumap, array<float> &
}
}
static inline void curvemapping_float_to_array(BL::CurveMapping &cumap,
array<float> &data,
int size)
{
float min = 0.0f, max = 1.0f;
curvemapping_minmax(cumap, 1, &min, &max);
const float range = max - min;
cumap.update();
BL::CurveMap map = cumap.curves[0];
data.resize(size);
for (int i = 0; i < size; i++) {
float t = min + (float)i / (float)(size - 1) * range;
data[i] = cumap.evaluate(map, t);
}
}
static inline void curvemapping_color_to_array(BL::CurveMapping &cumap,
array<float3> &data,
int size,
@@ -214,7 +235,8 @@ static inline void curvemapping_color_to_array(BL::CurveMapping &cumap,
*
* There might be some better estimations here tho.
*/
curvemapping_minmax(cumap, rgb_curve, &min_x, &max_x);
const int num_curves = rgb_curve ? 4 : 3;
curvemapping_minmax(cumap, num_curves, &min_x, &max_x);
const float range_x = max_x - min_x;
@@ -281,7 +303,7 @@ static inline string image_user_file_path(BL::ImageUser &iuser,
string filepath_str = string(filepath);
if (load_tiled && ima.source() == BL::Image::source_TILED) {
string udim;
if (ima.tiles.length() > 0) {
if (!ima.tiles.empty()) {
udim = to_string(ima.tiles[0].number());
}
string_replace(filepath_str, udim, "<UDIM>");
@@ -625,7 +647,7 @@ static inline Mesh::SubdivisionType object_subdivision_type(BL::Object &b_ob,
{
PointerRNA cobj = RNA_pointer_get(&b_ob.ptr, "cycles");
if (cobj.data && b_ob.modifiers.length() > 0 && experimental) {
if (cobj.data && !b_ob.modifiers.empty() && experimental) {
BL::Modifier mod = b_ob.modifiers[b_ob.modifiers.length() - 1];
bool enabled = preview ? mod.show_viewport() : mod.show_render();

View File

@@ -14,11 +14,12 @@
* limitations under the License.
*/
#include "blender_viewport.h"
#include "blender/viewport.h"
#include "blender/util.h"
#include "blender_util.h"
#include "render/pass.h"
#include "util/util_logging.h"
#include "scene/pass.h"
#include "util/log.h"
CCL_NAMESPACE_BEGIN

View File

@@ -23,7 +23,7 @@
#include "RNA_blender_cpp.h"
#include "RNA_types.h"
#include "render/film.h"
#include "scene/film.h"
CCL_NAMESPACE_BEGIN

View File

@@ -14,14 +14,14 @@
* limitations under the License.
*/
#include "render/colorspace.h"
#include "render/image.h"
#include "render/image_vdb.h"
#include "render/object.h"
#include "render/volume.h"
#include "scene/volume.h"
#include "scene/colorspace.h"
#include "scene/image.h"
#include "scene/image_vdb.h"
#include "scene/object.h"
#include "blender/blender_sync.h"
#include "blender/blender_util.h"
#include "blender/sync.h"
#include "blender/util.h"
#ifdef WITH_OPENVDB
# include <openvdb/openvdb.h>

View File

@@ -22,34 +22,34 @@ set(INC_SYS
set(SRC
bvh.cpp
bvh2.cpp
bvh_binning.cpp
bvh_build.cpp
bvh_embree.cpp
bvh_multi.cpp
bvh_node.cpp
bvh_optix.cpp
bvh_sort.cpp
bvh_split.cpp
bvh_unaligned.cpp
binning.cpp
build.cpp
embree.cpp
multi.cpp
node.cpp
optix.cpp
sort.cpp
split.cpp
unaligned.cpp
)
set(SRC_HEADERS
bvh.h
bvh2.h
bvh_binning.h
bvh_build.h
bvh_embree.h
bvh_multi.h
bvh_node.h
bvh_optix.h
bvh_params.h
bvh_sort.h
bvh_split.h
bvh_unaligned.h
binning.h
build.h
embree.h
multi.h
node.h
optix.h
params.h
sort.h
split.h
unaligned.h
)
set(LIB
cycles_render
cycles_scene
cycles_util
)

View File

@@ -17,13 +17,13 @@
//#define __KERNEL_SSE__
#include "bvh/bvh_binning.h"
#include "bvh/binning.h"
#include <stdlib.h>
#include "util/util_algorithm.h"
#include "util/util_boundbox.h"
#include "util/util_types.h"
#include "util/algorithm.h"
#include "util/boundbox.h"
#include "util/types.h"
CCL_NAMESPACE_BEGIN

View File

@@ -18,10 +18,10 @@
#ifndef __BVH_BINNING_H__
#define __BVH_BINNING_H__
#include "bvh/bvh_params.h"
#include "bvh/bvh_unaligned.h"
#include "bvh/params.h"
#include "bvh/unaligned.h"
#include "util/util_types.h"
#include "util/types.h"
CCL_NAMESPACE_BEGIN

View File

@@ -15,27 +15,27 @@
* limitations under the License.
*/
#include "bvh/bvh_build.h"
#include "bvh/build.h"
#include "bvh/bvh_binning.h"
#include "bvh/bvh_node.h"
#include "bvh/bvh_params.h"
#include "bvh_split.h"
#include "bvh/binning.h"
#include "bvh/node.h"
#include "bvh/params.h"
#include "bvh/split.h"
#include "render/curves.h"
#include "render/hair.h"
#include "render/mesh.h"
#include "render/object.h"
#include "render/scene.h"
#include "scene/curves.h"
#include "scene/hair.h"
#include "scene/mesh.h"
#include "scene/object.h"
#include "scene/scene.h"
#include "util/util_algorithm.h"
#include "util/util_foreach.h"
#include "util/util_logging.h"
#include "util/util_progress.h"
#include "util/util_queue.h"
#include "util/util_simd.h"
#include "util/util_stack_allocator.h"
#include "util/util_time.h"
#include "util/algorithm.h"
#include "util/foreach.h"
#include "util/log.h"
#include "util/progress.h"
#include "util/queue.h"
#include "util/simd.h"
#include "util/stack_allocator.h"
#include "util/time.h"
CCL_NAMESPACE_BEGIN
@@ -67,8 +67,12 @@ BVHBuild::~BVHBuild()
/* Adding References */
void BVHBuild::add_reference_triangles(BoundBox &root, BoundBox &center, Mesh *mesh, int i)
void BVHBuild::add_reference_triangles(BoundBox &root,
BoundBox &center,
Mesh *mesh,
int object_index)
{
const PrimitiveType primitive_type = mesh->primitive_type();
const Attribute *attr_mP = NULL;
if (mesh->has_motion_blur()) {
attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
@@ -81,7 +85,7 @@ void BVHBuild::add_reference_triangles(BoundBox &root, BoundBox &center, Mesh *m
BoundBox bounds = BoundBox::empty;
t.bounds_grow(verts, bounds);
if (bounds.valid() && t.valid(verts)) {
references.push_back(BVHReference(bounds, j, i, PRIMITIVE_TRIANGLE));
references.push_back(BVHReference(bounds, j, object_index, primitive_type));
root.grow(bounds);
center.grow(bounds.center2());
}
@@ -101,7 +105,7 @@ void BVHBuild::add_reference_triangles(BoundBox &root, BoundBox &center, Mesh *m
t.bounds_grow(vert_steps + step * num_verts, bounds);
}
if (bounds.valid()) {
references.push_back(BVHReference(bounds, j, i, PRIMITIVE_MOTION_TRIANGLE));
references.push_back(BVHReference(bounds, j, object_index, primitive_type));
root.grow(bounds);
center.grow(bounds.center2());
}
@@ -140,7 +144,7 @@ void BVHBuild::add_reference_triangles(BoundBox &root, BoundBox &center, Mesh *m
if (bounds.valid()) {
const float prev_time = (float)(bvh_step - 1) * num_bvh_steps_inv_1;
references.push_back(
BVHReference(bounds, j, i, PRIMITIVE_MOTION_TRIANGLE, prev_time, curr_time));
BVHReference(bounds, j, object_index, primitive_type, prev_time, curr_time));
root.grow(bounds);
center.grow(bounds.center2());
}
@@ -153,18 +157,14 @@ void BVHBuild::add_reference_triangles(BoundBox &root, BoundBox &center, Mesh *m
}
}
void BVHBuild::add_reference_curves(BoundBox &root, BoundBox &center, Hair *hair, int i)
void BVHBuild::add_reference_curves(BoundBox &root, BoundBox &center, Hair *hair, int object_index)
{
const Attribute *curve_attr_mP = NULL;
if (hair->has_motion_blur()) {
curve_attr_mP = hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
}
const PrimitiveType primitive_type =
(curve_attr_mP != NULL) ?
((hair->curve_shape == CURVE_RIBBON) ? PRIMITIVE_MOTION_CURVE_RIBBON :
PRIMITIVE_MOTION_CURVE_THICK) :
((hair->curve_shape == CURVE_RIBBON) ? PRIMITIVE_CURVE_RIBBON : PRIMITIVE_CURVE_THICK);
const PrimitiveType primitive_type = hair->primitive_type();
const size_t num_curves = hair->num_curves();
for (uint j = 0; j < num_curves; j++) {
@@ -177,7 +177,7 @@ void BVHBuild::add_reference_curves(BoundBox &root, BoundBox &center, Hair *hair
curve.bounds_grow(k, &hair->get_curve_keys()[0], curve_radius, bounds);
if (bounds.valid()) {
int packed_type = PRIMITIVE_PACK_SEGMENT(primitive_type, k);
references.push_back(BVHReference(bounds, j, i, packed_type));
references.push_back(BVHReference(bounds, j, object_index, packed_type));
root.grow(bounds);
center.grow(bounds.center2());
}
@@ -198,7 +198,7 @@ void BVHBuild::add_reference_curves(BoundBox &root, BoundBox &center, Hair *hair
}
if (bounds.valid()) {
int packed_type = PRIMITIVE_PACK_SEGMENT(primitive_type, k);
references.push_back(BVHReference(bounds, j, i, packed_type));
references.push_back(BVHReference(bounds, j, object_index, packed_type));
root.grow(bounds);
center.grow(bounds.center2());
}
@@ -254,7 +254,8 @@ void BVHBuild::add_reference_curves(BoundBox &root, BoundBox &center, Hair *hair
if (bounds.valid()) {
const float prev_time = (float)(bvh_step - 1) * num_bvh_steps_inv_1;
int packed_type = PRIMITIVE_PACK_SEGMENT(primitive_type, k);
references.push_back(BVHReference(bounds, j, i, packed_type, prev_time, curr_time));
references.push_back(
BVHReference(bounds, j, object_index, packed_type, prev_time, curr_time));
root.grow(bounds);
center.grow(bounds.center2());
}
@@ -268,15 +269,18 @@ void BVHBuild::add_reference_curves(BoundBox &root, BoundBox &center, Hair *hair
}
}
void BVHBuild::add_reference_geometry(BoundBox &root, BoundBox &center, Geometry *geom, int i)
void BVHBuild::add_reference_geometry(BoundBox &root,
BoundBox &center,
Geometry *geom,
int object_index)
{
if (geom->geometry_type == Geometry::MESH || geom->geometry_type == Geometry::VOLUME) {
Mesh *mesh = static_cast<Mesh *>(geom);
add_reference_triangles(root, center, mesh, i);
add_reference_triangles(root, center, mesh, object_index);
}
else if (geom->geometry_type == Geometry::HAIR) {
Hair *hair = static_cast<Hair *>(geom);
add_reference_curves(root, center, hair, i);
add_reference_curves(root, center, hair, object_index);
}
}

View File

@@ -20,12 +20,12 @@
#include <float.h>
#include "bvh/bvh_params.h"
#include "bvh/bvh_unaligned.h"
#include "bvh/params.h"
#include "bvh/unaligned.h"
#include "util/util_array.h"
#include "util/util_task.h"
#include "util/util_vector.h"
#include "util/array.h"
#include "util/task.h"
#include "util/vector.h"
CCL_NAMESPACE_BEGIN

Some files were not shown because too many files have changed in this diff Show More