1
1

Compare commits

...

755 Commits

Author SHA1 Message Date
29495c624c Removed trailing spaces in python code. 2022-07-26 14:31:29 +02:00
13afaf5b2c Merge branch 'master' into temp-T99046-platform-reference-images 2022-07-26 14:30:41 +02:00
a4189e1c43 Initialize GPU backend in background by rendering a 1x1 image. 2022-07-26 14:25:32 +02:00
4665f62cf5 Fix issue using incorrect path. 2022-07-26 14:25:32 +02:00
3081179180 Fix T99271: modifier errors are not cleared 2022-07-26 14:25:32 +02:00
18d998af3c Fix T99373: add some padding in spreadsheet vector columns
This improves readability in some cases (e.g. in T99373).
2022-07-26 14:25:32 +02:00
Nate Rupsis
daf8e3f79a default N-panel open for animation editors
The Graph, Driver, and Dopesheet's (and sub modes) properties panel
(N-Panel) are now open by default. This includes the editors in the
default Animation workspace.

Note that, because the Timeline is implemented as a special mode of the
Dopesheet, switching between Timeline and Dopesheet will *not* change
the visibility of the properties panel.

Maniphest Tasks: T97980

Differential Revision: https://developer.blender.org/D14910
2022-07-26 14:25:32 +02:00
3c25f6f832 Partially revert "Build: Fix build of library dependencies on Linux aarch64"
This reverts the Flex-related parts of commit
rBef268c78933079137288e326704431432adf9ad9, as those caused a build
error on CentOS 7 (which is used for the precompiled Linux libraries).

CentOS 7 only has Automake 1.13, whereas after this commit version 1.15
seems to be required.

Since in its patch description (D15319) it's mentioned that this
"probably doesn't warrant changing", and it's actually blocking the
build of the precompiled libraries for Blender 3.3 now, I'll revert the
Flex-related part of the commit.
2022-07-26 14:25:32 +02:00
Iliay Katueshenock
b89d0f5ec8 BLI: add use_threading parameter to parallel_invoke
`parallel_invoke` allows executing functions on separate threads.
However, creating tasks in tbb has a measurable amount of overhead.
Therefore, it can be benefitial to disable parallelization when
the amount of work done per function is small.

See D15539 for some benchmark results.

Differential Revision: https://developer.blender.org/D15539
2022-07-26 14:25:31 +02:00
b0bc0a1fd5 GPencil: Update curve handle display after change overlay option
The handles were not updated after changing the settings.

This is a partial fix of T99984
2022-07-26 14:25:31 +02:00
fafc82cb31 Fix T99979: GPencil strokes cannot be edited after set origin
The stroke points were changed but the bounding box calculation was not done and this produced a problem in any bounding box check done by different tools.
2022-07-26 14:25:31 +02:00
2775b6e9b6 Cleanup: Typo in comments: data-lock -> data-block. 2022-07-26 14:25:31 +02:00
98bf1d3e0a Cleanup: quiet GCC cast-function-type warnings for gflags 2022-07-26 14:25:31 +02:00
059b175844 Cleanup: format 2022-07-26 14:25:31 +02:00
1bc84e2f24 Cleanup: spelling in comments 2022-07-26 14:25:31 +02:00
47fde09ee3 Fix Python SystemExit exceptions silently exiting
Any script that raised a SystemExit called by --python, --python-expr
command line args or by executing the text block would exit without
printing a message. This caused the error from T99966 to be hidden.

Add explicit handling for SystemExit to ensure the message is always
shown before exiting.

More details noted in code-comments.
2022-07-26 14:25:31 +02:00
ef3acaefa1 Fix T99966: Python API docs fail to generate
The recent addition of "active_action" [0] required updating in the
API docs type information.

[0]: cd21022b78
2022-07-26 14:25:31 +02:00
e96a8a288b Fix Cycles Metal build errors after recent changes
float8 is a reserved type in Metal, but is not implemented. So rename to
float8_t for now.

Also move back intersection handlers to kernel.metal, they can't be in the
class that encapsulates the other Metal kernel functions.
2022-07-26 14:25:31 +02:00
931cbbc7bd Fix: Fix attribute writer debug warnings in terminal
Use an imperfect solution, since this code will be replaced soon anyway.
2022-07-26 14:25:31 +02:00
c6eef1c3d3 Sculpt: Fix T99779, pbvh gets wrong active vertex for multires
The recent multires winding fix missed a code branch.
2022-07-26 14:25:31 +02:00
8b15c4e5b2 UI: Nishita sky: Increase Sun Elevation UI sensitivity and remove min/max
This now use default angle precision which matches the sun rotation.
Feeling is much more natural.
2022-07-26 14:25:31 +02:00
a015173b4b Cycles: Nishita Sky: Fix sun disk imprecision for large elevation
The issue was introduced by rBad5e3d30a2d2 which made possible to use
unbounded elevation angle.

In order to not touch the shading code, we just remap the value to the
expected range the shading code expects. This means that elevation angles
above +/-PI/2 effectively flip the sun rotation angle.
2022-07-26 14:25:31 +02:00
948ac32032 Fix T99459: GPencil: Fill tool on the surface not in the correct place
There is a 1 pixel error in the size registered for the buffer
dimensions.

NOTE: This issue indicates that the texture scale is different from the
region, so the mouse-based coordinates used are actually misaligned.
This misalignment will be fixed in another commit.

Regression probably introduced in rB1d49293b8044 + rB45f167237f0c8
2022-07-26 14:25:31 +02:00
06c1976015 Curves: Unify poll functions, add message with no surface
The "snap to surface" operators now have "disabled" poll messages
when there is no surface object.

The implementation in most curves operators is also unified.
The goal is to avoid having to define and use the poll failure messages
in multiple places, to reduce the boilerplate that tends to be
necessary to add an operator, and to increase the likelihood that
operators are implemented with proper poll messages.

Differential Revision: https://developer.blender.org/D15528
2022-07-26 14:25:31 +02:00
2ce9f905b6 Fix: Assert in resample curve node with single point curve 2022-07-26 14:25:31 +02:00
e975c3c371 Cleanup: remove __KERNEL_CPU__
This was tested in some places to check if code was being compiled for the
CPU, however this is only defined in the kernel. Checking __KERNEL_GPU__
always works.
2022-07-26 14:25:31 +02:00
Andrii Symkin
07f13a8844 Cycles: add math functions for float8
This patch adds required math functions for float8 to make it possible
using float8 instead of float3 for color data.

Differential Revision: https://developer.blender.org/D15525
2022-07-26 14:25:31 +02:00
df6b57cfe3 Cleanup: move device BVH code to kernel/device/*/bvh.h
Having the OptiX/MetalRT/Embree/MetalRT implementations all in one file with
many #ifdefs became too confusing. Instead split it up per device, and also
move it together with device specific hit/filter/intersect functions and
associated data types.
2022-07-26 14:25:31 +02:00
Arye Ramaty
67e94d961f Geometry Nodes: Add node descriptions/tooltips
This commit adds tooltips to the geometry nodes add menu.

Differential Revision: https://developer.blender.org/D15414
2022-07-26 14:25:31 +02:00
af47f1dd2a Fix wrong Cycles SSS intersection distance after ray distance changes
No need anymore to have a difference between CPU/GPU, all distances
remain in world space.
2022-07-26 14:25:31 +02:00
d84c7f32f4 Cycles: simplify handling of ray distance in GPU rendering
All our intersections functions now work with unnormalized ray direction,
which means we no longer need to transform ray distance between world and
object space, they can all remain in world space.

There doesn't seem to be any real performance difference one way or the
other, but it does simplify the code.
2022-07-26 14:25:31 +02:00
ea26995bc8 Cycles: more closely match some math and intersection operations in Embree
This helps with debugging, and gives a slightly closer match between CPU
and CUDA/HIP/Metal renders when it comes to ray tracing precision.
2022-07-26 14:25:31 +02:00
fd6c930e28 Fix T99816: renaming attribute works incorrectly
This fixes two issues:
* There was a crash when the new attribute name was empty.
* The attribute name was incremented (e.g. "Attribute.001") when
  the old and new name were the same.
2022-07-26 14:25:31 +02:00
f404db4af6 Fix T99850: incorrect tangents on evaluated bezier curves
Cyclic curves don't need the tangent correction based on the first
and last handle position.
2022-07-26 14:25:31 +02:00
e05583eda7 Fix T99851: Subdivide Curve node does not initialize attributes of end point 2022-07-26 14:25:31 +02:00
49210a108b Fix T99880: no node timing for frames in node groups 2022-07-26 14:25:31 +02:00
28034ce068 Fix T99889: Fillet Curve node uses wrong radius 2022-07-26 14:25:31 +02:00
Ramil Roosileht
8316aafc94 Fix T99036: hex color in "Add Color Attribute"
Proposed solution by @scurest The color attribute in the RNA was tagged as
 COLOR_GAMMA. This change will change it to a regular COLOR.

{F13217692}

Reviewed By: joeedh, jbakker

Maniphest Tasks: T99036

Differential Revision: https://developer.blender.org/D15272
2022-07-26 14:25:31 +02:00
cfcdaa1e7c Fix T99929: lattice modifier looks up vertex group index in wrong place
It looked up the vertex group index based on the object instead of the
actual mesh that is currently used. Since geometry nodes, the number
and order of attributes can change in arbitrary ways during evaluation.
Therefore, this index has to be looked up on the mesh which contains
the most up-to-date information.

There are probably similar issues in other modifiers. That has to be
fixed step by step. Ideally by using the attribute api directly eventually.
2022-07-26 14:25:31 +02:00
c1175c6a86 Fix missing disabled hint when dragging from Asset Browser in edit mode
When dragging assets into the 3D View while in any other mode than
object mode, dropping would be disabled and the cursor would indicate
that. However there was supposed to be an "Only supported in object
mode" message, that similar operators showed, but got forgotten when
this one was introduced.
2022-07-26 14:25:31 +02:00
ba22cc6755 Curves: add warning when invalid uv map is used when adding curves
UV maps that are used for surface attachment must not have overlapping
uv islands, because then the same uv coordinate would correspond to
multiple surface positions.

Ref T99936.
2022-07-26 14:25:31 +02:00
03ae19b5f8 Geometry: detect when the sample uv is in multiple triangles 2022-07-26 14:25:31 +02:00
3b76778847 EEVEE-Next: Fix float3 passes being incorrect 2022-07-26 14:25:31 +02:00
96d96e8909 EEVEE-Next: Fix some Material compilation errors 2022-07-26 14:25:31 +02:00
14db500ad2 EEVEE-Next: Display compatible properties panels
Only a few are kept not available as their features are not yet supported.
2022-07-26 14:25:31 +02:00
ae3ca88d9a Fix build error with WITH_CYCLES_KERNEL_NATIVE_ONLY on macOS Arm
-march=native is not supported for all architectures.
2022-07-26 14:25:31 +02:00
05da26222b Fix T99961: crash when spreadsheet shows volume grids 2022-07-26 14:25:31 +02:00
482ac5005e Fix: crash when accessing attributes from multiple threads
Calling two non-const methods on a `MutableAttributeAccessor`
at the same time in multiple threads is not safe.

While I don't know what caused the crash here exactly, I do know
that it happens while looking up the attribute for writing, which
may modify the unterlying geometry. I couldn't reproduce the
bug with a debug build or without threading.
2022-07-26 14:25:31 +02:00
Alex Parker
cd121b4fc5 Undo: Improve image undo performance
When texture painting a lot of time is spent in ED_image_paint_tile_find.
This fixes stores the PaintTiles in a blender::Map making ED_image_paint_tile_find an O(1) rather than O(n) operation.

When using threading the locking should happen during read as well,
still this gives a boost in performance as the read is now much faster.

Reviewed By: jbakker

Maniphest Tasks: T99546

Differential Revision: https://developer.blender.org/D15415
2022-07-26 14:25:31 +02:00
34a86b41c6 Geometry Nodes: Improve UV Sphere primive performance
In a test producing 10 million vertices I observed a 3.6x improvement,
from 470ms to 130ms. The largest improvement comes from calculating
each mesh array on a separate thread. Besides that, the larger changes
come from splitting the filling of corner and face arrays, and
precalculating sines and cosines for each ring.

Using `parallel_invoke` does gives some overhead. On a small 32x16
input, the time went up from 51us to 74us. It could be disabled
for small outputs in the future. The reasoning for this parallelization
method instead of more standard data-size-based parallelism is that the
latter wouldn't be helpful except for very high resolution.
2022-07-26 14:25:30 +02:00
Lukas Stockner
be64dc64ed Render: Update lightgroup membership in objects and world if lightgroup is renamed
As discussed, this only updates objects in and the world of the scene to which the view layer belongs, which also avoids the problem of not having a BMain available.

Differential Revision: https://developer.blender.org/D14740
2022-07-26 14:25:30 +02:00
9d1fad476e Alembic: speed up edge crease import
The Alembic importer uses a linear search over the mesh edges to find
the right edge when setting edge creases. Although the complexity is
`O(m * n)`, with `m` being the number of creased edges, and `n` being
the number of edges, this can lead to a quadratic complexity as `m`
approches `n`.

This patch uses `EdgeHash` to store and retrieve the edges, which
should bring complexity closer to `O(n)`, provided that lookup is
`O(1)`.

See differential for some timings. In most files, this is expected
to give at least a 2-3x speedup for this operation, but can lead
orders of magnitude speed increase for dense meshes with a significant
number of edge creases.

Differential Revision: https://developer.blender.org/D15521
2022-07-26 14:25:30 +02:00
13df661e78 Fix T98367: Light group passes do not work when shadow catcher is used 2022-07-26 14:25:30 +02:00
bd68d34cac Attributes: Use new API for C-API functions
Use the C++ API to implement more of the existing C functions.
This corrects the cases where one tries to add a builtin attribute
with the wrong domain or type on curves, though a better warning
message would be helpful in the future, and also reduces duplication
of the internal logic. Not much more is possible without changing
the interface.
2022-07-26 14:25:30 +02:00
de43db0b07 EEVEE-Next: Decorelate Large filter spiral sampling
This avoids correlation artifacts with the jitter pattern itself.
Also try to reduce the visible spiral pattern.
2022-07-26 14:25:30 +02:00
08ec203a0c EEVEE-Next: Fix depth accumulation and stability in viewport
The display depth is used to composite Gpencil and Overlays. For it to
be stable we bias it using the dFdx gradient functions. This makes
overlays like edit mode not flicker.

The previous approach to save the 1st center sample does not work anymore
since we jitter the projection matrix in a looping pattern when scene
is updated. So the center depth is only (almost) valid 1/8th of the times.
The biasing technique, even if not perfect, does the job of being stable.

This has a few cons:
- it makes the geometry below the ground plane unlike workbench engine.
- it makes overlays render over geometry at larger depth discontinuities.
2022-07-26 14:25:30 +02:00
b3832dd13a EEVEE-Next: Make animated viewport non jittered when disabling denoising 2022-07-26 14:25:30 +02:00
7d1525d96d EEVEE-Next: Add back background opacity toggle 2022-07-26 14:25:30 +02:00
f541400ecf EEVEE-Next: Make Anti-Flicker more strong
This might make the image a bit blurier but it reduces the flickering of
shiny surfaces during animation.

This uses the technique described in "High Quality Temporal Supersampling"
by Brian Karis at Siggraph 2014 (Slide 45): Reduce the exponential factor
when the history is close the bounding box border.
2022-07-26 14:25:30 +02:00
812d17e873 EEVEE-Next: Fix Alt+B render borders
A few offsets were missing.
Reminder that this does not change the actual render resolution but it
reduces the VRAM consumption of accumulation buffers.
2022-07-26 14:25:30 +02:00
977fba22a1 EEVEE-Next: Fix background velocity 2022-07-26 14:25:30 +02:00
208ccb274c Cleanup: Fix off-by-half-errors with udim search 2022-07-26 14:25:30 +02:00
b875ac49ae Cleanup: Simplify uv sculpt tool
No functional changes.
2022-07-26 14:25:30 +02:00
376df415a4 Fix: Removing attributes from UI invalidates caches
Use the new attribute API to implement the attribute remove function
used by RNA, except for BMesh attributes. Currently, removing curve
attributes from the panel in the property editor does not mark the
relevant caches dirty (for example, the cache of curve type counts),
because that behavior is implemented with the new attribute API.
Also, eventually we want to merge the two APIs, and removing an
attribute is the first function that can be partially implemented
with the new API.

Differential Revision: https://developer.blender.org/D15495
2022-07-26 14:25:30 +02:00
b28ee79fa2 EEVEE-Next: Film: Rename filter_size for clarity and add box filter ...
... as a debug option.
2022-07-26 14:25:30 +02:00
12432614c6 EEVEE-Next: Film: Fix incorrect anti-aliasing
There was a confusion about what space the offset was in.
2022-07-26 14:25:30 +02:00
c86b7dd6cd Fix an assert trip in boolean tickled by D11272 example.
The face merging code in exact boolean made an assumption that
the tesselated original face was manifold except at the boundaries.
This should be true but sometimes (e.g., if the input faces have
self-intersection, as happens in the example), it is not.
This commit makes face merging tolerant of such a situation.
It might leave some stray edges from triangulation, but it should
only happen if the input is malformed.
Note: the input may be malformed if there were previous booleans
in the stack, since snapping the exact result to float coordinates
is not guaranteed to leave the mesh without defects.

This is the second try at this commit. The previous one had a typo
in it -- luckily, the tests caught the problem.
2022-07-26 14:25:30 +02:00
67a2577220 Fix T99905: wrong toposort when the node tree is cyclic 2022-07-26 14:25:30 +02:00
cce1fb0c70 IO: speed up import of large amounts of objects in USD/OBJ by pre-sorting objects by name
Previously, when creating "very large" (tens-hundreds of thousands)
amounts of objects, the Blender code that was ensuring name
uniqueness was the bottleneck. That got recently addressed (D14162),
however now sorting of IDs by their names is the remaining bottleneck.

Name sorting code in Blender is optimized for the pattern where names
are inserted in already sorted order (i.e. objects expect to get added
near the end of the list). By doing this pre-sorting of objects
intended to get created by an importer (USD and OBJ, in this patch),
this sorting bottleneck can be largely removed, especially with very
high object counts.

Windows, Ryzen 5950X, import times:

- OBJ, splash screen scene (26k objects): 22.0s -> 20.7s
- USD, Disney Moana scene (250k objects): 585s -> 82.2s (10 minutes -> 1.5 minutes)

Reviewed By: Michael Kowalski, Howard Trickey
Differential Revision: https://developer.blender.org/D15506
2022-07-26 14:25:30 +02:00
d50bde3cc8 Fix T99830: missing update after reordering node group sockets 2022-07-26 14:25:30 +02:00
2ffe70b528 Fix: Store Named Attribute node not working when attribute did not exist 2022-07-26 14:25:30 +02:00
93577fa606 Update RNA to User manual mappings 2022-07-26 14:25:30 +02:00
47059ca38a Cleanup: Typo with uv sphere normal creation
Regression from 087f27a52f
2022-07-26 14:25:30 +02:00
649db9da2c Fix T99873: Use evaluated vertex groups in armature modifier
Geometry nodes has added the ability to modify mesh vertex groups
during evaluation (see 3b6ee8cee7). However, the armature
modifier always uses the vertex groups from the original object.
This is wrong for the modifier stack, where each modifier is meant
to use the output of the previous.

This commit makes the armature modifier use the evaluated vertex groups
if they are available. Otherwise it uses the originals like before.

Differential Revision: https://developer.blender.org/D15515
2022-07-26 14:25:30 +02:00
b5d67a413d EEVEE-Next: Add exposure awareness to denoising
This uses the exposure to get a better approximation of the perceptual
brighness of a sample before accumulating it.

Note that we do not modify exposure of the image. Only the samples weights
are computed differently.
2022-07-26 14:25:30 +02:00
201299e127 EEVEE-Next: Fix render not working
The swaps during accumulation were ignored because of the way the
`SwapChain<>` implementation works.

Using external references and updating them fixes the issue.
2022-07-26 14:25:30 +02:00
7c025321d1 Fix T99835: Incorrect title case for two node names 2022-07-26 14:25:30 +02:00
41fb9bd6d0 Cleanup: Use r_ prefix for boolean return parameters
Also rearrange some lines to simplify logic.
2022-07-26 14:25:30 +02:00
6b69c07cce Fix T99873: Store named attribute node cannot write to vertex groups
Since fd5e5dac89, the node would remove the attribute before
adding it again, which lost the vertex group status of an attribute,
meaning they were written as arbitrary attributes.

Now, the node first tries to write to attributes with the same domain
and data-type, which covers the vertex group case. Then it falls back
to removing the attribute and adding it again. Even that can fail
though, so I added an error message to make that a bit clearer.

Differential Revision: https://developer.blender.org/D15514
2022-07-26 14:25:30 +02:00
00374651fa Fix nodes not transforming
Error in {rB98bf714b37c1}
2022-07-26 14:25:30 +02:00
754ca558e1 Geometry Nodes: Port sample curves node to new data-block
Use the newer more generic sampling and interpolation functions
developed recently (ab444a80a2) instead of the `CurveEval` type.
Functions are split up a bit more internally, to allow a separate mode
for supplying the curve index directly in the future (T92474).

In one basic test, the performance seems mostly unchanged from 3.1.

Differential Revision: https://developer.blender.org/D14621
2022-07-26 14:25:30 +02:00
2f26cf7c64 Curves: support sculpting on deformed curves
Previously, curves sculpt tools only worked on original data. This was
very limiting, because one could effectively only sculpt the curves when
all procedural effects were turned off. This patch adds support for curves
sculpting while looking the result of procedural effects (like deformation
based on the surface mesh). This functionality is also known as "crazy space"
support in Blender.

For more details see D15407.

Differential Revision: https://developer.blender.org/D15407
2022-07-26 14:25:30 +02:00
Germano Cavalcante
2fde57d519 Refactor: arrange transform convert functions in 'TransConvertTypeInfo'
Simplify the transform code by bundling the TransData creation, Data
recalculation, and special updates into a single struct.

So similar functions and parameters can be accessed without special
type checks.

Differential Revision: https://developer.blender.org/D15494
2022-07-26 14:25:30 +02:00
1a1ba25550 GHOST/Wayland: Fix mouse wheel events for Sway Compositor (use seat v5)
Bump the requested seat version to v5, use discreet scroll callback.

Tested with gnome, river & sway.
2022-07-26 14:25:30 +02:00
fa20ac0b8f Cycles: enable oneAPI in Linux release builds
0f50ae131f didn't do it reliably
since it was deactivated explicitly a bit above.
2022-07-26 14:25:30 +02:00
cbd90ed08a BMesh: move bmesh_mesh to C++
This allows parts of the code to be threaded more easily.
2022-07-26 14:25:30 +02:00
056690fa35 Cleanup: move crazyspace.c to c++
Doing this in preparation for D15407.
2022-07-26 14:25:30 +02:00
b55bf6f9fd Fix T87779: Asymmetric vertex positions in circles primitives
Add sin_cos_from_fraction which ensures each quadrant has matching
values when their sign is flipped.
2022-07-26 14:25:29 +02:00
83d1b4b810 Cleanup: add BKE_image_find_nearest_tile_with_offset
Every caller BKE_image_find_nearest_tile was calculating the tile offset
so add a version of this function that returns the offset too.
2022-07-26 14:25:29 +02:00
73bc798ce5 Fix crash loading factory settings in image paint mode
Loading factory settings left the region NULL, causing the brushes
poll function to crash.
2022-07-26 14:25:29 +02:00
f6e371426c Cleanup: quiet nonull-compare warnings with GCC 2022-07-26 14:25:29 +02:00
70da312c43 UV: Edge support for select shortest path operator
Calculating shortest path selection in UV edge mode was done using vertex
path logic. Since the UV editor now supports proper edge selection [0],
this approach can sometimes give incorrect results.

This problem is now fixed by adding separate logic to calculate the
shortest path in UV edge mode.

Resolves T99344.

[0]: ffaaa0bcbf

Reviewed By: campbellbarton

Ref D15511.
2022-07-26 14:25:29 +02:00
446ef8cff7 Fix T99884: Crash when converting to old curve type
The conversion from Curves to CurveEval used an incorrect type
for one of the builtin attributes. Also, an incorrect default was used
for reading the nurbs_weight attribute.
2022-07-26 14:25:29 +02:00
9f1b3fa861 Cleanups: Small changes to armature deform
Use const pointers, remove unused data member for parallel callback,
use listbase macro.
2022-07-26 14:25:29 +02:00
db581ef413 Fix T99854: Crash converting legacy NURBS curves to new type
Creating the attributes was done inside a parallel loop. Also correct a
typo for the parallel grain size, which was meant to be a power of two.
2022-07-26 14:25:29 +02:00
Sebastiano Barrera
180110ace2 Fix T91932: number sliders wrap around when dragged for long distance on X11
The value of number sliders (e.g. the "end frame" button) wrap around to
their pre-click value when dragging them for a very long distance (e.g.
by lifting the mouse off the desk and placing it back on to keep
dragging in the same direction).

The problem is X11-specific, and due to XTranslateCoordinates using a
signed int16 behind the curtains, while its signature and the rest of
Blender uses int32. The solution is to only use XTranslateCoordinates on
(0, 0) to get the delta between the screen and client reference systems,
and applying the delta in a second step.

Differential Revision: https://developer.blender.org/D15507
2022-07-26 14:25:29 +02:00
80d7c56b18 Cleanup: compiler warning 2022-07-26 14:25:29 +02:00
5dc2d63ff9 Fix crash in some very rare case in remapping code.
Actualy 'safe' building of the base has in view layers (as part of
`BKE_main_collection_sync_remap`) would only happen when there was
already an existing one, otherwise it was skipped, and rebuilt later
(without the support for doublons) in collection sync code.

Very odd that that error was never spotted before, issue in code has
been there for a long time already. Probably only happens in rare cases
(specific conjuction of factors during remapping of old ID into itelf
new id)?

Reported by @hjalti from Blender studio. Reproducing case:
`heist/pro/shots/050_alarm/050_0160/050_0160.anim.blend`, r1407
2022-07-26 14:25:29 +02:00
37f00ce83b DRW: Volume: Fix crash in command line render caused by null textures
This was caused by the world volume shader needing placeholder textures
that were not available until cache populate begins.

Adding a check and creating on the fly fixes the issue.
2022-07-26 14:25:29 +02:00
1ab37f6eec EEVEE-Next: Add back option to disable TAA (Viewport Denoising 2022-07-26 14:25:29 +02:00
0b46b9a1e0 Fix crash due to improper handling of new library runtime name_map data on read/write.
Code handling read/write of libraries is still particular... but trying
to call `library_runtime_reset` on a random address at readtime was an
obvious mistake I should have caught during review :(

Regression from rB7f8d05131a77.
2022-07-26 14:25:29 +02:00
0b22cd3e4d Spreadsheet: Implement selection filter for curves sculpt mode
The spreadsheet can retrieve the float selection using the same
utilities as curves sculpt brushes. Theoretically this can work in
original, evaluated, and viewer node modes, at least when the
sculpt selection attributes are able to be propagated.

Differential Revision: https://developer.blender.org/D15393
2022-07-26 14:25:29 +02:00
6d6b90d268 GPU: Fix compilation with WITH_GPU_BUILDTIME_SHADER_BUILDER option 2022-07-26 14:25:29 +02:00
18b2551495 EEVEE-Next: Filter NaN at output to avoid propagation. 2022-07-26 14:25:29 +02:00
b8493e3389 Cleanup: DRW: common_math_geom_lib.glsl: Fix variable name style 2022-07-26 14:25:29 +02:00
ecea831b63 EEVEE-Next: Add Temporal-AntiAliasing
The improvements over the old implementation are:
- Improved history reprojection filter (catmull-rom)
- Use proper velocity for history reprojection.
- History clipping is now done in YCoCg color space using better algorithm.
- Velocity is dilated to keep correct edge anti-aliasing on moving objects.

As a result, the 3x3 blocks that made the image smoother in the previous
implementation are no longer visible is replaced by correct antialiasing.

This removes the velocity resolve pass in order to reduce the bandwidth
usage. The velocities are just resolved as they are loadded in the film
pass.
2022-07-26 14:25:29 +02:00
5e4348786f DRW: common_math_geom_lib.glsl: Add line_aabb_clipping_dist 2022-07-26 14:25:29 +02:00
1d49bc15b9 Fix build error in tests binary after previous commit
Also remove an unused include and add a comment,
const, use the math namespace.
2022-07-26 14:25:29 +02:00
872180294a Cleanup: Rename length parameterization interpolation function
The name makes more sense as an action, other interpolation
methods besides linear probably don't make sense here anyway.
2022-07-26 14:25:29 +02:00
1fc7f30a39 Cleanup: Remove debug print in test 2022-07-26 14:25:29 +02:00
7b81f382dd GHOST/Wayland: fix cursor glitch after grabbing while hidden
When the cursor grabbing was disabled, Blender's internal location
(wmWindow.eventstate) kept the location before un-hiding.

This caused the paint cursor to show in the wrong location after
adjusting the color wheel for e.g.
2022-07-26 14:25:29 +02:00
99ab84b8d4 Cleanup: Simplify relation flags assignment 2022-07-26 14:25:29 +02:00
7efd16466e Geometry Nodes: add debug check for whether AttributeWriter.finish is called
Calling `finish` after writing to generic attributes is currently necessary for
correctness. Previously, this was easy to forget. Now there is a check for this
in debug builds.
2022-07-26 14:25:29 +02:00
9819e677bc Curves: fix applying materials when applying modifier
The issue was that geometry nodes was run on the original curves,
and set a pointer to an evaluated material id on it. The fix is to not
mix up original and evaluated data by making sure that geometry nodes
does not modify the original data.
2022-07-26 14:25:29 +02:00
e5a032e73d Cleanup: Make automated code check happy.
- Assert that one of the thwo branches in
  `id_override_library_create_hierarchy` are always processed.
- Init success value regardless.
2022-07-26 14:25:29 +02:00
6bdbe75e4a Cleanup: Unused forward declaration 2022-07-26 14:25:29 +02:00
564657e25b Fix T99885: Invalid dependency graph state when curves surface is invisible
Differential Revision: https://developer.blender.org/D15510
2022-07-26 14:25:29 +02:00
Bastien Montagne
c4b870ebf9 LibOverride: support 'make override' for all selected items.
This commit allows to select several data-blocks in the outliner and
create overrides from all of them, not only the active one.

It properly creates a single hierarchy when several IDs from a same
hierarchy root data are selected.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D15497
2022-07-26 14:25:29 +02:00
d5d4635531 Fix T99733: Objects with driven visibility are evaluated when not needed
The issue was caused by the fact that objects with driven or animated
visibility were considered visible by the dependency graph evaluation.

This change makes it so the dependency graph evaluation is aware of
visibility which might be changing. This is achieved by evaluating the
path of the graph which affects objects visibility and adjusts to it
before evaluating the rest of the graph.

There is some time penalty to this, but there does not seem to be a
way to fully avoid this penalty.

With the production shot from the heist project the FPS drops by a
tenth of a frame (~9.4 vs ~9.3 fps) when adding a driver to an object
which keeps it visible. Note that this is a bit hard to measure since
the FPS fluctuates quite a bit throughout the playback. On the other
hand, having a driver on a visibility of a heavy object from character
and setting visibility to false gives big speedup.

Also worth noting that there is no penalty at all when there are no
animated visibilities in the scene.

Differential Revision: https://developer.blender.org/D15498
2022-07-26 14:25:29 +02:00
3ea9fefb52 Depsgraph: Clear operation evaluation flags early on
The goal is to make it possible to evaluate the graph in multiple
passes without evaluating the same node multiple times.

Currently should not be any functional changes.
2022-07-26 14:25:29 +02:00
dad882fe00 Cleanup: format 2022-07-26 14:25:29 +02:00
c7808728c5 Cleanup: add ISMOUSE_MOTION macro
Replace verbose ELEM(..) usage, now each kind of mouse event has it's
own macro.
2022-07-26 14:25:29 +02:00
fbc8620b3a Fix WM_event_type_mask_test ignoring wheel and gesture events
WM_event_type_mask_test checks assumed ISMOUSE macro worked for any
kind of mouse event when it only accepted buttons & motion.

Now ISMOUSE checks for any kind of mouse event,
use ISMOUSE_BUTTON/WHEEL/GESTURE for more specific checks.
2022-07-26 14:25:29 +02:00
52c4aa53ee WM: replace ISMOUSE with ISMOUSE_BUTTON
The ISMOUSE macro was used in situations only button events
needed to be checked.

The only functional difference would be MOUSEMOVE events were
previously accepted for these checks.
2022-07-26 14:25:29 +02:00
c6a5a820b6 WM: categorize smart-zoom as a gesture
Event handling and the enum definition documents MOUSESMARTZOOM
as a gesture however it wasn't accepted by ISMOUSE_GESTURE,
instead it was added to the ISMOUSE macro.

Move the type check to ISMOUSE_GESTURE.
2022-07-26 14:25:29 +02:00
4523969204 Fix failing cycles test from previous commit
Deprecated custom data type CD_MTEXPOLY has inconsistent data usage.

Reviewed By: Campbell Barton
2022-07-26 14:25:29 +02:00
5c92398240 Fix T90620: Ignore missing UV data caused by corrupt .blend file
Add crash protection and partial recovery for corrupt .blend files,
particularly for missing UV data.

Differential Revision: https://developer.blender.org/D15489
2022-07-26 14:25:29 +02:00
f734dac800 Cleanup: spelling in comments, typos in tool-tips 2022-07-26 14:25:29 +02:00
496a97d952 Fix T99678: Crash applying non-existent modifiers
Regression in [0] accessed the modifier type before NULL check.

[0]: 78fc5ea1c3
2022-07-26 14:25:29 +02:00
31c4bf0b29 Fix T99687: Cloth filter crash
The code was failing to exclude the sculpt object from
the list of collision objects.
2022-07-26 14:25:29 +02:00
ca18180a75 Fix T99878: Deleting curves or points removes anonymous attributes
Use the attribute API instead of the CustomData API, to correctly
handle anonymous attributes and simplify the code. One non-obvious
thing to note is that the type counts are recalculated by the "finish"
function of the `curve_type` attribute, so they don't need to be copied
explicitly. Also, the mutable attribute accessor cannot be an reference
if we want to give it an rvalue, which is convenient in this case.
2022-07-26 14:25:28 +02:00
92983e57d8 Cleanup: Remove unused function 2022-07-26 14:25:28 +02:00
abcf3b85bd Cleanup: Remove unnecessary handling of normals for fluid colliders
The normals are transformed, but not used. It looks like this logic was
just copied from below where the mesh is transformed for creating
emitters, which do use vertex normals.
2022-07-26 14:25:28 +02:00
7fec049494 Fix T99340: Image.frame_duration returning wrong value when image not loaded
The logic here was broken in d5f1b9c, it should load the image first.
2022-07-26 14:25:28 +02:00
1fa9c12aa7 UI: Remove redundant view reference in view items
The new view item base class already holds a reference to the view, no
need to have one in the derived class as well.
2022-07-26 14:25:28 +02:00
02a7f0995d Fix missing registration of grid view items in the view 2022-07-26 14:25:28 +02:00
f3dd7f7e89 Cleanup: use BLI_strncpy instead of strcpy
Using `strcpy` resulted in `stringop-truncation` warnings for me.
2022-07-26 14:25:28 +02:00
c24ead89e3 Cleanup: remove unused get_cage_mesh parameter
All callers passed `false` for this parameter, making it more confusing
than useful. If this functionality is needed again in the future, a separate
function should be added.

Differential Revision: https://developer.blender.org/D15401
2022-07-26 14:25:28 +02:00
Wannes Malfait
91d2c10511 Fix T99667: regression in Delete Geometry node
Differential Revision: https://developer.blender.org/D15445
2022-07-26 14:25:28 +02:00
9952b90a12 Fix T99869: Edge crease no longer working
Missed in d14c2d549b
2022-07-26 14:25:28 +02:00
9d0a85e8df Fix T99847: Dragging image from Image Editor to Node Editor broken
Oversight in b0da080c2c. The `session_uuid` operator property wouldn't
be checked by the invoke callback, and if neither the `filepath` nor the
`name` property were set, the File Browser would open.
2022-07-26 14:25:28 +02:00
6af9e9eee4 IDManagement: Speedup ID unique name assignment by tracking used names/basenames/suffixes
An implementation of T73412, roughly as outlined there:

Track the names that are in use, as well as base names (before
numeric suffix) plus a bit map for each base name, indicating which
numeric suffixes are already used. This is done per-Main/Library,
per-object-type.

Timings (Windows, VS2022 Release build, AMD Ryzen 5950X):

- Scene with 10k cubes, Shift+D to duplicate them all: 8.7s -> 1.9s.
  Name map memory usage for resulting 20k objects: 4.3MB.
- Importing a 2.5GB .obj file of exported Blender 3.0 splash scene
  (24k objects), using the new C++ importer: 34.2s-> 22.0s. Name map
  memory usage for resulting scene: 8.6MB.
- Importing Disney Moana USD scene (almost half a million objects):
  56min -> 10min. Name map usage: ~100MB. Blender crashes later on
  when trying to render it, in the same place in both cases, but
  that's for another day.

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D14162
2022-07-26 14:25:28 +02:00
5d9d3224b8 Constraints: add checks to specially handle the custom space target.
- The custom space target never needs B-Bone data (used by depsgraph).
- When drawing the relationship lines use the space matrix directly.
- Don't use the custom target to control the target space type dropdown.

Differential Revision: https://developer.blender.org/D9732
2022-07-26 14:25:28 +02:00
fbd8ac74ad Constraints: add missing calls to initialize custom space.
Add calls to a few locations that look like they may need to
initialize the Custom Space matrix, i.e. generally any place
that computes target matrices.

Differential Revision: https://developer.blender.org/D9732
2022-07-26 14:25:28 +02:00
219171a9a4 Use appropriate context for the DopeSheet Action Custom Properties panel.
Refactor D14646 to use context.active_action for the Action
Custom Properties panel, matching the already existing Action panel.

This has the advantage that it allows access to the properties of
any actions with channels visible in the Dope Sheet, e.g. Shape Keys,
Materials etc; while using just the active object is limited to just
the object animation.

Also move both panels from Item to the Action tab.

Differential Revision: https://developer.blender.org/D15288
2022-07-26 14:25:28 +02:00
111f5dd39e Cleanup: unused parameter in own recent commit rB92ca920c52b9. 2022-07-26 14:25:28 +02:00
Damien Picard
c74b53bdb7 I18n: fixes to add-on message extraction
This commit fixes several issues in add-ons UI messages extraction code:

- In multi-file modules, the script would crash because it tried to write to
  the dir instead of a `translations.py` file;
- The add-on message extraction works by enabling the add-on, getting all
  messages; disabling the add-on, getting all messages; then comparing the
  two message sets. But often a bug happens where a class gets a
  description from somewhere else in memory. I couldn’t debug that, so a
  workaround is to check that the message isn’t a corrupted one before
  removing it;
- `printf()` doesn't exist in Python and would crash the script;
- `self.src[self.settings.PARSER_PY_ID]` can be replaced by `self.py_file`
  in class `I18n`, since a property exists to do that;
- At one point a generator was printed instead of its values, so let's
  unpack the generator to get the values. Maybe the print could be
  deleted entirely;
- Use SPDX license identifier instead of GPL license block, to be more in
  line with other scripts from the codebase.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15474
2022-07-26 14:25:28 +02:00
Bastien Montagne
7fcac05a9e Add a 'Apply and Delete All' operation to shapekeys.
Adds a new option to the 'Delete ShpaKeys' operator, which first applies
the current mix to the object data, before removing all shapekeys.

Request from @JulienKaspar from Blender studio.

Reviewed By: JulienKaspar

Differential Revision: https://developer.blender.org/D15443
2022-07-26 14:25:28 +02:00
bcd78320f3 Curves: fix uninitialized curve type when adding new curves 2022-07-26 14:25:28 +02:00
b3a8d386df Cleanup: Access attributes with new API instead of geometry components
Remove the boilerplate of using a local geometry component just to use
the attribute API that was necessary before b876ce2a4a.
2022-07-26 14:25:28 +02:00
b6bbdc0f5e Curves: Remove use of CurveEval in sculpt brushes
This commit removes the use of PolySpline for resampling curves and
replaces it with the length parameterization utility for that purpose.
I didn't test performance, but I would expect the shrinking to be
slightly faster because I reused some arrays to avoid allocating
them for every curve. I noted some potential improvements in
the "add curves" function.

Differential Revision: https://developer.blender.org/D15342
2022-07-26 14:25:28 +02:00
7843131fb5 Curves: Port fillet node to the new data-block
This commit ports the fillet curves node to the new curves data-block,
and moves the fillet node implementation to the geometry module to help
separate the implementation from the node.

The changes are similar to the subdivide node or resample node. I've
resused common utilities where it makes sense, though some things like
the iteration over attributes can be generalized further. The node
is now multi-threaded per-curve and inside each curve, and some buffers
are reused per curve to avoid many allocations.

The code is more explicit now, and though there is more boilerplate to
pass around many spans, the more complex logic should be more readable.

Differential Revision: https://developer.blender.org/D15346
2022-07-26 14:25:28 +02:00
33dd11283f Cleanup: Combine geometry null checks in if statements
Testing if components or virtual arrays are null in the same line they
are retrieved can make this boilerplate code a bit easier to read.
2022-07-26 14:25:28 +02:00
d8ac99faf0 Cleanup: Use generic utility for copying compressed attribute
In the future, `materialize_compressed_to_uninitialized_threaded`
could be moved somewhere else and reused.
2022-07-26 14:25:28 +02:00
03d0be72e2 Point Cloud: Remove redundant custom data pointers
Similar to e9f82d3dc7, but for point clouds instead.

Differential Revision: https://developer.blender.org/D15487
2022-07-26 14:25:28 +02:00
dc06d31a52 Curves: Remove redundant custom data pointers
These mutable pointers present problems with ownership in relation to
proper copy-on-write for attributes. The simplest solution is to just
remove them and retrieve the layers from  `CustomData` when they are
needed. This also removes the complexity and redundancy of having to
update the pointers as the curves change. A similar change will apply
to meshes and point clouds.

One downside of this change is that it makes random access with RNA
slower. However, it's simple to just use the RNA attribute API instead,
which is unaffected. In this patch I updated Cycles to do that. With
the future attribute CoW changes, this generic approach makes sense
because Cycles can just request ownership of the existing arrays.

Differential Revision: https://developer.blender.org/D15486
2022-07-26 14:25:28 +02:00
Pratik Borhade
b378785711 Fix T99583: Missing update for option in particle edit mode
Missing Ui refresh when property is accessed through shortcut.
Use RNA_def_property_update to solve this.

Differential Revision: https://developer.blender.org/D15431
2022-07-26 14:25:28 +02:00
32ec394841 UI Code Quality: Move eyedropper files to own folder
Part of T98518
2022-07-26 14:25:28 +02:00
Tomek Gubala
fc883d8b72 UV: add Snap Cursor to Origin
Similar to snapping to the world origin in the 3D viewport. This can be found
in the Shift+S pie menu and UV > Snap menu.

Differential Revision: https://developer.blender.org/D15055
2022-07-26 14:25:28 +02:00
4f56f0684b Cleanup: compiler warning 2022-07-26 14:25:28 +02:00
1199c102a3 Fix error printed in console when running Shade Flat operator
Only the Shade Smooth operator has autosmooth settings.
2022-07-26 14:25:28 +02:00
14d9538569 Fix build error when not using unity build 2022-07-26 14:25:28 +02:00
51a4da929d Fix T99643: Vertex Crease fails with symmetry
Create a transform conversion type that only considers the Vertex
Custom Data.

This reduces the complexity of converting Meshes and slightly
optimizes the transformation.
2022-07-26 14:25:28 +02:00
38cd420b7c Cleanup: Remove compile option for curves object
After becb1530b1 the new curves object type isn't hidden
behind an experimental flag anymore, and other areas depend on this,
so disabling curves at compile time doesn't make sense anymore.
2022-07-26 14:25:28 +02:00
3bf4f45074 Cleanup: Improve API and documentation of interface_view.cc
File documentation was outdated and could use general improvement.
Function names didn't really reflect the level they are operating on.
2022-07-26 14:25:28 +02:00
3531e17298 UI Code Quality: Move view related files to own folder
Part of T98518.
2022-07-26 14:25:28 +02:00
Amélie Fondevilla
4c5158d165 Fix T99732: Crash on F3 in the dopesheet
Adding the `FCURVESONLY` filter in the filter function of the Grease
Pencil dopesheet prevents calls to F-curves related functions to grease
pencil channels, thereby fixing the crash.

Reviewed By: antoniov, sybren

Maniphest Tasks: T99732

Differential Revision: https://developer.blender.org/D15490
2022-07-26 14:25:28 +02:00
f9cc667976 Curves: Hide snapping menu in curves sculpt mode
The menu/popover doesn't affect anything in the mode, and precision
operations that would use snapping are meant for edit mode anyway.
2022-07-26 14:25:28 +02:00
c2ec2bf2e0 RNA: Don't allocate empty char pointer properties
Instead of allocating a single 0 char, set the `char *` DNA pointer to
null. This avoids the overhead of allocating and copying single-bytes.

rBeed45b655c9f didn't do this for safety reasons, but I checked the
existing uses of this behavior in DNA/RNA. Out of 43 total `char *`
members, this change only affects 7 recently added properties.
For a complete list, see the patch description.

Differential Revision: https://developer.blender.org/D14779
2022-07-26 14:25:28 +02:00
d50c371fc6 Depsgraph: Make animated properties API receive const ID
Semantically it is more correct as the cache does not modify the ID.

There is need to do couple of const casts since the BKE (which is in C)
does not easily allow to iterate into f-curves of const ID.

Should be no functional changes.
2022-07-26 14:25:28 +02:00
7e7d6671d8 Geometry Nodes: Copy parameters when copying a curves data-block
Previously, things like materials, symmetry, and selection options
stored on `Curves` weren't copied to the result in nodes like the
subdivide and resample nodes. Now they are, which fixes some
unexpected behavior and allows visualization of the sculpt mode
selection.

In the realize instances and join nodes the behavior is the same as
for meshes, the parameters are taken from the first (top) input.

I also refactored some functions to return a `CurvesGeometry` by-value,
which makes it the responsibility of the node to copy the parameters.
That should make the algorithms more reusable in other situations.

Differential Revision: https://developer.blender.org/D15408
2022-07-26 14:25:27 +02:00
212a5942fc Metal: Add license header to new files 2022-07-26 14:25:27 +02:00
Jason Fielder
8472f8165a Metal: MTLUniformBuffer module implementation
Initial implementation.

Authored by Apple: Michael Parkin-White
Ref T96261

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D15357
2022-07-26 14:25:27 +02:00
Jason Fielder
f8a87d1d51 Metal: MTLQueryPool implementation adding support for occlusion queries.
When a query begins, the current visibility result buffer needs to be
associated with the currently active Render Pass. The MTLContext and
MTLCommandBuffer are responsible for ensuring new render pass objects are
created if the visibility state changes.

Authored by Apple: Michael Parkin-White
Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D15356
2022-07-26 14:25:27 +02:00
eca51f9395 Cleanup: Add comment for geometry nodes lazyness 2022-07-26 14:25:27 +02:00
ac04dacd1a Nishita sky: Increase elevation range
The Nishita sky texture currently only allows moving the sun to the zenith.
The problem is if you want to animate the passing of a full night-day-night
cycle. Currently it's not easy to do due to this limitation.

The patch makes it so users can easily animate the sun moving from sunrise
to sunset by expanding the max sun elevation to go 360° instead of 90°.

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D13724
2022-07-26 14:25:27 +02:00
9e4e66e4e7 Cleanup: Apply clang-format 2022-07-26 14:25:27 +02:00
3462d3a19c UI: Port view item features to base class, merge view item button types
No user visible changes expected.

Merges the tree row and grid tile button types, which were mostly doing
the same things. The idea is that there is a button type for
highlighting, as well as supporting general view item features (e.g.
renaming, drag/drop, etc.). So instead there is a view item button type
now. Also ports view item features like renaming, custom context menus,
drag controllers and drop controllers to `ui::AbstractViewItem` (the new
base class for all view items).

This should be quite an improvement because:
- Merges code that was duplicated over view items.
- Mentioned features (renaming, drag & drop, ...) are much easier to
  implement in new view types now. Most of it comes "for free".
- Further features will immediately become availalbe to all views (e.g.
  selection).
- Simplifies APIs, there don't have to be functions for individual view
  item types anymore.
- View item classes are split and thus less overwhelming visually.
- View item buttons now share all code (drawing, handling, etc.)
- We're soon running out of available button types, this commit merges
  two into one.

I was hoping I could do this in multiple smaller commits, but things
were quite intertwined so that would've taken quite some effort.
2022-07-26 14:25:27 +02:00
cdfa1665ff UI: Add AbstractViewItem base class
No user visible changes expected.

Similar to rBc355be6faeac, but for view items now instead of the view.
Not much of the item code is ported to use it yet, it's actually a bit
tricky for the most part. But just introducing the base class already
allows me to start unifying the view item buttons (`uiButTreeRow` and
`uiButGridTile`). This would be a nice improvement.
2022-07-26 14:25:27 +02:00
Colin Basnett
a3296473cd Fix T97559: Undoing of NLA strip duplication requires two undo steps
Fix the issue where undoing a "duplicate NLA strip" operation would
require two undo steps.

The cause of this was that the operator was not using the operator macro
system to combine both the duplication and the translate operators into
one. Instead, the old code was simply manually invoking invoking the
translate operator after the duplicate operator had completed.

This patch requires the default keymap to be modified to include the two
new macro operators, `NLA_OT_duplicate_move` and
`NLA_OT_duplicate_linked_move` in favour of the old keymap that simply
called `NLA_OT_duplicate` and passed along a `linked` argument.

`duplicate_move` and `duplicate_move_linked` are two different enough
operations to justify having their own operators from user's
point-of-view, especially since we cannot yet have different tool-tips
based on an operator's settings.

Reviewed By: sybren, mont29

Differential Revision: https://developer.blender.org/D15086
2022-07-26 14:25:27 +02:00
Colin Basnett
491f46e5c4 Animation RNA: Add clear() method to FCurveKeyframePoints
Add `FCurveKeyframePoints.clear()` method to delete all keyframe points
from an FCurve.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D15283
2022-07-26 14:25:27 +02:00
a7e42f311a Curves: align surface and curves object in Empty Hair operator
Without this, symmetry does not work by default when the surface
object was not at the same location as the 3d cursor.
2022-07-26 14:25:27 +02:00
5b760a42e7 Depsgraph: Cleanup, Make variable less ambiguous and more clear 2022-07-26 14:25:27 +02:00
fc3560cabb Depsgraph: Make variable naming more clear
Disambiguate from nodes visibility flags.
2022-07-26 14:25:27 +02:00
Ethan-Hall
e7f4d25a55 EEVEE: use mipmaps of compressed textures (DDS)
Currently Blender generates mipmaps that override the existing ones.
This patch disables generating new mipmaps for compressed textures.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14459
2022-07-26 14:25:27 +02:00
b2b3822b88 Depsgraph: Cleanup, use nested namespace definition 2022-07-26 14:25:27 +02:00
5bc9884f80 Depsgraph: Localize synchronization component visibility handling
Move it from generic visibility handling to the synchronization
component node implementation. Should be no functional changes.
2022-07-26 14:25:27 +02:00
f487ad9b74 Depsgraph: Cleanup, comments wrapping and spacing between lines
Should make it easier to read. No functional changes expected.
2022-07-26 14:25:27 +02:00
9516146016 Depsgraph: Introduce operation code for visibility operation
No functional changes, just makes code more semantically clear.
2022-07-26 14:25:27 +02:00
d033634960 Depsgraph: Cleanup, don't mic static function and anonymous namespace 2022-07-26 14:25:27 +02:00
eb20903b62 Depsgraph: Refactor evaluation into smaller reusable functions
Should be no functional changes.
2022-07-26 14:25:27 +02:00
ee3d84d961 Depsgraph: Cleanup, use nested namespace definition 2022-07-26 14:25:27 +02:00
308658fa85 Depsgraph: Make name and name tag optional in component node
Matches the builder API, making some code less verbose.
2022-07-26 14:25:27 +02:00
14332289fb Depsgraph: Clarify comment in the component node 2022-07-26 14:25:27 +02:00
e064f7e11e Depsgraph: Use single task pool during evaluation
Not sure why multiple pools were created: the pool should be able to
handle two sets of tasks.

Perhaps non-measurable improvement in terms of performance but this
change simplifies code a bit.
2022-07-26 14:25:27 +02:00
912f4178bc Fix T99785: Make Principled Hair IOR input behave like other IOR sliders
Was accidental regression in rBed9b21098dd27bf9364397357f89b4c2648f40c2

Remove the input slider's PROP_FACTOR subtype in favor of the default to
align with other IOR sliders. This provides much better control when
dragging the value with the mouse.

Differential Revision: https://developer.blender.org/D15477
2022-07-26 14:25:27 +02:00
4a090b299a Fix T99737: Dropping files fails with Wayland
Drop events ignored the cursor coordinates, under the assumption that
cursor motion events would also be sent to update the cursor location.

This depended on the behavior of the compositor, it failed for Sway
but worked for Gnome-shell & River.

Resolve by making use of the drop events cursor coordinates.
2022-07-26 14:25:27 +02:00
a372c11eb2 Cleanup: quiet compiler warnings 2022-07-26 14:25:27 +02:00
175650b644 Fix T99794: regression from uv unwrap selected
Restore only_selected_faces flag inadvertently changed by c0e4532331

Differential Revision: https://developer.blender.org/D15480
2022-07-26 14:25:27 +02:00
ecc8181c02 Fix T99781: uv minimize stretch now unflips flipped faces
Add a small gradient to flipped faces proportional to length of edges.

Differential Revision: https://developer.blender.org/D15475
2022-07-26 14:25:27 +02:00
Henrik Dick
79eb6a0ba1 Fix Text Editor highlight of assert and async
Due to the ordering of the checks, assert and async were not highlighted
in the editor, even though they were in the list of keywords.

Differential Revision: http://developer.blender.org/D15483
2022-07-26 14:25:27 +02:00
cffa21af97 Fix wrong alpha for scene linear byte images during texture painting
Make the update logic consistent with the case where the initial texture is
created. Also fixes a wrong assert.

Thanks Clément for spotting this.
2022-07-26 14:25:27 +02:00
b1a6d5c0b8 Context: implement an active_action property that returns a single action.
Although e.g. in the dopesheet there is no specific concept of
active action, displaying panels requires singling out one action
reference. It is more efficient and clearer to implement this
natively in the context rather than using selected_visible_actions[0].

- In the Action Editor the action is taken from the header.
- In the Dope Sheet the first selected action is chosen, because
  there is no concept of an active channel or keyframe.
- In the Graph Editor the action associated with the active curve
  is used, which should also be associated with the active vertex.
  This case may be different from selected_visible_actions[0].

Differential Revision: https://developer.blender.org/D15412
2022-07-26 14:25:27 +02:00
2621127f62 Context: implement indexing for list properties in path_resolve.
The real RNA path_resolve method supports indexing lists,
but the python version on the Context object does not. This
patch adds the missing feature for completeness.

Differential Revision: https://developer.blender.org/D15413
2022-07-26 14:25:27 +02:00
63583a4532 Fix T99750: crash with file output node, after image colorspace saving changes 2022-07-26 14:25:27 +02:00
3fd0a390d1 Build: update Embree to 3.13.4, enable Neon2x on Arm
* Allows Apple Silicon machines to use 8-wide BVH, which the release notes
  mention give an 8% performance boost.
* An update to this version is also required for OpenPGL.

This patch includes contributions from Jason Fielder and Sebastian Herholz.

Ref D15286, T98555

Differential Revision: https://developer.blender.org/D15482
2022-07-26 14:25:27 +02:00
47693d824a Cleanup: change internal Cycles compact BVH default to match UI 2022-07-26 14:25:27 +02:00
Damien Picard
35a937de3b I18n: translate add node operator tooltips
The tooltips from the Add Node menu were extracted, but not translated.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15467
2022-07-26 14:25:27 +02:00
Jun Mizutani
283549a8fc Fix T99742: crash when generating rigify rigs, after recent changes
Differential Revision: https://developer.blender.org/D15473
2022-07-26 14:25:27 +02:00
0bf088189e Subdiv: remove unused GPU device choice, fix crash with libepoxy on init
openSubdiv_init() would detect available evaluators before any OpenGL context
exists, causing a crash with libepoxy. This test however is redundant as we
already check the requirements on the Blender side through the GPU API.

To simplify things, completely remove the device detection in the opensubdiv
module and reduce the evaluators to just CPU and GPU. The plan here is to move
to the GPU module abstraction over OpenGL/Metal/Vulkan and so all these
different backends no longer make sense.

This also removes the user preference for OpenSubdiv compute device, which was
not used for the new GPU subdivision implementation.

Ref D15291

Differential Revision: https://developer.blender.org/D15470
2022-07-26 14:25:27 +02:00
e37f797b72 Fix error indenting new-lines in generated RST API docs
New-lines in RNA type descriptions caused invalid RST indentation.

This resolve the error noted by @nutti in D15481.
2022-07-26 14:25:27 +02:00
bbfb4ca1d9 Fix T99644: Anchored brush mode fails for negative brushes
The stroke code now supports raycasting the original mesh.
This fixes anchored mode not working for negative brushes,
which might move the mesh out of the initial mouse cursor
position.
2022-07-26 14:25:27 +02:00
2047db0be3 Sculpt: Fix scene spacing mode (phase 1)
The scene spacing code was failing to
check if a raycast failed, which can happen
when sculpting the edges of objects in negative
mode.

Note I removed what I suspect was a hack put
in to fix this, spacing was clamped
to 0.001 scene units.

Scene spacing mode is actually quite broken,
so it will be fixed in a series of phases.
2022-07-26 14:25:26 +02:00
81bc8db92d Audaspace: minor formatting fix for last commit. 2022-07-26 14:25:26 +02:00
Colin Basnett
9d5cce0c5e Fix T99039: bpy.ops.sound.mixdown returns indecipherable error
Fix for {T99039}.

The problem was that `AUD_mixdown` and `AUD_mixdown_per_channel` were returning pointers to freed memory.

Two key changes are made:
1. The return value of those functions now simply return a bool as to whether the operation succeeded, instead of an optional error string pointer.
2. The error string buffer is now passed into the function to be filled in case an error occurs. In this way, the onus of memory ownership is unamibiguously on the caller.

Differential Revision: https://developer.blender.org/D15260
2022-07-26 14:25:26 +02:00
06a2d75dd5 PyAPI: re-enable the "bgl" module for headless builds
Instead of removing the `bgl` module, set all it's functions to stubs
so importing `bgl` or any of it's members doesn't raise an error.

This avoids problems for scripts that import bgl but don't call it's
functions when running in background mode.
2022-07-26 14:25:26 +02:00
0f3c2ac25b Cleanup: early exit MEM_lockfree_freeN when called with NULL pointer
Simplify logic for freeing a NULL pointer. While no null-pointer
de-reference was performed, this wasn't as so obvious as the pointer
was passed to MEM_lockfree_allocN_len before checking for NULL.

NOTE: T99744 claimed the a NULL pointer free was a vulnerability,
while I can't see evidence for this - exiting early makes it clearer
the memory isn't accessed.

*Details*

- Add MEMHEAD_LEN macro, avoids redundant NULL check.
- Use "UNLIKELY(..)" hint's for error cases
  (freeing NULL pointer and checking if `leak_detector_has_run`).
2022-07-26 14:25:26 +02:00
3c893ae305 Fix T99744: NULL pointer free with corrupt zSTD reading 2022-07-26 14:25:26 +02:00
a77b78af82 Fix error in assertion after 92a99c1496 2022-07-26 14:25:26 +02:00
7beb554680 Fix workbench background render broken after recent changes from D15463
For Eevee the light baking can initialize OpenGL earlier, but for workbench we
can't assume the backend exists here already.
2022-07-26 14:25:26 +02:00
bc2966618b Fix Eevee backround render crash after recent changes from D15463
Backend initialization needs to be delayed until after the OpenGL context
is created. This worked fine in foreground mode because the OpenGL context
already exists for the window at the point GPU_backend_init_once was called,
but not for background mode.

Create the backend just in time in GPU_context_create as before, and
automatically free it when the last context id discarded. But check if any
GPU backend is supported before creating the OpenGL context.

Ref D15463, D15465
2022-07-26 14:25:26 +02:00
8b9efcd310 Cycles: refactor rays to have start and end distance, fix precision issues
For transparency, volume and light intersection rays, adjust these distances
rather than the ray start position. This way we increment the start distance
by the smallest possible float increment to avoid self intersections, and be
sure it works as the distance compared to be will be exactly the same as
before, due to the ray start position and direction remaining the same.

Fix T98764, T96537, hair ray tracing precision issues.

Differential Revision: https://developer.blender.org/D15455
2022-07-26 14:25:26 +02:00
fac156df7e Fix Cycles MetalRT error after recent specialization changes 2022-07-26 14:25:26 +02:00
145a477fa0 Cleanup: compiler warnings 2022-07-26 14:25:26 +02:00
b28c772c6f Fix compiler error in debug builds after 1cf465bbc3 2022-07-26 14:25:26 +02:00
b72b6bbe8a Fix GPU backend deleting resources without an active context
This causes an assert with libepoxy, but was wrong already regardless.

Refactor logic to work as follows:
* GPU_exit() deletes backend resources
* Destroy UI GPU resources with the context active
* Call GPU_backend_exit() after deleting the context

Ref D15291

Differential Revision: https://developer.blender.org/D15465
2022-07-26 14:25:26 +02:00
3512faf70c Fix overly noisy surface deform warning message
An increased number of vertices is not a stopper for the surface
deform modifier anymore. It might still be useful to expose the
message in the UI, but printing error message to the console on
every modifier evaluation makes real errors to become almost
invisible.

Differential Revision: https://developer.blender.org/D15468
2022-07-26 14:25:26 +02:00
885a9807cd Cleanup: VSE waveform drawing
No functional changes.
2022-07-26 14:25:26 +02:00
b02d547722 Cleanup: compiler warning 2022-07-26 14:25:26 +02:00
105668b621 Fix T99706: Crash rendering with headless builds
When rendering with headless builds, show an error instead of crashing.

Previously GPU_backend_init was called indirectly from
DRW_opengl_context_create, a new function is now called from the window
manager (GPU_backend_init_once), so it's possible to check if the GPU
has a back-end.

This also disables the `bgl` Python module when building WITH_HEADLESS.

Reviewed By: fclem

Ref D15463
2022-07-26 14:25:26 +02:00
Damien Picard
d07c6f7527 UI: make many modifier strings translatable
This includes:
- new modifier names

It mostly uses `N_` because the strings are actually translated elsewhere.
The goal is simply to export them to .po files.

Most of the new translations were reported in T43295#1105335.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15418
2022-07-26 14:25:26 +02:00
25a7dcd74c Fix (unreported) LibOverride: invalid behaviors when creating (partial) overrides.
The outliner would tagg all existing local IDs (for remap from linked
reference data to newly created overrides) when creating a new override.
This would become critical issue in case there is several existing
copies of the same override hierarchy (leading to several hierarchies
using the same override).

Further more, BKE override creation code would not systematically
properly remapp linked usages to new overrides one whithin the affected
override hierarchy, leading to potential undesired remaining usages of
linked data.
2022-07-26 14:25:26 +02:00
8f1ce25793 Cycles: generalize shader sorting / locality heuristic to all GPU devices
This was added for Metal, but also gives good results with CUDA and OptiX.
Also enable it for future Apple GPUs instead of only M1 and M2, since this has
been shown to help across multiple GPUs so the better bet seems to enable
rather than disable it.

Also moves some of the logic outside of the Metal device code, and always
enables the code in the kernel since other devices don't do dynamic compile.

Time per sample with OptiX + RTX A6000:
                                         new                  old
barbershop_interior                      0.0730s              0.0727s
bmw27                                    0.0047s              0.0053s
classroom                                0.0428s              0.0464s
fishy_cat                                0.0102s              0.0108s
junkshop                                 0.0366s              0.0395s
koro                                     0.0567s              0.0578s
monster                                  0.0206s              0.0223s
pabellon                                 0.0158s              0.0174s
sponza                                   0.0088s              0.0100s
spring                                   0.1267s              0.1280s
victor                                   0.0524s              0.0531s
wdas_cloud                               0.0817s              0.0816s

Ref D15331, T87836
2022-07-26 14:25:26 +02:00
b4f602628d Cycles: Apple Silicon optimization to specialize intersection kernels
The Metal backend now compiles and caches a second set of kernels which are
optimized for scene contents, enabled for Apple Silicon.

The implementation supports doing this both for intersection and shading
kernels. However this is currently only enabled for intersection kernels that
are quick to compile, and already give a good speedup. Enabling this for
shading kernels would be faster still, however this also causes a long wait
times and would need a good user interface to control this.

M1 Max samples per minute (macOS 13.0):

                    PSO_GENERIC  PSO_SPECIALIZED_INTERSECT  PSO_SPECIALIZED_SHADE

barbershop_interior       83.4	            89.5                   93.7
bmw27                   1486.1	          1671.0                 1825.8
classroom                175.2	           196.8                  206.3
fishy_cat                674.2	           704.3                  719.3
junkshop                 205.4	           212.0                  257.7
koro                     310.1	           336.1                  342.8
monster                  376.7	           418.6                  424.1
pabellon                 273.5	           325.4                  339.8
sponza                   830.6	           929.6                 1142.4
victor                    86.7              96.4                   96.3
wdas_cloud               111.8	           112.7                  183.1

Code contributed by Jason Fielder, Morteza Mostajabodaveh and Michael Jones

Differential Revision: https://developer.blender.org/D14645
2022-07-26 14:25:26 +02:00
ed604701ed Cycles: keep track of SVM nodes used in kernels
To be used for specialization in Metal, to automatically leave out unused nodes
from the kernel.

Ref D14645
2022-07-26 14:25:26 +02:00
5a26d08ed9 Cycles: refactor to move part of KernelData definition to template header
To be used for specialization on Metal in a following commit, turning these
members into compile time constants.

Ref D14645
2022-07-26 14:25:26 +02:00
Damien Picard
345664d3ff Render: camera depth of field support for armature bone targets
This is useful when using an armature as a camera rig, to avoid creating and
targetting an empty object.

Differential Revision: https://developer.blender.org/D7012
2022-07-26 14:25:26 +02:00
8128557352 Render: improve render border operator in image editor
* Snap border to pixels just outside the drawn border, to more easily select
  specific pixels by drawing a border inside them.
* Support cropped border renders.
2022-07-26 14:25:26 +02:00
7399e8b8c6 Cleanup: add utlity function to compute render resolution
Instead of duplicating logic many times.
2022-07-26 14:25:26 +02:00
24525f8b89 Cleanup: make format 2022-07-26 14:25:26 +02:00
8636939dbd Fix T98061: uv resize with individual origins could break constrain to bounds
Fix unreported: Resize with Constrain To Bounds will now limit one shared scale
value for both U and V instead of calculating separate scale values for each.

To fix T98061, the individual origins (transdata->center) is now used when
that mode is active.

See also: 0e9367fc29

Differential Revision: https://developer.blender.org/D15420
2022-07-26 14:25:26 +02:00
7424e67b93 I18n: Add suport for labels from modifiers' subpanels.
Was a bit oif a struggle since those functions take a first string which
is not our label, but should work fine now.

Reported/detected as part of D15418.
2022-07-26 14:25:26 +02:00
Martijn Versteegh
535aac1295 Fix: Move DRW_shgroup_add_material_resources(grp, mat) to after the null-check for grp.
Reviewed By: fclem

Maniphest Tasks: T99646

Differential Revision: https://developer.blender.org/D15436
2022-07-26 14:25:26 +02:00
3ed88282a8 Fix T99606: Regression: TexCoordinate losing precision far away from origin
Same root cause as T99128. The fix also needed to be done in another place.
2022-07-26 14:25:26 +02:00
e58d9fe34c GPU: Fix shader builder on hardware that does not have all features 2022-07-26 14:25:25 +02:00
1605aad2c1 Cleanup: GPU: Replace NULL by nullptr from C++ files 2022-07-26 14:25:25 +02:00
e315428b86 Fix an increasing bottleneck when key press operator is too slow
The goal of this change is to fix an increasing bottleneck of the event
queue handling when there is an operator bound to a key press event and
is taking longer to finish than a key-repeat speed on the system.

Practical example of when it happens is the marker tracking operator in
a single-frame track mode. Quite often artists will hold down Alt-arrow
to track a segment of footage which seems trivial to track. The issue
arises when the Alt-arrow is released: prior to this change it is was
possible that more frames will be tracked. It also seems that redraws
are less smooth.

It is a bit hard to make easily shareable computer-independent test
case. Instead, a synthetic case can be reproduced by adding a 50 ms
sleep in the `text_move_exec()`. In such synthetic case open a long
text in the text editor and hold left/right arrow button to navigate
the cursor. The observed behavior is that seemingly redraws happen
less and less often and cursor travels longer and longer distances
between redraws. The cursor will also keep moving after the buttons
has been released.

The proposed solution is to ignore sequential key-press events from
being added to the event queue. This seems to be the least intrusive
and the most safe approach:

- If the operator is fast enough there will be no multiple press events
  in the queue in both prior and after of this change.

- If the operator is slow enough, clicking the button multiple times
  (i.e. clicking arrow button 3 times in a heavy shot will change the
  scene frame by exactly 3 frames because no events are ignored in
  this case).

- Only do it for key press events, keeping mouse and tabled behavior
  unchanged which is crucial for the paint mode.

Note that this is a bit different from the key repeat tracking and
filtering which is already implemented for keymaps as here we only want
to avoid the event queue build-up and do want to ignore all repeat
events. In other words: we do want to handle as many key presses as the
operator performance allows it without clogging anything.

A possible extension to this change could be a key press counter, so
that instead of ignoring the event we merge it into the last event in
the queue, incrementing some counter. This way if some operator really
needs to know exact number of key repeats it can still access it.

Differential Revision: https://developer.blender.org/D15444
2022-07-26 14:25:25 +02:00
b6f7a113b8 GPU: Remove USD dependency from shader_builder.
Dependency was added as shader builder depended to blenkernel as an
umbrella, in stead of adding the actual dependencies it required.
2022-07-26 14:25:25 +02:00
0b289f609f BLI_bitmap: fix _BITMAP_NUM_BLOCKS to not over-count by one block
For bit counts that were exact multiple of block size, the macro was
computing one block too much.

Reviewed By: Campbell Barton, Bastien Montagne
Differential Revision: https://developer.blender.org/D15454
2022-07-26 14:25:25 +02:00
a8f47bf4cb BLI_bitmap: ability to declare by-value, and function to find lowest unset bit
In preparation for a larger change (D14162), some BLI_bitmap
functionality that could be submitted separately:

- Ability to declare a fixed size bitmap by-value, without extra
  memory allocation: BLI_BITMAP_DECLARE
- Function to find the index of lowest unset bit:
  BLI_bitmap_find_first_unset
- Test coverage of the above.

Reviewed By: Campbell Barton, Bastien Montagne
Differential Revision: https://developer.blender.org/D15454
2022-07-26 14:25:25 +02:00
df243e56b5 GHOST/Wayland: partial support for updating the UI scale
Partial support for changing the UI scale while Blender is open.

The scale is set but issues with the window size not updating remain.
2022-07-26 14:25:25 +02:00
08593dc378 GHOST/Wayland: fix error setting the cursor scale
Calculate a scale that's compatible with the cursor size.
Needed so the cursor is always a multiple of scale.
2022-07-26 14:25:25 +02:00
d85d9fb50f blend_render_info: add check for negative BHead length (corrupt file)
Without this check, corrupt files would raise a Python exception,
now early exit with a useful error.
2022-07-26 14:25:25 +02:00
786d951091 Fix T99711: Eternal loop reading blend file thumbnail
Account for negative BHead length (already handled by blend file loading).
2022-07-26 14:25:25 +02:00
9317e8c352 Cleanup: Use const pointers for ImageSaveOptions and ImageFormatData
Use const pointers to ImageSaveOptions and ImageFormatData for API
parameters where appropriate.

Differential Revision: https://developer.blender.org/D15400
2022-07-26 14:25:25 +02:00
182a70e950 Fix T79304: improve uv island calculation when in edge selection mode
Differential Revision: https://developer.blender.org/D15419
2022-07-26 14:25:25 +02:00
32af6c3d3b Cleanup: separate clipUVTransform into two different functions
No functional changes.

Prep for D15420 / T98061.
2022-07-26 14:25:25 +02:00
01c0d29d5e Fix T99705: fix integer overflow in thumbnail extractor
It was smart enough to check if the buffer had the right
size but neglected to cast to a 64 bit value so it
overflowed.

Differential Revision: https://developer.blender.org/D15457
Reviewed By: brecht
2022-07-26 14:25:25 +02:00
f6e8ef7904 Modifiers: fix mesh to volume modifier on non-volume objects 2022-07-26 14:25:25 +02:00
dbd69e9a1a Fix on_drag_start handler not getting ID when dragging from Outliner
We would first invoke the dragging, and then set the drag data (like the
ID or the dragged modifier), so the `wmDropBox.on_drag_start()` handler
wouldn't be able to access this. This broke dragging some IDs from the
Outliner, noticed in D15333.

It's now possible to first create/request drag data, extend it, and then
invoke the actual dragging. The normal function to start dragging
returns `void` now instead of `wmDrag *`, so the drag data can't easily
be modified after starting anymore.
2022-07-26 14:25:25 +02:00
56dc2db032 UI: Tweak layout of File Browser Preferences
* Don't nest "Show Recent Locations" and "Show System Locations" under a
  "Defaults" heading. They are not just a default setting but completely
  hide panels from the UI.
* Use own "Show Locations" heading instead, and remove redundant words
  from labels.
* Move the options to the top of the panel, they are more general since
  they can't be toggled in a File Browser session, and thus have bigger
  impact.

We may want to remove these options in a future major release, I don't
think they are useful.

Agreed on with Pablo Vazquez.
2022-07-26 14:25:25 +02:00
b9c0fd78c1 I18n: Fix regex for messages from BKE_modifier_set_error.
Signature of this function changed at some point, regex to extract
messages from it was no longer working.

Reported/detected as part of D15418.
2022-07-26 14:25:25 +02:00
1e5ea2a74a Fix T99702: Gpencil Flip strokes did not support multiframe edit
This was a missing feature and this commit solves this.
2022-07-26 14:25:25 +02:00
Olivier Maury
dc7098721b Fix Cycles MNEE wrong results with area light spread
When the solve is successful, the light sample needs to be updated since the
effective shading point is now on the last refractive interface. Spread was
not taken into account, creating false caustics.

Differential Revision: https://developer.blender.org/D15449
2022-07-26 14:25:25 +02:00
79483087f7 Cleanup: replace state flow macros in the kernel with functions 2022-07-26 14:25:25 +02:00
788a433aa7 Cycles: add presets to the Performance panel
With choices Default, Lower Memory and Faster Render. For convenience, and
to help communicate what the various settings do.

Differential Revision: https://developer.blender.org/D15446
2022-07-26 14:25:25 +02:00
a79ab640b9 Improve Tool tip for Add-on search
Differential Revision: https://developer.blender.org/D15411
2022-07-26 14:25:25 +02:00
e11ffe21c3 Cycles: Improve cache usage on Apple GPUs by chunking active indices
This patch partitions the active indices into chunks prior to sorting by material in order to tradeoff some material coherence for better locality. On Apple Silicon GPUs (particularly higher end M1-family GPUs), we observe overall render time speedups of up to 15%. The partitioning is implemented by repeating the range of `shader_sort_key` for each partition, and encoding a "locator" key which distributes the indices into sorted chunks.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15331
2022-07-26 14:25:25 +02:00
ab70bc675f Cleanup: minor changes to camera frame fitting
Use const vars & make order of min/max checks consistent.
2022-07-26 14:25:25 +02:00
940294e04f Cleanup: spelling in comments
Also remove duplicate comments in bmesh_log.h, caused by automated
comment relocation in [0].

[0]: c4e041da23
2022-07-26 14:25:25 +02:00
55297afe29 Cleanup: remove redundant event->val check for 3D text insertion 2022-07-26 14:25:25 +02:00
61fa89c866 Cleanup: clang-tidy changes to GHOST_SystemX11
Also remove redundant check.
2022-07-26 14:25:25 +02:00
a626e277ab GHOST: remove redundant ascii argument to GHOST_EventKey
Now only the utf8 buffer is used there is no reason to pass both.
2022-07-26 14:25:25 +02:00
f6f1919b95 Fix: Wrong output types for some compositor nodes
The Difference Matte and RGB To BW nodes have a wrong output type. They
should be floats but are of type color.

This is a regression that was introduced during the migration to the
socket builder API in D13266.

Reviewed By: Blendify, fclem

Differential Revision: https://developer.blender.org/D15232
2022-07-26 14:25:25 +02:00
76287d73c9 GHOST/X11: avoid redundant utf8 text lookups for release events
The text representation of release events is never used,
so only calculate this for press events.
2022-07-26 14:25:25 +02:00
3d391dd618 GHOST/X11: Quiet warning about key-release events having their utf8 set
Quiet warning from [0], no functional change as the this information
was always ignored.

Key release events shouldn't have associated text, this was cleared
for wmEvent's, so there is no reason to pass it from GHOST.

[0]: d6fef73ef1
2022-07-26 14:25:25 +02:00
7607a37134 Cleanup: format, unused argument 2022-07-26 14:25:25 +02:00
ead7dc299a IDManagement: add more ID naming tests
As part of a larger change (https://developer.blender.org/D14162),
adding more test coverage for existing functionality separately.

New tests:
- ids_sorted_by_default
- ids_sorted_by_default_with_libraries
- name_too_long_handling
- create_equivalent_numeric_suffixes
- zero_suffix_is_never_assigned
- remove_after_dup_get_original_name
- name_number_suffix_assignment
- renames_with_duplicates
- names_are_unique_per_id_type
2022-07-26 14:25:25 +02:00
cf0123a4d9 Fix curve drawing crash after changing geometry nodes output.
Using geometry nodes with attributes on a curve object and changing the
output is crashing. This is because the `render_mutex` in the curve
drawing cache is cleared after changes in `curves_batch_cache_init` and
set to null. The cache isn't actually needed currently because all draw
updates are single-threaded, but the new `drw_attributes_merge` function
still tries to access it (this seems to be tolerated on Linux platforms
but crashes on Windows).

Make sure the render_mutex is always initialized after (re-)initializing
the cache.
2022-07-26 14:25:25 +02:00
94f536351e Correct error with IME from d6fef73ef1 2022-07-26 14:25:25 +02:00
db69425ebc Geometry Nodes: update curve type counts after realizing instances
The type counts have to be updated eagerly. This was missing from
the realize-instances code before, leading to bugs further down
the line.
2022-07-26 14:25:25 +02:00
340dcab291 BLI: fix finding indices from virtual array
The sorting of index vectors assumed that all vectors have
at least one element. Now this is checked for more explicitely.
2022-07-26 14:25:25 +02:00
4822e652e5 Geometry Nodes: fix face corner to edge boolean interpolation
This is a follow up for rB44e530e1b107fd0d91f472f9a58642ab59fd5422
which did not fix the function that interpolates boolean attributes.
2022-07-26 14:25:25 +02:00
fcfc1fc9dc Geometry Nodes: fix face corner to edge attribute interpolation
Looks like this was wrong all the time.. Luckily, this conversion
is not very common.

Found when testing D15274.
2022-07-26 14:25:24 +02:00
Damien Picard
d5d32d0302 UI: translate tooltips coming from menu descriptions
Many menus get their labels exported to the .po file, but then are not actually translated in the UI.

Before:
{F13283752}

After:
{F13283750}

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15417
2022-07-26 14:25:24 +02:00
Colin Basnett
d2c3e28142 Cleanup: Rename & refactor several F-curve functions
Rename and refactor several F-curve key manipulation functions, and move
them from `editors` to `blenkernel`.

The functions formerly known as `delete_fcurve_key`,
`delete_fcurve_keys`, and `clear_fcurve_keys` have been moved from
`ED_keyframes_edit.h` to `BKE_fcurve.h` and have been renamed according
to hierarchical naming rules.

Below is a table of the naming changes.

| From | To |
| -- | -- |
| `delete_fcurve_key(fcu, index, do_recalc)` | `BKE_fcurve_delete_key(fcu, index)` |
| `delete_fcurve_keys(fcu)` | `BKE_fcurve_delete_keys_selected(fcu)` |
| `clear_fcurve_keys(fcu)` | `BKE_fcurve_delete_keys_all(fcu)` |
| `calchandles_fcurve()` | `BKE_fcurve_handles_recalc()` |
| `calchandles_fcurve_ex()`| `BKE_fcurve_handles_recalc_ex()` |

The function formerly known as `delete_fcurve_key` no longer takes a
`do_fast` parameter, which determined whether or not to call
`calchandles_fcurve`. Now, the responsibility is on the caller to run
the new `BKE_fcurve_handles_recalc` function if they have want to
recalculate the handles.

In addition, there is now a new static private function called
`fcurve_bezt_free` which sets the key count to zero and frees the key
array. This function is now used in couple of instances of functionally
equivalent code. Note that `BKE_fcurve_delete_keys_all` is just a
wrapper around `fcurve_bezt_free`.

This change was initially spurred by the fact that `delete_fcurve_keys`
was improperly named; this was a good opportunity to fix the location
and naming of a few of these functions.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D15282
2022-07-26 14:25:24 +02:00
Iliay Katueshenock
e618adcd68 Fix T99239: weird behavior in Field on Domain node 2022-07-26 14:25:24 +02:00
Damien Picard
87da7cee18 UI: translate quick favorites menu operator names
Some operator titles were not translated in the quick favorites menu.

Before:
{F13283724}

After:
{F13283725}

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15416
2022-07-26 14:25:24 +02:00
Damien Picard
0f517a79f0 I18N: Allow translating newly added GP data names, and a missing Surface one. 2022-07-26 14:25:24 +02:00
b5f4b5fa40 Fix T99677: crash when convex hull node is used on empty mesh
Fundamental issue is that the attribute api returns none, because
the custom data api returns null for a layer when the size of 0.
This should be improved separately.
2022-07-26 14:25:24 +02:00
8da6caaf53 Cleanup: simplify 3D text insert, remove checks for ascii escape codes
3D text included checks for escape codes such as \n\r\b which have not
been included in wmEvent.ascii since [0] (2009).

Remove these and use more straightforward logic for overriding the
events text input.

[0] 66437a62a7
2022-07-26 14:25:24 +02:00
d88997c7b6 Cleanup: update & correct comments for event handling
- Remove references to `ISTEXTINPUT` as any keyboard event with it's
  utf8_buf set can be handled as text input.

- Update references to the key repeat flag.
2022-07-26 14:25:24 +02:00
af6731b887 WM: Remove ASCII members from wmEvent & GHOST_TEventKeyData
The `ascii` member was only kept for historic reason as some platforms
didn't support utf8 when it was first introduced.

Remove the `ascii` struct members since many checks used this as a
fall-back for utf8_buf not being set which isn't needed.
There are a few cases where it's convenient to access the ASCII value
of an event (or nil) so a function has been added to do that.

*Details*

- WM_event_utf8_to_ascii() has been added for the few cases an events
  ASCII value needs to be accessed, this just avoids having to do
  multi-byte character checks in-line.

- RNA Event.ascii remains, using utf8_buf[0] for single byte characters.

- GHOST_TEventKeyData.ascii has been removed.

- To avoid regressions non-ASCII Latin1 characters from GHOST are
  converted into multi-byte UTF8, when building X11 without
  XInput & X_HAVE_UTF8_STRING it seems like could still occur.
2022-07-26 14:25:24 +02:00
be2cfc98af GHOST/SDL: pass in utf8 buffer for keyboard events
While GHOST/SDL doesn't support non-ASCII text input,
use the UTF8 buffer to be consistent with all other back-ends.

Move the conversion from SDL_KeyboardEvent to ASCII into a function.

Also only lookup this value on key press (not release).
2022-07-26 14:25:24 +02:00
3a2e03f06a Fix build and warnings from previous commit. 2022-07-26 14:25:24 +02:00
6fbc97d6b1 Fix T99684: Upgrade Averages Island Scale with options Scale UV and Shear
Differential Revision: https://developer.blender.org/D15421
2022-07-26 14:25:24 +02:00
945da59299 GHOST/SDL: add support for the key repeat flag
Now all ghost back-ends support the key repeat flag
(accessed as WM_EVENT_IS_REPEAT from wmEvent.flag).
2022-07-26 14:25:24 +02:00
668660b183 Docs: Fix out of order parameters
Fixes T99672
2022-07-26 14:25:24 +02:00
9c0217d0ef Cleanup: Do not use spaces in default data names.
Using white spaces in data names should not be encouraged in general,
better not give wrong example here.

Originally part of D15441.
2022-07-26 14:25:24 +02:00
7969e94691 Fix (studio-reported) bad remapping of libraries.
New remapper code would also fail in some cases when remapping
libraries, similar to the issue yesterday, because ID_LI type had no
mask value.

That would fail to remap `parent` member of a library to NULL when
deleting that parent, leading to a crash e.g. in Outliner tree building
code.

Reported by @JulienKaspar from Blender studio.
2022-07-26 14:25:24 +02:00
26ec4990eb Documentation: Update Docs for Gizmo
This patch updates the documentation for arguments regarding the `Gizmo`
type.

- Corrected `select_id` doc for draw_preset_ functions. `-1` indicates
  that no selection ID is to be written, but previous docs incorrectly
  specified `0` instead.
- Added missing doc for `target` argument for `target_set_handler`
  function.

Reviewed by: Aaron Carlisle (Blendify)

Differential Revision: https://developer.blender.org/D14834
2022-07-26 14:25:24 +02:00
124a6d5bce Expose option for fallback tools keymap in GizmoGroup type
This patch allows new GizmoGroup classes to support tool fallback keymap.

With this patch, when new gizmo groups add `'TOOL_FALLBACK_KEYMAP'` to
its `bl_options`, the fallback tools are added to the group. This
allows a `WorkSpaceTool` (for example) to have selection be a fallback
tool if the user LeftMouse drags away from other gizmos in the group.

Reviewed by: Campbell Barton (campbellbarton)

Differential Revision: https://developer.blender.org/D15154
2022-07-26 14:25:24 +02:00
66b0952915 Expose snap options in transform operators
This commit exposes snap options in transform operators. These options
are needed for Python tools to control snapping without requiring the
tool settings to be adjusted.

The newly exposed options are:

- `snap_elements` for choosing which element(s) of target the source
  geometry should snap to (ex: Face Raycast).
- `use_snap_self`, `use_snap_edit`, `use_snap_nonedit`,
  `use_snap_selectable_only` for controlling target selection.
- `use_snap_project` for controlling Face Raycast snapping.
- `use_snap_to_same_target` and `snap_face_nearest_steps` for
  controlling Face Nearest snapping.

Reviewed by: Campbell Barton (campbellbarton)

Differential Revision: https://developer.blender.org/D15398
2022-07-26 14:25:24 +02:00
82289245e7 Fix T99654: Applying Mirror modifier breaks the erase tool
The problem was the new generated strokes were copied from original and the location was offset to mirror, but the internal geometry data was not updated and the collision check done by brushes was not working.

Now, the internal geometry data is recalculated when the modifier is applied.
2022-07-26 14:25:24 +02:00
d1cc827e83 Fix (studio-reported) issue in remapping code.
Not clearing runtime remapping data for the new ID as well as the old
one can lead to false stale data there, wichi could e.g. make indirectly
linked data be tagged as directly linked.

This would generate an error report on file write when hapening on
ShapeKey ID, since that type is not allowed to be directly linked.
2022-07-26 14:25:24 +02:00
0963364bb0 Cleanup: logical order of axis defines, assign variables for readability 2022-07-26 14:25:24 +02:00
870fc16171 Cleanup: use defines for camera axes for view frame fitting
The values used for axes weren't in any meaningful order, use defines
to improve readability.
2022-07-26 14:25:24 +02:00
02dc79ed14 Fix T99653: "Align Active Camera to Selected" fails with ortho camera
There were two bugs, a regression in [0] and the object-data wasn't
tagged for depsgraph updating.

[0]: 19df0e3cfd
2022-07-26 14:25:24 +02:00
805f2ac16e Fix T99659: Improve UV Island calculation with hidden faces.
Simplify interface, regularize implementation and some light cleanup.

See also: T79304 and D15419.
2022-07-26 14:25:24 +02:00
d9dd1155eb Fix: set dangling pointer to null
The data has been moved somewhere else, the span should not
keep a pointer to it.
2022-07-26 14:25:24 +02:00
a19c54f22e Cycles: Make not-compact BVH the default for embree
Measurements shown on average a 1.08x speedup for a 1.04x increase in
memory usage which is an acceptable trade off for a default setting,
although discoverability of such settings influencing memory usage could
be improved.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15429
2022-07-26 14:25:24 +02:00
11c9569274 Enable "copy to selected" for new Curves modifiers
The operator bpy.ops.object.modifier_copy_to_selected()
does not work for the new Curves objects.
This is because it isn't added to BKE_object_supports_modifiers.

Differential Revision: https://developer.blender.org/D15439
2022-07-26 14:25:24 +02:00
66ef9c50cc Curves: improve error checking in deform curves on surface node 2022-07-26 14:25:24 +02:00
caa4130d07 Fix: wrong node name in menu 2022-07-26 14:25:24 +02:00
36c2c0a239 Fix: Memory leaks in indexer code
Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D15376
2022-07-26 14:25:24 +02:00
Khoi Dau
d5905a617c Fix T99103: crash when displaying or rendering Grease Pencil object
On some hardware/systems, blender may crash when adding, rendering or displaying Grease Pencil objects.

In `/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl`, line 35:
```
gpMaterialFlag gp_flag = floatBitsToInt(gp_mat._flag);
```
`gpMaterialFlag` is of type `uint`. This is a mismatched-type assignment that can cause crashes on some hardware/systems with GLSL that do not support implicit type casting.

So use `floatBitsToUint` for type conversion.

Differential Revision: https://developer.blender.org/D15433
2022-07-26 14:25:23 +02:00
9f886a5ccf Fix: missing geometry copy before modifying it
A geometry component may reference read-only geometry.
In this case it has to be copied before making changes to it.

This was caused by rBb876ce2a4a4638142.
2022-07-26 14:25:23 +02:00
856156bded Cycles: fix and enable JIT oneAPI CentOS7 builds for drivers 23570+
The current specific CentOS7 workaround we have for AoT, which is to
disable __FAST_MATH__ by using -fhonor-nans, now also fixes the
compilation issue for JIT as well since at least driver 23570.
2022-07-26 14:25:23 +02:00
336a4c636b LibOverride: Fix some issues from.revealed by recent previous commit.
rB57097e9a8515 did not properly consider case where you have more than
one override for a same reference linked ID.

Also adds more security checks around shapekeys, since match between
override and its linked reference is never ensured either way (fixes a
crash reported by @Rik from Blender studio).
2022-07-26 14:25:23 +02:00
cee47bb06b Cleanup: Use interpf instead of repeating the logic
This makes the code clearer.
2022-07-26 14:25:23 +02:00
a95b9e7e6a Fix T96238: shrinking to zero doesn't actually scales the radius to zero
Probably to prevent the radius of a point from being stuck at zero,
the `Shrink/Fatten` curve operator sets a minimum value of `0.001`
for all points being transformed.

This is an inconvenience as these points may have been purposely set
to zero on the panel.

And it also doesn't follow the convention seen in other operators
(which keep the value zero).

So remove this limitation.
2022-07-26 14:25:23 +02:00
94dcbd061d Fix T99261: partial LibOverride creation would not properly remap all needed data.
When creating partial overrides, there may also be need to reamap usage
of linked data towards already existing overrides, in newly created
overrides.
2022-07-26 14:25:23 +02:00
RedMser
e8769d1fe9 Markers: Make delete confirmation depend on key used
Add a 'Delete Confirmation' operator property to the 'Delete Marker'
operator. This determines whether the user is asked to confirm the
deletion or not.

Defaults so that only {key X} ({key Backspace} for industry compatible
keymap) prompts for deletion, whereas {key Del} does not show the
confirmation popup.

This also makes the default keymap for marker deletion consistent with
the common delete operators (such as objects and keyframes).

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D13818
2022-07-26 14:25:23 +02:00
b72059ceb3 UV: Box and lasso selection for partially intersecting edges
In UV edge mode, box and lasso selections allow edge selections only
when the entire edge is contained within the selection area. This
doesn't consider any edges that partially overlap with the selection
area.

This is  now fixed by adding a second pass, similar to how these
operators work for edit-mesh selections. Now if both operators are
unable to find any edges contained within the selection area, then
they will perform a second pass which checks for edges that partially
intersect with the selection area.

Now edge selection in the UV editor matches edit-mesh edge-selection
when drawing wire-frame.

Resolves T99443.

Ref D15362
2022-07-26 14:25:23 +02:00
fa6f48c556 Fix: Incorrect coordinates used in BLI_rct*_isect_segment functions
Ref D15330.
2022-07-26 14:25:23 +02:00
cbb6a36380 Fix threading crash due to conflict in mesh wrapper type
A mesh wrapper might be being accessed for read-only from one thread
while another thread converts the wrapper type to something else.

The proposes solution is to defer assignment of the mesh wrapper
type until the wrapper is fully converted. The good thing about this
approach is that it does not introduce extra synchronization (and,
potentially, evaluation pipeline stalls). The downside is that it
might not work with all possible wrapper types in the future. If a
wrapper type which does not clear data separation is ever added in
the future we will re-consider the threading safety then.

Unfortunately, some changes outside of the mesh wrapper file are
to be made to allow "incremental" construction of the mesh prior
changing its wrapper type.

Unfortunately, there is no simplified file which demonstrates the
issue. It was investigated using Heist production file checked at
the revision 1228: `pro/lib/char/einar/einar.shading.blend`. The
repro case is simple: tab into edit mode, possibly few times.

The gist is that there several surface deform and shrinkwrap
modifiers which uses the same target. While one of them is building
BVH tree (which changes wrapper type) the other one accesses it for
read-only via `BKE_mesh_wrapper_vert_coords_copy_with_mat4()`.

Differential Revision: https://developer.blender.org/D15424
2022-07-26 14:25:23 +02:00
8b5983698b Fix: crash when iterating over all attributes 2022-07-26 14:25:23 +02:00
1a5d46bb85 Cleanup: use array for internal _bpy methods 2022-07-26 14:25:23 +02:00
1d9ae10d0b Tests: add test to ensure restricted py-driver execution is working
Add internal function (only used for testing at the moment)
`_bpy._driver_secure_code_test`.

Add test `script_pyapi_bpy_driver_secure_eval` to serves two purposes:

- Ensure expressions that should be insecure remain so when upgrading
  Python or making any changes in this area.

- Ensure new versions of Python don't introduce new byte-codes that
  prevent existing expressions from being executed
  (happened when upgrading from 3.7, see [0]).

[0]: dfa5201763
2022-07-26 14:25:23 +02:00
7011cacdf5 Python: add opcodes for safe py-drivers
The following opcodes have been added, see [0] for details:

- LIST_TO_TUPLE: convert a list to a tuple,
  use for constructing lists/tuples in some cases.

- LIST_EXTEND: use for constructing lists with unpacking.

- SET_UPDATE: use for constructing sets with unpacking.

- CONTAINS_OP: check if `a in b` generally useful.

When writing tests these op-codes where needed for basic operations
and can be safely supported.

Add note why dictionary manipulation op-codes have been left out.

Also restrict namsepace access to anything with an underscore prefix
since these may be undocumented.

[0]: https://docs.python.org/3.10/library/dis.html
2022-07-26 14:25:23 +02:00
6ab6271c1d Fix (studio-reported) crash in ID remapping code on rare cases.
Some ID types did not have a filter value, even though they would be
used in remapping code, leading to missing remappings. In that specific
case, shape keys would actually never be properly remapped.

Reproducible in r1230 of
`Heist/pro/animation_test/einar/einar_new_expression_shapes2.blend`,
2022-07-26 14:25:23 +02:00
5c3abb49eb Fix (unreported) crash in liboverride code on rare cases.
When dealing with 'embedded' IDs (and the like, e.g. shape keys),
liboverride code could fail in case the reference linked data (e.g. a
mesh) would not have a shapekey anymore, while the override mesh would
still have one.

Found while investigating another issue in Heist production file
`Heist/pro/animation_test/einar/einar_new_expression_shapes2.blend`,
r1230.
2022-07-26 14:25:23 +02:00
dc764fe346 GPU: add BUIDTIME to WITH_GPU_SHADER_BUILDER
Adds a better name that describes when it is used.
The GPU_SHADER_BUILDER is a buildtime tool for developers
to pre-validate GLSL (and in the overseen future pre-compile to
SpirV). We don't see that this needs to become a required
step in the future so WITH_GPU_BUILDTIME_SHADER_BUILDER
is more descriptive name.
2022-07-26 14:25:23 +02:00
Jeroen Bakker
c8edde0ada GPU: Do not allow GPU Shader builder when USD is enabled.
Linking GPU shader builder requires stubs for many functions of the USD library.
We don't want to rely on other modules to update the stubs for a tool that
is only used by GPU developers.

This patch raises an error when both WITH_GPU_SHADER_BUILDER and WITH_USD are
enabled. This reduces the maintenance of updating the stubs when USD API changes.

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D15422
2022-07-26 14:25:23 +02:00
97dbc40493 Fix T99218: light group add button should be disabled when name is empty
Previously it was inactive but still clickable.

Ref D15316
2022-07-26 14:25:23 +02:00
6c7a3cae5c GPU: Update shader builder stubs.
Fixes workflow when using WITH_GPU_SHADER_BUILDER=On.
2022-07-26 14:25:23 +02:00
e9726228c6 Fix/Cleanup UI messages. 2022-07-26 14:25:23 +02:00
e9e1573144 Deps Builder: Disable TermInfo and ncurses for DPC++
They are not strictly needed for compilation and disabling them makes
the compiler more portable without any special trickery.

This change aimed to solve problem which currently happens on the API
documentation build which does not have terminfo installed, but needs
to compile Cycles.

Note that the DPC++ is to be re-compiled.
2022-07-26 14:25:23 +02:00
0c1bc93434 Cleanup: Remove unused operator name storage in UI lists 2022-07-26 14:25:23 +02:00
dd9e6a020e Fix T99383: Wrong origdata type in color filter 2022-07-26 14:25:23 +02:00
c615679393 Fix T94633: Sculpt mode missing check for hidden active object
Note there is a bug in BKE_object_is_visible_in_viewport, it
returns false when the object is in local mode.

The transform operator poll should do a similar test.  That
would allow us to move the test from sculpt_brush_strok_invoke
to SCULPT_mode_poll (at the moment we cannot do this due to
the brush operator falling through to the translate keymap
item in global view3d keymap).
2022-07-26 14:25:23 +02:00
fad829248a PyAPI: add Matrix.is_identity read-only attribute
Add a convenient way of checking if the matrix is an identity matrix.
2022-07-26 14:25:23 +02:00
8b6c946ce8 GPencil: Dot-dash modifier rename segment bug fix.
This patch fixes naming and renaming issue with dot-dash modifier segment list.

Before: when double clicking and exiting it would append
number at the end regardless of name being changed or not.

Now it works like in other areas.

Authored by: Aleš Jelovčan (frogstomp)

Reviewed By: YimingWu (NicksBest)

Differential Revision: https://developer.blender.org/D15359
2022-07-26 14:25:23 +02:00
733788502f Cleanup: spelling in comments 2022-07-26 14:25:23 +02:00
3f4533822c Cleanup: remove unused GHOST function getAnyModifiedState.
Remove unused GHOST_WindowManager::getAnyModifiedState()
2022-07-26 14:25:23 +02:00
3d220ee160 Revert "Fix an assert trip in boolean tickled by D11272 example."
This reverts commit 6543290116.
It broke tests and I don't know why, so reverting this while
figuring that out.
2022-07-26 14:25:23 +02:00
804d680ab0 Fix an assert trip in boolean tickled by D11272 example.
The face merging code in exact boolean made an assumption that
the tesselated original face was manifold except at the boundaries.
This should be true but sometimes (e.g., if the input faces have
self-intersection, as happens in the example), it is not.
This commit makes face merging tolerant of such a situation.
It might leave some stray edges from triangulation, but it should
only happen if the input is malformed.
Note: the input may be malformed if there were previous booleans
in the stack, since snapping the exact result to float coordinates
is not guaranteed to leave the mesh without defects.
2022-07-26 14:25:23 +02:00
006b58bf02 Fix T99532: New OBJ importer in some cases fails to import faces
The importer code was written under incorrect assumption that vertex
data (v, vn, vt commands etc.) are grouped by object, i.e. follow the
o command, and that each object has its own vertex data commands. This
is not the case -- all the vertex data in the whole OBJ file is
"global", with no relation to any objects/groups; it's just that the
faces belong to the object, and then they pull in any vertices they
like.

This patch fixes this incorrect assumption in the importer:

- Vertex data is now properly global; no need to track some sort of
  "offsets" per object like it was doing before.
- For each object, face definitions track the minimum & maximum vertex
  indices referenced by the object, and then all that vertex range is
  created in the final Blender object. Note: it might be (unusual, but
  possible) that an object does not reference a sequential range of
  vertices, e.g. just a single face with vertex indices 1, 10, 100 --
  the resulting Blender mesh will have all the 100 vertices (some
  "loose" without belonging to a face). It should be possible to track
  the used vertices exactly (e.g. with a vector set), but I haven't
  done that for performance reasons.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D15410
2022-07-26 14:25:23 +02:00
88e306e94d Fix T99536: new 3.2 OBJ importer fails with trailing space after wrapped lines
Address the issue by re-working line continuation handling: stop
trying to parse sequences like "backslash, newline" (which is the
bug: it should also handle "backslash, possible whitespace, newline")
during parsing. Instead, fixup line continuations after reading chunks
of input file data - turn backslash and the following newline into
spaces. The rest of parsing code does not have to be aware of them
at all then.

Makes the file attached to T99536 load correctly now. Also will extend
one of the test files in subversion tests repo to contain backslashes
followed by newlines.
2022-07-26 14:25:23 +02:00
b29333bedf Fix cursor display size with tablet input in GHOST/Wayland
The scale for tablet cursor surfaces was never set, making them display
larger. Now the outputs scale is set for mouse & tablet cursors.
2022-07-26 14:25:23 +02:00
dcf6764f36 Cleanup: split out wl_buffer creation into a utility function
Simplify logic for initializing the wl_buffer, ensure the cursors
custom data is never heft in a half initialized state.
Also remove the need for multiple calls to close when handling errors.
2022-07-26 14:25:23 +02:00
24955c5895 Cleanup: remove buffer_t in GHOST/Wayland
This was allocated and only used to store the custom cursor data.
Use a pointer & size member instead for simplicity.
2022-07-26 14:25:22 +02:00
f0b2434430 Cleanup: split memfd_create into it's own function for Wayland
Avoid ifdef's in cursor loading by creating a memfd_create_sealed
utility function that works irrespective of memfd_create availability.
2022-07-26 14:25:22 +02:00
428db2bf27 Fix resource leaks setting custom cursors in Wayland
- Memory from the prior cursor was never un-mapped.
- posix_fallocate failure left a file handle open..
2022-07-26 14:25:22 +02:00
cdc5eec4e4 UI: renaming fIle browser thumbnail sizes
Rename the thumbnail size from Regular to Medium since it's the typical
way to refer to sizing in American English

Reviewed By: Campbell Barton
Differential Revision: https://developer.blender.org/D15305
2022-07-26 14:25:22 +02:00
f8d8b70762 Weight & Vertex Paint: always respect edit mode hiding on faces.
In some cases it is mandatory to be able to hide parts of the mesh
in order to paint certain areas. The Mask modifier doesn't work in
weight paint, and edit mode hiding requires using selection, which
is not always convenient.

This makes the weight and vertex paint modes always respect edit mode
hiding like sculpt mode. The change in behavior affects drawing and
building paint PBVH. Thus it affects brushes, but not menu operators
like Smooth or Normalize.

In addition, this makes the Alt-H shortcut available even without
any selection enabled, and implements Hide for vertex selection.

Differential Revision: https://developer.blender.org/D14163
2022-07-26 14:25:22 +02:00
e1b39a25e3 Cleanup: quiet class-memaccess warning 2022-07-26 14:25:22 +02:00
764850ba5e Cleanup: Remove unused variable 2022-07-26 14:25:22 +02:00
78e36a0b26 Fix T99494: Transition effects not working correctly
This was caused by strip content length and start position being
incorrect. Previously this was set from strip boundary by update
function, but it was removed.

Add back code to set effect strip start and length.

Previously content length was always 1 for effects, but now it must
correspond to strip length. Because of this workaround for speed effect
to get this apparent content length was removed.
2022-07-26 14:25:22 +02:00
8d1f571822 Fix bug in recently added MutableVArraySpan move constructor 2022-07-26 14:25:22 +02:00
8e271aa364 Curves: use consistent default radius for Cycles, Eevee, Set Curve Radius node
To avoid Cycles not showing any hair by default, and to avoid very slow render
due to many overlaps with the previous 1 meter default in the node.

Fixes T97584, T99319

Differential Revision: https://developer.blender.org/D15405
2022-07-26 14:25:22 +02:00
03c8ae6573 Cleanup: convert brush.c to C++
In preparation of refactoring for texture nodes.
2022-07-26 14:25:22 +02:00
c4eb6976bc Geometry Nodes: new geometry attribute API
Currently, there are two attribute API. The first, defined in `BKE_attribute.h` is
accessible from RNA and C code. The second is implemented with `GeometryComponent`
and is only accessible in C++ code. The second is widely used, but only being
accessible through the `GeometrySet` API makes it awkward to use, and even impossible
for types that don't correspond directly to a geometry component like `CurvesGeometry`.

This patch adds a new attribute API, designed to replace the `GeometryComponent`
attribute API now, and to eventually replace or be the basis of the other one.

The basic idea is that there is an `AttributeAccessor` class that allows code to
interact with a set of attributes owned by some geometry. The accessor itself has
no ownership. `AttributeAccessor` is a simple type that can be passed around by
value. That makes it easy to return it from functions and to store it in containers.

For const-correctness, there is also a `MutableAttributeAccessor` that allows
changing individual and can add or remove attributes.

Currently, `AttributeAccessor` is composed of two pointers. The first is a pointer
to the owner of the attribute data. The second is a pointer to a struct with
function pointers, that is similar to a virtual function table. The functions
know how to access attributes on the owner.

The actual attribute access for geometries is still implemented with the `AttributeProvider`
pattern, which makes it easy to support different sources of attributes on a
geometry and simplifies dealing with built-in attributes.

There are different ways to get an attribute accessor for a geometry:
* `GeometryComponent.attributes()`
* `CurvesGeometry.attributes()`
* `bke::mesh_attributes(const Mesh &)`
* `bke::pointcloud_attributes(const PointCloud &)`

All of these also have a `_for_write` variant that returns a `MutabelAttributeAccessor`.

Differential Revision: https://developer.blender.org/D15280
2022-07-26 14:25:22 +02:00
2bd9c6c843 Linux: Move Mesa software OpenGL libraries to sub-directory
Allows to put libraries which are always needed by Blender into the
lib/ folder and not worry about OpenGL libraries picked up from there.

Currently no functional changes as we do not yet have dynamic libraries
which we load at startup. It allows to use direct linking of oneAPI
Cycles device (see D15397), also it is something which would need to
happen to support USD/Hydra/TBB compiler as dynamic libraries in the
future.

Differential Revision: https://developer.blender.org/D15403
2022-07-26 14:25:22 +02:00
f8c0a02e74 Cycles: enable oneAPI in Linux release builds
with a very high min-driver version requirement, placeholder until JIT
CentOS runtime compilation issue gets fixed in a defined version.
min-driver version check can be worked around by setting
CYCLES_ONEAPI_ALL_DEVICES environment variable.
2022-07-26 14:25:22 +02:00
ca0cc25d0c Fix T99191: Boolean modifier creates invalid material indices
Similar to 1a6d0ec71c which changed the mesh boolean node (and
also caused this bug), this commit changes the material mapping for the
exact mode of the boolean modifier. Now the result should contain any
material on the faces of the input objects (including materials linked
to objects and meshes). The improvement is possible because materials
can be changed during evaluation (as of 1a81d268a1).

Differential Revision: https://developer.blender.org/D15365
2022-07-26 14:25:22 +02:00
d320e0fa11 Hair Curves: The new curves object is now available
This commit doesn't implement any new feature but makes the new curves
object type no longer experimental.

Documentation:

* https://docs.blender.org/manual/en/3.3/modeling/curves/primitives.html#empty-hair
* https://docs.blender.org/manual/en/3.3/sculpt_paint/curves_sculpting/introduction.html

Note: This also makes the Selection Paint tool available. This tool
should have been moved out of the "New Curves Tool" flag when we got the
selection drawing to work.

Differential Revision: https://developer.blender.org/D15402
2022-07-26 14:25:22 +02:00
e08d52a933 Cleanup: make format 2022-07-26 14:25:22 +02:00
ef87ffbec2 Curves: support deforming curves on surface
Curves that are attached to a surface can now follow the surface when
it is modified using shape keys or modifiers (but not when the original
surface is deformed in edit or sculpt mode).

The surface is allowed to be changed in any way that keeps uv maps
intact. So deformation is allowed, but also some topology changes like
subdivision.

The following features are added:
* A new `Deform Curves on Surface` node, which deforms curves with
  attachment information based on the surface object and uv map set
  in the properties panel.
* A new `Add Rest Position` checkbox in the shape keys panel. When checked,
  a new `rest_position` vector attribute is added to the mesh before shape
  keys and modifiers are applied. This is necessary to support proper
  deformation of the curves, but can also be used for other purposes.
* The `Add > Curve > Empty Hair` operator now sets up a simple geometry
  nodes setup that deforms the hair. It also makes sure that the rest
  position attribute is added to the surface.
* A new `Object (Attach Curves to Surface)` operator in the `Set Parent To`
  (ctrl+P) menu, which attaches existing curves to the surface and sets the
  surface object as parent.

Limitations:
* Sculpting the procedurally deformed curves will be implemented separately.
* The `Deform Curves on Surface` node is not generic and can only be used
  for one specific purpose currently. We plan to generalize this more in the
  future by adding support by exposing more inputs and/or by turning it into
  a node group.

Differential Revision: https://developer.blender.org/D14864
2022-07-26 14:25:22 +02:00
501892df32 Fix build error without unity build, after recent changes 2022-07-26 14:25:22 +02:00
ede74d1d55 Fix Crash: Reading canvas tool settings.
Blender would crash when a file was saved where the tool settings is
set to paint on a single image (3d texture painting).

Reason is that the selected image memory address wasn't updated
when the new address.
2022-07-26 14:25:22 +02:00
Jeroen Bakker
ffc3dc48f1 Draw: Curve outline drawing in object mode.
This patch adds (selected/active) outline around a curve object in object mode.

{F13270680}

In the past the draw bounds option was enabled for any curve objects. With this
patch it isn't needed and will be disabled.

In the future the curve outline could also be enabled to improve GPU selection.

Reviewed By: dfelinto, HooglyBoogly, fclem

Maniphest Tasks: T95933

Differential Revision: https://developer.blender.org/D15308
2022-07-26 14:25:22 +02:00
Damien Picard
c4d0337751 Add a few missing UI strings to translation.
Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15392
2022-07-26 14:25:22 +02:00
ae5dd63fc7 GHOST/Wayland: add logging for listener handlers
Add logging to all Wayland listener callbacks as it can be difficult
to detect the cause of problems.

Using break-points often isn't practical for debugging interactive
windowing / compositor issues

Logging needs to be enabled on the command line, e.g:

blender --log "ghost.wl.*" --log-level 2 --log-show-basename
2022-07-26 14:25:22 +02:00
41ae4f5dd7 GHOST: use ELEM/ARRAY_SIZE/UNPACK macros to avoid repetition
Also use UNLIKELY macro for checks for very unlikely scenarios.
2022-07-26 14:25:22 +02:00
c75ca344e3 GHOST: add GHOST_utildefines
Add macros from BLI_utildefines, mainly to avoid that avoid repetition
(ELEM, UNPACK*, CLAMP* & ARRAY_SIZE).

Also add macros LIKELY/UNLIKELY as there are quiet a lot of checks
for unlikely situations for GHOST/Wayland (not having a keyboard,
or mouse for e.g.).
2022-07-26 14:25:22 +02:00
ccf35c1f22 Cleanup: Move mesh legacy conversion to a separate file
It's helpful to make the separation of legacy data formats explicit,
because it declutters actively changed code and makes it clear which
areas do not follow Blender's current design. In this case I separated
the `MFace`/"tessface" conversion code into a separate blenkernel
.cc file and header. This also makes refactoring to remove these
functions simpler because they're easier to find.

In the future, conversions to the `MLoopUV` type and `MVert`
can be implemented here for the same reasons (see T95965).

Differential Revision: https://developer.blender.org/D15396
2022-07-26 14:25:22 +02:00
6a3fca0149 Fix T99364: Unable to select bones when custom shape display is disabled
Regression in [0] which revealed an error in [1].
Logic for pose channel custom transform ignored ARM_NO_CUSTOM.

[0]: 3267c91b4d
[1]: c3fef001ee
2022-07-26 14:25:22 +02:00
2b51e0ebf1 Cleanup: spelling in comments
Also move mis-placed doc-string.
2022-07-26 14:25:22 +02:00
b3843978cb Cleanup: format 2022-07-26 14:25:22 +02:00
ed7b2596a1 Cleanup: Calm GCC Conversion Warning
Commit b9c0eed206 introduced a GCC conversion warning because of an
assignment of a long int value to an int.

Own Code
2022-07-26 14:25:21 +02:00
1884d79ed0 BLF: Add Support for Variable Fonts
Add support for Variable/Multiple Master font features. These are fonts
that contain a range of design variations along multiple axes. This
contains no client-facing options.

See D12977 for details and examples

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

Reviewed by Brecht Van Lommel
2022-07-26 14:25:21 +02:00
b14ed937f0 Fix T99332: resize video in image editor does not update correctly
Use the image user from the image editor to correctly get the frame in the
operators. Based on patch by Nicolas (john-g-h-doe) with changes by me.

Differential Revision: https://developer.blender.org/D15380
2022-07-26 14:25:21 +02:00
d6133055f1 Cleanup: Remove unused variable 2022-07-26 14:25:21 +02:00
15dac8c8fa Cleanup: improve asserts in generic span 2022-07-26 14:25:21 +02:00
3bc33188e2 BLI: make some spans default constructible
`GSpan` and spans based on virtual arrays were not default constructible
before, which made them hard to use sometimes. It's generally fine for
spans to be empty.

The main thing the keep in mind is that the type pointer in `GSpan` may
be null now. Generally, code receiving spans as input can assume that
the type is not-null, but sometimes that may be valid. The old #type() method
that returned a reference to the type still exists. It asserts when the
type is null.
2022-07-26 14:25:21 +02:00
87b5e432e6 LibOverride: Make fully editable when creating an experimental user setting.
This is temporary to investigate which behavior should be kept when
creating an override hierarchy if there are no cherry-picked data
defined: make all overrides user-editable, or not.

This removes the 'make override - fully editable' menu entries.
2022-07-26 14:25:21 +02:00
a685625896 UI: Superimposed pin icon for workspace scene pinning in the scene switcher
Followup to the previous commit, to display a pin icon in the scene switcher.
This is a good indicator to have and such workspace-wide functionality should
be available in the topbar, close to what it belongs to (scene switching).
Downside is that it makes this already crowded region even more crowded. But
thanks to the use of superimposed icons, it's not too noisy visually.

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

Reviewed by: Campbell Barton
2022-07-26 14:25:21 +02:00
84fa920702 Workspaces: Option to pin scene to a workspace
Adds a "Pin Scene" option to the workspace. When activated, the workspace will
remember the scene that was last activated in it, so that when switching back
to this workspace, the same scene will be reactivated. This is important for a
VSE workflow, so that users can switch between different workspaces displaying
a scene and thus a timeline for a specific task.

The option can be found in the Properties, Workspace tab. D11890 additionally
adds an icon for this to the scene switcher in the topbar.

The workspace data contains a pointer to the scene which is a UI to scene data
relation. When appending a workspace, the pointer is cleared.

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

Reviewed by: Brecht Van Lommel, Bastien Montagne (no final accept, but was fine
with the general design earlier)
2022-07-26 14:25:21 +02:00
fc00c34ee6 Outliner, Library Overrides: List child objects under parents
Because children point to, or "use" their parent, the Library Overrides
Hierarchies mode in the Outliner would show parents contained in children, not
children contained in a parent. See D15339 for pictures.

In production files this would make the rig listed under all its children, so
it would appear many times in the tree. Now it appears once and the children
are collected under it.

Refactors the tree building, so instead of using
`BKE_library_foreach_ID_link()`, it now uses the ID relations mapping in
`MainIDRelations`.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15339
2022-07-26 14:25:21 +02:00
Bastien Montagne
1acf6f81cb Fix T99256: Regression: Meta balls segfaulting copy-to-selected.
Revealed by rB43167a2c251b, but actuall issue is the
`rna_MetaBall_update_data` function expecting a never-NULL `scene`
pointer, which is not guaranteed.

This lead to refactoring the duo
`rna_MetaBall_update_data`/`BKE_mball_properties_copy`, since it was
doing a very sub-optimal O(n^2) process, new code is O(2n) now
(n being the number of Objects).

Not sure why the objects were processed through the existing bases of
the existing scene in the first place, this could miss a lot of affected
objects (e.g. in case said objects are in an excluded collection, etc.).

Also noticed that both old and new implementation can fail to fully propagate
changes to all affected meta-balls in some specific corner cases, added
a comment about it in the code.

Reviewed By: sergey

Maniphest Tasks: T99256

Differential Revision: https://developer.blender.org/D15338
2022-07-26 14:25:21 +02:00
ece69065e4 Compositor: Pre-fill motion tracking fields
Extends current functionality which was only filling in
the active movie clip. Now we also pre-fill tracking object
name, as well as (plane)track name.
2022-07-26 14:25:21 +02:00
2c8d87fa8b Cleanup: Use std::move for geometry set
The only real improvement is avoiding some reference counting,
but the main for the change is consistency. Also don't move a
StringRef, since that doesn't own any data anyway.
2022-07-26 14:25:21 +02:00
c0aa49178d Cleanup: Use C++ style of avoiding unused variable warnings
As documented in the best practices section of the style guide:
https://wiki.blender.org/wiki/Style_Guide/Best_Practice_C_Cpp
2022-07-26 14:25:21 +02:00
d6fd2971a3 Cleanup: Use generic index mask utility
This may lead to improved performance from multithreading as well.
2022-07-26 14:25:21 +02:00
b01909f02e Fix: Spreadsheet does not display original curves data
The spreadsheet ignored the component choice in the data set region
for curves and volume objects, and the original curves data-block wasn't
retrieved from the original object.
2022-07-26 14:25:21 +02:00
Amélie Fondevilla
a80d38b94b Fix T99505: NLA tweak mode crashes with GPencil data
Adding Grease Pencil keyframes in the dopesheet (rB92d7f9ac56e0) lead to
crashes from the NLA editor (T99505). This is now resolved, by removing
grease pencil keyframes from NLA editor (as it was in 3.2), and
filtering them out of all NLA-related operations.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D15391
2022-07-26 14:25:21 +02:00
Pratik Borhade
1c4ce4ffd8 Fix T99453: Regression: Crash on calling menu search
Fix T99453.
Crash due to null pointer access.
So wrap the function call in simple `if` check

Reviewed By: sybren

Maniphest Tasks: T99453

Differential Revision: https://developer.blender.org/D15370
2022-07-26 14:25:21 +02:00
710189794b Fix T99386: Driven modifiers are always re-evaluated during animation
Even if the driver is not dependent on time the modifiers were always
re-evaluated during playback. This is due to the legacy nature of the
check whether modifier depends on time or not: it was simply checking
for sub-string match for modifier in the F-Curve and drivers RNA paths.

Nowadays such dependencies are created by the dependency graph builder,
which allows to have more granular control over what depends on what.

The code is now simplified to only check for "static" dependency of the
modifier form time: for example, Wave modifier which always depends on
time (even without explicit animation involved).

This change also fixes missing relation from the animation component to
the shader_fx modifiers, fixing race condition.

Additional files used to verify relations:
- Geometry: F13257368
- Grease Pencil: F13257369
- Shader FX: F13257370

In these files different types of modifiers have an animated property,
and the purpose of the test is to verify that the modifiers do react
to the animation and that there is a relation between animation and
geometry components of the object. The latter one can only be checked
using the dependency graph relation visualization.

The drivers are not tested by these files. Those are not typically
depend on time, and if there were missing relation from driver to
the modifier we'd receive a bug report already. As well as if there
was a bug in missing time relation to a driver we'd also receive a
report.

Differential Revision: https://developer.blender.org/D15358
2022-07-26 14:25:21 +02:00
3aa5dc0896 Cleanup: Remove redundant filtering of legacy normal attribute
This is already done inside of `attribute_search_add_items`.
2022-07-26 14:25:21 +02:00
271e40f6f1 Cleanup: Correct comment with spreadsheet enum type 2022-07-26 14:25:21 +02:00
2db3e8ea3f Cleanup: Improve variable name
The new name makes more sense in non-node-related contexts.
2022-07-26 14:25:21 +02:00
90b10e1b80 Curves: Add sculpt selection overlay
This commit adds visualization to the selection in curves sculpt mode.
Previously it was only possible to see the selection when it was
connected to a material.

In order to obstruct the users vision as little as possible, the
selected areas of the curve are left as is, but a dark overlay
is drawn over unselected areas.

To make it work, the overlay requests the selection attribute and then
ensures that the evaluation is complete for curves. Then it retrieves
the evaluated selection GPU texture and passes that to the shader.
This reuses the existing generic attribute extraction system because
there currently wouldn't be any benefits to dealing with selection
separately, and because it avoids duplication of the logic that
extracts attributes from curves and evaluates them if necessary.

Differential Revision: https://developer.blender.org/D15219
2022-07-26 14:25:21 +02:00
340643c697 GHOST: initialize grab axis for windows
While this didn't cause any user visible bugs, ASAN would report
an error when passing it as an argument.
2022-07-26 14:25:21 +02:00
d98ada3953 ID Management: Purge: Make outliner button use recursive purge.
This change the 'Purge' button of the Outliner 'Orphaned' view to use
recursive purge, i.e. it wil not only delete immediately unused IDs (as
listed in the view) anymore, but also all their unused dependencies.
2022-07-26 14:25:21 +02:00
d15bb7ed4a Fix T98029: Support isolated islands of IDs when purging unused ones.
Cases were e.g. an object would use a material, and this material would
use this object (e.g. through a driver), even if both those data-blocks
are technically unused, they would remain forever since they were not
detected as such.

Now this is properly detected and purged as part of the 'recursive
purge' operation.
2022-07-26 14:25:21 +02:00
ff4da2c667 Fix T99491: Crash when opening modifiers panel
This crashed because in `get_active_fcurve_channel`, the filter did not
filter out channels with no fcurve.

The fix adds the filter `ANIMFILTER_FCURVESONLY`.

See rB92d7f9ac56e0ff1e65c364487542dfb7c32a0a67 for the new filter.

Maniphest Tasks: T99491

Differential Revision: https://developer.blender.org/D15386
2022-07-26 14:25:21 +02:00
36e5c85175 Fix: Save modified images during file close
Regressed in the following commit due to an inverted conditional:
{rB1159b63a07fd2cbc7fc48e162d57721c9c85b3f6}

Differential Revision: https://developer.blender.org/D15389
2022-07-26 14:25:21 +02:00
93c2e47e2b Fix T99388: Obey relative path option when saving UDIMs
Ensure that the Image maintains the proper file path after saving all
the individual tiles.

The image_save_post function is unaware that the filepath it receives
is only for a single tile, not the entire Image, and happily keeps
setting ima->filepath to the concrete filepath for each tile.

There were 2 problems with the code that attempted to correct the
Image filepath back to the UDIM virtual form:
- It would trample the "relative" directory that might have been set
- It would do the wrong thing if no tiles could be saved at all

The design is now as follows: Example of trying to save to a new PathB
|                                  | all tiles ok     | any tile not ok|
| -------------------------------- | ---------------- | ---------------|
| ima->filepath is currently empty | set to new PathB | keep empty     |
| ima->filepath is currently PathA | set to new PathB | keep PathA     |

Differential Revision: https://developer.blender.org/D15384
2022-07-26 14:25:21 +02:00
e99676b617 OBJ: more robust .mtl texture offset/scale parsing (T89421)
As pointed out in a comment on T89421, if a MTL file contained
something like: `map_Ka -o 1 2.png` then it was parsed as having
offset `1 2` and the texture filename just a `.png`. Make it so that
mtl option numbers are parsed in a way where the number is only
accepted only if it's followed by whitespace.

Differential Revision: https://developer.blender.org/D15385
2022-07-26 14:25:21 +02:00
e5959da438 OBJ: always set eevee blend mode when material "d" is below 1.0
Fixes T97743: the import code was setting EEVEE blending mode whenever
a transparency texture was present (map_d), or when the materials
illum was saying "yo, transparency!". But if only the material's d
was below 1.0, it was not setting the blend mode, which is different
to user expectations.

Differential Revision: https://developer.blender.org/D15383
2022-07-26 14:25:21 +02:00
99ddee14d5 Fix T99342: GPencil multiframe falloff is scaling wrongly in rotation
The falloff was applied to scale by error. Now, the falloff is only applied to the rotation.

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

.
2022-07-26 14:25:21 +02:00
16e29aaf2c Cleanup: use arguments for internal wayland cursor grabbing
Pass in arguments for internal grab logic instead of accessing
some values from the window and other values as arguments.
While more verbose it's simpler to reason about.
2022-07-26 14:25:21 +02:00
e308072d78 Fix T99270: bones using empties as custom shapes can't be selected
Regression in [0] which didn't account for the bounds of empty objects.
Add support support calculating bounds from empty draw-type to use in
pose-bone culling.

[0]: 3267c91b4d
2022-07-26 14:25:21 +02:00
90ae16663e Python: show additional context for PyDriver errors in the stderr
Showing the expression alone may not be enough to track down an error
evaluating a py-driver. Show information about the target ID & property
in the error message as well.
2022-07-26 14:25:21 +02:00
b91826b687 Python: clear Py-driver variables on exit
These kinds of leaks are relatively harmless, it reduces the number of
un-freed data reported by valgrind on exit.
2022-07-26 14:25:21 +02:00
7cec7a395c Cleanup: use boolean types & early exit on failure for PyDriver
Also use __func__ for printing the funciton name.
2022-07-26 14:25:21 +02:00
27a620a7ef Cleanup: format 2022-07-26 14:25:21 +02:00
818bef21ec Fix Py-driver byte code access with Python 3.11
Error in [0] which assumed the struct member was renamed however
byte-code access from PyCodeObject now requires an API call.

Thanks to @music for pointing this out.

[0]: 780c0ea097
2022-07-26 14:25:21 +02:00
82bb76239a Fix T99334: Ignore edit-related snap options in Object mode
When in Object Mode, any of the active- and edit-related snapping
options (Include Active, Include Edited, Include Non-Edited) should be
ignored when in Object Mode, otherwise snapping could be effectively
disabled.

This commit forces snap code to ignore the active- and edit-related
options when in Object Mode.

Reviewed By: Germano Cavalcante (mano-wii)

Differential Revision: https://developer.blender.org/D15366
2022-07-26 14:25:21 +02:00
73ea3eed10 UI: Adjust and fix shader node descriptions
The tooltips added for shader nodes in D15309 are very helpful already.
This commit makes a few tweaks to make them more consistent, concise,
and includes some fixes. Note that this might move some descriptions
further away from the wording in the manual.

* Make wording more concise
  * Start fewer new sentences
  * Use "For Example" slightly less
  * Avoid repeating the node's name unnecessarily
* Spelling/grammar fixes
  * Don't capitalize some words
  * Use consistent verb conjugation
  * Use ASCII characters/more common quote symbols
* Corrections to information
  * Plural/singular corrections
  * "smoke domains" -> "volume grids"
  * Fix tooltip for separate and combine color nodes
  * Refer to color sockets as colors rather than "images"
* Avoid "advice" in a few places, which should be left for the manual
* Remove information for sockets and could be in their tooltips
* Avoid referring to the locations of a property in the UI
* Avoid manual newlines (mostly reserve for "Note:")
  * Leave UI code in control of wrapping, which is more consistent
* Add some information
  * That the UV map and color attribute nodes use a default
  * That Voronoi is "based on the distance to random points"
  * Add "(Deprecated)" to old color combine and separate nodes

Differential Revision: https://developer.blender.org/D15381
2022-07-26 14:25:21 +02:00
020e6e7721 Object: Speed up duplication of large selections by doing fewer collection syncs
Previous code was doing N collection syncs when duplicating N objects.
New code avoids all the intermediate syncs by using
BKE_layer_collection_resync_forbid and
BKE_layer_collection_resync_allow, and then does one
BKE_main_collection_sync + BKE_main_collection_sync_remap for the
whole operation. There is some complexity involved where the Base
things of newly duplicated objects can't be found yet, without the
sync, so some work on them (marking them selected, active, ...) has
to be deferred until after the sync.

Timings: scene with 10k cubes, each with unique mesh (Windows, VS2022
Release build, AMD Ryzen 5950X):

- Shift+D duplicate: 13.6s -> 9.2s
- Alt+D duplicate: 4.76s -> 1.53s

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D14150
2022-07-26 14:25:21 +02:00
6dbb6f4112 Cycles oneAPI: Remove direct dependency on Level-Zero
We used it only to access device id for explicitly allowing Arc GPUs.
It made the backend require ze_loader.dll which could be problematic if
we end up using direct linking.
I've replaced filtering based on PCI device id by using other HW properties
instead (EUs, threads per EU), that are now available through Level-Zero.
2022-07-26 14:25:20 +02:00
dec9ec725c Cleanup: fix comments in oneAPI kernel.cpp 2022-07-26 14:25:20 +02:00
7fb56f0577 Fix T99464: Curves sculpt add 3D brush symmetry broken
The brush transform was not applied to the view direction.
2022-07-26 14:25:20 +02:00
149cef9611 Icons: Add each icon to a named group
The objects making up each icon are placed in a group named after the icon
coordinates in the grid. This change has no impact on the current pipeline used
to include icons in a Blender build, but lays the foundation to explore other
workflows to do that, and tidies up the file.

Differential Revision: https://developer.blender.org/D15251
2022-07-26 14:25:20 +02:00
83f6aa25ff Fix T99343: Missing RNA_def_property_update for show overlays in UV editor
Reviewed By: jbakker

Maniphest Tasks: T99343

Differential Revision: https://developer.blender.org/D15354
2022-07-26 14:25:20 +02:00
3fd9a69c9f Cycles: Improve an occupancy for Intel GPUs
Initially oneAPI implementation have waited after each memory
operation, even if there was no need for this. Now, the implementation
will wait only if it is really necessary - it have improved
performance noticeble for some scenes and a bit for the rest of them.
2022-07-26 14:25:20 +02:00
4ce3dc4a83 BLI: improve reverse uv sample in edge cases
Allow for a small epsilon to improve handling of uvs that are on edges.
Generally, when using reverse uv sampling, we expect that the sampling
is supposed to succeed.
2022-07-26 14:25:20 +02:00
842bbfc9a2 Fix T99368: Annotation lines doesn't start where clicked
Caused by [0] which made accessing the drag-start require a function
instead of being the value written into the event cursor coordinates.

[0]: b8960267dd
2022-07-26 14:25:20 +02:00
d15ec40391 Compositor: Pre-fill active scene movie clip in more nodes
Pre-fills movie clip from the scene to the following nodes:
- Keying Screen
- Plane Track Deform
- Track Position

The rest of tracking related nodes were already doing so.

Differential Revision: https://developer.blender.org/D15377
2022-07-26 14:25:20 +02:00
87742a4efe IO: speed up import of large Alembic/USD/OBJ scenes by optimizing material assignment
The importer parts that were doing assignment of materials to the
imported objects/meshes were essentially having a quadratic complexity
in terms of scene object count. For each material assigned to each
object, they were scanning the whole scene, checking which other
Objects use the same Mesh data, in order to resize their material
arrays to match the size.

Performance details (Windows, Ryzen 5950X):

- Import OBJ Blender 3.0 splash scene (24k objects): 43.0s -> 32.9s
- Import USD Disney Moana scene (260k objects): saves two hours
  (~7400s). Note that later on this crashes when trying to render the
  imported result; crashes in the same way/place both in master and
  this patch.

Implementation details:

The importers were doing "scan the world" basically twice for each
object, for each material: once when creating a new material slot
(assigns an empty material), and then again when assigning the
material.

However, all these importers (USD, Alembic, OBJ) always create one
Object for one Mesh. So that whole quadratic complexity resulting
from "scan the world for possible other users of this obdata" is
completely not needed; it just never finds anything. So add a new
dedicated function BKE_object_material_assign_single_obdata that skips
the expensive part, but should only be used when the caller knows that
the obdata has exactly one user (the passed object).

Reviewed By: Bastien Montagne, Michael Kowalski
Differential Revision: https://developer.blender.org/D15145
2022-07-26 14:25:20 +02:00
d1c39e3c80 Fix T99462: Deleting Missing Libraries Crashes Blender.
Usual same issue with outliner operations, where you apply it on one
item, and then try to apply it again on same item listed somewhere else
in the tree...

Fixed by using the 'multi-tagged deletion' code we now have for IDs,
that way tree-walking function just tags IDs for deletion, and they all
get deleted at once at the end.
2022-07-26 14:25:20 +02:00
a4649c5c59 OBJ: extend test coverage for parsing MTL scale/offsets (T89421)
The new OBJ/MTL importer was already handling case T89421
correctly, but there was no test coverage to prove it. Extend
the tests to parse various forms of "-o" and "-s" (one, two, three
numbers).
2022-07-26 14:25:20 +02:00
13a4d8d939 GHOST/Wayland: support dynamic loading libraries for Wayland
Add intern/wayland_dynload which is used when WITH_GHOST_WAYLAND_DYNLOAD
is enabled (off by default). When enabled, systems without Wayland
installed will fall back to X11.

This allows Blender to dynamically load:
- libwayland-client
- libwayland-cursor
- libwayland-egl
- libdecor-0 (when WITH_GHOST_WAYLAND_LIBDECOR is enabled).
2022-07-26 14:25:20 +02:00
ee4950522b Cleanup: declare local variables static 2022-07-26 14:25:20 +02:00
ca48f4a4da Cleanup: spelling in comments 2022-07-26 14:25:20 +02:00
Loren Osborn
cb7a1e5625 Cleanup: Fix compiler warnings
Use consistent class/struct declaration in forward declarations.

Differential Revision: https://developer.blender.org/D15382
2022-07-26 14:25:20 +02:00
7863f5b091 Fix T99284: Undefined values output from UV nodes
When committing D14389 I assumed that the output arrays didn't need
to be initialized, but the UV parameterizer uses the intial values of UVs.
2022-07-26 14:25:20 +02:00
Iliay Katueshenock
3028535051 Fix: Tests: Incorrect curve construction
The offsets were filled with the same value,
but they must be the total accumulated point count.

Differential Revision: https://developer.blender.org/D15374
2022-07-26 14:25:20 +02:00
a8506bac97 Curves: Port subdivide node to the new data-block
This commit moves the subdivide curve node implementation to the
geometry module, changes it to work on the new curves data-block,
and adds support for Catmull Rom curves. Internally I also added
support for a curve domain selection. That isn't used, but it's
nice to have the option anyway.

Users should notice better performance as well, since we can avoid
many small allocations, and there is no conversion to and from the
old curve type.

The code uses a similar structure to the resample node (60a6fbf5b5)
and the set type node (9e393fc2f1). The resample curves node can be
restructured to be more similar to this soon though.

Differential Revision: https://developer.blender.org/D15334
2022-07-26 14:25:20 +02:00
540714ea42 Curves: Move type conversion to the geometry module
This helps to separate concerns, and makes the functionality
available for edit mode.
2022-07-26 14:25:20 +02:00
74a61f0b7a UI: Curves Sculpting - Remove duplicated entry for Curve Length 2022-07-26 14:25:20 +02:00
5443843b76 Fix: Memleak in sequencer drag and drop code 2022-07-26 14:25:20 +02:00
2ae39c1a49 Cleanup: Unused headers in generic compositor nodes header
Move headers to node files which actually need those.
There is no need for all nodes to have all those headers
included indirectly.
2022-07-26 14:25:20 +02:00
07072e2ce2 Fix tracking header not being self-sufficient
It used size_t type without including any header to define it.
2022-07-26 14:25:20 +02:00
46d58ca650 BLI: add float3x3 * float3 operator overload 2022-07-26 14:25:20 +02:00
be5e378f09 Cleanup: extract function to snap curves to surface
This makes it possible to use this function without having
to call an operator. This is currently used by D14864.
2022-07-26 14:25:20 +02:00
16cfec4dc4 BLI: use a slightly less trivial reverse uv sampler
This approach is still far from ideal, but at least it has linear
complexity in the common case instead of quadratic.
2022-07-26 14:25:20 +02:00
b354e801b1 Cleanup: use curves surface transform utility in operators 2022-07-26 14:25:20 +02:00
12b18348b0 Curves: move curves surface transforms to blenkernel
This utility struct is useful outside of sculpting code as well.
2022-07-26 14:25:20 +02:00
28629db7c9 Fix T99272: Regression: location override ignored when used in a shadertree.
This is not strictly speaking a regression, this worked before partial
resync was introduced purely because the whole override hierarchy was
systematically re-built.

But support for material pointers in obdata (meshes etc.) was simply not
implemented.

NOTE: This commit also greatly improves general support of materials in
liboverrides, although there is still more work needed in that area to
consider it properly supported.
2022-07-26 14:25:20 +02:00
8aaecb1a27 Fix (unreported) liboverride: incomplete hierarchy when root is not object/collection.
We do not (currently) consider other ID types as 'end points' justifying
to create an override hierarchy, however if the 'root' ID (i.e. the ID
the user selected as base to create the override) is not an object or
collection, we still want to check all of its dependencies.

This fixes e.g. if a material depends on another Empty object, and user
tries to hierarchy-override that material, its Empty dependency not
being overridden.
2022-07-26 14:25:20 +02:00
c4a1a8b92a NLA: update description of frame_end_ui RNA property
The description incorrectly mentioned it changes the start frame as well,
but it changes the strip's repeats or the action's end frame.
2022-07-26 14:25:20 +02:00
887d268c3b NLA: fix punctuation of tooltips 2022-07-26 14:25:20 +02:00
b294d06888 Cleanup: NLA, reformatting code
No functional changes.
2022-07-26 14:25:20 +02:00
Thibault de Villèle
4bcea8c065 NLA: change behavior of 'Frame Start' / 'End' sliders
Change the behavior of the "Frame start" and [Frame] "End" fields of an
NLA Strip in the NLA editor.

Frame Start now behaves like translating with {key G} and moving the
mouse. It also updates the Frame End to ensure the strip remains the
same length.

Frame End changes the length of the strip, based on the Repeat property.
If there are no repeats (i.e. number of repeats = 1) the underlying
Action will change length, such that more or less of its keyframes will
be part of the NLA strip. If there are repeats (i.e. number of repeats
smaller or larger than 1), the number of repeats will change. Either
way, the effective end frame off the strip will be the one set in the
Frame End slider.

The old behavior of stretching time has been removed. It is still
possible to stretch time of a strip, but this no longer automatically
happens when manipulating the Frame Start and Frame End sliders.

**Technical details:** new RNA properties `frame_start_ui` and
`frame_end_ui` have been added. Changing those values (for example via
the sliders, but also via Python) trigger the above behavior. The
behavior of the already-existing `frame_start` and `frame_end`
properties has been simplified, such that these can be set from Python
without many side-effects, simplifying import of data into the NLA.

Reviewed By: sybren, RiggingDojo

Differential Revision: https://developer.blender.org/D14658
2022-07-26 14:25:20 +02:00
3206eb9dd6 Geometry Nodes: Use alphabetical order for UV nodes in add menu 2022-07-26 14:25:20 +02:00
7417b7373f Cleanup: format 2022-07-26 14:25:20 +02:00
285202a448 GPU: add missing license header 2022-07-26 14:25:19 +02:00
3f57f694f1 Python: support v3.11 (beta) with changes to PyFrameObject & opcodes
- Use API calls to access frame-data as PyFrameObject is now opaque.
- Update opcodes allowed for safe driver evaluation.

**Details**

Some opcodes have been added for safe-driver evaluation.
Python 3.11 removes many opcodes - the number of accepted opcodes in
Blender's listing dropped from 65 to 43) however some new opcodes
also needed to be added. As this relates to security details about newly
added opcodes have been noted below (see [0] for full documentation).

Newly added opcodes:

- CACHE:
  Used to control caching instructions.

- RESUME:
  A no-op. Performs internal checks.

- BINARY_OP:
  Implements the binary and in-place operators,
  replacing specific binary operations.

- CALL, PRECALL, KW_NAMES:
  Used for calling functions, replacing some existing opcodes.

- POP_JUMP_{FORWARD/BACKWARD}_IF_{TRUE/FALSE/NONE/NOT_NONE}.
  Manipulate the byte-code counter.

- SWAP, PUSH_NULL.
  Stack manipulation.

Resolves T99277.

[0]: https://docs.python.org/3.11/library/dis.html
2022-07-26 14:25:19 +02:00
8367036805 Python: add opcodes for safe py-drivers
New opcodes added since 3.7 meant some actions such as `len()`
were disabled in safe py-driver execution.

The following opcodes have been added, see [0] for details:

- ROT_FOUR: similar to existing ROT_* opcodes, added v3.8.

- ROT_N: similar to existing ROT_* opcodes, added v3.10.

- GET_LEN: Push len(TOS) onto the stack, added v3.10.

- IS_OP: for ternary operator, added v3.9.

- BUILD_SLICE: access `slice` built-in, doesn't expose new
  functionality beyond existing `__getitem__` access.

[0]: https://docs.python.org/3.10/library/dis.html
2022-07-26 14:25:19 +02:00
609c888b3d Python: remove invalid Py_TPFLAGS_HAVE_GC usage
Blender wouldn't start with Python 3.11 because of an error in
Py_TPFLAGS_HAVE_GC usage for `bpy.app.handlers.persistent`.
Remove this flag as it's not necessary.

Part of fix for T99277.
2022-07-26 14:25:19 +02:00
ee9af3fc7a BLI: Use simpler sliced generic virtual arrays when possible
This is just a theoretical improvement currently, I won't try to justify
it with some microbenchmark, but it should be better to use the
specialized single and span virtual arrays when slicing a `GVArray`,
since any use of `GVArrayImpl_For_SlicedGVArray` has extra overhead.

Differential Revision: https://developer.blender.org/D15361
2022-07-26 14:25:19 +02:00
1b218a2ce6 METAL: Add license header to new files 2022-07-26 14:25:19 +02:00
92fcbf72ae Curves: Expose function to calculate vector handles 2022-07-26 14:25:19 +02:00
6adf7325f3 OBJ: remove "experimental" from C++ based importer/exporter, mark Python legacy
By now I'm not aware of any serious regressions or missing functionality
in the C++ based OBJ importer/exporter. They have more features (vertex colors
support), and are way faster than the Python based importer/exporter.

Reviewed By: Thomas Dinges, Howard Trickey
Differential Revision: https://developer.blender.org/D15360
2022-07-26 14:25:19 +02:00
b97c2c57f4 Cleanup: Correct UI view comments 2022-07-26 14:25:19 +02:00
a349252ad5 Fix curves sculpting Selection Paint missing refresh
This was reported as part of D15219 but it is a problem in master, not
in the patch.

EEVEE is drawing with a cheap sampling when navigating or painting, but
we need to clear the painting flag when we are done painting.

For a rainy day: DRW_state_is_navigating() should be renamed to indicate
that it also checks for the painting flag.
2022-07-26 14:25:19 +02:00
07f116f365 Cleanup: Remove unused function 2022-07-26 14:25:19 +02:00
694562fb1c Cleanup: Clarify relation name for time relation to modifier 2022-07-26 14:25:19 +02:00
b24a2eb280 Fix T99381: GPencil Unable to Sculpt last point using Subdivide Modifier
The problem was the last point had the original point, but the previous one not, so the loop ends before checking last point.

The solution is avoid the loop exist if the function is checking the previous point before last one.
2022-07-26 14:25:19 +02:00
49d04bccb9 Fix T98884: Fix edge case crashes in gpu subdiv cache code 2022-07-26 14:25:19 +02:00
1df73837e1 Cleanup: use local variable in smear code instead of ss->cache->bstrength 2022-07-26 14:25:19 +02:00
2e06e08cc1 Fix T98698: Division by zero in smear code when strength is zero 2022-07-26 14:25:19 +02:00
575faa57a9 Fix use-after-free error when handling events that close windows
Regression in [0] caused operations such as file-load or file-new
from any window besides the first to write into the freed:
`wmWindow.eventstate`.

Resolve by copying the event instead of restoring the region relative
cursor position after modifying it.

[0]: 789b1617f7
2022-07-26 14:25:19 +02:00
75c391d1ea Cleanup: remove unused WM_event_is_last_mousemove
This was part of walk-mode logic that implemented it's own cursor-grab,
now this has been moved to use GHOST's cursor grabbing,
it's no longer needed.
2022-07-26 14:25:19 +02:00
8a206270ae Cleanup: spelling in comments 2022-07-26 14:25:19 +02:00
65572760ad Cleanup: correct function signature for UI_block_add_view for grid_view 2022-07-26 14:25:19 +02:00
26a9f96f04 UV: Improve UV Straighten operator
Improves UV Straighten in several ways:
- Operate on entire selection.
- One straighten for each selected island.
- Prefers pins to anchor the endpoints of the resulting line.

Differential Revision: D15121
Resolves: T78553
2022-07-26 14:25:19 +02:00
767102dc23 Cleanup(UV): Refactor UV Align and UV Straighten (No user visible changes)
Move functionality into uvedit_uv_align_weld and uvedit_uv_straighten.

Prep for D15121
2022-07-26 14:25:19 +02:00
0aada062bf Cleanup: Rename curve segment count function
`curve_segment_num` -> `segments_num`.
The "curve" prefix is reduntant for a function in the curve namespace.
2022-07-26 14:25:19 +02:00
d33d293491 UI: Move rename buffer management to new view base class
Renaming is a nice example of a feature that shouldn't need a specific
implementation for a specific view type (e.g. grid or tree view). So it's
something that can be supported in the general view code. Individual views can
use it "for free" then. This ports the view level part of the renaming code,
the view item level part of it can be ported once we have a common base class
for the view items.
2022-07-26 14:25:19 +02:00
bc53b2e6fd UI: Add AbstractView base class for views, unify reconstruction in there
No user visible changes expected.

There's plenty of duplicated code in the grid and the tree view, and I expect
this to become more. This starts the process of unifying these parts, which
should also make it easier to add new views. Complexity in the view classes is
reduced, and some type shenanigans for C compatibility and general view
management can be removed, since there is now a common base type.

For the start this ports some of the view reconstruction, where the view and
its items are compared to the version of itself in the previous redraw, so that
state (highlighted, active, renaming, collapsed, ...) can be preserved.
Notifier listening is also ported.
2022-07-26 14:25:19 +02:00
Iliay Katueshenock
9c24f3efb2 Fix T99316: Crash with no font in String to Curves node
If you remove the default font from the project, the node will not
have the selected font. In this case, there is no check that the font
does not exist. This suggestion adds an error message if the font
is not specified.

Differential Revision: https://developer.blender.org/D15337
2022-07-26 14:25:19 +02:00
dc201d4865 BLI: refactor length parameterization
This refactor had two main goals:
* Simplify the sampling code by using an algorithm with fewer special cases.
* Generalize the sampling to support non-sorted samples.

The `SampleSegmentHint` optimization was inspired by `ValueAccessor` from
OpenVDB and improves performance 2x in my test cases.

Differential Revision: https://developer.blender.org/D15348
2022-07-26 14:25:19 +02:00
167235809e Fix: Build error with unity builds off after recent cleanup
Mistake in df8d96ab66
2022-07-26 14:25:19 +02:00
53d2218e21 Revert "Start of Bevel V2, as being worked on with task T98674."
This reverts commit 9bb2afb55e.
Oops, did not intend to commit this to master.
2022-07-26 14:25:19 +02:00
6e96bbf3c6 Start of Bevel V2, as being worked on with task T98674.
This is the start of a geometry node to do edge, vertex, and face
bevels.

It doesn't yet do anything but analyze the "Vertex cap" around
selected vertices for vertex bevel.
2022-07-26 14:25:19 +02:00
f85b14c7a6 BLI: improve span access to virtual arrays
* Make the class names more consistent.
* Implement missing move-constructors and assignment-operators.
2022-07-26 14:25:19 +02:00
f77c3f050e BKE: fix wrong recently added assert 2022-07-26 14:25:19 +02:00
6ba0f24f5c Cleanup: Simplify logic building in length parameterization
We can construct an IndexRange directly rather than retrieving it.
2022-07-26 14:25:19 +02:00
8a94fec654 Fix crash with window decorations (libdecor) in Wayland
Surfaces from window decorations were passed into GHOST's listeners
since libdecor & GHOST share a connection.

This error introduced by recent changes that assumed surfaces passed to
GHOST's handler functions were owned by GHOST.

Tag GHOST surfaces & outputs to ensure GHOST only attempts to access
data it created.
2022-07-26 14:25:19 +02:00
031b09049b Fix T99268: LineArt better handling for dense overlappings.
Two main fixes:
- Split tiles only when we are more sure that it will improve distribution.
- Discard edges and chains that are not gonna be used afterwards before chaining.

This speeds up the whole process and also eliminates unnecessary tile splitting.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D15335
2022-07-26 14:25:19 +02:00
285a66e067 Fix T99301: RNA_boolean_get warning when saving a file for the first time
Caused by [0], RNA_struct_property_is_set also functioned to check if
the property existed.

[0]: 6a2c42a0d5
2022-07-26 14:25:19 +02:00
ef642fa35f Cleanup: rename internal cursor grabbing function
This function was named as if it was part of GHOST's API but was
in fact an internal utility.
2022-07-26 14:25:18 +02:00
45c0062d55 Cycles: fix support for multiple Intel GPUs
Identical Intel GPUs ended up with the same id.
Added PCI BDF to the id to make it unique.
2022-07-26 14:25:18 +02:00
4ba6411954 IO: print import & export times of Alembic & USD
Many existing importers/exporters do log the time it takes to system
console (some others log more information too). In particular, OBJ
(C++ & python), STL (C++ & python), PLY, glTF2 all log the time it
takes. However, neither USD nor Alembic do. And also it's harder to
know the time it takes there from a profiler, since all the work
normally is done on a background job and is split between several
threads (so you can't just find some top-level function and see how
much time it took).

This change:

- Adds import/export time logging to USD & Alembic importer/exporter,
- In the time utility class (also used by OBJ & STL), improve the
  output formatting: 1) print only one decimal digit, 2) for long
  times, print seconds and also produce a hours:minutes:seconds form.

Reviewed By: Michael Kowalski, Kévin Dietrich
Differential Revision: https://developer.blender.org/D15170
2022-07-26 14:25:18 +02:00
Jason Fielder
1dbd5421f3 Metal: MTLMemoryManager implementation includes functions which manage allocation of MTLBuffer resources.
The memory manager includes both a GPUContext-local manager which allocates per-context resources such as Circular Scratch Buffers for temporary data such as uniform updates and resource staging, and a GPUContext-global memory manager which features a pooled memory allocator for efficient re-use of resources, to reduce CPU-overhead of frequent memory allocations.

These Memory Managers act as a simple interface for use by other Metal backend modules and to coordinate the lifetime of buffers, to ensure that GPU-resident resources are correctly tracked and freed when no longer in use.

Note: This also contains dependent DIFF changes from D15027, though these will be removed once D15027 lands.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D15277
2022-07-26 14:25:18 +02:00
ae36132627 Sculpt Curves: UI tweaks and shortcut
* Minimum Distance -> Distance Mix
* Max Count -> Count Max
* Shift + A for selection grow

This follows better the names we have in geometry nodes in the Distribute Points
node when using the Poisson Disk method (Distance Min, Distance Max).

The shortcut for the selection grow is the same we use in mesh sculpt
for the Expand Mask operator (which behaves a bit similar).
2022-07-26 14:25:18 +02:00
7e66362613 Cleanup: add missing license headers in Cycles oneAPI implementation 2022-07-26 14:25:18 +02:00
cef60cd063 GHOST/Wayland: map additional cursors from GHOST_TStandardCursor 2022-07-26 14:25:18 +02:00
2b53e107c6 Cleanup: GPUCodegen: Remove unused variables 2022-07-26 14:25:18 +02:00
bd8cf9198e GPUMaterial: Remove the max attribute check
This is needed to make the GPU_attribute used as generic input mechanism.
2022-07-26 14:25:18 +02:00
4cec62ddc6 Fix un-grab cursor positioning failing for Wayland
UI elements such as sliders & color picker set an un-grab location
which GHOST/Wayland didn't implement.
2022-07-26 14:25:18 +02:00
a98a0e7191 Geometry Nodes: remove warning in Points node
Generating no points in some frames is a perfectly valid use case.
2022-07-26 14:25:18 +02:00
b36a693315 Cleanup: remove unused variable 2022-07-26 14:25:18 +02:00
9d15d692e5 Tracking: Image from Plane Marker operators
There are two operators added, which are available via a special
content menu next to the plane track image selector:

- New Image from Plane Marker
- Update Image from Plane Marker

The former one creates an image from pixels which the active plane
track marker "sees" at the current frame and sets it as the plane
track's image.

The latter one instead of creating the new image data-block updates
the image in-place.

This allows to create unwarped texture from a billboard from footage.
The intent is to allow this image to be touched up and re-projected
back to the footage with an updated content.

Available from a plane track image context menu, as well as from the
Track menu.

{F13243219}

The demo of the feature from Sebastian Koenig: https://www.youtube.com/watch?v=PDphO-w2SsA

Differential Revision: https://developer.blender.org/D15312
2022-07-26 14:25:18 +02:00
0752cbe245 Add helper function to replace buffer of a single-frame image
Very similar to BKE_image_add_from_imbuf with the exception that no
new image data-block is created, but instead the given one is modified.
2022-07-26 14:25:18 +02:00
93adb14939 Fix possible wrong image color space when it is created from image buffer
From quick look it doesn't seem to be leading to real issues yet as the
image buffers are created with the default roles, but valid color space
is needed to be ensured for an upcoming development.
2022-07-26 14:25:18 +02:00
515e86e8ed Fix image-from-imbuf resulting in invalid image configuration
The image which source is set to file is not expected to have empty
file path. If it happens it becomes very tricky to save the image on
exit using the standard quit dialog.

This change makes it so if the image buffer does not have file path
then the new image is set to the "generated" source and it behaves
as if the image was created like so and was fully painted on.

Additionally, mark image as dirty, so that quitting Blender after
such image was added will warn about possible data loss.
2022-07-26 14:25:18 +02:00
118b4bbe40 Fix T99315: Unit plane track deform compositor node leads to unnecessary blur 2022-07-26 14:25:18 +02:00
aa52e515dd Fix sequencer transform test failing.
Issue was caused by using function `SEQ_render_give_stripelem` to obtain
first `StripElem`, but this function now takes retiming into account.

Since first element was meant to be obtained, point to it directly by
using `seq->strip->stripdata`.
2022-07-26 14:25:18 +02:00
e4492db892 Fix crash when creating an off-screen context fails in Wayland
This is very unlikely to happen but better not to crash.
2022-07-26 14:25:18 +02:00
689200ee74 Fix accessing windows from surfaces in Wayland
This is a follow up to [0], where it was assumed flushing the output
would run the appropriate leave handlers & clear the keyboard & pointer
surfaces. While that's mostly true it's not guaranteed.

Resolve this by clearing the pointers when closing windows and add NULL
checks before accessing the windows.

Tested with Gnome, KDE & River compositors.

[0]: 58ccd8338e
2022-07-26 14:25:18 +02:00
75a9146771 Cleanup: Remove outdated comments
Point clouds always use geometry_set_eval, and so do volumes.
2022-07-26 14:25:18 +02:00
836438277b Cleanup: Remove unnecessary includes from geometry nodes header 2022-07-26 14:25:18 +02:00
bb94d3e049 Curves: Avoid initializing offsets when first allocated
The offsets array that encodes the sizes of each curve must be filled
anyway, or the curves will be in an invalid state. Calloc is unnecessary
here. To make that situation clearer, fill the offsets with -1 in debug
builds. Always set the first offset to zero though, since that can save
some boilerplate in other areas.
2022-07-26 14:25:18 +02:00
2c2d1dba16 Fix: Incorrectly sized curves created in set conversion node
The number of points in the source curve was needed, but the offset
(just zero) was passed instead. It's unclear how this worked before.
A mistake in the recent commit 9e393fc2f1.

Also use a common utility for retrieving the sizes of curves
in ranges instead of reimplementing it for this file.
2022-07-26 14:25:18 +02:00
8bdd58efbd Cleanup: group public utility functions for Wayland System/Window
GHOST methods were mixed in with Wayland specific utility functions,
making it difficult to navigate or know where to add new functions.
2022-07-26 14:25:18 +02:00
0367c432e1 Cleanup: spelling in comments 2022-07-26 14:25:18 +02:00
acfabcc097 Cleanup: remove unused argument 2022-07-26 14:25:18 +02:00
480a2e4dd1 Fix: Correct attribute names in resample curves code 2022-07-26 14:25:18 +02:00
b8e40f944b Curves: Adjust "for each curve by type" utility
The first change is reusing the same vector for all types. While we don't
generally optimize for the multi-type case, it doesn't hurt here. The
second change is avoiding calling the corresponding function if there
are no curves of a certain type. This avoids creating attributes for
types that aren't used, for example.
2022-07-26 14:25:18 +02:00
39daae64a0 Cleanup: Add assert for customdata realloc size
This gives a more clear error than finding the error with the signed
to unsigned conversion for size_t.
2022-07-26 14:25:18 +02:00
38e555606d Cleanup: Add assert for unsupported legacy curve type 2022-07-26 14:25:18 +02:00
05977cbaf6 Cleanup: Remove duplicate include 2022-07-26 14:25:18 +02:00
0713c5042f Cleanup: Avoid assigning constructed VArray to reference
This is clearer about what is actually happening (VArray is small
enough to be a by-value type and is constructed on demand, while
only the generic virtual array is stored).
2022-07-26 14:25:18 +02:00
e264521981 Fix T99309: Duplicate elements deletes instance attributes
The node had incorrect handling of instance attributes. For the instance
component, instead of using the instance domain over the point domain,
it just looked through instances recursively when retrieving attributes.
We never want to do that, since we only work on one geometry at a time.
Instead, just switch out the instance domain for the point domain like
the set position node.
2022-07-26 14:25:18 +02:00
Gaia Clary
85cf2ad02a COLLADA: Support for alpha color in vertex data.
Many thanks to the original Author of this patch: Christian Aguilera

The COLLADA importer was silently ignoring the alpha component in the
vertex data.

The `stride` variable holds the component count (3 for RGB; 4 for RGBA),
and can be used for honouring the alpha channel in the vertex data.

Test plan:
- Open Blender.
- Clear the scene.
- Add a plane.
- Enter **Vertex Paint** mode.
- Switch to the **Erase Alpha** blending mode.
- Select a tone of gray.
- Turn strength down to less than 1
- Paint [some of] the vertices of the plane.
- Export project as a COLLADA file (`.dae`).
- Clear the scene.
- Re-import the COLLADA file again.
- Export the project again (with different name).

**Without** this patch, the second exported project will have lost the
alpha component in their vertex data:

```lang=xml, counterexample
<float_array id="Plane-mesh-colors-Col-array" count="24">1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1</float_array>
```

**With** the patch, the first and the second exported projects retain
the alpha values painted previously:

```lang=xml
<float_array id="Plane-mesh-colors-Col-array" count="24">1 1 1 1 1 1 1 0.5490196 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.5490196</float_array>
```

Reviewed By: cristian64, SonnyCampbell_Unity
Authored by: Christian Aguilera

Differential Revision: https://developer.blender.org/D14246
2022-07-26 14:25:18 +02:00
485f3967ad EEVEE-Next: Add Film and RenderBuffers module
This modules handles renderpasses allocation and filling. Also handles
blitting to viewport framebuffer and render result reading.

Changes against the old implementation:
- the filling of the renderpasses happens all at once requiring
  only 1 geometry pass.
- The filtering is optimized with weights precomputed on CPU and
  reuse of neighboor pixels.
- Only one accumulation buffer for renderpasses (no ping-pong).
- Accumulation happens in one pass for every passes using a single
  dispatch or fullscreen triangle pass.

TAA and history reprojection is not yet implemented.
AOVs support is present but with a 16 AOV limit for now.
Cryptomatte is not yet implemented.
2022-07-26 14:25:18 +02:00
91b9bcc28d Fix T90964: Strip can't be deleted if cursor is at bottom of timeline
Caused by hard-coded width of markers region causing operator to pass
through.

Execute operator if there are no markers.
2022-07-26 14:25:18 +02:00
1a7f06c238 Fix broken Cycles performance benchmark after recent logging changes
Ensure full render report is printed with default verbosity.
2022-07-26 14:25:18 +02:00
9374676b35 Fix build error with Alembic after 65166e145b 2022-07-26 14:25:18 +02:00
193b0e8a0c Fix pointer to pointer passed where single pointer is expected (VSE versioning) 2022-07-26 14:25:18 +02:00
aa17af826c Cleanup: Remove scene frame macros (CFRA et al.)
Removes the following macros for scene/render frame values:
- `CFRA`
- `SUBFRA`
- `SFRA`
- `EFRA`

These macros don't add much, other than saving a few characters when typing.
It's not immediately clear what they refer to, they just hide what they
actually access. Just be explicit and clear about that.
Plus these macros gave read and write access to the variables, so eyesores like
this would be done (eyesore because it looks like assigning to a constant):
```
CFRA = some_frame_nbr;
```

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D15311
2022-07-26 14:25:17 +02:00
0cac6169f2 Fix incorrect strip position if pitch was animated
Commit 302b04a5a3 introduced new retiming system, that unified sound
pitch animation with strip speed control. Because sound playback is
handled in different way, this did not work as expected and old files
were broken. In addition animation was not copied to new property.

Revert length position and offset handling for sound strips so their
position does not change and remap fcurves to new `speed_factor`
property.
2022-07-26 14:25:17 +02:00
Patrick Huang
3283c85e41 Fix T96429: outliner tooltip inconsistent with behavior when linking collections
Previously, it would show "Link inside collection" but move between collections
instead in some cases. Additionally there was no tooltip for the "Link before/
after/between collections" case.

Behavior and tooltip should now be consistent in all cases.

Differential Revision: https://developer.blender.org/D15237
2022-07-26 14:25:17 +02:00
41b260895c Cleanup: fix compiler warnings
"override" should be used either for all methods or none, otherwise Clang gives
warnings. Adding it for all platforms is a bigger change.
2022-07-26 14:25:17 +02:00
31c4adf931 Build: Fix build of library dependencies on Linux aarch64
rBb9c37608a9e959a896f5358d4ab3d3d001a70833 moved evaluation of
`versions.cmake` before `options.cmake`, as a result of which
`BLENDER_PLATFORM_ARM` was no longer defined in `versions.cmake`,
causing it to choose the wrong OpenSSL version for aarch64. This
reverts that. Also fixes a compiler crash when building flex with some
glibc versions.

Differential Revision: https://developer.blender.org/D15319
2022-07-26 14:25:17 +02:00
Andrii Symkin
7ebeae6dfb Cycles: add more math functions for float4
Add more math functions for float4 to make them on par with float3 ones. It
makes it possible to change the types of float3 variables to float4 without
additional work.

Differential Revision: https://developer.blender.org/D15318
2022-07-26 14:25:17 +02:00
d8ea9b456e Fix T99266: Crash when dragging file to VSE from file browser
Crash happened because sequencer data was not initialized. Ensure data
is initialized before adding strip.
2022-07-26 14:25:17 +02:00
a7947d4192 Cleanup: colon after params, move text into public doc-strings, spelling 2022-07-26 14:25:17 +02:00
1159c5d97a GHOST/Wayland: clarify window access from surfaces
It wasn't obvious when direct access or lookups should be used.

Add class methods for direct lookups as well as searching from known
windows when windows are accessed outside Wayland's handlers.

This avoids having to check if the window has been removed in some cases.
2022-07-26 14:25:17 +02:00
062cf8d0c1 GHOST/Wayland: use flush instead of roundtrip
Using flush avoids handling new events which complicates logic here.
2022-07-26 14:25:17 +02:00
ba7c44a55e Fix key/dnd event handling accessing freed memory under Wayland
Closing a window could leave danging pointers which Wayland
callbacks are responsible for clearing.

However, any calls Blender makes that don't originate from Wayland's
handlers don't have that assurance (key-repeat in this case).

Resolve by using a window lookup on each key-repeat event.
2022-07-26 14:25:17 +02:00
181e5d0d75 Fix accessing cursor position for GHOST/Wayland
GHOST_GetCursorPosition wasn't working properly under Wayland because
the last focused window didn't necessarily match the window used to call
wm_cursor_position_get(..).

Now the window passed into wm_cursor_position_get is passed to GHOST
so that window is used to access cursor coordinates.
2022-07-26 14:25:17 +02:00
67426ce95e GHOST: get/set cursor position now uses client instead of screen coords
Use client (window) relative coordinates for cursor position access,
this only moves the conversion from window-manager into GHOST,
(no functional changes).

This is needed for fix a bug in GHOST/Wayland which doesn't support
accessing absolute cursor coordinates & the window is needed to properly
access the cursor coordinates.

As it happens every caller to GHOST_GetCursorPosition was already making
the values window-relative, so there is little benefit in attempting to
workaround the problem on the Wayland side.

If needed the screen-space versions of functions can be exposed again.
2022-07-26 14:25:17 +02:00
6cfc094cc1 Fix memory leak with off-screen buffers under Wayland
Each off-screen buffer created a surface and EGL window which was
only freed when Blender exited.

Resolve by freeing the associated data when disposing the off-screen
context.
2022-07-26 14:25:17 +02:00
a8600bc684 Cleanup: declare GHOST/Wayland methods const
Needed when called by functions that are const too.
2022-07-26 14:25:17 +02:00
2f6e38aba9 Cleanup: use "use_" prefix for boolean property 2022-07-26 14:25:17 +02:00
7cfc9fb250 Fix missing argument, avoid instancing function call in macro 2022-07-26 14:25:17 +02:00
c53dfecf6a Fix T99133:animating multiply factor on video strips crashes blender
Crash caused by `effect_seq->len` being 0, so frame map was not built.

Get length in timeline using handle positions.
2022-07-26 14:25:17 +02:00
Amélie Fondevilla
9fc173f6a0 Animation: Add GP layers in regular Dopesheet
Grease Pencil animation channels are now also shown in the Dopesheet
mode of the Dopesheet editor and in the Timeline.

Grease pencil related events are now listened not only by container
`SACTCONT_GPENCIL` (Grease Pencil Dopesheet), but also
`SACTCONT_DOPESHEET` (main Dopesheet), and `SACTCONT_TIMELINE`
(timeline).

A new Animation Filter flag was added: `ANIMFILTER_FCURVESONLY`. For now
this only filters out Grease Pencil Layer channels.

**Implemented:**

- Preview range set: now only considers selected Grease Pencil keyframes
  when `onlySel` parameter is true. Not only this allows the operator to
  work with grease pencil keyframes in main dopesheet, but it also fixes
  the operator in the Grease Pencil dopesheet.
- Translation: allocation (and freeing) of specific memory for
  translation of Grease Pencil keyframes.
- Copy/Paste: call to both Fcurve and GPencil operators, to allow for
  mixed selection. Errors are only reported when both the FCurve and
  GPencil functions fail to paste anything.
- Keyframe Type change and Insert Keyframe: removed some code here to
  unify Grease Pencil dopesheet and main dopesheet code.

- Jump, Snap, Mirror, Select all/box/lasso/circle, Select left/right,
  Clickselect: account for Grease Pencil channels within the channels
  loop, no need for `ANIMFILTER_FCURVESONLY` there.

**Not Implemented:**

- Graph-related operators. The filter `ANIMFILTER_FCURVESONLY` is
  naively added to all graph-related operators, meaning more-or-less all
  operators that used `ANIMFILTER_CURVE_VISIBLE`.
- Select linked: is for F-curves channel only
- Select more/less: not yet implemented for grease pencil layers.
- Clean Keys, Sample, Extrapolation, Interpolation, Easing, and Handle
  type change: work on Fcurve-channels only, so the
  `ANIMFILTER_FCURVESONLY` filter is activated

Graying out these operators (when no fcurve keyframe is selected) can be
done with custom poll functions BUT may affect performance. This is NOT
done in this patch.

**Dopesheet Summary Selection:**

The main summary of the dopesheet now also takes into account Grease
Pencil keyframes, using some nasty copy/pasting of code, as explained
[on devtalk](https://devtalk.blender.org/t/gpencil-layers-integration-in-main-dopesheet-selection-issue/24527).
It works, but may be improved, providing some deeper changes.

Reviewed By: mendio, pepeland, sybren

Maniphest Tasks: T97477

Differential Revision: https://developer.blender.org/D15003
2022-07-26 14:25:17 +02:00
98927f5777 Curves: New tools for curves sculpt mode.
This commit contains various new features for curves sculpt mode
that have been developed in parallel.

* Selection:
  * Operator to select points/curves randomly.
  * Operator to select endpoints of curves.
  * Operator to grow/shrink an existing selection.
* New Brushes:
  * Pinch: Moves points towards the brush center.
  * Smooth: Makes individual curves straight without changing the root
    or tip position.
  * Puff: Makes curves stand up, aligning them with the surface normal.
  * Density: Add or remove curves to achieve a certain density defined
    by a minimum distance value.
  * Slide: Move root points on the surface.

Differential Revision: https://developer.blender.org/D15134
2022-07-26 14:25:17 +02:00
Nate Rupsis
3ef6baa875 Normalize Weights: use valid default Subset for current context
For the Normalize Weights operator, dynamically set the default 'Subset'
parameter so that it is applicable to the current context.

When the user's last use of Normalize Weights was set to "Deform Pose
Bones", and then tries to use the operator on a mesh without armature,
Blender would try to use the previous opertor properties and show an
error message. This is resolved by switching to `WT_VGROUP_ACTIVE` in
such cases.

Reviewed By: zanqdo, sybren

Maniphest Tasks: T95038

Differential Revision: https://developer.blender.org/D14961
2022-07-26 14:25:17 +02:00
6adf6dea04 Constraints: rename and refactor custom space initialization.
Rename and simplify the function for initializing the custom space,
avoiding the need for the calling code to be aware of the internals
of bConstraintOb. This patch should not change any behavior.

This was split off from D9732.

Differential Revision: https://developer.blender.org/D15252
2022-07-26 14:25:17 +02:00
973ac83de0 Fix numerical issues with plane track compositor node with empty input
No changes in the interface, but avoids spam in the console about
inability to find a solution for homography transform from singularity.
2022-07-26 14:25:17 +02:00
15286e1b62 Fix (unreported) liboverride resync creating garbage data in some cases.
Regression caused by the introduction of partial resync in February 2022
(rB1695d38989fd482d3c). Code was missing adding some existing overrides
to the mapping in some specific cases, causing resync to create 'new'
ones instead of re-using existing ones.

This commit also adds a basic resync testcase that illustrates this
issue.
2022-07-26 14:25:17 +02:00
4581b08a27 Revert "Revert "LibOverride: Handle dependencies in both directions in partial override cases.""
This reverts commit rB31d80ddeaad, and fixes issue introduced in rBf0b4aa5d59e3
by not doing the 'reversed dependency check' in resync case.

Rational here are:
* Supporting reversed dependency in a reliable, coinsistent way in
  resync is likely to be a nightmare, if even possible at all.
* Needs for such reversed dependency in resync should be close to 0% of
  cases, as long as users remain reasonable with their organization of
  their assets (it could only become a problem in extreme bad practice
  and corner cases, like a geometry object being added as a child of a
  rig in a completely new, otherwise un-overridden collection, in
  partial override context).

This decision may need to be re-evaluated later in case we go more
towards a very highly partial-override  workflow, but even then I would
expect current solution to work fine in all reasonable use cases.
2022-07-26 14:25:17 +02:00
a4eccd8b91 Fix T99290: Wrong color management of plane track image preview
Always consider images as "View as Render" for the plane track image drawing.
2022-07-26 14:25:17 +02:00
Iyad Ahmed
d801184956 Fix C++ STL importer unused function result warning
Fix unused function result warnings for usages of `fread` in the C++
.stl importer, by actually using the returned error code.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D15189
2022-07-26 14:25:17 +02:00
3a913899ba Fix T99196: sculpt_update_object calls paint updates for nonpaint tools
Specifically BKE_texpaint_slots_refresh_object was being called, which
causes cycles to reset at strange times (like moving the mouse cursor
in pose, boundary and various other tools).

This (along with some code that checks if the pbvh pixels need
to be rebuilt) is only run if is_paint_mode (which used to be
needs_colors) is true.
2022-07-26 14:25:17 +02:00
4cc030db08 Sculpt: Fix a few bugs revealed by SCULPT_TOOL_NEEDS_COLOR name change
* Color attributes are no longer auto-created when painting an image.
* Workbench shading type is no longer automatically changed to
  Attribute for image paint.
2022-07-26 14:25:17 +02:00
b22088fac3 Cleanup: Renamed SCULPT_TOOL_NEEDS_COLOR to SCULPT_tool_is_paint
Old name is confusing since SCULPT_TOOL_PAINT can paint
on images too, and it's planned for smear to as well.
2022-07-26 14:25:17 +02:00
111af04b5f Fix T98886: PBVH_GRIDS ignores face smooth flag on first gpu build 2022-07-26 14:25:17 +02:00
54c2e48571 Cleanup: format 2022-07-26 14:25:17 +02:00
817a1fc136 Cleanup: spelling in comments 2022-07-26 14:25:16 +02:00
3ca41d2fcc Cleanup: quiet warning, remove punctuation in description 2022-07-26 14:25:16 +02:00
32db66b843 Transform Snap: nearest face snap mode, snapping options, refactoring.
This commit adds a new face nearest snapping mode, adds new snapping
options, and (lightly) refactors code around snapping.

The new face nearest snapping mode will snap transformed geometry to the
nearest surface in world space. In contrast, the original face snapping
mode uses projection (raycasting) to snap source to target geometry.
Face snapping therefore only works with what is visible, while nearest
face snapping can snap geometry to occluded parts of the scene. This new
mode is critical for retopology work, where some of the target mesh
might be occluded (ex: sliding an edge loop that wraps around the
backside of target mesh).

The nearest face snapping mode has two options: "Snap to Same Target"
and "Face Nearest Steps". When the Snap to Same Object option is
enabled, the selected source geometry will stay near the target that it
is nearest before editing started, which prevents the source geometry
from snapping to other targets. The Face Nearest Steps divides the
overall transformation for each vertex into n smaller transformations,
then applies those n transformations with surface snapping interlacing
each step. This steps option handles transformations that cross U-shaped
targets better.

The new snapping options allow the artist to better control which target
objects (objects to which the edited geometry is snapped) are considered
when snapping. In particular, the only option for filtering target
objects was a "Project onto Self", which allowed the currently edited
mesh to be considered as a target. Now, the artist can choose any
combination of the following to be considered as a target: the active
object, any edited object that isn't active (see note below), any non-
edited object. Additionally, the artist has another snapping option to
exclude objects that are not selectable as potential targets.

The Snapping Options dropdown has been lightly reorganized to allow for
the additional options.

Included in this patch:

- Snap target selection is more controllable for artist with additional
  snapping options.
- Renamed a few of the snap-related functions to better reflect what
  they actually do now. For example, `applySnapping` implies that this
  handles the snapping, while `applyProject` implies something entirely
  different is done there. However, better names would be
  `applySnappingAsGroup` and `applySnappingIndividual`, respectively,
  where `applySnappingIndividual` previously only does Face snapping.
- Added an initial coordinate parameter to snapping functions so that
  the nearest target before transforming can be determined(for "Snap to
  Same Object"), and so the transformation can be broken into smaller
  steps (for "Face Nearest Steps").
- Separated the BVH Tree getter code from mesh/edit mesh to its own
  function to reduce code duplication.
- Added icon for nearest face snapping.
- The original "Project onto Self" was actually not correct! This option
  should be called "Project onto Active" instead, but that only matters
  when editing multiple meshes at the same time. This patch makes this
  change in the UI.

Reviewed By: Campbell Barton, Germano Cavalcante

Differential Revision: https://developer.blender.org/D14591
2022-07-26 14:25:16 +02:00
892379a616 Geometry Nodes: Only calculate mesh to volume bounds when necessary
In "size" voxel resolution mode, calculating the bounds of the mesh to
volume node's input mesh isn't necessary. For high poly this can take
a few milliseconds, so this commit skips the calculation unless we need
it for the "Amount" mode.

Differential Revision: https://developer.blender.org/D15324
2022-07-26 14:25:16 +02:00
Aleksi Juvani
84d0387add Geometry Nodes: UV Unwrap and Pack Islands Nodes
This commit adds new Unwrap and Pack Islands nodes, with equivalent
functionality to the existing Unwrap and Pack Islands operators. The
Unwrap node uses generic boolean attributes to determine seams instead
of looking at the seam flags in the mesh geometry.

Unlike the Unwrap operator, the Unwrap node doesn't perform aspect
ratio correction, because this is trivial for the user to implement
with a Vector Math node if it is desired.

The Unwrap node implicitly performs a Pack Islands operation upon
completion, because the results may not be generally useful otherwise.
This matches the behaviour of the Unwrap operator.

The nodes use the existing Vector socket type, and do not introduce a
new 2D Vector type (see T92765).

Differential Revision: https://developer.blender.org/D14389
2022-07-26 14:25:16 +02:00
Martijn Versteegh
39ce904aca Attributes: Use attribute renaming function for generic mesh layers
The RNA API in rna_mesh.c has a function to rename generic customdata
layers. However for customdata layers which are attributes (i.e. not
specialized types) the attribute renaming function needs to be used,
as that can ensure unique names across domains.

Differential Revision: https://developer.blender.org/D15310
2022-07-26 14:25:16 +02:00
45fe9139a8 Cleanup: Clang tidy, unused variable warning 2022-07-26 14:25:16 +02:00
8dc6ffe50f Geometry Nodes: Add Mesh To Volume Node
This adds a Mesh To Volume Node T86838 based on the existing modifier.
The mesh to volume conversion is implemented in the geometry module,
and shared between the node and the modifier.

Currently the node outputs a grid with the name "density". This may
change in the future depending on the decisions made in T91668.

The original patch was by Kris (@Metricity), further implementation
by Geramy Loveless (@GeramyLoveless), then finished by Erik Abrahamsson
(@erik85).

Differential Revision: https://developer.blender.org/D10895
2022-07-26 14:25:16 +02:00
cca41cb003 Spreadsheet: display byte colors as scene linear floats
The compression as sRGB is mostly an implementation detail and showing the
integers does not make it clear what the actual values are that will be used
for computations in geometry nodes. This follows the general convention that
colors in Blender are displayed and edited in scene linear floats.

The raw sRGB bytes can still be viewed as a tooltip.

Ref T99205

Differential Revision: https://developer.blender.org/D15322
2022-07-26 14:25:16 +02:00
3428e023d5 LineArt: Shadow and related functionalities.
This patch includes the full shadow functionality for LineArt:

- Light contour and cast shadow lines.
- Lit/shaded region selection.
- Enclosed light/shadow shape calculation.
- Silhouette/anti-silhouette selection.
- Intersection priority based on shadow edge identifier.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D15109
2022-07-26 14:25:16 +02:00
Arye Ramaty
a2331980bc UI: add tooltips for nodes to the shader node add menu
These are based on the descriptions from the manual, with various changes.

Differential Revision: https://developer.blender.org/D15309
2022-07-26 14:25:16 +02:00
bc6759a8ec Fix T99248: GPencil Sculpt Grab/Push don't work with one point
There were two problems:

1) The checking of the collision was not working with one point only.
2) For one point, the masking was checked always and if the masking was not activated, the stroke was skipped.
2022-07-26 14:25:16 +02:00
c20385445f Fix T98697: EEVEE: Regression: Missing custom property from volumetrics
The resource binding were missing from the shading group
(`shgroup->uniform_attrs`), leading to no custom property UBO creation
(`drw_uniform_attrs_pool_update`) when issuing the drawcall,
resulting in a missing UBO bind.

The fix make sure to no duplicate the bindings by creating a simple
shader bind instead of a `GPUMaterial` bind.

Candidate for 3.2.1 corrective release.
2022-07-26 14:25:16 +02:00
c777cb7a6b Fix T98825: EEVEE: Regression: Buffer overflow in sample name buffer
This happened because of the false assumption that `std::array<char, 32>`
would be treated as a container and not relocate their content if the
`Vector` would grow. Replacing with actual object allocation fixes the
issue.

Candidate for 3.2.1 corrective release.
2022-07-26 14:25:16 +02:00
ee0a860fb5 Fix T99104: EEVEE: Regression: Crash when using Light Output in Materials
Using Light output is supported in Cycles. This patch adds support for it
and remove the crash in `ntree_shader_weight_tree_invert()` by treating
it as any other outputs.

Candidate for 3.2.1 corrective release.
2022-07-26 14:25:16 +02:00
7ec3928c69 Fix T99128: EEVEE: Regression: Pixelated Environment Texture
Use view position to retreive world space direction to retain float
precision.

Candidate for 3.2.1 corrective release.
2022-07-26 14:25:16 +02:00
181747bf8d Fix T99138: EEVEE: Regression: World volume shader incorrect texture coords
The ORCO property was not being properly initialized in this case.

Candidate for 3.2.1 corrective release.
2022-07-26 14:25:16 +02:00
01af234f14 Cleanup: correct type for sequencer SWAP macro 2022-07-26 14:25:16 +02:00
566343714e Cycles: Add support for rendering on Intel GPUs using oneAPI
This patch adds a new Cycles device with similar functionality to the
existing GPU devices.  Kernel compilation and runtime interaction happen
via oneAPI DPC++ compiler and SYCL API.

This implementation is primarly focusing on Intel® Arc™ GPUs and other
future Intel GPUs.  The first supported drivers are 101.1660 on Windows
and 22.10.22597 on Linux.

The necessary tools for compilation are:
- A SYCL compiler such as oneAPI DPC++ compiler or
  https://github.com/intel/llvm
- Intel® oneAPI Level Zero which is used for low level device queries:
  https://github.com/oneapi-src/level-zero
- To optionally generate prebuilt graphics binaries: Intel® Graphics
  Compiler All are included in Linux precompiled libraries on svn:
  https://svn.blender.org/svnroot/bf-blender/trunk/lib The same goes for
  Windows precompiled binaries but for the graphics compiler, available
  as "Intel® Graphics Offline Compiler for OpenCL™ Code" from
  https://www.intel.com/content/www/us/en/developer/articles/tool/oneapi-standalone-components.html,
  for which path can be set as OCLOC_INSTALL_DIR.

Being based on the open SYCL standard, this implementation could also be
extended to run on other compatible non-Intel hardware in the future.

Reviewed By: sergey, brecht

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

Co-authored-by: Nikita Sirgienko <nikita.sirgienko@intel.com>
Co-authored-by: Stefan Werner <stefan.werner@intel.com>
2022-07-26 14:25:16 +02:00
d4ee6a6f6d VSE: Improved Retiming system
Patch implements better way to control playback speed than it is
possible to do with speed effect. Speed factor property can be set in
Time panel.

There are 2 layers of control:

Option to retime movie to match scene FPS rate.
Custom speed factor to control playback rate.
Since playback rate is strip property, it is now possible to manipulate
strip as normal one even if it is retimed.

To facilitate manipulation, some functions need to consider speed factor
and apply necessary corrections to strip offset or strip start. These
corrections may need to be float numbers, so start and offsets must be
float as well.

Sound strips now use speed factor instead of pitch. This means, that
strips will change length to match usable length. In addition, it is
possible to group movie and sound strip and change speed of meta strip.
2022-07-26 14:25:16 +02:00
3e0ba09d49 BLI: add Vector.append_and_get_index with rvalue parameter
This makes it possible to use this method with `std::unique_ptr`.
2022-07-26 14:25:16 +02:00
85d9ada983 Fix uninitialized memory use in key-down events on window activation 2022-07-26 14:25:16 +02:00
f5f5c53449 GHOST/Wayland: quiet warning with empty title with libdecor
Set the title before showing the window.
2022-07-26 14:25:16 +02:00
719cf931d3 GHOST/Wayland: support older output manager (for Weston support)
Support zxdg_output_manager_v1 v2, as weston only supports this.

Even though it's a reference implementation it can be useful for testing.
2022-07-26 14:25:16 +02:00
b8480221f6 Mantaflow: disable call to MANTA::terminateMantaflow
Effectively revert [0] as it ran when freeing individual modifiers,
causing a crash on exit in one of the cycles_volume_cpu tests.

[0]: 6777c420db
2022-07-26 14:25:16 +02:00
Jeroen Bakker
76cf20d756 Benchmark: Add eevee viewport playback tests.
This commit adds the ability to test Eevee viewport playback performance tests.

Tests should be placed in `lib/benchmarks/eevee/*/*.blend`. {rBL62962} added
initial test files. See https://wiki.blender.org/wiki/Tools/Tests/Performance how
to set it up.

To record the playback performance the test start the viewport playback, and adds
a post frame change handler.

This handler will go over the next steps:

* Ensures the viewport is set to rendered mode.
* Wait for shaders to be compiled. Utilizes `bpy.app.is_job_running` function when
  available (v3.3) to wait for shader compilation to finish. When not available will wait
  for one minute.
* Draw several warmup frames
* Record for 10 seconds tracking the number of frames drawn and performance counters.
* When ready print the result to the console. The results will be extracted when the
  benchmark has run.

## Example report
```
                                         master               v3.0                 v3.1                 v3.2
T88219                                   0.0860s              0.0744s              0.0744s              0.0851s
blender290-fox                           1.3056s              0.8744s              0.7994s              1.2809s
```

{F13232387}

Reviewed By: brecht, fclem

Maniphest Tasks: T99136

Differential Revision: https://developer.blender.org/D15302
2022-07-26 14:25:16 +02:00
dbe74589b3 Sculpt: Fix backwards normals in PBVH_GRIDS raycasting
Winding order of grid quads was backwards.
2022-07-26 14:25:16 +02:00
7970285769 Fix T99231: Wrong anchored mode test for smear brush 2022-07-26 14:25:15 +02:00
4b846a6a5c Cleanup(UV): Remove unused parameter (no functional changes)
Prep for D15263
2022-07-26 14:25:15 +02:00
21acce0012 Cleanup(UV): Store nboundaries on pchart (no functional changes)
Prep for D15263
2022-07-26 14:25:15 +02:00
23d76a4d2c Cleanup: format 2022-07-26 14:25:15 +02:00
c60812f894 Cleanup: Fix mul_v2_v2_ccw for repeated arguments (no functional changes)
Prep for D15263
2022-07-26 14:25:15 +02:00
b109fc2790 Mantaflow: call MANTA::terminateMantaflow on exit
terminateMantaflow was never called, this leak is more of a technicality
since it's only called on exit.

Also make Py_Initialize/Py_Finalize optional in Pd:setup/finalize
as it caused Blender to crash, finalizing Python twice.

Add a patch to extern/mantaflow to keep track of changes in Blender
from up-stream.
2022-07-26 14:25:15 +02:00
0f8678f53d Cleanup: update curve_fit_nd (no functional changes) 2022-07-26 14:25:15 +02:00
211a2d7a95 Cleanup: spelling in comments 2022-07-26 14:25:15 +02:00
0193a46d38 Fix T78394: In UV Editor, UV Unwrap respects selection
Differential Revision: D14945
2022-07-26 14:25:15 +02:00
1d3c9af64d Fix: Use distance unit for points node radius input 2022-07-26 14:25:15 +02:00
805f2322a6 Fix: Flush mode to evaluated object when exiting curves sculpt mode
Tagging the object for copy on write in order to change the mode on the
evaluated object was already done when entering sculpt mode, it should
happen when exiting sculpt mode as well.

Also use the message system to tag updates of the mode property.
This is commonly done for other "mode switch" operators. It's
best to be consistent here, though I don't know that lacking that
caused any issues.
2022-07-26 14:25:15 +02:00
Siddhartha Jejurkar
47c969ccc6 Fix T98924: Skip saving selection properties for UV edge ring operator
Oversight in rB7724251af81f. Skip saving selection properties
for UV edge ring operator as it allows the operator to re-use
the value that was previously set using the key-map.

Reviewed By: campbellbarton

Maniphest Tasks: T98924

Differential Revision: https://developer.blender.org/D15214
2022-07-26 14:25:15 +02:00
9e35f46239 Fix Cycles assert with mix weights outside of 0..1 range
This could result in wrong skipping of SVM nodes in the graph. Now make the
logic consistent with the clamping in the OSL implementation and constant
folding.

Thanks to Christophe Hery for finding the problem and providing the fix.
2022-07-26 14:25:15 +02:00
af6d909513 UI: Unhide the world mist panel if the mist pass is not enabled
This makes no sense to hide it since we can nowadays preview it inside the
viewport even if the render pass is not enabled.
2022-07-26 14:25:15 +02:00
e4713b2d31 DRW: Curve: Fix wrong UBO alignment
This was preventing correct attribute rendering with multiple attributes.
Since the `CurveInfos` struct is used for data sharing between C++ and
GLSL and inside a UBO it needs to obey the `std140` alignment rules which
states that arrays of scalars are padded to the size of `vec4` for each
array entry.
2022-07-26 14:25:15 +02:00
da4acb7ddd Cleanup: GPUShader: Fix missing space in debug message 2022-07-26 14:25:15 +02:00
f7b81c42e7 Cleanup: DRW: Fix misnamed argument and add more info in a function doc 2022-07-26 14:25:15 +02:00
Sayak Biswas
ec684cea2f Cycles: enable Vega GPU/APU support
Enables Vega and Vega II GPUs as well as Vega APU, using changes in HIP code
to support 64-bit waves and a new HIP SDK version.

Tested with Radeon WX9100, Radeon VII GPUs and Ryzen 7 PRO 5850U with Radeon
Graphics APU.

Ref T96740, T91571

Differential Revision: https://developer.blender.org/D15242
2022-07-26 14:25:15 +02:00
06a4a8d366 Fix T98882: Regression: Gradient colors in a Grease Pencil material change depending on the visibility of other objects
The material ID was being wrongly passed in the shader.
2022-07-26 14:25:15 +02:00
ab1a14ad8a Build: add HIP version to buildbot configuration 2022-07-26 14:25:15 +02:00
Christian Rauch
661a15ee1c Build: when using Wayland, always enable EGL and disable system GLEW
GLEW does not support GLX and EGL at the same time, and the distribution version
is likely to have GLX.

This also refactors the code so all OpenGL related CMake options are together.

Differential Revision: https://developer.blender.org/D12034
2022-07-26 14:25:15 +02:00
3be497bf1b Py API Doc: add runtime changelog generation to sphinx_doc_gen.py.
Optionally use `sphinx_changelog_gen.py` to dump current version of the
API in a JSON file, and use closest previous one listed in given index
file to create a changelog RST page for Sphinx.

Part of {T97663}.
2022-07-26 14:25:15 +02:00
152b161252 Py API Doc: refactor changelog generation script.
Main change is to make it use JSON format for its dump files, instead of
some Python code.

It also introduces an index for those API dump files, mapping a blender
version to the relevant file path.

This is then used to automatically the most recent (version-number wise)
previous API dump to compare against current one, when generating the
change log RST file.

Part of {T97663}.
2022-07-26 14:25:15 +02:00
3a4ac6f062 Fix frame_final_start/end strip property not setting handle position
This was a mistake in 17a773cdce - I did not notice existing set
function and assumed, that property set DNA directly.

Both get and set functions are now available and readonly flag is
removed.
2022-07-26 14:25:15 +02:00
0d56d4b242 Build: remove GLEW version checking from install_deps.sh
Latest OpenSubdiv builds without GLEW by default, which is also what we do
for precompiled libraries. So there is no need for compatibility checking
with system GLEW.

Additionally WITH_SYSTEM_GLEW is turned off by default for Blender, and this
logic was presumably added when it was still on by default a few years ago.

Also remove outdated mention of glew-mx, we use intern/glew-mx and no
external library for this.

Differential Revision: https://developer.blender.org/D15281
2022-07-26 14:25:15 +02:00
luzpaz
1f86853ac8 Cleanup: fix various typos
Differential Revision: https://developer.blender.org/D15304
2022-07-26 14:25:15 +02:00
9fe3652c11 Install_deps: Fix several issues with TBB.
* TBB MEX version is now 2021, since this versin introduces 'oneTBB'
  which brings a lot of incompatibilities with previous versions.
* Fix several typos and mistakes in OSD, Embree and OIDN build code that
  prevented proper usage of a local TBB build.
2022-07-26 14:25:15 +02:00
e4d9a00d7a Fix: sampling points on mesh surface generates too many points 2022-07-26 14:25:15 +02:00
2078ab308d BLI: add kdtree range search method that accepts c++ lambda
This is easier to use in C++ code compared to passing a function
and user-data separately.
2022-07-26 14:25:15 +02:00
6833f51a64 Mask editor: Always use smooth drawing
The mask is expected to be always be displayed smooth, and the
option mainly existed for some legacy drivers. IF smooth drawing
causes issues it should be fixed in the drawing code, not as an
option in the interface.

Differential Revision: https://developer.blender.org/D15266
2022-07-26 14:25:15 +02:00
c1f7990a26 Cleanup: Remove redundant theme versioning code
Since we reset the default theme for the 3.0 release, we don't need to
keep these version patches around anymore.

Ref D13131
2022-07-26 14:25:15 +02:00
86268206bf Fix T98799: camera unselectable in camera view below a certain scale
The camera frame (used for selection) was drawn outside the near
clipping plane in those cases.

This has been an issue before as seen in the following commits:
- rB6e7e6832e87
- rB33d322873e6
- rB4f9451c0442

Remaining issue was that the code which ensure the frame isn't behind
the near clipping plane was not taking into account the camera could be
scaled (in Z).
A caller of `BKE_camera_view_frame_ex` (namely
`OVERLAY_camera_cache_populate`) applies scale (also on the depth) which
does not play well with the way `BKE_camera_view_frame_ex` did it.

Now take Z scale into account.

Ref D15178
2022-07-26 14:25:15 +02:00
Red Mser
6453636203 Fix textview selection rendering in front of text
Selection of Python Console renders in front of the text.
Since the default theme uses a low opacity selection color,
it isn't obvious, but increasing alpha to 100% shows it clearly.

Ref D13111
2022-07-26 14:25:15 +02:00
08a89b6ea7 Cleanup: replace magic number with define for scan-code/key-code offset 2022-07-26 14:25:15 +02:00
c0e4006c8c GHOST/Wayland: avoid creating a keyboard-state each key press/release
Instead, create keyboard two states when the keyboard layout is set
(one with & one without num-lock pressed).
This avoids key-press lookups having to check if num-lock exists and
setting the keyboard state for key press & release events.

No functional changes.
2022-07-26 14:25:15 +02:00
1518c87b79 Fix T96170: keys mis-mapped with NeoQwertz layout under Wayland
Accessing the symbols for keys with no modifiers & num-lock enabled
has unintended consequences for some keyboard layouts that use this
to switch layers.

Resolve by restricting num-locked lookups to keys typically toggled
with num-lock (key-pad home, page up/down ... etc).
2022-07-26 14:25:15 +02:00
8018e9df79 Cleanup: group wayland event codes in their own doxy section
Also don't pass typedef'd ints as references.
2022-07-26 14:25:14 +02:00
8381de1e30 Fix T99202: AccentGrave key doesn't work with Wayland
Implement scan-code fallback when the scan-code used for AccentGrave
on US keyboards doesn't map to a key known to GHOST.

Without this, shortcuts that use AccentGrave are inaccessible and the
key does nothing.

This matches functionality from X11, see [0].

[0]: f3427cbc98
2022-07-26 14:25:14 +02:00
Keith Boshoff
57ecc9642c UI: add Custom properties panel to collections
Show a custom properties panel in the collections tab,
matching other data-blocks which already support this.

Reviewed by: HooglyBoogly, campbellbarton

Ref D12598
2022-07-26 14:25:14 +02:00
f142406d39 GHOST: only use GHOST_PRINT when WITH_GHOST_DEBUG is enabled
Revert part of [0] so only assert behavior is changed.

[0]: 9b5dda3b07
2022-07-26 14:25:14 +02:00
b1357a5bf0 Cleanup: compiler warnings, remove unused functions 2022-07-26 14:25:14 +02:00
d2286bcd61 Fix T99156: UV parameterizer respects both Pins and Seams
Rgression from: e6e9f1ac5a

Reviewed By: Brecht Van Lommel

Differential Revision: D15292
2022-07-26 14:25:14 +02:00
09de9dc18a Fix T96776: Assets dropped upside down when looking through camera
In perspective mode the snap point direction needs to be taken into
account to define which side of the face is being looked at.

If there is no face under the mouse cursor, there is no direction
adjustment and the element normal will be used.
2022-07-26 14:25:14 +02:00
d82236b43a Fix T99216: RNA startdisp and enddisp return unreliable values
Since 7afcfe111a `startdisp` and `enddisp` fields are used as runtime
position storage for effect strips exclusively.

Use getter functon to return handle position and make properties read
only.
2022-07-26 14:25:14 +02:00
8d1b5168b8 Fix error in previous commit - missed include 2022-07-26 14:25:14 +02:00
c3035d10f1 Fix meta strip has incorrect range when created
Caused by using `startdisp` and `enddisp` to initialize range.
Use handle position instead.
2022-07-26 14:25:14 +02:00
Germano Cavalcante
80248b4b5c Fix T84369: Fluid: Missing cache invalidation when properties on non-domain objects change
The `DEG_OB_COMP_TRANSFORM` and `DEG_OB_COMP_GEOMETRY` relations between
the **Domain** object and the **Flow**, **Effector** and **Force Field** objects
are added in the `updateDepsgraph` callback of the Fluid modifier, more
specifically in `DEG_add_collision_relations`.

The node linked to these components is the `POINT_CACHE` whose assigned
function is `BKE_ptcache_object_reset`.

So include the `eModifierType_Fluid` modifier in outdated cache checks.

Reviewed By: sergey, zeddb

Maniphest Tasks: T84369

Differential Revision: https://developer.blender.org/D15210
2022-07-26 14:25:14 +02:00
144b439dc8 Sculpt: Fix backwards normals in PBVH_GRIDS raycasting
Winding order of grid quads was backwards.
2022-07-26 14:25:14 +02:00
f0202da3d1 BLI: Math: Add ceil_to_multiple_u()
Standalone version of a function added to `BLI_math_vector.hh`.
2022-07-26 14:25:14 +02:00
Félix
fee1292901 VSE: Add API function to select displayed meta strip
Use function `sequence_editor.display_stack(meta_strip)` to set
displayed timeline content.

To view top-level timeline, that does not belong to any meta strip, pass
`None` as argument.

Differential Revision: https://developer.blender.org/D12048
2022-07-26 14:25:14 +02:00
b1e97c8ae3 Fix broken build on macOS after recent changes 2022-07-26 14:25:14 +02:00
24fe186977 FFmpeg: Add VFR media support
Variable frame rate (VFR) files have been difficult to work with.
This is because during sequential decoding, spacing between frames is
not always equal, but it was assumed to be equal. This can result in
movie getting out of sync with sound and difference between preview and
rendered image. A way to resolve these issues was to build and use
timecodes which is quite lengthy and resource intensive process. Such
issues are also difficult to communicate through UI because it is not
possible to predict if timecode usage would be needed.

With this patch, double buffer is used to keep previously decoded frame.
If current frame has PTS greater than what we are looking for, it is not
time to display it yet, and previous frame is displayed instead.

Each `AVFrame` has information about it's duration, so in theory double
buffering would not be needed, but in practice this information is
unreliable.

To ensure double buffer is always used, function
`ffmpeg_decode_video_frame_scan` is used for sequential decoding, even
if no scanning is expected.

This approach is similar to D6392, but this implementation does not
require seeking so it is much faster. Currently `AVFrame` is only
referenced, so no data is copied and therefore no overhead is added.

Note: There is one known issue where seeking fails even with double
buffering: Some files may seek too far in stream and miss requested
PTS. These require preseeking or greater negative subframe offset

Fixes: T86361, T72347

Reviewed By: zeddb, sergey

Differential Revision: https://developer.blender.org/D13583
2022-07-26 14:25:14 +02:00
eee7dbb3d6 File Browser UI: Use "Widget" font style instead of "Widget Label"
It didn't make much sense to use the "Widget Label" font style here,
since this is just regular text, not labels for widgets. Checked with
@pablovazquez and we agreed on using the "Widget" font style instead.

Also fixes a mismatch where we used the "Widget Label" font style for
drawing, but the "Widget" font style for string width calculations.
Fixes T99207.
2022-07-26 14:25:14 +02:00
Sonny Campbell
aec6ee41a6 Fix T98055: Library Filters do not work in Source Files
The fix is to ensure the filter for id type is run when displaying
assets from an Asset Library.

In the current implementation the id_type filter does not run if a blend
file is opened that also happens to be in an Asset Library directory. If
we have opened a blend file that is in an Asset Library directory, we
now use the same filtering check as for the "Current File" asset
library.

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

Reviewed by: Julian Eisel
2022-07-26 14:25:14 +02:00
43e4c206d7 UI: Scrollbar Behavior Changes
Changes to scrollbars so that they are always visible, but thin and
dim, and widen and become more visible as your mouse approaches.

See D6505 for details and examples.

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

Reviewed by Campbell Barton
2022-07-26 14:25:14 +02:00
Pratik Borhade
84adea3bee Fix T99070: Apply transform fails to clear delta transform values
Clear delta transform value after applying transform.
Include delta location while applying transform.
Use `copy_v3_fl` for resetting object scale

Reviewed By: mano-wii

Maniphest Tasks: T99070

Differential Revision: https://developer.blender.org/D15270
2022-07-26 14:25:14 +02:00
de4be47a86 Cleanup: Use assert instead of early exit for asset dragging internals
Instead of failing silently, throw a failed assert in debug builds.
2022-07-26 14:25:14 +02:00
702909398a Fix T93650: Asset drag into catalogs broken, Industry Compatible keymap
Issue was that the Industry Compatible keymap wouldn't select files on a
mouse press, and since the dragged items are determined by the
selection, nothing would be considered as dragged.

Selecting items on mouse press happens since c606044157. I haven't
heard of that issue happening in the Industry Compatible keymap. But if
it did happen, it should be fixed too now.
2022-07-26 14:25:14 +02:00
8ac0777af5 Revert 6de0f29950: BLF: Support for Variable Fonts
Reverting for now, breaks on GCC
2022-07-26 14:25:14 +02:00
93862a319b BLF: Add Support for Variable Fonts
Add support for Variable/Multiple Master font features. These are fonts
that contain a range of design variations along multiple axes. This
contains no client-facing options.

See D12977 for details and examples

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

Reviewed by Brecht Van Lommel
2022-07-26 14:25:14 +02:00
dce2544350 Fix T99171: Crash in mesh vertices positions RNA update function
Solution found by Philipp Oeser (@lichtwerk), thanks.
2022-07-26 14:25:14 +02:00
fa188382a2 Cleanup: remove redundant RNA_struct_property_is_set check
This dates back to [0] from before PROP_SKIP_SAVE existed.
While harmless it's confusing why only one option uses this check.

[0]: ff83a98a07
2022-07-26 14:25:14 +02:00
c2aa80b571 Cleanup: DRW: Remove drw_view renaming MACROS 2022-07-26 14:25:14 +02:00
d41f86c55a Fix color attribute interpolation with GPU subdivision
Handling of 16-bits compression was missing, which gave values that were
way off.
2022-07-26 14:25:14 +02:00
5c6a65d1a3 Cleanup: rename misleading/inconsistent GHOST types
Remove mask suffix from:
- GHOST_TButtonMask
- GHOST_TModifierKeyMask
.. neither are used as bit-masks.

Remove 'Grab' from:
- GHOST_kGrabAxisNone
- GHOST_kGrabAxisY
.. matching the existing GHOST_TAxisFlag & GHOST_kAxisX.
2022-07-26 14:25:14 +02:00
9cf6c2acb8 Cleanup: format 2022-07-26 14:25:14 +02:00
Jason Fielder
19873e6ecb MTLCommandBufferState for coordinating GPU workload submission and render pass coordination.
MTLFrameBuffer has been implemented to support creation of RenderCommandEncoders, along with supporting functionality in the Metal Context.

Optimisation stubs for GPU_framebuffer_bind_ext has been added, which enables specific assignment of attachment load-store ops at the bind level, rather than on a framebuffer object as a whole.

Begin and end frame markers are used to encapsulate frame boundaries for explicit workload submission. This is required for explicit APIs where implicit flushing of work does not occur.

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D15027
2022-07-26 14:25:14 +02:00
b30a41f140 Cleanup: spelling in comments 2022-07-26 14:25:14 +02:00
98272fef62 Cleanup: remove redundant has key checks 2022-07-26 14:25:14 +02:00
77a7445aa2 UI: define category for the dope-sheet properties panel
Caused warning on startup, missing from [0].

[0]: 57816a6435
2022-07-26 14:25:13 +02:00
4e75bb0290 Fix T99178: Console warning using search (F3) in grease pencil draw mode
The preview data was not available in this context and need to be checked to avoid the warning.
2022-07-26 14:25:13 +02:00
51a5606e8a GHOST/Wayland: Add a build time option for DBUS, disable by default
Add WITH_GHOST_WAYLAND_DBUS option, so Blender can be built without
DBUS support. Currently it's only used to access the cursor theme.
Without this the "default" cursors are used instead.

Disabling this since it adds an additional dependency for a minor gain
in functionality, with the benefit of removing a library requirement.

There is also a problem where Blender hangs on startup for ~5 seconds
when DBUS isn't running. Eventually it would be good to be able to avoid
this problem without a build option.
2022-07-26 14:25:13 +02:00
b716f5f094 GHOST/Wayland: set the minimum window size with libdecor 2022-07-26 14:25:13 +02:00
4b09571f43 GHOST/Wayland: split pointer/tablet state into separate structs
For Wayland the mouse & tablet are separate devices with their
own location, button-pressed state and focused window.
Split internal state storage so they're separate.

Also track mouse button press/release state without needing focused
windows.
2022-07-26 14:25:13 +02:00
3e9f795014 Fix T98673: Color attribute fill API didn't support editmode 2022-07-26 14:25:13 +02:00
13375e569e Fix T99100: Undo/redo bugs with paint and gravity
You can now push multiple sculpt undo nodes
of different types.  This is necassary to handle
paint tools that have gravity enabled.
2022-07-26 14:25:13 +02:00
b02de1a021 Cleanup (UV): Remove unused variable do_aspect 2022-07-26 14:25:13 +02:00
eaa1241cc7 Fix T99182: Hard code screen_scale for circle drawing in 3D 2022-07-26 14:25:13 +02:00
78ec7dc5ab Curves: Port string to curves node to the new data-block
Use the conversion implemented in 5606942c63.
2022-07-26 14:25:13 +02:00
7363f80151 Cleanup: Clang tidy 2022-07-26 14:25:13 +02:00
62e941bf33 Functions: improve span buffer reuse in procedure execution
This potentially overallocates buffers so that they are usable
for more data types, which allows buffers to be reused more
easily. That leads to fewer separate allocations and improved
cache usage (in one of my test files the number of separate
allocations went down from 1826 to 1555).
2022-07-26 14:25:13 +02:00
0b75392e88 BLI: improve support for trivial virtual arrays
This commits reduces the number of function calls through function
pointers in `blender::Any` when the stored type is trivial.

Furthermore, this implements marks some classes as trivial, which
we know are trivial but the compiler does not (the standard currently
says that any class with a virtual destructor is non-trivial). Under some
circumstances we know that final child classes are trivial though.
This allows for some optimizations.

Also see https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1077r0.html.
2022-07-26 14:25:13 +02:00
873c58de17 Fix: crash when converting zero legacy curves
The issue was that the "radius" lookup below fails, because there is no
curve data. Arguably, it should be possible to add attributes even when
there is no data. However, the rules for that are a bit loose currently.
A simple fix is to just not run the conversion code when there is nothing
to convert.
2022-07-26 14:25:13 +02:00
9015d1188c Functions: avoid using Map for small values
This leads to a 5-10% performance improvement in my benchmark
that runs a procedure many times on a single element.
2022-07-26 14:25:13 +02:00
922e6bd0b7 Geometry Nodes: Field on Domain Node
As described in T98943, this commit adds a node that can
evaluate a field on a separate domain in a larger field context.
This is potentially useful in many cases, to avoid relying on
a separate capture attribute node, which can make it easier
to build reusable fields that don't need geometry inputs.

Internally, the node just evaluates the input field in the larger
field context and then uses the generic domain interpolation,
so the code is simple. One future optimization might be using
the input selection to only evaluate part of the input field, but
then the selection has to be interpolated as well, and that might
not always be worth it.

Differential Revision: https://developer.blender.org/D15289
2022-07-26 14:25:13 +02:00
84114780f6 Curves: Skip CurveEval in legacy curve conversion
Currently when converting from the legacy curve type to the new type,
which happens during evaluation of every legacy curve object, the
`CurveEval` type is used as an intermediate step. This involves
copying all data twice, and allocating a bunch of temporary arrays.
It's also another use of `CurveEval` that has to be removed before
we remove the type.

The main user difference besides the subtlety described below
will be improved performance.

**Invalid Handles and Types**
One important note is that there are two cases (that I know of)
where handles and handle types can be invalid in the old curve
type. The first is animation, where animated handle positions don't
necessary respect the types. The second is control points with a
single aligned handle that didn't necessarily align with the other.

In master (partially on purpose) the code corrects the first situation
(which caused T98965). But it doesn't correct the second situation.
It's trivial to correct for the second case with this patch (because of the
eager calculation decided on in D14464), but this patch makes the choice
not to correct for //either//.

Though not correcting the handle types puts curves in an invalid state,
it also adds flexibility by allowing that option. Users must understand
that any deformation may correct invalid handles.

Fixes T98965

Differential Revision: https://developer.blender.org/D15290
2022-07-26 14:25:13 +02:00
73bfdbab6b Cleanup: add missing override 2022-07-26 14:25:13 +02:00
ad02bf8173 BLI: improve check for common virtual array implementations
This reduces the amount of code, and improves performance a bit by
doing more with less virtual method calls.

Differential Revision: https://developer.blender.org/D15293
2022-07-26 14:25:13 +02:00
d6b16f444e Geometry Nodes: Add Points Node
This node takes a point count,a vector field, and float field and creates
a pointcloud with n points at the positions indicated in the vector
field with the radii specified in the float field.The node is placed in
the "Point" menu.

Differential Revision: https://developer.blender.org/D13920
Maniphest Task: https://developer.blender.org/T93044
2022-07-26 14:25:13 +02:00
f7f40d5c26 Fix T98949: Deleting vertex group in geometry nodes affects others
The vertex group indices stored in the weights need to be accounted for
when the vertex group list on the mesh changes.
2022-07-26 14:25:13 +02:00
8262f28293 Cleanup: Remove unused argument 2022-07-26 14:25:13 +02:00
7dd0558d94 Fix: Incorrect dirty normal tag after mesh translation
Mistake in 54182e4925. The dirty flag was always cleared,
but we only want to clear it after translating a mesh if it normals
were already non-dirty.
2022-07-26 14:25:13 +02:00
04beca354a Cleanup: Remove unnecessary includes 2022-07-26 14:25:13 +02:00
79603b6244 Fix T99058: geometry nodes ignore if subdivision surface modifier is disabled
It was looking up the last modifier in the stack, ignoring visibility, instead
of mesh->runtime.subsurf_runtime_data set by the modifier evaluation and used by
the drawing code.
2022-07-26 14:25:13 +02:00
bf67be8e05 Cycles: stop Metal rendering on command buffer error
If there is an error we should stop rendering, instead of finishing with a
wrong render result or reporting a wrong benchmark time.

Ref T96519

Differential Revision: https://developer.blender.org/D15287
2022-07-26 14:25:13 +02:00
Christian Rauch
a8d879c9cd GHOST/Wayland: support client-side window decorations
This implements client-side window decorations for moving and resizing
windows and HiDPI support.

This functionality depends on the external project 'libdecor' that is
currently a build option: WITH_GHOST_WAYLAND_LIBDECOR.

Reviewed by: brecht, campbellbarton

Ref D7989
2022-07-26 14:25:13 +02:00
6265afbc00 Fix T99130: Spline factor gets messed up if one hair is too short
In the cases where length is zero, we simply equally distribute the
value based on the control point/curve index.

Differential Revision: https://developer.blender.org/D15285
2022-07-26 14:25:13 +02:00
4fbfbfc7b6 Fix T98427: Crash adding quick effects smoke from Python
Manta flow used the `__main__` namespace which it was executed in,
this caused a bug when calculating fluid from Python, which clears
it's `__main__` name-space after execution.
This caused Manta-flows name space to be cleared too.

Resolve this by creating a separate name-space for manta-flow.

Reviewed by: SonnyCampbell_Unity

Ref D15269
2022-07-26 14:25:13 +02:00
5f7859545f PyAPI: Expose event.type_prev, value_prev
Before [0] mouse-motion events left the 'event.value' un-changed,
so a mouse-move would be set to PRESS/RELEASE based on previous events.

Support accessing the previous event value directly
to address feedback from T99102.

Note that the previous cursor location is already exposed.

[0]: 52af3b20d4
2022-07-26 14:25:13 +02:00
a14999e6cb Fix T99037: bpy.ops.transform.rotate fails in background mode
This reverts commit c503c5f756,
alternate fix for T82244.

Scripts that run in background mode expected rotation to be usable,
defaulting to the 3D viewport when there is no active windowing data.

Also resolves T88610.
2022-07-26 14:25:13 +02:00
12eba8867c Workbench: Increase render tests fail threshold for hair.
When running the render test cases on MacOS/Intel the hair render
test fail. Most likely due to the dense geometry and the low
resolution of the test image.

This patch increases the fail threshold so these tests will pass.
Note that I haven't been able to test whether this is also the case
for Linux/Windows. If that is the case we should remove the platform
specific test.
2022-07-26 14:25:13 +02:00
Jeroen Bakker
ef2844202d Test/Eevee: Increase failure threshold for image tests.
Makes the current test cases pass on NVIDIA 1080Ti/515.
The tests still fail on other platforms (AMD, Intel). Some are actual failures.
Other require platform specific reference images.

Original patch provided by Brecht van Lommel.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15264
2022-07-26 14:25:13 +02:00
51ea30e3bb Fix T99129: Eevee Hair Info Length not working (old particle hair).
When using the old particle hair with the hair info length it wasn't
working with AMD GPUs. The reason was that the drw_curves uniform buffer
wasn't initialized what made the shader select the incorrect length.
2022-07-26 14:25:13 +02:00
0d700d0711 Cleanup: Fix building warnings on gcc 9.4.0
Solution by Jacques Lucke
2022-07-26 14:25:13 +02:00
45851b9052 Fix T98925: Editor panels are broken
Commit 277fa2f441 added channels region to unintended editors if sequencer was
used in area. This caused issues with some editors having 2 tool regions and
non functioning side panel.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D15253
2022-07-26 14:25:13 +02:00
aaf0445fef GHOST/Wayland: support for cursor warp with hidden/wrapped grab enabled
As grab already uses it's own virtual coordinates, cursor warping can
be used when grab is enabled.

Currently nothing depends on this however it could be useful in future.
2022-07-26 14:25:13 +02:00
0bc055f74d Cleanup: remove unused function WM_cursor_compatible_xy 2022-07-26 14:25:12 +02:00
675c3109a9 Fix T99021: Walk-mode doesn't work in Wayland
Walk mode implemented it's own grab which relied on WM_cursor_warp
to work (which isn't implemented for wayland).

Resolve this by using WM_cursor_grab_{enable/disable}.

Besides fixing Wayland this removes the need for workarounds:

- Ensure the event received were after the event generated from warping.
- Alternate logic that reset the "center" when using tablets.
- Checking the cursor location was scaled by native-pixels on macOS.

There is a minor change in behavior: on completion the cursor is left
at the location walk-mode began instead of the center of the region.
2022-07-26 14:25:12 +02:00
055026f490 Cleanup: add C++ compatible WL_ARRAY_FOR_EACH macro 2022-07-26 14:25:12 +02:00
107a558c18 Cleanup: remove unused cursor struct members in GHOST/Wayland 2022-07-26 14:25:12 +02:00
136abf74eb Cleanup: use const arguments for GHOST/Wayland 2022-07-26 14:25:12 +02:00
34cd6ad94a GHOST: use GHOST_ASSERT for non-release builds
GHOST_ASSERT now matches BLI_assert, which is only ignored for release
builds. Otherwise it prints or asserts when WITH_ASSERT_ABORT is enabled.
2022-07-26 14:25:12 +02:00
709fdff75a Docs: correct GHOST_TimerProcPtr time doc-string 2022-07-26 14:25:12 +02:00
db4529f900 Fix outdated pressure/tilt for tablet motions events under GHOST/Wayland
Accumulate tablet data before generating an event using the 'frame'
callback.
2022-07-26 14:25:12 +02:00
3089c86c2b Fix T99083: audio bad in command-line video player (blender -a)
There was a wrong sample size computation in PulseAudioDevice.
The sample format is switched to float32 for the command-line player.
2022-07-26 14:25:12 +02:00
959c50fff0 Cleanup: Make function static 2022-07-26 14:25:12 +02:00
0ddb6c4445 Geometry Nodes: Speed up Separate color node in RGB mode
This applies the same optimization as b8bd304bd4 to the separate
color node. I observed about a 50% improvement with 10 million values
when only extracting one channel-- from about 17ms to 11ms.
2022-07-26 14:25:12 +02:00
b11da98940 Cleanup: make format 2022-07-26 14:25:12 +02:00
aa37c4f2dc Fix T97691: undefined behavior sanitizer warning for alignment in RNA functions
Thanks Loren Osborn for investigating this and proposing solutions.

Ref D14798
2022-07-26 14:25:12 +02:00
Max Edge
ece24da562 Fix T94621: Missing selection indication for virtual node sockets
A small regression as a result of adding a custom outline to the empty
virtual socket, which ended up overriding the colors when selected with
Shift+LMB.

Differential Revision: https://developer.blender.org/D15103
2022-07-26 14:25:12 +02:00
Angel Bueno
0e9126a26a Spreadsheet: Support operations for filtering colors
Support choosing an operation when filtering colors,
like the other types.

Differential Revision: https://developer.blender.org/D15191
2022-07-26 14:25:12 +02:00
777b9b9cc7 Cleanup: Remove unused array in vertex paint code
Unused since 4f616c93f7
2022-07-26 14:25:12 +02:00
662639c6c8 Vertex paint mode tried to do a "fast update" by trying to avoid tagging
the mesh ID for a full update. The conditions it uses are troublesome:
 1. There must be an evaluated mesh
 2. The evaluated mesh's active byte color layer must equal the original's

This logic doesn't make sense for a few reasons. First of all, the
`mloopcol` pointer doesn't make sense in the context of color
attributes (rather than the old vertex colors), since it only points
to byte color attribute on face corners. Second, just because the
layer pointers are equal doesn't mean something doesn't depend
on the attribute's values.

I think the best solution currently is to remove this "fast update"
case and instead work on optimizing the general case.

Also, T95842 suggests removing these pointers, and this is one
of the last remaining uses of `Mesh.mloopcol`.

Differential Revision: https://developer.blender.org/D15275
2022-07-26 14:25:12 +02:00
b83765dfcf Mesh: Add an explicit "positions changed" function
We store various lazily calculated caches on meshes, some of which
depend on the vertex positions staying the same. The current API to
invalidate these caches is a bit confusing. With an explicit set of
functions modeled after the functions in `BKE_node_tree_update.h`,
it becomes clear which function to call. This may become more
important if more lazy caches are added in the future.

Differential Revision: https://developer.blender.org/D14760
2022-07-26 14:25:12 +02:00
6602900b43 Geometry Nodes: Optimize selection for virtual array input
This makes calculation of selected indices slightly faster when the
input is a virtual array (the direct output of various nodes like
Face Area, etc). The utility can be helpful for other areas that
need to find selected indices besides field evaluation.

With the face area node used as a selection with 4 million faces,
the speedup is 3.51 ms to 3.39 ms, just a slight speedup.

Differential Revision: https://developer.blender.org/D15127
2022-07-26 14:25:12 +02:00
fab4f47027 Cyles: switch primitive.h inline hints to forceinline
This change helps decrease Intel GPU binaries compile time by 5-10
minutes without impacting other backends.

Reviewed By: sergey, brecht

Differential Revision: http://developer.blender.org/D15273
2022-07-26 14:25:12 +02:00
29ed98a869 Fix T98975: Broken vertex paint mode operators
All of the operators in vertex paint mode didn't work properly with
the new color attribute system. They only worked on byte color type
attributes on the face corner domain.

Since there are four possible combinations of domains and types now,
it mostly ended up being simpler to convert the code to C++ and use
the geometry component API for retrieving attributes, interpolating
between domains, etc. The code changes ended up being fairly large,
but the result should be simpler now.

Differential Revision: https://developer.blender.org/D15261
2022-07-26 14:25:12 +02:00
e75c75c5a5 Fix T99110: Crash after running view_all operator in VSE
Crash caused by NULL dereference, when `Editing` is not initialized.

Check if data is initialized in poll function.
2022-07-26 14:25:12 +02:00
ab61ca5a42 Fix T99091: Freeze when changing strip source with thumbnails enabled
When input file is changed, `orig_height` and `orig_width` fields are
reset, which causes thumbnail dimensions to be incorrectly calculated.

Only draw thumbnails if both mentioned fields are non 0.
2022-07-26 14:25:12 +02:00
fc955371cd Fix T99028: crash deleting file output node with color management override
One case of copying image formats was not properly using BKE_image_format_copy.
To fix this for existing .blend file we need to do versioning, ensuring the curve
mapping is properly copied.
2022-07-26 14:25:12 +02:00
Andrii Symkin
306d4ad108 Cycles: unify math functions names
This patch unifies the names of math functions for different data types and uses
overloading instead. The goal is to make it possible to swap out all the float3
variables containing RGB data with something else, with as few as possible
changes to the code. It's a requirement for future spectral rendering patches.

Differential Revision: https://developer.blender.org/D15276
2022-07-26 14:25:12 +02:00
055719f6be Fix T99027: Touch typing in text fields results in dropped key presses
Fix by always testing unhandled double-click events as press events,
irrespective of the previous event type.

**Details**

Handling double-click events only ran when the previously pressed-key
matched the current pressed-key.

Originally when double-click support was added the previous type was
compared (ignoring it's press/release value) and while not necessary
it was harmless as it matched the check for double-click events being
generated.

As of [0] the logic for click/drag detection changed to ignore release
events as release this could interrupt dragging.
This made it possible to generate double-click events that failed the
`event->prev_press_type == event->type` comparison.
In these cases it was possible to generate double-click
events that would not fall-back to a 'press' value when unhandled.

[0]: 102644cb8c
2022-07-26 14:25:12 +02:00
e2bb8e31aa Cleanup: fix typo that deactivated clang-format in rna_brush.c 2022-07-26 14:25:12 +02:00
bf2af9d43c Fix T98871: Drivers not updated when joining an armature
If the some driver had been flagged as "invalid", the flag would not be
cleared when joining armatures which could lead to now valid drivers
still being flagged as invalid.

Now we clear this invalid flag on all drivers to force a recheck after
joining the armatures.
2022-07-26 14:25:12 +02:00
Colin Basnett
3cf54a8f75 Animation: Add function to remove all FCurves from an Action
Add a `BKE_action_fcurves_clear(action)` function, which removes all the
Action's FCurves, and expose it as `ActionFCurves.clear()` in RNA.

This is more ergonomic than calling `remove` on f-curves until the list
is empty.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14660
2022-07-26 14:25:12 +02:00
Colin Basnett
f56f164a84 Armature: Add poll message explaining bone groups need pose mode
Add a poll message to the bone group operators, to explain they only
work in pose mode. Before, the buttons would be greyed out with no
explanation.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D15119
2022-07-26 14:25:12 +02:00
Colin Basnett
741c9e1867 Dopesheet: Add Custom Properties panel
Adds a custom property panel for the active `Action` to the Dopesheet
editor. There was previously no way to edit these properties outside of
the Python API.

This panel will show up when
`context.active_object.animation_data.action` is set.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14646
2022-07-26 14:25:12 +02:00
Michael Jones
67ebb35d9f Cycles: Add diagnostic tracing of MTLLibrary compilation time
Reviewed By: sergey

Differential Revision: https://developer.blender.org/D15268
2022-07-26 14:25:12 +02:00
550fb1eec2 Fix key repeat continuing after a window loses focus for GHOST/Wayland
Also remove NULL checks in keyboard enter/leave handlers,
as they didn't serve any purpose.
2022-07-26 14:25:12 +02:00
b1d3b71641 LineArt: Cleanup minor warnings from variable type changes. 2022-07-26 14:25:12 +02:00
1593fbcacd Fix key repeat behavior for GHOST/Wayland
- Respect modifier keys (Shift press/release didn't change the case).

- Changing modifiers resets the timer instead of canceling key-repeat.

- Releasing keys (besides the key being repeated) resets the timer
  instead of canceling key repeat.

This makes key-repeat behave the same way as GTK & WIN32 text input.
2022-07-26 14:25:11 +02:00
97f0991610 Cleanup: Clang tidy
Mainly duplicate includes and else after return.
2022-07-26 14:25:11 +02:00
813be6d943 Cleanup: Use const arguments
Also use Curves as an argument instead of Object,
since it's more specific to this situation.
2022-07-26 14:25:11 +02:00
Michael Jones
bf3b67d631 Cycles: Tidy of KernelData patchup code
Reviewed By: sergey

Differential Revision: https://developer.blender.org/D15267
2022-07-26 14:25:11 +02:00
Michael Jones
701a39d62c Cycles: Distinguish Apple GPUs by core count
This patch suffixes Apple GPU device names with `(GPU - # cores)` so that variant GPUs with the same chipset can be distinguished. Currently benchmark scores for these M1 family GPUs are being incorrectly merged:

- M1: 7 or 8 cores
- M1 Pro: 14 or 16 cores
- M1 Max: 24 or 32 cores
- M1 Ultra: 48 or 64 cores

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D15257
2022-07-26 14:25:11 +02:00
24e87196af Cleanup: remove unused sculpt texture cache generation
This has not been used since 5505697ac in 2010.
2022-07-26 14:25:11 +02:00
Ramil Roosileht
f3e37442dd D14974: Tip roundness - match square and round brush radius
Oneliner for T97961.  Square sculpt brushes no longer fit
inside the radius circle, they now use the radius for
the square size.

{F13082514}

Note: original patch was modified to scale PBVH
      search radius to avoid artifacts.

Differential Revision: https://developer.blender.org/D14974
Reviewed By: Joseph Eagar & Julien Kaspar
Ref: D14974
2022-07-26 14:25:11 +02:00
797114a699 Cleanup: simplify macOS make deps instructions 2022-07-26 14:25:11 +02:00
Patrick Huang
4a9dd0b960 Fix T97675: slow zoom in node editor with Continue zoom method
Speed increased by 10x, making it visually similar to other editors.

Differential Revision: https://developer.blender.org/D15209
2022-07-26 14:25:11 +02:00
b2a8c05739 Fix T98773: GPU Subdivision breaks auto selection in UV edit mode
When GPU subdivision is used, and the modifier is not set to be applied
on the cage, UV selection is not synced with the face selection in the
viewport.

This happens because the extraction, despite being in edit mode, is set
to `MESH` instead of `BMESH` (or `MAPPED` in some cases) like for CPU
subdivision, and since the mesh is not always synchrnised with the BMesh
the edit mode flags are not always updated.

With GPU subdivision, when creating the `MeshRenderData`, the condition
`has_mdata && do_final && editmesh_eval_final != editmesh_eval_cage` is
true which forces the `MESH` extraction. Following comment in D14485,
this replace the `has_mdata` in the condition with `use_mapped` which
solves the issue.

Differential Revision: https://developer.blender.org/D15248
2022-07-26 14:25:11 +02:00
de329c8a00 Fix T98956: Crash removing some builtin attributes
For example, the "id" attribute is stored as a named attribute.
If it doesn't exist already, `layer_index` was uninitialized, causing
issues with `CustomData_free_layer`. The fix is to use the generic
function to free a named layer in that case. Eventually the other
case will go away as T95965 is finished.
2022-07-26 14:25:11 +02:00
adc8273e53 Fix: Memory leak writing to builtin attribute with wrong type
The store named attribute node creates a new buffer to evaluate
the field into. When creating the attribute with that buffer fails,
if must be freed.
2022-07-26 14:25:11 +02:00
d78dc493ed Cleanup: Remove unused function arguments
Solves the corresponding compiler warning.
2022-07-26 14:25:11 +02:00
6a01f40275 Cleanup: clang-format 2022-07-26 14:25:11 +02:00
a67afe0773 Revert "LibOverride: Handle dependencies in both directions in partial override cases."
This reverts commit f0b4aa5d59.

This commit was making files to get bigger and bigger every time they
were saved and re-opened.

In the orphaned data in the outliner new collections would show up
there, even after continuously purging it. This would lead to a massive
file which get also very slow.

This problem will fix itself after a few re-open/re-saves of the files.
For anyone also experimenting this you can fix this faster by purging
the unused data multiple times in the file.

Example of file from the Project Heist (rev. 1014):
heist/pro/shots/010_opening/010_0050/010_0050.anim.blend
2022-07-26 14:25:11 +02:00
Simon Lenz
63b4ec9543 Mask Editor: Add toggle for mask spline drawing
Adds an overlay option to show/hide the spline points & lines of masks in the Mask Editor.

It also moves the "smooth" option up (its position left of the selection dropdown was missleading).

{F11847272}

This emerged from a discussion in https://developer.blender.org/D12776

Differential Revision: https://developer.blender.org/D13314
2022-07-26 14:25:11 +02:00
Ramil Roosileht
21988ec764 D14975: Voxel Remesh Size Edit - Constant Size by default
This patch makes constant size a default for size edit operator of voxel remesh.
In turn, pressing CTRL now enables relative scale, the old default.

Patch also changes workspace status text entry with new additions. Note that it is a simple text and not an array of keymaps (for that further changes are needed)

{F13082567}

Reviewed By: Julien Kaspar & Joseph Eagar
Differential Revision: https://developer.blender.org/D14975
Ref D14975
2022-07-26 14:25:11 +02:00
b986ced8aa Added Python API for devce type, documented usage of gpu_info, removed references to platform. 2022-06-22 17:12:10 +02:00
e8f26ff6d1 Added GPU info as script to solve initialization errors. 2022-06-22 14:04:55 +02:00
28d915e614 Get GPU platform. 2022-06-22 12:57:54 +02:00
a84d6d0e1c RenderReport: Add option to add platform specific overrides.
Reference images in the platform_reference_dir will be chosen before
images in reference_dir. This allows platform specific reference
images, with a common base.

To ignore set platform_reference_dir to None. The caller is responsible
of setting the platform reference dir as the unit test is more aware
what the definition of a platform is.

NOTE: should we rename it to reference_override_dir as that is better
suited to the actual implementation and responsibilities.

Differential Revision: https://developer.blender.org/D15265
2022-06-22 09:58:17 +02:00
4 changed files with 97 additions and 3 deletions

View File

@@ -55,6 +55,34 @@ static PyObject *pygpu_platform_version_get(PyObject *UNUSED(self))
return PyUnicode_FromString(GPU_platform_version());
}
PyDoc_STRVAR(
pygpu_platform_device_type_get_doc,
".. function:: device_type_get()\n"
"\n"
" Get GPU device type.\n"
"\n"
" :return: Device type ('APPLE', 'NVIDIA', 'AMD', 'INTEL', 'SOFTWARE', 'UNKNOWN').\n"
" :rtype: str\n");
static PyObject *pygpu_platform_device_type_get(PyObject *UNUSED(self))
{
if (GPU_type_matches(GPU_DEVICE_APPLE, GPU_OS_ANY, GPU_DRIVER_ANY)) {
return PyUnicode_FromString("APPLE");
}
if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_ANY, GPU_DRIVER_ANY)) {
return PyUnicode_FromString("NVIDIA");
}
if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)) {
return PyUnicode_FromString("AMD");
}
if (GPU_type_matches(GPU_DEVICE_INTEL | GPU_DEVICE_INTEL_UHD, GPU_OS_ANY, GPU_DRIVER_ANY)) {
return PyUnicode_FromString("INTEL");
}
if (GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_ANY, GPU_DRIVER_ANY)) {
return PyUnicode_FromString("SOFTWARE");
}
return PyUnicode_FromString("UNKNOWN");
}
/** \} */
/* -------------------------------------------------------------------- */
@@ -74,6 +102,10 @@ static struct PyMethodDef pygpu_platform__tp_methods[] = {
(PyCFunction)pygpu_platform_version_get,
METH_NOARGS,
pygpu_platform_version_get_doc},
{"device_type_get",
(PyCFunction)pygpu_platform_device_type_get,
METH_NOARGS,
pygpu_platform_device_type_get_doc},
{NULL, NULL, 0, NULL},
};

View File

@@ -3,6 +3,7 @@
import argparse
import os
import pathlib
import shlex
import shutil
import subprocess
@@ -98,6 +99,26 @@ if inside_blender:
print(e)
sys.exit(1)
def get_gpu_device_type(blender):
command = [
blender,
"-noaudio",
"--background"
"--factory-startup",
"--python",
str(pathlib.Path(__file__).parent / "gpu_info.py")
]
try:
completed_process = subprocess.run(command, stdout=subprocess.PIPE)
for line in completed_process.stdout.read_text():
if line.startswith("GPU_DEVICE_TYPE:"):
vendor = line.split(':')[1]
return vendor
except BaseException as e:
return None
return None
def get_arguments(filepath, output_filepath):
return [
@@ -134,10 +155,16 @@ def main():
idiff = args.idiff[0]
output_dir = args.outdir[0]
gpu_device_type = get_gpu_device_type(blender)
reference_override_dir = None
if gpu_device_type == "AMD":
reference_override_dir = "eevee_renders/amd"
from modules import render_report
report = render_report.Report("Eevee", output_dir, idiff)
report.set_pixelated(True)
report.set_reference_dir("eevee_renders")
report.set_reference_override_dir(reference_override_dir)
report.set_compare_engine('cycles', 'CPU')
test_dir_name = Path(test_dir).name

24
tests/python/gpu_info.py Normal file
View File

@@ -0,0 +1,24 @@
"""
Prints GPU backend information to the console and exits.
Use this script as `blender --background --python gpu_info.py`.
"""
import bpy
import gpu
import sys
# Render with workbench to initialize the GPU backend otherwise it would fail when running in
# background mode as the GPU backend won't be initialized.
scene = bpy.context.scene
scene.render.resolution_x = 1
scene.render.resolution_y = 1
scene.render.engine = "BLENDER_WORKBENCH"
bpy.ops.render.render(animation=False, write_still=False)
print('GPU_VENDOR:' + gpu.platform.vendor_get())
print('GPU_RENDERER:' + gpu.platform.renderer_get())
print('GPU_VERSION:' + gpu.platform.version_get())
print('GPU_DEVICE_TYPE:' + gpu.platform.device_type_get())
sys.exit(0)

View File

@@ -78,12 +78,18 @@ def test_get_name(filepath):
return os.path.splitext(filename)[0]
def test_get_images(output_dir, filepath, reference_dir):
def test_get_images(output_dir, filepath, reference_dir, reference_override_dir):
testname = test_get_name(filepath)
dirpath = os.path.dirname(filepath)
old_dirpath = os.path.join(dirpath, reference_dir)
old_img = os.path.join(old_dirpath, testname + ".png")
if reference_override_dir:
override_dirpath = os.path.join(dirpath, reference_override_dir)
override_img = os.path.join(override_dirpath, testname + ".png")
if os.path.exists(override_img):
old_dirpath = override_dirpath
old_img = override_img
ref_dirpath = os.path.join(output_dir, os.path.basename(dirpath), "ref")
ref_img = os.path.join(ref_dirpath, testname + ".png")
@@ -108,6 +114,7 @@ class Report:
'output_dir',
'global_dir',
'reference_dir',
'reference_override_dir',
'idiff',
'pixelated',
'fail_threshold',
@@ -127,6 +134,7 @@ class Report:
self.output_dir = output_dir
self.global_dir = os.path.dirname(output_dir)
self.reference_dir = 'reference_renders'
self.reference_override_dir = None
self.idiff = idiff
self.compare_engine = None
self.fail_threshold = 0.016
@@ -161,6 +169,9 @@ class Report:
def set_reference_dir(self, reference_dir):
self.reference_dir = reference_dir
def set_reference_override_dir(self, reference_override_dir):
self.reference_override_dir = reference_override_dir
def set_compare_engine(self, other_engine, other_device=None):
self.compare_engine = (other_engine, other_device)
@@ -343,7 +354,7 @@ class Report:
name = test_get_name(filepath)
name = name.replace('_', ' ')
old_img, ref_img, new_img, diff_img = test_get_images(self.output_dir, filepath, self.reference_dir)
old_img, ref_img, new_img, diff_img = test_get_images(self.output_dir, filepath, self.reference_dir, self.reference_override_dir)
status = error if error else ""
tr_style = """ class="table-danger" """ if error else ""
@@ -390,7 +401,7 @@ class Report:
self.compare_tests += test_html
def _diff_output(self, filepath, tmp_filepath):
old_img, ref_img, new_img, diff_img = test_get_images(self.output_dir, filepath, self.reference_dir)
old_img, ref_img, new_img, diff_img = test_get_images(self.output_dir, filepath, self.reference_dir, self.reference_override_dir)
# Create reference render directory.
old_dirpath = os.path.dirname(old_img)