1
1

Compare commits

...

8115 Commits

Author SHA1 Message Date
57ae554740 Report error when choosing incorrect GPU backend. 2022-10-19 14:46:20 +02:00
dce3327404 Add supported backend check to shader builder. 2022-10-19 14:37:43 +02:00
3ee90b6c01 Shader builder process all available backends. 2022-10-19 13:19:26 +02:00
c53f4bb835 Merge branch 'master' into temp-T101905-gpu-backend-argument 2022-10-19 11:57:22 +02:00
50971775d5 Fix compilation errors SDL. 2022-10-19 11:55:21 +02:00
6739cbcef6 Fix compilation errors windows. 2022-10-19 11:55:10 +02:00
638c6d9687 Fix compilation errors on linux. 2022-10-19 11:53:46 +02:00
b9b4b35096 Add support for animation playback. 2022-10-19 10:56:29 +02:00
e5782df4ab Fix (unreported) error messages about invalid ID usercount when batch-deleting IDs.
Batch-delete by-passes a lot of ID usages handling in to-be-deleted IDs,
so usercount of deleted IDs needs to be manually reset to avoid the
annoying error messages in the console.
2022-10-19 10:27:56 +02:00
b1d94ad3fb Combined glSettings and type in ghost. 2022-10-19 10:27:00 +02:00
358155a8da Make batch ID deletion 100 times faster.
Simplify and optimize remapping handling in bacth ID deletion, by moving
it outside of the initial loop gathering all IDs to be deleted, and and
by using batch remapping code.

Speedup can be over 100 times faster in complex production scenes using
thousands of IDs, when e.g. deleting a whole library.

Examples before/after times on my machine (deleting two different libraries):
lib1:  5.55 sec/0.03 sec
lib2: 13.60 sec/0.13 sec

Found while investigating T101903.
2022-10-19 10:17:33 +02:00
a450a2f2b2 Fix T101903: Crash when deleting library in some cases.
Remapping in batch deletion could end up calling viewlayer resync code
on partially invalid BMain (some IDs still in Main using IDs removed
from Main).

Think this code can actually be further optimized, but this fix should
be safe enough for 3.3 (and potentially 2.93).

Thanks to Jeroen (@jbakker) for the initial investigation.
2022-10-19 09:22:02 +02:00
4163c63def Curves sculptmode: fix missing mode and tool in Brush Specials
For consistency with other brush based (paint) systems we should add
these entries in the brushes context menu.
For this, expose the brushes `ob_mode` to RNA and show this (along with
the tool choice) to the appropriate menus.

Differential Revision: https://developer.blender.org/D16287
2022-10-19 08:53:09 +02:00
4d185921f6 Sculpt curves: Fix BKE_paint_object_mode_from_paintmode
Currently harmless (since atm. it is not possible to trigger this part
of the code from curves sculpting), but in a future fix (for T101518), it
would be good to use `BKE_paint_init` (and having the correct ob_mode
for the brush would be nice).

Differential Revision: https://developer.blender.org/D16286
2022-10-19 08:52:27 +02:00
96fa5e1e84 Cleanup: remove unused 'VIEW3D_MT_brush_context_menu_paint_modes'
This was added in rB4c9fe657458f, however that new code never used this
menu (but the existing `VIEW3D_MT_brush_paint_modes` instead).

Differential Revision: https://developer.blender.org/D16285
2022-10-19 08:50:38 +02:00
760a6aa1f5 Fix error in 30d9a6245f
X/Y for mouse wheel events was unintentionally flipped.
2022-10-19 16:35:32 +11:00
30d9a6245f GHOST/Wayland: support high resolution 2D track-pad scroll events
These events are interpreted as MOUSEPAN by Blender.
Tested with a Wacom Intuos5. This isn't full touch support
which is needed to support gestures such as Swipe, Rotate .. etc.
2022-10-19 16:32:32 +11:00
da4bd24c3e Sculpt: Improve performance of face set creation from selection
Skip BMesh conversion and read the selection attribute directly.
With a Ryzen 3700x, my test face of a simple 4 million face grid
became over 4000 times faster, from 2.6s to 0.6ms.
2022-10-18 23:44:16 -05:00
42f37106c5 GHOST/Wayland: add listener for touch events (no touch support yet)
Currently unused as my tablet isn't generating touch events.
This may be useful for development as touch events are logged.
2022-10-19 14:53:48 +11:00
e4c5a46c12 Cleanup: remove NDOF_BUTTON_NONE from the range of usable buttons
This is used to represent unknown state, so there is no need to be
able to store it's pressed state.
2022-10-19 14:07:36 +11:00
c9f1378863 Cleanup: use '_' suffix for private members for NDOF Manager 2022-10-19 13:53:20 +11:00
c247562b07 GHOST/NDOF: various minor changes to NDOF manager
- Use logging for NDOF device output
  (this removes printing on startup buy default).
- Use `ndof_` prefix for button maps.
- Use full sentences.
2022-10-19 13:38:31 +11:00
ab28abcb6b Cleanup: remove the last button from NDOF button enum values
This is only used for comparison, no need to make it part of the enum.
2022-10-19 12:58:36 +11:00
ecda118be4 Fix T101866: Incorrect buttons for space-mouse enterprise
Use key from spacenavd's wiki.

Also add keys: ENTER, DELETE, TAB, SPACE & Views 1-3.
2022-10-19 12:52:58 +11:00
8aca40652a Cleanup: spelling in comments 2022-10-19 12:52:55 +11:00
8115d30dca License headers: add missing license identifiers 2022-10-19 12:52:54 +11:00
be32882e1c Fix T101883: Issue applying modifier to mesh with shape keys
Caused by 21f2bacad9 which misunderstood the logic handling
shape keys in this function. The shape key on the original mesh in the
main data-base should be cleared if the "no-main" mesh doesn't have any
shape key layers and the vertex count has changed. The complexity is
necessary because shape keys are stored differently on original and
evaluated meshes.

Also change to "Warn" because this is expected behavior in some cases,
like when applying a geometry nodes modifier that creates a new mesh
from scratch.
2022-10-18 15:57:57 -05:00
949d6e360b Add command line argument to swithc gpu backend. 2022-10-18 18:08:36 +02:00
d57352b114 Fix T101893: Auto merge affecting edge crease and bevel weight
None of the special transformations in `special_aftertrans_update__mesh`
are really applicable or useful for edge crease and bevel weight.
2022-10-18 12:51:32 -03:00
91e85230f9 Fix T101660: crash when trying to propagate string attributes in some nodes
String attributes are intentionally not fully supported in geometry nodes
yet because more design work is necessary to decide how they should behave.

For now just disable handling string attributes to avoid crashes.
2022-10-18 17:17:08 +02:00
91ecf47b2c Fix: Sample nearest surface node crash with empty mesh 2022-10-18 10:07:32 -05:00
a2fcfcabd7 Cleanup: add missing CPPType for MStringProperty 2022-10-18 16:50:42 +02:00
7abd79398d Fix T101642: crash when deleting group output inside node group 2022-10-18 16:15:27 +02:00
5c1d2c5a9d Brush: Wrap mtex/mask_tex around functions.
`Brush` has two attributes for holding texture information (`MTex`).
One for color textures (`mtex`) and one for mask textures (`mask_mtex`).

Unfortunately sculpt mode due to reasons used `mtex` to store mask textures.
Changes like brush asset/paint mode require modes/tools to read the mask/color texture from
one place.

To start sanatizing this we isolate the attributes in functions.
`BKE_brush_color_texture_get` and `BKE_brush_mask_texture_get`. All object
paint modes should use these functions.
2022-10-18 16:06:40 +02:00
619ce8392b Depsgraph: wrong copy-on-write update after depsgraph rebuild
Differential Revision: https://developer.blender.org/D16268
2022-10-18 15:49:05 +02:00
489260198e File Browser: Fix slowdown with non-existing ID previews in big files
When the File (or Asset) Browser would display data-blocks without
previews in a heavy .blend file, there would be a drastic slowdown.

See patch for details and comparison videos.

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

Reviewed by: Bastien Montagne
2022-10-18 15:10:59 +02:00
c2fe387244 Build: get make deps working with Xcode command line tools
Deduplicating code with Xcode detection for Blender builds.
2022-10-18 14:17:28 +02:00
Sebastian Herholz
2006c3ed10 Fix T101529: Blender crashes when using Path Guiding 2022-10-18 13:59:12 +02:00
Jason Fielder
aed301704a Metal: MTLBatch and MTLDrawList implementation.
MTLBatch and MTLDrawList implementation enables use of Metal Viewport for UI and Workbench. Includes Vertex descriptor caching and SSBO Vertex Fetch mode draw call submission.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D16101
2022-10-18 12:47:43 +02:00
e47bf05e85 NDOF: use logging for GHOST so users can enable event logging
Previously this was only available as a build options, making it
difficult to get user feedback when NDOF events didn't work as expected.

Now logging can be enabled with:

  blender --log "ghost.ndof.*" --log-level 2 --log-show-basename
2022-10-18 14:54:33 +11:00
1edebb794b UV: support snapping on non-uniform grids
Part of a wider set of changes to Grid and Pixel snapping in the
UV Editor.

This change fixes snapping behavior for non-uniform grids, either
manually specified Fixed grids, or pixel grids where the underlying
image is non-square.

See a24fc6bbc1 for visual changes.

Maniphest Tasks: T78391

Differential Revision: https://developer.blender.org/D16275
2022-10-18 16:05:30 +13:00
c7051192e2 UI: Improve tooltip for texture shading mode
Pointed out in T98506
2022-10-17 22:57:10 -04:00
85875455b9 Fix T101872: Curves sculpt deform node crash with changed curve count
There might be more or fewer curves in the input to the deform curves on
surface node than the original, so the curve's surface UV coordinates
need to be retrieved from the original curves.
2022-10-17 17:08:09 -05:00
161aa5e0d0 Fix T101882: Division by zero in mesh topology nodes
A vertex might be connected to no edges or no faces. Most of these nodes
worked fine in that case, but we might as well make that explicit
and skip the sorting anyway.
2022-10-17 16:51:42 -05:00
e8291f4504 Sculpt: Remove face sets from default cube
As discussed in T101623, since face sets have become optionally stored,
(see b5f7af31d6) the default cube shouldn't have face sets--
they should be created explicitly by the user instead. This may improve
performance when modifying the default cube mesh.
2022-10-17 13:18:25 -05:00
23ea72f051 Cleanup: Move versioning_defaults.c to C++ 2022-10-17 13:18:25 -05:00
603a534f09 Fix T101850: Cycles DDS oversaturation when alpha is in use
DDS files coming through OIIO needed a similar treatment as TGA in
T99565; just for DDS OIIO just never set the "unassociated alpha"
attribute. Fixes T101850.

Reviewed By: Brecht Van Lommel
Differential Revision: https://developer.blender.org/D16270
2022-10-17 21:03:37 +03:00
728451f01a Fix T101871: Realize instances node can skip material indices
The node only created a material index attribute on the result mesh
if it existed on any of the input meshes. But the input meshes might
not have the attribute if they had a single material or no materials.
As a fix, also create the attribute if the result has more than one
material.
2022-10-17 12:21:30 -05:00
Jason Fielder
d3b47fa842 FIX T101445: halo Particles are not working.
color uniform assignment needing to be changed to ucolor was missed.

Ref T101445

Reviewed By: fclem

Maniphest Tasks: T101445

Differential Revision: https://developer.blender.org/D16236
2022-10-17 17:46:51 +02:00
694481095b Fix for T101506: BLF Disable Kerning in Main Font
Disable kerning in our main font to exactly restore the spacing of text
as seen in Blender 3.1 - 3.3

See D16186 for more details.

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

Reviewed by Brecht Van Lommel
2022-10-17 08:35:11 -07:00
660c47596e Weight Paint: relax heuristic to determine when final mesh can be used.
Checking for polygon and loop data to be referenced is too fragile
re changes in geometry node implementations. Instead, compare counts
of polygons, face corners and vertices: topology changes are unlikely
to keep all three unchanged.

Ref D15501
2022-10-17 16:48:29 +03:00
1111af5cb4 Sculpt: add versioning for Auto-masking cavity factor default
Also remove automasking_cavity_factor default from RNA for brushes.
Data-blocks set their defaults via `DNA_brush_defaults.h`

Continuation from previous commit and rBdb40b6

Thanks to Dalai for the help!
2022-10-17 14:47:58 +02:00
0a35afbf86 Fix T99565: Cycles reading TGA files with alpha different than Blender
Thanks to Lukas for tracking down the cause in OIIO.
2022-10-17 14:34:25 +02:00
3eaf2b7fc6 Fix OpenPGL and OneAPI being detected by CMake when Cycles is disabled 2022-10-17 14:34:25 +02:00
baa9a00f5f Fix Wayland not being disabled when dependencies are not found 2022-10-17 14:34:25 +02:00
390cf2fe75 Cleanup: compiler warnings 2022-10-17 14:34:25 +02:00
69e7274d4f Brush: Fix mismatch in DNA Brush defaults
Missed changing the DNA brush default in rBdb40b6

Thanks to SteffenD for reporting in blender.chat!
2022-10-17 14:11:21 +02:00
e96ad822b3 Fix AssetCatalogTest failure on WIN32
Recent changes to path handling (most likely [0]) caused
AssetCatalogTest.create_catalog_after_loading_file to fail on WIN32.

The test relied on the resulting path to be joined with "/" as a path
separator. The resulting path used both forward and back-slashes.
While these do work for some API's on WIN32, mixing both in a file path
isn't expected behavior in most cases, so update the tests to use native
slash direction for file-paths.

[0]: 9f6a045e23
2022-10-17 21:27:05 +11:00
Iliya Katueshenock
a6b83617e9 Fix T101705: crash when connecting reroute to multi-input socket
Differential Revision: https://developer.blender.org/D16203
2022-10-17 12:00:09 +02:00
e5425b566d Geometry Nodes: separate Instances from InstancesComponent
This makes instance handling more consistent with all the other geometry
component types. For example, `MeshComponent` contains a `Mesh *` and
now `InstancesComponent` has a `Instances *`.

Differential Revision: https://developer.blender.org/D16137
2022-10-17 11:39:58 +02:00
Pablo Vazquez
db40b62252 Sculpt: Auto-masking UI improvements
Add auto-masking as a popover in the header while in Sculpt mode,
following the design in T101593.

These properties were present in the Options panel (and popover),
they have been removed from there.

Moreover, this commit makes the auto-masking section in Brush settings
match the new popover.

In the future this popover can be used for other modes that support
auto-masking such as Grease Pencil.

See D16145 for details and screenshots.

Reviewed By: JulienKaspar

Differential Revision: https://developer.blender.org/D16145
2022-10-17 11:23:16 +02:00
11bb38e887 Make sure all dependency graphs are updated on particles system copy 2022-10-17 11:03:21 +02:00
89effac57e Fix T101851: Duplicating a particle system crashes 2022-10-17 11:02:13 +02:00
3e35beae61 Cleanup: correct doc-string & remove unused define
Minor edits to recent commits.
2022-10-17 12:41:56 +11:00
94ce176e75 Cleanup: renaming GHOST/Wayland functions & private members
- Use `_` suffix for private members.
- Use `wl_` prefix for Wayland native types to help distinguish
  them from local types.
- Replace single character names `d` & `w` with `display` `window`.
- Rename `selection` to `clipboard`. Using the primary selection as a
  clipboard is a separate and as yet unsupported feature.
2022-10-17 12:25:40 +11:00
9f6a045e23 Cleanup: replace BLI_join_dirfile with BLI_path_join
These functions are almost identical, the main difference being
BLI_join_dirfile didn't trim existing slashes when joining paths
however this isn't an important difference that warrants a separate
function.
2022-10-17 11:38:54 +11:00
1d1cade9a9 BLI_path: remove trailing NULL argument to BLI_path_join
Using varargs had the disadvantages, replace with a macro which has
some advantages.

- Arguments are type checked.
- Less verbose.
- Unintended NULL arguments would silently terminate joining paths.
- Passing in a NULL argument warns with GCC.
2022-10-17 11:16:41 +11:00
2f3f208901 Cleanup: spelling in comments, unused arg warning 2022-10-17 11:16:39 +11:00
6ad04a031c Cycles: Fix floor intrinsic for ARM Neon 2022-10-17 01:13:43 +02:00
25e84334f7 Sculpt: Fix T101864: Mask initialization not updating multires data
BKE_sculpt_mask_layers_ensure now takes a depsgraph argument and
will evaluate the depsgraph if a multires mask layer is added.
This is necassary to update the multires runtime data so that
pbvh knows it has a grids mask layer.

Also added code to update pbvh->gridkey.
2022-10-16 13:24:26 -07:00
Monique Dewanchand
4c320e2639 Fix T101394: Ensure all viewlayers on scene copy.
When a scene copy is called, all viewlayers are ensured before they are
copied. In case of multiple viewlayers, a viewlayer can be out of sync.
This triggers an assert in the BKE_view_layer_copy_data.

Reviewed By: mont29

Maniphest Tasks: T101394

Differential Revision: https://developer.blender.org/D16214
2022-10-16 11:24:07 +02:00
0c50f9c4aa Fix T98672: Noise texture shows incorrect behaviour for large scales
This was a floating point precision issue - or, to be more precise,
an issue with how Cycles split floats into the integer and fractional
parts for Perlin noise.
For coordinates below -2^24, the integer could be wrong, leading to
the fractional part being outside of 0-1 range, which breaks all sorts
of other things. 2^24 sounds like a lot, but due to how the detail
octaves work, it's not that hard to reach when combined with a large
scale.

Since this code is originally based on OSL, I checked if they changed
it in the meantime, and sure enough, there's a fix for it:
https://github.com/OpenImageIO/oiio/commit/5c9dc68391e9

So, this basically just ports over that change to Cycles.

The original code mentions being faster, but as pointed out in the
linked commit, the performance impact is actually irrelevant.

I also checked in a simple scene with eight Noise textures at
detail 15 (with >90% of render time being spent on the noise), and
the render time went from 13.06sec to 13.05sec. So, yeah, no issue.
2022-10-16 02:34:10 +02:00
b898330c37 Fix T99450: Animated Holdout not updating on frame change
Problem here was that layer_collection_objects_sync wasn't called when
the holdout property is updated due to frame change, so the changed
visibility flag was never applied to ob->base_flag.

Turns out there's no real reason to handle the per-object holdout
property through the layer system. So, instead of merging both the
layer holdout and object holdout into base_flag and checking that
from the render engines, only handle the layer holdout (which can't
be animated, so no issue here) through base_flag and explicitly also
check the object holdout in the render engines.
2022-10-15 23:11:20 +02:00
ebe9804cfa Cleanup: comment out unused lambda parameter 2022-10-14 23:03:10 -07:00
b7ea79fde7 Sculpt: Fix face set relax being too strong 2022-10-14 23:00:13 -07:00
c207571d44 Sculpt: Fix draw artifacts when drawing multires mask 2022-10-14 22:51:45 -07:00
010c10febe Sculpt: Ensure faces are uniquely assigned to PBVHNodes
PBVH_FACES and PBVH_GRIDS do not store faces directly in nodes;
instead they store 'primitives', which are tesselation triangles
for PBVH_FACES and grids (which are per-loop) for PBVH_GRIDS.

Primitives from the same face could sometimes end up in different
PBVH nodes.  This is now prevented in two ways:

* All primitives of the same face are given the same boundary
  during PBVH build.  This prevents them from being swapped
  away from each other during partitioning.
* build_sub adjusts the final partition midpoint to fall
  between primitives of different faces.
2022-10-14 22:08:36 -07:00
bc06fcca47 Sculpt: do not validate PBVH draw data in mesh_batch_cache_valid
Turns out PBVH drawing and normal mesh batches are not mutually
exclusive inside the draw cache; there are edge cases with modifiers
and instancing where you need both, and forcing one or the other
inside this function leads to memory corruption.
2022-10-14 15:00:42 -07:00
7a005e089d Sculpt: fix crash when instancing sculpt objects 2022-10-14 15:00:42 -07:00
2111fab88a Fix: Missing part of previous BMesh bug fix
Missed actually using the variables from 6f190c669f.
2022-10-14 16:26:49 -05:00
6c4b72b135 Fix T101746: Node copy and paste changes multi-input socket order
The multi-input indices have to be copied, and updated after
pasting in case all original connected nodes weren't copied.
2022-10-14 14:18:59 -05:00
Sebastian Herholz
a90b0eb772 Deps: Updating OpenPGL 0.4.0 hash value 2022-10-14 21:10:55 +02:00
e3de5af135 Fix wrong Cycles default radius for motion blurred point clouds
Missing from recent commit to change the default in a6db2c2.
2022-10-14 19:51:28 +02:00
9e77f5f17f Fix T101803: Max length Operator bl_idname is truncated 1 character.
There were quite a few issues here:
* Bad usage of nagic number leading to confusing code
* Forgetting to take into accoun final `NULL` char
* RNA code thinkin `bl_idname` is python version, when it is actually
  BL/C version.
2022-10-14 18:35:28 +02:00
4112f0241b Fix: Draw: Initialize StencilSet in the correct order
tmp
2022-10-14 17:00:13 +02:00
Jun Mizutani
f940ecde7a Cleanup: Fix wrong comment of breadcrumb tree path
The breadcrumb of tree path in node editor is displayed on the top of the editor.

Reviewed by: PratikPB2123

Diff: https://developer.blender.org/D14994
2022-10-14 19:19:47 +05:30
Charlie Jolly
84d70de25a Fix: Muted curves connect to the Fac socket
Resolve by setting no_muted_links() on Factor sockets.

Same issue as T101613

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D16153
2022-10-14 14:21:58 +01:00
58324f0c86 Cycles: oneAPI: Make test kernel more representative
Test kernel will now test functionalities related to kernel execution
with USM memory allocations instead of with SYCL buffers and accessors
as these aren't currently used in the backend.
2022-10-14 11:22:11 +02:00
5d53e6b3c1 Deps: include libxkbcommon-devel for Linux build script, remove wayland
- Include libxkbcommon headers: needed for building Blender with Wayland.
- Remove Wayland libraries (now wayland is built locally).
- Split up packages into two lists, one for building libs,
  another for building Blender - since it's useful to be able to build
  Blender, testing the libs work as expected.
2022-10-14 19:12:11 +11:00
06081d48e3 Deps: add comments noting why packages are installed
Some don't seem to be needed anymore, noted these in comments too.
2022-10-14 18:59:12 +11:00
b2ab9977bf Deps: use the locally built wayland-scanner for wayland_protocols
This removes the dependency on wayland-devel, with some potential
for errors caused from using two different versions.

Note that the generated files are currently unchanged.
2022-10-14 18:59:11 +11:00
695614ad3b Fix T101805: Blender icons doesn't show in GNOME 43
Use an app_id that matches the naming for the `.desktop`
file distributed with Blender.

Follow up to T101779.
2022-10-14 16:53:41 +11:00
e4e80058c8 Cleanup: simplify calculation of NDOF pan/zoom in 2D views
Make the logic for converting NDOF Z-motion to a scale value more
straightforward. Flipping the Z axis was scaling by negative-time,
now the entire pan vector is scaled by time and the zoom value is
calculated as `scale = 1 - (z * time)` instead of `1 + (z * -time)`.
Although they're equivalent, confusion here caused T100953.

Also clamp the scale (while unlikely, negative scale wasn't prevented).
2022-10-14 16:32:59 +11:00
1fbd300adb Fix: Curves sculpt adding resets attribute values
Error in 9088a1f476.
2022-10-13 18:21:39 -05:00
e8eed82bd5 Cleanup: Small changes to curves draw cache
- Remove unused include
- Avoid repeating blender:: namespace
- Remove timer left in by mistake in previous commit
2022-10-13 17:40:30 -05:00
98aa7276c8 Curves: Multithread position vertex buffer extraction
On a Ryzen 3700x I observed a 4ms improvement (from 5ms to 1ms)
on every redraw when sculpting with 88000 curves.
2022-10-13 17:21:23 -05:00
1703a8fb33 Build: Add TBB define to BMesh module
Allows using BLI_task.hh to write multithreaded code.
2022-10-13 14:48:35 -05:00
6beeba1ef5 Nodes: Duplicate Linked operator + User Preference option for Node Tree
This operator (Alt + D) allows users to explicitly create a linked copy
of a group node (same current behaviour for the Duplicate operator).

The duplicate operator (Shift + D) now takes the new User Preference
duplicate data option for Node Tree into account. It is by default
disabled, leading to no functional change for users.

Although we could make in the future make this option "on" by default,
to make it consistent with the rest of Blender we do not at the time.

Differential Revision: https://developer.blender.org/D16210
2022-10-13 20:06:20 +02:00
a5d3b648e3 Outliner: Use row background color for elements count indicator
From T101799:

Currently, the count indicator background and color are hardcoded to
black and white in an attempt to maximize contrast, at the expense of
being too prominent even when not needed.

Changing the background color to match the row (or any other element)
background, would make it look like the data-block icon is masked
out, improving readability while not standing out too much.

The circle background color should not have transparency, as it does
now. And the text inside should match the color of the text used for the
parent element (instead of hardcoded white). This should make it look
good in any theme.

---

Before:
{F13674265, size=full}

After:
{F13674269, size=full}

Differential Revision: https://developer.blender.org/D16246
2022-10-13 20:05:28 +02:00
6f190c669f Fix: Attribute layers can be skipped in Mesh to BMesh conversion
In some situations, layers were filled with their default value
when converting from Mesh to BMesh (entering edit mode, for example).
This was caused by the recently added "copy mesh to bmesh" or "merge
mesh to bmesh" custom data functions creating a difference custom
data format than was used for the copying functions used later.

`CustomData_to_bmesh_block` is not robust enough to handle simple
differences in layout between the layout of the source and result
CustomData layers, because it relies on the order of the types and
the number of layers within each type.

As a fix, make the "mesh to bmesh" special case more explicit in
the conversion functions. This makes the difference in the API
smaller, which is a nice improvement anwyay.

Fixes T101796
2022-10-13 12:43:04 -05:00
Sebastian Herholz
b2627dff49 Build: Upgrading OpenPGL version to 0.4.0 2022-10-13 17:45:14 +02:00
afd30e5e3a Fix: Crash updating draw cache of original curves data
Error in c67e5628d2 which mistook clearing
the pointer for clearing the values in the struct.
2022-10-13 09:37:12 -05:00
d292d635ea install_deps: Add system libdecor dev package.
ref. T101403
2022-10-13 14:49:29 +02:00
1a9480cf25 Realtime Compositor: Keep interpolation in Scale node
Currently, the scale node always changes the interpolation of its result
to bilinear. This was done because the scale node does not have an
interpolation option, unlike the Transform node, so a default of
bilinear was assumed. This turned out to be problematic, because in the
pixelation use cases, a nearest interpolation is typically preferred by
the user.

This patch changes the default interpolation of input nodes to bilinear,
makes the scale node keep the interpolation of the input it receives,
and makes the pixelate node changes the interpolation to nearest. In
effect, for non-pixelation use cases, the default bilinear interpolation
will be used, and for pixelation use cases, the nearest interpolation
will be used unless explicitly specified using a node that sets the
interpolation.
2022-10-13 12:42:43 +02:00
cbe1c1474b Fix T101501: Masks are not visible in Image Editor
Need to initialize the mask drawing overlays when the new space
is created. Otherwise the new space is configured in a way that
the splines are not visible and overlay opacity is 0.

This change fixes the new masking files created. The currently
saved ones need a manual tweak.
2022-10-13 12:26:36 +02:00
f95071028c UI: Fix wrong error message when trying to apply modifier
The error message when trying to apply a constructive modifier on a curve
object was wrong, "transform" makes no sense in this context.

Thanks Philipp for pointing it out!
2022-10-13 12:24:03 +02:00
4767a8eb4a Cleanup: simplify uv packing api
Affects paint.add_simple_uvs

No user visible changes.

Differential Revision: https://developer.blender.org/D16231
2022-10-13 23:07:12 +13:00
057e99d6df Cycles: use one instance of oneAPI gpu compiler by default
This change removes CMake code for automatic calculation of the number
of offline device compiler instances, to hand over control to developers
instead as it incurs a rather large memory usage with around 8GB per
instance at peak.
Use SYCL_OFFLINE_COMPILER_PARALLEL_JOBS CMake variable to configure it.
2022-10-13 10:49:30 +02:00
Werner, Stefan
c32a455605 Cleanup: Fixed some warnings
Some unused parameters were left after changing the oneAPI device code
to be a direclty linked shared library.
2022-10-13 09:45:53 +02:00
fabf4ee33d Fix T100699: Older preferences from 2.93 wont load
Even though this was intentionally removed in [0], loading data from
older startup files is supported. So show them when available.

[0]: 45439dfe4c
2022-10-13 17:36:30 +11:00
c67e5628d2 Cleanup: Use std::mutex for mesh runtime mutexes
Instead of allocating three separate ThreadMutex pointers,
just embed std::mutex into the struct directly.
2022-10-12 22:31:50 -05:00
375dafe3ef Build: use bash for build environment script
- Prefer bash over sh to so it's unambiguous which features can be used.
- Use array syntax to specify main package list, allowing to comment
  why packages are required and making git-blame easier to track down
  commits that add/remove packages.
- Add license header.
2022-10-13 13:20:58 +11:00
c34c6d3e25 Mesh: Move runtime data out of DNA
This commit replaces the `Mesh_Runtime` struct embedded in `Mesh`
with `blender::bke::MeshRuntime`. This has quite a few benefits:
- It's possible to use C++ types like `std::mutex`, `Array`,
  `BitVector`, etc. more easily
- Meshes saved in files are slightly smaller
- Copying and writing meshes is a bit more obvious without
  clearing of runtime data, etc.

The first is by far the most important. It will allows us to avoid a
bunch of manual memory management boilerplate that is error-prone and
annoying. It should also simplify future CoW improvements for runtime
data.

This patch doesn't change anything besides changing `mesh.runtime.data`
to `mesh.runtime->data`. The cleanups above will happen separately.

Differential Revision: https://developer.blender.org/D16180
2022-10-12 20:55:57 -05:00
b3e6a2888a Point Cloud: Support applying modifiers
The geometry nodes modifier can now be applied on point cloud objects.
This is basically a copy of the logic from 96bdd65e74
and 538da79c6d.
2022-10-12 19:16:37 -05:00
99f88281df Fix T101776: wrong logic for GLX setSwapInterval
Regression in 93e4b15767.
2022-10-13 10:27:22 +11:00
3980af7453 Fix T101779: Incorrect app_id on Wayland
Using the title as the app_id prevented the proper icon being used
under KDE-Plasma.
2022-10-13 10:10:26 +11:00
a481eb5576 Cleanup: Use correct blenkernel namespace for mesh functions 2022-10-12 17:41:35 -05:00
6c4210b97b Draw: Add missing TBB define to draw module
Allows improving performance with BLI_task.hh in draw extraction code.
Threading added in c15a63d21e improved performance by 3-4x
for me, but didn't make a difference until now.
2022-10-12 16:51:29 -05:00
7f921032c2 Cleanup: Remove deprecated socket variables
Last used in 62421470ee.
2022-10-12 16:10:06 -05:00
bcc56253e2 Fix T95683: FFmpeg seeking is broken
According to information I gathered, ffmpeg seeks internally using DTS
values instead of PTS. In some files DTS and PTS values are offset and
ffmpeg fails to seek correctly to keyframe located before requested PTS.

This issue become evident after hardcoded preseek of 25 frames was
removed and effort went into more precise seeking to improve
performance. It was thought, that this is bug in ffmpeg code, but
after reading some discussions, I don't think it is considered as such
by their developers, see below:
http://ffmpeg.org/pipermail/ffmpeg-devel/2018-March/226354.html
https://trac.ffmpeg.org/ticket/1189

Best solution seems to be to add small preseek value possibly at
detriment of performance, so 3 frames of preseek are applied. Number 3
was chosen experimentally.

Performance impact seems to be insignificant with this change.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D15847
2022-10-12 20:10:15 +02:00
a1bc05b200 Nodes: Add "Legacy" to legacy node UI names, skip in search
Currently there is no way to tell that these node types are deprecated
in the UI. This commit adds "(Legacy)" to the end of the names.
It also makes it simple to skip these in the various node searches
more automatically than before.

Fixes T101700

Differential Revision: https://developer.blender.org/D16223
2022-10-12 12:31:38 -05:00
0d25169dc5 Fix T101711: Curve to points node sometimes skips initializing radius
Don't add the radius attribute to point clouds by default, since not
having a radius attribute should be a valid state. The radius is only
set when a radius attribute also exists on curves.
2022-10-12 12:29:25 -05:00
a6db2c22b1 Cycles: Use 0.01m as default point cloud radius
Currently Cycles uses zero as a default radius when no "radius"
attribute exists. This is more confusing than helpful. Instead,
use the same default radius as EEVEE and Workbench.
2022-10-12 12:23:23 -05:00
605f87256e Cleanup: Decrease variable scope in UI region popup code 2022-10-12 12:19:28 -05:00
ba67a383fa Cycles: Enable MNEE on Metal (macOS >= 13)
This patch enables MNEE on macOS >= 13. There was an inefficiency in the calculation of spill requirements, fixed as of macOS 13. This patch also adds a temporary inlining workaround for a Metal compiler bug which causes `mnee_compute_constraint_derivatives` to behave incorrectly.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16235
2022-10-12 17:06:50 +01:00
d586f8962d Cleanup: EEVEE-Next: Add precision to comment 2022-10-12 17:39:23 +02:00
0610fc38b9 DRW: View: Expose matrices through interface 2022-10-12 17:39:23 +02:00
7a9a83f4a0 DRW: Wrappers: Add TextureRef to wrap around GPUTexture pointers
This adds the possibility to use the C++ API for other GPUTexture.
2022-10-12 17:39:23 +02:00
b249b3658c DRW: Fix gl error related to incorrect uniform size 2022-10-12 17:39:23 +02:00
4552924dcc Cleanup: DRW: Improve state_stencil documentation 2022-10-12 17:39:23 +02:00
aa5ce2fcc1 Cleanup: Use const vertex pointer argument 2022-10-12 10:08:10 -05:00
e38377d690 Cleanup: Reduce variable scope in vertex group mirror operator
Combined with the previous cleanup, this would have prevented T101773.
2022-10-12 10:04:54 -05:00
7e4786503c Cleanup: Remove macro usage in vertex group mirror operator
Avoiding a few lines of duplication is not worth the
confusion and worse debugging experience of macros.
2022-10-12 09:52:06 -05:00
a35d5378ad Fix T101773: Mirror Vertex Weights operator broken 2022-10-12 09:48:07 -05:00
a379fce14b Fix T101679: Duplicate objects are created when 'Make' override is called on existing override in 3DView
When the active selected object in the 3DView is already a local
liboverride, only perform the 'clear system flag' process on selected
objects, there is no point in trying to create an override out of it.
2022-10-12 11:45:25 +02:00
872a45f42b ImageEngine: Clamp image data to fit half float range.
When image data exceeds half float ranges values are set to +/-
infinity that could lead to artifacts later on in the pipeline.
Color management for example.

This patch adds a utility function `IMB_gpu_clamp_half_float`
that clamps full float values to fit within the range of
half floats.

This fixes T98575 and T101601.
2022-10-12 08:56:14 +02:00
78634b1fd1 Cleanup: minor edits to recent wayland/libdecor
Remove asserts committed by accident & simplify preprocessor checks.
2022-10-12 17:23:51 +11:00
f0e1089a33 GHOST/Wayland: only require libdecor when running in gnome-shell
- Support switching between libdecor and xdg_shell at run-time.

- Require libdecor when using gnome-shell, otherwise use xdg_shell.

- Gnome-shell detection checks for a gtk_shell* interface which
  isn't ideal however it's not possible to check server-side-decorations
  are supported without first creating a window.

- Unload Wayland libraries when Wayland fails to load.
2022-10-12 17:01:52 +11:00
0f60872461 Cleanup: Simplify node insert after drag code
- Give functions and variables more descriptive names
- Use references for arguments
- Use tree topology cache to avoid iterating over all links
- Group related code together
2022-10-11 20:33:31 -05:00
b9e4d930b3 Cleanup: use 'u' prefixed unsigned types 2022-10-12 10:39:12 +11:00
3f64b88684 Cleanup: use function style casts for C++, format & spelling 2022-10-12 10:39:12 +11:00
984b279ef1 Cleanup: use commented arguments for unused args in C++ 2022-10-12 10:39:12 +11:00
89bd261d9e Cleanup: Convert two nodes files to C++ 2022-10-11 18:17:37 -05:00
a80b1adc10 Cleanup: Comment formatting in BMesh operator 2022-10-11 18:17:37 -05:00
f5e6d4e4b0 Cleanup: Remove link drag search operations for socket templates
Besides texture nodes, which aren't supported anyway, we don't have any
builtin nodes that still use the socket template system, so this can be
removed.
2022-10-11 18:17:37 -05:00
37d83f0095 Cleanup: Reduce indentation in node attach operator 2022-10-11 18:17:37 -05:00
b7decab07e UV: add grid shape source to the uv editor, and add new "pixel" option
This change is part of a wider set of changes to implement Grid and Pixel
snapping in the UV Editor. This particular change adds a new third option,
`pixel grid`, to the previous grid options, `dynamic grid` and `fixed grid`.

Maniphest Tasks : T78391

Differential Revision: https://developer.blender.org/D16197
2022-10-12 11:27:41 +13:00
c2256bf7f7 Fix T90782: add uv pack option to specify margin as a fraction
A refactor of the margin calculation of UV packing, in anticipation
of multiple packing methods soon becoming available.

Three margin scaling methods are now available:

* "Add", Simple method, just add the margin. [0]
    (The default margin scale from Blender 2.8 and earlier.)
* "Scaled", Use scale of existing UVs to multiply margin.
    (The default from Blender 3.3+)
* "Fraction", a new (slow) method to precisely specify
    a fraction of the UV unit square for margin. [1]

The "fraction" code path implements a novel combined search / secant
root finding method which exploits domain knowledge to accelerate
convergence while remaining robust against bad input.

[0]: Resolves T85978
[1]: Resolves T90782

Differential Revision: https://developer.blender.org/D16121
2022-10-12 11:05:34 +13:00
a376c4c3c3 Nodes: Change Mix node link drag weighting
This lowers the search weight for color-specific
mix functions on non-color sockets.

Reported in blender.chat by simonthommes

Differential Revision: https://developer.blender.org/D16228
2022-10-11 22:59:22 +01:00
7636fc06ea Cleanup: Move draw_cache_impl_volume.c to C++ 2022-10-11 13:01:13 -05:00
48fd4a01ef Sculpt: Fix mask from cavity not redrawing viewport with modifiers 2022-10-11 10:11:16 -07:00
7119582b66 Sculpt: Fix T101595: sculpt_attribute_update_refs called in wrong place
Needs to go after the assignment to ob->sculpt->pbvh, not before.
2022-10-11 09:58:43 -07:00
188786f0b0 Sculpt: Fix T101718: Automasking crash with new texture paint
* 'Original coordinates' mode can't be used in image paint mode
(it does nothing in this case anyway).
* SCULPT_automasking_factor_get now returns 1.0 if
  a PBVH_REF_NONE vertex reference is passed in.
2022-10-11 09:58:41 -07:00
65b42d8c57 Fix T101709: Proportional editing being disabled in NLA Editor redo panel
Do not save the "use_proportional_edit" property if it is not supported.
This prevents it from being automatically disabled.

And hide "use_proportional_edit" in `SPACE_NLA`
2022-10-11 12:47:50 -03:00
4fc4005f6b deps_builder: add missing openpgl config file
harvesting openpgl_Exports-debug.cmake was missing for
windows in the build script, and we manually added it
to svn when openpgl landed when we realized it was
missing.

This fixes the issue at the root of the problem, so
the file will not be missing for future updates.
2022-10-11 09:14:10 -06:00
Alaska
0048820df8 Fix T101601: Compositor/Set cryptomatte alpha to 1.
Cryptomatte uses alpha node, which was altered to by default
apply the alpha. This patch changes it back to replacing the
alpha.

Reviewed By: jbakker

Maniphest Tasks: T101601

Differential Revision: https://developer.blender.org/D16165
2022-10-11 16:59:37 +02:00
009acfa477 Cleanup: Add missing include for parallel reduction
The parallel reduction file didn't include its own header, which can
yield "no previous declaration" warnings. This patch includes the header
to fix the warning.
2022-10-11 16:22:14 +02:00
37461b8bdd Cleanup: Remove unused spreadsheet geometry cache item 2022-10-11 08:52:18 -05:00
be44fd9401 Fix SVG tests: Add missing file 2022-10-11 15:13:30 +02:00
223ba59cb0 Beginning of automated SVG regression test
This commit contains the CTest integration.

Starting with the very simple tests for the recent fixes in the
io_corve_svg addon which were related on closing path.

The idea is to use same framework as what we use for render tests
to make it easily visible what aspect of SVG changed or broke.

In order to achieve this both .blend and .svg files are used.
The .svg file defines the exact subject of test, and the .blend
file defines camera, and possibly material.

The longer term idea is to have a number of atomic tests for a
specific SVG features to help isolating problematic areas, as
well as a more comprehensive tests to perform QA.
2022-10-11 15:03:09 +02:00
c425599216 Fix linker order of X11 and Wayland libs
For some compiler and linker configurations, linking would fail as the
wayland libs were linked at a high level and not at the actual code
where they were needed.

After talking to Campbell, we decided to clean up this part and now
only link both the X11 and Wayland libs where they are used.
2022-10-11 14:52:35 +02:00
50943f5dc7 Realtime Compositor: Implement variable size bokeh blur
This patch implements the variable size blur option in the Bokeh Blur
node. The implementation is different from the CPU one in that it also
takes the Bounding Box input into account, which is ignored for some
reason for the CPU. Additionally, this implementation does not do the
optimization where the search radius is limited relative to the maximum
value in the size texture. That's because the cost of computing the
maximum is not worth it for most use cases.

The reference implementation does three unexpected things that are
replicated here nonetheless. First, the center bokeh weight is always
ignored and assumed to be 1. Second the size of the center pixel is
taken into account. Third, a unidimensional distance is used instead of
a 2D euclidean one. Those need to be considered independently.

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

Reviewed By: Clement Foucault
2022-10-11 13:40:48 +02:00
0037411f55 Realtime Compositor: Implement parallel reduction
This patch implements generic parallel reduction for the realtime
compositor and implements the Levels operation as an example. This patch
also introduces the notion of a "Compositor Algorithm", which is a
reusable operation that can be used to construct other operations.

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

Reviewed By: Clement Foucault
2022-10-11 13:22:52 +02:00
f6a6992031 GPencil: Fix unreported Close Stroke operator did not select new points
When use the close stroke, the new created points were not addedd to the
selection.
2022-10-11 12:04:16 +02:00
Pratik Borhade
9a6dc39d4b Sculpt: Fix T101694: Change operator for unhide face sets
In 22c3db72ca `SHOW_ALL` has been removed from
`face_set_change_visibility`. Instead `SCULPT_OT_reveal_all` is now used
for unhiding all face sets.

Reviewed By: Joseph Eagar & Julian Kaspar
Differential Revision: https://developer.blender.org/D16199
Ref D16199
2022-10-11 02:49:45 -07:00
be27159527 Cleanup: rename base_index to ob_index in knife logic
This indexes the "objects" array, so rename 'b' and 'base_index'
to 'ob_index'.
2022-10-11 20:30:31 +11:00
2590626e77 Fix T101741: GPencil Outline modifier removes unexpectedly strokes
The stroke could be tagged before modifier and was removed due  the tag.

Now, the tag is reset before to avoid this problem.
2022-10-11 11:20:48 +02:00
2bacf1cb26 Fix T101721: Knife project crashes
The crash was caused by [0] however knife-project functionality has been
incorrect since [1] which would loop over each edit-mode object and run
the knife project function which operated on all edit-mode objects too.

- Resolve the crash by postponing face-tessellation recalculation
  until the knife tool has cut all objects

- Objects occluding each other is now supported
  (an old TODO and something that was never supported).

[0]: 690ecaae20
[1]: 6e77afe6ec
2022-10-11 20:19:13 +11:00
70ef334f08 GHOST/Wayland: correct the library path for libwayland-egl
Systems without `libwayland-egl.so` (Fedora 37 beta) failed to start,
as the name `libwayland-egl.so.0` wasn't correct.
2022-10-11 17:08:18 +11:00
9cd99684b0 Py Docs: Update to sphinx 5.2.3
Notable change is the improvements made to search.
2022-10-10 23:17:23 -04:00
b51d337adc GHOST/Wayland: print all dynamic loading failure when using Wayland
Previously only failure to dynamically load libdecor would report a
warning. Now report failure to load all Wayland libraries.

This was done because Wayland libraries (besides libdecor) are likely to
be installed on systems running Wayland. However it makes it difficult
to troubleshoot failure to load Wayland on systems with libdecor.

Only silence Wayland dynamic loading warnings when Wayland isn't running.
2022-10-11 11:14:40 +11:00
f495939e6e Correct argument type for BKE_pbvh_node_get_bm_orco_data, format 2022-10-11 11:06:32 +11:00
7f133b7a38 Sculpt: Clean up Dyntopo's original triangle api
Cleaned up Dyntopo original triangle API (which is deprecated):

* BMVerts for original triangles are now stored.
* BKE_pbvh_bmesh_update_topology now handles original triangle
* data properly.
* BKE_pbvh_bmesh_node_save_orig can now initialize the original
  coordinates from the current BMLogEntry.
* Ray casting of original data now returns active vertex.
  Should fix various random crashes.

Hopefully this will fix a number of bugs.
2022-10-10 14:45:48 -07:00
dc1418e5d9 Sculpt: Fix T101674: Passing null to GPU_batch_elembuf_set 2022-10-10 14:08:02 -07:00
da25006bc4 Sculpt: T101699: Face set change visibility crashes on no face sets
Cleaned up sculpt_face_sets_change_visibility_exec some more:

* SCULPT_UNDO_HIDDEN is now pushed instead of SCULPT_UNDO_FACE_SETS
  (since face sets no longer encode visibility).
* Added branches for if face sets do not exist.
* Cleaned up independent if statements into a switch.
2022-10-10 13:34:37 -07:00
473df37134 Sculpt: Fix T101729: Automasking crash in elastic deform brush
Was missing a call to SCULPT_automasking_node_update.
2022-10-10 13:05:43 -07:00
9b8be81eef deps_builder: Add support for cve-bin-tool
This change adds support for intels cve-bin-tool [1]
in the deps builder. This adds 2 new targets to the
builder that do not build automatically but can be
build on demand when required.

`make cve_check` will output to the console.
`make cve_check_html` will output a html file that
can be shared with other people.

Requirements:

- A working installation of cve-bin-tool on the system

Not required but higly recommended:

- Obtaining a key from the nvd [2] to speed up the
  database download. you can pass the key to cmake
  using `-DCVE_CHECK_NVD_KEY=your_api_key`

[1] https://github.com/intel/cve-bin-tool
[2] https://nvd.nist.gov/developers/request-an-api-key

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16160
2022-10-10 11:48:05 -06:00
03fd2f7a5a Fix building WITH_HEADLESS
An earlier commit removed the '#ifdef' check for the function call but not for
the function declaration.
2022-10-10 18:16:29 +02:00
9a8746dff1 Cleanup: clang-format 2022-10-10 17:57:25 +02:00
95aac5df73 Fix T101651: Cycles crashes when failing to initialize render device
The issue here was that PathTraceWork was set up before checking if
any error occurred, and it didn't account for the dummy device so
it called a non-implemented function.

This fix therefore avoids creating PathTraceWork for dummy devices
and checks for device creation errors earlier in the process.
2022-10-10 17:55:08 +02:00
Damien Picard
7d7318f6c5 I18n: disambiguate message "World"
The confusion is about World as an ID type, and the World coordinates.

Use no context for the latter, and either `BLT_I18NCONTEXT_ID_WORLD`,
or other more fine-grained contexts when needed as part of enums for the
former.

The message from the custom HDRI installation operator cannot be
disambiguated right now, because Python enums don't support contexts.

Ref T43295

Reviewed By: mont29

Maniphest Tasks: T43295

Differential Revision: https://developer.blender.org/D16194
2022-10-10 17:37:32 +02:00
Thibault de Villèle
962b647690 Cleanup: NLA transforms, simplify recalcData_nla()
Refactor the `recalcData_nla()` function, which takes data from the
transform system and updates NLA strips, such that the actual logic to
change the strip is moved into its own function.

This also moves some generic code (find prev/next strip) from that
function to BKE.

This is to make the code easier to adjust when different transform
operations need to perform different modifications of the strip (i.e. to
fix T101130).

Manifest Task: T101130

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D16181
2022-10-10 17:28:35 +02:00
82a5790d2a Cycles: oneAPI: Trigger compilation of used kernels only
JIT compilation of oneAPI kernels now happens during load stage
and proper message gets shown in the GUI during compilation.
Also, this implementation skips kernels that aren't needed for
the used scene, reducing overall (re)compilation time.
2022-10-10 16:38:11 +02:00
bb8dba8609 Fix missing view layer update when iterating a collection from Python.
The previous fix ignored the most fundamental access operation.

Follow up to 4a60c4746d fixing 68589a31eb.
2022-10-10 17:13:06 +03:00
Charlie Jolly
f5e1a2119d Node: Add blend modes to Mix node link drag search
Allows searching for Mix blend modes
e.g. Overlay when using link drag search

Requested by @simonthommes in GN chat

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D16209
2022-10-10 14:36:44 +01:00
25b745ae85 IO: support Presets in Alembic, Collada, OBJ, STL, USD importers
The exporters already had Preset functionality, but the importers
did not.
2022-10-10 16:01:18 +03:00
499af28a35 IO: remove BKE_layer_collection_resync_forbid & allow
Part of T101073: after the view layer sync was made lazy (D15885), the
BKE_layer_collection_resync_forbid and BKE_layer_collection_resync_allow
in Alembic/USD/OBJ importers is no longer needed, as long as they do
view layer dependent operations (selecting new objects) in a separate
loop after creating all the objects.

Verified that this does not regress import times for 26k objects OBJ
scene (Blender 3.0 splash) and 250k objects USD scene (Moana).
2022-10-10 14:06:54 +03:00
Damien Picard
b099cf73ae I18n: disambiguate or extract a few messages
Disambiguate:
- "Active Only" (GPencil copy material and layer, add NLA modifier)
- "Clip" (movie clip, image extension mode)
- "Emission" (particles)
- "New" (scene)
- "Tracking" (movie clip)

Extract:
- "ViewLayer", the default view layer name when creating new scene

Ref T43295

Reviewed By: mont29

Maniphest Tasks: T43295

Differential Revision: https://developer.blender.org/D16196
2022-10-10 13:03:26 +02:00
Damien Picard
9b2d682394 I18n: fix popup menus context
When calling `wm.call_menu_pie` and `wm.call_menu`, the menu context
was ignored when showing its name in the header or pie menu center.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D16195
2022-10-10 13:01:18 +02:00
9df9397ae8 EEVEE-Next: Fix surface deferred shader compilation in debug mode 2022-10-10 11:09:29 +02:00
f77eadc203 GHOST/Wayland: warn when falling back to X11 because of missing libdecor
X11 is used as a fallback when libdecor isn't found on the users system.

Now print a warning when Blender falls back to X11 and a missing
libdecor is the only reason wayland could not be used.

Only print this warning when using Wayland so this warning doesn't show
on X11 systems which have Wayland libraries installed.

Addresses T101715.
2022-10-10 19:50:33 +11:00
d855f5fdcd Fix typos & co in UI messages. 2022-10-10 10:36:15 +02:00
42b1a7d4c6 OBJ: add global scale factor import setting
Requested in D16095 proposal - also USD & Alembic have import scale
option; OBJ has an export scale object but the import scale
was not there for some reason.
2022-10-10 10:10:46 +03:00
a24f11e0ec UI: show the windowing environment in the "About" splash
Show the windowing environment on non MS-Windows/Apple systems,
since X11/WAYLAND are selected startup there was no convenient way
for users to know which back-end was being used.

Include the windowing environment in the About splash & system-info.txt
since it will be useful for handling bug reports.

This commit adds a private API call not intended for general use
as I would like to be able to remove this later and it's only needed
in the specific case of testing if Blender is using WAYLAND or X11
(which maybe be used via XWayland).

Python scripts can already inspect the system to check which windowing
environment used, the API call is mainly useful for troubleshooting.
2022-10-10 11:22:41 +11:00
210f4db81c Cleanup: spelling in comments 2022-10-10 11:22:41 +11:00
e0ad4712f6 Cleanup: quiet warnings, format 2022-10-10 11:22:41 +11:00
aaa731a782 Partially fix T101702: OSL Shaders with boolean inputs crash
OSL (like Cycles) has no internal boolean type, instead an integer
input can be flagged to be shown as a boolean in the UI.
Cycles reacts to this by creating a boolean socket on the Blender
side, but as a result incorrectly called the boolean overload of the
set function even though the internal type is an integer.

There's another unrelated crash in the GPU viewport shader code that
appears to apply to every OSL node that outputs a shader, and the file
in T101702 triggers both, so this is only a partial fix for the report.
2022-10-10 01:03:12 +02:00
bd2f002e71 Fix T101685: OBJ importer does not assign proper material if "usemtl" is before "o"
The importer logic was wrongly resetting "current material name"
upon encountering a new object ("o" command). However as per OBJ
specification, this is incorrect:

> Specifies the material name for the element following it. Once a
> material is assigned, it cannot be turned off; it can only be
> changed.

Fixes T101685. Test coverage for this was added in svn tests repo.
2022-10-09 21:21:31 +03:00
c2fb85282d OBJ: extend importer tests to test imported material expectations
Previously "which material got assigned to an object in the end"
was not covered by tests. This is preparation for fixing T101685.
2022-10-09 20:52:23 +03:00
af34c13da4 Cleanup: Remove data duplication from large array in eevee_camera.hh
Use `inline constexpr` instead of `static const` to prevent these
variables from being duplicated in each translation unit that includes
the eevee_camera.hh header (was included into 17 different object files
with MSVC).

Differential Revision: https://developer.blender.org/D16200
2022-10-09 00:34:59 -07:00
cee6c07f9e Set operator poll message when vertex group is locked
Differential Revision: https://developer.blender.org/D16190
2022-10-08 11:43:38 -07:00
f61ff22967 Attribute Node: support accessing attributes of View Layer and Scene.
The attribute node already allows accessing attributes associated
with objects and meshes, which allows changing the behavior of the
same material between different objects or instances. The same idea
can be extended to an even more global level of layers and scenes.

Currently view layers provide an option to replace all materials
with a different one. However, since the same material will be applied
to all objects in the layer, varying the behavior between layers while
preserving distinct materials requires duplicating objects.

Providing access to properties of layers and scenes via the attribute
node enables making materials with built-in switches or settings that
can be controlled globally at the view layer level. This is probably
most useful for complex NPR shading and compositing. Like with objects,
the node can also access built-in scene properties, like render resolution
or FOV of the active camera. Lookup is also attempted in World, similar
to how the Object mode checks the Mesh datablock.

In Cycles this mode is implemented by replacing the attribute node with
the attribute value during sync, allowing constant folding to take the
values into account. This means however that materials that use this
feature have to be re-synced upon any changes to scene, world or camera.

The Eevee version uses a new uniform buffer containing a sorted array
mapping name hashes to values, with binary search lookup. The array
is limited to 512 entries, which is effectively limitless even
considering it is shared by all materials in the scene; it is also
just 16KB of memory so no point trying to optimize further.
The buffer has to be rebuilt when new attributes are detected in a
material, so the draw engine keeps a table of recently seen attribute
names to minimize the chance of extra rebuilds mid-draw.

Differential Revision: https://developer.blender.org/D15941
2022-10-08 16:43:18 +03:00
a716e69658 Cleanup: Use helper function for previous mesh loop 2022-10-07 22:46:52 -05:00
577a79b485 Cleanup: Fix outdated mesh data comments 2022-10-07 22:46:52 -05:00
f9ab2214ae Linux: enable WAYLAND by default
Enable the following CMake options:

- WITH_GHOST_WAYLAND
  Enable Wayland which is now included as part the bundled dependencies.
  When the pre-compiled libraries aren't used, only X11 will be enabled.

- WITH_GHOST_WAYLAND_DYNLOAD
  So systems without libwayland can fall back to X11.

- WITH_GHOST_WAYLAND_LIBDECOR
  To draw window frames on WAYLAND compositors such as gnome-shell which
  expect client-side decorations (without this the Blender window is
  borderless).

  Unfortunately there doesn't seem to be a reliable way to know if the
  compositors handles server-side decorations, so libdecor is required
  for Wayland to be used even with KDE and tiling compositors where it's
  not needed. Although this is an area that could use some further
  investigation - possibly bundling libdecor or handling client-side
  decorations in Blender.

The final part of D16091.
2022-10-08 13:26:33 +11:00
18c045a35f Build: show X11 & Wayland options on first run 2022-10-08 13:16:11 +11:00
Iliya Katueshenock
3d209d1619 Mesh: Multithread some boolean domain interpolation logic
This can improve performance by 3-10x in some simple test cases,
when reading a boolean attribute on a different domain from the
one it's stored on.

Differential Revision: https://developer.blender.org/D16054
2022-10-07 17:54:24 -05:00
af288a09a5 Viewport: Enable draw_debug.cc code when WITH_DRAW_DEBUG is on 2022-10-07 15:40:41 -07:00
Laurynas Duburas
f3f0ea8dc2 Curve: Retain active NURBS curve after point deletion
Before, the active spline index and the active point index were always
cleared. Now the active index is only cleared when the curve/surface is
deleted. This was accomplished by making the surface patch delete
function handle that correctly. The spline deletion already handled it.

This fixes only vertex deletion mode.
Fixes problem mentioned in T101160.

Differential Revision: https://developer.blender.org/D16133
2022-10-07 16:33:50 -05:00
d779792977 Build: reference bundled wayland and libdecor headers
When using pre-compiled libs, reference the bundled wayland headers,
needed so the headers from the bundled wayland-scanner are compatible.

Part of D16091.
2022-10-08 08:00:17 +11:00
66f184d981 Deps: add libdecor for Wayland window frames
Include libdecor, note that this only bundles a header file
as Blender dynamically loads on the system at run-time.

Part of D16091.
2022-10-08 08:00:08 +11:00
b083755c20 Deps: harvest Wayland headers, build Wayland libraries
The headers on centOS7 (Wayland 1.15) aren't compatible with the headers
generated by wayland-scanner 1.20.

Include the headers to support building Wayland on systems with
older Wayland installed.

Using these headers will be part of a separate commit.

Part of D16091.
2022-10-08 08:00:04 +11:00
f63179cc9f Fix T101424: Empty group node added to node add search
The group node type polls true, but adding an empty group node isn't
useful, so just skip it.
2022-10-07 12:32:23 -05:00
Nate Rupsis
f96b729d7b FIX T101275: Regression in NLA causes Actions to be ignored by Context menu (I.e influence, etc)
Reviewed By: sybren

Differential Revision: http://developer.blender.org/D16154
2022-10-07 11:03:24 -05:00
9cf2b413c2 Fix small errors in tool tips for path guiding
Contributed by Alaska.

Differential Revision: https://developer.blender.org/D16166
2022-10-07 17:59:22 +02:00
349091ce00 Cleanup: Move editmesh_undo.c to C++
To allow moving mesh runtime data to C++ (D16180).
2022-10-07 10:41:19 -05:00
1a5c57cdec Fix: One-API build issue on windows.
Flags were not properly passed to the
compiler.
2022-10-07 09:16:29 -06:00
bf85074148 GPencil: New Fill Extend lines adjust with MMB
The actual length of extension lines can be adjusted using wheel mouse 
but this is very inconvenient for tablet users.

Now, the extension can be adjusted using MMB of the pen.

There was a similar request in Right-Click Select

Reviewed By: Matias Mendiola, Daniel Martinez Lara

Differential Revision: https://developer.blender.org/D16128
2022-10-07 16:18:56 +02:00
3714d3c3ce Cycles: link oneAPI backend with debug version of sycl when in Debug
It fixes SYCL runtime issues in Debug builds that were due to mixing
Release and Debug MSVC runtimes.
This commit also removes specific handling of dpcpp compiler executable
to simplify the CMake implementation. Using it like clang++ works and
clang++ executable is also available from Intel oneAPI DPC++ compiler in
case it doesn't.
2022-10-07 16:14:50 +02:00
331f850056 Cleanup: redundant parenthesis 2022-10-07 22:55:03 +11:00
11abeae99f Cleanup: use function style casts for C++ 2022-10-07 22:55:03 +11:00
9dec9eee0d Cleanup: DRW: Rename ViewInfos to ViewMatrices
This makes sense now that the struct only contains matrices.
2022-10-07 13:15:22 +02:00
bae22ac7b4 DRW: Remove mouse_pixel and is_inverted from ViewInfos
This is part of the effor to simplify the View struct in order to implement
multiview rendering.

`mouse_pixel` is only use for debug purpose and will be reintroduced later.
`is_inverted` is moved to `draw::View`.
2022-10-07 13:13:23 +02:00
6fd557e2c2 DRW: Remove viewport_size from DRWView
This is part of the effor to simplify the View struct in order to implement
multiview rendering.
2022-10-07 12:43:10 +02:00
f8384485fc EEVEE-Next: Use global viewport size instead of DRWView one
This is part of the effor to simplify the View struct in order to implement
multiview rendering.
2022-10-07 12:43:10 +02:00
7b9ce3af98 GPencil: Use global viewport size instead of DRWView one
This is part of the effor to simplify the View struct in order to implement
multiview rendering.
2022-10-07 12:43:10 +02:00
f11b3ed9b0 Basic: Use global viewport size instead of DRWView one
This is part of the effor to simplify the View struct in order to implement
multiview rendering.
2022-10-07 12:43:10 +02:00
70b35c7ad0 Overlay: Use global viewport size instead of DRWView one
This is part of the effor to simplify the View struct in order to implement
multiview rendering.
2022-10-07 12:43:10 +02:00
126d485b83 DRW: Remove screen_vecs
These were only a normalized copy of the XY axes of the inverse viewmat.
But since the viewmatrix is always normalized we can use it directly.
2022-10-07 12:43:10 +02:00
a945cf4d0f DRW: Move clipping planes to their own UBO
This is part of the effor to simplify the View struct in order to implement
multiview rendering.
2022-10-07 12:43:10 +02:00
223f970407 EEVEE: Move reflection clip plane to local storage
This avoid dependency with the draw view.
2022-10-07 12:43:09 +02:00
a775e42dee DRW: Use view_clipping_distances instead of world_clip_planes_set_clip_distance
No functional change. `view_clipping_distances` is prefered as it is
auto masked.
2022-10-07 12:43:09 +02:00
8f96d0f732 DRW: Remove view vectors
This is part of the effor to simplify the View struct in order to implement
multiview rendering.

The viewvecs can easilly be replace by projection matrix operation.
Even if slightly more complex, there is no performance impact.
2022-10-07 12:43:09 +02:00
03a7f1d7b1 DRW: Move CameraTexCoFactors to engine specific storage
This is part of the effor to simplify the View struct in order to implement
multiview rendering.

The CameraTexCoFactors being only valid for a single view, and being only
used in very few places, it make sense to move it to the engine side.
2022-10-07 12:43:09 +02:00
055680a89e DRW: Split ViewCullingData out of ViewInfos
This is in order to reduce the size of ViewInfos and support multi view
rendering.
2022-10-07 12:43:09 +02:00
f43c2d9abe Armature Modifier: skip non-deforming vertices in Multi-Modifier mode.
The modifier already contained a check to skip complex processing of
vertices that won't produce any deformation due to the vertex group
mask, but this only works for the non-Multi Modifier case. This adds
a similar check for the Multi Modifier mode.

Differential Revision: https://developer.blender.org/D16152
2022-10-07 13:11:44 +03:00
f7a781d45f Fix T101547: Add update notifiers in dopesheet and timeline selection operators
Updates the function checking if a container can have grease pencil layer keyframes, to account for dopesheet in main mode, and timeline.

Reviewed By: Sybren A. Stüvel

Differential Revision: http://developer.blender.org/D16132
2022-10-07 11:44:27 +02:00
87ef423e6e Fix missing header include when using timeit feature. 2022-10-07 11:32:13 +02:00
412d670e9c Refactor: adding function to check if an animation container has grease pencil layer keyframes.
Used in action_select to refactor the selection operators.

No functional changes.

Reviewed By: Sybren A. Stüvel

Differential Revision: http://developer.blender.org/D16168
2022-10-07 11:07:02 +02:00
7eeeaec6da Cycles: use direct linking for oneAPI backend
This is a minimal set of changes, allowing a lot of cleanup that can
happen afterward as it allows sycl method and objects to be used outside
of kernel.cpp.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D15397
2022-10-07 09:50:05 +02:00
fc0b1627eb Fix T100953: Zooming with NDOF is inverted in the camera view
Use convention for applying zoom in other 2D views.
2022-10-07 17:46:25 +11:00
3522c6e59c Cleanup: replace static variables with arguments
Functions in vfontdata_freetype.c used static variables instead of
argument parsing. This originates from initial freetype support [0].

This didn't cause problems as callers use a global lock, however it
makes the code more difficult to follow means we can more easily remove
the lock in the future.

[0]: d4f9678b39
2022-10-07 16:44:13 +11:00
0d16625d35 Cleanup: use doxy sections
Also use doxy syntax for some comments.
2022-10-07 16:05:39 +11:00
650beef4b6 GHOST/Wayland: silence warnings for modifier key handling in GNOME
GNOME (mutter) intentionally doesn't follow the Wayland spec for the
keyboard_enter events (held keys are always an empty array).

This means we can't know which keys are held on window activation,
making the result of getModifierKeys invalid (in that we don't know
which modifiers are held).

Detect this situation and suppress warnings as the issue has been
reported and it doesn't help for users to see noisy warnings for
a known problem.
2022-10-07 15:53:47 +11:00
a0af1e3971 GHOST/Wayland: improve logging messages for keyboard events 2022-10-07 15:53:46 +11:00
cafd204af6 Cleanup: remove redundant 'using'
clang-tidy converts C-style typedefs to this style,
but the "using ..." isn't needed.
2022-10-07 14:36:35 +11:00
47d3e76567 3D View: depth sort candidates in the selection menu
Objects/bones in the selection menu weren't ordered usefully,
worse, the closest items could be left out of the menu since items
would stop being added once the menu-size limit was reached.

Resolve this by sorting the menu items by depth, removing the most
distant when the number of items exceeds the limit.

When Ctrl is held, order by the distance to the object center
instead of depth.
2022-10-07 13:26:43 +11:00
3b77d60b6c Cleanup: share factory reset properties 2022-10-07 13:19:13 +11:00
db2b889618 Cleanup: quiet compiler shadowed variable warning 2022-10-07 13:19:12 +11:00
104fd82f74 Fix for T101481: Improved VFont Loading
Remove redundancy in the testing and loading of VFont fonts. Includes
improved setting of character map for using Wingding and Symbol fonts.

See D16174 for more details.

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

Reviewed by Campbell Barton
2022-10-06 18:02:40 -07:00
781d03efe4 Preferences: support loading factory settings only for app-templates
When app-templates are enabled, support resetting defaults only for the
app-templates.

Without this, it's not possible to reset app-template preferences
without also resetting the default preferences for all settings the
app-template does not override (used when there is no application
template loaded, and other app-templates).

These additional menu items are shown in menus when an app-template has
been loaded.

Address issue raised by T96427.

Reviewed By: mont29, brecht

Ref D16150
2022-10-07 10:50:17 +11:00
4eb3e7ff86 Cleanup: compiler warning 2022-10-07 10:42:56 +11:00
ecc404ea1a Cleanup: spelling in comments 2022-10-07 10:42:56 +11:00
b04b87b322 Cleanup: Avoid inconsistent naming in mesh topology API
Mesh corners are called "loops" in the code currently. Avoid diverging
naming and just use that convention in some newly added code.
2022-10-06 17:35:02 -05:00
79b1e267ef Cleanup: Move subdiv_ccg.c to C++
In preparation for moving mesh runtime data to C++
2022-10-06 17:24:16 -05:00
406a98aff8 Cleanup: Move eight modifier files to C++
In preparation for moving mesh runtime data to C++.
2022-10-06 16:08:07 -05:00
53d937a170 Sculpt: Raise pbvh->leaf_limit to 400 for dyntopo
Setting pbvh->leaf_limit (the max triangles per node)
too low results in lots of distinct GPU meshes, which
can be slow for even moderately sized sculpt meshes
(starts to be a problem around 100-150k triangles).
2022-10-06 14:06:16 -07:00
dfa0eb298e Sculpt: Fix T101502: GPU tris miscounted for dyntopo
Dyntopo PBVH draw was miscounting the number of triangles.
2022-10-06 14:04:12 -07:00
eae3fa8730 Cleanup: Move subdiv_modifier.c to C++
In preparation for moving mesh runtime data to a C++ type
2022-10-06 15:48:02 -05:00
d4f77c2266 Cleanup: Move shrinkwrap.c to C++ 2022-10-06 15:48:02 -05:00
f58b524669 Sculpt: Fix bug in sculpt attribute api
SculptAttribute.domain wasn't being set
when creating from an existing CustomData
attribute.
2022-10-06 13:19:35 -07:00
65c8c83679 Fix: Properly free non-trivial node editor runtime type 2022-10-06 15:07:09 -05:00
14de57713d Cleanup: Remove unnecessary MOD_nodes.h includes 2022-10-06 15:07:09 -05:00
0d0e2dc0a8 DRW: fix use of potentially uninitialized variable
Bug introduced in rB6774cae3f25b.

This causes undefined behavior in `DRW_state_draw_support()` making
overlay depth drawing unpredictable.
2022-10-06 16:04:11 -03:00
be8ee05dcb Fix for T53332: BFont 43 Inaccessible Glyphs
Preloading of BFont (default for 3D Text Objects) glyphs will not load
any with a character code greater than 256, resulting in 43 characters
that are inaccessible. This patch corrects that preloading code.

See D16122 for more details

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

Reviewed by Campbell Barton
2022-10-06 10:36:57 -07:00
c592bff047 Animation: Expose "mute" for drivers in their properties UI
In the driver editor and the "edit driver" popover, add a checkbox that
can mute the driver. This is the same functionality as the checkbox in
the driver editor's channel list, but then exposed in a different place
in the UI.

This is for convenience, such that a driver can now be muted by
right-clicking on the driven property, choosing "Edit Driver", then
muting it there. The same checkbox was added to the regular driver
editor's header for consistency.

Reviewed By: Severin

Maniphest Tasks: T101592

Differential Revision: https://developer.blender.org/D16173
2022-10-06 19:07:33 +02:00
46c40d7fa1 Fix: Use after free in geometry node group logger
The name of the node group in the geometry nodes logger is created
in `GeoModifierLog::get_local_tree_logger`, where it references the
compute context. However, the compute context is a local variable
that doesn't live as long as the log. Therefore the log needs to own
the node group name.

Removing the ownership from `NodeGroupComputeContext` may be
possible as well, but seems less obviously correct. This can be a
temporary solution until we can completely avoid storing strings
in the logger (see D15775).

Fixes T101599
2022-10-06 11:58:11 -05:00
26df25caef UI: remove extraneous inversion of "inverted" button state
Fix an issue where a `UI_BTYPE_CHECKBOX_N` button couldn't be toggled.

When toggling the value of a property, the `UI_BTYPE_TOGGLE_N`,
`UI_BTYPE_ICON_TOGGLE_N`, and `UI_BTYPE_CHECKBOX_N` types shouldn't
matter. These determine the inverted display of the value, but toggles
of that value should still happen once.

For these button types, the toggle happened twice, effectively making it
a no-op. The code for individual values is now also consistent with the
code for handling bit-flags.

Actually found & over-the-shoulder-reviewed by @Severin
2022-10-06 18:54:36 +02:00
bd77cdde58 Build Environment: Update Ubuntu instructions to include bison
Ubuntu also requires bison (just like macOS seems to do).
2022-10-06 18:09:29 +02:00
0f224ceedb Cleanup: Move multires.c to C++ 2022-10-06 10:49:24 -05:00
dc93235797 GPencil: Use new icons for Envelope and Outline modifiers
Before both modifiers were using Skin icon.
2022-10-06 17:25:38 +02:00
6942f05848 UI: New modifier Icons Envelope and Outline
Task: T101155

Designed by: Matias Mendiola
Reviewed by : Pablo Vazquez
2022-10-06 17:16:56 +02:00
29e1cd75fa Linux CentOS 7 setup script
Add a script to set up a Linux CentOS 7 machine so that it can be used
to build the precompiled libraries for Linux.

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D16171
2022-10-06 16:59:07 +02:00
Sebastian Herholz
e1a3348755 Fix T101458: Changing volume density when pg is enabled causes crash
Changing volume parameters during rendering could cause a crash
when guiding was enabled. It was due to an unintialized state paramter
at the beginning of the path tracing process.

In addition guiding is disabled when dealing with almost delta volumes
(i.e., g close to 1.0 or -1.0).
2022-10-06 14:39:51 +02:00
423c1366b0 Fix T101618: Freeze when reloading a library in certain situation
Freeze happened when reloading a library while having an Object property
with a custom getter function defined in Python.

Just piggybacking on rB62eb21e3ce87, this just applies the same fix (use
the BPy_BEGIN/END_ALLOW_THREADS macros) to relading from RNA/py.

All credit goes to @brecht and @mont29.

Maniphest Tasks: T101618

Differential Revision: https://developer.blender.org/D16167
2022-10-06 14:18:02 +02:00
a01ab2b4e0 Fix T101492: UV stitch crash (more than 32 objects selected)
Crash happened when adjusting operator props in Adjust Last Operation
panel.

When there are more than 32 objects selected in muti-object-editmode, we
are running into RNA array limit (`objects_selection_count` is defined as
an RNA array (which can only hold 32 entries, see
`RNA_MAX_ARRAY_LENGTH`), leading to reading random memory errors.

While there might be ways to make this work with more than 32 selected
objects (e.g. by instead using a collection, or investigate supporting
dynamic sized arrays for run-time RNA), this patch only cancels the
operator with a report message (instead of crashing).

Maniphest Tasks: T101492

Differential Revision: https://developer.blender.org/D16115
2022-10-06 14:11:02 +02:00
25533ac22d Fix T101517: GPencil strokes snap to origin in a Scale value is on 0
The problem was the conversion to object space converted the
points to zero.

Now, the new function `zero_axis_bias_m4` is used in order to add
a small bias in the inverse matrix and avoid the zero points.

A known math issue is the stroke can be offsetted if the scale is set to 1 
again. In this case apply the scale to reset to 1.

Differential Revision: https://developer.blender.org/D16162
2022-10-06 13:30:09 +02:00
7163a83450 Fix addons submodule ref
Was downgraded to a version from 2019 by mistake
2022-10-06 12:53:19 +02:00
Damien Picard
8b485e7226 I18n: ignore user-installed add-ons when extracting bl_info
Since add-on info was made translatable in D15747, user-installed
add-ons could also get their info extracted. This led to having
different messages depending on the environment of the Blender doing
the I18n messages update.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15963
2022-10-06 10:28:18 +02:00
247af8cf5b UI Translations: Add context to 'New' menu entries for files.
Aftermath of rBf5d67f3fdf2d and rBa096248d1253, from D16159 (did not
apply direclty).
2022-10-06 10:16:09 +02:00
0484b6bb18 Fix T101591: mathutils.geometry.intersect_line_line 2D vector error
Uninitialized stack memory was used when intersecting 2D vectors.
2022-10-06 17:33:50 +11:00
707c7de21f Fix T101628: Correct frame node intersection in add reroute operator
Fix reroute nodes added via the cut link gesture being parented to the
wrong frame node.

The frame's bounds that are used for the intersection test with the
newly added reroute are in view space, but the reroute's location was
given in the node tree's coordinate space, when the add reroute
operator was recently refactored (56193eccf6).

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D16163
2022-10-06 07:35:35 +02:00
c2c31afa92 Cleanup: split BLF glyph rendering into a function
This makes the drawing loop easier to follow.
2022-10-06 16:28:12 +11:00
RedMser
6fac4bb8b0 Curve: increase max of order U/V
Uses soft and hard max of the resolution properties.

Range for order U/V was 2-6, but after testing higher max values with
NURB splines and surfaces with many control points, no problems were
found.

Reviewed By: campbellbarton

Ref D13918
2022-10-06 13:17:21 +11:00
63ed9550e9 Fix exception in bpy_extras.object_utils.object_data_add(..)
Adding object-data that doesn't support edit-mode would raise an
exception when the "Enter Edit Mode" preferences was enabled.

Other changes:

- Don't attempt to enter edit-mode for library-data.
- Support entering edit-mode for grease-pencil objects.

Alternate fix for the issue raised by D15999.
2022-10-06 13:07:16 +11:00
68ea6c85ab Fix: File context menu broken after recent commit
layout.menu does not have a text_context argument.
f5d67f3fdf
2022-10-06 12:49:22 +11:00
86352364a6 3D View: use float for ED_view3d_project_base & minor changes
Using 'short' was historic (as the value was stored in the Base).
Prefer floats which allow sub-pixel distances to be differentiated.

Also remove IS_CLIPPED assignment as this only made sense when the
values were stored in the Base, without any other ways to check
if projection failed.
2022-10-06 12:35:28 +11:00
87d737cd79 Cleanup: spelling in code comments 2022-10-06 12:13:00 +11:00
51bd26d0fa New math function to add small bias to zero axis
In some situations the zero axis can produce problems and need to add a small bias.

This function adds a small bias using the orthogonal result of the others valid axis.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D16158
6d
2022-10-05 22:11:08 +02:00
1ff51f30ad GPencil: Use stroke function for convert points
The stroke function is faster because the matrix 
is inverted only once.
2022-10-05 22:11:08 +02:00
bfeb64d620 Cleanup: make format 2022-10-05 21:40:58 +02:00
9d40b1cc3e Sculpt: Fix crash in face set init 2022-10-05 12:38:26 -07:00
38af785dba Sculpt: Fix crash in dyntopo draw 2022-10-05 12:38:26 -07:00
a096248d12 Fix: File menu broken after recent commit
layout.menu does not have a text_context argument.
f5d67f3fdf
2022-10-05 13:48:01 -05:00
548a2cbe06 Cleanup: Clang tidy
Also remove unnecessary struct keywords in C++ files.
2022-10-05 13:48:01 -05:00
6306d747b7 DRW: Split ViewProjectionMatrix in order to increase precision
This also removes the need to compute the persmat and saves some memory
from the `ViewInfos` struct. This is needed to allow multiview support.

Initial testing found no major performance regression during vertex
heavy workload.

Test file: {F13610017}

Results:
| Platform | Master | Split Matrix|
| Linux + Mesa + AMD W6600 | 48 fps | 47 fps |
| Macbook Pro M1 | 50 fps | 51 fps |
| Linux + NVidia 1080Ti | 51 fps | 52 fps |
| Linux + Radeon Vega 64 | 25.6 fps | 26.7 fps |

Increased precision when far from origin:
{F13610024}

{F13610025}

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D16125
2022-10-05 20:29:12 +02:00
74ff0aeea0 deps_builder: harden the package download process
During the 3.3 release some packages were missing
in SVN during the release and it ended up building
the release tarball without issues when re-running
the `make source_archive_complete` command after it
failed initially. The tarball however had 0 byte files
for the missing packages.... not good.

This diff hardens the download process by :

1) Validating all required variables are set. This
catches the erroneously attempt at downloading the
nanovdb package even though we have removed it
from versions.cmake but neglected to remove it
from download.cmake

2) When a download fails (due to either a missing
package, or bad download URL) FILE Download will
warn about a hash mismatch but will carry on
happily, you then have to go into the file system
go delete the 0 byte file to retry the download.
We know for a fact the file is bad when it is 0
bytes, just delete it.

3) When we are using the blender repository
(and likely building a source archive) explicitly
validate the hash of all packages. Normally the
build process does this, however when building
a source archive the build does not actually
run for a dep. So preform this check during the
configuration stage.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16124
2022-10-05 12:05:26 -06:00
Iliya Katueshenock
e89b2b1221 Mesh: Skip some domain interpolations for single values
Completely skip the work of interpolating domains for single values
for many to and from combinations. Similar to 535f50e5a6,
but slightly more complex because of the possibility of loose elements
on some mesh domains.

From D16054, with added comments.
2022-10-05 12:42:46 -05:00
124df79e78 Fix T101523: Cycles path guiding debug settings not affecting final render 2022-10-05 19:33:36 +02:00
Iliya Katueshenock
829569dccf Cleanup: Use generic array for mesh domain interpolation result
Instead of declaring a typed array inside the static type block.
This generates slightly less code and should have the same performance.

From D16054
2022-10-05 12:03:07 -05:00
9a633b967a Revert "Geometry Nodes: Add index input to Edge Vertices node"
Unfortunately this commit changed behavior in a fundamental way that
can't be addressed without larger changes. Previously the position
outputs were evaluated on the edge domain and then interpolated to the
context domain, which could be useful for some rudimentary mesh smoothing.
After the commit they were just evaluated at the specified index, which
looks practically random when evaluated on a different domain. We may need
a new node that doesn't have the implicit behavior in the future.

This reverts commit 4ddc5a936e.
2022-10-05 11:38:53 -05:00
424df9ea87 Fix T101610: UV Sphere missing from geometry nodes menu
Caused by 837144b457
2022-10-05 11:02:45 -05:00
Damien Picard
fd48f1b505 I18n: improve unit extraction regex
There were two issues with the unit extraction regex:
- it didn't take the inches, feet, arcminutes and arcseconds symbols
into accounts, which aren’t letters but ' and ";
- some units have more than one B_UNIT_DEF_* flag.

This allows extracting feet, inches, square millimeters, cubic
millimeters, arcminutes, and arcseconds.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D16144
2022-10-05 17:58:50 +02:00
Damien Picard
f5d67f3fdf I18n: disambiguate a few messages
- Active Track (NLA vs movie clip)
- New (file)
- Object Index (loop cut)
- Object Index (render pass)
- Proxy Storage (sequence)
- Rim (Solidify modifier)
- Roughness (particle children)
- Spaces (text whitespace)
- Out (sequencer wipe transition)

Also make new asset tag name translatable.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D16067
2022-10-05 17:53:37 +02:00
Damien Picard
860a539fb5 I18n: extract dynamic enum items
These item names and descriptions never got extracted because they're
not in the RNA until the proper context occurs, and so the extraction
script never even knew about them.

The properties are mostly located in the fluids UI.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15994
2022-10-05 17:47:54 +02:00
195bcea0d0 install_deps: Fix typo in previous commit.
Typo from rB7fa0080c4ffa.
2022-10-05 17:19:16 +02:00
6dd2e193e1 Fix T101405: Deleting a baked action results in an error.
RNA code to create new actions did not properly remove the extra user
set by default, as done in other `new` callbacks of other ID types.

NOTE: Mask ID had the same issue, also fixed in this commit.

NOTE: At some point this needs to be properly fixed, default super-low
level ID creation code should simply not add a 'default' user, this is
extremely bad design and forces higher-level code to do all kind of
extra work to get rid of it half of the time, in very unclear and
confusing ways and places.
2022-10-05 15:59:25 +02:00
Bastien Montagne
b47a234f98 BKE_Main: Add clear separation between 'temp' mains and global main.
Blender is using more and more temporary Main data-base (historically
for reading linked data, but also now when resyncing liboverrides, for
temp data in asset code, etc.).

This commit aims at making this a bit more formal and defined, by:
* Adding a dedicated flag in Main struct to mark a Main as global.
* Adding some API to replace, or temporarily swap the current global
  Main (`G_MAIN`) by another one.

NOTE: Having to temporarily replace `G_MAIN` is a workaround for the
limitation of current RNA, ideally this should be fixed in RNA itself,
but for now at least having an API helps tracking those cases (since
this is potentially risky operation).

This work is also a preparation for more usages of temp mains in the near
future (Asset Brushes and its presets system e.g. will most likely use
temp mains too).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15977
2022-10-05 14:26:45 +02:00
31a4fb42d4 Fix T101613: Muted Mix node wrongly connects to Factor socket
T101613: Muting/ctrl+x deleting the new mix node in Float mode
passes through the wrong input.

Fix by setting no_muted_links() on Factor sockets.
2022-10-05 13:19:54 +01:00
634e4a49d6 Fix T101334: Paint Texture Slots appear greyed out
To the user, this looks like a disfunctional thing (usually greying out
is used for props having no effect).

The greying out is caused by
{rB8b7cd1ed2a17e40661101eea4adae99e8e3d02e9}.
Above commit disabled the direct renaming of images in the
`TEXTURE_UL_texpaintslots` UIList (and instead displays the texture slot
directly as a prop -- which has its `PROP_EDITABLE` flag cleared)
(from the commit message):
> A limitation of this patch is that is isn't possible anymore to rename
images directly from
> the selection panel. This is currently allowed in master. But as
CustomDataLayers
> aren't ID fields and not owned by the material supporting this wouldn't
be easy.

To work around the UI confusion (but still keep the non-editable nature
of the property), now just display this as a label.

Maniphest Tasks: T101334

Differential Revision: https://developer.blender.org/D16138
2022-10-05 13:41:59 +02:00
cfa765845b Fix T101306: crash when calling Delete command for Library Override
Was not passing user_data to id_override_library_delete_hierarchy_fn.

Also correct a wrong assert.

Greenlit by @mont29 in T101306.
Should also go into 3.3 LTS.
2022-10-05 12:47:13 +02:00
6d879601b7 LineArt: Fix "No intersection" flicker.
The flicker was caused by the failure for checking both triangles for
flags. Now fixed.
2022-10-05 18:11:43 +08:00
7fa0080c4f Install_deps: Add building of OpenPGL.
Ref. T101403.
2022-10-05 12:08:05 +02:00
e3bcb203a9 Fix order of include-guard & C++ extern block 2022-10-05 20:27:45 +11:00
1a485a3aa6 Fix error in 6b76381e0a
Missed flipping arguments for caller.
2022-10-05 16:56:10 +11:00
b9cbb229b1 Fix app-template settings being used for non-template preferences
Saving non app-template preferences would use add-ons and other
app-template settings to write the default preferences if there was no
existing user preferences file saved.
2022-10-05 15:34:02 +11:00
79774aa68c App Template: quiet warning when existing preferences don't exist
Suppress warning when saving app-template preferences.

Check if the preferences exist before attempting to read them,
while harmless it looked as if something went wrong.
2022-10-05 15:34:02 +11:00
5dc798f2e4 Docs: improve doc-strings for blend file IO
- Document the behavior of app-template IO for preferences.
- Add doxy-sections for each kind of blend file IO.
- Clarify BKE_blender_userdef_app_template_data_swap doc-string.
2022-10-05 15:30:42 +11:00
6be8c6b3b1 Cleanup: Remove unused includes 2022-10-04 22:17:59 -05:00
fbbd7f0d5c Fix: Crash when reininitializing empty generic array
Noticed this while developing new code that used GArray.
2022-10-04 22:17:59 -05:00
b804f925c7 Fix T101185: New Mikktspace crashes on meshes without valid triangles
The code already had a check for meshes with zero triangles, but it
didn't catch the case where all triangles are flagged as degenerate.
A simple way to reproduce this is to take a mesh and scale it to zero.

After checking the code, it turns out that in this case it's supposed
to just set all tangents to zero, so the fix simply is to detect this
case and skip the computation.
2022-10-05 02:42:43 +02:00
f9a10e7ed0 Geometry Nodes: Add soft min for points node radius input
Also remove an unnecessary cast.
2022-10-04 17:45:58 -05:00
41281cc0e7 Build: fix missing xml2 build time dependency for wayland
Also prepend the existing 'PKG_CONFIG_PATH' instead of overwriting it
as this prevents 'devtoolset-9' libraries being used in the release
environment.
2022-10-05 08:48:32 +11:00
82de17c801 Cleanup: VSE: Rename val to timeline_frame 2022-10-04 21:24:09 +02:00
6309f67718 Cleanup: Add docstrings to SEQ_time.h 2022-10-04 21:24:09 +02:00
76043bc3d6 Cleanup: VSE code readability
Add function `SEQ_time_content_end_frame_get` to get content end frame.
New function is shorthand for
`SEQ_time_start_frame_get() + SEQ_time_strip_length_get()`.
2022-10-04 21:24:09 +02:00
d981418c8c Fix: Crash versioning transfer node with animation data
This versioning needs to be done after linking in order to affect
animation  data which might not be loaded in the regular "do_versions"
loop. Animation data is removed in `nodeRemoveNode`.

Fixes T101439
2022-10-04 13:27:24 -05:00
ea95d04245 Build: integrate OpenPGL into platform files like other libraries
To avoid issues with install_deps. If we more generally switch to using
CMake configs then perhaps this code can be deduplicated again or at
least simplified.
2022-10-04 20:24:27 +02:00
6167a065a5 Build: also list Cycles build options on first cmake config 2022-10-04 20:13:58 +02:00
3353fc60c2 Cleanup: remove unused members from RenderResult 2022-10-04 20:13:54 +02:00
9f8b0b83a9 UI: Avoid unnecessary label in set curve normal node
"Mode" is obvious and isn't worth cutting off the text.
2022-10-04 12:36:06 -05:00
31e89ee5b9 Fix: Bump subversion after forward compatibility breakage
c3b6e37254 change node ID names. Bump the subversion and the
min file subversion so older versions get warnings opening newer files.
2022-10-04 12:33:09 -05:00
8102510482 Fix T101583: Issues applying modifier to mesh with shape keys
The wrong mesh was used to read the position attribute. Also, there was
always a warning about missing shape keys when that wasn't the case.
2022-10-04 12:10:10 -05:00
bc00666683 Fix: UI: Warning for description with period at end
The last period is added automatically, for better or worse.
2022-10-04 12:10:10 -05:00
3e2d7403f9 Cycles: refine inlining thresholds for oneAPI backend
New thresholds give a few percent improvement in average.
2022-10-04 18:34:54 +02:00
df29211eeb Cycles: Speed up oneAPI GPU binaries compilation by using parallel instances
This change speeds up the compilation at the cost of higher memory usage.
CMake implementation checks the amount of available memory to spawn a
reasonable number of parallel compiler jobs.
2022-10-04 18:19:37 +02:00
d2f0cb6745 BLI: Unroll vector loops for better performance on GCC
On GCC, the loops created by `BLI_VEC_OP_IMPL` were not always
unrolled, leading to branching. For `attribute_math::mix4<float3>`,
this lead to a significant performance regression compared to its
older `interp_v3_v3v3v3v3` counterpart.

Instead of a using macros to create the for loops, use variadic
templates to manually unroll them. The compiler might do it anyway
(I didn't observe any effect on Clang in my tests), but there should
be no reason not to unroll these small loops, and making it explicit
and removing use of macros seems better.

On a Ryzen 3700x, this commits doubles the performance of Catmull
Rom curve position evaluation (from 18-19ms to around 9-10ms).

Differential Revision: https://developer.blender.org/D16136
2022-10-04 11:16:25 -05:00
4d9588ee45 Revert "install_deps: update OpenVDB for Blender 3.4."
This update has been moved back to Blender 3.5.

This reverts commit ded4604d71.
2022-10-04 17:35:21 +02:00
25d162f864 Revert "install_deps: update OIIO/Boost/Python/NumPy versions."
These updates have been moved back to Blender 3.5.

This reverts commit 1e1e9014cf.
2022-10-04 17:35:21 +02:00
4186b0ebe4 Fix T101233: Crash on deleting the object in outliner due to null pointer access
After rB188f7585a183 deleting the object results in crash due
to null pointer access if collections are filtered out

Reviewed by: mont29

Differential Revision: https://developer.blender.org/D16031
2022-10-04 20:49:34 +05:30
dd4a40f42d Always initialize MaterialPass (Fixes a crash in mscv)
Differential Revision: https://developer.blender.org/D16134
2022-10-04 16:16:46 +02:00
957cb173f2 Fix T101447: Hold split not working correctly
Caused by incorrect conflict resolution in commit 302b04a5a3.
2022-10-04 16:11:34 +02:00
0458b24a23 Fix T101499: Do not allow unlinking objects from linked collections. 2022-10-04 14:59:06 +02:00
38170cd295 Cleanup: Remove commented out code in ssr_lib.glsl. 2022-10-04 13:33:41 +02:00
Miguel Pozo
6c2c3ed2c9 Fix T101438: Wrong LOD selection after clamping the mip value (Nvidia)
Fix for T101438

Clamping the mip seems to always set it to 9.0.
I couldn't find an alternative way to avoid triggering the error (ie. min(mip, 9.0)).

In any case, the results with this patch applied look the same to the (correct) ones on AMD.
And, since clamping the max mip to a hardcoded value could result in resolution-depended behavior, I guess disabling the clamp should be ok anyway.

Reviewed By: fclem

Maniphest Tasks: T101438

Differential Revision: https://developer.blender.org/D16129
2022-10-04 13:32:15 +02:00
James
da6d6f99a8 Animation: Update tooltips to be more readable
Change some wording of tooltips for readability, in animation-related
areas (drivers, keying sets, animation channel visibility).

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D16131
2022-10-04 12:30:30 +02:00
c3003b4346 Fix T101559: Rain Test Animation demo crashes Blender 3.3
Update to liboverride creation code to add support of keeping active
object forgot to consider case when there is no known/given view layer.

NOTE: due to differences in code, fix for 3.3 will be a bit different.
2022-10-04 10:56:49 +02:00
501fff40e8 New viewlayer deferred resync code: add utils to ensure resync of whole Scene and Main.
Similar to existing `BKE_main_collection_sync` and `BKE_scene_collection_sync`,
in some cases code does not have access to a specific view layer,
and/or does not know exactly which view layer needs to be in sync,
or just need the full data to be up to date.
2022-10-04 10:53:05 +02:00
6b76381e0a Cleanup: rename BKE_appdir_folder_id_version, improve doc-strings
Rename BKE_appdir_folder_id_version to
BKE_appdir_resource_path_id_with_version because BKE_appdir_folder_id
and BKE_appdir_folder_id_version didn't accept compatible arguments.

Also add notes to GHOST_getSystemDir & GHOST_getUserDir that
BKE_appdir_resource_path_id(..) should be used instead (in most cases).
2022-10-04 16:52:10 +11:00
bf4926b30c Support environment variables to override USER & SYSTEM resource paths
Even though individual USER/SYSTEM paths could be set using environment variables,
it wasn't possible to override the USER or SYSTEM paths.

This meant the result of `bpy.utils.resource_path('USER')` &
`bpy.utils.resource_path('SYSTEM')` could still be used by scripts,
making the Blender session potentially the default USER directory
(even when `BLENDER_USER_CONFIG`, `BLENDER_USER_SCRIPTS` &
`BLENDER_USER_DATAFILES` all point elsewhere).

Resolve by adding environment variables:

- BLENDER_USER_RESOURCES
- BLENDER_SYSTEM_RESOURCES

These will be used for `bpy.utils.resource_path('USER')` &
`bpy.utils.resource_path('SYSTEM')`, as well as a basis for user &
system directories, unless those environment variables are
set (`BLENDER_USER_*` or `BLENDER_SYSTEM_*`).

Resolves issue raised by T101389.

Example usage & output:

{P3225}

Reviewed By: brecht

Ref D16111
2022-10-04 13:54:09 +11:00
868ef9ec37 Cleanup: remove unnecessary includes from sculpt_paint 2022-10-04 13:54:04 +11:00
5c51bf2ffe Cleanup: format 2022-10-04 13:54:02 +11:00
a9918e9c0e Cleanup: undeclared function warning 2022-10-04 13:54:01 +11:00
1d629a4403 Cleanup: correct argument size for plane in planeProjection 2022-10-04 13:53:59 +11:00
22c3db72ca Sculpt: Visibility bugfixes
* Unhide all is no longer part of face_set_change_visibility.
* Implemented a few visibility API methods for PBVH_BMESH
* Fixed bug with unhide all not freeing all multires grid_hidden
  bitmaps.
2022-10-03 17:19:50 -07:00
2cf21604c9 Sculpt: implement Reveal All for PBVH_BMESH 2022-10-03 17:19:50 -07:00
d42f882343 Cleanup: Fix sign conversion warning in BMesh log 2022-10-03 17:43:21 -05:00
97746129d5 Cleanup: replace UNUSED macro with commented args in C++ code
This is the conventional way of dealing with unused arguments in C++,
since it works on all compilers.

Regex find and replace: `UNUSED\((\w+)\)` -> `/*$1*/`
2022-10-03 17:38:16 -05:00
ed7f5713f8 Sculpt: Fix T101430: Blank stroke undo steps corrupt dyntopo
Blank brush strokes never have an oppurtunity to initialize
a sculpt undo step, which results in blank global undo steps.
These confuse DynTopo's internal BMLog undo stack.

Note: I tried having the stroke operator return OPERATOR_CANCELLED,
but this didn't prevent the undo push (which is done automatically
due to the presence of OPTYPE_UNDO in the operator flags).
I might investigate removing the flag, but that might cause other
problems.
2022-10-03 15:37:23 -07:00
416d1d0393 Sculpt: Add debug code to print sculpt undo stack. 2022-10-03 15:37:23 -07:00
4ddc5a936e Geometry Nodes: Add index input to Edge Vertices node
Previously the edge index was always determined by the field context,
and the node didn't work when the context was in any other domain.
Adding an index input makes it work much more nicely with the other
topology nodes. It's now in the topology submenu too.

I also reimplemented the edge positions input to use the field at index
node internally. That will probably make it slower for now, but we need
to optimize that to do nothing in some special cases anyway.

Differential Revision: https://developer.blender.org/D16105
2022-10-03 16:54:23 -05:00
99cbaced3b Fix: Incorrect field status in offset point in curve node
The input supports fields, the outputs are fields only if either of the
inputs are fields. Also, .hide_value() is redundant for implicit fields.
2022-10-03 16:44:09 -05:00
c3b6e37254 Geometry Nodes: Rename Control Point Neighbors Node
Rename the node to "Offset Point in Curve"

Since this was committed, more mesh and curve topology nodes have been
committed with a different naming scheme (482d431bb6). Change
the name of this node to match "Offset Corner in Face". Because the
node was only added recently, it's a full rename, including the ID,
so forward compatibility is broken.
2022-10-03 16:41:58 -05:00
248def7e48 Geometry Nodes: Change order of outputs in topology nodes
It's a bit more natural if the "Total" output come second, and it's
also consistent with the Accumulate Field node.
2022-10-03 16:27:09 -05:00
748fda32ed Geometry Nodes: Set Curve Normal
This node allows for curves to have their evaluated normal mode changed
between MINIMUM_TWIST and Z_UP. A selection input allows for choosing
which spline in the curves object will be affected.

Differential Revision: D16118
2022-10-03 15:50:21 -05:00
Phoenix Katsch
b475506cfb Cycles: add option to bake specular from active camera viewpoint
Previously it would bake viewed from above the surface. The new option can be
useful when the baked result is meant to be viewed from a fixed viewpoint or
with limited camera motion.

Some effort is made to give a continuous reflection on parts of the surface
invisible to the camera, but this is necessarily only a rough approximation.

Differential Revision: https://developer.blender.org/D15921
2022-10-03 21:59:31 +02:00
af51e4b41c Cleanup: fix source comment/documentation typos
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D16071
2022-10-03 21:59:31 +02:00
e2572bd89f Fix OpenEXR saving still outputting alpha when using RGB instead of RGBA mode
Contributed by linhsu0723.

Differential Revision: https://developer.blender.org/D15979
2022-10-03 21:59:31 +02:00
42f40657f1 Images: remove option to choose between BW/RGB/RGBA for multilayer EXR save
This was not properly respected, and in general with multiple passes and layers
it's unclear what this should do exactly without breaking some render passes.
Better to keep this image format for raw unmodified render results.
2022-10-03 21:59:20 +02:00
9b7c84f293 Image: improve Save As Render tooltip, hide option when saving render result 2022-10-03 21:00:55 +02:00
0c7458604d Cleanup: rename IMA_CHAN_FLAG_ALPHA to IMA_CHAN_FLAG_RGBA to match meaning 2022-10-03 20:45:06 +02:00
72ceb7dec1 Fix: crash when linked geometry node group is missing 2022-10-03 19:15:06 +02:00
13b3c408e3 Fix T101510: Incorrect context for running data unlink from template ID
There was already a fix for this, but it got broken again with c973d333da.
2022-10-03 18:20:59 +02:00
d20be55c1a Cleanup: in Cycles force inline transform_inverse_impl
We expect this to always happen.

Ref T100891
2022-10-03 17:58:34 +02:00
2f7234d3e1 Attribute Node: access geometry node instance attributes.
The Instancer mode of the node is intended for varying material
behavior between instances. Since Geometry Nodes support arbitrary
named instance attributes, this mode should include them in lookup.

To implement this it is sufficient to store references to Geometry
Node data in DupliObject, and check it during dupli attribute lookup.

In order to reduce the memory usage of DupliObject, only 4 array
entries are allocated, even though the current dupli recursion stack
limit is 8. This assumes that not every entry would be associated with
a GeometrySet instance. Hopefully, soon the whole system will be
rewritten to remove the hard limits altogether.

Differential Revision: https://developer.blender.org/D16114
2022-10-03 18:02:24 +03:00
a6083cdeef Cleanup: remove unnecessary braces 2022-10-03 16:28:21 +02:00
e65598b4fa Geometry Nodes: new Sample UV Surface node
This node allows sampling an attribute on a mesh surface based
on a UV coordinate. Internally, this has to do a "reverse uv lookup",
i.e. the node has to find the polygon that corresponds to the uv
coordinate. Therefore, the uv map of the mesh should not have
overlapping faces.

Differential Revision: https://developer.blender.org/D15440
2022-10-03 16:06:29 +02:00
31ae3a5012 Geometry Nodes: set viewer overlay opacity default to 1
This value worked better for artists.
2022-10-03 12:34:48 +02:00
83ebf6a811 Fix T101564: GPencil: Selecting imprecise if transforms are animated
The check was doing with the original point and
must be the evaluated point.
2022-10-03 11:18:08 +02:00
035c237d69 Fix T101548: GPencil new lines in Multiframe editing appear as Onion
The problem was the eval data update only occurs for the 
actual frame and in this case must be for all frames.
2022-10-03 10:38:00 +02:00
7029f11439 Fix T101487: New OBJ importer handles UVs incorrectly when some faces of an object don't have UVs
The UV data filling logic was incorrectly just skipping over loop
entries that don't have a UV coordinate, instead of assigning
the default zero UV for them. This was a problem only for meshes
where some faces did have UVs, but some other faces did not (T101487).
2022-10-03 11:07:50 +03:00
cbfd2aaeb7 Cleanup: sort cmake file lists 2022-10-03 12:13:01 +11:00
b1a672f541 CMake: add missing headers 2022-10-03 12:13:01 +11:00
7afee060d0 Cleanup: add license header 2022-10-03 12:04:41 +11:00
d4d40f3b69 DNA: reduce size of Base struct
Re-order members and remove pad members,
reducing it's size by 24 bytes on 64 bit systems.
2022-10-03 11:19:15 +11:00
d3ba8826b0 Cleanup: remove 2D region-relative coordinates from Base
Historically, caching these values may have had some advantages,
simplifying drawing object centers and selecting by object center.

Now the only uses of these values would calculate the projection
before use, so there is no reason to store run-time projection in DNA.

This also quiets a `-Wstring-overflow` warning.
2022-10-03 11:07:17 +11:00
ea2c41c730 Cleanup: spelling in comments
Also replace "dm" for evaluated mesh in some comments.
2022-10-03 11:03:46 +11:00
55387197a7 Cleanup: use function style casts for C++ 2022-10-03 11:03:46 +11:00
d762132a72 Cleanup: quiet undeclared function warning 2022-10-03 10:24:05 +11:00
15e6673ccd Cleanup: Move three modifier files to C++ 2022-10-02 11:17:40 -05:00
ed6764dede Fix: build issue with MSVC
Issue introduced by rB208b3a0472b3
which fixed a build issue on linux.

This fix is a band-aid at best but
reverting rB208b3a0472b3 is not
really an option since that would
break linux again.
2022-10-02 10:17:05 -06:00
5a982b0695 GPUTexture: Add GPU_texture_create_single_layer_view
This allows the creation of texture arrays from 1D/2D/Cube texture.
This is useful when the shader expect a texture array but the original
texture isn't.
2022-10-02 15:18:42 +02:00
208b3a0472 Fix build error on Linux after font thumbnail changes 2022-10-02 15:06:34 +02:00
9d30adb7eb Cleanup: Rename function gpencil_point_to_parent_space
gpencil_point_to_parent_space -> gpencil_point_to_world_space

The old name was not clear because it looked it was moving into
the object space, but really is doing the opposite.
2022-10-02 13:40:42 +02:00
8f1d3e14d9 Cleanup: Rename functions
gpencil_apply_parent->gpencil_world_to_object_space
gpencil_apply_parent_point->gpencil_world_to_object_space_point

The old name was not descriptive enough.
2022-10-02 13:40:42 +02:00
e0a261c653 Cleanup: Move more files using mesh runtime data to C++
In preparation for moving mesh runtime data out of DNA.
2022-10-01 22:13:19 -05:00
b14ad9114f Fix: Mix node did not set clamp result correctly in versioning code
Files were incorrectly loaded without the Clamp Result option set.

Reported in BA by CarlG
2022-10-02 00:04:30 +01:00
Jason Fielder
0fdb9cd650 GPU: Fix issue with GPU render boundaries being opened while a GPUBackend does not exist.
Fixes regression introduced by rBe8bcca4bdc94 (D15900)

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D16085
2022-10-02 00:08:52 +02:00
Pratik Borhade
ffd8390af7 Fix T101504: Crash when repeat value is zero
Crash triggers due to division by zero
fix is to increase minimum limit for `seg_repeat` to 1

Reviewed By: antoniov, frogstomp

Maniphest Tasks: T101504

Differential Revision: https://developer.blender.org/D16120
2022-10-01 16:28:29 +02:00
e5ccbfab09 Cleanup: simplify uv packing for non-square materials 2022-10-01 17:29:14 +13:00
206dead860 Sculpt: Fix T101467: Improper vertex count in pbvh draw 2022-09-30 15:40:50 -07:00
81f15a51aa Sculpt: Fix sculpt face set undo creating duplicate face set layers 2022-09-30 15:35:11 -07:00
991a35b844 Sculpt: fix crash in relax face sets brush 2022-09-30 15:32:01 -07:00
6b9f45c1d1 Sculpt: Fix T101430: Dyntopo undo crash 2022-09-30 15:28:26 -07:00
5b0485fd77 Sculpt: Upload white for color attributes in multires in sculpt
Even if multires in sculpt mode doesn't yet support color
attributes, we should at least upload white color to avoid
making everything black.

Also fixed a bug where multires PBVHs didn't have access to
their CustomData attribute layout, which PBVH draw needs.
2022-09-30 15:19:10 -07:00
1eba76d8ed Sculpt: Fix T101503: Memory corruption in multires faceset drawing 2022-09-30 15:02:50 -07:00
4cbafba04b Sculpt: Fix T101430: Curve shown improperly in mask from cavity redo 2022-09-30 14:56:06 -07:00
554afabf75 Attribute Node: refactor lookup to remove duplication between engines.
Currently lookup of Object and Instancer attributes is completely
duplicated between Cycles, Eevee and Eevee Next. This is bad design,
so this patch aims to deduplicate it by introducing a common API
in blenkernel.

In case of Cycles this requires certain hacks, but according to
Brecht it is planned to be rewritten later for more direct access
to internal Blender data anyway.

Differential Revision: https://developer.blender.org/D16117
2022-09-30 20:01:57 +03:00
42eda155df Cleanup: Move draw_manager_data.cc to C++
This will help with moving mesh runtime data to C++
2022-09-30 09:38:02 -05:00
8ba508d70b Fix missing Outliner updates when adding nodetrees
When e.g. grouping nodes into nodegroups, these would not show up
immediately in the Outliner (Blender File / Data API view).

Now send (unique combination, not used elsewhere) notifiers (and listen
for these in the Outliner).

Differential Revision: https://developer.blender.org/D16093
2022-09-30 11:53:03 +02:00
2004827bc9 Fix T101347: Curve draw fails to project to cursor depth in ortho views
ED_view3d_win_to_3d_on_plane with do_clip enabled wasn't working in
non-camera orthographic views as it didn't take into account the ray
origin being centered to the view.

Resolve by testing viewport clipping after the ray has been projected.
2022-09-30 18:29:26 +10:00
68ac737d48 Cleanup: format 2022-09-30 10:28:11 +02:00
6865aab133 Cleanup: quiet unused parameter warning in lambda function
Copy-paste error in rB039429faeb41.
2022-09-30 10:27:48 +02:00
dbc097d6b8 Fix error in blf_get_sample_text returning a pointer to stack memory
Copy-by-value was used when iterating over unicode_samples which
then referenced an array from the value.

Resolve by referencing a const pointer to the unicode_sample array.
2022-09-30 15:03:18 +10:00
8bdd4b4685 Cleanup: use function style casts for C++ 2022-09-30 14:51:49 +10:00
1c1dc5f844 Cleanup: Move files that use mesh runtime data to C++
In preparation for moving the mesh runtime struct out of DNA.
2022-09-29 18:32:44 -05:00
7db79feecd Cleanup: Move object_update.c to C++ 2022-09-29 17:11:20 -05:00
0ff485b6ba Cleanup: Move modifier.c to C++ 2022-09-29 16:43:09 -05:00
3059c0998a Fix T101118, T101471: Crash with bevel weight in solidify modifier
Just a missing null check for the original edge weight.
2022-09-29 16:40:13 -05:00
688c4f7e51 Sculpt: fix stroke-only attributes not being freed at stroke end 2022-09-29 13:45:17 -07:00
b063cfa9cf Sculpt: fix T101465, crash in cloth filter with new automasking modes 2022-09-29 13:38:16 -07:00
6a9b45995d Sculpt: Fix T101464: Crash in mask from cavity 2022-09-29 13:14:42 -07:00
f998fa2732 Sculpt: Fix T101463: Don't initialize automask to zero in
factor mode if topology or boundary modes are inactive

Factors mode (precomputing the automask) should initialize the
mask to 1.0 if no additive automasking modes are enabled, instead
of zero.
2022-09-29 13:06:55 -07:00
c938447ee2 Cleanup: Naming in edge vertices node
- Use `enum class`
- Use shorter names for field input classes for better line wrapping
- Use "Vert" instead of "Vertex"
2022-09-29 15:01:10 -05:00
912a1e2820 Fix: Order of node mixins in custom nodes python template
See T101259. This order makes the poll not work, even when called from
Python. The bundled template shouldn't be a source of errors for node
addons.
2022-09-29 11:59:02 -05:00
c007e84e9e Fix: Viewer node overlay alpha broken on NVidia GPUs
On NVidia GPUs, when the blue channel was between 0 and 0.1,
the overlay's alpha would increase, making it invisible.

With the `overlay_line_fb` frame buffer bound in `overlay_engine.cc`
there are two outputs to write to: the color and the line output, which
is used for making smooth antialiased lines. The overlay is in its
current position in the order of overlays so that it draws on top of
curve wire lines. Not writing to that second output is undefined
behavior, so fix it by writing zeros. In the future, the overlay
could be smoothed on curves using that second texture.

Thanks to Clément for the explanation of the issue!
2022-09-29 11:28:48 -05:00
520d111eca Cleanup: Simplify code and remove duplications
This commit simplify the previous fix for T101455

f6c2f1c65e
2022-09-29 15:03:23 +02:00
d2e576f34c GPencil: Remove Fill use_collide_only option
After a lot of testing, this option is not required and
now this is managed by stroke_collsion.

If the stroke_collision is enabled, only collide strokes 
are used.
2022-09-29 14:58:29 +02:00
10f1972ff7 GPencil: Fix missing Fill stroke cross detection
If the cross point was in the extreme of the stroke the
collision was not detected because it could be
outside of the bbox.

Removed the bbox check because now it is
not necessary.
2022-09-29 13:51:58 +02:00
f6c2f1c65e Fix T101455: GPencil Gizmo in wrong location when using Active Element
The gizmo was not set when this option was selected.

By design, in grease pencil the active element option uses
the object origin as pivot point.
2022-09-29 13:38:31 +02:00
b70b02ee42 Fix: Spline Parameter node produces NaN when curve is a single point
Issue found in file from T101256.
2022-09-29 13:32:03 +02:00
ffccdf069b Nodes: fix missing update when input of muted node changes 2022-09-29 13:09:00 +02:00
6757f81fab Viewport: Remove unnecassary assert 2022-09-29 04:05:03 -07:00
db0ef8b00d Fix T101410: ignore dangling reroute inputs
For consistency with other node systems in Blender and older
versions of geometry nodes, dangling reroute inputs should
not affect the output. When an input socket is linked to dangling
reroutes, its own value should be used instead.
2022-09-29 13:03:15 +02:00
5ffbabb24c Nodes: fix missing updates with muted nodes and reroutes
Muted nodes and reroutes can potentially affect the output when
they are linked to an input socket and don't have any inputs on
their own.

The issues was that previously "logically linked sockets" where used
which hide reroutes and muted nodes away. The solution is to work
with the directly linked sockets instead and handle reroutes etc
explicitly.
2022-09-29 12:43:43 +02:00
1494a22a90 Sculpt: Reset automask cache on non-color non-mask undo steps 2022-09-29 02:33:59 -07:00
f1990bd900 UI: Nodes typo in "distribute points in volume" node
Distribute Points In Volume →  Distribute Points in Volume.
2022-09-29 11:16:47 +02:00
fae975dd54 UI: Nodes re-organize the nodes in alphabetical order
This was a regression introduced after the 3.3 release.

This fix T101452
2022-09-29 11:13:27 +02:00
2fc136427d Fix T101451: curve attribute overlay disappears when origin is out of view
The core issue seems to be that `BKE_curve_minmax` does not create the
correct bounding box for `Curve` data passed to the render engine.
That's because this `Curve` object does not contain the legacy curve
data structure.

Fixing this will likely require some more consideration, so this fix just
avoids the culling check for now, which is actually also done in
`OVERLAY_extra_wire` using the same approach.
2022-09-29 11:12:05 +02:00
6d3da28676 Sculpt: fix draw face sets not updating on first stroke 2022-09-29 01:47:40 -07:00
Andrew Oates
4bdba62cb9 Fix T94441: fix crash parenting object to a bone
This crash occurs when the bone is newly created.  In certain
circumstances the depsgraph data for the armature is not updated,
causing `pchan_eval` to be NULL when the parent is updated.  This causes
a segfault in `ED_object_parent_set` when the flags are updated.

This change fixes the underlying depsgraph bug, and also adds both an
assertion and NULL pointer check to `ED_object_parent_set` to better
handle this scenario if it recurs via another path.

Maniphest Tasks: T94441

Differential Revision: https://developer.blender.org/D16065
2022-09-29 10:35:18 +02:00
039429faeb Sculpt: fix missing nullptr check in pbvh draw
This time it was face sets.
2022-09-29 01:25:47 -07:00
9be99bcb45 Cleanup: Address format-security warning 2022-09-29 10:02:04 +02:00
5dd48c50f0 Cleanup: Set but unused variable 2022-09-29 09:52:00 +02:00
46e0512d1e Cleanup; Warning about missing override for virtual function 2022-09-29 09:51:32 +02:00
eeb81c4a63 Cleanup: quiet warnings (unused arg & trailing fullstop) 2022-09-29 17:31:55 +10:00
a56da7b045 Fix bpy.utils.script_paths() ignoring environment variables
When check_all=True was passed,

- `os.path.join(bpy.utils.resource_path('USER'), "scripts")`
  was used instead of BLENDER_USER_SCRIPTS.
- `os.path.join(bpy.utils.resource_path('SYSTEM'), "scripts")`
  was used instead of BLENDER_SYSTEM_SCRIPTS.

Other minor changes:

- Simplify collecting paths.
- Don't add user-directories multiple times when check_all=True.
- Normalize paths before before checking duplicates to reduce the
  change the same path is added multiple times.

Found these issues while investigating T101389.
2022-09-29 17:31:55 +10:00
a66e584294 Cleanup: correct API usage for script access
In practice this didn't cause problems, but accessing scripts via
bpy.utils.resource_path('USER') ignores the BLENDER_USER_SCRIPTS
environment variable.
2022-09-29 17:22:32 +10:00
46076e4876 Cleanup: run clang-format in sculpt code 2022-09-28 23:41:53 -07:00
eab69d4930 Cleanup: Use c++-style unused paramter form in automasking code.
Also renamed shadowed variable in sculpt_filter_mesh.c
2022-09-28 23:38:48 -07:00
0de9081e89 Sculpt: fix missing nullptr check in pbvh draw
Check for nullptr when building mask vbos.
2022-09-28 23:33:02 -07:00
bbc69563d0 Sculpt: Normal-based automasking modes
Two new normal-based automasking modes.

The first mode, "brush", compares vertex normals with the initial
normal at the beginning of the brush stroke.

The second, "view", compares vertex normals with the view normal.
If "occlusion" is on then rays will be shot from each vertex to test
if it is occluded by other geometry (note: this can be very slow).\
Only geometry inside the sculpt mesh is considered.

Each mode has an associated angular limit and a falloff.

Reviewed by: Julien Kaspar and Jeroen Bakker
Differential Revision: https://developer.blender.org/D15297
Ref D15297
2022-09-28 23:21:56 -07:00
a4ff106c58 Cleanup: Remove more unused CustomData API functions
Due to increased usage of typed arrays in C++ and name/offset based
access for BMesh, these are unlikely to be used again, and haven't been
used in many years.
2022-09-28 23:13:58 -05:00
ff353842bd Cleanup: Deduplicate logic in CustomData access functions
Also remove comments that just restated what the next line
was doing, often incorrectly.
2022-09-28 23:13:58 -05:00
57620af33c Cleanup: Remove unused BMesh function 2022-09-28 23:13:58 -05:00
0c282c068f Cleanup: cmake indentation 2022-09-29 13:32:16 +10:00
f96020fb9a Cleanup: remove '.' from the end of descriptions
Quiet warnings at startup & build time.
2022-09-29 13:32:16 +10:00
91db47e914 Cleanup: simplify storage when uv island packing
Refactor ahead of upcoming packing changes.

Differential Revision: https://developer.blender.org/D16096
2022-09-29 15:48:53 +13:00
e2df195844 Fix wrong version bump to 3.4.1, we are still on 3.4.0
The patch levels are reserved for bugfix releases.
2022-09-29 03:57:30 +02:00
c64d3a692d Cleanup: use doxy-sections in anim_channels_edit.c 2022-09-29 10:28:56 +10:00
c1548938a4 Cleanup: spelling in comments 2022-09-29 10:28:39 +10:00
d459219307 Cleanup: quiet deprecated copy warning 2022-09-29 10:28:11 +10:00
ec8118a59e Cleanup: replace UNUSED() with commented arguments
This is the conventional way of dealing with unused arguments in C++.

Also quiet enum conversion warnings.
2022-09-29 10:26:10 +10:00
9cfa8b945a Cleanup: format 2022-09-29 10:11:42 +10:00
c087d09c16 Cleanup: fix unused variable warnings in draw_pbvh.cc 2022-09-28 16:39:21 -07:00
0156a677c7 Sculpt: New Cavity Automasking Mode
Add new cavity automasking mode based on local mesh
curvature.  Cavity masking is a great way to quickly add
detail in crevices and the like.  It's meant to be used
with the Paint brush in color attribute mode.  It does
work with other brushes but the results can be unpredictable.

{F13131497}

The old "dirty mask" operator has been replace with a new
"mask from cavity" operator that shares the same code with
cavity automasking.

Differences from the sculpt-dev implementation:
    * It uses the word "cavity."  When I first implemented
this I wasn't aware
      this feature existed in other software (and other
paint modes in Blender),
      and for reasons that escape me today I initially
decided to call it a concave or
      concavity mask.
    * The cavity factor works a bit differently.  It's
      no longer non-linear and functions as a simple
      scale around 0.5f.
    * Supports custom curves.
    * Supports blurring.

Reviewed By: Julian Kaspar, Jeroen Bakker and Campbell Barton
Differential Revision: https://developer.blender.org/D15122
Ref D15122
2022-09-28 16:22:34 -07:00
53ac3192ba Cleanup: remove duplicate declaration
Also got rid of ATTR_NO_OPT macro.
2022-09-28 15:50:09 -07:00
65900d88a8 Sculpt: Rewrite PBVH draw
Rewrite PBVH draw to allocate attributes into individual VBOs.
The old system tried to create a single VBO that could feed
every open viewport.  This required uploading every color and
UV attribute  to the viewport whether needed or not, often exceeding
the VBO limit.

This new system creates one VBO per attribute.  Each attribute layout is
given its own GPU batch which is cached inside the owning PBVH node.

Notes:

* This is a full C++ rewrite.  The old code is still there; ripping it out
can happen later.
* PBVH nodes now have a collection of batches, PBVHBatches, that keeps
track of all the batches inside the node.
* Batches are built exclusively from a list of attributes.
* Each attribute has its own VBO.
* Overlays, workbench and EEVEE can all have different attribute
  layouts, each of which will get its own batch.

Reviewed by: Clement Foucault
Differential Revision: https://developer.blender.org/D15428
Ref D15428
2022-09-28 14:51:23 -07:00
a790873d2a Cleanup: Typo in forward declaration 2022-09-28 16:32:59 -05:00
482d431bb6 Geometry Nodes: Curve and mesh topology access nodes
This patch contains an initial set of nodes to access basic
mesh topology information, as explored in T100020.

The nodes allow six direct topology mappings for meshes:
- **Corner -> Face** The face a corner is in, the index in the face
- **Vertex -> Edge** Choose an edge attached to the vertex
- **Vertex -> Corner** Choose a corner attached to the vertex
- **Corner -> Edge** The next and previous edge at each face corner
- **Corner -> Vertex** The vertex associated with a corner
- **Corner -> Corner** Offset a corner index within a face

And two new topology mappings for curves:
- **Curve -> Points** Choose a point within a curve
- **Point -> Curve** The curve a point is in, the index in the curve

The idea is that some of the 16 possible mesh mappings are more
important, and that this is a useful set of nodes to start exploring
this area. For mappings with an arbitrary number of connections, we
must sort them and use an index to choose a single element, because
geometry nodes does not support list fields. Note that the sort
index has repeating behavior as it goes over the "Total" number of
connections, and negative sort indices choose from the end.

Currently which of the "start" elements is used is determined by the
field context, so the "Field at Index" and "Interpolate Domain" nodes
will be quite important. Also, currently the "Sort Index" inputs are
clamped to the number of connections.

One important feature that isn't implemented here is using the winding
order for the output elements. This can be a separate mode for some
of these nodes. It will be optional because of the performance impact.

There are several todos for separate commits after this:
- Rename "Control Point Neighbors" to be consistent with this naming
- Version away the "Vertex Neighbors" node which is fully redundant now
- Implement a special case for when no weights are used for performance
- De-duplicating some of the sorting logic between the nodes
- Improve performance and memory use of topology mappings
- Look into caching some of the mappings on meshes

Differential Revision: https://developer.blender.org/D16029
2022-09-28 14:38:27 -05:00
25533dbe21 Mesh: Add C++ implementaiton of topology mappings
Because they are friendlier to use in C++ code than the existing mesh
mapping API, these mappings from one domain to another were often
reimplemented in separate files. This commit moves some basic
implementations to a `mesh_topology` namespace in the existing
mesh mapping header file. These is plenty of room for performance
improvement here, particularly by not using an array of Vectors, but
that can come later.

Split from D16029
2022-09-28 14:31:32 -05:00
878dea4e0f GPencil: Avoid infinite loop in Fill debug mode
If the internal flag is set to debug and the Ctrl key is used
the program keeps running endless.
2022-09-28 20:29:41 +02:00
6e9320d237 GPencil: Disable Fill visual aids if use Inverted
When the inverted mode is used, the visual aids must
not be displayed.
2022-09-28 20:23:49 +02:00
19955ef88e GPencil: Extend Fill lines when visual aids are disabled
When the visual aids are disabled, but the extend factor
is > 0, the lines must be extended, but not displayed.

Also, some variables renamed to clarify.
2022-09-28 20:07:20 +02:00
36096fe480 GPencil: Change property text for Fill Visual Aids 2022-09-28 19:42:03 +02:00
ad789c74df GPencil: Fix unreported memory leak in Fill inverse
There was a memory leak when use inverted fill.
2022-09-28 19:36:31 +02:00
c55d38f00b Geometry Nodes: viewport preview
This adds support for showing geometry passed to the Viewer in the 3d
viewport (instead of just in the spreadsheet). The "viewer geometry"
bypasses the group output. So it is not necessary to change the final
output of the node group to be able to see the intermediate geometry.

**Activation and deactivation of a viewer node**
* A viewer node is activated by clicking on it.
* Ctrl+shift+click on any node/socket connects it to the viewer and
  makes it active.
* Ctrl+shift+click in empty space deactivates the active viewer.
* When the active viewer is not visible anymore (e.g. another object
  is selected, or the current node group is exit), it is deactivated.
* Clicking on the icon in the header of the Viewer node toggles whether
  its active or not.

**Pinning**
* The spreadsheet still allows pinning the active viewer as before.
  When pinned, the spreadsheet still references the viewer node even
  when it becomes inactive.
* The viewport does not support pinning at the moment. It always shows
  the active viewer.

**Attribute**
* When a field is linked to the second input of the viewer node it is
  displayed as an overlay in the viewport.
* When possible the correct domain for the attribute is determined
  automatically. This does not work in all cases. It falls back to the
  face corner domain on meshes and the point domain on curves. When
  necessary, the domain can be picked manually.
* The spreadsheet now only shows the "Viewer" column for the domain
  that is selected in the Viewer node.
* Instance attributes are visualized as a constant color per instance.

**Viewport Options**
* The attribute overlay opacity can be controlled with the "Viewer Node"
  setting in the overlays popover.
* A viewport can be configured not to show intermediate viewer-geometry
  by disabling the "Viewer Node" option in the "View" menu.

**Implementation Details**
* The "spreadsheet context path" was generalized to a "viewer path" that
  is used in more places now.
* The viewer node itself determines the attribute domain, evaluates the
  field and stores the result in a `.viewer` attribute.
* A new "viewer attribute' overlay displays the data from the `.viewer`
  attribute.
* The ground truth for the active viewer node is stored in the workspace
  now. Node editors, spreadsheets and viewports retrieve the active
  viewer from there unless they are pinned.
* The depsgraph object iterator has a new "viewer path" setting. When set,
  the viewed geometry of the corresponding object is part of the iterator
  instead of the final evaluated geometry.
* To support the instance attribute overlay `DupliObject` was extended
  to contain the information necessary for drawing the overlay.
* The ctrl+shift+click operator has been refactored so that it can make
  existing links to viewers active again.
* The auto-domain-detection in the Viewer node works by checking the
  "preferred domain" for every field input. If there is not exactly one
  preferred domain, the fallback is used.

Known limitations:
* Loose edges of meshes don't have the attribute overlay. This could be
  added separately if necessary.
* Some attributes are hard to visualize as a color directly. For example,
  the values might have to be normalized or some should be drawn as arrays.
  For now, we encourage users to build node groups that generate appropriate
  viewer-geometry. We might include some of that functionality in future versions.
  Support for displaying attribute values as text in the viewport is planned as well.
* There seems to be an issue with the attribute overlay for pointclouds on
  nvidia gpus, to be investigated.

Differential Revision: https://developer.blender.org/D15954
2022-09-28 17:54:59 +02:00
2312915b96 Cleanup: Rename variables 2022-09-28 17:42:32 +02:00
8c95ab235f GPencil: Fix unreported bug for fill closing strokes
The extend lines were included in render by error
when the only collide option was ON.
2022-09-28 17:42:32 +02:00
1f493125e3 MSVC: promote C4033 to an error
C4033 'function' must return a value

is a MSVC level-1 warning, clang and GCC
treat this as an error however, this
change promotes it to an error as well
for MSVC to mimic the GCC behaviour.
2022-09-28 08:32:56 -06:00
3f55121a18 GPencil: Fix compiler warning 2022-09-28 16:10:54 +02:00
bb4e09ddc5 Fix compiler warnings with clang
This attribute only works on functions in clang, not function pointers.
2022-09-28 16:03:39 +02:00
fe19de5fcc GPencil: Fill Tool - Check if extensions collide with real strokes
This commit is an improvement in the previous fill tool
changes in order to improve how the extended strokes
are managed.

* Now, the algorithm checks if the extend cross a standard stroke, not only extend strokes.

* Option to enable or disable the stroke cross checking
because this can be slow in very complex scenes.

* Added `D` key to toggle stroke cross option.

* Option to use only collide strokes to be used as fill limit.

If the option to use only collide strokes is enabled, the
open extensions are in different color.

* Status text now shows mode and the actual extend factor.

This commits also contains a refactor of the loops
to use arrays as much as possible.

Reviewed By: mendio, pepeland

Differential Revision: https://developer.blender.org/D16052
2022-09-28 15:44:20 +02:00
e191cf89b2 Fix macOS cmake warning about missing OpenAL, after Python module changes 2022-09-28 14:39:25 +02:00
050b6498d3 Bump submodule versions 2022-09-28 13:45:22 +02:00
808b03da43 Cleanup: decentralize .blend I/O for space types
This adds callbacks to `SpaceType` to make each editor responsible to
manage their own .blend I/O, and moves relevant code from `screen.c`
to the editors files.

Differential Revision: D11069
2022-09-28 11:52:22 +02:00
5270ac5ed8 Fix GC tracking error for instances of mathutils types
Mathutils types were always GC tracked even when it wasn't intended.
Not having to track objects speeds up Python execution.

In an isolated benchmark created to stress test the GC
creating 4-million vectors (re-assigning them 100 times), this gives
an overall ~2.5x speedup, see: P3221.

Details:

Since [0] (which added support for sub-classed mathutils types)
tp_alloc was called which defaults to PyType_GenericAlloc which always
GC tracked the resulting object when Py_TPFLAGS_HAVE_GC was set.

Avoid using PyType_GenericAlloc unless the type is sub-classed,
in that case the object is un-tracked.

Add asserts that the tracked state is as expected before tracking &
un-tracking, to ensure changes to object creation don't cause objects
to be tracked unintentionally.

Also assign the PyTypeObject.tp_is_gc callback so types optionally GC
track objects only do so when an object is referenced.

[0]: fbd9364944
2022-09-28 17:53:30 +10:00
ada2b9f6e4 Fix T101341: make nodegroups active input/output non-animatable
Active UI list index is usually not animatable.
Here specifically, the active list index is oly used for operators acting
on a specific (active) socket.

Note other props here were already made non-animatable in
rB1d3b92bdeabc.

Maniphest Tasks: T101341

Differential Revision: https://developer.blender.org/D16077
2022-09-28 08:47:08 +02:00
788f3d72cf Fix Python module test failing with macOS + address sanitizer
Based on patch by Ankit Meel.

Ref D10877
2022-09-28 03:01:47 +02:00
5beaecb33e Fix T101414: in 3d viewport, smart uv project failed to pack
Regression from https://developer.blender.org/rBa5c696a0c2b9
2022-09-28 12:42:49 +13:00
6d1d1bf2b1 Cleanup: spelling in comments
Also add missing task ID.
2022-09-28 09:41:31 +10:00
72a7f107d8 Cleanup: format 2022-09-28 09:41:28 +10:00
6f9b84c5ce Cleanup: compiler warnings 2022-09-28 09:41:28 +10:00
552561d46e Correct sign conversion errors in convexhull_2d.c 2022-09-28 09:36:15 +10:00
5c93c37678 Cleanup: improve 2D convex hull
Improve correctness, API, comments, memory usage and performance
of the 2D convex hull calculation.

Pre-requisite for UV packing improvements.

Differential Revision: https://developer.blender.org/D16055
2022-09-28 12:24:16 +13:00
2ead05d738 Cycles: Add optional per-kernel performance statistics
When verbose level 4 is enabled, Blender prints kernel performance
data for Cycles on GPU backends (except Metal that doesn't use
debug_enqueue_* methods) for groups of kernels.
These changes introduce a new CYCLES_DEBUG_PER_KERNEL_PERFORMANCE
environment variable to allow getting timings for each kernels
separately and not grouped with others. This is done by adding
explicit synchronization after each kernel execution.

Differential Revision: https://developer.blender.org/D15971
2022-09-27 22:15:00 +02:00
b145cc9d36 Cleanup: Unused variable warning with path guiding turned off 2022-09-27 15:00:37 -05:00
f2bad0e49f Fix T101348: Sculpt smooth brush artifacts with hidden faces
The brush mixed up the vert and poly hide layers.
2022-09-27 14:50:07 -05:00
aa58f58e46 Fix: Assert in legacy mesh conversion
When setting the old face set custom data type, do it in the
"layers to write" vector instead of the mesh's poly custom
data layers, which weren't "prepared" yet. Otherwise this
could make the mesh's custom data typemap invalid.
2022-09-27 14:50:07 -05:00
2f0c40c7a2 Cleanup: Use signed integers for mesh vertex indices 2022-09-27 14:50:07 -05:00
b6ee599d92 Cleanup: Use variable and const for sculpt mesh vertex to poly maps 2022-09-27 14:50:07 -05:00
Pablo Vazquez
f69aaf71f8 WM: Support opening backup .blend files via drag-drop
Add support for opening Blender backup `.blend` files (`.blend1`, `.blend2`, etc) by dropping them into the window, just like regular .blend files.

{F13393482, size=full}

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D15700
2022-09-27 19:19:29 +02:00
447368b472 Fix: OpenPGL related build error on windows
Debug and Release libs are different libs on
Windows and will give linker errors when you
try to mix and match them.

This changes retrieves both libs and fills the
OPENPGL_LIBRARIES variable appropriately resolving
the linker error.
2022-09-27 10:48:09 -06:00
Michael Jones
2b88ee50fb Cycles: Tweak inlining policy on Metal
This patch optimises the Metal inlining policy. It gives a small speedup (2-3% on M1 Max) with no notable compilation slowdown vs what is already in master. Previously noted compilation slowdowns (as reported in T100102) were caused by forcing inlining for `ccl_device`, but we get better rendering perf by relying on compiler heuristics in these cases.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16081
2022-09-27 17:01:28 +01:00
fc604a0be3 Cycles: Disable binary archives on macOS < 13.0
An bug with binary archives was fixed in macOS 13.0 which stops some spurious kernel recompilations. In older macOS versions, falling back on the system shader cache will prevent recompilations in most instances (this is the same behaviour as in Blender 3.1.x and 3.2.x).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D16082
2022-09-27 16:58:21 +01:00
Aleš Jelovčan
b0d70a9c80 Gpencil: Time Offset modifier new Chain mode
This patch adds 5th mode to Time offset modifier, which should allow 
to create time segments list.

This will allow users to chain together multiple time ranges in 4 modes:

- Forward
- Backwards
- Pingpong
- Reverse  Pingpong

It also comes with additional Repeat parameter which specifies number 
of times particular segment should run.

The mechanic of it is transforming initial parameters into array of frames which 
are mapped to existing cfra (current frame) value.
Prototype : https://jsfiddle.net/ha2sjw8p/3/

This is also closely aligned to community request: 
https://blender.community/c/rightclickselect/Txhbbc/

This should allow creation of complex animations like dancing, 
which consists of repeating loops and transitions to the next.
One important side effect of this is dramatically reduced 
file sizes, as user no longer needs to copy paste keyframes.

Reviewed By: antoniov, mendio, pepeland

Differential Revision: https://developer.blender.org/D15052
2022-09-27 17:55:43 +02:00
12fdf9069a BLF: Editing Text with Combining Characters
Corrections for caret insertion & movement and deletion for text
strings that include non-precomposed diacritical marks (Unicode
combining characters).

See D15659 for more details and examples.

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

Reviewed by Campbell Barton
2022-09-27 08:40:36 -07:00
697e86a761 View3D: move view3d_draw.c to c++ 2022-09-27 17:38:23 +02:00
5f7259a001 GPencil: New Outline modifier
This modifier converts any stroke (no fill strokes) into perimeter
from camera view.  Also, it's possible to define an alternative 
material for the outline.

There is an option to include a target object to manipulate the start 
point of the strokes. The start point will be the nearest point 
to the target object.

Reviewed By: mendio, frogstomp

Maniphest Tasks: T100826

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

Note: Icon will be updated in T101155
2022-09-27 16:43:20 +02:00
Sebastian Herhoz
75a6d3abf7 Cycles: add Path Guiding on CPU through Intel OpenPGL
This adds path guiding features into Cycles by integrating Intel's Open Path
Guiding Library. It can be enabled in the Sampling > Path Guiding panel in the
render properties.

This feature helps reduce noise in scenes where finding a path to light is
difficult for regular path tracing.

The current implementation supports guiding directional sampling decisions on
surfaces, when the material contains a least one diffuse component, and in
volumes with isotropic and anisotropic Henyey-Greenstein phase functions.

On surfaces, the guided sampling decision is proportional to the product of
the incident radiance and the normal-oriented cosine lobe and in volumes it
is proportional to the product of the incident radiance and the phase function.

The incident radiance field of a scene is learned and updated during rendering
after each per-frame rendering iteration/progression.

At the moment, path guiding is only supported by the CPU backend. Support for
GPU backends will be added in future versions of OpenPGL.

Ref T92571

Differential Revision: https://developer.blender.org/D15286
2022-09-27 15:56:32 +02:00
6d19da0b2d Cycles: BSDF eval refactor to remove separate reflection/refraction methods
Simplifies code overall to do it inside the eval function, most of the BSDFs
already compute the dot product.

The refactoring in bsdf_principled_hair_eval() was needed to avoid a HIP
compiler bug. Cause is unclear, just changing the implementation enough
is meant to sidestep it.

Ref T92571, D15286
2022-09-27 15:56:28 +02:00
Sebastian Herhoz
bd249eb4f3 Cycles: BSDF changes in preparation of path guiding
* Return roughness and IOR for BSDF sampling
* Add functions to query IOR and label for given BSDF
* Default IOR to 1.0 instead of 0.0 for BSDFs that don't use it
* Ensure pdf >= 0.0 in case of numerical precision issues

Ref T92571, D15286
2022-09-27 15:47:03 +02:00
Germano Cavalcante
715c86d9e5 Fix T101231: Console flooded with warnings when fluid type is Domain
Although rB67e23b4b2967 turned the problem more recurrent, the warning
messages in the console always appear when `BKE_fluid_cache_free_all`
is called.

This is because of a bug in `BLI_filelist_dir_contents` as this function
calls `BLI_strdupcat` instead of `BLI_join_dirfile`

NOTE: Other places in Blender avoid this problem by making sure to add
a `SEP_STR` to the end of the directory.

Differential Revision: https://developer.blender.org/D16043
2022-09-27 10:17:29 -03:00
f3a46e2fd9 Deps: fix builing wayland-scanner
- fix the source package download URL
- patch the `meson.build` file to allow the CentOS 7 meson version to be
  used
- only build what we need (`wayland-scanner`), and not the libraries,
  documentation, and tests.

Ref: D16074

This also reverts commit f6664217b3
"Build: temporarily disable wayland dependency".
2022-09-27 15:11:57 +02:00
0084b8635f Fix T101398: Transfer Attribute node still defined in menu
Removing this item was missed in 837144b457.
2022-09-27 07:49:21 -05:00
ed28ba4e99 Fix T101393: Vertex Crease operator does not create vertex crease layer
Typo in rBa8a454287a27 (created layer on edge data instead of vertex
data).

Maniphest Tasks: T101393

Differential Revision: https://developer.blender.org/D16079
2022-09-27 14:38:48 +02:00
f6664217b3 Build: temporarily disable wayland dependency
This caused problems on centos7, see D16074 for details.
2022-09-27 22:28:55 +10:00
1cbfe04638 Fix: GPencil animated layer transforms evaluate wrong when identity
Due to (optimization) checks in in `BKE_gpencil_prepare_eval_data` &
`BKE_gpencil_update_layer_transforms`, updates were skipped if animation
reached exact identity transforms.

Now check if the matrix has changed additionally to gain proper updates.
Unsure if this is the cheapest way to check for the animated state of
layer transforms tbh, but I see similar checks elsewhere.

Fixes T101164.

Maniphest Tasks: T101164

Differential Revision: https://developer.blender.org/D16018
2022-09-27 12:29:07 +02:00
30113e54d2 Fix curves sculpting in deformed space when using Subdivide node
Needs a call to remember_deformed_curve_positions_if_necessary, missed
in rB1f94b56d7744.

Thx @JacquesLucke for the solution!

Differential Revision: https://developer.blender.org/D16078
2022-09-27 11:59:56 +02:00
4a60c4746d Fix T101272: Missing view layer updates handling collections via python.
Fixed by ensuring the view layer is up to date.
2022-09-27 11:57:34 +02:00
cbab734445 Build: add wayland to deps build
This is needed to ensure and up to date "wayland-scanner" is used,
as versions before 1.20.0 generate headers incompatible with
dynamic linking (WITH_GHOST_WAYLAND_DYNLOAD).

As the centos7 version of wayland is 1.15 so make this part of Blender's
dependencies on Linux.

We intend to enable Wayland for Blender 3.4 release, this is needed for
the build-bot.

Reviewed By: brecht

Ref D16074
2022-09-27 19:22:07 +10:00
5f6d66c1c5 Cleanup: Fix brace-scalar-init warning 2022-09-27 10:19:12 +02:00
b6a7541f87 GHOST: exit with an error when GHOST cannot be initialized
When the GHOST back-end Blender was built with isn't supported,
Blender would crash on startup without any useful information.
This could happen when building X11 only, then running on Wayland.

Now show a list of the GHOST back-ends that were attempted and exit
with an error code instead of crashing.
2022-09-27 17:14:32 +10:00
78952518e7 Cleanup: format 2022-09-27 16:36:27 +10:00
Iyad Ahmed
cd7ec0dac6 WM: batch rename action clips
Batch rename for action clips works in outliner and 3d view.

Reviewed By: campbellbarton

Ref D15819
2022-09-27 12:13:08 +10:00
2edb8ab739 Revert "Cleanup: remove redundant WITH_GHOST_WAYLAND check"
This reverts commit 7fa7c7ceda.

The check was not redundant, it accounted for wayland not being found.
2022-09-27 11:53:12 +10:00
4e1d32107b Build: add missing include for opencolorio
OpenColorIO failed to build on Linux+GCC-12.2 because of strlen() use.
2022-09-27 11:21:35 +10:00
7fa7c7ceda Cleanup: remove redundant WITH_GHOST_WAYLAND check 2022-09-27 09:14:24 +10:00
Iliya Katueshenock
8da253cfb6 Fix T101361: Collapsed multi-input sockets not collapsing noodles
Caused by 40d815dff6, which removed the check for "hidden" nodes.

Differential Revision: https://developer.blender.org/D16061
2022-09-26 18:10:27 -05:00
dcd909122f Scew Modifier: Remove eager normal calculation
The screw modifier calculated normals eagerly (whether or not the
next modifier actually used them). However, this was incorrect and
set invalid normals. It isn't necessary because they can be calculated
later anyway. The potential performance improvement isn't worth the
complexity or maintenance burden.

Fixes T101075

Differential Revision: https://developer.blender.org/D16073
2022-09-26 17:59:44 -05:00
722b850c38 GPU: Fix crash when rendering with compositor using CLI
The backend gets used before it is initialized again.

This is just a workaround for now as production schedule needs ir.
2022-09-27 00:53:56 +02:00
408a8edf89 Cleanup: remove unnecessary argument to else() in CMake
We have moved away from duplicating arguments in else() and endif()
commands.
2022-09-27 08:49:51 +10:00
b77ad0c82d Cleanup: correct indentation of harvest.cmake 2022-09-27 08:48:28 +10:00
cd1caa5853 GPU: Revert part of D16017 that was accidentally commited
This code slipped through the final review step surely caused by a faulty
merge.

Fixes T101372 Regression: World shader setup crashes Blender in rendered view

Regression introduced by rB697b447c2069bbbbaa9929aab0ea1f66ef8bf4d0
2022-09-27 00:00:28 +02:00
Sebastian Herhoz
66a863e301 Build: add OpenPGL as to deps builds
Ref T92571, D15286
2022-09-26 23:40:33 +02:00
bcb7b119ae Cleanup: remove workarounds and version checks for unsupported compilers
Match minimum supported versions from the WIKI [0] by raising them to:

- GCC 9.3.1
- CLANG 8.0
- MVCS 2019 (16.9.16 / 1928)

Details:

- Add CMake checks that ensure supported compiler versions early on.
- Previously GCC per-processor version checks served to exclude
  `__clang__`, in some cases this has been replaced by explicitly
  excluding `__clang__`. This was needed as CLANG treated some of these
  flags differently to GCC, causing the build to fail.
- Remove USE_APPLE_OMP_FIX GCC-4.2 OpenMP workaround.
- Remove linking error workaround for old MSVC versions.

[0]: https://wiki.blender.org/wiki/Building_Blender

Reviewed by: brecht, LazyDodo

Ref D16068
2022-09-27 07:05:13 +10:00
cd7e9a1ad5 Cleanup: use the system-handle arg for GHOST_SetMultitouchGestures
There was an unused argument warning, quiet by using the argument.
2022-09-27 07:05:13 +10:00
84ddb8b3cc UI: add preference to disable touchpad multitouch gestures
Available on Windows and macOS, where such gestures are supported.
For Windows, disabling this option restores touchpad behavior to
match Blender 3.2.

Ref T97925

Differential Revision: https://developer.blender.org/D16005
2022-09-26 22:59:35 +02:00
57ea827bfb Fix: Incorrect handling for crease layers
First, there can only be one crease layer, so remove the "default name",
since apparently that's how CustomData tests for that
(see `CustomData_layertype_is_singleton`).

Second, always propagate crease data because it can be used in arbitrary
situations by geometry nodes. That also has to be done for all generic
attribute layers.

Fixes T101340, T101373
2022-09-26 15:42:29 -05:00
8d49a4f36e Fix T101365: saving second view layer as (non-Multilayer) OpenEXR does not work 2022-09-26 22:24:39 +02:00
d4fc451b90 Fix T101354: Cycles crash with baking and adaptive sampling 2022-09-26 22:16:01 +02:00
ddf6f70049 Fix build errors and warnings after recent changes, when not using Unity build 2022-09-26 21:12:25 +02:00
c15a761524 Geometry Nodes: Miscellaneous changes in control point neighbors node
- Use const and whitespace more consistently
- Fix "Offset Valid" output only working on point domain
- Use the smallest output array that can contain the result.
- Consistent include ordering
- Use "data-block" term instead of "object" in tooltip
- Remove unnecessary call to set default output values
2022-09-26 13:23:07 -05:00
837144b457 Nodes: Use plain menus for geometry nodes add menu
At the cost of slightly more boilerplate code, we can avoid the `NodeItem`
and `NodeCategory` abstractions used to build the node add menu.
This makes the menus more flexible and more obvious, which will
make them easier to extend with assets.

The identifiers for the new menu types are inconsistent with regular
class naming for backwards compatibility with the old "category"
menu naming.

Also adds an item for the "Self Object" node missed in dd5131bd70.

Differential Revision: https://developer.blender.org/D15973
2022-09-26 13:10:42 -05:00
8a6dc0fac7 Geometry Nodes: Control Point Neighbors Node
This node allows access to the indices of neighboring control points
within a curve via an offset. This includes taking into consideration
curves that are cyclic.

Differential Revision: D13373
2022-09-26 13:03:28 -05:00
46cfd345e4 Fix typo and and incorrect property initialization
Error in rB236fda7faf58
2022-09-26 14:23:11 -03:00
236fda7faf Fix T101343: useless Snapping menu in transform operators
Changes:
- Use the "snap_elements" property only for operators that support snapping to geometry.
- Remove unused properties:
  - "use_snap_to_same_target",
  - "snap_face_nearest_steps").
- Fix property with wrong name "use_snap_selectable_only" -> "use_snap_selectable"
- Fix use of dependent property flags.
- Remove redundant initialization of variables
- Simplify `poll_propety`. Only the "use_snap_project" is not hidden.

>>! In rBc484599687ba it's said:
>  These options are needed for Python tools to control snapping without requiring the tool settings to be adjusted.
If that's the case, there doesn't seem to be any need to display them in the redo panel.  Therefore:
- Hide snapping properties in redo panel.

Many properties have been added that can be independent of ToolSettings. Therefore:
- Save snapping properties in the operator itself. For Redo.
2022-09-26 14:18:39 -03:00
125ac1f914 Cycles: increase min-supported driver version for Intel GPUs
Windows drivers 101.3430 fix an important GUI-related crash and it's
best to prevent users from running into it.
Linux drivers weren't affected but still had relevant gpu binary
compatibility fixes, so it makes sense to keep the min-supported version
aligned across OSes.
2022-09-26 07:41:47 -07:00
Angus Stanton
2522ca03d2 Asset Browser: Add slider UI to pose blending
Add the Slider UI to pose blending. This adds a slider with percentages,
and controls for precision control and incremental control.

Reviewed By: sybren

Maniphest Tasks: T90182

Differential Revision: https://developer.blender.org/D14984
2022-09-26 16:21:00 +02:00
2356afc7af Cleanup: format, ensure trailing newlines 2022-09-26 21:52:40 +10:00
03eac69c61 Cleanup: restore parenthesis removed in recent commit
Partial revert [0], removed by accident because the -fpermissive
flag was enabled with collada.

[0]: 34477bbfcd
2022-09-26 21:51:43 +10:00
b211540783 Fix: bump subversion to avoid corrupted files
Replacing the transfer node breaks forward compatibility, so a version
bump is necessary to get a warning in older versions.
2022-09-26 12:06:54 +02:00
fa1c214c5b Fix crash in Solidify modifier with Inner Crease
Since a8a454287a the simple case would crash:

- Add place
- Add Solidify modifier
- Set Inner Crease to something non-zero

Seems to be a mistake in the logic which was trying to access
existing custom data layer on a clean result while it is more
logical to create the layer.

Was initially reported by the studio who could not open
production files after the change.
2022-09-26 11:55:34 +02:00
530b9841ee Fix T101370: GPencil Grab Sculpt crash after bake transform animation
The problem was the duplicated strokes had wrong pointers 
to the original stroke.
2022-09-26 11:09:49 +02:00
333e41eac6 Cleanup: replace C-style casts with functional casts for numeric types
Use function style casts in C++ headers & source.
2022-09-26 17:58:36 +10:00
0210c4df17 GPU: Disable SSBO support from commandline.
In heavy scenes containing many hairs/curves and volumetrics
using SSBO can overwrite the binding information of the volumetric
resolve shader. This has been detected during project Heist and is
only reproducable on NVIDIA platform.

This patch adds an debug option to disable SSBOs from the command
line to replace the --debug-gpu-force-workarounds that has been
used as a workaround on the render farm. Reason is that
force workarounds will also add other limitations as well (number
of texture binds for example)
2022-09-26 09:41:50 +02:00
6075b04cf9 System info: Added GPU device type and feature support.
Adds more information to System info to help triaging/debugging.
2022-09-26 08:36:05 +02:00
267aee514a Python: Add platform feature support methods to gpu.capabilities module.
Depending on the actual platform, Blender will disable features that are
known to have a faulty implementation. Add-on developers or users don't
have the ability to check what is actually enabled.

This patch will add the ability to check for

* Compute shader support `gpu.capabilities.compute_shader_support_get()`.
* SSBO support `gpu.capabilities.shader_storage_buffer_objects_support_get()`.
* Image load/store `gpu.capabilities.shader_image_load_store_support_get()`.
2022-09-26 08:19:44 +02:00
b4605f6158 Console: Add gpu python module to list of internal modules.
The python GPU module was not mentioned in the list of internal
modules. Adding the GPU module to the list allows curious users
to find it.
2022-09-26 08:18:17 +02:00
34477bbfcd Cleanup: remove redundant parenthesis 2022-09-26 14:23:52 +10:00
6275541df7 Cleanup: use ELEM/STR_ELEM/STREQ macros 2022-09-26 14:12:38 +10:00
96d88e5614 CMake: remove workaround for GCC 4.5 as 9.3.1 is the minimum version
The -fpermissive flag is best avoided as it suppresses some important
warnings/errors.
2022-09-26 11:52:21 +10:00
20276191e5 Cleanup: fix warning in recent parenthesis removal
Regression in [0], this slipped through due to "-fpermissive"
being added to GCC flags, suppressing the error.

[0]: c9e35c2ced
2022-09-26 11:39:24 +10:00
3961d3493b Cleanup: use 'u' prefixed integer types for brevity in C code
This also simplifies using function style casts when moving to C++.
2022-09-26 11:33:22 +10:00
3a7dc572dc Cleanup: use 'u' prefixed unsigned types for GHOST 2022-09-26 10:52:52 +10:00
5b320e5a24 Fix undefined 'uint' for macOS/WIN32 2022-09-26 10:42:47 +10:00
8a68f4f808 Cleanup: replace unsigned with uint, use function style casts for C++ 2022-09-26 10:09:15 +10:00
15f3cf7f8f Cleanup: replace C-style casts with functional casts for numeric types
Some changes missed from f68cfd6bb0.
2022-09-26 09:53:49 +10:00
e746999aa9 Fix T101309: crash when executing geometry nodes without logger 2022-09-25 23:07:29 +02:00
b3714b1e85 BLF: Refactor of blf_font_boundbox_foreach_glyph
Refactor of `BLF_boundbox_foreach_glyph` and simplification of its
usage by only passing translated glyph bounds to callbacks.

See D15765 for more details.

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

Reviewed by Campbell Barton
2022-09-25 11:25:31 -07:00
c8ee70c962 Geometry Nodes: decentralize implicit input definitions
Previously, all implicit inputs where stored in a centralized place.
Now the information which nodes have which implicit inputs is
stored in the nodes directly.
2022-09-25 19:16:53 +02:00
2fd63efd0e BLI: simplify removing elements from containers with predicate
Previously removing elements based on a predicate was a bit cumbersome,
especially for hash tables. Now there is a new `remove_if` method in some
data structures which is similar to `std::erase_if`. We could consider adding
`blender::erase_if` in the future to more closely mimic the standard library,
but for now this is using the api design of the surrounding code is used.
2022-09-25 17:57:49 +02:00
c6e70e7bac Cleanup: follow C++ type cast style guide in some files
https://wiki.blender.org/wiki/Style_Guide/C_Cpp#C.2B.2B_Type_Cast

This was discussed in https://devtalk.blender.org/t/rfc-style-guide-for-type-casts-in-c-code/25907.
2022-09-25 17:39:45 +02:00
0419ee871f Cleanup: remove redundant parenthesis (especially with macros) 2022-09-25 22:41:22 +10:00
21d77a417e Cleanup: replace C-style casts with functional casts for numeric types
Some changes missed from f68cfd6bb0.
2022-09-25 22:31:31 +10:00
d35a10134c Cleanup: Remove commented lines 2022-09-25 12:31:05 +02:00
b6adca3280 Fix T101317: GPencil separate Active layer freezes blender
The error occurs only when the layer is empty.
2022-09-25 12:26:59 +02:00
f68cfd6bb0 Cleanup: replace C-style casts with functional casts for numeric types 2022-09-25 20:17:08 +10:00
c7b247a118 Cleanup: replace static_casts with functional casts for numeric types 2022-09-25 18:31:10 +10:00
891949cbb4 Cleanup: use 'u' prefixed integer types for brevity & cast style
To use function style cast '(unsigned char)x' can't be replaced by
'unsigned char(x)'.
2022-09-25 18:26:27 +10:00
c9e35c2ced Cleanup: remove redundant double parenthesis 2022-09-25 15:34:32 +10:00
865894481c Cleanup: quiet compiler warning 2022-09-25 15:26:30 +10:00
26f330ea4c Cleanup: format, spelling in comments 2022-09-25 15:24:37 +10:00
4e7983e073 UI: Improved Font Thumbnails
Thumbnails of fonts that better show design, shapes, contents, intent,
and intended language. Previews almost every known language - living
and dead - and symbol, specialty fonts, etc.

See D12032 for more details and samples.

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

Reviewed by Campbell Barton
2022-09-24 10:57:34 -07:00
2ff5d42cd3 Sculpt: Fix bug with allocating duplicate attribute layers
Sculpt attribute API was incorrectly allocating duplicate
attribute layers.
2022-09-24 10:04:28 -07:00
72933ebe96 BLF: Correctly Set Default Font Size
Commit cd1631b17d fails to scale the global_font_size by UI scale in
BLF_set_default. Generally used for simple text output like statistics.

See D16053 for more details.

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

Own Code
2022-09-24 08:23:36 -07:00
1b46d57f67 Fix: Invalid CustomData type map created for legacy mesh conversion
Caused by 060a534141.
2022-09-24 09:37:30 -05:00
535f50e5a6 Curves: Use early out when apapting domain of single value
When adapting the domain of a single value virtual array, skip
allocating an array for the result and just return another single
value. Among other cases, this can help when everything is selected
in sculpt mode, moving domain interpolation from 5% of perf samples
to 0% when sculpting.
2022-09-24 09:31:15 -05:00
c25df02ac3 Cleanup: simplify accessing mesh looptris 2022-09-24 11:41:08 +02:00
8422da13c9 GPencil: Exist early from loop for Fill extensions
It does not need follow in the loop if a collision was found.
2022-09-24 11:18:39 +02:00
f416a76bcd Cleanup: typo in static node type 2022-09-24 10:33:17 +02:00
cd1631b17d BLF: Refactor of DPI
Correction of U.dpi to hold actual monitor DPI. Simplify font sizing by
omitting DPI as API argument, always using 72 internally.

See D15961 for more details.

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

Reviewed by Campbell Barton
2022-09-23 17:36:49 -07:00
88a602bc64 Fix build error in blenloader on macOS after recent changes 2022-09-24 01:21:26 +02:00
ff27b68f41 Fix T101295: Allow Large Windows Thumbnails
Allow our Windows Thumbnail Handler to supply thumbnails up to the
maximum 256x256 size.

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

Reviewed by Ray Molenkamp
2022-09-23 14:49:36 -07:00
ce63fea080 Cleanup: Remove unused data transfer function 2022-09-23 16:30:25 -05:00
1b5c94630e GPU: Disable static compilation for geometry shaders workaround
These shaders are only supported by the Metal backed.
Regression introduced by 1514e1a5b7
2022-09-23 23:27:42 +02:00
fd2668a368 Overlay: Fix overlay image shaders
Regression introduced in 18b45aabf9.
Caused by a bad merge.
2022-09-23 23:27:42 +02:00
c2a21dfb77 Sculpt: fix memory corruption in new attribute api 2022-09-23 14:16:11 -07:00
7e980f2b8c Fix T101249: Node groups don't show in node search
bdb5754147 neglected to add search items for node groups.
Luckily adding them is quite simple. However, if the node group is also
an asset, it will show up duplicated in the list. To resolve this we
avoid adding node groups to the list if they have already been
added as assets.
2022-09-23 14:25:25 -05:00
dedc679eca Geometry Nodes: Split transfer attribute node
This patch replaces the existing transfer attribute node with three
nodes, "Sample Nearest Surface", "Sample Index", and "Sample Nearest".
This follows the design in T100010, allowing for new nodes like UV
sampling in the future. There is versioning so the new nodes replace
the old ones and are relinked as necessary.

The "Sample Nearest Surface" node is meant for the more complex
sampling algorithms that only work on meshes and interpolate
values inside of faces.

The new "Sample Index" just retrieves attributes from a geometry at
specific indices. It doesn't have implicit behavior like the old
transfer mode, which should make it more predictable. In order to not
change the behavior from existing files, the node has a has a "Clamp",
which is off by default for consistency with the "Field at Index" node.

The "Sample Nearest" node returns the index of the nearest element
on a geometry. It can be combined with the "Sample Index" node for
the same functionality as the old transfer node. This node can support
curves in the future.

Backwards compatibility is handled by versioning, but old versions can
not understand these nodes. The warning from 680fa8a523 should make
this explicit in 3.3 and earlier.

Differential Revision: https://developer.blender.org/D15909
2022-09-23 13:56:35 -05:00
d5554cdc7c Fix T100741: Update FFMPEG Dimensions
Update the animation's dimensions within ffmpeg_fetchibuf in case it
has changed because of dynamic resolution (possible with WebM).

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

Reviewed by Richard Antalik
2022-09-23 10:50:05 -07:00
d12f0d3f70 Fix: Crash with empty vertex group in mask modifier
The C++ vertex group data accessor returned a span with null data that
wasn't empty. Instead of adding a null check as well as the size check,
just return an empty span when there is no vertex group data.
2022-09-23 12:32:08 -05:00
392855ce50 GPencil: Improve Fill Tool Extend lines
* Improve how the extend lines collision is calculated.
* Added `S` key to switch between modes.
*  Now extend factor does not disable visual aids (thi sis done with checkbox).
* Reduce the use of linked list and now memory array is used.
* Refactor Radius functions.
* Fixed bug of Radius mode when object is rotated.
* Cleanup code.

Differential Revision: https://developer.blender.org/D16022
2022-09-23 19:29:02 +02:00
2d8eadacf9 Fix: Missing DNA rename for recent mesh refactor
12becbf0df changed to `flag_legacy` but didn't use a rename.
2022-09-23 12:13:25 -05:00
67308d73a4 Node Editor: Adjust node link curving
Clamp node link curving when the link is close to horizontal to prevent
overshooting at the ends.

Reviewed By: Pablo Vazquez, Hans Goudey

Differential Revision: http://developer.blender.org/D16041
2022-09-23 18:13:45 +02:00
2438f76d6f Fix: Assert calculating mesh triangulation
The condition from 0d7d8c73cf was reversed.
2022-09-23 10:45:07 -05:00
12becbf0df Mesh: Move selection flags to generic attributes
Using the attribute name semantics from T97452, this patch moves the
selection status of mesh elements from the `SELECT` of vertices, and
edges, and the `ME_FACE_SEL` of faces to generic boolean attribute
Storing this data as generic attributes can significantly simplify and
improve code, as described in T95965.

The attributes are called `.select_vert`, `.select_edge`, and
`.select_poly`. The `.` prefix means they are "UI attributes",so they
still contain original data edited by users, but they aren't meant to
be accessed procedurally by the user in arbitrary situations. They are
also be hidden in the spreadsheet and the attribute list.

Until 4.0, the attributes are still written to and read from the mesh
in the old way, so neither forward nor backward compatibility are
affected. This means memory requirements will be increased by one byte
per element when selection is used. When the flags are removed
completely, requirements will decrease.

Further notes:
* The `MVert` flag is empty at runtime now, so it can be ignored.
* `BMesh` is unchanged, otherwise the change would be much larger.
* Many tests have slightly different results, since the selection
  attribute uses more generic propagation. Previously you couldn't
  really rely on edit mode selections being propagated procedurally.
  Now it mostly works as expected.

Similar to 2480b55f21
Ref T95965

Differential Revision: https://developer.blender.org/D15795
2022-09-23 10:45:07 -05:00
e345686cb7 View3d: move space_view3d.c to c++ 2022-09-23 16:51:29 +02:00
63bdd89108 Cleanup: use depsgraph iterator settings in rna
Somehow missed this as part of rBb197cd5821f1dfaa5168d31984dd8014f5252456.
2022-09-23 16:12:59 +02:00
a8a454287a Mesh: Move edge crease out of MEdge
This is very similar to D14077. There are two differences though.
First is that vertex creases are already stored in a separate layer,
and second is that we can now completely remove use of `Mesh.cd_flag`,
since that information is now inherent to whether the layers exist.

There are two functional differences here:
 * Operators are used to add and remove layers instead of a property.
 * The "crease" attribute can be created and removed by geometry nodes.

The second change should make various geometry nodes slightly faster,
since the "crease" attribute was always processed before. Creases are
now interpolated generically in the CustomData API too, which should
help maintain the values across edits better.

Meshes get an `edge_creases` RNA property like the existing vertex
property, to provide more efficient access to the data in Cycles.

One test failure is expected, where different rounding between float
the old char storage means that 5 additional points are scattered in
a geometry nodes test.

Differential Revision: https://developer.blender.org/D15927
2022-09-23 09:02:28 -05:00
b197cd5821 Cleanup: use depsgraph iterator settings in rna
This was missing in rBe5d4afd5bac71e29ba71ecf091feaa0d70b70260.
2022-09-23 15:49:12 +02:00
0d7d8c73cf Mesh: Use cached looptris in draw cache extraction
The mesh's triangulation cache is often created for other operations
besides the drawing code, but during the mesh draw cache extraction
it is recalculated on every single time. It is simpler and faster to use
the existing MLoopTri array. It can also save memory if the cache
already exists by avoiding allocating a duplicate array. For a 4 million
face quad mesh, that is already 128 MB.

Also use face normals for mesh triangulation if they aren't dirty,
which should provide a general speedup when they're both necessary.

Recently 54182e4925 made this more reliable, since the triangulation
cache is invalidated properly when the mesh is deformed.

Fixes T98073

Differential Revision: https://developer.blender.org/D15550
2022-09-23 08:23:35 -05:00
060a534141 Mesh: Move sculpt face sets to a generic attribute
Similar to the other refactors from T95965, this commit moves sculpt
face sets to use a generic integer attribute named `".sculpt_face_set"`.
This makes face sets accessible in the Python API.

The attribute is not visible in the attributes list or the spreadsheet
because it is meant for internal use, though that could be an option
in the future along with other similar attributes. Currently the change
is small, but in the future this could simplify code by allowing use
of more generic attribute APIs.

Differential Revision: https://developer.blender.org/D16045
2022-09-23 08:19:40 -05:00
35375380d7 Cleanup: Grammar fix in lazy function 2022-09-23 08:05:44 -05:00
998fc4f8f6 Cleanup: fix compiler errors 2022-09-23 14:45:25 +02:00
f2b5fd0a0e Cleanup: give anonymous enum a name 2022-09-23 12:48:22 +02:00
e5d4afd5ba Depsgraph: generalize passing parameters to depsgraph object iterator
This makes it easier to pass more parameters to the iterator in the future.

Differential Revision: https://developer.blender.org/D16047
2022-09-23 12:41:22 +02:00
eb54502d9d Fix T101109: Animation on nodes problems when dealing with Node Groups
Whenever animation on nodes was transfered to/from nodegroups (grouping/
ungrouping/separating) via BKE_animdata_transfer_by_basepath, it was
possible to create new nodes with the same name (in the formerly same
path -- see report for an example of this) and animation from the
original node was still performed on them. Issue went away after save/
reload.

In order to fully update the action, a depsgraph is now performed on the
action (similar to what is done when renaming for example).

Maniphest Tasks: T101109

Differential Revision: https://developer.blender.org/D15987
2022-09-23 12:06:32 +02:00
c350d97a2f Fix T101046: missing DEG update changing bone layers in editmode
Following {T54811} (and {rBbb92edd1c802}), DEG updates have been added
to the various operators. This has also been done for the layers
operators (see {rBf998bad211ae}, `ARMATURE_OT_bone_layers` has been
marked done in T54811). However, instead of `ARMATURE_OT_bone_layers`,
the update tagging actually happened for `POSE_OT_bone_layers`.

Now do this for `ARMATURE_OT_bone_layers` as well (keep it for
`POSE_OT_bone_layers`, dont think this is wrong there either).

Maniphest Tasks: T101046

Differential Revision: https://developer.blender.org/D15969
2022-09-23 12:06:02 +02:00
fbd78a8d78 Cleanup: use ELEM macro 2022-09-23 15:29:21 +10:00
c655bdfa31 Cleanup: add string utility macros to GHOST/Wayland
Use STREQ for readability.
2022-09-23 15:28:48 +10:00
77ed4651ee Cleanup: float literals 2022-09-23 15:28:48 +10:00
0f6d5c9a9d Docs: minor improvements to info_advanced_blender_as_bpy wording 2022-09-23 15:04:02 +10:00
c172522060 Fix T100141: Header Alignment of New Editors
Revert part of [0] which changed logic for scaling 2D regions
when the window resize. This re-introduces T72392 which can be
fixed separately.

[0]: 6243972319
2022-09-23 14:33:51 +10:00
0e94d24080 Cleanup: replace int return value with bool 2022-09-23 14:33:47 +10:00
187d8ba362 Cleanup: avoid unnecessary access to context.space_data 2022-09-23 14:33:46 +10:00
998ace3463 Cleanup: use lowercase function calls & macros in for CMake
This is already the case for most CMake usage.
Although some find modules are an exception to this, as they were
originally maintained externally they use some different conventions.

Also corrected bad indentation in: intern/cycles/CMakeLists.txt
2022-09-23 14:33:44 +10:00
add1b6ab3c Cleanup: spelling in comments 2022-09-23 14:33:43 +10:00
3edd87f009 Cleanup: format 2022-09-23 14:33:42 +10:00
cda2dc721d Cleanup: compiler warnings 2022-09-23 14:33:40 +10:00
e9344d329f Fix: Add missing drag link search item for store named attribute node
The search didn't add an item for the geometry output socket.
2022-09-22 16:54:23 -05:00
319ee296fd Curves editmode: show point selection
Points cannot be selected atm in editmode, this patch just shows the
selection from sculptmode in editmode.

Since the selection in sculptmode is a float, a point is considered
selected as soon as the float selection is above 0.0f.

Implementation: this piggy-back on the existing drawing via
overlay_edit_curve_point.glsl which requires a "data" VBO which holds
flags for selection (next to others such as "active" - which we also
have to take care of later).

Differential Revision: https://developer.blender.org/D16021
2022-09-22 20:23:13 +02:00
Charlie Jolly
680fa8a523 Fix T100846: Bump blender file min version for forward compatibility warning
Also reported in blender.chat.

Corrupted files were reported after opening files with the new Mix node (rBbfa0ee13d539).

Files saved in 3.4 will not be compatible with older versions of Blender.

Opening these files in previous versions will exhibit a red undefined node.

Reviewed By: HooglyBoogly, brecht

Differential Revision: https://developer.blender.org/D16025
2022-09-22 17:08:50 +01:00
Jason Fielder
e8bcca4bdc GPU: Ensure rendering operations occur within GPU render boundaries.
This is required by the Metal backend to perform flushing of temporary objective-C resources. This is implemented as a global autoreleasepool, and is to ensure consistency such that all rendering operations, whether called via events, or via main loop will be within an autoreleasepool.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15900
2022-09-22 18:05:59 +02:00
Jason Fielder
18b45aabf9 Metal: GLSL shader compatibility changes for global uniform and interface name collision.
For the Metal shader translation support for shader-global uniforms are remapped via macro's, and in such cases where a uniform name matches a vertex attribute name, compilation errors will occur due to this injected syntax being incompatible with the immediate code.

Also adding source-level function interface alternatives where sized arrays are passed in. These are not supported directly in Metal shading language and are instead handled as pointers. These pointers require explicit address-space qualifiers in some cases, if device/constant address space memory is passed into the function.

Ref T96261

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15898
2022-09-22 17:53:56 +02:00
Jason Fielder
1514e1a5b7 Metal: First set of Geometry Shader alternative implementations using SSBO vertex shader fetch.
These implementations remove dependency on the Geometry pass by instead invoking one vertex shader instance for each expected output vertex, matching what a geometry shader would emit. Each vertex shader instance is then responsible for calculating the same output position based on its vertex_id as the logic would in the geometry shader version.

SSBO Vertex fetch enables full random-access into a vertex buffer by binding it as a read-only SSBO. This enables each instance to read neighbouring vertex data to perform contextual calculations as a geometry shader would, for cases where attribute Multiload is not supported.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15901
2022-09-22 17:43:04 +02:00
Thomas Dinges
697b447c20 Metal: MTLContext implementation and immediate mode rendering support.
MTLContext provides functionality for command encoding, binding management and graphics device management. MTLImmediate provides simple draw enablement with dynamically encoded data. These draws utilise temporary scratch buffer memory to provide minimal bandwidth overhead during workload submission.

This patch also contains empty placeholders for MTLBatch and MTLDrawList to enable testing of first pixels on-screen without failure.

The Metal API also requires access to the GHOST_Context to ensure the same pre-initialized Metal GPU device is used by the viewport. Given the explicit nature of Metal, explicit control is also needed over presentation, to ensure correct work scheduling and rendering pipeline state.

Authored by Apple: Michael Parkin-White

Ref T96261

(The diff is based on 043f59cb3b)

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15953
2022-09-22 17:32:43 +02:00
Thomas Dinges
bb63b98d1f Metal: MTLVertBuf implementation and support for texture creation from vertex buffers.
Metal: MTLVertBuf implementation and support for texture creation from vertex buffers.

Authored by Apple: Michael Parkin-White

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D15452
2022-09-22 17:16:22 +02:00
dd5131bd70 Geometry Nodes: Add Self Object Node
From the nodes' description: "Retrieve the object that contains
the geometry nodes modifier currently being executed". This was
discussed in the most recent geometry nodes module meeting.

Because the node allows you to retrieve the position of the modifier
object, it has to add a depsgraph relation to object transform.
Expect that modifiers will be reevaluated when moving the object.
In the future, better static analysis of node trees could make this
check smarter.

Differential Revision: https://developer.blender.org/D16037
2022-09-22 08:15:03 -05:00
dc06bf2cb6 Fix crash loading fonts that fail to be read
Null pointer dereference since [0] when font's can't be read.

[0]: d39abb74a0
2022-09-22 22:11:09 +10:00
Werner, Stefan
0c824837ab Cycles: Cleanup in oneAPI math includes and definitions
Now explicitly including math.h first before #defining funcitons.
This avoids undefined behavior and improves compatibility with
different SYCL compilers and backends.
2022-09-22 11:33:57 +02:00
75d984a712 Refactor: const-correctness in bmesh conversion assert 2022-09-22 10:33:12 +02:00
c50335b359 UV: add toggle to show the grid over the image
In UV editor, previously unable to see grid and image at same time.

Maniphest Tasks: T78391

Differential Revision: https://developer.blender.org/D16038
2022-09-22 17:20:11 +12:00
3185c3bc74 Cleanup: use an array of modifier keys for GHOST/Wayland
Support iterating over modifiers, instead of using macros.
2022-09-22 13:47:17 +10:00
ef06375159 GHOST: assert when unknown keys are passed to the ModifierKeys API 2022-09-22 13:47:17 +10:00
7ce09ef48f Cleanup: remove unused modifier state checks from getModifierKeys
Also remove unused numpad & caplock key index storage.
2022-09-22 13:47:17 +10:00
967fe75bb6 Cleanup: remove redundant includes from GHOST_SystemPathsUnix 2022-09-22 13:47:17 +10:00
62ffbc7d7f PyGPU: Allow single bool in 'GPUShader.uniform_bool' method
As with the other uniform methods, a single value is expected.
2022-09-21 22:30:57 -03:00
20dc839319 Fix T101262: Crash in spreadsheet selection filter with empty domain
The BMesh selection virtual array was empty. There are a few different
places we could add an "empty" check here, but at the top of the
function is the simplest for now.
2022-09-21 17:34:30 -05:00
77dcfac8a3 Fix: Use correct node group for add node search
Similar to e5a7470638, the tree currently being edited should be
used for polling and other tests, rather than the node tree at the root
of the node editor's path.
2022-09-21 17:12:53 -05:00
3676d6b88d Cleanup: Use const arguments for node group poll function
Also make the disabled hint argument optional.
2022-09-21 17:12:53 -05:00
f42569bb71 Fix EEVEE: Screen Space Refraction Artefacts caused by viewport aspect ratio
This was caused by the vertical/horizontal clasification being done in
NDC space which wasn't respecting the Aspect ratio.

Multiplying the test vector by the target size fixes the issue.
2022-09-21 21:48:23 +02:00
91dd29fd45 Attributes: Allow calling "finish" on empty accessors
This removes some boilerplate when creating many optional attributes.
2022-09-21 13:17:05 -05:00
600c069e0e Attributes: Correct implementation of typed "write_only" method
The typed "lookup_or_add_for_write_only" function is meant to do the
same thing as the non-typed version of the function. Instead, it still
initialized values of new attribute arrays, which isn't meant to happen.

Missed in 4c91c24bc7.

I also had to correct one place that used the "write_only"
function but didn't intialize all values.
2022-09-21 13:10:03 -05:00
a82e52102b Mesh: Avoid uninitialized values when converting BMesh to Mesh
I didn't observe this issue in practice, but since the write_only
version of the attribute API isn't meant to initialize trivial types,
theoretically this could be a problem if the attribute is created
halfway through converting the BMesh to a Mesh.
2022-09-21 12:06:53 -05:00
c1f622e63e Cleanup: Miscellaneous cleanup in distribute points in volume node
- Fix unused variable warning
- Change whitespace
- Use standard variable names
- Use standard method to remove non-pointcloud components
2022-09-21 11:24:37 -05:00
a2966f6477 Fix race condition in memory freeing in edit mesh wrapper to mesh
The BM_mesh_bm_to_me_for_eval() cal be called on the same BMesh
from multiple threads. This adds a restriction that this function
should not modify the BMesh. This started to be violated quite
madly during the generic attributes changes.

This change makes it so that the BMesh is not modified.
The code looks less functional-like, but it solves the threading
conflict.

Ideally the BMesh will be const in the function but doing it now
is a bit tricky due to the other APIs.

The repro case for the crash is a bit tricky to reproduce from
scratch. For those who has access to the Heis production repo
/pro/lib/char/pack_bot/pack_bot.blend file can be used. Simply
add loop to "GEO-leg.R" object and use bevel operator on the
new loop.

There is still some write of the element indices happening in
this function. In theory those could be removed (together with
the dirty index tag clear) but it leads to obscure crashes in
area far away from this one. I've left it unchanged for now as
on 64bit platforms those assignments should not be causing real
issues.

Differential Revision: https://developer.blender.org/D16023
2022-09-21 17:36:42 +02:00
8bffadcdc4 Refactor: Simplify transfer of tags in the depsgraph builder
Base it in an existing building blocks rather than having dedicated
structure for it.

No functional changes is expected, just preparing to make the code
more reusable.
2022-09-21 16:48:48 +02:00
cd3a19f20c Fix inconsistent node name handling in dependency graph
The ID nodes will use the provided component name to maintain
the map-based storage, while the component node itself could
override the empty name with a type name.

This lead to situations when it is not possible to lookup
the operation from its owner parameters.
2022-09-21 16:48:48 +02:00
0ca9b637c5 Refactor: More const-correctness in node builder
Make it so find type of methods receive const pointers and do not
modify graph topology.

The latter was violated in the find_operation() which could have
created an empty component. This is not intended behavior.

No functional changes is expected.
2022-09-21 16:48:48 +02:00
f948ffaa9f Refactor: Move depsgraph node keys to own file
They are not specific to the relations builder and could be
used outside of it.
2022-09-21 16:48:48 +02:00
78b7a1c3a8 PyAPI: disable IMB color management methods for stand-alone mathutils
Allow building a standalone mathutils without including imbuf.
2022-09-21 23:53:38 +10:00
1b95784aad Fix compile error on (designated initializers in C++) 2022-09-21 14:36:55 +02:00
efa6525bf1 Cleanup: Move file browser history handing to own file
Was placed in filelist.cc, which didn't make much sense since they deal
with quite different things.
2022-09-21 14:32:08 +02:00
cd84d3f3da Refactor: Move file browser filelist.c to C++
I'm adding some asset APIs/types in C++ that the file-listing code would
use. I prefer porting this code to C++ over adding a C-API for the asset
code.

Includes some minor cleanups that shouldn't change behavior, like using
`MEM_new()`/`MEM_cnew()`, C++ style C-library includes,
`LISTBASE_FOREACH()`, removing unnecessary typedefs, etc.
2022-09-21 12:39:26 +02:00
Alaska
6adb481fb5 Add oneAPI to the 'cycles_device' command line argument help text
Differential Revision: https://developer.blender.org/D16027
2022-09-21 12:04:27 +02:00
78bfaf1a4f File Browser: Manual auto-increase name support for output filepaths
This functionality was present until Blender 2.80.  Basically it adds back the
"+" and "-" buttons in the file browser when it stores an output filepath.

This is useful for someone rendering multiple versions of an animation (or a
composition) to compare.

At the moment this is used for the render output, and the File Output node in
the compositor.

Differential Revision: https://developer.blender.org/D15968
2022-09-21 11:06:44 +02:00
15593299f3 Revert "Cleanup: Fix warning unused variable 'mode' when doing make lite"
Sorry, this was working before I rebased. I believe the warning was
fixed and the rebase still applied.

The commit as it was introduced building problems

This reverts commit ae21319d7f.
2022-09-21 11:05:35 +02:00
ae21319d7f Cleanup: Fix warning unused variable 'mode' when doing make lite 2022-09-21 10:57:11 +02:00
bc88f2006d Cleanup: remove vector adaptor data structure
This was used in early node based particle system development
but is not used anymore. The code also didn't match the standards
of other data structures in blenlib.
2022-09-21 10:39:07 +02:00
ea79dab062 Docs: add notes about wmWindow.eventstate & modifier key checks
There were undocumented limitations in the current modifier handling
that came to my attention while investigating related issues.
2022-09-21 16:46:41 +10:00
f97728248e Fix module search path for Python on initialization
Initializing the sys.path on startup attempted to add subdirectories
of {BLENDER_SYSTEM_SCRIPTS}:

- ./modules/modules
- ./modules/startup

As the directories aren't expected to exist there is no need to add them.

Also improved comments for path searching logic.
2022-09-21 12:01:49 +10:00
5517c848bd Cleanup: spelling in comments 2022-09-21 12:00:01 +10:00
e9bdf8ebc3 Cleanup: unused variable warning 2022-09-21 11:55:56 +10:00
6f15141f27 Fix T101188: Fluid modifier doesn't work
05952aa94d modified this area incorrectly, transforming
vertices outside of the mesh. That would have been fine, but the mesh
is used to retrieve the bounding box. Instead just avoid duplicating the
positions and normals completely, and avoid using referenced layers
just to be extra safe.
2022-09-20 18:38:20 -05:00
cbbed90486 Cleanup: Remove BKE_ prefix for local functions 2022-09-20 18:38:20 -05:00
7f284f5134 Fix T101138: remove console spam when hovering over toolbar in uv editor
Reviewers: Campbell Barton <ideasman42>, Ryan Inch <Imaginer>

Differential Revision: https://developer.blender.org/D16015
2022-09-21 09:44:59 +12:00
1df58ec540 Fix T101220: UV proportional editing not working correctly with UV Sync Selection
Regression introduced in rb2ba1cf4b40fc.

The `MLOOPUV_VERTSEL` flag only indicates UV selection without sync.
2022-09-20 17:29:44 -03:00
90999a0694 Fix T101208: Missing original index handling in extrude node
The extrude node must set the original indices for new faces to "None"
in edge mode as well. Same for new edges in vertex mode.
2022-09-20 14:36:20 -05:00
01ed08690a Fix: BMesh to Mesh conversion does not create all necessary layers
Even meshes without any faces must have MPoly and MLoop layers, etc.
This caused a crash in the extrude node when the edit mesh had no faces
(see T101208). Issue with f94130c94b.
2022-09-20 14:34:12 -05:00
9df0d20957 Cycles: don't allow negative BSDF weights
This doesn't work with path guiding, and likely other features.
2022-09-20 21:07:29 +02:00
ed6c8d82b8 Fix T101196: constraint plane failing in side orthographic views
Caused due to an inaccuracy when the values of `in` and `out` are too
close.

The solution is to project the value of `in` directly onto the plane.
2022-09-20 14:29:37 -03:00
1b4cf3af4b Cleanup: Improve consistency when nodes run without OpenVDB
Use a consistent order of expressions and formatting.
Also use consistent error message text.
2022-09-20 12:27:36 -05:00
Miguel Porces
01a4d38606 Fix: Group input and output always show in node add menu
In D10241, both NodeItems for NodeGroupInput and NodeGroupOutput in the
were moved from their categories into the 'node_group_items' generator.

As the NodeItem.poll() is called by the NodeCategory class and not by
the NodeItem class, the poll functions associated with those NodeItems
were never called. This should correct that.

Differential Revision: https://developer.blender.org/D16013
2022-09-20 12:07:59 -05:00
32b766223a Sculpt: Fix T100479: Boundary expand crash
Face sets were not being initialized.  I had also
forgotten to remove a dead struct member from
SculptBoundary which was being accessed.
2022-09-20 10:03:28 -07:00
bf14757709 Sculpt: Fix memory corruption with reading masks from PBVH_BMESH
Feeding -1 to BM_ELEM_CD_GET_VOID_P will not return NULL.
2022-09-20 10:03:27 -07:00
5c33704ffa GPencil: Add offset parameter to reproject operator Redo Panel
Now it's possible to set an offset in the surface reprojection.
Before, this was only possible while drawing, but not in the
reproject operator.

Differential Revision: https://developer.blender.org/D15610
2022-09-20 17:32:09 +02:00
afe91903af Cleanup: Strict compiler warning
Resolves -Wunneeded-internal-declaration warning generated by Clang.
2022-09-20 15:39:29 +02:00
RedMser
3132d2751e Animation: Fix operator properties for redo panel
After the redo panel is added to animation editors in D14960, many
operators have now been adjusted to appear and function correctly.

A full list of changes is tracked in T98195.

This patch only includes actual usability fixes. It does not do any
changes for the user's convenience, like adding other helpful properties
to operators. This can be done in a follow-up patch.

Reviewed By: sybren

Maniphest Tasks: T98195

Differential Revision: https://developer.blender.org/D14977
2022-09-20 14:57:00 +02:00
RedMser
1f828a5a06 Animation: Add redo panel to Dopesheet and NLA
Add the Redo panel to the dopesheet & NLA editors. This also implicitly
adds it to the timeline editor, since it's a kind of action editor
internally.

This feature is needed for changing advanced properties of animation
operators, such as select grouped (see D14811). But it can also be
useful for existing operators, like precise keyframe position tweaking.

Changes are basically the same as in D6286 (which added the redo panel
for Graph Editor).

Some operators have internal properties that should be hidden. A full
list can be found in T98195. These will be fixed in a follow-up patch.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14960
2022-09-20 14:37:16 +02:00
9396437417 Move workspace.c to C++
Differential Revision: https://developer.blender.org/D16020
2022-09-20 13:22:55 +02:00
2b4cb893e7 Fix T101214: hidden link can cause cycle in node tree
Links that are linked to unavailable sockets should be ignored.
2022-09-20 13:21:16 +02:00
22efaa2e7b Fix T101201: Missing filter from outliner header
This was missing in Blender File & Orphan Data view.

Typo in rBb5fc8f611e39.

Maniphest Tasks: T101201

Differential Revision: https://developer.blender.org/D16016
2022-09-20 12:20:14 +02:00
5c81d3bd46 Geometry Nodes: improve evaluator with lazy threading
In large node setup the threading overhead was sometimes very significant.
That's especially true when most nodes do very little work.

This commit improves the scheduling by not using multi-threading in many
cases unless it's likely that it will be worth it. For more details see the comments
in `BLI_lazy_threading.hh`.

Differential Revision: https://developer.blender.org/D15976
2022-09-20 11:08:05 +02:00
7a239812ca Fix misleading operator name in the dope-sheet and action editor
The operator did not set the any extrapolation mode of the individual
keyframes, it sets it for the whole f-curve. Change the operator name to
reflect that.
2022-09-20 10:52:35 +02:00
c8a18fd239 Cleanup: add hint that typedef is used as compiler bug workaround
https://developercommunity.visualstudio.com/t/Alias-template-inside-fold-expression-fa/10040507
2022-09-20 10:42:25 +02:00
41935b9285 Cleanup: quite compiler warning
Warning: P3204.
2022-09-20 10:37:46 +02:00
22b69ed08f Fix T101001: crash setting texture node active in certain cases
Code from {rBb0cb0a785475} assumed a texture node `node->id` would
always be an image.
That is not true though:
 - could be an object (as reported here with the Point Density node)
 - could be a textblock (as in the IES Texture node)

Acting on these would crash when doing `BKE_image_signal` on them.

Now check node id is an image and do nothing otherwise.
Also check if an image is actually set in these nodes (if none is, the
Image Editor is now also untouched, previously the image in the Image
Editor was "cleared" here [set to NULL] -- which does not seems very
beneficial)

Maniphest Tasks: T101001

Differential Revision: https://developer.blender.org/D15943
2022-09-20 09:19:49 +02:00
e00f76c6a8 ViewLayer: fix missing sync in object APIs (fixes T101128, T101204)
Since D15885, most (all?) python based importers are failing with an
error like RuntimeError: Error: Object 'Cube' can't be selected
because it is not in View Layer, whenever they try to mark
just-created objects selected via obj.select_set(True). Happens at
least in FBX and (legacy) OBJ importers -- effectively they end up
creating just the first imported object before failing with this
exception.

Looks like BKE_view_layer_synced_ensure calls were missing before
BKE_view_layer_base_find in rna_object_api.c.

Reviewed By: Campbell Barton
Differential Revision: https://developer.blender.org/D16004
2022-09-20 09:45:27 +03:00
b950a8fb79 Painting: Don't calculate rake rotation when texture is not set.
Currently the rake rotation is calculated when the angle mode is set. Even when the texture isn't valid.
This change will only calculate the rake rotation when the texture is valid and the angle mode is set.
2022-09-20 08:28:35 +02:00
c279a0d931 GHOST/Wayland: refactor modifier handling on window activation
GHOST_SystemWayland::getModifierKeys() now returns the correct
modifier keys held instead of guessing that both left/right modifiers
were held.
2022-09-20 16:02:34 +10:00
09308c4b6a CMake: fail to build with unsupported versions of wayland-scanner
When WITH_GHOST_WAYLAND_DYNLOAD is enabled.
2022-09-20 12:53:06 +10:00
9c35f103c0 Cleanup: quiet warning 2022-09-20 12:53:05 +10:00
710b8b7929 GNUmakefile: fix error showing final message with the 'dash' shell
The bpy module check wasn't working with dash,
use posix compliant check for empty string.
2022-09-20 12:53:03 +10:00
3d5e0c8b9d Cleanup: Move mesh_mapping.c to C++ 2022-09-19 18:45:11 -05:00
a24fc6bbc1 UV: extend custom grid sizes to set each axis separately
For example, allows a custom UV grid size of 4 x 12.

TODO: Fix snapping with custom UV grid sizes.

Manifest Tasks: T78391

Differential Revision: https://developer.blender.org/D16000
2022-09-20 10:00:41 +12:00
7a67d69ca4 Cleanup: spelling 2022-09-20 09:20:55 +12:00
bdb5754147 Nodes: Add node group assets to search menus
Currently node group assets are supported, but using them by dragging
from the asset browser is cumbersome. This patch adds all node group
assets from user asset libraries and the current file libraries to the
add node search menu and the link drag search menu.

Node groups added through the search will have their "options" hidden,
meaning the data-block selector is displayed. This helps keep the UI
clean, and the selector shouldn't be necessary anyway.

To make that possible, metadata like the node tree type and its inputs
and outputs has to be saved in the file. This requires re-saving the
files that contain the assets with the patch applied.

The node add search operator is moved from Python to C++ to ease
development and allow more flexibility. It supports a tooltip that
gives the description of assets.

Currently the node groups are added with the asset system's existing
"Append & Reuse" behavior. It's likely that linking should be possible
in the future too, but for now the idea is to use the more foolproof
option that doesn't create dependencies between files.

Because loading assets can potentially take a long time, the search
menu refreshes its items as new assets are loaded. However, changing
the search field is necessary to see the update.

Differential Revision: https://developer.blender.org/D15568
2022-09-19 11:57:10 -05:00
862de9187f Cleanup: Move versioning_300.c to C++ 2022-09-19 11:06:21 -05:00
Iyad Ahmed
b6e26a410c Geometry Nodes: Distribute Points in Volume
This commit adds a node to distribute points inside of volume grids.
The "Random" mode usese OpenVDB's "point scatter" implementation, and
there is also a "Grid" mode for uniform distributions. Both methods
operate on all of the float grids in the volume, using every voxel with
a value higher than the threshold. The random method is not stable as
the input volume deforms.

Based on a patch by Angus Stanton (@abstanton), which was based on a
patch by Kenzie (@kenziemac130).

Differential Revision: https://developer.blender.org/D15375
2022-09-19 10:14:08 -05:00
0e6a8df6df GPencil: Make format
Missing in previous commit
2022-09-19 16:31:00 +02:00
5c13c7cd30 GPencil: Cut Extended lines in Fill tool when collide
Before, the lines could be extended endless, but this added too noise. 
Now, the lines are not extended more if collide.

Before:

{F13504186}

After:

{F13504187}

Reviewed By: mendio, frogstomp

Differential Revision: https://developer.blender.org/D15992
2022-09-19 16:03:53 +02:00
be863506b8 Cleanup: Improve comment for curve component legacy curves 2022-09-19 08:46:28 -05:00
2ce8b01c59 PyGPU: call 'GPU_shader_bind' in 'GPUShader.uniform_' methods
This simplifies python code.

When we call a method like shader.uniform_float("color", (1,1,1,1)),
we expect the shader's uniform to be updated regardless of whether the
shader is bound or not.

And `batch.draw()` already calls `GPU_shader_bind` inside.

Differential Revision: https://developer.blender.org/D15929
2022-09-19 09:40:20 -03:00
2fffd7d7a8 Move overlay engine to C++
This just makes the minimum changes to make the files compile.
2022-09-19 14:29:58 +02:00
327802b86f DNA: Remove unnecessary studio light & light probe struct paddings 2022-09-19 12:16:30 +02:00
2c407cfb8f GHOST/Wayland: correct flag for checking pressed keys
Check modifier keys using XKB_STATE_MODS_DEPRESSED which is used
to check if modifiers are physically held. In practice it's unlikely
this would have caused an error for key-maps in common use.
2022-09-19 16:29:29 +10:00
ea35c237fc Fix T101180: console HOME key doesn't work
Regression in [0], re-order the key-map so the home key
can be used for cursor motion.

[0]: 82fc52ffc8
2022-09-19 15:52:21 +10:00
6b8b2c8e7f Cleanup: use doxy sections 2022-09-19 14:52:27 +10:00
6424fbca94 Cleanup: spelling 2022-09-19 14:52:27 +10:00
4baa6e57bd Cleanup: prefer 'arg' over 'params' for sphinx documentation
While both are supported, 'arg' is in more common use so prefer it.
2022-09-19 14:24:31 +10:00
Wannes Malfait
8a9f6a2e0a Fix T101137: Crash with Transform Node
In `BKE_mesh_tag_coords_changed_uniformly` the checks for dirty vertex
and dirty poly normals were swapped around, causing an assert to be
triggered.

Differential Revision: https://developer.blender.org/D16002
2022-09-18 22:58:51 -05:00
a45b408422 Cleanup: Fix grammar in IndexRange header
Also make it more clear by avoiding repeating the name of the function.
2022-09-18 22:57:46 -05:00
ecf3435362 Curves: Remove CurveEval and old Spline types
`CurveEval` was added for the first iteration of geometry nodes curve
support. Since then, it has been replaced by the new `Curves` type
which is designed to be much faster for many curves and better
integrated with the rest of Blender. Now that all curve nodes have
been moved to use `Curves` (T95443), the type can be removed,
along with the corresponding geometry component.
2022-09-18 15:10:04 -05:00
7536abbe16 Curves: Port Curve to Points node to the new data-block
This is the last node to use the `CurveEval` type. Since the curve to
points node is basically the same as the resample node, now it just
reuses the resample code and moves the curve point `CustomData` to a
new point cloud at the end. I had to add support for sampling tangents
and normals to the resampling.

There is one behavior change: If the radius attribute doesn't exist,
the node won't set the radius to 1 for the output point cloud anymore.
Instead, the default radius for point clouds will be used.
That issue was similar to T99814.

Differential Revision: https://developer.blender.org/D16008
2022-09-18 14:56:24 -05:00
cf56b8be37 Fix T101166: crash when creating group input socket
The issue was that not all Group Input nodes were updated when
the node group interface changed.
2022-09-18 21:07:23 +02:00
53c92efd5a Fix: Prevent clipping of node drop shadow
Fix clipping artifacts of node drop shadows that could occur
on hidden nodes, when using higher UI scaling.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D16007
2022-09-18 20:39:14 +02:00
998ffcbf09 Fix: Make node position consistent when added through link drag search
The node position is specified in the coordinate space of the node
editor. The cursor position has to be divided by `UI_DPI_FAC` since it's
in view space but the offset is independent of any ui scaling.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D16006
2022-09-18 20:18:50 +02:00
fd1bc90679 Cycles: sync changes from standalone repository
* Windows build fixes
* Workaround for Hydra + OpenColorIO link issue
* Bump version
2022-09-18 17:34:23 +02:00
0ffd288fab Build: fix gtest build flags affecting actual library
Switch to target_ functions to avoid this.
2022-09-18 11:26:34 +02:00
6bf5cc62e0 Build: limit Py_ENABLE_SHARED to modules using Python headers
And remove Python flags from nodes, no longer needed.
2022-09-18 11:26:33 +02:00
892a5f8176 Build: disable gtests entirely for Python module
To avoid test failure on Windows.
2022-09-18 11:26:23 +02:00
Wannes Malfait
3ff15a9e23 Geometry Nodes: New Face Set Boundaries node
With the recent addition of the UV unwrapping node, there is a need to
be able to create seams easily. This node does that by outputting a
selection of the boundaries between different input face sets. In the
context of UV mapping, one inputs the "patches" you want, and the node
gives you the seams needed to make those patches.

Differential Revision: https://developer.blender.org/D15423
2022-09-17 22:18:52 -05:00
Mattias Fredriksson
ce54f48556 BLI: Add generic utlity for gathering values with indices
Add new functions to `array_utils` namespace called `gather(..)`.
Versions of `GVArray::materialize_compressed_to_uninitialized(..)` with
threading have been reimplemented locally in multiple geometry node
contexts. The purpose of this patch is therefore to:
 * Assemble these implementations in a single file.
 * Provide a naming convention that is easier to recognize.

Differential Revision: https://developer.blender.org/D15786
2022-09-17 22:12:02 -05:00
Mattias Fredriksson
095516403c Curves: Correct and improve Catmull Rom interpolation
Correct interpolation of integer POD types for Catmull Rom
interpolation as implemented in eaf416693d.

**Problem description**
`attribute_math::DefaultMixer<T>::mix_in()` assumes/asserts positive
weights but the basis function for Catmull-Rom splines generates
negative weights (see image in revision). Passing negative weights will
yield correct result as sum(weights) = 1 (after multiplication by 0.5)
but the assert is still triggered in debug builds. This patch adjusts
the behavior by extending the mix functions with mix4(). The benefit
of using mix#() over a DefaultMixer is that the result no longer needs
to be divided by the weight sum, instead utilizing that the basis weight
sum is constant (see plot).

**Changes**
 * Added mix4() and updated catmull_rom::interpolate() to use it.
 * Removed TODOs from catmull_rom functions.
 * Moved mix definitions to be ordered as 2, 3, 4 in the header.

**Implementation specifics**
`catmull_rom::interpolate()` uses a constexpr to differentiate between
POD types which multiplies the result with 0.5 after weighting the
values, this reduces the number of multiplications for 1D, 2D, 3D
vectors (https://godbolt.org/z/8M1z9Pxx6). While this could be
considered unnecessary, I didn't want to change the original behavior
as it could influence performance (did not measure performance here
as this should ensure the logic is ~identical for FP types).

Differential Revision: https://developer.blender.org/D15997
2022-09-17 21:53:58 -05:00
641bbc820f Curves: Don't allow resolutions less than 1
While this worked, the result for curves with a resolution of zero was
just a single evaluated point, which isn't useful or intuitive. Using
the attribute validation from 8934f00ac5, make sure users
can't set values 0 or less.
2022-09-17 21:12:25 -05:00
0bdb5239c1 LineArt: Force intersection option.
This option allows easier setup of intersection overrides on more
complex scene structures. Setting force intersection would allow objects
to always produce intersection lines even against no-intersection ones.

Reviewed By: Aleš Jelovčan (frogstomp) Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D15978
2022-09-18 09:46:21 +08:00
4f284873d0 Fix: Crash after recent attributes commit
Fixes test failures from 8934f00ac5.
2022-09-17 20:27:50 -05:00
8c878ddd34 Fix OS-key events repeating on GHOST/Win32
Holding the OS (Windows) key on Win32 used key-repeat behavior.
While as far as I know it didn't cause user visible errors - sending
repeated modifier events isn't expected behavior and doesn't happen
on other platforms (or for other modifier keys).
2022-09-18 11:16:24 +10:00
0950e6fae6 GHOST: support left/right OS-key
Handling the OS key now match other modifiers in GHOST which detect
each key separately, making the behavior simpler to reason about since
mapping a single key to a modifier state is simpler, avoiding handling
that only applied to the OS-Key.

This means simulating key up/down events can use the correct modifier.

In the window-manager this is still only accessed accessed via KM_OSKEY.
2022-09-18 10:31:14 +10:00
8934f00ac5 Attributes: Validate some builtin attributes for untrusted inputs
We expect some builtin attributes to have positive values or values
within a certain range, but currently there some cases where users
can set attributes to arbitrary values: the store named attribute node,
and the output attributes of the geometry nodes modifier. The set
material index node also needs validation.

This patch adds an `AttributeValidator` to the attribute API, which
can be used to correct values from these untrusted inputs if necessary.
As an alternative to D15548, this approach makes it much easier to
understand when validation is being applied, without the need to add
arguments to every attribute API method or complicate the virtual
array system.

Currently validation is provided with a multi-function. That integrates
well with the field evaluations that set these values now, but it could
be wrapped to be friendlier to other areas of Blender in the future.

The Python API is not handled here either. Currently I would prefer to
wait until we can integrate the C++ and C attribute APIs better before
addressing that.

Fixes T100952

Differential Revision: https://developer.blender.org/D15990
2022-09-17 14:38:30 -05:00
6069cab442 Mikktspace: Fix triangle reordering predicate
This only affected meshes containing degenerate triangles.
2022-09-17 21:18:12 +02:00
114815816b Fix: lite build on windows
writefile.cc includes BLI_winstuff.h which
includes Windows.h which supplies definitions
of min/max that conflict with the c++ headers

previously windows.h was only included when TBB was
enabled, the inclusion of BLI_winstuff.h now
makes this define mandatory for all configurations
2022-09-17 09:36:14 -06:00
44272fdd23 WM: send a modifier press when activating a window with modifier held
Previously the a simulated event was sent for releasing modifiers
on activation but pressing only set the eventstate flag.

Prefer the simulated events since press/release events are used in some
modal key-maps.
2022-09-18 00:39:13 +10:00
d74c16ba81 WM: refactor modifier hold/release logic when activating a window
Initial support for matching left/right modifier keys for simulated
events - no functional changes.
2022-09-18 00:39:13 +10:00
57e4b6aefb PyDoc: correct parameter doc-strings & exception message 2022-09-18 00:39:13 +10:00
f8a3ec48e4 Fix T100330: Remove Render Slot not working for first slot
This bug was caused by the weird ownership logic for render results.
Basically, the most recent render result is owned by the Render, while
all others are owned by the RenderSlots.
When a new render is started, the previous Render is handed over to its
slot, and the new slot is cleared. So far, so good.

However, when a slot is removed and happens to be the one with the most
recent render, this causes a complication.
The code handles this by making another slot the most recent one, along
with moving its result back to the Render, as if that had always been
the most recent one.

That works, unless there is no most recent render because you haven't
rendered anything yet. Unfortunately, there is no way to store "there
hasn't been a render yet", so the code still tries to perform this
handover but can't.
Previously, the code handled that case by just refusing to delete the
slot. However, this blocks users from deleting this slot.

But of course, if there hasn't been a render yet, the slots will not
contain anything yet, so this entire maneuver is pointless.
Therefore, the fix for the bug is to just skip it altogether if there
is no Render instead of failing the operation.

Technically, there is a weird corner case remaining, because Renders
are per-scene. Therefore, if a user renders images in one scene,
switches to a different scene, deletes a slot there and then switches
back, in some situations the result in the deleted slot might end up
in the next slot.
Unfortunately this is just a limitation of the weird split ownership
logic and can't just be worked around. The proper fix for this
probably would be to hand over ownership of the result from the Render
to the RenderSlot once the render is done, but this is quite complex.

Also fixes a crash when iuser->scene is NULL.
2022-09-17 16:21:44 +02:00
bdbf24772a GPencil: Remove Leak Size
This value was used to close gaps, but now with the new system is not needed.

Internally, still we need to keep a small leak size, but after doing a lot of test a 
value of 3 is perfect, so it's harcoded.
2022-09-17 12:30:13 +02:00
742268c50b GPencil: Move Gap Closure option to separated subpanel
Also removed leak size
2022-09-17 12:30:13 +02:00
0621d162f0 GPencil: Change prop text to Closure Mode 2022-09-17 12:30:13 +02:00
dd0ef74887 GPencil: Hide the help Circles for gaps when gap is closed
To avoid too much noise, the help circles are only visible if the
the gap is still open. When the gap is closed, the circles are hidden.

Hiding the circles makes it easier to focus on what is problematic.
instead, to see many circles that are already resolved.
2022-09-17 12:30:13 +02:00
172b0ebe6a GPencil: Rename Fill closure methods
The new names are:

* Radius
* Extend

The mode Radius + Extend has been removed.

Also, some code cleanup and format.
2022-09-17 12:30:13 +02:00
Dave Pagurek
468f2ccc0e GPencil: Add more types of stroke extensions when filling
The motivation for this change: while working on an animation recently, I found that there are some gaps that won't close easily via stroke extension or leak size checking. In D14698, I attempted to address this by changing the algorithm of the raster-space flood fill. This patch attempts to address the same issue in vector space by adding two new cases where stroke extensions are added, as suggested by @frogstomp:

  # **Points of high curvature:** when the curvature at a point is high enough that it's hard to visually distinguish between it and an endpoint, add a stroke extension out along the normal (pointing in the opposite direction of the stroke's acceleration.) This addresses cases where technically the endpoint points up, but there's a sharp corner right below it that should extend to connect.

  # **Stroke endpoints within a radius**: when two endpoints are close together, regardless of the angle they make, connect them if they are within a radius. This addresses cases like where the two endpoints have effectively parallel tangents, so extensions won't close the gap.

Reviewed By: antoniov, mendio, frogstomp

Differential Revision: https://developer.blender.org/D14809
2022-09-17 12:30:13 +02:00
a4027658ee IndexRange: Add new intersect method
Returns a new range, that contains the intersection of the current one
with the given range.

This is helpful to select a portion of a range without having to deal with
all the asserts of other functions. The resulting range being always a
valid subrange, it can be used to iterate or copy a part of a vector.
2022-09-17 12:27:00 +02:00
9dcce5be90 DRW: Debug: Fix row / column counters not being reset on init
This fixes the issues with CPU debug print not being in the right order.
2022-09-17 12:27:00 +02:00
a1aafddcbe DRW: GPU wrapper: Add new StorageVectorBuffer
Same as `StorageArrayBuffer` but has a length counter and act like a
`blender::Vector` you can clear and append to.
2022-09-17 12:27:00 +02:00
7549e0c5ae Geometry Nodes: use stringref instead of string in logger
This reduces logging overhead. The performance difference is only
significant when there are many fast nodes. In my test file with many
math nodes, the performance improved from 720ms to 630ms.
2022-09-17 12:08:57 +02:00
1810b1e4c8 GL: Framebuffer: Add support for empty framebuffer (no attachments)
This allows to reduce the memory footprint of very large framebuffers if
there is no need for any attachment.
2022-09-17 10:17:47 +02:00
b37954d03c Cleanup: format 2022-09-17 15:12:56 +10:00
34a6952067 Cleanup: compiler warnings 2022-09-17 15:12:42 +10:00
d9930d5fd0 Cleanup: spelling, punctuation & repeated words in comments 2022-09-17 15:08:40 +10:00
5f6f2e106c Cleanup: Use dedicated function to offset VSE strip handles 2022-09-17 05:23:34 +02:00
d4a763d363 Fix T101098: Moving meta strip can change its length
Caused by clamping handle translation to strip bounds in functions
`SEQ_time_*_handle_frame_set()` to prevent strip ending in invalid
state. Issue happens when meta strip is moved so quickly, such that
immediate offset is greater than strip length.

Currently meta strip bounds are updated when any contained strip changes
its position, but this update always preserves meta strip position.
Transforming meta strip is not possible directly and all contained
strips are moved instead. Therefore this is 2-step process and fix needs
to be applied on update function and on translation function.

Inline offset handling without clamping in function
`SEQ_time_update_meta_strip_range()`.
Add new function `seq_time_translate_handles()` to move both handles at
once in `SEQ_transform_translate_sequence()`.
2022-09-17 04:21:56 +02:00
e108d67635 Sculpt: add .sculpt to allow_procedural_attribute_access
Also cleaned up a comment.
2022-09-16 13:05:04 -07:00
9c35a5a524 Sculpt: Improve performance when initializing face sets
Avoid conversion to `BMesh` for basic topology operations and data access.
Instead use a mesh map to retrieve the faces connected to each edge.
I observed performance improvements of 5x (600ms to 100ms) to 10x
(15s to 1s), with bigger changes for large meshes with more data layers
Switching to `std::queue` over Blender's `GSQueue` gave another
25% improvement.

Differential Revision: https://developer.blender.org/D15988
2022-09-16 14:31:30 -05:00
8fdaf2bddc Fix: Missing updates for multires sculpting
Caused by ee23f0f3fb, which removed the update tag when entering
sculpt mode, and by b5f7af31d6, which made these layers lazily
created, so they weren't always available at the start of a stroke. Now
update the evaluated mesh/multires CCG as necessary. Some updates
could potentially avoided when switching modes in the future, but for
now do it all the time.

Fixes T101116
Also fixes a crash when painting multires mask for the first time
2022-09-16 14:31:30 -05:00
02575bcbd0 Sculpt: New attribute API
New unified attribute API for sculpt code.

= Basic Design =

The sculpt attribute API can create temporary or permanent attributes (only supported in `PBVH_FACES` mode).  Attributes are created via `BKE_sculpt_attribute_ensure.`

Attributes can be explicit CustomData attributes or simple array-based pseudo-attributes (this is useful for PBVH_GRIDS and PBVH_BMESH).

== `SculptAttributePointers` ==

There is a structure in `SculptSession` for convenience attribute pointers, `ss->attrs`.  Standard attributes should assign these; the attribute API will automatically clear them when the associated attributes are released.  For example, the automasking code stores its factor attribute layer in `ss->attrs.automasking_factor`.

== Naming ==

Temporary attributes should use the SCULPT_ATTRIBUTE_NAME macro for naming, it takes an entry in `SculptAttributePointers` and builds a layer name.

== `SculptAttribute` ==

Attributes are referenced by a special `SculptAttribute` structure, which holds
all the info needed to look up elements of an attribute at run time.

All of these structures live in a preallocated flat array in `SculptSession`, `ss->temp_attributes`.  This is extremely important.  Since any change to the `CustomData` layout can in principle invalidate every extant `SculptAttribute`, having them all in one block of memory whose location doesn't change allows us to update them transparently.

This makes for much simpler code and eliminates bugs.  To see why this is tricky to get right, imagine we want to create three attributes in PBVH_BMESH mode and we provide our own `SculptAttribute` structs for the API to fill in.  Each new layer will invalidate the `CustomData` block offsets in the prior one, leading to memory corruption.

Reviewed by: Brecht Van Lommel
Differential Revision: https://developer.blender.org/D15496
Ref D15496
2022-09-16 12:20:28 -07:00
4cea4f4c5f Fix: Geometry nodes crash with undefined node
The new evaluator crashes for multi-input sockets coming from undefined
nodes. The multi-input socket lazy node tries to retrieve the default
value since the undefined node never created output values. But there
is no default value stored because the socket is linked.

Differential Revision: https://developer.blender.org/D15980
2022-09-16 12:54:46 -05:00
3d93525069 Cleanup: Remove unused member variable in lazy function graph 2022-09-16 12:53:18 -05:00
9ca1abe042 Fix T101100: missing smooth shading with linked subdivision surface in editmode
Smooth flag should come from the evaluated mesh, only selection and hidding
state should be mapped to the original bmesh.

Pre-existing issue revealed by refactor in b247588dc0.
2022-09-16 16:50:43 +02:00
4d67a995d9 Fix: crash when evaluating geometry nodes after deleting an unlinked node
This was essentially a use-after-free issue. When a geometry nodes
group changes it has to be preprocessed again before it can be evaluated.
This part was working, the issue was that parent node groups have to be
preprocessed as well, which was missing. The lazy-function graph cached
on the parent node group was still referencing data that was freed when
the child group changed.

Now the depsgraph makes sure that all relevant geometry node groups are
preprocessed again after a change.

This issue was found by Simon Thommes.
2022-09-16 16:03:50 +02:00
7042f4e4b2 Fix Linux bpy wheel failing to install due to wrong ABI flags 2022-09-16 15:53:37 +02:00
c8b9ede4b1 Sculpt: Move sculpt_face_set.c to C++ 2022-09-16 08:17:54 -05:00
Lukas Stockner
44aaa9893b Eevee: Add support for Nishita sky texture
Sun Disc is currently not supported because it'll need special handling - on the one hand, I'm not sure if Eevee would handle a 1e6 coming out of a background shader without issues, and on the other hand it won't actually cast sharp shadows anyways.
I guess we'd want to internally add a sun to the lamps if Sun Disc is enabled, but getting that right is tricky since the user could e.g. swap RGB channels in the node tree and the lamp wouldn't match that.
Anyways, that can be handled later, the sky itself is already a start.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13522
2022-09-16 15:10:09 +02:00
2eb19eeb19 Fix 101000: color picker colors drift above 1 for some OCIO configurations
Increase threshold to avoid float precision issues.
2022-09-16 15:00:39 +02:00
bf05b998b6 Revert "EEVEE: Fix volumetric resolve in large scenes."
This reverts commit 34051fcc12.
Although for normal use this doesn't make a difference. But when working with
huge scenes and volumetrics + NVIDIA it made a work-around not possible anymore.

For the heist production we added a fix on the render-farm (enable GPU workarounds).
{rB34051fcc12f388375697dcfc6da53e9909058fe1} made another work-around not
accessible anymore and it and was requested to revert this change.
2022-09-16 14:55:04 +02:00
Germano Cavalcante
4b326d5a78 Fix T101040: Blender Crashes When snap roll a bone in armature
The modes that don't support individual projection shouldn't support
FACE_NEAREST either.

Differential Revision: https://developer.blender.org/D15970
2022-09-16 09:05:33 -03:00
13c4af66fc Cleanup: format 2022-09-16 18:14:33 +10:00
95f05a6a4b Cleanup: spelling in comments 2022-09-16 18:14:33 +10:00
48d7ff68f0 Make File Select dialog update operator's file & path properties
When an operator is attached to a file select dialog, the update
callback function for the operator's directory, filename and filepath
properties will be called as the user navigates through the dialog.

This will allow add-on authors to make more interactive import
operators.

Differential Revision: https://developer.blender.org/D15543
2022-09-16 00:27:59 -07:00
8bf0714d50 make_source_archive: exclude hidden git files 2022-09-16 15:34:53 +10:00
ac76da2944 Revert "UI: Use full word for face set operator name, tweak description"
This reverts commit 15d85c54c3.
Included a separate change/new file by mistake. Sorry for the noise.
2022-09-15 23:06:04 -05:00
15d85c54c3 UI: Use full word for face set operator name, tweak description
"Init" shouldn't be used in the UI, and avoid repeating the operator
name in its description.
2022-09-15 23:04:55 -05:00
a231637fae Sculpt: Respect hiding when creating face sets from loose parts
Different areas of the mesh can be "loose parts" visually when separated
by hidden areas. This is consistent with other areas of sculpt mode that
also treat hidden areas differently.
2022-09-15 22:54:51 -05:00
72253f427d Docs: Update sphinx 2022-09-15 22:30:47 -04:00
d255c8e9f7 Cleanup: format 2022-09-16 11:53:40 +10:00
a8eeec7b35 Cleanup: typos in 427d669f62 2022-09-16 11:39:48 +10:00
427d669f62 make_bpy_wheel: various minor improvements
- Add doc-string with example usage shown in the --help message.
- Add help text for command line arguments.
- Only search for the CMakeCache.txt file when the `--build-dir`
  is omitted.
- Write fatal errors to the stderr.
2022-09-16 11:27:13 +10:00
8342564796 Cleanup: suppress type warnings for make_bpy_wheel & make_utils
'make check_mypy' now runs without warnings.
2022-09-16 10:52:20 +10:00
d5df23d758 Cleanup: Rename attribute required functions
Avoid "customdata" in the name, since that's an implementation detail
in this context.
2022-09-15 13:14:31 -05:00
0945ae338b Fix: Merging mesh and non-empty BMesh creates "flag" attributes
We need to use the custom data copy function that skips mesh-only
attributes like the hide status attributes, the generic material index
attribute, etc. Otherwise the BMesh has those attributes which
conflict with their builtin counterparts.
2022-09-15 12:52:18 -05:00
8b26349d57 BLO: move blenloader to C++
Differential Revision: https://developer.blender.org/D15965
2022-09-15 19:13:13 +02:00
Brecht Van Lommel
9f76d0c8e6 Python: script for packing bpy module as wheel
The buildbot will call this script to create a binary .whl file that can be
easily installed through pip.

This wheel will only work with the same Python version used for Blender.
Other minimum system requirements are the same as regular Blender builds.

Includes contributions by Campbell Barton.

Differential Revision: https://developer.blender.org/D15957
2022-09-15 18:27:03 +02:00
f70fac6382 Python: fix failing bpy build with full release config on Windows
* Fix issue with different build and install paths.
* Fix issue with oneAPI kernel build.

Ref D15957
2022-09-15 18:27:02 +02:00
5228b0b74f Python: fix failing tests when building bpy module
* Use Python executable from lib folder since it's not installed.
* Make bpy module test work for portable install.
* Disable gtests which don't work with different Python link flags
  and shared library locations.

Ref D15957
2022-09-15 18:27:01 +02:00
335a6c0c87 Cleanup: move Blender version parsing to make_utils.py
Ref D15957
2022-09-15 18:27:00 +02:00
5b216aae8b Fix T101065: wrong denoising depth after ray precision improvements 2022-09-15 16:04:24 +02:00
fbc74c9d93 Fix warning-as-errors in older GCC's, take 2.
rBf4e6616b835e did not work for `some reason`, this one has been
verified with gcc 10!
2022-09-15 15:58:21 +02:00
f4e6616b83 Fix warning-as-errors in older GCC's.
Recent compilers (at least gcc 11 and 12) do not report any issue, but
gcc 10 does.
2022-09-15 15:46:47 +02:00
c41249d436 PointCloud: add BKE_pointcloud_nomain_to_pointcloud
This adds a utility function to copy the data from a PointCloud
outside of the main database to one that is in the database. This
is similar to `BKE_mesh_nomain_to_mesh`.

Ref D11592
2022-09-15 15:21:25 +02:00
Damien Picard
a869fcd686 I18n: disambiguate and extract a few messages
Disambiguate:
- Lower / Upper (case)
- Spray (ocean modifier)
- Keep Original (clip, grease pencil, object)
- Screen [space] (inside some enum items, mostly)
- Cast Shadow ("shadow that is cast", not "to cast a shadow")

Extract:
- Line Art Light Reference Near and Far
- Mesh vertex attribute domain: Vertex

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15938
2022-09-15 11:38:45 +02:00
903709c4eb GPencil: Add frame number to Trace operator
The default trace can only trace an image or a sequence, but
it was not possible to trace only selected frames in a sequence. 
This new parameter allows to define what frame trace.

If the value is 0, the trace is done as before.

The parameter is not exposed in the UI because this is logic
if it is managed by a python API, but it has no sense in the UI.

This feature was included after receiving feedback from Studios
which need to trace videos only for some frames using custom
python scripts.
2022-09-15 11:19:30 +02:00
Nate Rupsis
2310daed3a NLA: draw track bg based on strip's extrapolation type
In the NLA, draw the track background based on the strip's extrapolation
setting. Previously, this had no visual indicator; "Hold", "Hold
Forward", and "Nothing"  were visually indistinguishable. Now "Nothing"
actually shows nothing, "Hold Forward" shows a dimly colored background
from the strip to its right, and "Hold" shows that in both directions.

Reviewed By: RiggingDojo, sybren

Maniphest Tasks: T97572

Differential Revision: https://developer.blender.org/D14836
2022-09-15 10:47:02 +02:00
3eae1bfe35 Cleanup: quiet sign-conversion warning in OFFSETOF_STRUCT_AFTER
BLI_strict_flags.h raised a build error when this macro was used.
2022-09-15 18:02:53 +10:00
5c4295ee6f Workaround for msvc compiler bug
This is the same issue as in rB2e8089b6bf50.
2022-09-15 09:34:20 +02:00
5d69958442 Correct over allocation in 0e172e9732 2022-09-15 17:10:39 +10:00
718d545ff8 Cleanup: minor improvement to boundary check
Use a byte flag instead of counting polys using edges
(technically a fix for edges with USHRT_MAX+2 users).
2022-09-15 16:57:14 +10:00
0e172e9732 Fix T95649: Corrective Smooth can cause vertices to jump
Calculate a tangent per loop, apply the transformation in multiple
spaces and accumulate the result weighting by the loop-angle.

Note that previously only the tangents Z axis (normal)
was properly accumulated, the X and Y axes only contained the values
from a single loop (the last one written to), meaning only two edges
contributed to the result. Now the transformation from all loops are
taken into account.

In practice the difference between both methods is minimal,
only for more extreme bending it can be noticed which is often when the
previous method didn't work as well.
2022-09-15 16:17:17 +10:00
2c53970bbf Cleanup: use doxy sections, remove outdated comment 2022-09-15 15:27:21 +10:00
27e17fed28 PyDoc: hide overly long titles from the side-bar
The side-bar included both title and description for documentation
pages including quickstart, tips & tricks .. etc.

Titles often wrapped and took up a lot of vertical space in the side-bar.

Now these pages are linked on the main page, with the side-bar
used for top-level Python modules.
2022-09-15 14:34:23 +10:00
4bbb043bc5 Cleanup: spelling in comments, comment blocks 2022-09-15 10:03:46 +10:00
5cd08e373b CMake: exclude '.github' from addons in the install target
This file is only used for the github mirror
and doesn't need to be installed.
2022-09-15 09:48:32 +10:00
f404dd0b3c Fix Unreported: VSE and NLA handle position text is not drawn
When moving strip, or it's handle, text with frame number near handle
should be drawn. This feature was broken by 8d53ead69b, because
function `UI_view2d_text_cache_add` sets all fields of `v2s->rect` to 0.
This case was checked in function `UI_view2d_text_cache_draw`, but it
was not quite obvious.

This commit reverts 8d53ead69b, makes condition for 0 size rectangle
more obvious and adds comment for clarity.

function `UI_view2d_text_cache_add` is only used in NLA and VSE, and
this new condition fits existing use-cases. Status of T97500 is not
affected by this change.
2022-09-15 01:12:16 +02:00
b5115ed80f UV: rename "Pixel Snap Mode" to "Pixel Round Mode"
Maniphest Tasks: T78391

Differential Revision: https://developer.blender.org/D15952
2022-09-15 10:36:13 +12:00
530f203e27 Fix: Build error after previous cleanup commit
The prototype didn't match the definition anymore.
2022-09-14 15:12:15 -05:00
42fe0b6dfc Attributes: add color_srgb property to FloatColorAttributeValue and ByteColorAttributeValue
This patch adds color_srgb property to FloatColorAttributeValue and
ByteColorAttributeValue, so Python code can do
`layer.data.foreach_get("color_srgb", ...)` to fetch the data
efficiently, if it needs it in sRGB color space.

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D15966
2022-09-14 22:51:00 +03:00
6d4d74172b Cleanup: Remove unused argument from modifier data mask callback
This isn't likely to be helpful in the future with the move to generic
attributes
2022-09-14 14:49:40 -05:00
e22198b8d1 Cleanup: Make format 2022-09-14 14:45:36 -05:00
ee23f0f3fb Sculpt: Separate hide status from face sets, use generic attribute
Whether faces are hidden and face sets are orthogonal concepts, but
currently sculpt mode stores them together in the face set array.
This means that if anything is hidden, there must be face sets,
and if there are face sets, we have to keep track of what is hidden.
In other words, it adds a bunch of redundant work and state tracking.

On the user level it's nice that face sets and hiding are consistent,
but we don't need to store them together to accomplish that.

This commit uses the `".hide_poly"` attribute from rB2480b55f216c to
read and change hiding in sculpt mode. Face sets don't need to be
negative anymore, and a bunch of "face set <-> hide status" conversion
can be removed. Plus some other benefits:
 - We don't need to allocate either array quite as much.
 - The hide status can be read from 1/4 the memory as face sets.
 - Updates when entering or exiting sculpt mode can be removed.
 - More opportunities for early-outs when nothing is hidden.
 - Separating concerns makes sculpt code more obvious.
 - It will be easier to convert face sets into a generic int attribute.

 Differential Revision: https://developer.blender.org/D15950
2022-09-14 14:37:18 -05:00
Monique Dewanchand
68589a31eb ViewLayer: Lazy sync of scene data.
When a change happens which invalidates view layers the syncing will be postponed until the first usage.
This will improve importing or adding many objects in a single operation/script.

`BKE_view_layer_need_resync_tag` is used to tag the view layer to be out of sync. Before accessing
`BKE_view_layer_active_base_get`, `BKE_view_layer_active_object_get`, `BKE_view_layer_active_collection`
or `BKE_view_layer_object_bases` the caller should call `BKE_view_layer_synced_ensure`.

Having two functions ensures that partial syncing could be added as smaller patches in the future. Tagging a
view layer out of sync could be replaced with a partial sync. Eventually the number of full resyncs could be
reduced. After all tagging has been replaced with partial syncs the ensure_sync could be phased out.

This patch has been added to discuss the details and consequences of the current approach. For clarity
the call to BKE_view_layer_ensure_sync is placed close to the getters.
In the future this could be placed in more strategical places to reduce the number of calls or improve
performance. Finding those strategical places isn't that clear. When multiple operations are grouped
in a single script you might want to always check for resync.

Some areas found that can be improved. This list isn't complete.
These areas aren't addressed by this patch as these changes would be hard to detect to the reviewer.
The idea is to add changes to these areas as a separate patch. It might be that the initial commit would reduce
performance compared to master, but will be fixed by the additional patches.

**Object duplication**
During object duplication the syncing is temporarily disabled. With this patch this isn't useful as when disabled
the view_layer is accessed to locate bases. This can be improved by first locating the source bases, then duplicate
and sync and locate the new bases. Will be solved in a separate patch for clarity reasons ({D15886}).

**Object add**
`BKE_object_add` not only adds a new object, but also selects and activates the new base. This requires the
view_layer to be resynced. Some callers reverse the selection and activation (See `get_new_constraint_target`).
We should make the selection and activation optional. This would make it possible to add multiple objects
without having to resync per object.

**Postpone Activate Base**
Setting the basact is done in many locations. They follow a rule as after an action find the base and set
the basact. Finding the base could require a resync. The idea is to store in the view_layer the object which
base will be set in the basact during the next sync, reducing the times resyncing needs to happen.

Reviewed By: mont29

Maniphest Tasks: T73411

Differential Revision: https://developer.blender.org/D15885
2022-09-14 21:34:38 +02:00
Monique Dewanchand
23276bcc37 Adding const Scene* parameter in many areas.
Related to {D15885} that requires scene parameter
to be added in many places. To speed up the review process
the adding of the scene parameter was added in a separate
patch.

Reviewed By: mont29

Maniphest Tasks: T73411

Differential Revision: https://developer.blender.org/D15930
2022-09-14 21:30:56 +02:00
1a48548980 BLF: Incorrect Define Used
Replace incorrect usage of GLYPH_ASCII_TABLE_SIZE with correct
KERNING_CACHE_TABLE_SIZE

See D15815 for more details.

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

Own Code.
2022-09-14 09:57:54 -07:00
5f4db28c24 Fix T100899: Drag and Drop failing depending on window position
Regression introduced in rBbbf87c4f7509, which now relies on OS coordinates for Drag and Drop.

These coordinates did not match on different OSs.
2022-09-14 13:54:51 -03:00
818c9e524d Fix: Mesh SoA format conversion skips versioning
Converting to the SoA format (T95965) immediately when reading meshes
means that none of the changes from versioning would be applied first.
This means important fixes like f14995aba7 aren't properly applied,
so modifications could be done to invalid CustomData. To fix this, move
the SoA changes into versioning code, in a new versioning_400.cc file.

Differential Revision: https://developer.blender.org/D15919
2022-09-14 11:33:35 -05:00
460fe4a10c Curves: Improve sculpting performance by reducing allocations
The snake hook and grow/shrink brushes need some arrays for input
to the length paramterization code. These were allocated and freed
for every curve. Instead, use a local buffer for each task execution.

Differential Revision: https://developer.blender.org/D15964
2022-09-14 11:18:20 -05:00
390320a151 Mesh: Fix quadratic cost for accessing normals with RNA
Same as eb3a561a7f, but for the mesh normal arrays
introduced in b7fe27314b.
2022-09-14 11:12:27 -05:00
eb3a561a7f Curves/PointCloud: Avoid quadratic cost for retrieving positions
A "lookup_int" callback needs to be provided for RNA collections
that aren't backed by DNA directly. Otherwise they will iterate from
the start of the array for every access.
2022-09-14 10:55:18 -05:00
21ed3b3258 Fix T101025: Cycles motion blur crash with changing point cloud size
Caused by 410a6efb74 which didn't properly use the
smallest size between the Cycles and Blender point clouds.
2022-09-14 09:51:27 -05:00
643e94c032 Cleanup: Add missing licence headers
Missed in eaf416693d
2022-09-14 08:54:04 -05:00
56fb2a5ed0 Cleanup: use proper bool variables in Main, instead of char. 2022-09-14 15:48:49 +02:00
Myron Carey
22bf5ba4d1 Fix T49814: Collada Import Ignores Vertex Normals
We now import and apply custom normals using a similar strategy
to the STL importer. We store custom normal data for each loop
as we read each MPoly and then apply it to the mesh after
`BKE_mesh_calc_edges()` is called.

The new behavior is optional and may be disabled in the Collada import
UI. When disabled, we use the old behavior of only using normals
to determine whether or not to smooth shade an MPoly.

----

Patch as requested in {T49814}.

The Collada import UI now has an additional checkbox, similar to the glTF and FBX import UIs:

{F13428264}

Here is a test Collada file with a simple test cube with flipped custom normals:

{F13428260}

{F13428282}

And a sphere where the two halves are disconnected geometry, but has custom normals that make the halves appear to be connected:

{F13436363}

{F13436368}

I've tested it on a number of my own meshes, and the custom normals appear to be imported
correctly. I'm not too sure about how I've plumbed the option down, though, or whether this
is the most proper way to apply custom normals.

Reviewed By: gaiaclary

Differential Revision: https://developer.blender.org/D15804
2022-09-14 15:26:11 +02:00
Joseph Micheli
8aca0da952 Fix T100684: Correct descriptions in Python API
The descriptions for view_layer_eval and scene_eval incorrectly duplicate the descriptions for view_layer and scene:

  - https://docs.blender.org/api/current/bpy.types.Depsgraph.html?highlight=depsgraph#bpy.types.Depsgraph.view_layer_eval
  - https://docs.blender.org/api/current/bpy.types.Depsgraph.html?highlight=depsgraph#bpy.types.Depsgraph.scene_eval

This patch fixes this by changing "Original" to "Evaluated."

Reviewed By: jbakker

Maniphest Tasks: T100684

Differential Revision: https://developer.blender.org/D15931
2022-09-14 15:20:53 +02:00
Germano Cavalcante
4e4daa6417 Fix T100959: Memory leak when moving node with Alt
The memory leak happens because `ED_node_link_insert` (called after the
transform operation) overwrites the pre-existing `snode->runtime->iofsd`,
losing the reference without freeing the memory.

So to "move" the reference from `snode->runtime->iofsd` to
`op->customdata`, so that each operator works with its own data.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D15948
2022-09-14 09:13:12 -03:00
10a3bfa5ee Cleanup: quiet warnings 2022-09-14 12:07:40 +02:00
a9250cb1f1 Cleanup: remove unused fields + add override 2022-09-14 12:02:27 +02:00
e4b925b9e2 Added missing license headers. 2022-09-14 11:49:48 +02:00
38a77c1400 Fix T100977: Wrong native Ukrainian language name in UI. 2022-09-14 11:37:59 +02:00
Erik Abrahamsson
609171d8b7 Optimization: Exit early when resizing material slots.
When assigning a huge number of materials, like when importing thousands of
objects, the function `BKE_objects_materials_test_all` uses quite a lot of
resources because of the way it loops through all objects to resize the
mat-array.

By counting the amount of processed objects and comparing to the number
of users of the obdata ID, we can exit early and avoid looping through
all objects every time.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15740
2022-09-14 11:00:37 +02:00
39c341bf4a Cleanup: remove redundant braces from assert & raise
autopep8 v1.7 added a space after assert & raise,
remove the braces as they aren't needed.
2022-09-14 16:18:59 +10:00
260b75a952 PyDoc: add an "Advanced" section to document WITH_PYTHON_MODULE
Document the use cases, usage and limitations
of using Blender as a Python module.
2022-09-14 15:17:51 +10:00
d26220d97a Fix reports printing twice when called from Python in background-mode
Calling operators in background-mode always printed with the
assumption that output should never be hidden.
However operators called from `bpy.ops` were also printing reports to
the `stdout` (needed for the Python console and generally useful).

Resolve by adding a flag to signal that the owner of the ReportList
is responsible for printing to the `stdout`.
2022-09-14 14:06:44 +10:00
7bd60d40ef CMake: warn when "bpy" installs into the site-packages from LIBDIR
Using "../lib" as a target is unlikely to be useful,
add a warning & suggest alternatives.
2022-09-14 14:06:41 +10:00
f74fa63b5a Cleanup: skip argument freeing when built as a Python module 2022-09-14 14:06:39 +10:00
Charlie Jolly
e1a9c16176 UI: Add Mix Node to color section of add node menu
This adds back the new mix node to the Color sections
of the add node menu.

The add menu now contains two entries for the mix node.

One under Utilites/Converter which defaults for float.

One under Color which defaults to color with `Mix Color` label.

This was moved as part of D13749.

The issue was reported on BlenderArtists.

Differential Revision: https://developer.blender.org/D15887
2022-09-13 23:06:40 +01:00
7518d30f2a Fix T100771: Incorrect strip length when timecodes are used
Some files have 2 different framerates stored in metadata. Use function
`av_guess_frame_rate` to get media FPS, because it provides more
consistent / correct values across multiple files.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D15839
2022-09-13 20:29:12 +02:00
3302b7e6a3 Fix T100998: Speed effect not rendering scene strip subframes
After change in 19bff8eb51, subframe must be calculated for function
`RE_RenderFrame` in order to render subframes.
2022-09-13 20:25:50 +02:00
08a8de739d Fix: Resolve deprecation warning when copying polygon struct
`MPoly` is used and copied in many places. To avoid the need to use a
special function for copying MPoly, or the need to add a copy
constructor, just rename the `mat_nr` field to include "legacy" in the
name. This keeps the original purpose of notifying developers that
the field shouldn't be used without any further complexity.
Apply the same fix to `bweight`.

Differential Revision: https://developer.blender.org/D15841
2022-09-13 11:43:34 -05:00
Mattias Fredriksson
eaf416693d Geometry Nodes: Port the trim curve node to the new data-block
The trim functionality is implemented in the geometry module, and
generalized a bit to be potentially useful for bisecting in the future.
The implementation is based on a helper type called `IndexRangeCyclic`
which allows iteration over all control points between two points on a
curve.

Catmull Rom curves are now supported-- trimmed without resampling first.
However, maintaining the exact shape is not possible. NURBS splines are
still converted to polylines using the evaluated curve concept.

Performance is equivalent or faster then a 3.1 build with regards to
node timings. Compared to 3.3 and 3.2, it's easy to observe test cases
where the node is at least 3 or 4 times faster.

Differential Revision: https://developer.blender.org/D14481
2022-09-13 11:36:14 -05:00
d88811aed3 Fix T100980: Missing deg update when duplicating a geometry nodetree in node editor.
Tagging depsgraph for relation rebuild does not replace tagging IDs for update.
2022-09-13 16:42:34 +02:00
109cc14dba Revert hidden object optimization in depsgraph
The internal state tracking is not fully suited for such kind
of optimization yet.

It is probably not that much work to make them work, but the
issue caused by the changes is serious enough for the studio
so it feels better to revert changes for now and have a closer
look into remaining issues without pressure.
2022-09-13 16:05:16 +02:00
8442b0ffc1 Fix T101027: Sculpt tools don't respect visibility after recent commit
Caused by b5f7af31d6, which exposed the fact that the PBVH wasn't
retrieving the updated hide status attributes if they were allocated in
sculpt mode. Previously the attributes were always allocated when
entering sculpt mode.
2022-09-13 08:35:58 -05:00
Nate Rupsis
b6ebd5591c NLA: Remove Edited Action tab from NLA panel
Removes the "Edited Action" tab for selected Action strips in the NLA
editor. It is still available in the Action editor, where it is actually
suitable/usable. Having it in the NLA got in the way of the actual NLA
strip properties.

Reviewed By: sybren, RiggingDojo

Differential Revision: https://developer.blender.org/D14964
2022-09-13 15:09:06 +02:00
34051fcc12 EEVEE: Fix volumetric resolve in large scenes.
On NVIDIA volumetric resolve failed for large production scenes.
The result would remove most color from the final render. The cause
seems to be a faulty driver.

This change ported the fragment shader to a compute shader which
would select a different compiler branch and didn't show the error.
2022-09-13 15:05:17 +02:00
Wayde Moss
b404548972 Fix: set ipo/easing in dope ignores hidden channels
Animators were not able to set channel interpolation or easing type for
channels visible in the dopesheet but hidden in the graph editor.

Bug seemed to be due to typo.
No official report, but there was a RCS on this
https://blender.community/c/rightclickselect/yWgbbc/

Reviewed By: sybren, RiggingDojo

Differential Revision: https://developer.blender.org/D10228
2022-09-13 15:03:24 +02:00
92a92fdca5 Fix T101031: Crash with Initialize Face Sets operator 2022-09-13 07:48:41 -05:00
a99a62231e obj: implement support for PBR .mtl extensions
Implement import & export support for "PBR extensions" in .mtl files
(T101029, also fixes T86736).

Newly supported parameters:
- Roughness (Pr, map_Pr)
- Metallic (Pm, map_Pm)
- Sheen (Ps, map_Ps)
- Clearcoat thickness (Pc) and roughness (Pcr)
- Anisotropy (aniso) and rotation (anisor)
- Transmittance (Tf / Kt)

Exporter has an option to enable these additional PBR parameters
export; defaults to off since not all software understands that.

Exporter UI tweaked and all material-related options were put into
their own separate box.

Added/extended test files in Subversion repository for test coverage.
2022-09-13 15:01:29 +03:00
3839a4dd84 Fix broken Cycles Metal build after recent changes
It was unable to find the Metal framework, thanks to Alaska for tracking
this down.
2022-09-13 13:52:14 +02:00
62cee24003 Fix: crash when changing to viewer context in spreadsheet 2022-09-13 13:14:29 +02:00
3c2c296130 Fix compilation error on Windows after recent change 2022-09-13 11:52:11 +02:00
Jeroen Bakker
8068b89a68 EEVEE-Next: Cryptomatte render passes.
This change adds cryptomatte render passes to EEVEE-Next. Due to the upcoming viewport
compositor we also improved cryptomatte so it will be real-time. This also allows viewing
the cryptomatte passes in the viewport directly.

{F13482749}

A surface shader would store any active cryptomatte layer to a texture. Object hash is stored
as R, Asset hash as G and Material hash as B. Hashes are only calculated when the cryptomatte
layer is active to reduce any unneeded work.

During film accumulation the hashes are separated and stored in a texture array that matches
the cryptomatte standard. For the real-time use case sorting is skipped. For final rendering
the samples are sorted and normalized.

NOTE: Eventually we should also do sample normalization in the viewport in order to extract the correct
mask when using the viewport compositor.

Reviewed By: fclem

Maniphest Tasks: T99390

Differential Revision: https://developer.blender.org/D15753
2022-09-13 11:07:38 +02:00
bb3a021427 Fix T101004: Crash when invisible object becomes visible
A regression since ac20970bc2

The issue was caused by depsgraph clearing all id->recalc flags
wrongly assuming that all IDs are fully evaluated.

This change makes it so the depsgraph becomes aware of possibly
incompletely evaluated IDs.

Differential Revision: https://developer.blender.org/D15946
2022-09-13 11:00:37 +02:00
a45c36efae Cycles: Make OSL implementation independent from SVM
Cleans up the file structure to be more similar to that of the SVM
and also makes it possible to build kernels with OSL support, but
without having to include SVM support.

This patch was split from D15902.

Differential Revision: https://developer.blender.org/D15949
2022-09-13 10:59:28 +02:00
8e03df9bbc Fix oneAPI compilation on modern Linux and CentOS 7 libraries 2022-09-13 10:55:36 +02:00
602cca671e Cycles: Include reason the oneAPI library could not be loaded
Additionally, just stick to a pure error stating. Such messages
are aimed for developers and it is rather implied that oneAPI
rendering will be disabled.
2022-09-13 10:52:18 +02:00
cca416cfe6 Fix compilation on Linux, glibc 2.34, and CentOS libraries
A continuation of previous fix for malloc hooks which got removed
from the new glibc library.

The pre-compiled jemalloc has definitions which interpose hooks
in glibc leading to linking errors with multiple hook definitions.

A simple fix is to skip doing the workaround when using jemalloc
from pre-compiled libraries.

This will likely be revisited in the future, but for now it is
important to fix compilation errors for developers.
2022-09-13 10:38:42 +02:00
146e67b2bd CMake: exclude BLI_args when building as a Python module 2022-09-13 18:03:29 +10:00
d92e14af1f Cleanup: typo in variable name 2022-09-13 18:03:09 +10:00
f78219c9a8 Cleanup: spelling in comments 2022-09-13 18:03:09 +10:00
4130f1e674 Geometry Nodes: new evaluation system
This refactors the geometry nodes evaluation system. No changes for the
user are expected. At a high level the goals are:
* Support using geometry nodes outside of the geometry nodes modifier.
* Support using the evaluator infrastructure for other purposes like field evaluation.
* Support more nodes, especially when many of them are disabled behind switch nodes.
* Support doing preprocessing on node groups.

For more details see T98492.

There are fairly detailed comments in the code, but here is a high level overview
for how it works now:
* There is a new "lazy-function" system. It is similar in spirit to the multi-function
  system but with different goals. Instead of optimizing throughput for highly
  parallelizable work, this system is designed to compute only the data that is actually
  necessary. What data is necessary can be determined dynamically during evaluation.
  Many lazy-functions can be composed in a graph to form a new lazy-function, which can
  again be used in a graph etc.
* Each geometry node group is converted into a lazy-function graph prior to evaluation.
  To evaluate geometry nodes, one then just has to evaluate that graph. Node groups are
  no longer inlined into their parents.

Next steps for the evaluation system is to reduce the use of threads in some situations
to avoid overhead. Many small node groups don't benefit from multi-threading at all.
This is much easier to do now because not everything has to be inlined in one huge
node tree anymore.

Differential Revision: https://developer.blender.org/D15914
2022-09-13 08:44:32 +02:00
4d69b6f525 Cleanup: use u-prefixed integer types (for brevity) 2022-09-13 16:29:06 +10:00
75f9b691e2 Docs: improve explanation for why CLG_exit shouldn't be called early 2022-09-13 16:01:39 +10:00
5ffa829a0e Cleanup: improve titles for CMake sections, line length
Also use same convention for comments as (space after #).
2022-09-13 13:50:21 +10:00
060da0858b CMake: omit WITH_INSTALL_PORTABLE from bpy_module.cmake
Since this was added, Linux libraries have been included in `../lib/`.
This made `make bpy` on Linux install the `bpy` module into the bundled
SVN libraries which isn't very useful.

Now leave WITH_INSTALL_PORTABLE unset (defaulting to ON).
Python developers may reference their systems Python and disable the
option if they wish for a system-wide module installation.
2022-09-13 13:30:06 +10:00
41212c1d44 CMake: omit WITH_INSTALL_PORTABLE from the 'lite' configuration
As portable is already the default, setting it meant using the lite
configuration would always reset the value if was intentionally changed.

This was also inconsistent as other configurations left this unset.
2022-09-13 13:30:06 +10:00
9189260880 Python: update defaults for "make bpy"
This was a kind of "lite" target, disabling options such as FFMPEG and
ALEMBIC which may be useful to read/write data from the Python module.

Now fewer options have been changed.
The following options are now disabled:

- Audio support (to prevent audio devices being initialized on startup).
- Input device support such as NDOF and IME as there is no GUI.
- Blender thumbnail extraction as it's not installed as part of
  the Python module.

Instead of attempting to predict what is useful to enable when building
as a Python module, developers can mix combine options e.g.
"make bpy release" or "make bpy lite".
2022-09-13 13:28:22 +10:00
03885fe120 Makefile: support 'make bpy lite' / 'make bpy release'
Re-order configuration loading so 'bpy' is loaded after others.
Needed as `bpy` disables options other configurations enable.
2022-09-13 13:28:22 +10:00
90fb212a93 Docs: improve BKE_object_defgroup_flip_map doc-string 2022-09-13 13:24:45 +10:00
1a08a26388 Cleanup: spelling in comments 2022-09-13 13:24:44 +10:00
c05ff54795 Cleanup: remove unused function 2022-09-13 13:24:42 +10:00
400151833d Nodes: Avoid unnecessary sorting when selecting or moving nodes
Previously the nodes were sorted wven when there was no change.
This is a fixed version of e3ef6a6660, which was reverted by
dc937c5aee.
2022-09-12 21:47:01 -05:00
50913d719c Cleanup: Use attribute API for curves functions 2022-09-12 21:47:01 -05:00
ddfce277e0 NLA: actionclip_add now fails on invoke if no NLA track is selected
This makes the NLA_OT_actionclip_add operation (Shift+A while mousing
over the NLA strips area) fail on invocation if no tracks are active.

This stops the annoyance of using the Shift+A menu to select an action
to add, but only getting the error after you select an action.

Differential Revision: https://developer.blender.org/D15737
2022-09-12 18:11:00 -07:00
b3e9ef1924 Fix building WITH_GHOST_WAYLAND, WITH_OPENXR (without X11)
The pre-processor blocks contained un-balanced braces, causing a syntax
error when building with WAYLAND but not X11.

Use the same number of opening & closing braces in each pre-processor
block so changes aren't as likely to break other platforms.

Also assert when unexpected states are reached.
2022-09-13 10:41:36 +10:00
ebcf004ecf Cleanup: quiet missing-variable-declarations warning 2022-09-13 10:41:36 +10:00
2c73175100 Cleanup: missing declaration warning 2022-09-13 10:41:36 +10:00
28c9b33870 IMBUF: Fix WebP Build Error and Warnings
Fix error and warnings introduced in commit 8851790dd7. Include
unistd.h for close() on Non-Windows OSs. Calm warnings about unused
argument. Return full size of image file to caller.

Own Code.
2022-09-12 17:28:19 -07:00
c8b6062d6c Update RNA to User manual mappings 2022-09-12 19:09:32 -04:00
8851790dd7 IMBUF: Improved Thumbnailing of WebP Images
Thumbnail WebP images quicker while using much less RAM.

See D15908 for more details.

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

Reviewed by Brecht Van Lommel
2022-09-12 15:42:51 -07:00
ad245f1970 Fix T101013: Reordering materials broken with only one assigned
When there was only a single material assigned to the mesh, the material
index attribute didn't necessarily exist. Changing the oder of the slots
wouldn't change the first material index as necessary.
2022-09-12 17:17:11 -05:00
ea474dda62 Fix: Node edge pan and remove on cancel doesn't work
Caused by 4a71765f9a which used an operator that didn't have the
properties it expected.
2022-09-12 16:43:54 -05:00
5bad311f4c Fix: Multires crash after recent face set refactor
Missing null check when retrieving face sets for multires automasking.
Caused by b5f7af31d6.
2022-09-12 16:12:18 -05:00
752a9b743e USD IO: fixed compiler warnings 2022-09-12 15:47:45 -04:00
bc15c83afa Fix T100886: error saving side-by-side stereo EXR image of depth pass
The stereo saving code that combines two image buffers into one did not work
correctly when the number of channels is not equal to 4.
2022-09-12 20:21:13 +02:00
100fe61f7c Sculpt: Fix T100941: Draw cache invalidation loop
PBVH draw was invalidating the draw cache even
when disabled (e.g. if modifiers exist).
2022-09-12 11:10:07 -07:00
8af59cdb16 Cleanup: obj: rename MTLMaterial & MTLTexMapType members
The members were named after .mtl file syntax ("d") instead of their
meaning ("alpha"). In preparation for extending OBJ code for more
PBR parameters support, rename them for clarity. No functionality
changes, just a pure rename.
2022-09-12 21:05:57 +03:00
8f6a07bc75 Cleanup: Comment formatting
Also include a small cleanup to the previous commit missed from review.
2022-09-12 12:54:44 -05:00
2c1650ae8f Sculpt: Fix T100608: SCULPT_UNDO_FACE_SETS broken for redo
Always swap values when restoring sculpt undo data.
2022-09-12 10:51:53 -07:00
b5f7af31d6 When these features aren't used, there is no sense in storing the
corresponding data layers and using their values for computations.
Avoiding that should increase performance in many operations that
would otherwise have to read, write, or propagate these values.
It also means decreased memory usage-- not just for sculpt mode
but for any mesh that was in sculpt mode. Previously the mask, face set,
and hide status layers were *always* allocated by sculpt mode.

Here are a few basic tests when masking and face sets are not used:

| Test | Before | After |
| Subsurf Modifier | 148 ms | 126 ms |
| Sculpt Overlay Extraction | 24 ms every redraw | 0 ms |
| Memory usage | 252 MB | 236 MB |

I wouldn't expect any difference when they are used though.

The code changes are mostly just making sculpt features safe for when
the layers aren't stored, and some changes to the conversion to and
from the hide layers. Use of the ".hide_poly" attribute replaces testing
whether face sets are negative in many places.

Differential Revision: https://developer.blender.org/D15937
2022-09-12 12:48:42 -05:00
3d3c34f345 Sculpt: Fix T101008: Missing CD_MDISPS layer
sculpt_update_object now auto-creates a CD_MDISPS layer
if missing.  Note that it is possible for the depsgraph
to provide a multires ccg context without a CD_MDISPS.
This causes a PBVH_GRIDS pbvh to be built instead of
falling back to PBVH_FACES, which is why this bug happens
(of course falling back to PBVH_FACES would still be a bug).
2022-09-12 10:33:47 -07:00
9951464571 Fix T100956: Cycles GPU context assert after recent changes
We don't need to be on the main thread to destroy the context.
2022-09-12 19:00:07 +02:00
54571003dc Fix T100016: Memory leak in USD importer.
These changes were implemented by Sonny Campbell.

Fixed the first issue by freeing the operator customdata when the import
is cancelled.

Fixed the second issue by using a character array instead of allocating
new memory for the prim_path_mask.

Differential Revision: https://developer.blender.org/D15781
2022-09-12 12:46:27 -04:00
9088a1f476 Geometry: Avoid unnecessary initialization when resizing data arrays
When resizing mesh and curves attribute storage, avoid initializing the
new memory for basic types. Also, avoid skipping "no free" layers; all
layers should be reallocated to the new size since they may be accessed.

The semantics introduced in 25237d2625 are essential for this
change, because otherwise we don't have a way to construct non-trivial
types in the new memory.

In a basic test of the extrude node, I observed a performance
improvement of about 30%, from 55ms to 42ms.

Differential Revision: https://developer.blender.org/D15818
2022-09-12 11:35:33 -05:00
225b5a3491 BLI: Add utility functions to generic spans
Generally we don't want to do per-element operations on these spans
because of the overhead of the runtime type system, but these operations
on the whole span avoid ugly pointer arithmetic in other areas.
2022-09-12 11:04:52 -05:00
e37f3388b1 Attributes: Add function to retrieve span without adding attribute
Previously, the only versions of attribute access that gave a span would
also add the attribute when it doesn't exist, which isn't always wanted.
2022-09-12 11:04:52 -05:00
ce07bc3628 Merge remote-tracking branch 'origin/blender-v3.3-release' 2022-09-12 17:13:25 +02:00
Thibault de Villèle
7c33d7b4b5 Fix T100918: change min value for NLAStrip start
The bug was contained in BKE/intern/nla.c, where the wrong macro was
used as the minimum frame value. Instead of `MINAFRAMEF`, `MINFRAMEF`
was used (the former is around -10k, the latter is 0, both fp32).

Differential Revision: https://developer.blender.org/D15940
2022-09-12 17:08:06 +02:00
038a19ce6c Fix macOS incomplete Python install after recent changes
After 2c23b4e0bf the meaning of PYTHON_LIBPATH changed.
2022-09-12 15:48:09 +02:00
16af35054d GLibC Compat: Add deprecated memory hooks symbols removed from 2.34.
Starting from GLibC 2.34, deprecated `__malloc_hook` & co. have been
removed from headers, while still present in the shared library itself.

This means that it is no more possible to build Blender with USD 22.03
on recent linux systems.

While USD 22.08 has a fix to this issue, it is unlikely to be upgraded
for Blender 3.4, and definitely not for Blender 3.3.

This commit ensures Blender can build with USD 22.03 and glibc >= 2.34.

Ref.: T99618,
https://devtalk.blender.org/t/building-blender-on-linux-using-glibc-2-34-raises-linking-errors-from-the-usd-library/24185

Patch by @brecht, many thanks.
2022-09-12 15:23:42 +02:00
ec2e866aee UI: Cleanup/Fixes of some UI messages. 2022-09-12 14:18:17 +02:00
2d069b609b Fix T100999: GPencil Copy paste stroke(s) does not respect autokeying
The operator was not checking the status of the 
Autokey button.
2022-09-12 12:13:07 +02:00
33abb68cf2 UI: add a Custom Properties panel to the View Layer tab of properties.
Although view layers aren't ID, they do support custom properties,
so not providing the UI to access them seems to be a simple oversight.
2022-09-12 10:31:53 +03:00
6d0f8d5a19 Fix T100851: Sync markers does not work for numinput
special_aftertrans_update would always use TransInfo values (not
the values_final -- we need the final values to follow numinput, snapping,
etc).

Maniphest Tasks: T100851

Differential Revision: https://developer.blender.org/D15893
2022-09-12 09:11:29 +02:00
ebc385de5f Cleanup: Remove unused DerivedMesh functions 2022-09-11 21:42:41 -05:00
94e211ced9 Fix T100874: improve uv unwrap of degenerate geometry
Provide reasonable defaults for UV unwrap for triangles with zero area:

* Three vertices are arranged in a line.
* Two vertices are at the same 3D location.
* All three vertices are at the same 3D location.

Change fixes quads / ngons which have triangulations with zero area.

Change fixes both "Angle Based" method and "Conformal" method.

Differential Revision: https://developer.blender.org/D15922
2022-09-12 14:23:22 +12:00
c9a8380426 Cleanup: remove unused ImBuf.next/prev pointers 2022-09-12 11:20:22 +10:00
f884a34cae Cleanup: replace BLI_snprintf with BLI_path_join
Also use a larger buffer to account for the unlikely case of the
buffer not being big enough for the appended directories.
2022-09-12 11:02:25 +10:00
cf9c0a4b50 Tests: add tests for leading (relative) slashes for BLI_path_join
Also note that leading slashes are kept in the doc-string.
2022-09-12 11:02:25 +10:00
caf6225a3d UV: support uv seams when computing uv islands
An edge can be marked BM_ELEM_SEAM, which means the UV co-ordinates
on either side of the edge are actually independent, even if they
happen to currently have the same value.

This commit optionally add support for UV Seams when computing islands.

Affects UV sculpt tools, individual origins, UV stitch and changing
UV selection modes etc.

Required for upcoming packing refactor which requires seam support
when computing islands.

Differential Revision: https://developer.blender.org/D15875
2022-09-12 12:27:14 +12:00
1f4dc51d09 Fix T100974: Remesh operators reset mesh properties
Caused by 21f2bacad9 which copies a few more values to
the original meshes from the "nomain" meshes. The "nomain" meshes
created from the originals need to copy some values as well.
2022-09-10 18:06:54 -05:00
8b612c6496 GPencil: Add new Set Start Point operator to context menu 2022-09-10 16:12:18 +02:00
98c4e1e590 GPencil: New Set Start point operator
This operator allows to set the start point for any cyclic stroke.

This is very handy to fit interpolation issues or
use thickness modifier.

Note: There is small change in this commit to fix
a typo error in the name of the operator.

Reviewed By: mendio, frogstomp

Maniphest Tasks: T100827

Differential Revision: https://developer.blender.org/D15881
2022-09-10 15:43:20 +02:00
2c23b4e0bf Python: on macOS, stop requiring framework for building bpy module
Build against Python from precompiled libraries by default, instead of
requiring framework from python.org package install. The resulting bpy module
can still be used with any Python install of the same version.

Use the same CMake find module as Linux. This simplifies code, and makes it
possible to manually set PYTHON_* variables in CMake configuration.

Remove WITH_PYTHON_FRAMEWORK option for regular Blender build, as this doesn't
work well due to missing required Python packages. Advanced users can still
set PYTHON_ROOT_DIR=/Library/Frameworks/Python.framework/Versions/3.10 for
the same result.
2022-09-10 13:47:48 +02:00
325eee2261 Cleanup: cycles OSL compiler warnings 2022-09-10 13:47:48 +02:00
8cb3b49e51 Cleanup: replace strncpy with BLI_strncpy
Also replace strncpy+strcat with BLI_string_join
2022-09-10 16:54:21 +10:00
489cb7fd7e Cleanup: remove unnecessary strcat use 2022-09-10 16:19:23 +10:00
c90fbbf75a WM: update comment for wm_autosave_location auto-save fallback 2022-09-10 16:19:23 +10:00
66fab6828c BKE_appdir: add function attributes 2022-09-10 15:50:49 +10:00
c34b4d35ab Fix possible NULL pointer dereference in bookmark operators
Although unlikely, the result of BKE_appdir_folder_id_create may be NULL.
Check this for bookmark operators & move writing bookmarks into a shared
utility function.
2022-09-10 15:38:51 +10:00
9877d9e145 Cleanup: remove redundant NULL checks
Checking if a property exists only makes sense for generic callbacks
that apply to multiple operators.
2022-09-10 14:54:02 +10:00
5a0447ca88 Cleanup: spelling in comments 2022-09-10 14:19:34 +10:00
eae081f8fd Cleanup: format, spelling 2022-09-10 14:17:32 +10:00
ef3c49de81 Cleanup: early return when directories can't be found
Also reduce variable scope and assert when an invalid argument
is passed to BKE_appdir_folder_id_create.
2022-09-10 14:13:07 +10:00
099ae99589 Fix: Missed return in ASSET_OT_bundle_install item enumerator
Discovered from inspection.

Differential Revision: https://developer.blender.org/D15699
2022-09-09 20:12:47 -07:00
352d55b1c8 Mesh: Avoid saving redundant generic material index attribute
This attribute is still read and written in the legacy format which
puts it inside of `MPoly`. Missed in f1c0249f34.
2022-09-09 17:58:13 -05:00
7966fb083e PyGPU: expose 'GPU_SHADER_3D_IMAGE_COLOR'
This shader is required by some addons that need to modulate the alpha of images.
2022-09-09 18:31:08 -03:00
ded4604d71 install_deps: update OpenVDB for Blender 3.4.
This has been a pain, newer OpenVDB forcefully trying to use more recent
system TBB (oneTBB) instead of the one built by this script.

Also include a few minor unrelated fixes.

Ref T99618.
2022-09-09 21:38:56 +02:00
1e1e9014cf install_deps: update OIIO/Boost/Python/NumPy versions.
OIIO: 2.3.18.0
Boost: 1.80.0
Python:3.10.6
NumPy: 1.23.2

Ref T99618.
2022-09-09 18:01:45 +02:00
8611c37f97 Cycles: Generate OSL closures using macros and a template file
This has the advantage of being able to use information about the
existing OSL closures in various places without code duplication. In
addition, the setup code for all closures was moved to standalone
functions to avoid usage of virtual function calls in preparation for GPU
support.

This patch was split from D15902.

Differential Revision: https://developer.blender.org/D15917
2022-09-09 15:47:37 +02:00
ef7c9e793e Cycles: Remove separate OSL attribute map and instead always use SVM attribute map
The SVM attribute map is always generated and uses a simple
linear search to lookup by an opaque ID, so can reuse that for OSL
as well and simply use the attribute name hash as ID instead of
generating a unique value separately. This works for both object
and geometry attributes since the SVM attribute map already
stores both. Simplifies code somewhat and reduces memory
usage slightly.

This patch was split from D15902.

Differential Revision: https://developer.blender.org/D15918
2022-09-09 15:35:44 +02:00
291c313f80 Mesh: Move bevel weight out of MVert and MEdge
As described in T95966, the goal is to move to a "struct of arrays"
approach rather than gathering an arbitrary set of data in hard-coded
structs. This has performance benefits, but also code complexity
benefits (this patch removes plenty of code, though the boilerplate
for the new operators outweighs that here).

To mirror the internal change, the options for storing mesh bevel
weights are converted into operators that add or remove the layer,
like for some other layers.

The most complex change is to the solidify modifier, where bevel
weights had special handling. Other than that, most changes are
removing clearing of the weights, boilerplate for the add/remove
operators, and removing the manual transfer of bevel weights
in bmesh - mesh conversion.

Eventually bevel weights can become a fully generic attribute,
but for now this patch aims to avoid most functional changes.

Bevel weights are still written and read from the mesh in the old way,
so neither forward nor backward compatibility are affected. As described
in T95965, writing in the old format will be done until 4.0.

Differential Revision: https://developer.blender.org/D14077
2022-09-09 08:29:47 -05:00
21f2bacad9 Cleanup: Simplify BKE_mesh_nomain_to_mesh
- Remove "take ownership" argument which was confusing and always true
  - The argument made ownership very confusing
  - Better to avoid boolean arguments that switch a function's purpose
- Remove "mask" argument which was basically wrong and not used properly
  - "EVERYTHING" was used because developers are wary of removing data
  - Instead use `CD_MASK_MESH` for its purpose of original mesh data
- Remove use of shallow copied temporary mesh, which is unnecessary now
- Split shape key processing into separate functions and use C++ types
- Copy fields explicitly rather than using memcpy for the whole struct
- Use higher level functions and avoid redundant code
  - The whole idea is pretty simple and can be built from standard logic
- Adjust `CustomData` logic to be consistent with "assign" expectations
  - Clear the layer data from the source, and moves the anonymous ID

Differential Revision: https://developer.blender.org/D15857
2022-09-09 08:29:46 -05:00
12c235a1c5 Subdiv: Avoid quadratic runtime for loose edges
Currently, when subdividing every single vertex on every loose edge,
Blender iterates over all other edges to find neighbors. This has
quadratic runtime and can be very slow. Instead, first create a
map of edges connected to each vertex.

With about 10000 edges, the performance goes from very slow to very
smooth in my tests. Because of the nature of quadratic runtime, the
improvement will depend massively on the number of elements.

The only downside to this is that the map will still be built when
there are only a couple loose edges, but that case is probably not
so common.

Differential Revision: https://developer.blender.org/D15923
2022-09-09 08:29:46 -05:00
cef1b9c30f Cleanup: remove BLI_make_file_string
This function did multiple things making it difficult to know
what was intended by the caller:

- Directory & file join.
- Expand relative '//' prefix to an optional directory.
- Expand drive letters on windows (guessing with fall-backs).
- Switch slashes to native direction.

This functionality wasn't needed as the full directory was always passed
in, so guessing the drive letter wasn't needed.

If functionality to add drive letters onto paths is needed in the future
a function that only does this can be added.
2022-09-09 23:21:00 +10:00
436f1b4dbe Correct error building on WIN32
Mistake in f7a4ede79f.
2022-09-09 23:21:00 +10:00
6039d15732 Fix Clang warning about braces around initialization 2022-09-09 15:03:36 +02:00
05f821b094 Cleanup: remove unnecessary use of BLI_make_file_string
Use BLI_join_dirfile instead, also reduce right-shift.
2022-09-09 22:43:34 +10:00
8f8ae06b51 Fix use-after-free error when exiting on WIN32
The logging API was freed before calling wm_autosave_delete that called
BKE_appdir_folder_id_create to get the auto-save location (when the
temporary directory wasn't found). Detecting BLENDER_USER_AUTOSAVE would
log details about the path, which would read data freed by CLG_exit.
Resolve by calling CLG_exit last.
2022-09-09 22:43:34 +10:00
f4e5a86544 Realtime Compositor: Implement bokeh blur node
This patch implements the bokeh blur node for the realtime compositor.
The patch is still missing the Variable Size option because it depends
on the Levels node, which is yet to be implemented. In particular, it
requires the computation of global texture properties like the maximum
color.

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

Reviewed By: Clement Foucault
2022-09-09 14:32:58 +02:00
03f33a6f23 Realtime Compositor: Allow inputs to skip realization
This patch adds support for the skip realization option of the input
descriptor. Inputs that request skip realization will not be realized on
the operation domain of the operation and will not contribute to its
computation, and consequently, they can't be a domain input.

An example is the bokeh input of the Bokeh Blur node, which is actually
a resource that is decoupled from the rest of the inputs and should not
affect or be affected by their domain.

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

Reviewed By: Clement Foucault
2022-09-09 14:22:03 +02:00
0fd39da3a9 Realtime Compositor: Implement scale node
This patch implements the Scale node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-09-09 14:11:43 +02:00
e254d8867d Outliner: Hide library overrdies context menu when no IDs are selected
The library overrides context menu operators only make sense when at
least one ID is selected in the Outliner. So don't show them unless
that's the case. This also means the menu items don't show up anymore
for things like RNA properties, or the overridden properties in the
Library Overrides Properties view.

Also see 7eda9d8dda and the previous commit.
2022-09-09 14:04:27 +02:00
860c3dce1b Outliner: Don't show asset context menu when no IDs are selected
The asset context menu operators only make sense when at least one ID is
selected in the Outliner. So don't show them unless that's the case.
This also means the menu items don't show up anymore for things like RNA
properties, or the overridden properties in the Library Overrides
Properties view.

Also see 7eda9d8dda.
2022-09-09 14:04:27 +02:00
04ae0fe46b Realtime Compositor: Implement blur node
This patch implements the blur node for the realtime compositor. The patch is
still missing the Variable Size option because it depends on the Erode/Dilate
node, which is yet to be implemented. Furthermore, there are a number of
optimizations that can be implemented, the most important of which is the IIR
implementation of the Fast Gaussian filter, as well as the use of hardware
filtering and thread local memory. The latter of which was attempted but was
not robust enough, so it will be submitted as separate patch.

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

Reviewed By: Clement Foucault
2022-09-09 13:58:54 +02:00
1339fec22a Nodes: fix memory leak 2022-09-09 13:35:21 +02:00
f15fecf0f7 Readfile: avoid confusion when debugging a memory leak 2022-09-09 13:16:28 +02:00
ac66a819c1 Realtime Compositor: Implement pixelate node
This patch implements the pixelate node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-09-09 13:15:01 +02:00
77a4bb02cc Fix T100697: Curve nodes change colors at identity settings
Shader and compositor curve nodes change their inputs even if they are
at identity settings.

That is because shader and compositor curve nodes evaluate their curve
map texture samplers at the normalized input directly, disregarding the
fact that the samplers are evaluated using linear interpolation. This
causes the output to be slightly different that it should be.

This patch remaps the evaluation parameters such that the texture
sampler is evaluated at the center of the pixels.

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

Reviewed By: Clement Foucault
2022-09-09 13:03:53 +02:00
fa0f18b37d Cleanup: readfile: use correct type 2022-09-09 12:37:02 +02:00
0817966f14 Cleanup: Remove unused attribute in draw manager.
There are no plans to use the object attribute anymore.
2022-09-09 12:24:51 +02:00
dc937c5aee Fix Auto-offset for nodes: Revert "Cleanup: Return early"
This "cleanup" commit broke Auto-offset for nodes.

This reverts commit e3ef6a6660.
2022-09-09 11:51:07 +02:00
58945b07f1 Cleanup: remove paranoid NULL checks 2022-09-09 17:46:43 +10:00
Loren Osborn
3baca31719 Fix error extracting arguments from project_source_info
Output of make encounters path names that are single-quoted. This
causes the path to be misinterpreted and fail validation.

Resolves error in "make check_cppcheck"

Ref D15801 (partially applied)
2022-09-09 17:18:11 +10:00
1e6a003860 Cleanup: move return arguments last, use r_ prefix
Also use '_num' suffix instead of '_tot'.
2022-09-09 16:20:32 +10:00
87a45db522 Edit mode normalize fails to respect locked groups
Add BKE_object_defgroup_flip_map_unlocked which excludes locked groups
from the flip-map.

Reviewed By: zanqdo, campbellbarton

Maniphest Tasks: T96787

Ref D15317
2022-09-09 16:03:02 +10:00
Nate Rupsis
43b1624eee Fix T96787: Edit mode normalize fails to respect locked groups
Add BKE_object_defgroup_flip_map_unlocked which excludes locked groups
from the flip-map.

Reviewed By: zanqdo, campbellbarton

Ref D15317
2022-09-09 15:58:49 +10:00
fb07bbb751 License headers: use SPDX identifiers 2022-09-09 15:44:03 +10:00
274dc024f6 Cleanup: format, trailing space 2022-09-09 15:38:27 +10:00
0c9749093b Cleanup: spelling in comments 2022-09-09 15:37:33 +10:00
f7a4ede79f Python: change bpy.app.binary_path behavior WITH_PYTHON_MODULE
The following changes have been made to this attribute with
WITH_PYTHON_MODULE is defined:

- Defaults to an empty string (instead of pointing to __init__.so).
- It's writable, so script authors can point to a valid Blender binary.

`where_am_i(..)` is no longer used by BKE_appdir_program_path_init,
there is now a separate code-path for setting the initial program
directory, calls after this can be used to set the binary path.
2022-09-09 14:01:41 +10:00
d455f1a0ba Cleanup: quiet conversion warning 2022-09-09 12:17:59 +10:00
ce5ad66330 GNUmakefile: change message to reference "bpy" when building as a module 2022-09-09 12:17:09 +10:00
3a01c23a84 Cleanup: cmake line length, wrapping 2022-09-09 11:52:14 +10:00
9e0c2f6867 CMake: exclude Python libs & batch scripts WITH_PYTHON_MODULE for WIN32 2022-09-09 11:33:43 +10:00
22b84424c7 Cleanup: check for Python module in BKE_appdir_program_path_init
Replace the argument with an in ifdef in BKE_appdir_program_path_init.
At the time `blenkernel` didn't define WITH_PYTHON_MODULE, since it does
now there is no need for an argument. With the minor benefit of fewer
preprocessor checks in the main() function.
2022-09-09 11:13:05 +10:00
fad7a30de3 Cleanup: comments, spelling, line length for creator's CMake file 2022-09-09 11:10:37 +10:00
81558783e4 Python: install "bpy" as a package WITH_PYTHON_MODULE
Building WITH_PYTHON_MODULE was creating a "bpy" module that required
Blenders data-files to be located in the module search path too.

This mean that a typical installation on Linux would create:

- `/usr/lib/python3.10/site-packages/bpy.so`
- `/usr/lib/python3.10/site-packages/3.4`
  (containing `scripts` & `datafiles`).

The new behavior creates:

- `/usr/lib/python3.10/site-packages/bpy/__init__.so`
- `/usr/lib/python3.10/site-packages/bpy/3.4`

With the advantage that the "bpy" directory is the self contained Python
module.

No changes are needed for the module loading logic as the mechanism to
swap in blend internal Python "bpy" module
(defined in `release/scripts/modules/bpy/__init__.py`)
works the same in both instances.

Thanks to Brecht for macOS support.

Reviewed by brecht

Ref D15911
2022-09-09 10:25:35 +10:00
Dominik Fill
4a71765f9a Fix T100521: Nodes added with link drag search not added to frame
Use macro NODE_OT_translate_attach for attaching node created through
link-drag-search to frame, as suggested by Leon Schittek (@lone_noel)
in D15888.

Differential Revision: https://developer.blender.org/D15920
2022-09-08 17:03:54 -05:00
ff8cd48418 Fix T100833: Cycles UDIM baking broken after recent changes 2022-09-08 20:24:32 +02:00
06a5741f42 Silence warnings/assert about invalid embedded IDs for older blendfiles.
there is no point in warning about files that are not supposed to be
'correct' in that regard.
2022-09-08 18:49:10 +02:00
e5a7470638 Fix: link drag search feature only works forgeometry nodes groups
The node tree used to detect if the tree was a node group wasn't the
last in the node editor's path like it should be, so the search thought
that all shader node groups weren't node groups.
2022-09-08 10:57:21 -05:00
ff7bba8dad Fix: Integer type in linear probing strategy
Probing strategies must iterate over every possible hash, but the linear
strategy only did 2^32 iterations, not 2^64. Updating this was missed
in 8cbbdedaf4. Also fix an unnecessary comma.

Differential Revision: https://developer.blender.org/D15913
2022-09-08 09:52:42 -05:00
17f37b43f1 Cleanup: Remove unused face customdata for merging meshes 2022-09-08 09:50:59 -05:00
b9727dae82 Cleanup: Remove redundant vertex duplication in extrude node
Now this is done by `Mesh::verts_for_write()`
2022-09-08 09:50:59 -05:00
59f6c60fb6 Cleanup: Remove unused variable in RNA path function
Caused by 462014b59b
2022-09-08 16:44:24 +02:00
7eda9d8dda Outliner: Hide "data operations" context menu entries unless supported
The context menu would always show a section with "Select", "Deselect",
"Hide", "Unhide" and "Select Linked" if there were no more specific
operators to show (e.g. modifier operations). For many tree elements
they did not make sense and simply would do nothing. Only show the
section for supported types.
2022-09-08 16:36:00 +02:00
8f6a38ed7e Cleanup: Simplify outliner context menu building queries
- Remove unnecessary calls to `get_element_operation_type()` (result
  wasn't used).
- Remove branches/checks for cases that couldn't possibly happen.
  (assert instead).
- Ensure all return arguments are set so caller can't make the mistake
  of forgetting that.
- Early exit instead of big `if` block.
- Use `const`.
2022-09-08 16:36:00 +02:00
406243c2fd IDManagement: change IDTypeInfo.owner_get to instead return address of the owner_id pointer.
Also rename the callback. That way, we can keep moving toward a more
generic handling of those embedded IDs (think e.g. about copy code).
2022-09-08 16:34:31 +02:00
462014b59b IDManagement: Add new BKE_id_owner_get accessor.
Essentially calls `IDTypeInfo->owner_get` for now, will make more sense
once the callback is changed to return the address of the pointer
instead.
2022-09-08 16:34:31 +02:00
4ac69c26db Fix Cycles wrong MIS logic in shade_light kernel after recent changes
Though end result was still correct. Thanks to Alaska for spotting this.
2022-09-08 15:23:21 +02:00
173d8edb0b Cleanup: make meaning of base visibility flags more clear
Rename, add comments, and use flag in the depsgraph to ensure the logic
matches.

Differential Revision: https://developer.blender.org/D15883
2022-09-08 15:23:21 +02:00
b5fc8f611e Outliner: Hide ID type filter for library overrides
a) There were two filter icons next to each other in the header which
isn't exactly professional, b) the filter was redundant since IDs are
now grouped under an ID type element ("Objects", "Collection", ...)
anyway.
In the hierarchies view it was already hidden (because the whole point
of it is to show relationships between IDs, you wouldn't want to have
any parts of the hierarchy hidden).
2022-09-08 14:19:59 +02:00
2a769e76a0 Outliner: Hide search options for library overrides hierarchies view
Searching isn't possible in the hierarchies view anymore, so the options
for it shouldn't be displayed either.
Followup to 21b92a5f31, forgot to remove these.
2022-09-08 14:10:58 +02:00
21b92a5f31 Outliner: Hide search button for library overrides hierarchies view
c9a9967903 added a workaround for performance issues in heavy
production scenes in the library overrides hierarchies view, reducing
the amounts of elements to be built. Searching for elements would still
have to build the entire tree, so Blender would essentially freeze when
searching in mentioned heavy scenes. Removing the search functionality
works around this issue for now.
2022-09-08 12:54:49 +02:00
d481fb10ef Nodes: fix handling cyclic node trees 2022-09-08 12:54:00 +02:00
5e2d139ee3 Fix Blender as a Python module for WIN32
BKE_appdir_program_path_init would override the module path extracted
from the Python module, replacing it with the Python executable.

This caused the data files not to be found and the module not to load.
2022-09-08 20:32:57 +10:00
82fc52ffc8 Console: Support page up/down and home keys for scrolling
- Page up/down scrolls up/down an entire page
- Home resets the scrolling back to the bottom.

The fact that these were missing was probably an oversight. Other
similar editors have them.

This works by including the "View2D Buttons List" keymap for the
console, which the other similar editors use as well.
2022-09-08 12:27:42 +02:00
129993c026 Fix T100887: Some C++ importers/exporters (e.g. OBJ) reset file dialog Sort By mode
A couple years ago D8598 made it so that C++ operators generally
should use "default" sort mode, which remembers previously used sort
setting. Back then all the places that needed it got changed to use
this "default" one, but since then some more IO code landed, where
seemingly by accident it used "sort by file name":

- USD importer,
- Grease Pencil exporter,
- OBJ importer & exporter,
- STL importer.

Reviewed By: Julian Eisel
Differential Revision: https://developer.blender.org/D15906
2022-09-08 13:07:31 +03:00
268e1eff8a Fix T96297: obj: improve layout of UI fields and axis validation
Implement ideas from T96297:
- Fix "invalid axis settings" (both forward & up along the same
  direction) validation: now similar to the Python based code, when
  invalid axis is applied, the other axis is changed to not conflict.
- Make axis enums be expanded inside the row, similar to Collada UI.
- Move "selected only" near the top, similar to how it's in Collada,
  USD, FBX and glTF export UIs.
- Move animation export options to the bottom.
2022-09-08 11:43:47 +03:00
ecf3287533 Fix T100822: Merging objects does not assign materials correctly
Caused by {rBf1c0249f34c4}

This is what (I think) went wrong in the above commit:
- `join_mesh_single` was writing material indices to the custom data /
attribute of the source mesh
- the `polyofs` of each mesh that was joined was not taken into account

Now, instead of using the AttributeWriter on a particular mesh, use the
CustomData (`pdata`) - that is constantly changed during joining -
directly for writing.
Otherwise we end up writing into customdata that has not been "extended"
yet (even if we use the destination mesh).
Also note that even on the destination mesh, CustomData would be freed
anyways after all calls to `join_mesh_single` took place, to be replaced
with the mentioned `pdata` which should be the single customdata to
write to here.

When doing this (writing to `pdata`), we also need to take into account
the poly offset of each contributing mesh.

Maniphest Tasks: T100822

Differential Revision: https://developer.blender.org/D15878
2022-09-08 09:06:50 +02:00
a3ddcc6b4d Cleanup: correct PyModuleDef.m_slots reference
Changed in Python 3.5, match Python's internal name.
2022-09-08 15:32:33 +10:00
8a9d1f19ab Python: ensure the runtime version is compatible WITH_PYTHON_MODULE
When Blender is built as a Python module, exit early if the major
and minor versions don't match. Without this, the error message can
be cryptic/unhelpful.
2022-09-08 14:58:16 +10:00
9f50bd20eb Fix: Spreadsheet row filters unimplemented for boolean type
This was lost in 474adc6f88
2022-09-07 23:31:46 -05:00
d593497421 Cleanup: Use C++ methods to retrieve attribute accessors
Replace `mesh_attributes`, `mesh_attributes_for_write` and the point
cloud versions with methods on the `Mesh` and `PointCloud` types.
This makes them friendlier to use and improves readability.

Differential Revision: https://developer.blender.org/D15907
2022-09-07 21:41:39 -05:00
17bc292530 Cleanup: remove ED_types.h & ACTIVE, DESELECT definitions
- ACTIVE flag is no longer in use.

- DESELECT was used in some places as an alias for false,
  even though this could arguably help readability, in practice this
  was often passed with a selection flag leading to confusing calls
  such as `select_beztriple(bezt, DESELECT, SELECT, HIDDEN)`.
  Replace SELECT/DESELECT with true/false in these cases.

- Remove ED_types.h. Add a 'SELECT' definition to DNA_anim_types.h,
  for fcurve_test, we could use a shared DNA header, or remove use of
  the define entirely in favor of typed enums.
2022-09-08 12:08:20 +10:00
c2c369ebe6 Cleanup: prefer terms verts/polys over vertices/polygons
Follows existing naming for the most part, also use "num" as a suffix
in some instances (following our naming conventions).
2022-09-08 11:34:02 +10:00
c36c403cdb Cleanup: Removed handling of unused flag in TimeMarkers
This removes the defunct handling of the ACTIVE flag in
TimeMarker::flags. It's not possible for that flag to be set though
normal operation.

Differential Revision: https://developer.blender.org/D15828
2022-09-07 18:13:05 -07:00
0a32f6b76a Fix T100863, T100875: Vertex group reading broken for recent files
This patch consists of two related fixes. The first is a simple fix for
forward compatibility, setting the Mesh.dvert pointer when writing a
file allows old Blender versions to read vertex groups from newly saved
files.

The second part is a bit uglier and more complex. Normally mesh vertex
group data is read in mesh_blend_read_data, for backward compatibility
with very old files. However, after 05952aa94d the mesh.dvert
pointer was not set, so the data was not read. Reading vertex group
layers when reading custom data is enough to fix that issue. We need to
read the data from *both* places, but BKE_defvert_blend_read cannot run
twice without memory leaks, so first try reading from custom data, then
read the pointer if that fails.

Differential Revision: https://developer.blender.org/D15905
2022-09-07 14:33:29 -05:00
e53405bf15 UI: Small Adjustments to Event Icons
Minor adjustments to event icons required after recent font changes.

See D15582 for more details and examples.

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

Reviewed by Brecht Van Lommel
2022-09-07 08:06:29 -07:00
67dcdebb3a Fix T100669: OBJ exporter does not properly export image sequence texture names
When exporting OBJ/MTL animation, texture file paths of image
sequences were not adjusted to contain the correct frame number.
Fixes T100669.

Also, the OBJ exporter was wrongly writing to the same .mtl file
for each exported frame, which is a regression compared to the
legacy Python exporter.
2022-09-07 17:56:21 +03:00
715d185dcd DRW: update test 'draw_pass_all_commands'
It was incorrectly updated in rBc226c480079fc07e3784f673b1bac4a774fe7937
2022-09-07 08:51:05 -03:00
da0c3cdbc9 DRW: fix 'bind_texture' being called in place of 'bind_image'
Error pointed out by tests.
2022-09-07 08:51:05 -03:00
967664d1ee BLI: new C++ BitVector data structure
This adds a new `blender::BitVector` data structure that was requested
a couple of times. It also replaces usages of `BLI_bitmap` in C++ code.

See the comment in `BLI_bit_vector.hh` for more details about the
advantages and disadvantages of using a bit-vector and how the new
data structure compares to `std::vector<bool>` and `BLI_bitmap`.

Differential Revision: https://developer.blender.org/D14006
2022-09-07 13:15:34 +02:00
13a7516f43 Cleanup: factor out "set default filepath" into a ED_fileselect_ensure_default_filepath
Follow up to D15904, a bunch of places had exact same logic for
"is filepath set? if not, set some default one", so factor all that out
into a separate ED_fileselect_ensure_default_filepath function.
2022-09-07 13:27:27 +03:00
97bd04d665 Fix T100797: C++ exporters do not remember the path on subsequent exports
Most/all C++ based IO code had a pattern of doing using
RNA_struct_property_is_set to check whether a default path needs to
be set. However, it returns false for properties restored from
"previous operator settings" (property restoration code sets
IDP_FLAG_GHOST flag on them, which "is set" sees and goes
"nope, not set").

The fix here is to apply similar logic as 10 years ago in the
T32855 fix (rBdb250a4): use RNA_struct_property_is_set_ex instead.

Reviewed By: Campbell Barton
Differential Revision: https://developer.blender.org/D15904
2022-09-07 12:57:34 +03:00
788952705c IDManagement: Add some assert to ensure lib consistency in embedded IDs.
From re-checking related code, it seems that we already always ensure
consistency of the `lib` pointer between embedded IDs and their owners.

This commit only adds some asserts in ambedded ID read code to
double-check this.
2022-09-07 11:26:11 +02:00
46642507ae Geometry Nodes: improve printing geometry set for debugging 2022-09-07 10:43:46 +02:00
ab5d0d2df3 Cleanup: Remove some references to proxies in comments/log messages.
Note that there are still some references to proxies left, in some cases
it's unclear if the code related to the comment is even still relevant,
this goes beyond mere cleanup to address then.
2022-09-07 10:27:20 +02:00
17d8028181 Nodes: add owner_tree method to nodes 2022-09-07 10:24:51 +02:00
2b43173fa9 Fix T100862: only leading deform modifiers used in weight/vertex paint.
It turns out upon close inspection that the 'deform only' mesh
only includes leading deform modifiers, rather than all of them
like crazyspace evaluation. This reduces the effect of the change
in rB9823a8f72be8 to using the fully evaluated mesh (all modifiers)
when the whole stack resulted in no topology change.
2022-09-07 11:10:41 +03:00
ddfd2b7644 Cleanup: comment unused INPUTCHANGE event 2022-09-07 16:34:44 +10:00
b5837bc948 WM: don't clear modifiers when the window is de-activated
Leave the modifiers as they were so comparing with previous modifiers
on window re-activation isn't detected as a state change.
2022-09-07 16:18:06 +10:00
8c8c102980 Fix T40059: Switching windows ignores held modifier keys
Re-enable workaround (USE_WIN_ACTIVATE) which should no longer cause
problems as of [0].

[0]: 37d835f0bc
2022-09-07 16:07:47 +10:00
857639559c CMake: add missing headers 2022-09-07 15:14:50 +10:00
3f5505b4cb Cleanup: de-duplicate bounding box center calculation 2022-09-07 15:14:50 +10:00
adb746415f Cleanup: add sections, use float literals 2022-09-07 15:14:50 +10:00
bd2b50dfa8 Cleanup: sort cmake file lists 2022-09-07 15:14:50 +10:00
7c52f18f15 Cleanup: format 2022-09-07 15:14:49 +10:00
124655547c Cleanup: GHOST/Win32 drop
- Reduce variable scope.
- Use snake-case for variables.
- Remove unnecessary counter when building file-list.
- Remove break after return.
- Use early return.
- Add missing braces.
2022-09-07 15:14:49 +10:00
be038b844c Cleanup: Tweak naming for recently added mesh accessors
Use `verts` instead of `vertices` and `polys` instead of `polygons`
in the API added in 05952aa94d. This aligns better with
existing naming where the shorter names are much more common.
2022-09-07 00:06:31 -05:00
20daaeffce UV: add new operator, uvcalc_align_rotation
Adds a new operator to automatically rotate UV Islands into alignment.

Modes:
* Auto (All edges)
* Geometry (V direction will point in geometry direction) [1]
* Edge (Rotate until selected edge is in V direction)

Also adds uv_sync_selection support to UV Randomize Transform.

Resolves: T78399
Differential Revision: https://developer.blender.org/D15820

[1] Listed as "World" in Task description.
2022-09-07 16:26:32 +12:00
18d1ef46f2 Cleanup: rename internal types for GHOST/Wayland
- Use pascel-case type names, instead of snake-case with `_t` suffix.
- Use `GWL_` prefix (short for GhostWayLand), to distinguish these
  types from ghost (`GHOST_*`) and wayland (`wl_*`) types.
- Rename `input` to `seat` (following wayland's own terminology).
- Use `wl_` prefix for wayland native variables which have locally
  defined equivalents so `GWL_Output *output` isn't confused with
  `struct wl_output *wl_output`. As the locally defined types are used
  more often this is less verbose overall.
2022-09-07 14:04:01 +10:00
ef46f5399b GHOST/Wayland: correct logging ID 2022-09-07 13:07:13 +10:00
da3d1e9165 Cleanup: spelling in comments, correct doxy slashes, replace '/w' 2022-09-07 13:04:44 +10:00
a5d65200c2 Cleanup: unused argument warning 2022-09-07 13:04:44 +10:00
ffc0e4d410 Fix building with MSVC
Correct error from [0] which built with GCC.

[0]: b8d9864518
2022-09-07 13:04:44 +10:00
b8d9864518 Cleanup: remove unused Main argument to RNA_path functions
Note that lib_override functions have kept the unused argument,
but this may be removed too. It impacts many lib_override functions
so this can be handled separately.
2022-09-07 11:07:44 +10:00
9c4c9a889d Cleanup: use 'continue' in customdata for loop, reduce right shift 2022-09-07 09:02:59 +10:00
Lukas Stockner
6951e8890a Mikktspace: Optimized port to C++
This commit is a big overhaul to the Mikktspace module, which is used
to compute tangents. I'm not calling it a rewrite since it's the
result of a lot of iterations on the original code, but pretty much
everything is reworked somehow.

Overall goal was to a) make it faster and b) make it maintainable.

Notable changes:
- Since the callbacks for requesting geometry data were a big
  bottleneck before, I've ported it to C++ and made it header-only,
  templating on the data source. That way, the compiler generates code
  specific to the caller, which allows it to inline the data source and
  specialize for some cases (e.g. subd vs. non-subd in Cycles).
- The one input parameter, an optional angle threshold, was not used
  anywhere. Turns out that removing it allows for considerable
  algorithmic simplification, removing a lot of the complexity in the
  later stages. Therefore, I've just removed the option in the new code.
- The code computes several outputs, but only one (the tangent itself)
  is ever used in Blender. Therefore, I've removed the others to
  simplify the code. They could easily be brought back if needed, none
  of the algorithmic simplifications are conflicting with them.
- The original code had fallback paths for many steps in case temporary
  memory allocation fails, but that never actually gets used anyways
  since malloc() doesn't really ever return NULL in practise, so I
  removed them.
- In general, I've restructured A LOT of the code to make the
  algorithms clearer and make use of some C++ features (vectors,
  std::array, booleans, classes), though there's still some of cleanup
  that could be done.
- Parallelized duplicate detection, neighbor detection, triangle
  tangent computation, degenerate triangle handling and tangent space
  accumulation.
- Replaced several algorithms with faster equivalents: Duplicate
  detection uses a (concurrent) hash set now, neighbor detection uses
  Radixsort and splits vertices by index pairs etc.

As for results, the exact speedup depends on the scene of course, but
let's consider the file from T97378:
- Blender 3.1 (before D14675): 6.07sec
- Blender 3.2 (with D14675): 4.62sec
- rBf0a36599007d (last nightly build): 4.42sec
- With this commit: 0.90sec

This speedup will mostly be noticed at the start of Cycles renders and,
even more importantly, in Eevee when doing something that changes the
geometry (e.g. animating) on a model using normal maps.

Differential Revision: https://developer.blender.org/D15589
2022-09-07 00:35:44 +02:00
Lukas Stockner
6b6428fcbc Cleanup: Move (edit)mesh_tangent.c to C++
This changes the two tangent-related files in BKE to C++ in preparation for the C++ Mikktspace port in D15589.
For now, they still use the original Mikktspace.

Differential Revision: https://developer.blender.org/D15636
2022-09-07 00:24:42 +02:00
043f59cb3b Fix weight paint smoothing with vertex selection.
Broken in rB2480b55f216c3137 by incorrectly converting a boolean
expression. There is also another suspect expression nearby.
2022-09-06 23:02:55 +03:00
2636f6fdee Fix T100760: No color attribute initialization when created by brush
Caused by 25237d2625.
2022-09-06 14:46:14 -05:00
f94130c94b Fix T100854, T100856: Invalid shape keys when exiting edit mode
The `mvert` pointer was passed to `bm_to_mesh_shape` and was never
reset to the beginning of the vertex array. Use spans instead to
eliminate this error completely. This also has the benefit of letting
the CustomData system handle allocation of mesh layers.
2022-09-06 14:25:48 -05:00
ced56dbc53 Fix: Restore fix for empty attributes after recent commit
3484c6d4f1 removed parts of 6e5eb46d73 by mistake,
returning no attribute when attribute data wasn't found. However, we
want that attributes can exist even on empty geometry. This commit
restores the fix and tries to make it more explicit to avoid the same
mistake again.

Differential Revision: https://developer.blender.org/D15899
2022-09-06 13:23:41 -05:00
Sonny Campbell
394c0b5ae4 Fix T99141: Crash with edit mode and copy location constraint
The constraint attempted to access mesh normals on a mesh with
wrapper type ME_WRAPPER_TYPE_BMESH. This commit reverses the if
statements so that If there is an editmesh then we use that as the
source of truth - otherwise use the evaluated mesh.

Differential Revision: https://developer.blender.org/D15809
2022-09-06 13:09:01 -05:00
e3ef6a6660 Cleanup: Return early 2022-09-06 12:14:04 -05:00
545fb528d5 Cleanup: Avoid using runtime node flag, use topology cache
It's easier to keep track of state in these algorithms if it's stored in
a central place like a set. Plus, using flags requires clearing them
beforehand. For the selected linked operators, using the topology
cache means we don't have to iterate over all links.
2022-09-06 12:14:04 -05:00
1d24586a90 Cleanup: Move select all nodes code to operator
This more specific high level functionality isn't needed
elsewhere. Move it to the operator and clean it up a bit.
2022-09-06 12:14:03 -05:00
2d38768f89 Cleanup: Use more specific function for deselecting all nodes 2022-09-06 12:14:03 -05:00
ff17131109 Fix T100841: Creating a frame node with shortcut doesn't sort nodes
Before 58c650a44c, the nodes span was rebuilt on every redraw. Now
that it's only rebuilt as necessary, we need to tag it dirty when nodes
are reordered. Relying on the order of the nodes at all isn't ideal, but
it's fairly fundamental in many areas at the moment.
2022-09-06 12:14:03 -05:00
6830ba12a8 Cleanup: Remove unnecessary node sorting, rename variables
Changing node colors shouldn't change the output of `node_sort`.
2022-09-06 12:14:03 -05:00
6d08ba8a50 Fix T100824: Cycles GPU render broken on macOS 13 Beta and Apple silicon
The recent revert of Apple silicon inlining changes to avoid long compile times
worked on macOS 12, but in macOS 13 Beta it results in render errors. This may
be a compiler bug and perhaps get fixed in time, but try to be on the safe side
and ensure Blender 3.3.0 works regardless.

This brings part of the inlining back, which brings improved performance but
also longer compiler times again. Compile time is around 2min now, where the
previous full inlining was about 5-7min.

Patch by Michael Jones.

Differential Revision: https://developer.blender.org/D15897
2022-09-06 19:11:52 +02:00
da9e685e26 Fix T100823: Do Not Load Non-Scalable Fonts
Do not allow the loading of old-style non-scalable fonts.

See D15884 for more details.

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

Reviewed by Brecht Van Lommel
2022-09-06 09:48:41 -07:00
0c242ff72b Cleanup: IDManagement: Simplify owner_get calllback of IDTypeInfo.
Now that all embedded IDs have a loopback pointer to their owner, we do
need anymore extra parameters for this accessor.
2022-09-06 18:21:16 +02:00
e46687c3aa Address to some extent issues with invalid embedded IDs in existing files.
Many existing .blend files (including startup ones) seem to have invalid
embedded IDs (they are not properly tagged with `LIB_EMBEDDED_DATA`).

We cannot `do_version` this so just fix it on the fly when detecting the
issue. User then need to re-save these files.

We also need to update some release files (default factory startup is
OK, but e.g. the VSE template one is not).

Keeping the assert is important here, as such missing flag is a critical
data corruption that can potentially have many serious consequences
throughout the ID management code.
2022-09-06 18:01:53 +02:00
e047b2618a BLI: Add new blender::Pool container
A `blender::Pool` can construct and destruct elements without reordering. Freed items memory
will be reused by next allocations.

Elements are allocated in chunks to reduce memory fragmentation and avoid reallocation.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D15894
2022-09-06 17:51:25 +02:00
0759f671ce Fix T100824: Cycles GPU render broken on macOS 13 Beta and Apple silicon
The recent revert of Apple silicon inlining changes to avoid long compile times
worked on macOS 12, but in macOS 13 Beta it results in render errors. This may
be a compiler bug and perhaps get fixed in time, but try to be on the safe side
and ensure Blender 3.3.0 works regardless.

This brings part of the inlining back, which brings improved performance but
also longer compiler times again. Compile time is around 2min now, where the
previous full inlining was about 5-7min.

Patch by Michael Jones.

Differential Revision: https://developer.blender.org/D15897
2022-09-06 17:39:08 +02:00
3484c6d4f1 Cleanup: Remove unused update custom data pointers in attribute API
Unused after 05952aa94d, 410a6efb74, and e9f82d3dc7.
2022-09-06 09:43:32 -05:00
64b10c43c4 Blender 3.3 release version bump.
Branch is frozen now and in Bcon5.
2022-09-06 16:34:45 +02:00
e3afead9aa Fix (unreported) bad handling of embedded IDs on owner copying.
Completely forgot in rBcd49fee74114 to handle the owner ID copying case
(this code now also needs to re-assign to `owner_id` pointer of the
newly copied embedded IDs to their rightful owner).
2022-09-06 16:23:06 +02:00
6f80c60ce6 Fix T100850: Regression: Gpencil: crash on material color and other properties change.
rBcd49fee74114 forgot to add proper support for calls to `ntreeAddTree`
with a NULL Main (which should generate `NO_MAIN` ntrees).
2022-09-06 16:23:06 +02:00
3dd9ab341a IDManagement: better debug checks in owner_get callbacks.
Simplify and make more efficients checks in collection one (missed
these in yesterday's commit rBcd49fee74114), add some to ShapeKey's one.
2022-09-06 16:23:06 +02:00
987c3a3e22 Merge branch 'blender-v3.3-release' 2022-09-06 16:17:34 +02:00
Josh Whelchel
74477149dd Fix T100845: wrong Cycles OptiX runtime compilation include path
Causing OptiX kernel build errors on Arch Linux.

Differential Revision: https://developer.blender.org/D15891
2022-09-06 16:11:12 +02:00
d9ea72291f Fix T100842: Display Texture Paint UVs option in UV editor not working
In 8cf52e8226 we assumed that the UV IBO's are only needed in edit mode,
however the UV lines also need to work in texture paint mode. So prefer to
use bmesh when available to fix the original bug, but don't assume the face
is hidden when there is no bmesh.

Differential Revision: https://developer.blender.org/D15895
2022-09-06 16:08:30 +02:00
e1fbb4ce89 Merge branch 'blender-v3.3-release' 2022-09-06 15:39:12 +02:00
8b11ed392c Cycles: Fix crashes in oneAPI backend for scenes not fitting in dGPU memory
Differential Revision: https://developer.blender.org/D15889
2022-09-06 15:38:15 +02:00
c226c48007 Update DRW tests
And remove retest of `GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR`.
2022-09-06 08:43:40 -03:00
b23fceff7d GPU/DRW: Fix test
Regression introduced in rB755e728a9840
2022-09-06 13:20:54 +02:00
dd41dda80e Merge branch 'blender-v3.3-release' 2022-09-06 11:53:44 +02:00
25c8d72e20 Fix T100747: Cannot add "String" attribute to mesh
Caused by {rB31365c6b9e4c}.

The new API `CustomDataAttributeProvider` just did not support
`CD_MASK_PROP_STRING`.

While strings dont perform nicely in their current form, still add
support back for the API.

Adding Strings to the supported types seems to survive just
fine, see attached example file.

Maniphest Tasks: T100747

Differential Revision: https://developer.blender.org/D15851
2022-09-06 11:44:07 +02:00
397e5c5526 GL: Require a minimum of 8 ssbo slot per shader stage
Otherwise we disable this feature. This is because some driver
does not support any vertex storage buffers but still support
8 ssbo in fragment shader.
2022-09-06 11:12:38 +02:00
d7a67e245d DRW: remove consistent debug buffer bind
This avoids the overhead of debug drawing when not debugging
anything or even not using the new draw manager.
2022-09-06 11:12:38 +02:00
6602f30225 Cleanup: early exit when the active layer disallows procedural access
Once the active layer index is reached, there is no need to keep
searching. Return early instead.
2022-09-06 17:16:04 +10:00
3ebf6a7f38 Cleanup: Remove use of designated initializers in C++ code
Does not compile on Windows.
2022-09-06 18:31:01 +12:00
6c6a53fad3 Cleanup: spelling in comments, formatting, move comments into headers 2022-09-06 16:25:20 +10:00
077ba5ac38 ShaderBuilder: Fix compilation error due to recent changes.
Added CustomData_get_layer to stub.
2022-09-06 08:18:04 +02:00
Jason Fielder
32d19f7317 MacOS: Resolve purple rendering artifacts in EEVEE materials by increasing sampler limit.
Enables a feature flag during OpenGL device initialisation on macOS, which increases the available number of texture samplers available for use within shaders. Enabling this flag removes purple rendering artifacts present in certain EEVEE materials, when the existing limit of 16 is exceeded.

This feature flag is supported on Apple Silicon and AMD GPUs, for devices supporting macOS 11.0+. Device initialisation first tests whether GL device creation with the flag is supported, if not, we fall back to standard initialisation.

Other solutions would not be trivial or incur additional performance overhead or feature limitations. Other workarounds, such as texture atlas's, could already be created by artists.

{F13245498}

{F13245497}

Reviewed By: jbakker

Maniphest Tasks: T57759, T63935

Differential Revision: https://developer.blender.org/D15336
2022-09-06 08:08:07 +02:00
d9db79dbe5 Cleanup: Move uvedit_islands to c++
Differential Revision: https://developer.blender.org/D15870
2022-09-06 15:52:26 +12:00
f0a3659900 GPU: remove 'GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR'
The only difference between `GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR`
and `GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR` is that in the vertex
shader the 2D version uses `vec4(pos, 0.0, 1.0)` and the 3D version
uses `vec4(pos, 1.0)`.

But VBOs with 2D attributes work perfectly in shaders that use 3D
attributes. Components not specified are filled with components from
`vec4(0.0, 0.0, 0.0, 1.0)`.

So there is no real benefit to having two different shader versions.
2022-09-05 19:01:02 -03:00
755e728a98 GPU: remove 'GPU_SHADER_3D_IMAGE_MODULATE_ALPHA'
`GPU_SHADER_3D_IMAGE_MODULATE_ALPHA` can be seamlessly replaced by
`GPU_SHADER_3D_IMAGE_COLOR` with no real harm done.
2022-09-05 18:11:35 -03:00
1fcc673230 Cleanup: Remove unused function
This had a specific use case relating to the `CurveEval` type
which shouldn't be necessary anymore.
2022-09-05 15:48:47 -05:00
5763918651 GPU: convert 'GPU_SHADER_2D_IMAGE_COLOR' to 3D
3D shaders work in both 2D and 3D viewports.

This shader is a good candidate to be exposed in Python.
2022-09-05 17:34:10 -03:00
4536de98d1 GPU: remove 'GPU_SHADER_2D_SMOOTH_COLOR'
The only real difference between `GPU_SHADER_2D_SMOOTH_COLOR` and
`GPU_SHADER_3D_SMOOTH_COLOR` is that in the vertex shader the 2D
version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses
`vec4(pos, 1.0)`.

But VBOs with 2D attributes work perfectly in shaders that use 3D
attributes. Components not specified are filled with components from
`vec4(0.0, 0.0, 0.0, 1.0)`.

So there is no real benefit to having two different shader versions.

This will simplify porting shaders to python as it will not be
necessary to use a 3D and a 2D version of the shaders.

In python the new name for '2D_SMOOTH_COLOR' and '3D_SMOOTH_COLOR'
is 'SMOOTH_COLOR', but the old names still work for backward
compatibility.
2022-09-05 16:34:05 -03:00
0c3953d545 GPU: remove 'GPU_SHADER_2D_IMAGE'
The only real difference between `GPU_SHADER_2D_IMAGE` and
`GPU_SHADER_3D_IMAGE` is that in the vertex shader the 2D
version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses
`vec4(pos, 1.0)`.

But VBOs with 2D attributes work perfectly in shaders that use 3D
attributes. Components not specified are filled with components from
`vec4(0.0, 0.0, 0.0, 1.0)`.

So there is no real benefit to having two different shader versions.

This will simplify porting shaders to python as it will not be
necessary to use a 3D and a 2D version of the shaders.

In python the new name for '2D_IMAGE' and '3D_IMAGE'
is 'IMAGE', but the old names still work for backward
compatibility.
2022-09-05 16:34:05 -03:00
baf2835ff7 GPU: remove 'GPU_SHADER_2D_FLAT_COLOR'
The only real difference between `GPU_SHADER_2D_FLAT_COLOR` and
`GPU_SHADER_3D_FLAT_COLOR` is that in the vertex shader the 2D
version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses
`vec4(pos, 1.0)`.

But VBOs with 2D attributes work perfectly in shaders that use 3D
attributes. Components not specified are filled with components from
`vec4(0.0, 0.0, 0.0, 1.0)`.

So there is no real benefit to having two different shader versions.

This will simplify porting shaders to python as it will not be
necessary to use a 3D and a 2D version of the shaders.

In python the new name for '2D_FLAT_COLOR'' and '3D_FLAT_COLOR'
is 'FLAT_COLOR', but the old names still work for backward
compatibility.
2022-09-05 16:34:05 -03:00
223665b994 GPU: remove 'GPU_SHADER_2D_UNIFORM_COLOR'
The only real difference between `GPU_SHADER_2D_UNIFORM_COLOR` and
`GPU_SHADER_3D_UNIFORM_COLOR` is that in the vertex shader the 2D
version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses
`vec4(pos, 1.0)`.

But VBOs with 2D attributes work perfectly in shaders that use 3D
attributes. Components not specified are filled with components from
`vec4(0.0, 0.0, 0.0, 1.0)`.

So there is no real benefit to having two different shader versions.

This will simplify porting shaders to python as it will not be
necessary to use a 3D and a 2D version of the shaders.

In python the new name for '2D_UNIFORM_COLOR'' and '3D_UNIFORM_COLOR'
is 'UNIFORM_COLOR', but the old names still work for backward
compatibility.

Differential Revision: https://developer.blender.org/D15836
2022-09-05 16:34:05 -03:00
cec67176b1 GPencil: Use correct index for start point and refactor update
The last commit offset the start point by 1.

Also, remove the update because is better to do this in each operator that need it.
2022-09-05 20:19:35 +02:00
d26a0be968 UI: Corrected Scaling of AREAMINX
Minimum horizontal area size should be scaled by UI resolution.

See D15865 for more details.

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

Reviewed by Brecht Van Lommel
2022-09-05 10:37:15 -07:00
258d385857 Cleanup: Unused variable, compiler warning 2022-09-05 12:02:21 -05:00
05952aa94d Mesh: Remove redundant custom data pointers
For copy-on-write, we want to share attribute arrays between meshes
where possible. Mutable pointers like `Mesh.mvert` make that difficult
by making ownership vague. They also make code more complex by adding
redundancy.

The simplest solution is just removing them and retrieving layers from
`CustomData` as needed. Similar changes have already been applied to
curves and point clouds (e9f82d3dc7, 410a6efb74). Removing use of
the pointers generally makes code more obvious and more reusable.

Mesh data is now accessed with a C++ API (`Mesh::edges()` or
`Mesh::edges_for_write()`), and a C API (`BKE_mesh_edges(mesh)`).

The CoW changes this commit makes possible are described in T95845
and T95842, and started in D14139 and D14140. The change also simplifies
the ongoing mesh struct-of-array refactors from T95965.

**RNA/Python Access Performance**
Theoretically, accessing mesh elements with the RNA API may become
slower, since the layer needs to be found on every random access.
However, overhead is already high enough that this doesn't make a
noticible differenc, and performance is actually improved in some
cases. Random access can be up to 10% faster, but other situations
might be a bit slower. Generally using `foreach_get/set` are the best
way to improve performance. See the differential revision for more
discussion about Python performance.

Cycles has been updated to use raw pointers and the internal Blender
mesh types, mostly because there is no sense in having this overhead
when it's already compiled with Blender. In my tests this roughly
halves the Cycles mesh creation time (0.19s to 0.10s for a 1 million
face grid).

Differential Revision: https://developer.blender.org/D15488
2022-09-05 11:56:34 -05:00
63cfc8f9f6 Cleanup: Fix unused variable warnings 2022-09-05 11:28:30 -05:00
70da5a1434 Cleanup: Remove unused code for VSE waveform drawing 2022-09-05 17:49:46 +02:00
7f70b99584 Fix VSE: accidentally commented out code
`DEG_id_tag_update` was commented out in `sequencer_meta_toggle_exec()`.
Tagging does not affect functionality now, but it should be done.
2022-09-05 17:49:46 +02:00
Germano Cavalcante
89abc14d6c Fix T81002: Images drawn with the Python gpu module no longer draw on top in the Image Editor
This reverts commit 32d4a67017 thus fixing T81002 again.

And in order not to break T81212 (again) a different fix was implemented.


Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15840
2022-09-05 12:35:42 -03:00
44619eaa32 Cleanup: make format 2022-09-05 17:25:05 +02:00
39a3d312c1 GPencil: Fix bug in set start api function
The point of the second stroke was duplicated.
2022-09-05 17:10:42 +02:00
191872a836 GPencil: Improve previous commit error checking
Better check if the strokes has more points. 

A 0 or 1 point stroke never need to set start point.
2022-09-05 17:08:23 +02:00
ffe4840c2b Cleanup: Add parameter auto_flip documentation 2022-09-05 17:04:23 +02:00
5b2720befc GPencil: Small code cleanup 2022-09-05 17:01:35 +02:00
Bastien Montagne
cd49fee741 IDMAnagement: Add owner ID pointer to embedded ones.
Add a dedicated `owner_id` pointer to ID types that can be embedded
(Collections and NodeTrees), and modify slightly come code to make
handling those more safe and consistent.

This implements first part of T69169.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15838
2022-09-05 16:12:54 +02:00
dd19d6456a EEVEE: Fix attributes node on Alpha Clip/Hashed materials
This was cause by a missing implementation of some post
processing attribute functions. Leading to unresolved reference.
2022-09-05 16:03:30 +02:00
Damien Picard
19b9ea72b0 I18n: extract keymap preferences
The per-keymap user preferences messages were not extracted. This goes
through the keymap preferences RNA, as well as Python files for UI.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15871
2022-09-05 15:37:09 +02:00
Damien Picard
dead26b577 I18n: translate untitled file names
When saving, the default file name is "untitled" regardless of
selected language. This can be translated, like many graphical
applications do.

This applies to:
- blend file
- alembic file
- collada file
- obj file
- usd file
- rendered image
- grease pencil export
- subtitles export
- other Python exports through ExportHelper

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15868
2022-09-05 15:29:20 +02:00
f70cf451ed Merge branch 'blender-v3.3-release' 2022-09-05 15:21:49 +02:00
141d5cac3a GPencil: Move Outline operator in menu
Reviewed by: Matias Mendiola
2022-09-05 15:20:20 +02:00
8000d52684 Fix T100796: wrong tangents on bezier splines with duplicate points and handles
Differential Revision: https://developer.blender.org/D15880
2022-09-05 15:20:18 +02:00
Damien Picard
a2a208d88d I18n: fix translation of status bar
- Use the proper context (Operator, since that is what the cursor
  keymap status uses)
- Add a few missing message extraction tags

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15867
2022-09-05 15:19:04 +02:00
fbf875a3da GPencil: Move Scale Thickness option in menu
The option is more logic in the Normalize group

Reviewed by: Matias Mendiola
2022-09-05 15:16:42 +02:00
404e75c165 Merge branch 'blender-v3.3-release' 2022-09-05 15:07:47 +02:00
1b216fc237 Fix T100814: Cycles wrong area light parametric texture coordinates
The fix from cefd6140f3 was for light intersection, but light sampling also
needs it.

Differential Revision: https://developer.blender.org/D15879
2022-09-05 13:25:50 +02:00
871347fd93 Fix Cycles not rendering hair without radius attributes
This was fixed in 8159e0a but accidentally reverted as part of 18b703d
2022-09-05 11:38:32 +02:00
38508f5110 GPencil: New BKE function to set stroke start point
This function allows to set the start point for cyclic strokes.

The function is required by a new modifier and operator
that are currently under development.
2022-09-05 11:03:12 +02:00
91b1ca5b7b Fix T100820: Crash renaming modifier with visibility driver 2022-09-05 10:41:15 +02:00
472d8f8e92 Merge branch 'blender-v3.3-release' 2022-09-05 10:06:31 +02:00
Clément Foucault
3ae996c293 Fix T100649: Regression: Environment texture is stretched when added to mesh
The new code was not using the correct default attribute. Add access to
`g_data.P` through `node_tex_coord_position()` to replace the old
`GPU_builtin(GPU_VIEW_POSITION)` which was used before.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D15862
2022-09-05 09:21:02 +02:00
Clément Foucault
f0166bc168 Fix T100775: Regression: EEVEE world environment is stretched when using orthographic view
It was using normalized vector instead of `viewCameraVec` which account for
orthographic views.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D15861
2022-09-05 09:18:44 +02:00
b0d9b6f6df Fix T100788 Regression: EEVEE wrong normal map on backfaces
This was caused by rB07cf3ce92fa2. It was missing a sign flip.
2022-09-05 09:12:12 +02:00
0ff920b777 Cleanup: Clarify multi-socket input sorting
The multi-socket input sorting was used for two purposes: moving links
to the proper positions when dragging a new link, and resetting the
multi-input indices on the links when removing a link. They are now
separated into two functions, and the sorting when making a group
node that didn't accomplish anything is removed (in that case a
proper implementation would copy the indices from the original
exterior sockets).
2022-09-03 23:25:06 -05:00
b978c1bc65 Cleanup: Replace recursive quadratic node link mute operation
The previous implementation iterated over all links multiple times
recursively. Instead, use the node tree topology cache, only iterate
over all links once, and use a stack to propagate the mute upsteam
and downstream.
2022-09-03 17:57:53 -05:00
b60850d395 Cleanup: Deduplicate node link intersection test 2022-09-03 14:52:27 -05:00
56193eccf6 Cleanup: Refactor node add reroute operator
Use C++ Map that supports the duplication natively. Use vectors instead
of linked lists, and adjust naming. Also remove combination of reroutes
for input sockets, which doesn't make sense since a reroute isn't
allowed to combine multiple input links into one output.
2022-09-03 14:19:09 -05:00
4b818b1513 Merge branch 'blender-v3.3-release' 2022-09-03 11:43:15 +02:00
a631dc5575 Fix T100731: Keymap Editor context menu crash
Caused by {rB3f3d82cfe9ce}

Since above commit, a `uiRNACollectionSearch` may contain a NULL
`search_prop`, crashing the menu entry for "Jump To Target"
(`ui_jump_to_target_button_poll`).

Now safeguard against this with a NULL check (getting search callbacks
to work for "Jump To Target" can be investigated in master).

Maniphest Tasks: T100731

Differential Revision: https://developer.blender.org/D15832
2022-09-03 11:36:57 +02:00
a50ca6a1cd Fix T100687: Geometry Attribute Convert crashes in sculpt mode
Since above commit, `BKE_id_attributes_active_get` would also return
"internal" attributes like ".hide_poly" or ".hide_vert".
As a consequence, a couple of poll functions dont return false anymore
(attribute remove, attribute convert), allowing these operators to
execute, but acting on this "internal" layers is just asking for
trouble.

In the UI, we dont see these attributes, because `MESH_UL_attributes`
checks `is_internal`, same thing we do now in
`BKE_id_attributes_active_get`.

Maniphest Tasks: T100687

Differential Revision: https://developer.blender.org/D15833
2022-09-03 11:30:51 +02:00
0348bc88e4 Cleanup: Return early 2022-09-02 19:06:12 -05:00
2d72fc0586 Cleanup: use more standard variable name for node sockets 2022-09-02 17:48:46 -05:00
4a4044ad9b Cleanup: Use separate variables for node socket locations
This will help if the locations are moved out of DNA
and require slightly more complicated access.
2022-09-02 17:46:38 -05:00
df40440d22 Cleanup: Avoid using node socket location
The location of a reroute node and its sockets should be the same,
only stored in different coordinate spaces. Because the node's location
is the ground truth, use that for finding whether the mouse is hovering.
2022-09-02 17:46:38 -05:00
cd10fb4826 Cleanup: Use references and const in node editor 2022-09-02 17:46:38 -05:00
aa08545a01 Cleanup: Use new node topology cache for sorting multi input sockets
Assuming the cost of building the cache is ammortized, this
may be be helpful because it removes some quadratic behavior.
2022-09-02 17:45:29 -05:00
a736ca33ab Cleanup: Return early 2022-09-02 16:20:01 -05:00
0b4b3abc0b Merge branch 'blender-v3.3-release' 2022-09-02 15:49:33 -05:00
831ed297d0 Fix T100767: Geometry nodes viewer node placed incorrectly
See explanation in comment.

Differential Revision: https://developer.blender.org/D15864
2022-09-02 15:48:41 -05:00
b903b74944 Cleanup: Deduplicate node link points evaluation functions 2022-09-02 15:44:05 -05:00
40d815dff6 Cleanup: Further split of node link Bezier calculation function
Now dragged handles are handled separately, and the function returns a
statically sized array by value. The functions are also renamed to be
more consistent with curve naming elsewhere in Blender.
2022-09-02 15:44:05 -05:00
21e235afc3 Fix: Ensure topology cache exists when drawing nodes
This was missed in 58c650a44c.
2022-09-02 15:44:05 -05:00
8d1e5334ec Cleanup: Split node link draw culling to separate function
This was only really used in one place, so better to just do it there
rather than requiring another argument for the handle calculation.
2022-09-02 15:44:05 -05:00
ab6702a40f Cleanup: Return early 2022-09-02 15:44:05 -05:00
4068880ffc Cleanup: Remove unnecessary struct keyword usage in node editor 2022-09-02 15:44:05 -05:00
0fb699b212 Cleanup: Remove unused struct
Unused after 217d0a1524
2022-09-02 15:44:05 -05:00
a1e01f4c02 UI: 3D Text Caret
Changes to the text caret (cursor) when editing Text objects in the
3D Viewport.

See D15797 for more details and examples.

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

Reviewed by Brecht Van Lommel
2022-09-02 13:18:09 -07:00
65a215b819 Cleanup: DRW: Fix warning in release mode 2022-09-02 21:16:42 +02:00
86e7aaead2 Cleanup: Use C++ vector types in node editor 2022-09-02 14:09:41 -05:00
58c650a44c Nodes: Use existing nodes span cache
Use cache from 25e307d725 rather
than creating a new vector on every redraw.
2022-09-02 14:09:41 -05:00
RaphaelBelmont
6f53af3a81 EEVEE: Fix Symbol error in SH_L2 Caculation
The caculation of 7th SH coefficient need a negative sign

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15635
2022-09-02 20:59:09 +02:00
2b7de49a2b EEVEE-Next: Port to new Draw Manager 2022-09-02 20:56:55 +02:00
99afbc40e7 Cleanup: Fix clang-tidy warnings: [bugprone-suspicious-memory-comparison] 2022-09-02 20:34:37 +02:00
06043c8313 Cleanup: Fix clang-tidy warnings: [modernize-redundant-void-arg] 2022-09-02 20:34:37 +02:00
73434f02c3 Cleanup: Fix clang-tidy warnings: [modernize-use-nullptr] 2022-09-02 20:34:37 +02:00
4e84fba547 Cleanup: Fix clang-tidy warnings: [modernize-use-using] 2022-09-02 20:34:37 +02:00
9c469321c5 Cleanup: Fix clang-tidy warnings: [readability-else-after-return] 2022-09-02 20:34:37 +02:00
ccf62df8b6 Cleanup: Fix clang-tidy warnings: [readability-inconsistent-declaration-parameter-name] 2022-09-02 20:34:37 +02:00
aa781f98bb Cleanup: Fix clang-tidy warnings: [bugprone-incorrect-roundings] 2022-09-02 20:34:37 +02:00
9ba04c4598 Cleanup: Fix clang-tidy warnings: [modernize-use-bool-literals] 2022-09-02 20:34:37 +02:00
361a2de6f1 Cleanup: Fix clang-tidy warnings: [modernize-deprecated-headers] 2022-09-02 20:34:37 +02:00
e0bdd171f3 Merge branch 'blender-v3.3-release' 2022-09-02 13:10:45 -05:00
d3242b772b obj: improve placement of shader nodes in imported materials
Previously for most materials (especially the ones without any
textures), the nodes were "off screen" way to the right, requiring
a view framing to even see them.

Also, as soon as multiple images were used, many nodes overlapped
one another and the connections were all a mess.

Simplify all that, and now each node type (coordinate, mapping, image,
normal map, bsdf etc.) is in it's own column, with BSDF at zero
coordinate. Each used image (along with any possible coordinate,
mapping, normal map) is it's own row. The resulting connections
are much cleaner.
2022-09-02 21:03:44 +03:00
1a641b449a BLF: Replacement of Hebrew Font
Replacement of our Hebrew font, which has bad variable weight default.

See D15846 for more details.

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

Reviewed by Brecht Van Lommel
2022-09-02 10:54:03 -07:00
e48a6fcc63 DRW-Next: Add uniform attributes (object attributes) support
This replaces the direct shader uniform layout declaration by a linear
search through a global buffer.

Each instance has an attribute offset inside the global buffer and an
attribute count.

This removes any padding and tighly pack all uniform attributes inside
a single buffer.

This would also remove the limit of 8 attribute but it is kept because of
compatibility with the old system that is still used by the old draw
manager.
2022-09-02 19:37:15 +02:00
356460f5cf Cleanup: EEVEE-Next: Use reference as suggested by MSVC 2022-09-02 19:05:48 +02:00
28d8076a2e Fix T100768: Reverse curves skips handles of middle Bezier points
Reversing Bezier handle types and positions would skip the middle point
of curves with an odd number of segments, which is still necessary to
swap in order to avoid changing the curve's shape.
2022-09-02 12:05:12 -05:00
da0bd86739 Cleanup: GPU: UniformAttribute: Improve const correctness
Removes a warning and tidy the API.
2022-09-02 19:01:12 +02:00
Clément Foucault
65ad36f5fd DRWManager: New implementation.
This is a new implementation of the draw manager using modern
rendering practices and GPU driven culling.

This only ports features that are not considered deprecated or to be
removed.

The old DRW API is kept working along side this new one, and does not
interfeer with it. However this needed some more hacking inside the
draw_view_lib.glsl. At least the create info are well separated.

The reviewer might start by looking at `draw_pass_test.cc` to see the
API in usage.

Important files are `draw_pass.hh`, `draw_command.hh`,
`draw_command_shared.hh`.

In a nutshell (for a developper used to old DRW API):
- `DRWShadingGroups` are replaced by `Pass<T>::Sub`.
- Contrary to DRWShadingGroups, all commands recorded inside a pass or
   sub-pass (even binds / push_constant / uniforms) will be executed in order.
- All memory is managed per object (except for Sub-Pass which are managed
   by their parent pass) and not from draw manager pools. So passes "can"
   potentially be recorded once and submitted multiple time (but this is
   not really encouraged for now). The only implicit link is between resource
   lifetime and `ResourceHandles`
- Sub passes can be any level deep.
- IMPORTANT: All state propagate from sub pass to subpass. There is no
   state stack concept anymore. Ensure the correct render state is set before
   drawing anything using `Pass::state_set()`.
- The drawcalls now needs a `ResourceHandle` instead of an `Object *`.
   This is to remove any implicit dependency between `Pass` and `Manager`.
   This was a huge problem in old implementation since the manager did not
   know what to pull from the object. Now it is explicitly requested by the
   engine.
- The pases need to be submitted to a `draw::Manager` instance which can
   be retrieved using `DRW_manager_get()` (for now).

Internally:
- All object data are stored in contiguous storage buffers. Removing a lot
   of complexity in the pass submission.
- Draw calls are sorted and visibility tested on GPU. Making more modern
   culling and better instancing usage possible in the future.
- Unit Tests have been added for regression testing and avoid most API
   breakage.
- `draw::View` now contains culling data for all objects in the scene
   allowing caching for multiple views.
- Bounding box and sphere final setup is moved to GPU.
- Some global resources locations have been hardcoded to reduce complexity.

What is missing:
- ~~Workaround for lack of gl_BaseInstanceARB.~~ Done
- ~~Object Uniform Attributes.~~ Done (Not in this patch)
- Workaround for hardware supporting a maximum of 8 SSBO.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D15817
2022-09-02 18:45:14 +02:00
fd47fe4006 Cleanup: fix compiler warning 2022-09-02 18:33:10 +02:00
789936ea1b Merge branch 'blender-v3.3-release'
# Conflicts:
#	release/scripts/addons
2022-09-02 18:28:46 +02:00
Clément Foucault
e02e844f51 Fix T100163: Eevee: Regression: Displacement maps affected by rotation
This was an oversight as the matrix multiplication present in original
code was reversed.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D15858
2022-09-02 18:21:24 +02:00
07cf3ce92f Fix T100377: EEVEE: Regression 3.2 normalmap node broken
This was caused by un-wanted normalization. This is a requirement of
the MikkTspace. The issue is that g_data.N is expected to be normalized
by many other functions and overriden by bump displacement.

Adding a new global variable containing the interpolated normal fixes the
issue AND make it match cycles behavior better (mix between bump and
interpolated normal).
2022-09-02 18:13:54 +02:00
719a0378ae Cleanup: Use NODE_STORAGE_FUNCS for compositor nodes
This patches replaces the custom node storage acessor functions from the
viewport compositor code and replaces it with NODE_STORAGE_FUNCS.
2022-09-02 18:12:31 +02:00
Clément Foucault
874e9cbab9 Fix T99528: EEVEE: Regression: Faulty shaders when using Volume Info node
Workaround the issue by adding an intermediate function. This is usually
the case when working with attributes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D15860
2022-09-02 18:11:11 +02:00
Nathan Vegdahl
49ca810bf3 Cycles: enable adaptive sampling for Sobol-Burley
This uses the same sample classification approach as used for PMJ,
because it turns out to also work equally well with Sobol-Burley.

This also implements a fallback (random classification) that should
work "okay" for other samplers, though there are no other samplers
at the moment.

Differential Revision: https://developer.blender.org/D15845
2022-09-02 17:36:58 +02:00
4bbbba5bc2 Fix Cycles scrambling distance incorrectly showing as enabled for Sobol-Burley
Contributed by Alaska.

Differential Revision: https://developer.blender.org/D15849
2022-09-02 17:36:58 +02:00
aa174f632e Cleanup: split surface/displacement/volume shader eval into separate files 2022-09-02 17:13:28 +02:00
b865339833 Cleanup: remove some unnecessary kernel feature defines
That are either unused or aren't useful for testing anymore without a
megakernel.
2022-09-02 17:13:28 +02:00
cf57624764 Cleanup: refactoring of kernel film function names and organization 2022-09-02 17:13:28 +02:00
e72b9ca556 Fix: Wrong enum used in Mix Node for factor mode
Wrong type of enum was used for factor mode in rna_nodetree.c

No functional change, thankfully the correct enum had the same value.
2022-09-02 15:42:52 +01:00
622470fbb2 Cleanup: Comments of ID's tags. 2022-09-02 16:18:43 +02:00
852995d084 Cleaunp: Reorder GPencil function parameters
It's better to keep stroke as first parameter.
2022-09-02 16:11:23 +02:00
426d6b4baa GPencil: Simplify Perimeter functions to not use RegionView3D
This makes the api more portable and not depend on 
any visual area for background tasks like future modifiers.
2022-09-02 16:07:37 +02:00
633117669b Realtime Compositor: Implement dilate erode node
This patch implements the dilate/erode node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-09-02 14:47:39 +02:00
8cfca8e1bd PyGPU: only use 3D shaders and rename string enums
Since rB6269d66da, creating formats no longer depends solely on the
shader, but now depends on the dimensions used to fill the VBOs.

This allows 3D shaders to work flawlessly when assigned dimensions are
2D.

So there's no real benefit to us having shaders that are limited to 2D
use anymore.

This limitation makes it difficult to implement other builtin shaders
as they indirectly require a 2D version.

So this commit removes the 2D versions of the builtin sahders used in
Python , renames the string enums but keeps the old enums working for
backward compatibility.

(This brings parts of the changes reviewed in D15836).
2022-09-02 09:39:09 -03:00
Clément Foucault
de818d81c3 Fix T98190: EEVEE: Very slow rendering on Intel HD Graphics 4400
This particular GPU driver does not constant fold all the way in order
to discard the unused branches.

To workaround that, we introduce a series of material flag that generates
defines that only keep used branches.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D15852
2022-09-02 13:51:43 +02:00
c8ac1280bb EEVEE-Next: Move weight layer indexes to shader shared.
Upcoming cryptomatte patch would need access to these defines. So moving
them from film_lib to shader shared. We cannot include the film_lib as
it requires images/textures to be bound that we don't need.

At the same time fixes incorrect casing (`lAYER` => `LAYER`).
2022-09-02 11:33:33 +02:00
0a85288462 Fix build error after recent Metal GPU commit
These definitions were in the patch but didn't make it to the commit.
2022-09-01 17:10:05 -05:00
af4e62a020 Cleanup: Remove duplicate declaration in GPU capabilities 2022-09-01 16:57:17 -05:00
Thomas Dinges
cc8ea6ac67 Metal: MTLShader and MTLShaderGenerator implementation.
Full support for translation and compilation of shaders in Metal, using
GPUShaderCreateInfo. Includes render pipeline state creation and management,
enabling all standard GPU viewport rendering features in Metal.

Authored by Apple: Michael Parkin-White, Marco Giordano

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D15563
2022-09-01 22:28:40 +02:00
Jason Fielder
ac07fb38a1 Metal: Minimum per-vertex stride, 3D texture size + Transform feedback GPUCapabilities expansion.
- Adding in compatibility paths to support minimum per-vertex strides for vertex formats. OpenGL supports a minimum stride of 1 byte, in Metal, this minimum stride is 4 bytes. Meaing a vertex format must be atleast 4-bytes in size.

- Replacing transform feedback compile-time check to conditional look-up, given TF is supported on macOS with Metal.

- 3D texture size safety check added as a general capability, rather than being in the gl backend only. Also required for Metal.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14510
2022-09-01 22:18:02 +02:00
Jason Fielder
5f4409b02e Metal: MTLIndexBuf class implementation.
Implementation also contains a number of optimisations and feature enablements specific to the Metal API and Apple Silicon GPUs.

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D15369
2022-09-01 21:45:12 +02:00
9d59734ffd Fix build (missing include from fa40013009) 2022-09-01 21:57:42 +03:00
fa40013009 Cleanup: obj: simplify material node tree creation
As pointed out in D15827 comment, the unique_ptr usage in
ShaderNodetreeWrap related code does not sound very useful. Looking at
it, whole ShaderNodetreeWrap does not make much sense - it's only
ever created, and then immediately just one thing is fetched from it.
This very much sounds like "a function", so make it just that -
header file contains just a `create_mtl_node_tree` function, and the
whole implementation is hidden from the users. Which I've also
simplified into just a handful of freestanding functions.

No functionality or performance changes, but the code does get ~80
lines shorter.
2022-09-01 21:26:28 +03:00
16adfff1c6 Cleanup: make format 2022-09-01 19:59:55 +02:00
9a86255da8 Node Editor: Visual tweaks to node links
Several visual tweaks to node links to make them overall fit in
better with the look of the node editor:

- Change the link thickness with the zoom level to a certain degree.
- Remove the fuzziness of the node link and its shadow/outline.
- The link outline color can now be made transparent.
- Add circles at the end of dragged links when connecting to sockets.
- Improve the banding of the color interpolation along the link.
- Adjust the spacing of dashes along straight node links.

Reviewed By: Pablo Vazquez, Hans Goudey

Differential Revision: http://developer.blender.org/D15036
2022-09-01 19:48:35 +02:00
6ee3431914 Fix: Use of deprecated field in legacy MFace conversion
The material indices have been moved out of MPoly since f1c0249f34.
That conversion happens in file reading code currently, so the material
indices have to be accessed the new way everywhere.
2022-09-01 12:45:18 -05:00
08894ac929 Merge branch 'blender-v3.3-release' 2022-09-01 20:44:09 +03:00
f366d197db Fix T100737: OBJ/USD import: imported object has no active material, material has 2 users
Fixes issues in importers written in C++ (T100737):

- Materials had one reference count too much. Affected Collada,
  Alembic, USD, OBJ importers, looks like "since forever".
- Active material index was not properly set on imported meshes.
  Regression since 3.3 (D15145). Affected Alembic, USD, OBJ. Note:
  now it sets the first material as the active one, whereas
  previously the last one was set as active. First one sounds more
  "intuitive" to me.

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D15831
2022-09-01 20:38:56 +03:00
82e3513a8d Merge branch 'blender-v3.3-release' 2022-09-01 17:48:06 +02:00
ad4dcfe227 Fix T100709: baking max ray distance wrong with older .blend files
Add versioning to compensate for bugfix from T97945.
2022-09-01 17:16:50 +02:00
3249853ebe Fix: Incorrect vertex group layer "construct" callback
The "set default" callback doesn't need to be defined since it falls
back to clearing the memory, but since "construct" is optional, it
needs to be defined. Mistake in 25237d2625.
2022-09-01 08:23:57 -05:00
00d2bda241 Py Docs: Document delayed setting of UI data
Blender may not apply certain UI data changes immediately when done via BPY.
This is a rather typical gotcha, better to have it documented.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D15614
2022-09-01 15:03:51 +02:00
06d2dc6be2 Cleanup: minor cleanups for sample pattern code 2022-09-01 14:57:39 +02:00
60119daef5 Cycles: remove old Sobol pattern, simplify sampling dimensions
The multi-dimensional Sobol pattern required us to carefully use as low
dimensions as possible, as quality goes down in higher dimensions. Now that we
have two sampling patterns that are at least as good, there is no need to keep
it around and the implementation can be simplified.

Differential Revision: https://developer.blender.org/D15788
2022-09-01 14:57:39 +02:00
Nathan Vegdahl
50df9caef0 Cycles: improve Progressive Multi-Jittered sampling
Fix two issues in the previous implementation:
* Only power-of-two prefixes were progressively stratified, not suffixes.
  This resulted in unnecessarily increased noise when using non-power-of-two
  sample counts.
* In order to try to get away with just a single sample pattern, the code
  used a combination of sample index shuffling and Cranley-Patterson rotation.
  Index shuffling is normally fine, but due to the sample patterns themselves
  not being quite right (as described above) this actually resulted in
  additional increased noise. Cranley-Patterson, on the other hand, always
  increases noise with randomized (t,s) nets like PMJ02, and should be avoided
  with these kinds of sequences.

Addressed with the following changes:
* Replace the sample pattern generation code with a much simpler algorithm
  recently published in the paper "Stochastic Generation of (t, s) Sample
  Sequences". This new implementation is easier to verify, produces fully
  progressively stratified PMJ02, and is *far* faster than the previous code,
  being O(N) in the number of samples generated.
* It keeps the sample index shuffling, which works correctly now due to the
  improved sample patterns. But it now uses a newer high-quality hash instead
  of the original Laine-Karras hash.
* The scrambling distance feature cannot (to my knowledge) be implemented with
  any decorrelation strategy other than Cranley-Patterson, so Cranley-Patterson
  is still used when that feature is enabled. But it is now disabled otherwise,
  since it increases noise.
* In place of Cranley-Patterson, multiple independent patterns are generated
  and randomly chosen for different pixels and dimensions as described in the
  original PMJ paper. In this patch, the pattern selection is done via
  hash-based shuffling to ensure there are no repeats within a single pixel
  until all patterns have been used.

The combination of these fixes brings the quality of Cycles' PMJ sampler in
line with the previously submitted Sobol-Burley sampler in D15679. They are
essentially indistinguishable in terms of quality/noise, which is expected
since they are both randomized (0,2) sequences.

Differential Revision: https://developer.blender.org/D15746
2022-09-01 14:57:39 +02:00
ba1bf87bd8 GPUMaterial: Make uniform attrib precompute hash and attribute safe name
This avoids redundant operation at draw time.
The per attrib hash is to be used with the future implementation.
2022-09-01 14:41:00 +02:00
06005b0870 Tweak cryptomatte channels naming to improve interoperability
Use lowercase rgba channel names which still by-passes lossy nature
of DWA compression and which also keeps external compositing tools
happy.

Thanks Steffen Dünner for testing this patch!

Differential Revision: https://developer.blender.org/D15834
2022-09-01 14:39:26 +02:00
Germano Cavalcante
cb771dbe76 PyDoc: update the shader creation examples with gpu module
The old way of creating shaders is being replaced by using
`GPUShaderCreateInfo` for more portability.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14634
2022-09-01 08:31:56 -03:00
Germano Cavalcante
6269d66da2 PyGPU: GPUShader: implementation of 'attrs_info_get' method
With the new `attrs_info_get` method, we can get information about
the attributes used in a `GPUShader` and thus have more freedom in the
automatic creation of `GPUVertFormat`s

Reviewed By: fclem, campbellbarton

Differential Revision: https://developer.blender.org/D15764
2022-09-01 08:25:55 -03:00
05fe7ca5af Merge branch 'blender-v3.3-release' 2022-09-01 12:43:13 +02:00
df751516e1 Fix cryptomatte passes saved lossy into multilayer EXR
The DWA compression code in OpenEXR has hardcoded rules which decides
which channels are lossy or lossless. There is no control over these
rules via API.

This change makes it so channel names of xyzw is used for cryptomatte
passes in Cycles. This works around the hardcoded rules in the DWA code
making it so lossless compression is used. It is important to use lower
case y channel name as the upper case Y uses lossy compression.

The change in the channel naming also makes it so the write code uses
32bit for the cryptomatte even when saving half-float EXR.

Fixes T96933: Cryptomatte layers saved incorrectly with EXR DWA compression
Fixes T88049: Cryptomatte EXR Output Bit Depth should always be 32bit

Differential Revision: https://developer.blender.org/D15823
2022-09-01 10:37:39 +02:00
Monique Dewanchand
17501c146e Cleanup: Remove/replace View Layer macros.
This patch is a cleanup required before refactoring the view layer syncing
process {T73411}.

* Remove FIRSTBASE.
* Remove LASTBASE.
* Remove BASACT.
* Remove OBEDIT_FROM_WORKSPACE.
* Replace OBACT with BKE_view_layer_active_object.
* Replace OBEDIT_FROM_VIEW_LAYER with BKE_view_layer_edit_object.

Reviewed By: mont29

Maniphest Tasks: T73411

Differential Revision: https://developer.blender.org/D15799
2022-09-01 10:22:43 +02:00
f9c249917d Cleanup: use reference instead of copy 2022-09-01 09:57:24 +02:00
Bastien Montagne
414baf9780 Fix invalid memory handling in C++ OBJ MTL Importer.
An ID created with regualr ID management code should never ever be
directly freed directly.

For embedded nodetrees, there is a dedicated function.

Reviewed By: aras_p

Differential Revision: https://developer.blender.org/D15827
2022-09-01 09:17:02 +02:00
9806672e86 Fix: Build error in Cycles with OpenVDB turned off 2022-08-31 18:06:13 -05:00
3a605b23d0 Fix T100708: Cycles bake of diffuse/glossy color not outputting alpha 2022-08-31 20:51:50 +02:00
b9998541e1 Fix part of T100626: Cycles not using tiles for baking
Leading to excessive memory usage compared to Blender 2.93. There's still
some avoidable memory usage remaining, due to the full float buffer in the
new image editor drawing and not loading the cached EXR from disk in tiles.

Main difficulty was handling multi-image baking and disk caches, which is
solved by associating a unique layer name with each image so it can be
matched when reading back the image from the disk.

Also some minor header changes to be able to use RE_MAXNAME in RE_bake.h.
2022-08-31 20:04:14 +02:00
e665f0f497 Fix T100714: Cycles volume render artifacts with negative value grids
The volume bounds were not constructed correctly in this case.
2022-08-31 20:04:14 +02:00
d7b33cd8c8 Sculpt: Fix T100479: Memory corruption in sculpt_boundary_edit_data_init 2022-08-31 10:20:30 -07:00
70f1711324 Mesh: Remove unnecessary copy in modifier stack
These few lines making a copy of the final mesh were confusing.
The goal (I'm fairly certain) is to make sure the cage mesh and final
mesh aren't shared when applying the vertex coordinates to the final
mesh. This can be done more simply though, in a way that avoids
duplicating the final mesh if it already isn't shared.

This works well in some basic tests with different modifiers. Though
I doubt it was really a bottleneck anywhere, simplifying the modifier
stack internals is always nice.

Differential Revision: https://developer.blender.org/D15814
2022-08-31 12:12:09 -05:00
91d9f46aec Cleanup: Use const for node data in compositor
Push the const usage a bit further for compositor nodes, so that they
are more explicit about not modifying original nodes from the editor.

Differential Revision: https://developer.blender.org/D15822
2022-08-31 12:06:13 -05:00
fae955fdb1 Fix merge error. 2022-08-31 10:04:23 -07:00
ab8240fcff Fix submodule refs 2022-08-31 10:02:42 -07:00
373e69b94e Merge branch 'blender-v3.3-release' 2022-08-31 09:46:33 -07:00
cdc0be48c9 Cleanup: fix warnings from vcol limit commit 2022-08-31 09:43:52 -07:00
e6557785ed Fix: crash on undo due to missing node declaration
This was broken in {rB25e307d725d0b924fb0e87e4ffde84f915b74310}.
2022-08-31 18:35:07 +02:00
0a4249561c Fix compile error from merge. 2022-08-31 09:08:35 -07:00
2f729bc111 Fix T98525: depsgraph for indirectly referenced ID Properties in drivers.
If the RNA path of a Single Property variable goes through a pointer
to a different ID, the property should be attached to that ID using
the owner reference in the RNA pointer. This already happened when
building some, but not all of the relations and nodes.

This patch fixes the remaining cases.

Differential Revision: https://developer.blender.org/D15323
2022-08-31 19:00:38 +03:00
f987d9b758 Merge branch 'blender-v3.3-release' 2022-08-31 08:33:23 -07:00
30ec628d43 UI: Fix Geometry Nodes "Is Face Planar" name
Old name: "Face is Planar"
New name: "Is Face Planar"

This follows the current convention (Is Shade Smooth, Is Viewport, ...).
2022-08-31 17:31:04 +02:00
db98007c3a UI: Fix Geometry Nodes "Mesh to Volume" name (typo)
Old name: "Mesh To Volume"
New name: "Mesh to Volume"

This is consistent with what we do for the other nodes
(Mesh to Curve, Mesh to Points).
2022-08-31 17:30:39 +02:00
a6ba8e5f38 Core: Remove color attribute limit from CustomData API
Note: does not fix the limit in PBVH draw which is
caused by VBO limits not MAX_MCOL.
2022-08-31 08:29:16 -07:00
2a13ce1e61 Fix T100700: Compositor crashes when disabled then enabled
The viewport compositor crashes when it is disabled then enabled after
the compositor node tree is edited.

This happens because the compositor engine uses the view_update callback
of the draw engine type to detect changes in the node tree and reset its
state for future evaluation. However, the draw manager only calls the
view_update callback for enabled engines, so the compositor never
receives the needed updates to properly reset its state and then crashes
at draw time.

This patch call the view_update callback for all registered engines
regardless if they are enabled or not, that way, they always receive
the potentially important updated needed to maintain a correct state.

Aside from the compositor engine, this change affects the EEVEE and
Workbench engines because they are the only engines that utilizes this
callback. However, both of them only reset a flag that is checked at
draw time. So the change should have no side effects. For the EEVEE
engine, we just add a null check in case it was not instanced, while
Workbench already have the appropriate null check.

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

Reviewed By: Clement Foucault
2022-08-31 16:59:54 +02:00
370b17a8c6 Merge remote-tracking branch 'origin/blender-v3.3-release' 2022-08-31 16:30:57 +02:00
0864ab5248 UI: Fix order of Geometry Nodes in the Add Nodes Mesh menu 2022-08-31 16:29:13 +02:00
ae79bc490a GPencil: Apply Brush Size to Outline thickness while drawing
The new factor allows to apply the current brush size to the
external stroke perimeter conversion done in draw mode.
2022-08-31 16:18:08 +02:00
097ed6565e Merge branch 'blender-v3.3-release' 2022-08-31 16:10:59 +02:00
f1c0249f34 Mesh: Move material indices to a generic attribute
This patch moves material indices from the mesh `MPoly` struct to a
generic integer attribute. The builtin material index was already
exposed in geometry nodes, but this makes it a "proper" attribute
accessible with Python and visible in the "Attributes" panel.

The goals of the refactor are code simplification and memory and
performance improvements, mainly because the attribute doesn't have
to be stored and processed if there are no materials. However, until
4.0, material indices will still be read and written in the old
format, meaning there may be a temporary increase in memory usage.

Further notes:
* Completely removing the `MPoly.mat_nr` after 4.0 may require
  changes to DNA or introducing a new `MPoly` type.
* Geometry nodes regression tests didn't look at material indices,
  so the change reveals a bug in the realize instances node that I fixed.
* Access to material indices from the RNA `MeshPolygon` type is slower
  with this patch. The `material_index` attribute can be used instead.
* Cycles is changed to read from the attribute instead.
* BMesh isn't changed in this patch. Theoretically it could be though,
  to save 2 bytes per face when less than two materials are used.
* Eventually we could use a 16 bit integer attribute type instead.

Ref T95967

Differential Revision: https://developer.blender.org/D15675
2022-08-31 09:09:01 -05:00
d4d14df38c Release schedule: Blender 3.3 RC
The branch is now in Bcon4, critical bug fixes only.
2022-08-31 16:08:26 +02:00
3e73afb536 Merge branch 'blender-v3.3-release' 2022-08-31 15:34:44 +02:00
b1231e616a Cycles: Enforce Windows driver version requirements for sycl
sycl/L0 runtime reports compute-runtime version since Intel graphics
driver 101.3268 on Windows, when querying driver version from sycl.
Prior to this driver, it was 0. Now we can bump minimum requirement to
this one and filter-out devices returning 0.

Maniphest Tasks: T100648
2022-08-31 15:33:16 +02:00
310a43bcac Cleanup: Resolve unused-lambda-capture warning 2022-08-31 15:20:45 +02:00
ac20970bc2 Depsgraph: optimize out evaluation of hidden objects
This change makes it so that objects which are temporary hidden from
the viewport (the icon toggle in outliner) do not affect on the
performance of the viewport.

The attached file demonstrates the issue. Before this change hiding
the object does not change FPS, after this change FPS goes high when
the object is hidden.

F13435936

Changing the object temporary visibility is already expected to tag
scene for bases updates, which flushes down the stream to the object
visibility update. So the only remaining topic was to ensure the
graph does a special round of visibility update on such changes.

Differential Revision: https://developer.blender.org/D15813
2022-08-31 15:11:18 +02:00
5a1b733a67 Fix unnecessary modifier visibility re-evaluation
While it is hard to measure the performance impact accurately, there
is no need to perform per-modifier string lookup on every frame update.

Implemented as an exceptional case in the code which flushes updates to
the entire component. Sounds a bit suboptimal, but there are already
other exception cases handled in the function.

Differential Revision: https://developer.blender.org/D15812
2022-08-31 15:11:18 +02:00
c1e342136d UI: Add shift-click hint to library overrides button tooltip
This information was missing and made the feature hard to discover.
2022-08-31 15:04:43 +02:00
773241add9 Merge branch 'blender-v3.3-release' 2022-08-31 14:47:52 +02:00
24fe659224 LibOverride: Replace linked objects by their overrides when created from 3DView.
From the 3DView code has basically no knowledge of collection hierarchy,
so we can either not remap any local usage of linked objects that are
being overridden, or remap them in all their local collections.

The second behavior makes most sense in the vast majority of cases.

Note that this was only an issue when directly linking and overriding
objects, not when doing so through collections.
2022-08-31 14:44:55 +02:00
4b9d7b71e0 Fix: incorrect detection of used sockets 2022-08-31 14:41:57 +02:00
627e8ad682 Fix: missing vector clear
Otherwise, these vectors are never cleared, leading to crashes
down the line.
2022-08-31 13:57:08 +02:00
d3f07998ed Cleanup: simplify debugging
This makes it easy to set breakpoints where false is returned.
2022-08-31 13:57:08 +02:00
81d82427b5 Merge branch 'blender-v3.3-release' 2022-08-31 12:38:13 +02:00
d210ab90d4 Fix crash in liboverride operations from the Outliner.
Checks for 'invalid' selected IDs that need to be skipped were
incomplete, and one was missing the actual return statement.
2022-08-31 12:36:54 +02:00
25e307d725 Nodes: move NodeTreeRef functionality into node runtime data
The purpose of `NodeTreeRef` was to speed up various queries on a read-only
`bNodeTree`. Not that we have runtime data in nodes and sockets, we can also
store the result of some queries there. This has some benefits:
* No need for a read-only separate node tree data structure which increased
  complexity.
* Makes it easier to reuse cached queries in more parts of Blender that can
  benefit from it.

A downside is that we loose some type safety that we got by having different
types for input and output sockets, as well as internal and non-internal links.

This patch also refactors `DerivedNodeTree` so that it does not use
`NodeTreeRef` anymore, but uses `bNodeTree` directly instead.

To provide a convenient API (that is also close to what `NodeTreeRef` has), a
new approach is implemented: `bNodeTree`, `bNode`, `bNodeSocket` and `bNodeLink`
now have C++ methods declared in `DNA_node_types.h` which are implemented in
`BKE_node_runtime.hh`. To make this work, `makesdna` now skips c++ sections when
parsing dna header files.

No user visible changes are expected.

Differential Revision: https://developer.blender.org/D15491
2022-08-31 12:16:13 +02:00
5a60535a20 GPUCapabilities: Add GPU_shader_draw_parameters_support
This checks for the availability of `gl_BaseInstanceARB` or equivalent.

Disabling for any workaround that disables shader_image_load_store_support
as a preventive measure.
2022-08-31 11:35:18 +02:00
41f439a737 Merge branch 'blender-v3.3-release' 2022-08-31 10:29:35 +02:00
6177d9f0c8 Fix: reverse uv lookup fails due to floating point accuracy issues
The case when the query uv is almost on an edge but outside of any
triangle was handled before. Now the case where the query uv is
almost on an edge but inside more than one triangle is handled as well.
2022-08-31 10:28:35 +02:00
68f234b8ab Cleanup: obj: simplify import/export syntax handling code
I want to add support for PBR materials extension to OBJ, but the way
current I/O code syntax handling was done made it quite cumbersome
to extend the number of MTL textures/parameters.

Simplify all that by removing FormatHandler template on "syntax"
that gets routed through keyword enums, and instead just have
simple `write_obj_*` and `write_mtl_*` functions.

Simplify MTLMaterial to not contain a map of textures (that is always
fully filled with all possible textures), instead now there's
a simple array. Rename `tex_map_XX` to `MTLTexMap`.

All this does not affect behavior or performance, but it does result
in 170 fewer lines of code, and saves a couple kilobytes of executable
size.
2022-08-31 11:18:34 +03:00
caa352bc45 Merge branch 'blender-v3.3-release' 2022-08-31 09:44:15 +02:00
e2deee73ab Update freedesktop file.
Add new features for upcoming Blender 3.3 and also missing 3.2 notes, which were not merged to master.
2022-08-31 09:42:17 +02:00
60576fba11 Fix resource leak dropping files in GHOST/Win32
Early returns in error cases missed calling ReleaseStgMedium for
getDropDataAsFilenames, getDropDataAsString & getDropDataAsString.
2022-08-31 16:28:32 +10:00
a0ff2be199 Cleanup: remove pointless strcpy return value check 2022-08-31 16:12:24 +10:00
70035e6473 Cleanup: break before the default case in switch statements
While missing the break before a default that only breaks isn't
an error, it means adding new cases needs to remember to add the
break for an existing case, changing the default case will also
result in an unintended fall-through.

Also avoid `default:;` and add an explicit break.
2022-08-31 16:01:29 +10:00
ff651a08b5 Fix returning a freed context when initialization fails for GHOST/Win32 2022-08-31 14:55:47 +10:00
4df3cf020b Fix uninitialized variable use for ID3D11RenderTargetView
When 'm_render_target' was NULL, backbuffer_res would be used without
being assigned. While it seems likely this code-path is rarely used
(if at all), resolve the logical error.
2022-08-31 14:55:47 +10:00
065a1cd0b1 Cleanup: check GetKeyboardState succeeds before using it's values
Quiets compiler warning.
2022-08-31 14:55:39 +10:00
e9d4a20a59 Cleanup: tablet press could fall through to release on GHOST/Win32
Introduced in [0], checking the logic here, there seems to be no reason
a press event should ever run release logic, relocate break statement.

In practice this was unlikely to cause problems as peeking into press
events would need to fail, peeking into release would need to succeed.
Even so, better avoid accidental fall through in switch statements.

[0]: 6f158f834d
2022-08-31 14:36:44 +10:00
8bfb65e254 Cleanup: remove 'else' after return 2022-08-31 14:36:44 +10:00
c4a16389bc Cleanup: use bool for GHOST_SystemWin32::setConsoleWindowState return 2022-08-31 14:36:44 +10:00
0f8ebd21e3 Cleanup: reduce scope, quiet unused variable warnings
When building without thumbnails some variables weren't used,
reduce their scope as well as the BlPath sub-string.
2022-08-31 14:26:47 +10:00
876d1bfe4e Cleanup: quiet MSVC warning using flag flag operations on boolean
While harmless it wasn't clear if other bits might be set but ignored,
assign the value instead.
2022-08-31 14:26:46 +10:00
68d85ce208 Cleanup: format 2022-08-31 13:52:44 +10:00
cae50c83c6 Cleanup: split font datafile loading into a function
Also use more descriptive/conventional variable names.
2022-08-31 12:50:08 +10:00
657b92c888 BLF: use existing stat from 'direntry' for directory check 2022-08-31 12:42:41 +10:00
dc733cf17d Merge branch 'blender-v3.3-release' 2022-08-31 10:02:45 +08:00
fec90a5d58 GPencil: Fix sharp_threshold property in sample stroke operator
The property registration was missing in the operator, now fixed.
2022-08-31 10:02:09 +08:00
66fecfcda6 LineArt: Fix (unreported) wrong index in weight transfer
Line art now uses global index for vertices but needs to have
local index in order to do correct weight transfer.
2022-08-31 10:02:09 +08:00
Charlie Jolly
bfa0ee13d5 Node: Mix node
This patch is a response to T92588 and is implemented
as a Function/Shader node.

This node has support for Float, Vector and Color data types.

For Vector it supports uniform and non-uniform mixing.

For Color it now has the option to remove factor clamping.

It replaces the Mix RGB for Shader and Geometry node trees.

As discussed in T96219, this patch converts existing nodes
in .blend files. The old node is still available in the
Python API but hidden from the menus.

Reviewed By: HooglyBoogly, JacquesLucke, simonthommes, brecht

Maniphest Tasks: T92588

Differential Revision: https://developer.blender.org/D13749
2022-08-31 00:13:57 +01:00
0331a8c67c Cleanup: Remove redundant addition of attribute
The radius attribute is aleady added in `pointcloud_random`.
2022-08-30 17:03:04 -05:00
b5bc086864 Cleanup: Avoid using geometry component unnecessarily 2022-08-30 17:00:36 -05:00
7bfabc6444 Cleanup: Remove unused point cloud function
This can be done more intuitively with a "copy parameters" function
like `curves_copy_parameters` or `BKE_mesh_copy_parameters` anyway.
2022-08-30 16:52:30 -05:00
d94a11ed79 Curves: Avoid unnecessarily initializing new positions layer
When creating a curves data-block, one is expected to set the new
position values. We can slightly improve performance by avoiding
doing that redundantly.

Similar to cccc6d6905.
2022-08-30 16:49:24 -05:00
4c91c24bc7 Attributes: Avoid unnecessarily initializing new attributes
The "write_only" (i.e. no reading) API function expects the caller to
set values for all new attribute elements, so using calloc or setting
 the default value first is redundant. In theory this can improve
performance by avoiding an extra pass over the array. I observed a
6% improvement in a basic test with the mesh to points node:
from 47.9ms to 45ms on average.

See 25237d2625 for more info.
Similar to cccc6d6905.
2022-08-30 16:45:00 -05:00
cccc6d6905 Mesh: Avoid redundant custom data layer initialization
In all these cases, it was clear that the layer values were set right
after the layer was created anyway. So there's no point in using
calloc or setting the values to zero first.

See 25237d2625 for more info.
2022-08-30 16:27:43 -05:00
47d105f6ad Merge branch 'blender-v3.3-release' 2022-08-30 15:39:30 -05:00
d9c48d94e4 Fix: Potential name clash when adding rest position attribute
If a "rest_position" attribute already existed, potentiall with another
type, the next name "rest_position.001" would be used, which might
even conflict with a name on another domain. Use the C++ attribute
API instead, which has more standard/predictable behavior.
2022-08-30 15:38:38 -05:00
bcd671e565 Cleanup: Use C++ attribute API 2022-08-30 15:32:10 -05:00
3090edfecf Cleanup: Use standard variable name for curve points 2022-08-30 15:32:10 -05:00
4944167dee GPUBatch: Add multi_draw_indirect capability and indirect buffer offset
This is for completion and to be used by the new draw manager.
2022-08-30 22:26:11 +02:00
f5ea2a6434 GPUTexture: Add type correct GPU_SAMPLER_MAX constant for C++
This avoid having to cast when using it in `.cc` and `.hh` files.
2022-08-30 22:26:11 +02:00
36e74cc4f7 GPUMaterial: Expose debug name getter
This also makes it mandatory, but reduced length for release.
2022-08-30 22:26:11 +02:00
da03c1f96d GPUCodegen: Do not rely on auto resource location
This allows the render engine to expect non-overlapping resources in the
generated create info.
Textures are indexed from 0 and up.
Nodetree ubo is bound to slot 0.
Uniform attributes ubo is bound to slot 1.
2022-08-30 22:26:11 +02:00
b15f90bf85 GPUBatch: Add draw parameter getter
This is used to populate indirect draw commands in the draw manager.
2022-08-30 22:26:11 +02:00
fe195f51d1 GPUStorageBuf: Add read() function to readback buffer data to host
This is not expected to be fast. This is only for inspecting the content
of the buffer for debugging or validation purpose.
2022-08-30 22:26:11 +02:00
25237d2625 Attributes: Improve custom data initialization options
When allocating new `CustomData` layers, often we do redundant
initialization of arrays. For example, it's common that values are
allocated, set to their default value, and then set to some other
value. This is wasteful, and it negates the benefits of optimizations
to the allocator like D15082. There are two reasons for this. The
first is array-of-structs storage that makes it annoying to initialize
values manually, and the second is confusing options in the Custom Data
API. This patch addresses the latter.

The `CustomData` "alloc type" options are rearranged. Now, besides
the options that use existing layers, there are two remaining:
* `CD_SET_DEFAULT` sets the default value.
  * Usually zeroes, but for colors this is white (how it was before).
  * Should be used when you add the layer but don't set all values.
* `CD_CONSTRUCT` refers to the "default construct" C++ term.
  * Only necessary or defined for non-trivial types like vertex groups.
  * Doesn't do anything for trivial types like `int` or `float3`.
  * Should be used every other time, when all values will be set.

The attribute API's `AttributeInit` types are updated as well.
To update code, replace `CD_CALLOC` with `CD_SET_DEFAULT` and
`CD_DEFAULT` with `CD_CONSTRUCT`. This doesn't cause any functional
changes yet. Follow-up commits will change to avoid initializing
new layers where the correctness is clear.

Differential Revision: https://developer.blender.org/D15617
2022-08-30 14:56:05 -05:00
d81e947c59 BLF: Fallback Stack Error Handling
Properly handle invalid fonts.

See D15798 for more details

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

Reviewed by Brecht Van Lommel
2022-08-30 11:31:11 -07:00
627bd4c46a Merge branch 'blender-v3.3-release' 2022-08-30 20:21:09 +02:00
f20d0de3b7 Fix T93084: Area stretch overlay full red on large scale mesh
Issue arises when face areas are really large combined with small UV
areas (report has a mesh ~1.5 km), then precission of shorts is
insufficient.

Now use floats instead.
This also removes this negative signed version of the total area ratio
(since with floats it is no longer used).

Thx @brecht for a lot of hand-holding!

NOTE: this is an alternative to D15805 (and quick tests show this does
not introduce the tiny performance hit as D15805 did).

Maniphest Tasks: T93084

Differential Revision: https://developer.blender.org/D15810
2022-08-30 20:16:30 +02:00
6f52a118a0 Fix: Build error on windows 2022-08-30 13:06:09 -05:00
934b9277be Fix build error from missing include 2022-08-30 12:47:21 -05:00
82a46ea6f8 Geometry Nodes: Use separate field context for each geometry type
Using the same `GeometryComponentFieldContext` for all situations,
even when only one geometry type is supported is misleading, and mixes
too many different abstraction levels into code that could be simpler.
With the attribute API moved out of geometry components recently,
the "component" system is just getting in the way here.

This commit adds specific field contexts for geometry types: meshes,
curves, point clouds, and instances. There are also separate field input
helper classes, to help reduce boilerplate for fields that only support
specific geometry types.

Another benefit of this change is that it separates geometry components
from fields, which makes it easier to see the purpose of the two concepts,
and how they relate.

Because we want to be able to evaluate a field on just `CurvesGeometry`
rather than the full `Curves` data-block, the generic "geometry context"
had to be changed to avoid using `GeometryComponent`, since there is
no corresponding geometry component type. The resulting void pointer
is ugly, but only turns up in three places in practice. When Apple clang
supports `std::variant`, that could be used instead.

Differential Revision: https://developer.blender.org/D15519
2022-08-30 11:08:27 -05:00
4d107041ec Merge branch 'blender-v3.3-release' 2022-08-30 10:43:36 -05:00
3306b4a86b Fix T99253: Missing face center dots with deform modifier cage option
Before 8c25889bb6, subsurf face center tags were stored in each
vertex, so they were always copied to duplicate meshes. Now they are
stored in runtime data though, so they need to be copied explicitly.
The function name "reset_on_copy" is a bit awkward here, so the
tags are copied by the caller.
2022-08-30 10:41:26 -05:00
38cf0d7d13 GPencil: Improve Thickness handling for Outline operator
Actually, when you increase the thickness of the stroke in the outline conversion, the shape of the stroke changes and becomes thicker.

This commit includes a new algorithm to correct this problem. A new `Keep Shape`  parameter allows you to disable it because, for artist reasons, it may be good to keep the old algorithm and change the shape.
2022-08-30 17:12:03 +02:00
002f339aed Fix: Alphabetical order in duplicate data preferences panel 2022-08-30 08:22:31 -05:00
9cfa74087e Merge branch 'blender-v3.3-release' 2022-08-30 15:18:49 +02:00
afa4f8f3ce LibOverride: Minor resync optimization by removing unuecessary processing.
Not much to gain here, but can make resync faster by a few percents when
dealing with linked overrides and such.
2022-08-30 15:18:17 +02:00
34ff27025d Cleanup: Remove one level of indentation by early continue in a loop. 2022-08-30 15:18:17 +02:00
f3186389b0 Fix T100586: libOverride resync could remove too many data-blocks.
Do not delete 'orphaned' overrides when their reference is missing
because the library file itself is missing.
2022-08-30 15:18:17 +02:00
fdc332981e Cleanup: simplify comparison, clarify comment 2022-08-30 21:20:26 +10:00
e0ab4b29a9 Merge branch 'blender-v3.3-release' 2022-08-30 21:07:31 +10:00
524d9a3e2f Fix error in operator poll functions
- PALETTE_OT_color_add: crashed without a brush.
- SCREEN_OT_actionzone: crashed without a window.
- PREFERENCES_OT_studiolight_show: exception when opening prefs failed.
2022-08-30 21:06:17 +10:00
c7555372fe Merge branch 'blender-v3.3-release' 2022-08-30 12:51:12 +02:00
558a6a45b4 Cleanup: Avoid misleading Outliner tree element callback name
These functions used the term "find", which makes it sound like a lookup
callback, when in fact it would add elements to a set for further
processing. So use "collect" instead.
2022-08-30 12:24:17 +02:00
34e30baedf Fix T100673: crash when using slide brush without attachment info
The slide brush requires attachment information on the curves.
Now a warning is shown instead of crashing Blender. The attachment
information can be generated by executing the
`Curves > Snap to Nearest Surface` operator.
2022-08-30 12:20:37 +02:00
702f112e77 Merge branch 'blender-v3.3-release' 2022-08-30 19:46:44 +10:00
a97ae83a09 Fix T100703: Crash in file reading with ID's referenced from the WM
Don't decrement ID reference counts as any ID references from the
window-managers will have already been freed.

Reviewed By: mont29

Ref D15808
2022-08-30 19:41:48 +10:00
364f47c834 Merge branch 'blender-v3.3-release' 2022-08-30 11:24:58 +02:00
16938ab7d4 Update DPC++ to 20220812
This was already done in the libraries SVN, just the build system
changes got forgotten to be committed.
2022-08-30 11:23:35 +02:00
d2c0d86a38 EEVEE-Next: Register render passes for compositor.
EEVEE-Next passes were rendered to the render result, but didn't appear
in the compositor. Reasoning is that when a render engine has the update
render passes callback registered it would not register any default
render passes. This callback is used to update the Render Layer node.

This patch implements the callback for EEVEE-Next with the render passes
that are already available. In the future the callback should be
extended. Note that AO/SHADOW render passes have been disabled for now
as they need to be converted to color buffers.
2022-08-30 10:26:10 +02:00
a65676e6e9 GPencil: Rename in Outline operator mode with material_mode
The old name `mode` was confusing because there was also a `view_mode`.
2022-08-30 09:37:26 +02:00
e7f1c73a4e GPencil: Add thickness parameter to Outline operator
Instead to use always a value of 1, now the thickness of the stroke perimeter can be set.

This thickness is added to the original perimeter, so using a big number can increase the global thickness of the stroke.
2022-08-30 09:37:26 +02:00
c29d63aa5e Cleanup: spelling in comments 2022-08-30 16:22:49 +10:00
24b8ccaa94 Cleanup: format 2022-08-30 16:22:49 +10:00
26487530f2 Merge branch 'blender-v3.3-release' 2022-08-30 11:14:08 +10:00
e9fe4aa7d7 Fix Dirty Vertex Colors failure when no vertex colors existed 2022-08-30 11:12:55 +10:00
5ae3fa50e2 Cleanup: Remove misleading std::string reference binding
These functions that retrieve strings from assets return stringrefs.
Storing them as std::strings is unnecessary and relies on binding to
the const references.
2022-08-29 18:11:37 -05:00
6577d2df8c Cleanup: Use const for custom data layers 2022-08-29 17:00:46 -05:00
71b660571a Sculpt: Avoid creating mask and face set when remeshing
If these layers didn't exist on the original mesh, they would be created
from scratch and transferred anyway. That is inefficient because all the
work is pointless, and because creating these layers could slow down
subsequent sculpt operations.
2022-08-29 16:55:26 -05:00
dc92c5766f Merge branch 'blender-v3.3-release' 2022-08-29 14:55:04 -05:00
b814f64f4a Fix: Broken build with OpenVDB turned off
Problem with e3a6a2f412.
2022-08-29 14:50:26 -05:00
Tom Edwards
35df9f80b9 Fix T99576: Guard against empty names when removing attributes
It's possible for misbehaving scripts written before 3.3 to reach
this state and crash Blender. With this change, the error is reduced
to a Python exception.

Differential Revision: https://developer.blender.org/D15724
2022-08-29 14:45:55 -05:00
Pratik Borhade
68487cff95 Fix T98968: Node reroute tool doesn't add to frames
If reroute node lies in side the frame node boundaries then set
frame node as the parent of reroute.

Differential Revision: https://developer.blender.org/D15739
2022-08-29 14:45:01 -05:00
Pratik Borhade
50e5c78799 Fix T98968: Node reroute tool doesn't add to frames
If reroute node lies in side the frame node boundaries then set
frame node as the parent of reroute.

Differential Revision: https://developer.blender.org/D15739
2022-08-29 14:39:14 -05:00
7fbf72f148 Build: automatically disable WITH_GHOST_WAYLAND if missing libraries
Same as other build options, don't make it a hard requirement to have
Wayland libraries installed when it gets enabled by default.

Also fixes wayland-protocols not being found on the buildbot.
2022-08-29 19:51:07 +02:00
74caf77361 Cycles: add option to specify OptiX runtime root directory
This allows individual users or Linux distributions to specify a directory
Cycles will automatically look for the OptiX include folder, to compile kernels
at runtime.

It is still possible to override this with the OPTIX_ROOT_DIR environment
variable at runtime.

Based on patch by Sebastian Parborg.

Ref D15792
2022-08-29 19:50:20 +02:00
42cff95519 Cycles: disable Scrambling Distance UI when using Sobol Burley
Contributed by Alaska.

Differential Revision: https://developer.blender.org/D15794
2022-08-29 19:45:58 +02:00
21acfbe348 Cleanup: move Cycles display driver context handling to render module
This is highly coupled to Blender logic so doesn't belong in Cycles.
2022-08-29 19:45:58 +02:00
810e7c032c Cleanup: move part of render module to C++ 2022-08-29 19:45:58 +02:00
ff27457240 Allocator: add MEM_cnew_array
This is a more C++ friendly version MEM_calloc_arrayN, like MEM_cnew is for
MEM_callocN. For cases where data structures are still C and Vector or Array
don't work.
2022-08-29 19:45:58 +02:00
658ff994c5 Merge branch 'blender-v3.3-release' 2022-08-29 19:21:49 +02:00
805d1063a0 Cycles: Remove "return" and "assert" from oneAPI kernel code 2022-08-29 19:18:50 +02:00
dff15bb5bf Fix: Broken build with OpenVDB turned off
Problem with e3a6a2f412.
2022-08-29 12:12:16 -05:00
48e1a66af0 Merge branch 'blender-v3.3-release' 2022-08-29 18:21:56 +02:00
1cd8ca49f9 Cycles: Increased minimum supported driver for Windows in oneAPI 2022-08-29 18:10:56 +02:00
999c5c5c8d Fix (studio-reported) crash when linking/appending data in some cases.
Recent refactor (rB7be1c8bbae76f49f) removed a null check in WM code,
that is mandatory in some cases like e.g. liboverride apply code on
linked data.
2022-08-29 17:25:09 +02:00
1567dca657 Merge branch 'blender-v3.3-release' 2022-08-29 17:01:01 +02:00
e3a6a2f412 Fix T99004: scaling volume down results in crash
OpenVDB crashes when the determinant of the grid transformation is
too small. The solution is too detect when the determinant is too small
and to replace the grid with an empty one. If possible the translation
and rotation of the grid remains unchanged.

Differential Revision: https://developer.blender.org/D15806
2022-08-29 17:00:08 +02:00
Damien Picard
9120c86c3f I18n: disambiguate and make a few more strings translatable
Those strings were at least partly disambiguated:
- Area
  - Zone
  - Measurement
- Ease
  - BBone Ease In / Out
- Back
  - Camera BG image depth
  - GP interpolate sequence
- Edge Crease
  - Theme
- Jitter
  - Brush
  - GPencil
  - Lens distorsion compositing node
- Cineon color management
  - Black
  - Gamma
  - White

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15791
2022-08-29 16:04:03 +02:00
Damien Picard
0db582c41c Add missing RNA text for the MeshUVLoop struct
The structures in rna_mesh.c all had a UI text which showed up in the
animation editors, except for MeshUVLoop.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15803
2022-08-29 15:08:29 +02:00
Damien Picard
9bf5c37bee I18n: translate newly created node group sockets
Translate:
- new group socket names
  - default names Input and Output
  - on connecting a link from another node
- new geometry nodes input and output socket names

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15763
2022-08-29 14:26:10 +02:00
Damien Picard
73bfd8058f I18n: make add-ons' info translatable
The info provided by add-ons is very valuable to users, yet it wasn’t translatable yet.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15747
2022-08-29 14:12:21 +02:00
9823a8f72b Weight Paint: use coordinates from normal evaluated mesh if same topology.
Weight and Vertex paint don't change coordinates and thus don't need
crazyspace data, which allows using coordinates from normal evaluated
meshes.

Since painting uses original topology, the deform only mesh is used,
but if the fully evaluated mesh has the same topology, it is preferred.
This is useful because not only Geometry Nodes, but even simple weight
computation modifiers are excluded from the deform only mesh evaluation.

Differential Revision: https://developer.blender.org/D15501
2022-08-29 14:10:31 +03:00
e460050099 Merge branch 'blender-v3.3-release' 2022-08-29 12:45:14 +02:00
7bb08882ec I18n: Better wording for the skipped languages in language menu file. 2022-08-29 11:05:03 +02:00
613b6ad9e5 GPencil: New conversion to outline in draw mode
This new option converts the stroke to outline perimeter as soon as is drawn.

If no alternative material is set, the actual material is used.

The algorithm is similar to the new operator in D15664

Reviewed By: pepeland

Differential Revision: https://developer.blender.org/D15738
2022-08-29 09:47:08 +02:00
377b81ac07 Fix compilation issue in MTLQueryPool::allocate_buffer.
This compilation issue happened due to multiple patches being handled at the same
time one overwriting a correction of the other.
2022-08-29 08:34:47 +02:00
c4d9dca4a6 Cleanup: Add missing override keyword in mtl_backend. 2022-08-29 08:31:56 +02:00
91b88d3d94 Merge branch 'blender-v3.3-release' 2022-08-28 17:55:42 -04:00
7b56c74881 Update RNA to User manual mappings 2022-08-28 17:53:49 -04:00
e0414070d9 Cleanup: Slightly improve virtual array implementation consistency
Previously the base virtual array implementation optimized for
common cases where data is stored as spans or single values.
However, that didn't make sense when there are already
sub-classes that handle those cases specifically. Instead,
implement the faster materialize methods for each class.
Now, if the base class is reached, it means no optimizations
for avoiding virtual function call overhead are used.

Differential Revision: https://developer.blender.org/D15549
2022-08-28 14:40:49 -05:00
67f3259c54 Curves: Avoid creating types array when unnecessary
When the curve type attribute doesn't exist, there is no reason to
create an array for it only to fill the default value, which will add
overhead to subsequent "add" operations. I added a "get_if_single"
method to virtual array to simplify this check. Also use the existing
functions for filling curve types.

Differential Revision: https://developer.blender.org/D15560
2022-08-28 14:33:03 -05:00
28750bcf7e Cleanup: replace NULL with nullptr for C++ files 2022-08-28 20:52:28 +10:00
7269ee4dbb Cleanup: use const FontBLF arguments 2022-08-28 20:46:53 +10:00
206272621e Merge branch 'blender-v3.3-release' 2022-08-28 20:21:32 +10:00
4694d497b7 Merge branch 'blender-v3.3-release' 2022-08-28 20:19:02 +10:00
ff78f79abc Merge branch 'blender-v3.3-release' 2022-08-28 20:18:58 +10:00
7de290ea08 Fix crashes running operators in invalid contexts
Fix for running operators outside of expected contexts.

- UI_OT_view_drop (poll)
- UI_OT_view_item_rename (poll)
- OBJECT_OT_gpencil_modifier_move_to_index
- OBJECT_OT_modifier_move_to_index
- OBJECT_OT_geometry_nodes_input_attribute_toggle
- OBJECT_OT_geometry_node_tree_copy_assign
- OBJECT_OT_shaderfx_remove
- OBJECT_OT_shaderfx_copy
- POSE_OT_relax (& other pose slide operators).
2022-08-28 20:18:12 +10:00
219d109575 Fix crash in gpencil.brush_reset_all referencing freed memory
A reference to the active brush was kept even when it was freed.
2022-08-28 20:00:14 +10:00
1f9d0acfa9 Fix running transform without a region
Running transform in background mode or without a region would crash.
2022-08-28 19:55:52 +10:00
ff7a7a6f77 Merge branch 'blender-v3.3-release' 2022-08-27 09:12:14 +02:00
f7ce20e340 Cleanup: Remove two files committed by mistake.
Committed in rB3c7a6718ddc.
2022-08-27 09:09:41 +02:00
d527aa4dd5 UV: support constrain-to-bounds for uv rotation operator
Differential Revision: https://developer.blender.org/D15730
2022-08-27 17:01:55 +12:00
7459c0228e Cleanup: rename filename to filepath when used for full paths 2022-08-27 14:52:31 +10:00
d41acc23e1 CMake: include missing header files 2022-08-27 14:32:50 +10:00
bfca876c05 CMake: cleanup, rename INC_HD_CYCLES to SRC_HD_CYCLES_HEADERS
Our convention is to use `INC_*` for include directories,
this caused `make check_cmake` to incorrectly fail as it expected
these files to be include directories.
2022-08-27 14:32:50 +10:00
3cba80039d UV: bpy_extras.mesh_utils.mesh_linked_uv_islands raises error in edit mode
Maniphest Tasks: T86484

Differential Revision: https://developer.blender.org/D15778
2022-08-27 16:09:17 +12:00
f7027f2253 Cleanup: simplify key input handling for GHOST/Win32
- Don't create utf8 text for key release events.
- Reduce variable scope.
2022-08-27 13:47:17 +10:00
95162e7157 Cleanup: add missing braces for GHOST/Win32 2022-08-27 13:11:34 +10:00
de1a2d7988 Cleanup: pass notifiers as const 2022-08-27 12:54:26 +10:00
578dff7863 Fix assertion when notifiers weren't removed from the notifier queue set
Since [0] notifiers were cleared and left in the queue, while harmless
it meant the call to remove the notifier from the set was redundant.

Now set aside a category to tag notifiers as having been cleared and
skip them entirely.

[0]: 0aaff9a07d
2022-08-27 12:28:18 +10:00
955032ffb0 Cleanup: use C style comments for GHOST/Win32 text 2022-08-27 11:24:49 +10:00
37d835f0bc Fix T100582: Windows-10 Switching Desktops locks Ctrl Key
Regression in recent fix for T66088 [0]. caused by much older problem
introduced with [1] & [2].

Unlike other platforms, as of [1] GHOST/Win32 was keeping track of the
pressed modifier keys.

Since GHOST/Win32 cleared the modifier state on window activation [2]
and only changes to modifier state would generate key events, activating
the window and releasing the modifier would not send the release event.

Resolve this by removing the stored modifier state from GHOST/Win32,
always passing modifier press/release events through to Blender
(matching other GHOST back-ends).
Instead, use key-repeat detection to prevent repeated modifier keys
from being generated - an alternate solution to T26446.

[0]: 8bc76bf4b9
[1]: d6b43fed31
[2]: 6b987910e4
2022-08-27 07:36:00 +10:00
07ccb9b573 Cleanup: use 'len_v2'
Simplifies readability and avoids repeat casts.
2022-08-26 16:10:22 -03:00
6bea434c41 Cleanup: Move bmesh_query_uv.c to C++
Helpful for D14365.
2022-08-26 13:56:50 -05:00
6a9cf59ce1 Merge branch 'blender-v3.3-release' 2022-08-26 15:35:18 -03:00
e040aea7bf Transform: Use more general approach to node view update
With rBe6a557952ead, concerns were reported about missing updates when
the view is moved other than through the Edge Pan system.

Although the transform operator blocks navigation in general, it is
good to avoid these cases.
2022-08-26 15:34:38 -03:00
da022f3f48 Merge branch 'blender-v3.3-release' 2022-08-26 14:19:34 -03:00
0c8de0eb3b Fix T100632: Regression: Node border snap guide line not drawing properly
Caused by {rBd2271cf93926}.

Color values were being used without being initialized.
2022-08-26 14:18:11 -03:00
e6a557952e Fix T100633: Node Editor: Edge scrolling breaks node snapping
The view offset, calculated by the Edge Pan system, only affects the
position of the nodes, but forget to update:
- snapping data
- final value of transform
- values used for custom drawing

Therefore, to avoid having to update a lot of scattered data, the
`transformViewUpdate` utility has been implemented to recalculate input
values when the view changes.

This utility does more than is necessary to fix the bug, but with that,
it can work in any situation.
2022-08-26 14:17:55 -03:00
3c060b2216 Fix T100633: Node Editor: Edge scrolling breaks node snapping
The view offset, calculated by the Edge Pan system, only affects the
position of the nodes, but forget to update:
- snapping data
- final value of transform
- values used for custom drawing

Therefore, to avoid having to update a lot of scattered data, the
`transformViewUpdate` utility has been implemented to recalculate input
values when the view changes.

This utility does more than is necessary to fix the bug, but with that,
it can work in any situation.
2022-08-26 13:17:51 -03:00
cc9c4e2744 CustomData: Add function to get name of default layer
Used by D14365
2022-08-26 11:16:10 -05:00
167e2fda15 Merge branch 'blender-v3.3-release' 2022-08-26 18:09:05 +02:00
8181494ffe Fix assert in id remapper tests.
Was using uninitialized ID name, leading to unknown ID type.

Thanks at Ray molenkamp (@LazyDodo) for noting the issue.
2022-08-26 18:08:46 +02:00
aaea263be4 Cleanup: Fix const correctness in CustomData set name function
The function does modify the object since it changes the name of a layer
it owns. Ideally this wouldn't be possible, but raw pointers don't have
ownership semantics so this is a common problem with CustomData.
2022-08-26 10:57:43 -05:00
Luis Pereira
763cafc2b1 Fix T55284: error in Hybrid MultiFractal Musgrave texture
The calculation was revised to address two issues:
* Discontinuities occurring when detail was a non-integer greater than 2.
* Levels of detail in the interval [0,1) repeating the levels of detail in
  the interval [1,2).

This fixes Cycles, Eevee and geometry nodes.

Differential Revision: https://developer.blender.org/D15785
2022-08-26 17:27:43 +02:00
a1c8a17b4d IDManagement: fix missing WM name validation when using "keep current WM list" code path
The blendfile_liblink and blendfile_io python tests in debug fired an
assert that WMWinMan object was in Main database, but not in the ID
name map. This was caused by wm_window_match_do going into case 3
there: the new WM list is completely empty, the old list is not empty,
and it was directly using the old/current list (via
wm_window_match_keep_current_wm function), without actually
registering/validating the objects in it through the name map.

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D15787
2022-08-26 12:15:12 +02:00
51178fd4da UV: improve consistency for scale parameter of uvcalc_randomize_transform 2022-08-26 21:19:46 +12:00
3e51ebaf54 IDManagement: fix missing WM name validation when using "keep current WM list" code path
The blendfile_liblink and blendfile_io python tests in debug fired an
assert that WMWinMan object was in Main database, but not in the ID
name map. This was caused by wm_window_match_do going into case 3
there: the new WM list is completely empty, the old list is not empty,
and it was directly using the old/current list (via
wm_window_match_keep_current_wm function), without actually
registering/validating the objects in it through the name map.

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D15787
2022-08-26 11:49:02 +03:00
e1f8136230 Merge branch 'blender-v3.3-release' 2022-08-26 09:16:46 +02:00
60420f6ea4 Fix T100602: Incoming Vector in world shader for Eevee is inverted
Regression from {rBf4d7ea2cf61} where the direction was flipped.

Maniphest Tasks: T100602

Differential Revision: https://developer.blender.org/D15779
2022-08-26 09:13:55 +02:00
054cec404b Cleanup: use booleans 2022-08-26 15:58:32 +10:00
6bf2c73249 Cleanup: quiet GCC array bounds warning 2022-08-26 15:06:33 +10:00
e77ac31799 makesrna: type check bool/int/float/enum get/set callbacks
While converting types from callbacks isn't a bug, it's unlikely
we ever want to do this on purpose and can hide mistakes such as
silently converting floating point values to ints as happened
with Sequencer.frame_start.
2022-08-26 14:43:16 +10:00
5bd4aea29c Cleanup: use matching function signatures for RNA callbacks
Use matching int/float/boo types for RNA callbacks.
2022-08-26 14:37:16 +10:00
4a0dd1d435 Merge branch 'blender-v3.3-release' 2022-08-26 14:26:55 +10:00
c9723d9464 Fix Sequence.frame_start being rounded to int when assigned 2022-08-26 14:22:58 +10:00
65cd265235 CMake: disable IME for lite configuration 2022-08-26 13:28:45 +10:00
6fc7b37583 Cleanup: reduce variable scope 2022-08-26 12:51:46 +10:00
a3e1a9e2aa Cleanup: spelling in comments, format 2022-08-26 12:47:21 +10:00
ef51825c06 Fix incorrect UI scaling after changing monitors DPI under Wayland
Add a GHOST_kEventWindowDPIHintChanged event to ensure the UI is
properly updated.
2022-08-26 12:37:08 +10:00
047d0e6c4a Merge branch 'blender-v3.3-release' 2022-08-25 17:26:58 +02:00
Bastien Montagne
500d815478 Fix T100255: Make RigidBodyWorld (and effector_weights) collections refcounted.
Those collections were so far mainly just tagged as fake user (even
though a few places in code already incremented usercount on them).

Since we now clear the fakeuser flag when linking/appending data, ensure
that these collections are preserved by making these usages regular ID
refcounting ones.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15783
2022-08-25 17:21:39 +02:00
9b41ac6251 Revert "LibOverride: Preserve viewlayers when creating overrides of collecitons."
Commit is not working as expected in some cases, as revealed by
liboverride testcase entering infinite loop.

Code needs some more thinking.

This reverts commit ee7bd79b54.
2022-08-25 16:17:34 +02:00
093607423d Merge branch 'blender-v3.3-release' 2022-08-25 12:23:27 +02:00
b27856f12e Update liboverride operators to manual mapping. 2022-08-25 12:23:10 +02:00
ee7bd79b54 LibOverride: Preserve viewlayers when creating overrides of collecitons.
Usually, when overriding collections, the linked reference ones are
removed from the ViewLayer, and the overrides replace them.

This change to `layer_collection_sync` code makes it so that in case
there is a free viewlayer hierarchy matching the linked collection, it
gets re-used for the override one, instead of re-creating everything
from scratch.

To achieve this, resync process is split into two steps, first regular
collections are processed, then the override ones. This should ensure
an override does not steal the layers of its reference if the later is
still instantiated in the view layer.
2022-08-25 12:22:38 +02:00
d4764a385a Merge branch 'blender-v3.3-release' 2022-08-25 11:50:55 +02:00
9c2bc57cbd Fix Cycles oneAPI for a newer DPC++ compiler version 2022-08-25 11:50:22 +02:00
e50c7a244b Merge branch 'blender-v3.3-release' 2022-08-25 09:25:22 +02:00
714a3739da Fix T100599: dont reset parent inverse setting parent type the same
Since rBb100bdca25b1 the parent inverse was always reset in
ED_object_parent (also for just changing the parent type).

This does make sense (since there is no point keeping it when e.g
changing from "Bone" to "Object" or "Vertex" to "Object", for this to
really make sense it would have to be properly recalculated anyways
which does not happen afaict).

The reported issue was that setting the prop to the same value as it was
before (e.g. from "Object" to "Object") would still reset the parent
inverse which was really unexpected since from a user standpoint,
nothing has changed here.

So in case the value does not really change, we now just early out and
skip `ED_object_parent`.

Maniphest Tasks: T100599

Differential Revision: https://developer.blender.org/D15771
2022-08-25 09:22:55 +02:00
96d8367924 PyAPI: return faces instead of indices from bmesh_linked_uv_islands
Return faces instead of face indices from bmesh_linked_uv_islands
since BMesh indices aren't reliable when geometry is added/removed,
where the faces will still be valid.
2022-08-25 17:05:50 +10:00
012db9e820 Cleanup: replace dict with set for bmesh_utils.bmesh_linked_uv_islands
Also correct doc-string syntax.
2022-08-25 16:41:22 +10:00
de570dc87e Fix T78406: create uv randomize islands operator
Implement a new operator to randomize the scale, rotation and offset
of selected UV islands.
2022-08-25 18:09:32 +12:00
f36d8d59c2 Cleanup: remove redundant calculation in bmo_poke_exec
Mistake in [0] calculated the mean-face-center which wasn't used.

0: 23344bca6c
2022-08-25 15:14:34 +10:00
fcecbc5610 Cleanup: rename mat3_to_quat_is_ok to mat3_to_quat_legacy
Update comment, noting why this is kept.
2022-08-25 14:33:01 +10:00
be40f31d03 Keyframing: replace mat3_to_quat_is_ok with mat4_to_quat
Added [0] which notes in most cases results are the same but in some
cases the result seems better. While true at the time of writing since
then mat3_to_quat has been improved and used for nearly all matrix
to quaternion conversion.

0: 876cfc837e
2022-08-25 14:32:34 +10:00
a7650c6206 BLI_math: ensure non-negative matrices for mat3_to_quat calculations
Making the callers responsible for this isn't practical as matrices are
often passed indirectly to a functions such as mat3_to_axis_angle,
BKE_object_mat3_to_rot & BKE_pchan_mat3_to_rot.
Or the matrix is combined from other matrices which could be negative.

Given quaternions calculated from negative matrices are completely
invalid and checking only needs to negate matrices with a negative
determinant, move the check into mat3_to_quat and related functions.

Add mat3_normalized_to_quat_fast for cases no error checking on the
input matrix is needed such as blending rotations.
2022-08-25 13:48:31 +10:00
8593228a13 Cleanup: remove outdated, unhelpful comments 2022-08-25 13:36:54 +10:00
9f1c05d5cb Fix matrix/quaternion conversion with negative scaled cameras 2022-08-25 12:38:04 +10:00
a604ed0068 Fix accessing freed memory for GHOST/Wayland clipboard access 2022-08-25 10:52:36 +10:00
Mattias Fredriksson
87e8810dd0 Cleanup: Add asserts to curves data-block creation
Ref D14481
2022-08-24 18:22:39 -04:00
Mattias Fredriksson
1dae11ccb5 Cleanup: Improve comments
Add to comments in curves header, fix typo in attribute header.

Ref D14481
2022-08-24 18:22:29 -04:00
f593a560d3 Cleanup: Deduplicate RNA mesh element index retrieval
Reuse the subtraction, which simplifies adding assertions
and refactoring to remove the custom data pointers.
2022-08-24 15:41:55 -04:00
b19c51c7f4 Cleanup: Move outliner types to namespace, avoid C-style type definition
With C++ we should transition towards namespaces to avoid naming
collisions. Having the namespace in place is the first step for that
transition.

Plus, the `typedef` isn't necessary for struct/class/enum definitions
in C++, so avoid the verbosity it adds.
2022-08-24 20:10:15 +02:00
ce1f401b42 Merge branch 'blender-v3.3-release' 2022-08-24 19:17:14 +02:00
3a1ea04d46 Cleanup warning about missing pointer casting. 2022-08-24 19:16:18 +02:00
fc26e3fe19 Cleanup: Fix typo in comment
Added by mistake in 6718afdc8a.
2022-08-24 11:25:04 -04:00
5d4d5a2162 Merge branch 'blender-v3.3-release' 2022-08-24 17:12:01 +02:00
8b7293eb41 LibOverride: Fix (unreported) crashes in some cases, preserve active object on Clear, general cleanup.
Inconsistencies in update/tagging code between different code doing the
same 'Clear. liboverride operation lead to crashes in some cases.

Unify deg tagging and WM notifiers accross the three editor-level
codepaths performing the common Make/Reset/Clear operations.

Preserve if possible the active object accross Clear operation.

Several cleanup/rename/re-arangement of code to make it more consistent.
2022-08-24 17:11:36 +02:00
24dc84f156 Cleanup: rename new IDTemplate operator to create overrides to make.
Matches other operators' names and UI labels better.
2022-08-24 17:11:36 +02:00
61896947d4 Merge branch 'blender-v3.3-release' 2022-08-24 15:39:52 +02:00
e65f0337e9 Fix WITH_CYCLES_ONEAPI_BINARIES issues with make release
Fix typo in blender_release.cmake, and ensure that "make release" still works
when ocloc is not available. While a fatal error is useful for debugging, the
current convention is to disable features, especially in cases like this where
there is no simple way to make the feature work.

Differential Revision: https://developer.blender.org/D15774
2022-08-24 15:38:27 +02:00
be0a68f0d1 BLI_math: assert mat3_normalized_to_quat doesn't use a negative matrix
Add an assert to ensure callers don't pass in negative matrices as the
resulting quaternion is invalid.
2022-08-24 20:45:17 +10:00
489aeda034 Merge branch 'blender-v3.3-release' 2022-08-24 20:40:43 +10:00
8c38a994c6 Fix Quaternion.rotate(matrix) with negative matrices
Rotating a quaternion by a negative matrix gave an invalid result.

Follow up fix for T94231 which negated negative matrices too.
2022-08-24 18:59:04 +10:00
dc2d75d9bc Merge branch 'blender-v3.3-release' 2022-08-24 17:27:25 +10:00
62f764fad7 Fix T100606: Apply object transform fails with delta quaternion rotation
Apply transform failed to clear delta quaternion & axis-angle rotation.
2022-08-24 17:26:38 +10:00
02d13c2d2f Merge branch 'blender-v3.3-release' 2022-08-24 09:17:51 +02:00
62bd007646 Fix T100590: Crash when changing active image texture node
Mistake in own rBc76d7f7bde35.
Happened when no image was set in the Image Editor already (which is now
checked for).

Maniphest Tasks: T100590

Differential Revision: https://developer.blender.org/D15761
2022-08-24 09:15:14 +02:00
4fb64068a7 Cleanup: use determinant_m3(m) < 0 to implement is_negative_m3/m4
Use a more direct method of checking if a matrix is negative instead of
using cross & dot product.

Also replace some determinant_m3() < 0 checks with is_negative_m3.
2022-08-24 16:34:04 +10:00
f39c9d1596 Merge branch 'blender-v3.3-release' 2022-08-24 16:09:13 +10:00
10a4726a5b Fix T94231: Matrix.to_quaternion() returns invalid rotation
The result of mat3_normalized_to_quat isn't valid for negative matrices.

Isolate the fix to the Matrix.to_quaternion() instead of changing
mat3_normalized_to_quat to prevent unintended side effects elsewhere.
2022-08-24 16:07:56 +10:00
be81690b73 Merge branch 'blender-v3.3-release' 2022-08-24 10:20:52 +10:00
112a2c0627 Fix error from 21ea499558
Was not using the absolute index for comparison,
breaking the id_management test.
2022-08-24 10:20:05 +10:00
649807a8cd Cleanup: format 2022-08-24 09:22:26 +10:00
a6056b870b Fix T100494: Broken sculpt hide status undo/redo
Caused by 2480b55f21 using the undo step indices instead of the
indices of vertices in the mesh, causing the hide values to be swapped
around randomly in the mesh.
2022-08-23 14:09:46 -04:00
e36ced1dce Fix: Write hide status attributes for undo steps
We don't convert to the old mesh format when writing undo steps to
avoid overhead. So we can't skip writing the hide attributes then.
2022-08-23 13:50:47 -04:00
35c601269b Fix T100482: Face Set visibility reset after saving
The face hide attribute wasn't created in order to store the visiblity
from the face sets, it was only updated if it already existed.
2022-08-23 12:17:16 -04:00
486d27d32a Cleanup: Move paint.c to C++ 2022-08-23 12:01:37 -04:00
59aef1d717 Cleanup: Use utility to write palette color list 2022-08-23 11:19:07 -04:00
b649fc13ed Cleanup: Avoid using invalid attribute domain
The number of attribute domains isn't an attribute domain, so storing
ATTR_DOMAIN_NUM in a variable with an eAttrDomain type isn't correct.
In the cases it was used, the value wouldn't be accessed anyway.
2022-08-23 10:44:10 -04:00
c32bb58e5b Depsgraph: use more fine grained update tags for scenes
Ref D15710, this avoids unnecessary sequencer updates for some operations.
2022-08-23 15:27:16 +02:00
a87d3edb98 Build: add system for shipping with dynamic libraries on Linux and macOS
PLATFORM_BUNDLED_LIBRARIES gathers shared libraries that will be installed
to the lib/ folder. The Blender executable gets a relative rpath pointing to
this folder as part of the install step.

The build rpath is different and uses absolute paths, so that it works for
executables like tests that are in different locations, and to support the
case where the build and install folders are different.

The system is already used for the OpenMP library on macOS. But on Linux it
will only kick in once we start using shared libraries for dependencies.

This also removes Mesa libraries from the old location, as these would cause
Blender to start with software OpenGL.

Ref T99618
2022-08-23 15:27:16 +02:00
afb74149c1 Cleanup: consistent variable names for install target directories 2022-08-23 15:27:16 +02:00
ddad2f8672 Build: use package instead of git repo for sse2neon
More consistent with other libs and avoids issues where it would always be
rebuilt.
2022-08-23 15:27:16 +02:00
a77a1bcae7 Merge branch 'blender-v3.3-release' 2022-08-23 15:09:50 +02:00
efc9faef23 Fix T98954: Color management is very slow with sequencer sound
Function `rna_ColorManagement_update` tagged unnecesary updates.

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D15710
2022-08-23 15:08:46 +02:00
21ea499558 Fix T100286: Crash accessing freed depsgraph object instances
Invalidate depsgraph.object_instances when freed, this resolves a crash
when accessing the object instances after iteration has finished.

Unlike most other collections, object_instances is only valid while the
iterator is in-memory.

The Python/RNA API needs to inline int/string collection lookups so the
Python instance can be created before the iterator ends.

Reviewed By: mont29, sergey

Ref D15755
2022-08-23 22:56:54 +10:00
ffb6cc263f Cleanup: format 2022-08-23 22:55:48 +10:00
Jeroen Bakker
37533cd6cb ImBuf: Optimize GPU memory by using 1 component format for grayscale images
This is done by checking the number of bitplanes from the image buffer.
We assume that for float buffer to use the same bitplanes as it was a
byte buffer.

Then, the data of the image buffer is packed at the start of the `rect` or
`float_rect` before upload.

**Statistics - einar.v004.blend **

Note that not all grayscale textures have been stored as BW images so the
amount of memory that can be reduced would be more.

Without patch
```
104 Textures - 3294.99 MB (3294.47 MB over 32x32), 37 RTs - 192.52 MB.
Avg. tex dimension: 2201.88x1253.51 (2283.53x2202.13 over 32x32)
464 Buffers - 25.01 MB total 1.24 MB IBs 23.50 MB VBs.
3512.52 MB - Grand total GPU buffer + texture load
```

Patch applied
```
104 Textures - 2917.66 MB (2917.14 MB over 32x32), 39 RTs - 215.45 MB.
Avg. tex dimension: 2221.38x1252.75 (2323.28x2253.47 over 32x32)
467 Buffers - 25.01 MB total 1.24 MB IBs 23.51 MB VBs.
3158.13 MB - Grand total GPU buffer + texture load.
```

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15484
2022-08-23 14:35:39 +02:00
13b2716e1c Merge branch 'blender-v3.3-release' 2022-08-23 14:25:18 +02:00
65870821da Fix: OBJ import unused parameter warning
Since {rB2542fda14d85}, `r_node` is an unused parameter.
Changed `load_texture_image` to reflect that.

Differential Revision: https://developer.blender.org/D15759
2022-08-23 14:22:23 +02:00
Philipp Oeser
0bc95b7b40 Compositor: handle NODE_DO_OUTPUT in RNA when setting a node active
Main motivation is from T54314 where there was no way to read from a
Viewer image datablock after setting another viewer node active.

Part of the problem was addressed in rB16d329da284c (where handlers for
the compositing background job were added so that you can act after the
compositor has run), however there was still the remaining issue that
setting another viewer node active would not properly tag the node
NODE_DO_OUTPUT. This forced users into a complicated workaround (using
switch nodes feeding into a single viewer node).

Now handle NODE_DO_OUTPUT properly in RNA, too, and do proper updates so
that behavior from RNA matches that of the Node Editor when setting a
viewer node active.

ref T54314.

Reviewed By: JacquesLucke

Maniphest Tasks: T54314

Differential Revision: https://developer.blender.org/D15203
2022-08-23 14:22:04 +02:00
60e2dfd1e8 Fix T99524: GPencil not updating when frame num is changed
When changing the frame_number of a grease pencil frame, the grease
pencil object is not updated correctly. The frame stays where it
previously was.

The fix adds a `property_update` callback to the `frame_number` RNA
property.

Maniphest Tasks: T99524

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D15394
2022-08-23 13:53:44 +02:00
511ff898da Merge branch 'blender-v3.3-release' 2022-08-23 12:40:58 +02:00
1663530408 Fix T100318: handle custom nodes in field inferencing more gracefully
Custom nodes are not supported, but it shouldn't crash here.
2022-08-23 12:40:26 +02:00
65c6886284 Merge branch 'blender-v3.3-release' 2022-08-23 11:55:57 +02:00
95464a842c Fix T99932: video in node group does not play 2022-08-23 11:54:51 +02:00
Damien Picard
4ac96a483b I18n: make workspaces translatable
This makes workspaces more translatable:
- New Workspace menu
  - header
  - preset menus
  - preset entries
- workspace names upon factory file template load
- new workspace name upon workspace addition

To properly translate those names, an extraction function for
workspace names from app templates was added as well.

(Do not do anything when loading a user-saved file!)

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15727
2022-08-23 11:54:34 +02:00
22fdb88be5 Merge branch 'blender-v3.3-release' 2022-08-23 11:19:08 +02:00
d269ad3535 Fix T100578: Surface Deform modifier displays wrong in editmode
This was the case when the "Show in Editmode" option was used and a
vertexgroup affected the areas.

Probably an oversight in {rBdeaff945d0b9}?, seems like deforming
modifiers always need to call `BKE_mesh_wrapper_ensure_mdata` in
`deformVertsEM` when a vertex group is used.

Maniphest Tasks: T100578

Differential Revision: https://developer.blender.org/D15756
2022-08-23 11:07:26 +02:00
c76d7f7bde Fix T99493: better syncing between Node Editor and Image Editor
Since {rBb0cb0a785475}, changing the active texture in the Node Editor
would also change the current image in the Image Editor.
While this was an overall improvement, this was not desired when the
image currently looked at was a `Render Result` or a `Viewer Node`
(artists usually want to keep focus on these).

With this patch, syncing the active texture change from the Node Editor
to the Image Editor will now only happen if the Image Editor's current
image is not a Render Result or a Viewer Node.

NOTE: Syncing the active paint slot to the Image Editor still happens
(even if the Image Editor's current image is not a Render Result or a
Viewer Node), behavior was not changed since this is a much more
explicit action while texture painting and probably desired in that
case.

Maniphest Tasks: T99493

Differential Revision: https://developer.blender.org/D15749
2022-08-23 11:07:08 +02:00
a3548667bc Merge branch 'blender-v3.3-release' 2022-08-23 10:58:00 +02:00
5d67b52441 Fix T100562: Realize Instances node crashes when there is an attribute name collision 2022-08-23 10:57:28 +02:00
56205e9f31 Fix T100579: internal links are drawn when sockets are hidden 2022-08-23 10:35:38 +02:00
6319dcb230 Fix: Missing compositor domain priority for filter nodes
Domain priorities were accidentally left out of the patches for the
filter nodes. This patch adds them appropriately.
2022-08-23 09:33:28 +02:00
655e9eabc3 Cleanup: Turn filter node methods into an Enum
This patch turns the filter node methods into an enum and renames the
members from FILT into FILTER for easier writing.
2022-08-23 09:24:25 +02:00
78061e6c3e Fix: Compositor results are fuzzy with bilinear filtering
The realtime compositor sometimes produces fuzzy results when the
interpolation is set to bilinear. This was due to the domain realization
shader, which incorrectly sampled the input image.

This patch fixes such fuzziness by introducing a 0.5 offset to evaluate
the sampler at the center of pixels. Additionally, it makes sure the
centring offset is an integer offset by taking its floor, retaining the
previous 0.5 offset even with the difference in size is odd.
2022-08-23 09:06:16 +02:00
35cc755366 Cleanup: simplify partition functions
- Assign return arguments last instead of manipulating them.
- Remove redundant NULL assignment of return arguments.
2022-08-23 12:48:06 +10:00
7694678025 Cleanup: remove unnecessary NULL check 2022-08-23 12:18:01 +10:00
ee60aa9d01 Cleanup: match names between functions & declarations 2022-08-23 11:05:50 +10:00
a65e4e6139 check_cppcheck: skip files that hang, minor improvements
- Skip text_format_pov.c & text_format_pov_ini.c which caused
  cppcheck to hang.
- Enable '--inconclusive' checks as they can be useful.
2022-08-23 11:01:02 +10:00
7f6cd405b9 Merge branch 'blender-v3.3-release' 2022-08-22 18:16:09 +02:00
4fecf652e2 Fix T100568: triangulate node resets vertices to rest position
The triangulate node is not supposed to take shape keys into account.
This was likely a mistake in rBabf30007abdac2a5bf3a1.
2022-08-22 18:15:33 +02:00
3345e8ed3c Merge branch 'blender-v3.3-release' 2022-08-22 16:31:53 +02:00
Iliya Katueshenock
5fff6c419c Fix T100258: wrong spline length used in Spline Parameter node
Differential Revision: https://developer.blender.org/D15705
2022-08-22 16:30:18 +02:00
de00b892a7 Merge branch 'blender-v3.3-release' 2022-08-22 16:13:30 +02:00
Sonny Campbell
8265d08e7f Fix T90706: crash when deleting fluid sim geometry
Differential Revision: https://developer.blender.org/D15299
2022-08-22 16:00:39 +02:00
500e4d540a Merge branch 'blender-v3.3-release'
Conflicts:
	release/scripts/startup/bl_ui/space_userpref.py
2022-08-22 15:44:44 +02:00
Damien Picard
0b2be4fbc3 I18n: Fix lighting preferences error messages
While the current situation sort of works, a proper translation cannot
be achieved in every language. Separate messages for each lighting
type.
2022-08-22 15:34:27 +02:00
4ad471d67f I18n: systematically tag all messages in RNA_ENUM_ITEM_HEADING.
Add missing labels, and also add tooltips.

Unfortunately there is no way currently to extract two messages from a
single 'function' call, so unless those type of macros become very
widely used, would keep it as manual tagging.

Also disambiguate `case` in text context, pretty sure English is one of
the very rare languages to use this word for character case too.
2022-08-22 15:24:21 +02:00
Damien Picard
ee985fa925 I18n: disambiguate a few translations
- Keying (keyframe insertion)
- Roughness (particle children)
- New image, collection, text (in menus)
- Parents (particles)
- Wrap (text)
- Light (add menu)
- Empty (volume add menu)
- Empty (empty add menu)
- Cycles (f-curve modifier)
- Drag (workspace tool type)
- Power (light intensity)
- Power (math nodes)

This last change also moves all math operations in nodes to the
ID_nodetree context. It's needed only for some operations, but we
can't be more granular here.

Also...

- Fix context extraction for interpolation mode headers in F-Curves
  and GPencil interpolation operator
- Enable new translation: "Slot %d" in image editor
- Fix an English message in the node editor:
  "Replace the input image's alpha channels by..." -> channel

Ref. T43295

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15694
2022-08-22 14:33:07 +02:00
ba74704c9a Merge branch 'blender-v3.3-release' 2022-08-22 12:16:11 +02:00
c973d333da Fix T100527: Right click in the attribute name field crashes blender.
`UI_context_active_but_prop_get_templateID` became much more widely used
with recent rBfec254364884, which revealed that it did not do any check
on actual type of data it accesses, resulting easily in undefined
behavior.

Now also check the callback function pointer, this should be safe
enough.

Patch by @Severin (Julian Eisel), many thanks!
2022-08-22 12:15:50 +02:00
ad577d3b69 Merge branch 'blender-v3.3-release' 2022-08-22 11:49:32 +02:00
f29f023017 Enable oneAPI AoT binaries on Windows 2022-08-22 11:49:00 +02:00
b72c658cfd Enable oneAPI AoT binaries on Windows 2022-08-22 11:47:18 +02:00
9e23ab9f37 Fix: Memory leak in realtime compositor
There was a memory leak in the GPU code generator for the compositor
output. It was just due to a missing free in the GPU code generator
destructor, so this patch makes sure it is freed.
2022-08-22 10:57:24 +02:00
79dfd2eb7b EEVEE-Next: Fix shader compilation error.
This fixes a compilation error in eevee_light_culling_debug shader.

Some compilers complained when accessing the same data twice. Unclear
why. We should investigate that this change doesn't harm the performance
of the shader.

Although the light is a local variable it might clutter available
registers. If so it will harm developers during debugging.
2022-08-22 10:44:46 +02:00
d966ce718b EEVEE-Next: Fix shader compilation error.
Due to a copy-paste error there was an out of bound read. Some drivers
didn't complain about it, others did. This patch fixes the compilation
error by accessing the array within bounds.
2022-08-22 10:36:38 +02:00
0aeae0d0b9 Revert "Fix T99259: Python API: ViewLayer.aovs.remove isn't available"
This reverts commit ae7909010f.
2022-08-22 08:40:36 +02:00
Mangal Kushwah
ae7909010f Fix T99259: Python API: ViewLayer.aovs.remove isn't available
Imeplemented **ViewLayer.aovs.remove** by Adding a new rna function to call the internal **BKE_view_layer_remove_aov**, removed assert from **BKE_view_layer_remove_aov**.

Reviewed By: jbakker

Maniphest Tasks: T99259

Differential Revision: https://developer.blender.org/D15341
2022-08-22 08:36:19 +02:00
9581be930b Cleanup: remove dead code 2022-08-22 12:42:23 +10:00
2a43c9bb08 Cleanup: move inline unit system search into a function
Improved readability and remove redundant NULL checks.
Also remove redundant assignment.
2022-08-22 12:42:23 +10:00
212a3a23df Merge branch 'blender-v3.3-release' 2022-08-22 12:14:09 +10:00
f3bf497c2c Merge branch 'blender-v3.3-release' 2022-08-22 12:14:06 +10:00
edfa67a8cc Merge branch 'blender-v3.3-release' 2022-08-22 12:14:02 +10:00
dc644677cb Merge branch 'blender-v3.3-release' 2022-08-22 12:13:58 +10:00
c9144f0cbb Fix potential undefined behavior printing a NULL pointer string
Improve messages when the font directory can't be detected or is missing.
2022-08-22 12:10:41 +10:00
ed070b1223 check_cppcheck: update 'glew' exclusion since it's removal 2022-08-22 11:36:27 +10:00
b04514da5d Cleanup: match names between functions & declarations
Mostly update the declarations, in some cases rename in the function
especially when the names used were inconstant with related functions.
2022-08-22 11:20:40 +10:00
5bd1d63115 Cleanup: move model authors from the doc-string to the implementation
There is no need for details like this in API doc-strings.
2022-08-22 10:58:02 +10:00
a283e07e04 BLI: float4x4: Fix bug / typo in << operator 2022-08-21 12:45:10 +02:00
563404d8ad Fix T100430: Restore larger node socket snap hitbox
Restore old hitbox for connecting links to sockets.

Commit rBd9d97db018d2 improved the node socket snapping when nodes
are close together by decreasing the tolerance around the cursor when
checking for nodes in front, that might occlude the socket.
In doing so it also reduced the hitbox of the node socket itself that
extended outside of the node.

This commit restores the old node socket hitbox while keeping the
improved behavior when nodes are close together with the following
changes:
1) When looking for the socket under the cursor, iterate through the
nodes front to back, which prioritizes node sockets in the foreground.
2) Instead of checking for another node underneath the cursor it checks
if the socket is actually occluded by another node.

The way the occlusion test for sockets is tweaked you can now connect to
sockets that are only partially occluded, which is a bit more forgiving
than previously.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D15731
2022-08-21 10:20:17 +02:00
a0c28a8054 Fix T100430: Restore larger node socket snap hitbox
Restore old hitbox for connecting links to sockets.

Commit rBd9d97db018d2 improved the node socket snapping when nodes
are close together by decreasing the tolerance around the cursor when
checking for nodes in front, that might occlude the socket.
In doing so it also reduced the hitbox of the node socket itself that
extended outside of the node.

This commit restores the old node socket hitbox while keeping the
improved behavior when nodes are close together with the following
changes:
1) When looking for the socket under the cursor, iterate through the
nodes front to back, which prioritizes node sockets in the foreground.
2) Instead of checking for another node underneath the cursor it checks
if the socket is actually occluded by another node.

The way the occlusion test for sockets is tweaked you can now connect to
sockets that are only partially occluded, which is a bit more forgiving
than previously.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D15731
2022-08-21 10:12:50 +02:00
acf083a5bf BLF: Fix FT_Get_Advance Wrong Value Without Size
Fix possibility of getting invalid fixed-pitch advance size.

See D15735 for more details.

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

Own Code.
2022-08-19 17:16:22 -07:00
c9a9967903 Outliner: Workaround for big performance issue in Library Overrides mode
When displaying the Hierarchies view of the Library Overrides display
mode in a specific Heist production file, Blender would become
unresponsive for about 30 seconds and every redraw in the Outliner would
lag noticably. Issue is that the sum of hierarchy elements is multiple
thousands, and that really brings the Outliner to its knees. I've looked
into some improvents and committed a few minor ones already, but it
seems it's really the big sum of elements causing the issue. There
doesn't appear to be a single bottle-neck.

To work around this, "lazy build" children, so that children of
collapsed elements are not actually created. This brings the tree
building down to some tens of miliseconds, and redrawing becomes
rather lag-free again, even with big parts of the tree un-collapsed.

Problem: Searching still needs to build the entire tree, so it's
essentially unusable right now. Should we disallow searching
altogether?
2022-08-19 22:22:40 +02:00
c2a6c3a4e2 Outliner: Refactor how lazy-building of children is done
Makes the lazy-building (where children are only built when the parent
isn't collapsed) more generic, so more display modes can use it. So far
this was hardcoded for the "Data API" display mode.

This will be used to work around a big performance issue with the
Library Overrides Hierachies view in a complex production file, see
following commit.
2022-08-19 22:22:25 +02:00
3a1ae5a02a Outliner: Workaround for big performance issue in Library Overrides mode
When displaying the Hierarchies view of the Library Overrides display
mode in a specific Heist production file, Blender would become
unresponsive for about 30 seconds and every redraw in the Outliner would
lag noticably. Issue is that the sum of hierarchy elements is multiple
thousands, and that really brings the Outliner to its knees. I've looked
into some improvents and committed a few minor ones already, but it
seems it's really the big sum of elements causing the issue. There
doesn't appear to be a single bottle-neck.

To work around this, "lazy build" children, so that children of
collapsed elements are not actually created. This brings the tree
building down to some tens of miliseconds, and redrawing becomes
rather lag-free again, even with big parts of the tree un-collapsed.

Problem: Searching still needs to build the entire tree, so it's
essentially unusable right now. Should we disallow searching
altogether?
2022-08-19 22:21:11 +02:00
231078441f Outliner: Refactor how lazy-building of children is done
Makes the lazy-building (where children are only built when the parent
isn't collapsed) more generic, so more display modes can use it. So far
this was hardcoded for the "Data API" display mode.

This will be used to work around a big performance issue with the
Library Overrides Hierachies view in a complex production file, see
following commit.
2022-08-19 22:21:10 +02:00
8115d31248 Outliner: (Refactor) Use C++ map instead of GHash
This container is type safe and contains a few nice optimizations,
although they shouldn't make a big difference here in practice. The
hashing now uses our default hashing method which reduces code
complexity and seems to perform slightly better in my tests.

For a Heist shot with a highly complex library overrides hierarchy in
the Outliner this reduces the tree building time from around 25 to 23.6
seconds here. However the main design change for performance is yet to
come, all this is just general code refactoring (which at least
shouldn't make performance worse).
2022-08-19 22:21:04 +02:00
6b9209ddfa Merge branch 'blender-v3.3-release' 2022-08-19 21:02:02 +02:00
51b79e4775 Fix T96133: Cycles viewport render crash with NVIDIA GPUs on macOS 2022-08-19 20:40:44 +02:00
4b62970dd3 Cleanup: replace CHECK_TYPE macro with static_assert
To avoid conflicts with BLI headers and simplify code.
2022-08-19 20:36:02 +02:00
6ef4267d5e Merge branch 'blender-v3.3-release' 2022-08-19 17:52:52 +02:00
be5c296e52 Fix T100502: GPencil Primitive apply offset when using Stroke mode
The offset was applied in stroke mode and this was wrong.
2022-08-19 17:52:12 +02:00
78e0c936c1 Merge branch 'blender-v3.3-release' 2022-08-19 17:32:55 +02:00
8f9b812d79 Fix build error on i386 due to wrong use of float_t
Was supposed to be float, likely copy paste error from int32_t.
2022-08-19 17:29:02 +02:00
0c8749788c Fix build error on mips64el architecture
Same as D12194, name "mips" conflicts on such systems.
2022-08-19 17:28:51 +02:00
Loren Osborn
db46251209 Fix ubsan warnings about indexing into null pointers
Ref T99382

Differential Revision: https://developer.blender.org/D15390
2022-08-19 16:27:22 +02:00
Nathan Vegdahl
a06c9b5ca8 Cycles: add Sobol-Burley sampling pattern
Based on the paper "Practical Hash-based Owen Scrambling" by Brent Burley,
2020, Journal of Computer Graphics Techniques.

It is distinct from the existing Sobol sampler in two important ways:
* It is Owen scrambled, which gives it a much better convergence rate in many
  situations.
* It uses padding for higher dimensions, rather than using higher Sobol
  dimensions directly. In practice this is advantagous because high-dimensional
  Sobol sequences have holes in their sampling patterns that don't resolve
  until an unreasonable number of samples are taken. (See Burley's paper for
  details.)

The pattern reduces noise in some benchmark scenes, however it is also slower,
particularly on the CPU. So for now Progressive Multi-Jittered sampling remains
the default.

Differential Revision: https://developer.blender.org/D15679
2022-08-19 16:27:22 +02:00
35a41a49a8 Merge branch 'blender-v3.3-release' 2022-08-19 16:25:41 +02:00
1608406600 Fix: nurbs basis cache not computed before it is used 2022-08-19 16:24:24 +02:00
Germano Cavalcante
e4f1d71908 Fix T89399: Mouse wrapping causes erratic movement
As mentioned in T89399, "the source of this bug is that cursor wrap
moves the cursor, but when it later checks the mouse position it hasn't
yet been updated, so it re-wraps".

As far as I could see, this happens for two reasons:
1. During the first warp, there are already other mousemove events in the queue with an outdated position.
2. Sometimes Windows occasionally and inexplicably ignores `SetCursorPos()` or `SendInput()` events. (See [1])

The solution consists in checking if the cursor is inside the bounds right after wrapping.
If it's not inside, it indicates that the wrapping either didn't work or the event is out of date.
In these cases do not change the "accum" values.

1. f317d619cc/src/video/windows/SDL_windowsmouse.c (L255))

Maniphest Tasks: T89399

Differential Revision: https://developer.blender.org/D15707
2022-08-19 10:09:58 -03:00
d94aadf235 Fix: Crash when realtime compositor node is unlinked
The realtime compositor crashes when some nodes are unlinked.

This happens for GPU material nodes if it was compiled into its own
shader operation. Since it is unlinked, the shader operation will have
no inputs, a case that the current code didn't consider.

This patch fixes this by skipping code generation for inputs if no
inputs exist for the shader operation.
2022-08-19 15:03:14 +02:00
1eeb174e72 Cleanup: update comment about undo & smooth-view 2022-08-19 21:04:57 +10:00
188f7585a1 Fix T100323: Outliner: Do not allow to delete objects from an override collection. 2022-08-19 12:42:52 +02:00
ab3e9c47d8 Merge branch 'blender-v3.3-release' 2022-08-19 16:24:51 +10:00
5c9bea25d0 Fix crash accessing PyEval_GetFrame from Python's crash handler
Check the thread-state before accessing PyEval_GetFrame, since this is
a crash handler, the state of the Python interpreter isn't known.
2022-08-19 16:23:29 +10:00
9855264c8d UI: increase range of font size for text editor & console
Useful when using different DPI & UI scales.
2022-08-19 15:54:24 +10:00
0322802314 Cleanup: minor changes to BLF API
- Use upper-case for defines.
- Use u-prefix for unsigned types.
- Use snake case for struct members.
- Use const struct for unicode_blocks & arguments.
- Use doxy style comments for struct members.
- Add doxy sections for recently added code.
- Correct code-comments (outdated references).
- Remove 'e' prefix from struct UnicodeBlock/FaceDetails
  (normally used for enums).
2022-08-19 14:46:45 +10:00
1a3bc09e89 Cleanup: spelling in comments 2022-08-19 13:49:13 +10:00
2a15040777 Merge branch 'blender-v3.3-release' 2022-08-19 13:46:37 +10:00
97f9015ed0 Cleanup: unused argument warning 2022-08-19 13:41:49 +10:00
0491ba09c2 Cleanup: Remove data duplication from BLI_any.hh support variables
Use `inline constexpr` instead of `static constexpr` to prevent these
variables from being duplicated in each translation unit that includes
the BLI_any.hh header.

Differential Revision: https://developer.blender.org/D15698
2022-08-18 19:40:46 -07:00
cd516d76b6 Cleanup: replace uint cd_loop_uv_offset with int
See https://wiki.blender.org/wiki/Style_Guide/C_Cpp#Integer_Types
2022-08-19 14:19:13 +12:00
e80a9d2645 Cleanup: lint, unused_vars 2022-08-19 13:44:55 +12:00
a5c696a0c2 UV: respect uv selection for smart uv, cube, sphere and cylinder projection
Differential Revision: https://developer.blender.org/D15711
2022-08-19 13:35:03 +12:00
529f0427fc Cleanup: spelling in comments 2022-08-19 11:29:32 +10:00
aa82f91c92 Cleanup: uvedit_*_select, replace BMEditMesh* with BMesh*
Change `cd_loop_uv_offset` from signed to unsigned, forcing
a crash if passed invalid input.

Differential Revision: https://developer.blender.org/D15722
2022-08-19 13:00:48 +12:00
4f8c15daf4 Fix logical errors in RNA_path_array_index_token_find
This function never succeeded as an off by one error checking the last
character always indexed the null byte.
The 'for' loop was broken as of [0] since the unsigned number could wrap
around with some RNA paths causing out of bounds memory access.

This is an example where tests would have caught the problem early on,
RNA path tests are planned as part of D15558.

[0]: 11b4d0a3c3
2022-08-19 10:54:45 +10:00
Germano Cavalcante
f5aac6662d Fix GPUShader.format_calc documentation
`format_calc` instead of `calc_format`.
2022-08-18 20:03:07 -03:00
d772e11b5a BLF: Gamma Correction
Gamma correction for glyph coverage values.

See D13376 for details and examples.

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

Reviewed by Julian Eisel
2022-08-18 12:34:23 -07:00
9707080a9d Cleanup: Remove unused outliner function
This is unused, and I don't see a need for it.
2022-08-18 21:14:54 +02:00
9961aae1e6 Merge branch 'blender-v3.3-release' 2022-08-18 20:31:34 +02:00
d2255aa4ed Outliner: Refactor outliner tree-hash interfaces with C++
- Turn storage into an object with "automatic" memory management (RAII)
  so freeing is implicit and reliable.
- Turn functions into member functions, to have the data and its
  functions close together with controlled access that increases
  encapsulation and hiding implementation details.
- Use references to indicate null is not an expected value.
- Related minor cleanup (comments, use const etc.)

Couldn't spot any changes in performance.
2022-08-18 20:22:55 +02:00
75cca8360f Outliner: Add commented out benchmarking calls for tree rebuilding
This way you can benchmark the tree rebuilding by simply commenting out
a single line. Not that it was difficult before, but this makes it as
easy as it gets, with basically no knowledge of existing benchmarking
tools required.
2022-08-18 20:22:55 +02:00
de794adc0c Outliner: Use C++ container for tree hash element storage
Simplifies code quite a bit, since this was doing the typical work of
such a container. I may remove this vector entirely as I'm working on
performance fixes, not sure, but simplifying this helps reason about the
design.

Couldn't spot performance differences in some benchmarks, and I wouldn't
expect any. Maybe some minor onces thanks to the small buffer
optimization of `blender::Vector`.
2022-08-18 20:22:55 +02:00
5148e1c60c Cleanup: General style improvements for Outliner tree hashing code
- Use C++ nullptr instead of C's NULL (clang-tidy warns otherwise)
- Use early exit/continue to avoid indentation (helps readability
  because visual scope of no-op branches is minimized).
- Use const for local variables, to separate them clearly from the
  mutable ones.
- Avoid struct typedef, this is not needed in C++
2022-08-18 20:22:55 +02:00
6a4f4810f3 Fix T100246: Cycles GPU render error when adding AO node during viewport render 2022-08-18 20:04:22 +02:00
e11c899e71 Cycles: disable Metal inlining optimization on Apple GPUs
This gave a 1.1x speedup, however also leads to very long compile times
that make it seems like Blender has stopped working.

This can be brought back in the future behind an option that users can
explicitly enabled.

Fix T100102

Ref D14923, D14763, T92212
2022-08-18 20:01:29 +02:00
790d57b88a Fix build error when not using unity build 2022-08-18 18:56:17 +02:00
b375019ebc Merge branch 'blender-v3.3-release' 2022-08-18 17:26:54 +02:00
f2f680d82d Fix T100475: Crash on undoing the created override from ID template.
We only need to 'manually' remap RNA ID pointer property to the newly
created override if the owner itself was not already a local override.

Also some more minor tweaks to notifiers sent when creating the
override.
2022-08-18 17:26:12 +02:00
885e7abed1 Realtime Compositor: Implement bilateral blur node
This patch implements the bilateral blur node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-08-18 17:16:14 +02:00
d8be33333f Merge branch 'blender-v3.3-release' 2022-08-18 17:09:52 +02:00
96206aa98a Enable oneAPI AoT kernels for Release on Linux
Windows still needs some work on the buildbot side, so keep
that disabled for the time being.
2022-08-18 17:03:59 +02:00
7d4aa0db9e Realtime Compositor: Implement despeckle node
This patch implements the despeckle node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-08-18 16:53:16 +02:00
41dd5a6c38 GPencil: Fix wrong material index in previous commit 2022-08-18 16:35:04 +02:00
aa7b2f1dd9 GPencil: New operator to convert strokes to perimeter.
This operator converts any stroke of gpencil with a center line into a stroke with the perimeter.

It's possible to assign the active material, keep current or create a new material for all perimeters.

The conversion is only done for strokes with a material using `Stroke`. Only `Fill` strokes are not converted.

Known issues: As the perimter has not boolean implementation, some perimeters can be overlaped. This could be solved in the future when a new 2D boolean library will be developed.

Reviewed By: mendio, pepeland, frogstomp

Differential Revision: https://developer.blender.org/D15664
2022-08-18 16:30:27 +02:00
4d4a84bbeb Merge branch 'blender-v3.3-release' 2022-08-18 15:50:05 +02:00
582704a758 LibOverride: Preserve active object when creating overrides. 2022-08-18 15:49:50 +02:00
a149c4aaee LibOverride: Fix more crashes when creating overrides from IDTemplates.
Assigning to RNA ID pointer properties will not _always_ trigger a
rebuild of the outliner tree, so try to enforce this when actually
creating overrides.
2022-08-18 15:49:50 +02:00
9a65dca37c Merge branch 'blender-v3.3-release' 2022-08-18 15:26:30 +02:00
8a799b00f8 Fix T100423: Addon's custom context menu entries get overridden by other addons
This introduces a new `UI_MT_button_context_menu` class which is
registered at startup. Addons can append/prepend draw functions to this
class, in order to add their custom context menu entries.

The new class replaces the old `WM_MT_button_context` class, thus
requiring a small change in addons using this feature. This is done
because addons were previously required to register the class
themselves, which caused addons to override each other's context menu
entries.

Now the class registration is handled by Blender, and addons need only
append their draw functions. The new class name ensures that addons
using the old method don't override menu entries made using the new
class.

Menu entries added with the legacy `WM_MT_button_context` class are
still drawn for backwards compatibility, but this class must not be used
going forward, as any addon using it still runs the risk of having its
menu entries overridden, and support for the legacy class is subject to
removal in a future version.

Reviewed By: campbellbarton

Maniphest Tasks: T100423

Differential Revision: https://developer.blender.org/D15702
2022-08-18 14:46:30 +02:00
a7652bf2f7 Fix T100470: Crash when changing the domain type 2022-08-18 14:29:56 +02:00
756308f9e4 Merge branch 'blender-v3.3-release' 2022-08-18 12:36:41 +02:00
c375750423 Fix T100476: Shift click to create overrides on objects not working.
Case where object was directly linked and not owned by a linked
collection was not properly handled, added some level of support for it
now.

Note that the behavior may not always be ideal in cases where the linked
object would be linked in many different local collecitons, hard to get
best solution always from this Editor given limited hierarchy data
available here.
2022-08-18 12:24:54 +02:00
80b7902a56 Fix (unreported) outliner not redrawing on 'removed ID' notification.
Could lead to crahses in some cases, with outliner drawing code
accessing freed ID data in its tree.
2022-08-18 12:23:47 +02:00
1854d31321 Realtime Compositor: Implement directional blur node
This patch implements the directional blur node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-08-18 12:20:18 +02:00
b828d453e9 Realtime Compositor: Implement filter node
This patch implements the filter node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-08-18 12:00:14 +02:00
6cb0a122df Realtime Compositor: Implement bokeh image node
This patch implements the bokeh image node for the realtime compositor.

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

Reviewed By: Clement Foucault
2022-08-18 11:53:08 +02:00
0aaff9a07d WM: optimize adding notifier duplication check
Use a GSet to check for duplicate notifiers, for certain Python scripts
checking for duplicate notifiers added considerable overhead.

This is an alternative to D15129 with fewer chances to existing logic.
2022-08-18 15:55:45 +10:00
7be1c8bbae Cleanup: de-duplicate notifier add function 2022-08-18 14:45:49 +10:00
fcd72756ab Cleanup: early return, reduce right-shift 2022-08-18 14:45:47 +10:00
f5234474bd Fix T97618: Clipped text labels intermittently missing ellipses
The offending line was attempting to artificially add width to the
length of the string in order to "avoid ellipsing text that nearly
fits". The line doesn't actually appear to do anything beneficial, and
it causes the nasty text bug.

Old:
{F13029695}

New:
{F13327308}

Reviewed By: campbellbarton

Ref D15585
2022-08-18 11:01:53 +10:00
2a2ca3292a CMake: always unset CMAKE_REQUIRED_* variables after use
Always unset these variables after use as they could interfere with
other checks made afterwards.
2022-08-18 10:01:27 +10:00
cfe5bf4b22 Cleanup: spelling, format 2022-08-18 08:46:24 +10:00
listout
f197b1a1f1 CMake: support building with musl libc
Instead of using macros like GLIBC we can use the CMake build
systems internal functions to check if some header or functions are
present on the running system's libc.

Add ./build_files/cmake/have_features.cmake to add checks for
platform features which can be used to set defines for source
files that require them.

Reviewed By: campbellbarton

Ref D15696
2022-08-18 08:12:56 +10:00
0a84cc691d Cleanup: Move subdiv_mesh.c to C++ 2022-08-17 18:11:01 -04:00
f60b47f2c8 UI: Fix inconsistency use of uppercase/capitalization
Since VBO stands for vertex buffer object it should always be uppercase.

"Vertex" in "vertex buffer object" should only be capitalized at the
beginning of a sentence.
2022-08-17 22:23:48 +02:00
646ef6e157 UI: Avoid the word "Use" in checkbox labels
As per the writing styles guidelines.
https://wiki.blender.org/wiki/Human_Interface_Guidelines/Writing_Style
2022-08-17 22:14:28 +02:00
0be6427429 Outliner: Compile outliner tree-hashing files in C++
Some performance issues were found here with a heavy production file and
we want to look into using some C++ to improve things for this ancient
code.
2022-08-17 21:00:22 +02:00
d8223bdc38 Cleanup: Improvements to Outliner tree writing code, add assert
Comments there weren't really helpful, took me a while to get what they
try to say. This attempts to add a better explanation. Also add an
assert for a previous, implicit (but commented) assumption, and some
minor cleanups.
2022-08-17 20:27:52 +02:00
ecf4a7835d Outliner: Avoid unnecessary Outliner storage copy
Was always creating a copy of `SpaceOutliner`, even though it's only
needed for one conditional branch. This is a shallow copy, so shouldn't
be that expensive, still trivial to avoid.
2022-08-17 20:27:52 +02:00
f6a6665947 deps/windows: bzip2 1.0.8 for python
backport of python PR 31735 [1]

[1] https://github.com/python/cpython/pull/31735
2022-08-17 12:16:22 -06:00
31279d522b Fix: Compiler warning in macro after recent C++ conversion
The iterator parameters struct should be initialized to zero in both
C and C++. Using memset seems to be the only reliable way to do that.
2022-08-17 13:16:48 -04:00
27f2ff6b5b Cleanup: Remove redundant use of evaluated non-mesh objects
Metaball, curve, text, and surface objects use the geometry component
system to add evaluated mesh object instances to the dependency graph
"for render engine" iterator. Therefore it is unnecessary to process
those object types in these loops-- it would either be redundant work
or a no-op.
2022-08-17 13:02:45 -04:00
04a04e9f69 Merge branch 'blender-v3.3-release' 2022-08-17 18:08:37 +02:00
244ef1f0f5 LibOverride: Remove the 'make all editable' user preferences.
This behavior is now implicitely controlled by the 'Make' operations,
based either on context or selected items.
2022-08-17 18:08:18 +02:00
9a67aac8d7 Cleanup: Fix outdated comment 2022-08-17 12:05:20 -04:00
a73cc81646 Cleanup: Remove unused function
Also remove two DispList references I missed in the previous commit.
2022-08-17 12:03:26 -04:00
6718afdc8a Cleanup: Fix outdated comments referring to DispList 2022-08-17 11:57:21 -04:00
316194c384 Merge branch 'blender-v3.3-release' 2022-08-17 11:13:13 -04:00
92493a5fa7 Fix: Node editor context path for curves objects
The object data path item wasn't added properly.
Also remove some of the unnecessary variables and forward declarations.
2022-08-17 11:11:28 -04:00
eaa87101cd Metaball: Evaluate metaball objects as mesh components
With the ultimate goal of simplifying drawing and evaluation,
this patch makes the following changes and removes code:
- Use `Mesh` instead of `DispList` for evaluated basis metaballs.
- Remove all `DispList` drawing code, which is now unused.
- Simplify code that converts evaluated metaballs to meshes.
- Store the evaluated mesh in the evaluated geometry set.

This has the following indirect benefits:
- Evaluated meshes from metaball objects can be used in geometry nodes.
- Renderers can ignore evaluated metaball objects completely
- Cycles rendering no longer has to convert to mesh from `DispList`.
- We get closer to removing `DispList` completely.
- Optimizations to mesh rendering will also apply to metaball objects.

The vertex normals on the evaluated mesh are technically invalid;
the regular calculation wouldn't reproduce them. Metaball objects
don't support modifiers though, so it shouldn't be a problem.
Eventually we can support per-vertex custom normals (T93551).

Differential Revision: https://developer.blender.org/D14593
2022-08-17 10:20:25 -04:00
71f091a631 Cleanup: Remove unused Outliner search element storage
This is old code to keep track of an active search element, so you could
step through the search results. This isn't used anymore, and not needed
since searching now filters the tree to only show matches. If we ever
wanted to have support for stepping through elements again, that should be
done via the active element instead.
2022-08-17 16:15:03 +02:00
db054b447d Cleanup: Move view3d_select.c to C++
Almost entirely adding casting and standard clang tidy changes.
Also switch to `blender::Vector` instead of the macro-based `BLI_array`.
2022-08-17 09:54:01 -04:00
923e10d751 Fix: Crash if Movie Clip node has an empty movie
The movie clip GPU texture free function doesn't do null checks, so make
sure the movie clip is not null before freeing.
2022-08-17 15:11:35 +02:00
f4040da3ef install_deps: replace libglew by libepoxy.
Should have been part of D15291/rBa296b8f694d1.

ref. T99618
2022-08-17 14:23:17 +02:00
1e427e224b Merge branch 'blender-v3.3-release' 2022-08-17 14:15:33 +02:00
224869acc5 Use report warning opening file written by newer Blender binary
handle_subversion_warning() was reporting with RPT_ERROR type, replaced
with RPT_WARNING.

RPT_ERROR would stop python scripts opening files written by newer
Blender binary with bpy.ops.wm.open_mainfile(), preventing further code
from running. This does not seem right since Blender itself still loads
the files.

Ran into this checking T100446 in 2.93.

Differential Revision: https://developer.blender.org/D15712
2022-08-17 14:11:51 +02:00
517d622057 Cleanup: conversion warnings in GCC 2022-08-17 21:34:13 +10:00
6ab5bced61 Merge branch 'blender-v3.3-release' 2022-08-17 13:01:09 +02:00
1c63e4233d Cleanup: Fix "unused m_system" warnings
The dummy `m_system` variable is not needed in the GHOST_NULL classes
2022-08-17 12:54:46 +02:00
fec2543648 LibOverride: Add Make/Reset/Clear entries to IDTemplate contextual menu.
Matches main operations exposed in View3D and the Outliner.
2022-08-17 12:10:31 +02:00
a078262804 Merge branch 'blender-v3.3-release' 2022-08-17 17:07:31 +10:00
839ece6477 Fix T100411: Invert Axis Pan option ignored for Lock Camera Pan/Zoom 2022-08-17 17:06:09 +10:00
a123fc9e22 GHOST/EGL: Only draw grey into buffers attached to windows
Avoid redundant drawing, match GHOST/GLX behavior.
2022-08-17 16:21:13 +10:00
b1d3097fa9 WM: update comment about window redraw for thumbnails 2022-08-17 15:56:00 +10:00
e52fd904e8 Merge branch 'blender-v3.3-release' 2022-08-17 15:45:25 +10:00
288cd705eb Merge branch 'blender-v3.3-release' 2022-08-17 15:44:30 +10:00
95fd163074 Cleanup: spelling in comments 2022-08-17 15:43:17 +10:00
a1f10b10b6 Fix freed memory access checking events with debug builds
Pressing escape when rendering a viewport animation would
access the freed even and crash (with ASAN enabled).

Always check the context's window before the event as this is a signal
a file was loaded or the window was closed (and it's events freed).
2022-08-17 15:33:30 +10:00
04dba9349d Fix: build issue with MSVC
empty initializers are not allowed in C99
introduced by rB2481be90e38d36abc06501c395105fa1833baf1c
2022-08-16 22:09:58 -06:00
5fab3bc630 Merge branch 'blender-v3.3-release' 2022-08-17 05:12:34 +02:00
06a01168f6 Fix T100079: Encoding with DNxHD fails due to bad parameters
Constant_rate_factor mode was not updated when choosing DNxHD codec in
RNA update function.

Ensure `FFM_CRF_NONE` is set.
2022-08-17 04:58:45 +02:00
48da8c4040 Fix T98462: Save Screenshot (glReadPixels) fails under Wayland
Use an off-screen buffer for the screen-shot operator.

Reading from the front-buffer immediately after calling swap-buffers
failed for GHOST/Wayland in some cases.
While EGL can request to preserve the front-buffer while drawing,
this isn't always supported. So workaround the problem by avoiding
use of the front-buffer entirely.
2022-08-17 12:58:17 +10:00
54827bb7cd Cleanup: shadow warning 2022-08-17 12:57:30 +10:00
2481be90e3 WM: ensure AlembicImportParams are always initialized
Initialize all members before assignment, ensuring newly added
members are never left uninitialized.
2022-08-17 12:51:07 +10:00
1f2a5fea87 Cleanup: strip blank lines around comment blocks 2022-08-17 12:51:07 +10:00
9d2136f272 Cleanup: add missing doxy sections 2022-08-17 12:51:07 +10:00
26d6b27ebc Cleanup: quiet shadow warning 2022-08-17 12:51:07 +10:00
836c07f29c UV: grab tool supports live unwrap
Differential Revision: https://developer.blender.org/D15709
2022-08-17 14:47:35 +12:00
74ea0bee9c UV: add geometry driven uv relax brush
Differential Revision: https://developer.blender.org/D15530
2022-08-17 14:11:57 +12:00
29c1d736c4 Cleanup: compiler warnings, clang-tidy 2022-08-17 11:57:53 +10:00
413c399ab8 Cleanup: Move view layer array utils from macros to functions
These macros don't compile in C++ because of taking an address of a
temporary and use of designated initializers. Besides that, using
functions can improve debugging and type safety.

Differentil Revision: https://developer.blender.org/D15693
2022-08-16 21:25:14 -04:00
d39abb74a0 BLF: FreeType Optional Caching
Implementation of the FreeType 2 cache subsystem, which limits the
number of concurrently-opened FT_Face and FT_Size objects, as well as
caching information like character maps to speed up glyph id lookups.
This time with the option of opening FontBLFs that are not cached.

See D15686 for more details.

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

Reviewed by Brecht Van Lommel
2022-08-16 15:02:56 -07:00
09640ab291 Fix T99872: Crash Loading Embedded Fonts - Master
Commit rBc0845abd897f to 3.4 (master) uses font's filepath without
checking if it exists, therefore crashing on embedded fonts since
they do not have a filepath (loaded from memory).

See D15703 for more details

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

Reviewed by Brecht Van Lommel
2022-08-16 12:43:10 -07:00
ccf31810d6 Cleanup: use a structure for Alembic import parameters
Also renammed some parameters and sprinkled a dash of documentation.
2022-08-16 19:59:22 +02:00
a3b3871ca1 Merge branch 'blender-v3.3-release' 2022-08-16 18:54:27 +02:00
233c9b3cad Cleanup: Unused parameters. 2022-08-16 18:54:04 +02:00
879ebcec7e Merge branch 'blender-v3.3-release' 2022-08-16 18:40:08 +02:00
669c924e07 Fix (unreported) bug in liboverride 'leaves' detection.
Loopback ID pointers should be ignored here as well, otherwise they are
very efficient at preventing proper detection of 'leaf' override IDs in
a hierarchy.
2022-08-16 18:39:47 +02:00
Fynn Grotehans
cdfe2e1c3f UI: Add View pie to File Browser
Adds a pie menu to the File Browser for convenient switching between vertical list, horizontal list and thumbnail view.

Uses the same shortcut as other View pie menus (`ACCENT_GRAVE`).

{F12811673}

Reviewed By: #user_interface, pablovazquez, Severin

Differential Revision: https://developer.blender.org/D13874
2022-08-16 18:10:18 +02:00
b247588dc0 Cleanup: some refactoring in mapped mesh extraction
* Flip the logic to first detect if we are dealing with an unmodified mesh
  in editmode. And then if not, detect if we need a mapping or not.
* runtime.is_original is only valid for the bmesh wrapper. Rename it to clarify
  that and only check it when the mesh is a bmesh wrapper.
* Remove MR_EXTRACT_MAPPED and instead check only for the existence of the
  origindex arrays. Previously it would sometimes access those arrays without
  MR_EXTRACT_MAPPED set, which according to a comment means they are invalid.

Differential Revision: https://developer.blender.org/D15676
2022-08-16 18:09:27 +02:00
74d716ce23 Fix error/crash in hidden edge drawing after recent changes
Mistake in 2480b55 using the wrong array.
2022-08-16 18:09:27 +02:00
fefe229de3 Merge remote-tracking branch 'origin/blender-v3.3-release' 2022-08-16 18:08:46 +02:00
5f2667aa71 Licenses: Attribution document for Blender 3.3
A few libraries were updated and a few added.

There are a few depedencies to intel oneAPI which I did not include, since we
refer already to Intel oneAPI already.
2022-08-16 18:08:09 +02:00
ed2d2cbdd2 Licenses: Attribution document for Blender 3.2
A few libraries were updated, a few were added, and a few were missing
from the previous license document.
2022-08-16 18:06:35 +02:00
e08f06c7a6 Merge branch 'blender-v3.3-release' 2022-08-16 16:36:18 +02:00
8cf52e8226 Fix T98773: GPU subdivision issues with UV editor display
This fixes missing selection updates in UV editor, both with GPU subdivision
and with the Modified Edges display option for modifiers in general.

It also fixes the UV editor incorrectly showing the cage mesh with deformed
coordinates. These are not yet supported by the UV selection system.

Changes:

* Always read selection state from the editmesh when building batches. The
  flags in the evaluated mesh can be outdated as selection bypasses depsgraph
  evaluation for performance, and instead may just clear the batches.
* runtime.is_original is only valid for the bmesh wrapper. The check for
  building the UV cage should only use that if the mesh is a bmesh wrapper.
* Don't create cage batches for objects whose mesh is in edit mode, but that
  are not themselves in edit mode, there is no need.

Differential Revision: https://developer.blender.org/D15658
2022-08-16 16:01:01 +02:00
a1b8013cc3 Cleanup: compiler warning 2022-08-16 16:00:40 +02:00
850126ab44 Merge branch 'blender-v3.3-release' 2022-08-16 15:43:24 +02:00
a42896a8a1 LibOverride: Refactor of menu entries in the View3D.
Move override creation into their own menu, add entries for reset and
clear operations.
2022-08-16 15:42:04 +02:00
Jeroen Bakker
8af983ba78 EEVEE-Next: Reduce image bindings.
This change combines the diffuse/specular light passes into a single texture
array, freeing up an image binding for cryptomatte.

When diffuse/specular light pass and/or requested a
texture array will be allocated. Only when specular light is requested 2 images will always be allocated. This increases the
memory overhead when viewing the specular light renderpass in the viewport. For final rendering it is a common scenario that none
or both are requested.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15701
2022-08-16 15:10:21 +02:00
a70eace19b Merge branch 'blender-v3.3-release' 2022-08-16 14:39:34 +02:00
8aa094263b Fix T100412: LibOverride: shift click on the modifier link button do not create override
Add support for the (geometry)node tree case.

Also add warning about not being implemented for other types.
2022-08-16 14:36:58 +02:00
90c14b1e44 Merge branch 'blender-v3.3-release' 2022-08-16 14:21:33 +02:00
a93f6a5429 LibOverride: Tweaks to new menus in Outliner.
Also add new outliner liboverride operators mapping to the manual,
though this is useless currently as this feature is not working in many
part of the UI, including the Outliner contextual menu.
2022-08-16 14:20:29 +02:00
e650cdd72a Fix T100375: Renaming items from the outliner does not update the despgraph.
Only object renaming was properly depsgraph-tagged, now all IDs (and
their sub-data like bones etc.) should be properly handled.
2022-08-16 14:14:21 +02:00
1221a4049c Merge branch 'blender-v3.3-release' 2022-08-16 13:50:19 +03:00
efdcef7855 Fix T100421: OBJ importer in 3.3 does not keep the vertex order
While fixing T100302 (rBd76583cb4a1) I did not realize that the
change in imported vertex order would actually matter. Turns out, it
does for morph targets / mesh shape keys. So redo the fix in a way
that does not change the vertex order. Fixes T100421.
2022-08-16 13:49:37 +03:00
7bfd78d450 Merge branch 'blender-v3.3-release' 2022-08-16 18:33:23 +08:00
accf38c1d1 Fix T100435: Use evaluated material for line art loading.
Materials can be changed by other evaluations like geometry nodes,
now handles that kind of situation.
2022-08-16 18:32:43 +08:00
42179fed71 GPU: ShaderCreateInfo: Use variadic template instead of default arguments
This should reduce the issue described in T100431.
This is also cleaner and without arbitrary argument limit.
2022-08-16 11:55:10 +02:00
66822319d3 UV: add constrain-to-bounds support for uv relax, uv grab and uv pinch
Differential Revision: https://developer.blender.org/D15683
2022-08-16 18:26:04 +12:00
3c351da89f UV: improve uv sculpt tools with boundary support and pin support
Fix boundary conditions for the Relax UV tool with the Laplacian method.

Add Pinned UV support to Relax UV tool (all modes) and Pinch UV tool.

Differential Revision: https://developer.blender.org/D15669
2022-08-16 17:16:45 +12:00
8841bd9660 GHOST/Wayland: Add NDOF support
Logic for NDOF devices is shared with X11, process events using
GHOST_NDOFManagerUnix when WITH_INPUT_NDOF is enabled.
2022-08-16 12:27:42 +10:00
3a8c57cf9d Support Ctrl-C to cancel rendering with headless builds
The original intention from [0] was to force background-mode when built
WITH_HEADLESS or WITH_PYTHON_MODULE, with the else clause setting the
signal handler for Ctrl-C. Since WITH_PYTHON_MODULE now disables all
signal handlers this check no longer makes sense.

[0]: 9d9c05a101
2022-08-16 10:51:14 +10:00
9d9c05a101 Cleanup: spelling in comments 2022-08-16 10:38:26 +10:00
c4eb70e543 Cleanup: format 2022-08-16 10:38:26 +10:00
75e652027c Cleanup: warnings 2022-08-16 10:38:26 +10:00
c22256f387 Merge branch 'blender-v3.3-release' 2022-08-15 17:18:33 -07:00
2d19038c6c Sculpt: Fix T100379: Anchored brush tags all nodes for update
Node tagging needed to happen after the undo node's null check.
2022-08-15 17:17:27 -07:00
f80f600b8e Sculpt: Fix T100379: Anchored brush tags all nodes for update
Node tagging needed to happen after the undo node's null check.
2022-08-15 17:13:45 -07:00
7f3eb055dd Sculpt: Improve sculpt debug draw
* Fixed crash in debug draw code.  Apparently this is
  only used by PBVH draw?
* Debug draw code can now be forcibly enabled in release
  mode (i.e. RelWithDebugInfo) by uncommenting a commented
  out #define.
* Fixed colors in debug draw mode.
* PBVH node boxes in debug mode now flash a different color
  when they are updated.
2022-08-15 17:01:17 -07:00
c5feb4e6fe Sculpt: Write documentation in sculpt_undo.c 2022-08-15 15:16:27 -07:00
3f9299e45d Sculpt: Fix redo panel bugs
SCULPT_undo_push_begin no longer takes an explicit
name.  Instead it takes a wmOperator pointer and uses
op->type->name for the name.  This is necassary for
the redo panel to work and should fix the entire class
of bugs related to misspelled undo push names.

Cases where the calling operator is not registered
may use SCULPT_undo_push_begin_ex if desired; it
takes a name string as before.
2022-08-15 14:52:02 -07:00
6b49b54bb1 Sculpt: Blank out redo panel for stroke operator
Unfortunately we do need the panel enabled to prevent
undo bugs.
2022-08-15 13:20:09 -07:00
74e6218c35 Fix T100106: Cycles poor playback performance with still image and auto refresh
The auto refresh option should be ignored in this case.
2022-08-15 19:30:31 +02:00
b43b62191c EEVEE-Next: HiZ Buffer: New implementation
This new implementation does all downsampling in a single compute shader
dispatch, removing a lot of complexity from the previous recursive
downsampling.

This is heavilly inspired by the Single-Pass-Downsampler from GPUOpen:
https://github.com/GPUOpen-Effects/FidelityFX-SPD
However I do not implement all the optimization bits as they require
vulkan (GL_KHR_shader_subgroup) and is not as versatile (it is only
for HiZ).

Timers inside renderdoc report ~0.4ms of saving on a 2048*1024 render for
the whole downsampling. Note that the previous implementation only
processed 6 mips where the new one processes 8 mips.
```
EEVEE ~1.0ms
EEVEE-Next ~0.6ms
```

Padding has been bumped to be of 128px for processing 8 mips.

A new debug option has been added (debug value 2) to validate the HiZ.
2022-08-15 18:36:19 +02:00
3195a38120 Introduce headless OpenGL rendering on Linux
With this patch true headless OpenGL rendering is now possible on Linux.
It changes the logic of the WITH_HEADLESS build flag.

The headless backend is now always available with regular builds and
Blender will try to fall back to it if it fails to initialize other
backends while in background mode.

The headless backend only works on Linux as EGL is not used on Mac or Windows.
libepoxy does support windows and mac, so this can perhaps be remedied in the future.

Reviewed By: Brecht, Jeroen, Campbell

Differential Revision: http://developer.blender.org/D15555
2022-08-15 16:54:29 +02:00
8ffc11dbcb Cleanup OpenGL linking and related code after libepoxy merge
This cleans up the OpenGL build flags and linking.
It additionally also removes some dead code.

One of these dead code paths is WITH_X11_ALPHA which actually never was
active even with the build flag on. The call to use this was never
called because the default initializer for GHOST was set to have it off
per default. Nothing called this function with a boolean value to enable it.

These cleanups are needed to support true headless OpenGL rendering.
Without these cleanups libepoxy will fail to load the correct OpenGL
Libraries as we have already linked them to the blender binary.

Reviewed By: Brecht, Campbell, Jeroen

Differential Revision: http://developer.blender.org/D15554
2022-08-15 16:47:20 +02:00
a296b8f694 GPU: replace GLEW with libepoxy
With libepoxy we can choose between EGL and GLX at runtime, as well as
dynamically open EGL and GLX libraries without linking to them.

This will make it possible to build with Wayland, EGL, GLVND support while
still running on systems that only have X11, GLX and libGL. It also paves
the way for headless rendering through EGL.

libepoxy is a new library dependency, and is included in the precompiled
libraries. GLEW is no longer a dependency, and WITH_SYSTEM_GLEW was removed.

Includes contributions by Brecht Van Lommel, Ray Molenkamp, Campbell Barton
and Sergey Sharybin.

Ref T76428

Differential Revision: https://developer.blender.org/D15291
2022-08-15 16:10:29 +02:00
3551b0a672 Fix T99255: Strips inserting incorrectly
When dropping file to sequencer timeline, coordinates for strip position
and overlap handling are used even if not set.

Reset internal state in on_drag_start callback and set is_modal
variable only if coordinates are updated. This way when dragging file
from external file browser, strip is added at current frame as before
modal operator was implemented.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D15333
2022-08-15 14:20:38 +02:00
90be364ca9 Merge branch 'blender-v3.3-release' 2022-08-15 14:01:34 +02:00
3897ff105e Fix T99955: Crash with 'Cache Result' and all render layers are disabled
Ensure render passes are allocated in the result prior to writing them.

Alternative could be to not write empty passes, but that is kind of
different from perspective of s one who reads the file.

Differential Revision: https://developer.blender.org/D15692
2022-08-15 14:01:18 +02:00
3aeacb9ab3 Merge branch 'blender-v3.3-release' 2022-08-15 13:53:42 +02:00
12e5b92c9c Cleanup: fix typos
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D15680
2022-08-15 13:48:50 +02:00
e949d6da5b Cycles: simplify handling of ray differentials
* Store compact ray differentials in ShaderData and compute full differentials
  on demand. This reduces register pressure on the GPU.
* Remove BSDF differential code that was effectively doing nothing as the
  differential orientation was discarded when making it compact.

This gives a 1-5% speedup with RTX A6000 + OptiX in our benchmarks, with the
bigger speedups in simpler scenes.

Renders appear to be identical except for the Both displacement option that
does both displacement and bump.

Differential Revision: https://developer.blender.org/D15677
2022-08-15 13:48:02 +02:00
8c77fa558a Cleanup: make format 2022-08-15 13:47:14 +02:00
7be7280c57 Fix build error in libc_compat when using musl libc
Checking for the existence of and using __GLIBC_PREREQ can't be done in the
same conditional.

Contributed by listout.

Differential Revision: https://developer.blender.org/D15690
2022-08-15 13:46:13 +02:00
d8841d0aa3 Fix T100394: Regression: Duplicating a modifier causes a crash
Need to update relations when modifiers are added or removed
since those create nodes in the dependency graph.

Added an assert statement to point at possible culprit so
that issues can be fixed more quickly.
2022-08-15 12:19:27 +02:00
3c9956fe55 Cleanup: Suppress compilation warning in eevee_lights.
Temporarily commented out LightModule::input_depth_tx until it is used to hide a
compilation warning.
2022-08-15 11:58:19 +02:00
Damien Picard
8a205b4036 Fix status bar keymap items during modal operations
The status bar keymap items still don't get translated because the
TIP_ translation introduced by rBe1974ae30e46 uses the wrong context:
it uses the default context, while the extraction introduced in
rB630b961f234e uses ID_WINDOWMANAGER.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15684
2022-08-15 09:51:20 +02:00
Damien Picard
e79312df6e I18n: translate recent files and bookmarks in the file browser
This is not dynamic: it only happens when the dir is added to the
list--automatically for recent files, and by the user for bookmarks.
Entries can then be manually renamed like other dirs. They will
keep the same name if the language is changed afterwards.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15629
2022-08-15 09:48:47 +02:00
77c867a5ee Cleanup: simplify sin_cos_from_fraction
Multiply numerator and denominator by 8 to split circle into octants.
Use symmetry and negation to increase precision.
2022-08-15 15:47:02 +12:00
4a11c0aabb Fix regression: crash with uv constrain to bounds without image
Merge confusion between cc1daa9b76 and 0d62e963b0.
2022-08-15 15:05:57 +12:00
659b63751d EEVEE-Next: Light: Add light evaluation support
This is the same implementation as the old one.
2022-08-14 20:40:04 +02:00
67d7792503 EEVEE-Next: Light: New light module
Compared to the previous implementation this has a limit of 65536 lights
per scene. Lights exceeding this limit will be ignored.

This also introduce fine grained GPU light culling, making rendering
many lights in a scene more efficient as long they don't overlap much.

Compatible light panels have been unhidden.

Note: This commit does not include surface evaluation, only light culling.
2022-08-14 20:40:04 +02:00
1226f5848d DRW: Add intersection and shape libraries for GLSL
These are meant to provide easy shape and AABB operation for culling.

They are currently incomplete but can be extended as one see fits.

The `common_debug_shape_lib.glsl` contains helper to draw thoses shapes.
2022-08-14 20:40:04 +02:00
0f7a5c4070 DRW: Debug: Fix print template
It was impossible to print literals like `drw_print(5)`.
2022-08-14 20:40:04 +02:00
89a2cb9297 DRW: Debug: Fix drw_debug_sphere not positioning and scaling the sphere
It was an oversight.
2022-08-14 20:40:04 +02:00
c81c5358ac GPencil: Engine: Make GL lights declaration optional
This avoid some macro name clashing with other engines where this struct
is not needed.
2022-08-14 20:40:04 +02:00
4b14fea38e GPU: Fix shader builder compilation
Was missing a stub.
2022-08-14 20:40:04 +02:00
407f11c55f Cleanup: Move object_vgroup.c to C++ 2022-08-14 14:32:54 -04:00
39bad22008 Cleanup: Add comments about deprecated flags 2022-08-14 09:19:40 -04:00
64f0c25a46 Fix: Incorrect access of mesh hide layers
Mistake in 2480b55f21
2022-08-13 22:34:11 -04:00
c2c019dda8 Fix Cycles MetalRT compile error 2022-08-13 19:55:38 +02:00
b5e92c3dfe Merge branch 'blender-v3.3-release' 2022-08-12 18:55:28 -03:00
ffd4f4a486 Fix T100354: Home key being the grave accent in french keyboard layout
I'm still not sure how the `0xFF` value came about, but it's not a
valid virtual key code.

Therefore it should not be used in `MapVirtualKey`.
2022-08-12 18:54:39 -03:00
dcfe7f795c BLF: Adjustments to Static Font Details
Adjust static font details so that we can properly display Arabic
contextual letter forms. And so that alphabetical ligatures are loaded
from language-specific fonts.

See D15678 for more details

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

Own Code.
2022-08-12 11:57:53 -07:00
3de18e16dd Merge branch 'blender-v3.3-release' 2022-08-12 17:57:10 +02:00
c1c0473a7e Fix out of bounds read in LineArt if there are only interestion edges
In this case the array allocation would allocate an array of size zero.
This would then later lead to out of bounds memory reads.

Now the code will skip zero length allocations.
2022-08-12 17:56:36 +02:00
0efb6d8a83 Merge branch 'blender-v3.3-release' 2022-08-12 12:13:52 -03:00
82fe475f06 Fix T100370: Depth choice for "Add Cube" tool always using Surface
As the surface normal is calculated along with the coordinates, the
surface depth was always being used when surface orientation was set.

Therefore, even calculated, ignore the surface depth when it is not
required.

Also promote an optimization when neither orientation nor depth is required.
2022-08-12 12:13:24 -03:00
6c6e59e846 Merge branch 'blender-v3.3-release' 2022-08-12 16:23:28 +02:00
fd57f520ac Py API doc: Add warning that py-defined property accessor callbacks may be called in threaded context.
At least Depsgraph evaluation and liboverride diffing do process IDs in
parallel, so python code in py-defined properties should not access any
data outside of their owner ID.

Ref. T100203.
2022-08-12 16:23:12 +02:00
62eb21e3ce Fix T100203: Freeze using override_hierarchy_create with Object level property with custom getter function.
As suggested by @brecht, use the `BPy_BEGIN`/`END_ALLOW_THREADS` macros.

Note that there may be other bits of code needing this too.
2022-08-12 16:23:12 +02:00
d13ed3c157 Merge branch 'blender-v3.3-release' 2022-08-12 16:14:51 +02:00
515a15f200 Fix syntax error introduced in previous commit 2022-08-12 16:13:09 +02:00
e7908c0790 Merge branch 'blender-v3.3-release' 2022-08-12 16:04:42 +02:00
79787bf8e1 Cycles: Improve denoiser update performance when rendering with multiple GPUs
This patch causes the render buffers to be copied to the denoiser
device only once before denoising and output/display is then fed
from that single buffer on the denoiser device. That way usually all
but one copy (from all the render devices to the denoiser device)
can be eliminated, provided that the denoiser device is also the
display device (in which case interop is used to update the display).
As such this patch also adds some logic that tries to ensure the
chosen denoiser device is the same as the display device.

Differential Revision: https://developer.blender.org/D15657
2022-08-12 16:00:54 +02:00
8af5267495 Merge branch 'blender-v3.3-release'
Conflicts:
	source/blender/editors/space_outliner/tree/tree_element_overrides.cc
2022-08-12 15:22:12 +02:00
27105af938 Cleanup: unused debug variable. 2022-08-12 15:20:43 +02:00
110356d8ad Merge branch 'blender-v3.3-release' 2022-08-12 15:18:37 +02:00
47af1ce8ac Cleanup: leftover debug prints. 2022-08-12 15:18:10 +02:00
4e5f9bbd34 Merge branch 'blender-v3.3-release'
Conflicts:
	source/blender/editors/space_outliner/outliner_tools.cc
2022-08-12 15:17:12 +02:00
c73cc15e07 LibOverride: Rework Outliner contextual menu.
Follow-up to design discussions here at the studio, add liboverride
operations into their own sub-menu, with three main entries:
- Create: Create, or enable for user editing, override hierarchies.
- Reset: Keep overrides data, but reset all local changes to the
  reference linked data values.
- Clear: like reset, but also turn editable overrides back to system
  overrides (aka non user editable).

Those three options can all operate either on the selected items, their
content only, or both.

Advanced operations are moved into a "Troubleshoot Hierarchy" sub-menu,
where one can resync, resync enforced, and fully delete library
overrides. Those operations always affect a whole override hierarchy,
regardless of which items are selected or not.
2022-08-12 15:11:59 +02:00
886768a699 CMake: correct linking order regression
Library sorting from [0] caused WITH_GPU_BUILDTIME_SHADER_BUILDER
to fail. It's possible there are missing dependencies that caused
the change in order to break, for now revert that change.

[0]: 19b5524d1c
2022-08-12 22:13:50 +10:00
223d623891 Cleanup: remove use_normals arugment to MOD_deform_mesh_eval_get
Accessing the normals creates them on demand so there was no need
to pass an argument requesting them.
2022-08-12 22:10:02 +10:00
afc71a0512 Merge branch 'blender-v3.3-release' 2022-08-12 21:51:18 +10:00
f4aec3719f Merge branch 'blender-v3.3-release' 2022-08-12 21:51:16 +10:00
4dc9a8a21e Fix T100191: Crash with the wave modifier using normals in edit-mode 2022-08-12 21:49:06 +10:00
4d2e2a6691 Fix T100350: missing brush falloff preview in sculpt mode 2022-08-12 13:46:34 +02:00
d42b61014b Merge branch 'blender-v3.3-release' 2022-08-12 12:42:35 +02:00
e0e4005582 Cleanup: Typos in comments. 2022-08-12 12:42:03 +02:00
74645d969b Merge branch 'blender-v3.3-release'
Conflicts:
	source/blender/blenkernel/BKE_lib_override.h
2022-08-12 12:40:46 +02:00
afd2e9ebc3 Fix (unreported) infinite tie building Outliner liboverride hierarchy tree.
In complex scenes featuring thousands of connections between IDs in
their liboverride hierarchies (e.g. Heist files), the time required to
check if tree items were available (before allocated a new one) would
become insanely long (O(n^2)).

This commit brings it back to roughly a constant time, only re-checking
the whole array for unused items once in a while (once every 10k times
currently), since in almost all cases is the index after `lastused`
value is not unused, and you have reached the end of the currently used
array of items, you actually need to 'allocate' a new one anyway.

It also improves the handling of `lastused` index, in particular in
`tse_group_add_element`.

This makes switching to the Outliner override hierarchy view in Heist
scenes from virtually infinite time (more than 30mins for sure) to about
20 seconds on my machine. Still far from being effectively usable.

Note that this is only a bandaid fix anyway, root of the issue is that
this view has to deal with way too many items in its tree, current code
is not designed for that. Either outliner has to improve its tree
handling (by only building subsets of the whole tree maybe?), or we have
to cull/filter out some of the ID relationships between overridden IDs
to make this view actually usable. Maybe limit the depth of the tree?
2022-08-12 12:37:10 +02:00
7f44dc79a6 Fix (unreported) crashes in Outliner override hierarchy view.
Fix wrong assumption that 'embedded' IDs are only ever used by their
owners. This is especially not true with shape keys.

Also small optimization by adding an eraly abort when both IDs are the
same (i.e. an ID has a pointer to itself).
2022-08-12 12:37:10 +02:00
12b3616895 IDType get_owner: add an optional hint about owner ID.
In some cases, there is a chance code already knows who might be the
owner of the given ID, in which case it can be more efficient to check
it first (especially in cases like embedded node trees or scene
collections, where the only other way is to loop over all possible
owners currently).

Will be used in next commit in some Outliner fix.
2022-08-12 12:37:10 +02:00
498e26fa0f Fix T100138: Use double for LineArt intersection record.
The use of `float` for intermediate intersection record led to some
inaccuracy which caused flickering in intersection lines. Now fixed.
2022-08-12 15:40:58 +08:00
7f733e294d Merge branch 'blender-v3.3-release' 2022-08-12 14:43:53 +10:00
95cc5c6081 Fix T96885: Drag Fallback on Tweak is using Move instead
Since [0] (fix for T95591), the tweak tools fallback action used tweak
instead of press.

This was enabled so tools such as "Measure" & "Add Cube" could use
fallback tools (otherwise is wasn't possible to add a new ruler without
also selecting for e.g.), however this is of limited use since both
tools support dragging anywhere to activate, making them less useful
with other selection tools beside tweak (box/lasso for e.g.).

Resolve by disabling the fallback option for tools where using the
tweak tool to select is undesirable. Selection by clicking with
"Measure" & "Add Cube" is still supported as this is also set in the
3D view's key-map.

[0]: 0e51defcf4
2022-08-12 14:24:31 +10:00
b751275af2 Cleanup: repeated words in strings 2022-08-12 12:46:31 +10:00
996cb4008d Cleanup: repeated words in comments 2022-08-12 12:38:54 +10:00
266a125b11 Cleanup: use sizeof() for better readability 2022-08-12 12:21:47 +10:00
f145366ae0 Cleanup: add missing braces, quite warnings by casting 2022-08-12 12:13:45 +10:00
a6d2fcef9f Cleanup: group translation imports 2022-08-12 12:07:52 +10:00
a1926c04b4 Cleanup: remove unnecessary ifdef 2022-08-12 11:25:10 +10:00
269e037ff4 Cleanup: replace misleading use of 'true' for the bit-field size
Also use a bit-field for SnapObjectParams.keep_on_same_target
2022-08-12 11:20:56 +10:00
c321572456 Cleanup: screw modifier comments & naming
Rename dist to dist_sq as it's the squared distance,
also prefer __func__ in temporary allocated arrays.
2022-08-12 11:18:00 +10:00
408687c75f Cleanup: use 'filepath' for fill paths 2022-08-12 11:14:31 +10:00
fe63124c3e Cleanup: add missing braces in GHOST 2022-08-12 11:13:07 +10:00
7347252f0f Cleanup: remove unnecessary icon assignment 2022-08-12 11:05:45 +10:00
d99ec7ff9e Cleanup: clang-tidy GHOST Context/Event/TimerManager 2022-08-12 11:04:21 +10:00
75c5b21a1c Cleanup: update comments in MANTA_main.cpp 2022-08-12 11:03:24 +10:00
42698b2dd9 Cleanup: use enum type for argument 2022-08-12 11:02:37 +10:00
dfd2570d28 WM: define WM_OT_drop_blend_file path as a file-path, skip-save
File paths have special handling of non-utf8 characters, so it's
best to use the FILE_PATH sup-type for all file-paths.
2022-08-12 10:59:14 +10:00
d4a082bc70 Cleanup: use short names for verts & polys as they're unambiguous
Follow conventions used in most existing code.
2022-08-12 10:56:27 +10:00
0c0c361123 Cleanup: replace magic number with flag 2022-08-12 10:48:15 +10:00
8649ac0ca8 Cleanup: early exit ui_but_extra_operator_icon_mouse_over_get
Early exit when the button has no extra icons, avoiding a redundant
transformation from mouse to button coordinates.
2022-08-12 10:41:39 +10:00
a2247c271c Cleanup: typo in selection check
In practice this is harmless as in most cases checking selected
vertices is enough, however as the intention is to check all 3 elements
it's best to do so.
2022-08-12 10:37:28 +10:00
282a861e11 Fix incorrect custom-data layer access for hide layers
Error in [0], missed in review.

[0] 2480b55f21
2022-08-12 09:16:09 +10:00
62d1ed0120 Cleanup: replace term face with poly
Be consistent with naming to avoid mixing MPoly/MFace.
2022-08-12 08:57:38 +10:00
344919240c Fix: Broken mesh hide status RNA accessors
Mistake in 2480b55f21.
Also deduplicate some of the code to find the indices of mesh elements.
2022-08-11 17:56:08 -04:00
d2b1e4712d BLF: Mutex Lock Glyph Cache Per Font, Not Global
Only lock access to our glyph caches per-font, rather than globally.
Also upgrade from spinlocks to mutexes.

See D15644 for more details.

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

Reviewed by Brecht Van Lommel
2022-08-11 12:52:07 -07:00
2fc7e15164 Fix: Use of uninitialized variable in recent commit
Mistake in 2480b55f21.
2022-08-11 14:40:42 -04:00
c9d821294f Cycles: take into account time limit for progress bar
This change allows the Cycles progress report system to take into conderation
the time limit property. This allows for more accuracte progress reports for
high sample count renders with short time limits.

Contributed by Alaska.

Differential Revision: https://developer.blender.org/D15599
2022-08-11 19:37:18 +02:00
ef5a44df2d Merge branch 'blender-v3.3-release' 2022-08-11 19:28:03 +02:00
6161b8dc63 Fix T100130: animation player crash on exit
GPU_exit is now expected to run within an active GPU context.

Also run BLF_exit and IMB_exit first they can use GPU resources and gave
ASAN errors. And remove redundant GPU_shader_free_builtin_shaders already
handled by GPU_exit.
2022-08-11 19:23:15 +02:00
90e027e594 Curve: Simplify legacy curve conversion to mesh
Build the mesh directly instead of returning arrays which need to be
copied to a new mesh. Also decrease the scope of some variables.
2022-08-11 13:09:55 -04:00
2480b55f21 Mesh: Move hide flags to generic attributes
This commit moves the hide status of mesh vertices, edges, and faces
from the `ME_FLAG` to optional generic boolean attributes. Storing this
data as generic attributes can significantly simplify and improve code,
as described in T95965.

The attributes are called `.hide_vert`, `.hide_edge`, and `.hide_poly`,
using the attribute name semantics discussed in T97452. The `.` prefix
means they are "UI attributes", so they still contain original data
edited by users, but they aren't meant to be accessed procedurally by
the user in arbitrary situations. They are also be hidden in the
spreadsheet and the attribute list by default,

Until 4.0, the attributes are still written to and read from the mesh
in the old way, so neither forward nor backward compatibility are
affected. This means memory requirements will be increased by one byte
per element when the hide status is used. When the flags are removed
completely, requirements will decrease when hiding is unused.

Further notes:
 * Some code can be further simplified to skip some processing when the
   hide attributes don't exist.
 * The data is still stored in flags for `BMesh`, necessitating some
   complexity in the conversion to and from `Mesh`.
 * Access to the "hide" property of mesh elements in RNA is slower.
   The separate boolean arrays should be used where possible.

Ref T95965

Differential Revision: https://developer.blender.org/D14685
2022-08-11 12:59:06 -04:00
5cbfdaccd0 Cleanup: minor changes to DebugFlags
Use C++11, remove unused running_inside_blender and move viewport_static_bvh
to BlenderSync.
2022-08-11 17:03:10 +02:00
4cbd799373 obj: support importing multiple files at once
Implemented the same way as STL or GPencil SVG importers: loop over
the input files, import one by one.

Has been requested by the community for quite a long time
(e.g. https://blender.community/c/rightclickselect/Jhbbbc/), as well
as 3rd party addons to implement just this
(https://github.com/p2or/blender-batch-import-wavefront-obj).
2022-08-11 17:05:54 +03:00
c4a0438522 Merge branch 'blender-v3.3-release' 2022-08-11 15:54:04 +03:00
0a096f2be2 Fix T98781: OBJ exporter wrongly writing default material socket values when textures are present
Report T98781 and part of T97642: the MTLMaterial info only captures
image nodes and the default socket values. When the image information
is present, do not emit the socket defaults - the .MTL spec states
they are multiplied together, but the default value is not used
in blender when the socket is connected.

Also contains svn tests repository update to extend the test coverage,
and update test expectation outputs.
2022-08-11 15:51:36 +03:00
aa0ca3aefa GHOST/Wayland: support setting modifiers on window activation
Take advantage of Waylands wl_keyboard_listener.enter callback which
takes an array of keys that are pressed when a window is activated.

Resolves T74684 under Wayland.
2022-08-11 16:48:55 +10:00
1c716cbeb7 Cleanup: access modifier keys by index under Wayland
This simplifies accessing modifiers as there is no need to perform
a string lookup each time (which may fail).
2022-08-11 16:48:08 +10:00
8bc76bf4b9 Fix T66088: Modifier keys ignored when the window doesn't have focus
Always use modifier keys from the active window, as changes to the
modifiers aren't sent to inactive windows.

Also resolves modifier keys being lost on window de-activation.
Activating the window again would check the previous state of the
modifiers which was always cleared as of [0],
now clearing is no longer needed.

[0]: 472595f1d3
2022-08-11 15:59:40 +10:00
51381c94d8 BLF: Fallback Broken After Cache Removal
Font fallback feature not working after reverting the implementation
of the cache system. Missing an blf_ensure_face before
FT_Get_Char_Index. Otherwise glyphs not found in fonts without faces.

Own Code
2022-08-10 20:50:49 -07:00
f35d671f46 Cleanup: refactoring uvislands to prepare for python api
Add element_map->island_total_uvs.
Add element_map->island_total_unique_uvs.
Simplify callers based on new members.
Add comments.

Resolves: D15598
2022-08-11 14:20:44 +12:00
d52d71b834 Cleanup: doxy parameters, use static set instead of tuple 2022-08-11 11:17:24 +10:00
fb8e604ff4 Merge branch 'blender-v3.3-release' 2022-08-11 11:10:13 +10:00
ed55054e57 Fix T100204: RMB select (with "Select Tool") causes edit-mesh conflict
When RMB select activated the selection tool, Alt-RMB would both
tweak and loop-select.

Fix/workaround this by passing though 'enumerate' unless the option
can be used (when selecting objects or armatures).
2022-08-11 11:06:54 +10:00
9015cba5ce Cleanup: clang-tidy uv_parametrizer.cc 2022-08-11 11:03:23 +10:00
d1e2988a12 Cleanup: missing newline in GHOST_PRINT 2022-08-11 10:58:41 +10:00
d9c2922a14 Cleanup: remove redundant MEM_SAFE_FREE
MEM_SAFE_FREE isn't necessary when the memory is known to be allocated
and clearing the value afterwards isn't necessary.
2022-08-11 10:57:14 +10:00
4641d6d7b0 Cleanup: check if the camera was moved before auto-key in smooth-view
There is no need to attempt to auto-key when the camera isn't moved.
2022-08-11 10:31:50 +10:00
b9b45c2036 Cleanup: pass const arguments to smooth-view functions
Also move region redraw tag out of view3d_smoothview_apply_with_interp
as it's not always needed.
2022-08-11 10:05:21 +10:00
07deb9a71b Cleanup: replace magic number 2022-08-11 09:52:49 +10:00
32c8a28720 Cleanup: spelling in comments 2022-08-11 09:51:19 +10:00
d68018cf10 License headers: add missing license header 2022-08-11 09:35:02 +10:00
fb7ef40006 Cleanup: refactoring uvislands to prepare for python api
Add #bm_uv_ensure_head_table

See also: D15598
2022-08-11 11:20:00 +12:00
e19986482f Cleanup: reduce asan lint and clang-tidy warnings on uv_parametrizer 2022-08-11 11:10:37 +12:00
13c5f6e08f Cleanup: refactoring uvislands to prepare for python api
Migrate island calculation to #bm_uv_build_islands.
Simplify connectedness calculation.
Reduce memory pressure.
No functional changes.

See also: D15598
2022-08-11 08:24:37 +12:00
bb3174e15b Merge branch 'blender-v3.3-release' 2022-08-10 18:06:13 +03:00
8c59b93505 obj: Also find .mtl images by their basename, if all else fails (T77801)
While T77801 itself is working as expected in the new C++ obj
importer, the repro file there uses absolute paths to material images,
yet the images themselves are right there in the current folder.

The old python based importer did find them, since it was doing a
really complex image search. My understanding is that while C++
importer was developed, it was decided to not do that -- however
just the "basename file in the mtl directory" sounds simple enough
and gets the repro case file work correctly.
2022-08-10 18:03:39 +03:00
5689dda6f7 Compositor: Limit C linkage of cryptomatte functions
Most of the functions in the compositor cryptomatte file are declared
with extern "C" linkage, which can cause symbol conflict even when
functions exist in separate namespaces. This is not actually necessary,
as the declaration of the few functions that require C linkage are
already declared as such in the header file, so this patch removes the
extern C scope from that file.

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

Reviewed By: Clement Foucault
2022-08-10 14:58:51 +02:00
27b9538e44 Realtime Compositor: Fix missing include in Displace node
The displace node was missing an include, which sometimes compiled fine
due to unity builds. This patch adds that missing include.
2022-08-10 14:10:07 +02:00
9596907363 Realtime Compositor: Allow in material preview mode
This patch allows the viewport compositor to operate in Material Preview
mode.

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

Reviewed By: Clement Foucault
2022-08-10 13:30:31 +02:00
79953d5482 Realtime Compositor: Fix clang tidy warnings
Fix a number of warnings reported by Clang Tidy in the realtime
compositor's code.

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

Reviewed By: Clement Foucault
2022-08-10 13:04:36 +02:00
f9589fab60 Render: remove camera shift hard limits
There is no need for these to be limited to -10..10, soft limits are enough.

Contributed by fundorin.

Differential Revision: https://developer.blender.org/D15650
2022-08-10 13:02:32 +02:00
089216067f Merge branch 'blender-v3.3-release' 2022-08-10 13:36:48 +03:00
d76583cb4a Fix T100302: New OBJ importer produces too many vertices when faces don't span a continuous range
As part of the previous fix (D15410), the importer got code to track
min & max vertex indices used as part of the mesh faces. However, if
faces refer to a "sparse" (i.e. non-contiguous) subset of all vertices,
then the imported mesh would contain all the vertices between min & max
range.

Replace that with proper tracking of actually used vertex indices
for each imported mesh. Fixes T100302.

This does affect import performance a tiny bit, e.g. importing Blender
3.0 splash scene goes 21.7s -> 22.1s, and importing rungholt.obj
goes 2.37s -> 2.48s.

Importer related tests have a bunch of vertex changes in them, since
now vertices are added in the order that the faces are referring
to them. Which incidentally matches the order that the Python based
importer was creating them too.
2022-08-10 13:34:58 +03:00
54c26f58d0 Cleanup: Fix warning in release builds 2022-08-10 11:02:38 +02:00
f12f7800c2 Depsgraph: Optimize evaluation of dependencies of disabled modifiers
Solves long-standing issue when dependencies of disabled modifiers are
evaluated.

Simple test case: no drivers or animation. Manually enabling modifier
is expected to bring FPS up, enabling modifier will bring FPS (sine
evaluation can not be avoided)

F13336690

More complex test case: modifier visibility is driven by an animated
property. In am ideal world FPS during property being zero is fast
and when property is 1 the FPS is low.

F13336691.

Differential Revision: https://developer.blender.org/D15625
2022-08-10 11:02:38 +02:00
cfbe11563a Depsgrapg: Add per-modifier graph nodes
No functional changes expected.
2022-08-10 11:02:38 +02:00
fad112be1c Realtime Compositor: Add stub unsupported nodes
This patch adds a stub implementation for all unsupported nodes. The
inputs are passed through to the outputs where it make sense, while
other outputs will be allocated a single zero value.

This seems to be preferred by users as opposed to stopping execution and
displaying an error message.

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

Reviewed By: Clement Foucault
2022-08-10 10:36:57 +02:00
40c45985a9 Realtime Compositor: Add basic distort nodes
This patch implements the following nodes for the realtime compositor:

- Crop node.
- Flip node.
- Lens distort node.
- Rotate node.
- Transform node.
- Translate node.

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

Reviewed By: Clement Foucault
2022-08-10 10:30:27 +02:00
c014021802 Realtime Compositor: Add basic matte nodes
This patch implements the following nodes for the realtime compositor:

- Box mask node.
- Channel matte node.
- Chroma matte node.
- Color matte node.
- Color spill node.
- Difference matte node.
- Distance matte node.
- Ellipse matte node.
- Luminance matte node.

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

Reviewed By: Clement Foucault
2022-08-10 10:21:18 +02:00
b5df7a02ac Realtime Compositor: Add basic convert and vector nodes
This patch implements the following nodes for the realtime compositor:

- Map range node.
- Map value node.
- Math node.
- Normal node.
- Alpha convert node.
- Separate color node.
- Combine color node.
- Separate XYZ node.
- Combine XYZ node.
- Separate RGBA node.
- Combine RGBA node.
- Separate HSVA node.
- Combine HSVA node.
- Separate YCCA node.
- Combine YUVA node.
- Set alpha node.
- Switch node.
- Switch view node.
- RGB to BW node.
- Color ramp node.

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

Reviewed By: Clement Foucault
2022-08-10 10:09:35 +02:00
6109ad6cce Realtime Compositor: Add basic color nodes
This patch implements the following nodes for the realtime compositor:

- Alpha over node.
- Bright contrast node.
- Color balance node.
- Color correction node.
- Exposure node.
- Gamma node.
- Hue correct node.
- Hue saturation value node.
- Invert node.
- Mix node.
- Posterize node.
- Time curve node.
- Vector curve node.

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

Reviewed By: Clement Foucault
2022-08-10 09:58:44 +02:00
865204fef0 Realtime Compositor: Add basic input nodes
This patch implements the following nodes for the realtime compositor:

- Image node.
- Movie clip node.
- Render layers node.
- RGB node.
- Scene time node.
- Value node.

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

Reviewed By: Clement Foucault
2022-08-10 09:45:28 +02:00
365fbb447e Realtime Compositor: Add basic output nodes
This patch implements the following nodes for the realtime compositor:

- Composite node.
- Viewer node.
- Split viewer node.

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

Reviewed By: Clement Foucault
2022-08-10 09:40:07 +02:00
624b0ac656 Realtime Compositor: Add evaluator and engine
This patch adds the core realtime compositor evaluator as well as a
compositor draw engine powered by the evaluator that operates in the
viewport. The realtime compositor is a new GPU accelerated compositor
that will be used to power the viewport compositor imminently as well as
the existing compositor in the future.

This patch only adds the evaluator and engine as an experimental
feature, the implementation of the nodes themselves will be committed
separately.

See T99210.

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

Reviewed By: Clement Foucault
2022-08-10 09:14:22 +02:00
169216684a Merge branch 'blender-v3.3-release' 2022-08-10 16:43:33 +10:00
b114993305 Fix T99963: Fallback actions are used in RCS on left click
Regression in [0].

Disable fallback tools for the 3D cursor so other shortcuts are
available such as lasso-select.

[0]: b0847eff2a
2022-08-10 16:39:29 +10:00
77f41da5f1 Cleanup: spelling 2022-08-10 16:23:11 +10:00
72f388c85e Cleanup: format 2022-08-10 16:15:45 +10:00
39f706a76c Cleanup: fix attr_nonnull error found by asan 2022-08-10 16:55:43 +12:00
1150dcf93e make_update: quiet warning when SVN lib/ contains hidden files
make_update attempted to update hidden local files, skip them instead.
2022-08-10 12:11:04 +10:00
9ef0f25a80 Merge branch 'blender-v3.3-release' 2022-08-09 21:27:14 -04:00
07ac26f0a5 Update RNA to User manual mappings 2022-08-09 21:26:48 -04:00
68e2084b07 Merge branch 'blender-v3.3-release' 2022-08-09 19:10:13 -05:00
bdb85bdd98 Fix T100308: Removing scene time node does not update relations
Similar to the fix in 734c6a4405.
2022-08-09 19:09:43 -05:00
31e06a8c73 Fix T99661: Use after free converting edit mode curve object to mesh
The fix from c0fdf16561 was missing in one place. We don't
want to free the edit mode pointers, those are just copied because the
edit mode changes aren't present in the actual original data-block.
2022-08-09 18:24:44 -05:00
90b7c3d05e Fix T99661: Use after free converting edit mode curve object to mesh
The fix from c0fdf16561 was missing in one place. We don't
want to free the edit mode pointers, those are just copied because the
edit mode changes aren't present in the actual original data-block.
2022-08-09 17:49:41 -05:00
a9a7460570 DRW: DebugDraw: Fix unguarded drw_debug_draw()
This might create nullptr dereference in some cases.
2022-08-09 23:05:07 +02:00
11bdc321a2 Sculpt: Register sculpt brush op so it clears last operator panel
Needed to prevent changing values in the last operator panel
from destructively undoing brush steps.
2022-08-09 12:54:24 -07:00
1d68318e97 Cleanup: Add function for creating object dupli with separate data 2022-08-09 14:44:47 -05:00
edd6d301c7 Cleanup: Move mball.c to C++
Facilitates changes in D14593
2022-08-09 13:49:09 -05:00
f8b1483566 Cleanup: Remove unused object batch cache API function
Remove the "tag batch cache dirty" function specifically  for object data,
since it isn't used. Ref D14593
2022-08-09 13:03:35 -05:00
c15a63d21e Cleanup: MIscellaneous improvements to pointcloud draw cache
- Use references
- Reorder functions to remove unnecessary prototype
- Use the attribute API
- Use const where possible
- Split no-radius extraction a bit more, add multithreading
2022-08-09 12:37:09 -05:00
752fb5dd08 Merge branch 'blender-v3.3-release' 2022-08-09 19:19:54 +02:00
79f1cc601c Cycles: improve ray tracing precision near triangle edges
Detect cases where a ray-intersection would miss the current triangle, which if
the intersection is strictly watertight, implies that a neighboring triangle would
incorrectly be hit instead.

When that is detected, apply a ray-offset. The idea being that we only want to
introduce potential error from ray offsets if we really need to.

This work for BVH2 and Embree, as we are able to match the ray-interesction
bit-for-bit, though doing so for Embree requires ugly hacks. Tiny differences
like fused-multiply-add or dot product intrinstics in matrix inversion and ray
intersection needed to be matched exactly, so this is fragile.

Unfortunately we're not able to do the same for OptiX or MetalRT, since those
implementations are unknown (and possibly impossible to match as hardware
instructions). Still artifacts are much reduced, though not eliminated.

Ref T97259

Differential Revision: https://developer.blender.org/D15559
2022-08-09 18:42:01 +02:00
1e8e70a90c Cleanup: Remove file mistakenly kept in C++ conversion 2022-08-09 11:15:59 -05:00
4ab6baefb1 Cleanup: Move draw_cache_impl_pointcloud.c to C++ 2022-08-09 11:10:44 -05:00
230f9ade64 Cycles: make transform inverse match Embree exactly
Helps improve ray-tracing precision. This is a bit complicated as it requires
different implementation depending on the CPU architecture.
2022-08-09 16:59:05 +02:00
286e535071 Cleanup: simplify CPU instruction checking
The performance of this will be slightly more important for upcoming changes.
Also removed an unused function and changed includes so these system.h can
be included in more places.
2022-08-09 16:59:05 +02:00
Andrii Symkin
d832d993c5 Cycles: add new Spectrum and PackedSpectrum types
These replace float3 and packed_float3 in various places in the kernel where a
spectral color representation will be used in the future. That representation
will require more than 3 channels and conversion to from/RGB. The kernel code
was refactored to remove the assumption that Spectrum and RGB colors are the
same thing.

There are no functional changes, Spectrum is still a float3 and the conversion
functions are no-ops.

Differential Revision: https://developer.blender.org/D15535
2022-08-09 16:49:34 +02:00
7921faa651 Merge branch 'blender-v3.3-release' 2022-08-09 16:45:28 +02:00
9644740230 Fix T99949: Crash when last input from File Output node is deleted
Regression since e4278b72bb.

Need to check inputs exist prior to requesting first input as it
might not exist.
2022-08-09 16:44:36 +02:00
1988665c3c Cleanup: make vector types make/print functions consistent between CPU and GPU
Now all the same ones are available on CPU and GPU, which was previously not
possible due to lack of operator overloadng in OpenCL. Print functions are
no-ops on some GPUs.

Ref D15535
2022-08-09 16:07:23 +02:00
9990792e87 Compositor: Rename compositor build option
Currently, the compositor can be disabled using the WITH_COMPOSITOR
build option. Since, we intent to always build the realtime compositor,
we need to make the distinction between both compositors clear.

So this patch renames the option to WITH_COMPOSITOR_CPU. Additionally,
the check for the option was moved inside the compositor modules' own
CMake file in preparation for the realtime compositor code.

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

Reviewed By: Jeroen Bakker, Ray Molenkamp
2022-08-09 15:59:56 +02:00
cefd6140f3 Fix T100119: Cycles light object's parametric vector distorted
Caused by 38af5b0501.

Adjust barycentric coordinates used for intersection result in the
ray-to-rectangle intersection check.

Differential Revision: https://developer.blender.org/D15592
2022-08-09 15:56:03 +02:00
f6639cc4fc DRW: DebugDraw: Port module to C++ and add GPU capabilities
This is a complete rewrite of the draw debug drawing module in C++.
It uses `GPUStorageBuf` to store the data to be drawn and use indirect
drawing. This makes it easier to do a mirror API for GPU shaders.

The C++ API class is exposed through `draw_debug.hh` and should be used
when possible in new code.

However, the debug drawing will not work for platform not yet supporting
`GPUStorageBuf`. Also keep in mind that this module must only be used
in debug build for performance and compatibility reasons.
2022-08-09 15:45:46 +02:00
2e4727e123 GL: Fix error messages missing end of line 2022-08-09 15:45:46 +02:00
be50d526eb Merge branch 'blender-v3.3-release' 2022-08-09 21:07:50 +10:00
34c7f42c08 Merge branch 'blender-v3.3-release' 2022-08-09 21:07:47 +10:00
19b74f8120 Merge branch 'blender-v3.3-release' 2022-08-09 21:07:44 +10:00
8aa98d1043 Merge branch 'blender-v3.3-release' 2022-08-09 21:07:41 +10:00
541f9dbfd2 Merge branch 'blender-v3.3-release' 2022-08-09 21:07:38 +10:00
Damien Picard
af59e32c13 I18n: make more parts of the UI translatable
- "Name collisions" label in mesh properties
- "Threshold" labels in Vertex Weight Edit modifier
- "Particle System" label in Particle Instance modifier
- Slot number in the Shader Editor

- Status bar keymap items during modal operations:
  add TIP_() macro to status bar interface template

- On dumping messages, sort preset files so their messages are stable
  between runs

Ref. T43295

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15607
2022-08-09 21:07:32 +10:00
2de1b06287 I18n: add extraction of modal event names.
Alternative fix to the one proposed in D15607.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D15643
2022-08-09 21:07:32 +10:00
efc1d4bb9a WM Modal Keymaps: Add accessors to modal event values.
It is currently impossible to access modal keymaps' event values (from
`propvalue` enum) from python code (for API introspection).

This is needed for i18n messages extraction (see D15607).

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D15643
2022-08-09 21:07:32 +10:00
Damien Picard
a2bdd6a71a I18n: remove Window class from message extraction blacklist
Messages from the bpy.types.Window class were blacklisted in the
message extraction script.

This change allows a few new messages to be translated, including at
least two which show up in the UI. There are only 12 new messages in
the .po files, so even if some never need to be translated, that's not
too many.

Ref. T43295

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15628
2022-08-09 21:07:32 +10:00
7b0bc1573b Fix memory leak exporting to collada 2022-08-09 21:04:25 +10:00
Damien Picard
e1974ae30e I18n: make more parts of the UI translatable
- "Name collisions" label in mesh properties
- "Threshold" labels in Vertex Weight Edit modifier
- "Particle System" label in Particle Instance modifier
- Slot number in the Shader Editor

- Status bar keymap items during modal operations:
  add TIP_() macro to status bar interface template

- On dumping messages, sort preset files so their messages are stable
  between runs

Ref. T43295

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15607
2022-08-09 12:42:33 +02:00
630b961f23 I18n: add extraction of modal event names.
Alternative fix to the one proposed in D15607.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D15643
2022-08-09 12:22:30 +02:00
2682a59efe WM Modal Keymaps: Add accessors to modal event values.
It is currently impossible to access modal keymaps' event values (from
`propvalue` enum) from python code (for API introspection).

This is needed for i18n messages extraction (see D15607).

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D15643
2022-08-09 12:22:13 +02:00
Damien Picard
219b4dbc3c I18n: remove Window class from message extraction blacklist
Messages from the bpy.types.Window class were blacklisted in the
message extraction script.

This change allows a few new messages to be translated, including at
least two which show up in the UI. There are only 12 new messages in
the .po files, so even if some never need to be translated, that's not
too many.

Ref. T43295

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15628
2022-08-09 11:41:29 +02:00
fea8ee4c0b Cleanup: use static_cast in bmesh_mesh.cc 2022-08-09 14:27:49 +10:00
c7a7aee004 Cleanup: use own username in code-comment tags 2022-08-09 14:18:18 +10:00
eab988c9f6 Merge branch 'blender-v3.3-release' 2022-08-09 13:54:05 +10:00
90b2ed6c4b Fix T100277: Grease pencil lines don't start at click-start
Regression in b8960267dd.
2022-08-09 13:52:27 +10:00
dfbba7c0eb Cleanup: CMake file indentation 2022-08-09 13:37:29 +10:00
19b5524d1c Cleanup: sort cmake file-lists 2022-08-09 13:37:29 +10:00
d3c653c6d9 BLF: Revert FreeType Cache
Remove the FreeType cache implementation. Not multithreading correctly.

Original commit: 9d77b5a0ed

See D15647 for more details.

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

Own Code.
2022-08-08 20:33:43 -07:00
26b9c54b01 License headers: add missing license headers 2022-08-09 13:25:11 +10:00
a26b1a299f Cleanup: split smooth-view apply into 3 functions
Mixing view interpolation with finishing smooth-view caused arguments
to be passed in that only made sense for one of these cases.
This also makes the intention of the callers clearer.

- view3d_smoothview_apply_with_interp
- view3d_smoothview_apply_and_finish
- view3d_smoothview_apply_from_timer

Also rename 'step' to 'factor` and use `interpf` for blending values.
2022-08-09 10:53:19 +10:00
35b0a2f5e7 Merge branch 'blender-v3.3-release' 2022-08-09 10:51:03 +10:00
4915fc4547 Merge branch 'blender-v3.3-release' 2022-08-09 10:50:59 +10:00
8b3e3c1810 Fix T100242: Handle Flushed FT Sizes
Properly deal with FreeType cache flushing a font's ft_size. Set this
to NULL in finalizer, and add a blf_ensure_size to make sure it
exists only when needed.

See D15639 for more details.

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

Reviewed by Brecht Van Lommel
2022-08-08 17:23:25 -07:00
f5fc9a7edf Cleanup: compiler warnings 2022-08-09 09:42:02 +10:00
228f7cb5ce Fix viewport operators with a view locked camera
Smooth-view wasn't working properly with a locked-camera this could
animate from the wrong position if the camera wasn't in sync with the
underlying viewport transformation.

Resolve issues for:

- VIEW3D_OT_view_orbit
- VIEW3D_OT_view_roll
- VIEW3D_OT_zoom_border
2022-08-09 09:31:20 +10:00
8ed2abf856 Fix missing undo steps for smooth-view operators
Support pushing undo steps for smooth-view operations that manipulate
the camera. Now V3D_SmoothParams take optional undo arguments.

Used for:

- VIEW3D_OT_view_center_cursor
- VIEW3D_OT_view_center_pick
- VIEW3D_OT_view_orbit
- VIEW3D_OT_view_roll
- VIEW3D_OT_zoom_border

Follow up fix for T92099.
2022-08-09 09:31:18 +10:00
1e57ddf6ea Merge branch 'blender-v3.3-release' 2022-08-08 12:37:53 -03:00
b3fc8206be Revert "Fix T100280: GG not toggling the offset transform mode in tracker"
This reverts commits b72eddac61 and
f8b5706a1f.

And fixes T100265.

It brings more problems than solutions.
2022-08-08 12:37:25 -03:00
8d080013f5 Fix T100285: Shader value node always outputs zero
The shader value node always outputs zero in some cases even when its
value is not zero.

This is caused by b639e60864. In that
commit, the behavior of GPU node linking changed such that unlinked
sockets get their value from their associated GPU node stack instead of
the socket itself. But execution node stacks do not always have their
output values initialized, and since the value node stores its value in
its output, it follows that its uniform value will be wrong.

This patch fixes that by getting the value directly from the socket.
This is also done fro the RGBA node, since it is implemented similarly.
Finally, the GPU_uniformbuf_link_out function was removed since it is no
longer used and does not make sense anymore.

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

Reviewed By: Clement
2022-08-08 17:31:25 +02:00
bca20c10da Merge branch 'blender-v3.3-release' 2022-08-08 17:00:10 +02:00
2e6fcd9aad Fix Cycles crash after recent bugfix for image saving 2022-08-08 16:59:37 +02:00
c0b6aeeca7 Cleanup: fix source typo
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D15630
2022-08-08 16:13:32 +02:00
47f433c776 Merge branch 'blender-v3.3-release' 2022-08-08 11:00:10 -03:00
b72eddac61 Fix T100280: GG not toggling the offset transform mode in tracker
Caused by {rB791bfae1d64b}.

The solution was to create the special handle for the Move Clip and Mask
transformation.

One change that cannot be reversed is showing the `G` shortcut in the
statusbar.

But the description of this shortcut was not even correct before.
2022-08-08 10:59:29 -03:00
4b3315fc98 Fix T100281: image save after copy not using correct filepath
Always use the image datablock filepath for saving. The only apparent reason
use the image buffer file path is image sequences, for which the current frame
filepath is now computed.
2022-08-08 13:51:19 +02:00
1382514bf2 Fix: Error in oneAPI image code for texture access with clip extension 2022-08-08 10:47:11 +02:00
e22628c70b Cleanup: refactoring uvislands to prepare for python api
Fix copy+paste bug
2022-08-08 20:00:10 +12:00
bb8488c62c Cleanup: refactoring uvislands to prepare for python api
Rename vert -> vertex.
Add `BM_uv_element_get_head`.

See also: D15598
2022-08-08 17:18:15 +12:00
9b924b2a23 Fix: Typo in geometry node tooltip 2022-08-07 22:30:47 -05:00
64984126a2 Cleanup: refactoring uvislands to prepare for python api
Rename buf -> storage.

See also: D15598
2022-08-08 10:39:43 +12:00
387e7e9e8d Merge branch 'blender-v3.3-release' 2022-08-07 23:08:34 +02:00
e4938b163e Cycles: re-enable zebin format for Intel GPUs on Linux
zebin format is critical for the compatibility of AoT graphics binaries
across driver versions. It was previously disabled on Linux due to
runtime issues that are now fixed in
https://github.com/intel/compute-runtime/releases/tag/22.31.23852.
The minimum supported driver version isn't bumped to this one yet as
current codebase with current IGC compiler does actually run fine on
earlier drivers and is not running into these issues anymore.
2022-08-07 22:54:15 +02:00
344c53561a Fix: Incorrect field node deduplication for shortest path nodes
Mistake in c8ae1fce60.
2022-08-07 14:38:17 -05:00
341e9f7a7c Revert "Parallelize remesh reprojects"
This reverts commit 34009dfb23.
This was committed by accident an does not belong in master.
2022-08-07 20:09:20 +02:00
e207930350 Revert "Update grain size"
This reverts commit 31674b9d14.
This was committed by accident an does not belong in master.
2022-08-07 20:08:53 +02:00
6e8709caa3 Cleanup: Fix typo Propatation -> Propagation
Fixes the typo in the struct `DefaultPropatationMixerStruct`.
2022-08-07 19:48:28 +02:00
31674b9d14 Update grain size 2022-08-07 19:41:08 +02:00
34009dfb23 Parallelize remesh reprojects
Differential Revision: https://developer.blender.org/D15638
2022-08-07 19:41:08 +02:00
e441e21d74 Cleanup: refactoring uvislands to prepare for python api
See also: D15598
2022-08-07 16:11:47 +12:00
8b51bd61fd Cleanup: make format 2022-08-07 10:09:31 +12:00
b411011f9d Merge branch 'blender-v3.3-release' 2022-08-06 17:01:37 -05:00
800c7dbf41 Fix: Missing translation in deform curves on surface node
Also add an error message for when the node is used on non-curves
objects, since there's nothing in the UI to show why it doesn't work
except for that. And also use quotes when referring to attribute names.
2022-08-06 17:01:01 -05:00
a9b4b044e3 BLF: Remove Unwanted Font File
Remove "Material Icons" font file, mistakenly added.

See D15627 for details

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

Reviewed by Brecht Van Lommel
2022-08-06 12:53:23 -07:00
bf8b56a69e Cleanup: Const in headers, standardize variable names 2022-08-06 14:31:57 -05:00
ce352e6d00 Cleanup: Remove unused function 2022-08-06 14:24:47 -05:00
fecef2ae74 Merge branch 'blender-v3.3-release' 2022-08-06 13:16:34 -04:00
d58476049e Fix T98025: Revert "Fix Bevel intersection continuity."
This reverts commit 94866ef84f
A number of reports of bevel regressions came after the
commit to fix bevel intersection continuity.
Since the fix for some of those regressions is not obvious
we will revert the continuity improvement and do it as
part of the Bevel V2 project.
2022-08-06 12:40:11 -04:00
8f915f0efb Merge branch 'blender-v3.3-release' 2022-08-06 15:18:12 +10:00
8dadc091d0 LineArt: Usability improvement for "Enclosed Shapes".
This patch removes the [rather confusing] separate checkbox for enclosed
shapes in favour of integrating that option into illumination filtering,
with the benefit of not limiting the selection to cached result.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D15327
2022-08-06 12:20:15 +08:00
Pratik Borhade
befe38fe1d Fix T92099: No undo when moving viewport with camera locked to view
Supports undo step generation while navigating in locked camera view.
NDOF & track-pad navigation are not included for now.

Actions that uses smooth view can be supported but are outside
the scope of this change, includes undo push for:

- VIEW3D_OT_view_pan
- VIEW3D_OT_dolly
- VIEW3D_OT_fly
- VIEW3D_OT_move
- VIEW3D_OT_rotate
- VIEW3D_OT_walk
- VIEW3D_OT_zoom

Reviewed by: campbellbarton

Ref D15345
2022-08-06 12:57:06 +10:00
fcd61d2056 Cleanup: Move uv_parametrizer.c to C++
Differential Review: https://developer.blender.org/D15618
2022-08-06 13:54:40 +12:00
0d62e963b0 Cleanup: Simplify NULL handling for BKE_image_find_nearest_tile
Differential Revision: https://developer.blender.org/D15616
2022-08-06 09:52:23 +12:00
Laurynas Duburas
476de3b463 Surfaces: Enhanced edit mode extrude tool for NURBS
Adds support for extrusion from more than one edge and from inner
lattice legs. Also fixes extrusion from one point. Implemented in two
steps. At first so called "copy intervals" are calculated according to
selected control points. Then those are used to copy control points to
the new surface patch. See the differential revision for a video.

Differential Revision: https://developer.blender.org/D15524
2022-08-05 13:17:08 -05:00
74336cee38 Merge branch 'blender-v3.3-release' 2022-08-05 12:55:33 -05:00
74f983738a Fix T100143: RNA path information of Curves datablock incorrect 2022-08-05 12:53:27 -05:00
fafd1ab9d3 Merge branch 'blender-v3.3-release' 2022-08-05 19:49:12 +02:00
4181d82ad1 Fix T99812: Audio scrubbing freezes Blender 3.2.1
Bug was caused by a change in ffmpeg's API.
2022-08-05 19:40:39 +02:00
18b703dc05 Fix T99991: Cycles wrong intercept with new hair curves
Copy the improved hair curves sync implementation from D14942. That patch is
not ready as a whole but this part was verified to match the old hair particles
can be used already.
2022-08-05 19:33:53 +02:00
d95100e821 Fix T98769: Cycles crash with multi-device rendering and BVH refits 2022-08-05 17:19:19 +02:00
Chris Clyne
e437997174 Fix: compositor stats in background mode subject to race conditions
Evaluating a compositor node tree in background mode causes the stats callback
to be called from multiple threads, leading to garbled output. This was causing
major problems with render-farm scripts.

Differential Revision: https://developer.blender.org/D15633
2022-08-05 16:45:50 +02:00
43a124bc1c Fix T99179: holdout does not affect transparency without transparent background
This was by design, but maybe not so useful in practice. It's always possible to
set alpha to 1 in compositing if needed.
2022-08-05 16:32:13 +02:00
fa514564b0 Fix T99201: Cycles render difference with 3D hair curves between OptiX and Emrbee
It should consistently use the Cycles pirmitive ID for self intersection detection,
not the one from the OptiX or Embree acceleration structure.

Differential Revision: https://developer.blender.org/D15632
2022-08-05 15:03:47 +02:00
91250022d0 EEVEE-Next: Depth Of Field: Avoid Framebuffer setup cost for each redraw
Using 2 framebuffer, if the temp textures are the same across redraws,
we can avoid the setup cost.
2022-08-05 14:45:49 +02:00
f6ce2c1f78 EEVEE-Next: Depth Of Field: Add comment about failed optimization attempt 2022-08-05 14:45:39 +02:00
c944dca127 EEVEE-Next: Depth Of Field: Fix black tiles when max blur radius is low
There was a missing clamp in `dof_slight_focus_coc_tile_get()`
and a couple of wrongly handled corner cases.
2022-08-05 14:45:39 +02:00
2a4cc0c81c EEVEE-Next: Depth Of Field: Use random sampling in slight focus gather
This replace the previous square rings approach by sampling a disk the
footprint of the search area. This avoids sampling in areas in corners
where there isn't any weight.

This results in much less samples needed to acheive a good enough result.
The max number of samples for an area of 11x11 px is hard coded to 16 and
still gives good results with the final clamp.

The number of samples is adaptative and is scaled by the search area (max
CoC).

The High Quality Slight Defocus is not required anymore. If there is a
quality parameter to add, it would be sample count option. But I consider
the temporal stability enough for viewport work and render can still
render many full scene samples. So I don't see a need for that yet.
2022-08-05 14:45:39 +02:00
3690dad40a EEVEE-Next: Depth Of Field: Fix reduce pass
The indexing during mipmap downsampling was wrong, leading to incorrect
bilateral downsampling.
2022-08-05 14:45:39 +02:00
72cdb0ed2d EEVEE-Next: Depth Of Field: Improve image stability
This adds anti-flicker pass to the slight focus region by using the
temporaly stable output from stabilize pass.

This also fixes the bilateral weight factor which was reversed.
2022-08-05 14:45:09 +02:00
897aa777c5 EEVEE-Next: Depth Of Field: Fix glitch on foreground scattered bokeh
This was caused by a missing synchronization.
The background gather pass was writting to the same occlusion texture
before the end of the scatter draw.
2022-08-05 14:45:09 +02:00
49d85dc8b5 EEVEE-Next: Depth Of Field: Improve Temporal stability
This implement a full TAA pass on the depth of field input.
An history buffer is kept for each view needing Depth of field.
This uses a swap with a `TextureFromPool` in order to not always 2
textures allocated.

Since this uses luma weighting without any input, the firefly parameter is
now obsolete and has been removed.

There is some tiny difference with the Film TAA so the implementation is
mostly copy pasted.

Also this implementation uses a LDS cache to speedup the TAA computations.
2022-08-05 14:45:09 +02:00
8659e62d1e EEVEE-Next: Depth Of Field: Make slight focus max coc more accurate
This moves the slight focus max in tile from the setup pass to the
resolve pass. This reduces complexity as there is no need for an extra
component in the tile textures.

This also avoids skipping any pixels and makes sure the local max matches
the dispatched local group size. This should make the resolve pass a little
bit faster.
2022-08-05 14:45:09 +02:00
c5526dc6f4 DRW: GPU Wrapper: add possibility to swap Texture and TextureFromPool
Ownership is transfered from the pool to the `Texture` and vice versa.
This allows to have history buffers with only 1 persistent texture.
2022-08-05 14:45:09 +02:00
1ae767be9f Cleanup: DRW: Remove void function argument 2022-08-05 14:45:09 +02:00
65561a0573 Merge remote-tracking branch 'origin/blender-v3.3-release' 2022-08-05 12:09:24 +02:00
45f483681f Fix T100093: Channel selection and grouping issues
Channel selection in graph editor was broken by rB3c5620aabd33 because
the selection took into account grease pencil channels. Such channels
are now removed from selection in containers that does not use them (NLA
and Graph Editor).

Grouping was broken from a similar issue. The grouping operation now
completely filters out grease pencil channels since the operator is only
defined for f-curve channels.

Reviewed By: sybren

Maniphest Tasks: T100093

Differential Revision: https://developer.blender.org/D15601
2022-08-05 12:06:03 +02:00
8362c57b21 Merge branch 'blender-v3.3-release' 2022-08-05 11:04:43 +02:00
f8d13a1b58 Cleanup: Use c++ casting in liboverride BKE code.
No functional change expected here!
2022-08-05 11:03:57 +02:00
4c340f9bd4 Cleanup: Remove outdated comment 2022-08-04 23:41:57 -05:00
fd0c27944f Cleanup: Reduce indentation 2022-08-04 23:35:37 -05:00
359aca8d4c Cleanup: Spelling, remove double negative 2022-08-04 23:02:02 -05:00
53c0c3cbd7 Cleanup: spelling, unused arg warning 2022-08-05 13:34:26 +10:00
16ede6584e Cleanup: format 2022-08-05 13:34:10 +10:00
0d476bcacd Merge remote-tracking branch 'origin/blender-v3.3-release' 2022-08-04 19:46:51 -07:00
bd467100dd Fix T100142: Compare correct render_slot variable during clear operation
In {rB0ef8a6179d2a773b2570352bd0cb7eb18b666da2} the parameter name was
changed to match the header declaration (slot) but it missed updating
the variable name inside the function correctly in one instance.

This prevents slot 0 from being cleared if the last slot to be rendered
was not also 0.

Differential Revision: https://developer.blender.org/D15620
2022-08-04 19:41:03 -07:00
9da0cfb86e Python: Add more useful information when attempting to pass incorrect attributes to GPUVertBuf.attr_fill
This simply adds the name of the incorrect parameter to the error message.

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

Reviewed by Jeroen Bakker
2022-08-04 15:54:00 -07:00
5b8143287b Fix: Build error after recent commit
A second try after 8b46731396.
2022-08-04 17:20:10 -05:00
5b8c07dc50 Cleanup: Remove outdated code for mesh normals
After recent refactors to mesh normals (cfa53e0fbe), they are no
longer stored in CustomData. A mechanism to compute them eagerly
should be implemented another way.
2022-08-04 17:05:46 -05:00
8b46731396 Fix Build Warnings in blf_font.c
Function made static, unused argument, type conversion

Introduced in 9d77b5a0ed

Own Code.
2022-08-04 14:40:11 -07:00
9d77b5a0ed BLF: Implement FreeType Caching
Implementation of the FreeType 2 cache subsystem, which limits the
number of concurrently-opened FT_Face and FT_Size objects, as well as
caching information like character maps to speed up glyph id lookups.

See D13137 for much more detail.

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

Reviewed by Brecht Van Lommel
2022-08-04 13:05:19 -07:00
fca7cb0101 Cleanup: Remove incorrect comment 2022-08-04 13:49:07 -05:00
77047d2088 Merge branch 'blender-v3.3-release' 2022-08-04 13:48:41 -05:00
bae2ce0695 Nodes: Disable link drag search for deprecated nodes 2022-08-04 13:43:26 -05:00
9ea9fc1f34 Fix T100099: Cycles crash baking vertex colors in edit mode
This was not supported, added now.
2022-08-04 20:14:50 +02:00
b29d6de77a Fix T99055: Cycles vertex color bake + denoising gives bad result
No denoising is supported in this case, it only works on images.
2022-08-04 19:28:09 +02:00
1c2c468abc Fix T100134: Cycles faceted triangle normals with motion blur
After recent changes to change barycentric coordinate convention.
2022-08-04 19:08:45 +02:00
91d365f6df Fix T100205: Cycles wrong volume shading with two materials in object
Assume that all faces using the smae material form a closed mesh, so that
joining meshes gives the same result as separate meshes.

It does mean that using different materials on different sides of one
closed mesh do not work, but the meaning of that is poorly defined anyway
if there is a volume interior.
2022-08-04 19:02:25 +02:00
dd4c47314e Merge branch 'blender-v3.3-release' 2022-08-04 18:56:16 +02:00
11b4d0a3c3 Attempt to fix build errors on MSVC
Same as 03cd794119, but using a different cast (see 9b9417b661).
2022-08-04 18:54:32 +02:00
56848fe967 Merge branch 'blender-v3.3-release' 2022-08-04 10:47:54 -05:00
d730940fdb Fix: Store named attribute node incorrect link drag search 2022-08-04 10:47:31 -05:00
4655ddf3a2 T90535: import UDIM textures from USD
Added logic to the USD Preview Surface importer to
convert UDIM textures.

Reviewed by: Sybren and Jesse

Differential Revision: https://developer.blender.org/D15379
2022-08-04 11:30:48 -04:00
3faf5d3252 Merge branch 'blender-v3.3-release' 2022-08-04 17:06:05 +02:00
Damien Picard
aa53eca6b5 I18n: make several parts of the UI translatable
- batch rename
- keyframe settings
- tool name in Tool properties header
- tool name in Tool properties Drag (fake) enum

- new file templates
- new preset
- new text datablock
- new collection datablock
- new geometry nodes (modifier and node group)
- new grease pencil data (layers and materials)

Ref. T43295

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15533
2022-08-04 17:05:34 +02:00
34912b0586 Merge branch 'blender-v3.3-release' 2022-08-04 09:34:52 -05:00
0844781961 Fix: Crash on instance on points node with empty mesh 2022-08-04 09:15:26 -05:00
50513e6964 Cleanup: Better const correctness and inlined key construction in depsgraph 2022-08-04 16:14:31 +02:00
d2a30abff0 Outliner: Use UI names and grouping for library overrides properties
NOTE: This is committed to the 3.3 branch as decided by Bastien, Dalai
and me. That is because these are important usability fixes/improvements
to have for the LTS release.

Part of T95802.

Showing properties with an RNA path in the UI isn't very user friendly.
Instead, represent the RNA path as a tree, merging together parts of the
RNA path that are shared by multiple properties. Properties and "groups"
(RNA structs/pointers) are now shown with their UI name and an icon if
any. The actually overridden properties still show the Library Overrides
icon. See the patch for screenshots.

Also: When a RNA collection item, like a modifier or constraint was
added via a library override, indicate that item and show all collection
items in the list, since the complete list of items and their orders may
be important context.

Differential Revision: https://developer.blender.org/D15606
2022-08-04 16:14:01 +02:00
585dd63c6e Cleanup: Move RNA path functions into own C++ file
NOTE: This is committed to the 3.3 branch as part of D15606, which we
decided should go to this release still (by Bastien, Dalai and me). That
is because these are important usability fixes/improvements to have for
the LTS release.

Adds `rna_path.cc` and `RNA_path.h`.

`rna_access.c` is a quite big file, which makes it rather hard and
inconvenient to navigate. RNA path functions form a nicely coherent unit
that can stand well on it's own, so it makes sense to split them off to
mitigate the problem. Moreover, I was looking into refactoring the quite
convoluted/overloaded `rna_path_parse()`, and found that some C++
features may help greatly with that. So having that code compile in C++
would be helpful to attempt that.

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

Reviewed by: Brecht Van Lommel, Campbell Barton, Bastien Montagne
2022-08-04 16:13:00 +02:00
27d31c15e8 UI: Pass modifier & constraint icon to the corresponding RNA base type
NOTE: This is committed to the 3.3 branch as part of D15606, which we
decided should go to this release still (by Bastien, Dalai and me). That
is because these are important usability fixes/improvements to have for
the LTS release.

This basically lets the UI use the constraint or modifier icon, whenever
refering to constraints/modifiers via RNA pointers. Used by D15606, so
that the "Modifiers" tree element to group the individual modifiers
together gets the right icon without hardcoded handling.
2022-08-04 16:11:14 +02:00
839422cf1c Cleanup: Remove unused ID from depsgraph time source 2022-08-04 16:09:47 +02:00
bd909ff990 Outliner: Add generic label element type
No user visible changes expected.

NOTE: This is committed to the 3.3 branch as part of D15606, which we
decided should go to this release still (by Bastien, Dalai and me). That
is because these are important usability fixes/improvements to have for
the LTS release.

We have a bunch of "base" element types, just to show a label element
for grouping together other elements. There is no reason to have these
tied to a case, just have a generic label type for this. It requires a
string to display, and can display an icon too. The new element type
isn't used yet, but will be in one of the following commits. Would be
nice if the existing base elements can be replaced by this.

Part of D15606.
2022-08-04 16:09:02 +02:00
665d3db3a4 Fix T99460: Allow creation new datablocks from evaluated
This changes makes it possible to copy evaluated result and put it
to the original bmain.

Prior to this change from the API point of view there was false
perception that it is possible, while in practice it was very fragile:
it only worked if the ID did not reference any evaluated IDs.

This change makes it so `id.copy()` Python API call will make it so
the copied ID only references original data-blocks. This sounds a bit
implicit, so here is motivational aspect why it is considered better
approach to all other:

- There needs to be a way to support the described scenario, in the
  lest fragile way. Requiring to always use an explicit function call
  or an argument is too verbose and is easy to be missed.

- The `id.copy()` is already doing implicit thing: it always adds the
  result to the bmain. So it might as well ensure the copied result
  does not reference evaluated data-blocks.

- Added clarity in the documentation should address possible confusion.

The limitation of this change is that the copy() of evaluated geometry
will clear its reference to the shape key. This is because the key is
only referenced for validness of RNA paths for drivers and the key
itself might not match topology of evaluated geometry due to modifiers.

Differential Revision: https://developer.blender.org/D15611
2022-08-04 16:02:44 +02:00
39a68b27b9 Depsgraph: More clear function name for transform dependnecy
The name was confusing to a level that it sounded like the relation
goes the opposite direction than it is intended.
2022-08-04 16:02:44 +02:00
0828361889 Cleanup: Redundant check in depsgraph builder
The build_object_data_geometry() is never called on armatures.
2022-08-04 16:02:44 +02:00
67b92418ee Outliner: Use UI names and grouping for library overrides properties
Part of T95802.

Showing properties with an RNA path in the UI isn't very user friendly.
Instead, represent the RNA path as a tree, merging together parts of the
RNA path that are shared by multiple properties. Properties and "groups"
(RNA structs/pointers) are now shown with their UI name and an icon if
any. The actually overridden properties still show the Library Overrides
icon. See the patch for screenshots.

Also: When a RNA collection item, like a modifier or constraint was
added via a library override, indicate that item and show all collection
items in the list, since the complete list of items and their orders may
be important context.

Differential Revision: https://developer.blender.org/D15606
2022-08-04 15:57:08 +02:00
79955e5f85 Docs: Note storage behavior of override operations in comment
It's not obvious that override property operations are recreated on undo
pushes, which caused me some confusion. Comment on this, so it's clear
that pointers to the operations shouldn't be stored.
2022-08-04 15:57:08 +02:00
8e3eea372d UI: Pass modifier & constraint icon to the corresponding RNA base type
This basically lets the UI use the constraint or modifier icon, whenever
refering to constraints/modifiers via RNA pointers. Used by D15606, so
that the "Modifiers" tree element to group the individual modifiers
together gets the right icon without hardcoded handling.
2022-08-04 15:57:08 +02:00
735b26053e Outliner: Add debugging utility to print an elements path
No user visible changes expected.

Adds a function that prints the "path" of an element, that is, the
ancestor elements starting from the root, separated by slashes. This can
be useful for debugging. The function isn't used.
2022-08-04 15:57:08 +02:00
2a3e4d8bcd Outliner: Add generic label element type
No user visible changes expected.

We have a bunch of "base" element types, just to show a label element
for grouping together other elements. There is no reason to have these
tied to a case, just have a generic label type for this. It requires a
string to display, and can display an icon too. The new element type
isn't used yet, but will be in one of the following commits. Would be
nice if the existing base elements can be replaced by this.

Part of D15606.
2022-08-04 15:57:08 +02:00
Germano Cavalcante
f8b5706a1f Fix T100129: Status bar incorrectly shows "[G] Move" after pressing G once in Edit Mode
Add specific modal keyitem for Vert/Edge Slide or TrackBall.

Note that there is a workround to avoid repeated keys in the status bar.

Reviewed By: campbellbarton

Maniphest Tasks: T100129

Differential Revision: https://developer.blender.org/D15597
2022-08-04 10:56:47 -03:00
Germano Cavalcante
791bfae1d6 Fix T100129: Status bar incorrectly shows "[G] Move" after pressing G once in Edit Mode
Add specific modal keyitem for Vert/Edge Slide or TrackBall.

Note that there is a workround to avoid repeated keys in the status bar.

Reviewed By: campbellbarton

Maniphest Tasks: T100129

Differential Revision: https://developer.blender.org/D15597
2022-08-04 10:54:29 -03:00
1ffb011d67 Fix T100171: GPencil toggle caps operator does not support multiframe
This was a missing feature.
2022-08-04 15:03:10 +02:00
c67d4117d4 Fix broken build due to missing include.
Caused by rBa95103f6f4abda2b. Please build blender before committing!
2022-08-04 14:52:51 +02:00
6af963ca81 Fix leak when the cursor leaves the window while dragging in Wayland 2022-08-04 22:33:28 +10:00
a10cac413e Fix the menu popup location when dropping blend files under Wayland
Even though the event's location matched the drop event,
the `wmWindow.eventstate` was not updated which was used for the
pop-up menu location.
2022-08-04 22:33:26 +10:00
ff286a9fcf Fix double-free after drag & drop with GHOST/Wayland
Resolve crash on exit after drag & drop in Wayland.
2022-08-04 22:33:25 +10:00
a95103f6f4 GHOST/Wayland: support URL decoding for file drag & drop
Paths that contained characters that needed escaping as URL's failed
to import.

Move URL decoding to a new file (GHOST_PathUtils), shared with X11 but
maybe be useful for other platforms too.
2022-08-04 22:33:23 +10:00
727cc426bc Fix drag & drop in Wayland with some applications
Drag & drop worked with GTK3 apps but not QT5 (pcmanfm-qt for eg)
as files are separated by '\n' instead of '\r\n'.

Resolve by supporting both (follow up to T99737).
2022-08-04 22:33:22 +10:00
cdd718dbb2 GHOST/Wayland: improve logging for drag & drop
Log the response for dropping events to simplify troubleshooting
drag & drop failure.
2022-08-04 22:33:20 +10:00
28e0cc424d Guarded allocator: Function to rename block for debugging
We have plenty of sorta generic functions, that allocate memory with
some generic name for debugging. When such a function is called and the
memory leaks, it may be unclear which call to it allocated the unfreed
memory (and thus which execution path leads to the leak).

The added function is only available if `NDEBUG` is not defined.

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

Reviewed by: Sergey Sharybin, Bastien Montagne
2022-08-04 11:26:57 +02:00
fdd282021a Cleanup: Fix compile warnings 2022-08-04 00:45:25 -07:00
550ebc5c8f Cleanup: quiet unused warning 2022-08-04 17:00:19 +10:00
72ab6faf5d Fix T97251: Store generated type information for each UDIM tile
Various situations can lead to un-saved UDIM tiles potentially losing
their contents. The most notable situation is a save and re-load of a
.blend file that has "generated" UDIM tiles that haven't been written to
disk yet. Normal "generated" images are reconstructed on demand in these
circumstances but UDIM tiles do not retain the information required for
reconstruction and empty tiles are presented to the user.

This patch stores the generated type information for each tile to solve
this particular issue. It also shifts the Image generation info into the
1st tile. The existing DNA fields are deprecated but RNA was modified as
to not break API compat.

There's two broad changes here that merit special callout:
- How to distinguish between a tile that should be reconstructed vs.
a tile that should remain empty because loading failed for the UDIMs
- How to better handle Image Source changes

The first issue is addressed as follows:
- Each time a tile is filled with generated content we set a new
IMA_GEN_TILE flag
- Each time a tile is saved to disk we remove the IMA_GEN_TILE flag
- When requesting an ibuf: If the ibuf is null, we check to see if
IMA_GEN_TILE is set. If it is set, go ahead and re-create the tile.
Otherwise, do nothing.

The second set of changes have to do with ensuring that information is
carried along as far as possible when the, sometimes destructive, act of
changing an Image Source is performed. Behavior should be a bit more
natural and expected now; though users will rarely, or should rarely, be
modifying this property. The full table describing the behavior is in
the differential.

Differential Revision: https://developer.blender.org/D14885
2022-08-03 22:00:52 -07:00
646207c9af Cleanup: Remove unused function 2022-08-03 22:06:07 -05:00
2083b9ae54 Cleanup: simplify uv parametrizer in preparation for C++
No functional changes.

Add casts required by C++. Simplify types.
2022-08-04 11:20:39 +12:00
dcf50cf046 Fix T100132: Disable winding when calculating islands for uv sculpt tools
Winding was originally added to island detection in 5197aa04c6.
However the sculpt tools can flip faces, potentially creating orphaned
islands if winding is enabled.

Differential Revision: https://developer.blender.org/D15600
2022-08-04 11:11:41 +12:00
8288017635 Merge branch 'blender-v3.3-release' 2022-08-03 15:18:25 -07:00
Ethan-Hall
177bc80748 Fix: add attribute with empty string name crash
Due to a recent change, empty strings are unhandled. This results
in Blender crashing.

This patch fixes the crash but a discrepancy still exists...
Prior to the regression, the empty string would be replaced by the
name of the data type. This patch uses "Attribute" for the default
name regardless of type. Restoring the previous behavior would
require making and/or modifying API methods.

Regression introduced in: rBeae36be372a6

Reviewed By: Joseph Eagar & Campbell Barton
Differential Revision: https://developer.blender.org/D14734
Ref D14734
2022-08-03 15:16:46 -07:00
f7e5a3b816 Merge branch 'blender-v3.3-release' 2022-08-03 15:06:15 -07:00
b65ab29310 Sculpt: Fix T99294: Voxel Remesher text is resized based on object scale 2022-08-03 15:05:56 -07:00
bc15812e0d Merge branch 'blender-v3.3-release' 2022-08-03 17:03:16 -05:00
1cc11e32e4 Fix: Avoid OBJ importer assert seting normals on mesh with no faces 2022-08-03 16:59:03 -05:00
6089a96be2 Cleanup: spelling, code-blocks 2022-08-04 07:54:29 +10:00
1ec7f75b2a Cleanup: format 2022-08-04 07:41:03 +10:00
cc1daa9b76 Cleanup: quiet nonnull-compare warning for GCC
All callers ensure this is not NULL.
2022-08-04 07:31:42 +10:00
Ramil Roosileht
a217e56575 Sculpt: Support gradient color mode in sculpt paint brush
T99614

Support for gradient mode in sculpt paint brush

{F13316165}

Reviewed By: Joseph Eagar & Julian Kaspar
Differential Revision: https://developer.blender.org/D15502
Ref D15502
2022-08-03 14:09:37 -07:00
Ramil Roosileht
6f62a388df Sculpt: Support gradient color mode in sculpt paint brush
T99614

Support for gradient mode in sculpt paint brush

{F13316165}

Reviewed By: Joseph Eagar & Julian Kaspar
Differential Revision: https://developer.blender.org/D15502
Ref D15502
2022-08-03 14:08:23 -07:00
9d7aac6d66 Cleanup: Use generic utility to retrieve attributes to transfer 2022-08-03 15:37:57 -05:00
a5a60d0f4f Cleanup: Fix doxygen section for custom data type 2022-08-03 13:20:01 -05:00
09df97e897 Merge branch 'blender-v3.3-release' 2022-08-03 19:55:12 +02:00
cc12f3e0ba Cleanup: fix various typos
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D15588
2022-08-03 19:28:05 +02:00
Liu Deyuan
411b4ed6ed Fix T96247: Principled BSDF roughness different in startup blend and new node
Change startup roughness to 0.5.

Differential Revision: https://developer.blender.org/D15586
2022-08-03 19:24:25 +02:00
f6ca44efd6 Fix T100106: image movie/sequence auto refresh affects still image performance 2022-08-03 19:24:09 +02:00
81d75affb1 Cleanup: Use const arguments in definition, add helper variable 2022-08-03 11:59:16 -05:00
ac32f5ac4f Merge branch 'blender-v3.3-release' 2022-08-03 19:09:57 +03:00
10c4734978 Fix T100173: fix missing removal of old name in BLO_update_defaults_startup_blend
If a screen had to be renamed, the old name was not removed from
the name map. Fixes T100173.
2022-08-03 19:09:21 +03:00
Iliay Katueshenock
55a332da64 Attribute Math: Improve performance of mixer in some cases
The `DefaultMixer` for mixing generic data types has some issues:
1. The full buffer is always zeroed, even if only some is used.
2. Finalizing also works on all values, even if only some are used.
3. "mixing" doesn't allow setting the first value, requiring that
everything is cleared beforehand.

This commit adds the following functionality:
1. Constructor with the specified `IndexMask` for preliminary zeroing.
2. `set` method to overwrite the value.
3. `finalize` with the specified mask to process a subset of values.

This is useful in situations where you want to use the
DefaultMixer without having to overwrite all the values many times.

A performance improvement was observed for NURBS curve evaluation and
attribute interpolation from the point to curve domain of about 15% and
35% respectively (100,000 curves).

Differential Revision: https://developer.blender.org/D15434
2022-08-03 10:18:02 -05:00
144027d70f Fix sequencer viewport render not respecting the "use_stamp" option
The sequencer OpenGL viewport renders would not render the metadata into
the image even if the option was on.

Did minor cleanups in the render function as well.
2022-08-03 17:15:19 +02:00
42f9430a3a Fix: Warning from incorrect use of macro
From d52551401e, exposed by recent C++ conversion.
2022-08-03 09:41:01 -05:00
9c8998ed11 Merge branch 'blender-v3.3-release' 2022-08-03 09:25:28 -05:00
06b6c004f5 Fix T100168: Sculpt positions undo not working after recent commit
efe0e2b183 used the "normals_update" for applying positions from
an undo step, which doesn't set the necessary flags for a redraw.
2022-08-03 09:18:13 -05:00
bdc30bd0fb Fix T100171: GPencil toggle caps operator does not support multiframe
This was a missing feature.
2022-08-03 15:45:08 +02:00
9896dd4d16 Merge branch 'blender-v3.3-release' 2022-08-03 10:49:45 +02:00
25517f36bc Cleanup: Improve doc of the BKE_id_copy functions. 2022-08-03 10:49:20 +02:00
d269fb1d72 Fix assert failures in the dependency graph
Happens after recent changes in the area.

The asserts were a bit too strict and were against the way how the
ID_RECALC_ALL is handled. So remove them with explanation why things
needs to be silent.
2022-08-03 09:31:05 +02:00
e3913ec6c1 Merge branch 'blender-v3.3-release' 2022-08-03 09:51:34 +03:00
89f0fedb5c Fix T97769: new OBJ exporter does not replace spaces in object names
The Python based exporter was replacing spaces with underscores
in object/group names, mostly to handle cases where names could begin
or end with spaces. The new exporter was not doing that. Note: spaces
in material names were already handled by the new exporter.

Fixes T97769. Updated test coverage expectations; one of the test
files has an object with a space in the name.
2022-08-03 09:49:56 +03:00
c9821b6c01 Fix compile issue in recent commit.
fallthrough in case statement.
2022-08-03 08:25:41 +02:00
Angus Stanton
ea70687dd5 Image: Display GPU layout in uiTemplateImageInfo
Add IMB_gpu_get_texture_format and GPU_texture_format_description to
retrieve and 'stringify' an eGPUTextureFormat. These are then used in the
image info panel used in several areas across blender.

New Information:
{F13330937}

Reviewed By: jbakker

Maniphest Tasks: T99998

Differential Revision: https://developer.blender.org/D15575
2022-08-03 08:15:12 +02:00
abc46d5aeb Fix: Timeline marker names are not correctly clipped in some cases
Timeline marker names are now correctly clipped instead of messily
overlapping each other and being unreadable. This change affects all
the animation editors (graph editor, NLA, action editor etc.) as well
as the VSE.

This also makes a change to when text is elevated. In the previous
behavior, a marker's text would be elevated if it was selected or if
the current frame was <= 4 frames away from the marker. This seems
like a completely arbitrary thing (probably added in to alleviate text
overlapping for markers that the user would be interested in). This
patch changes the behavior such that the marker's text will be elevated
if it is either selected or it is the last marker encountered relative
to the current frame.
2022-08-02 20:59:44 -07:00
84b1607196 Cleanup: make format 2022-08-03 13:27:13 +12:00
68c1eb86a6 Fix unreported: Add tie-break conditions for udim search with integers
When searching for closest UDIM with integer co-ordinates, several UDIMs
can be equidistant. Previously, of all closest UDIMs, the one which was
earliest in the list would be used. Now, "half-open interval" rules are
used to break the tie.

Motivated by 0fcc04e7bf

Differential Revision: https://developer.blender.org/D15590
2022-08-03 13:20:54 +12:00
43918ec28d Geometry Nodes: Speed up reading attribute with different type
The virtual array created by the implicit conversions had a lot of
overhead when converting many values. Implement "materialize"
functions to avoid a virtual function call for every element.
This gave me a 20x improvement when copying the values
from a float attribute as a boolean, though I doubt there are
any real world situations where it's that noticible.
2022-08-02 19:23:13 -05:00
fc1a53eb7b Cleanup: Remove unused function uv_poly_copy_aspect 2022-08-03 09:51:55 +12:00
18377c4f5e UI: Improve circle drawing of cursor for uv sculpting
Calculate segments based on radius.

Differential Revision: https://developer.blender.org/D15591
2022-08-03 09:44:06 +12:00
8081a05015 Tests: Remove deprecated/removed operators from tests
44aa9e40ff
2022-08-02 16:26:38 -05:00
f4fe3fb09b EEVEE-Next: Depth Of Field: Port implementation to compute shader
This is a port of the previous implementation but using compute
shaders instead of using the raster pipeline for every steps.

Only the scatter passes is kept as a raster pass for obvious performance
reasons.

Many steps have been rewritten to take advantage of LDS which allows faster
and simpler downsampling and filtering for some passes.

A new stabilize phase has been separated from another setup pass in order
to improve it in the future with better stabilization.

The scatter pass shaders and pipeline also changed. We now use indirect
drawcall to draw quads using triangle strips primitives. This reduces
fragment shader invocation count & overdraw compared to a bounding
triangle. This also reduces the amount of vertex shader invocation
drastically to the bare minimum instead of having always 3 verts per
4 pixels (for each ground).
2022-08-02 21:53:17 +02:00
2ea4754109 EEVEE-Next: Cleanup: Remove static references for swapchains
Those are no longer necessary.
2022-08-02 21:53:17 +02:00
335dbccc33 EEVEE-Next: Fix GL errors when rendering with transparent materials
For now, we need to always bind the render pass images even if not used.
2022-08-02 21:53:17 +02:00
75dda90030 EEVEE: Depth of field: Fix incorrect variance occlusion
The change is likely not noticeable.
2022-08-02 21:53:17 +02:00
04d43e8dbb GL: Remove lingering image binds
This updates image bind tracking to be the same as texture binds.
Adding a new bind flag to avoid conflict when the texture is used in
both slots.
Fixes a gl error in glBindImageTextures about invalid image binds.
2022-08-02 21:53:17 +02:00
d629402054 GL: Compute: Fix indirect compute barrier and unbind
This path is not used by any existing code so it isn't necessary to
backport.
2022-08-02 21:53:17 +02:00
35762cea91 DRW: common_math_lib.glsl: Fix weighted_sum macro
This avoids issue when the macro is followed by another operator.
Example:
`float result = weighted_sum(a,b,c,d,w) * 5.0;`
2022-08-02 21:53:17 +02:00
8a0f804e2b DRW: Add image unbind in debug mode
This allows finding missing binds more easily as the missing binds slots
won't be populated with previous texture binds.
2022-08-02 21:53:17 +02:00
24a0015dbd DRW: Add DRW_shgroup_call_procedural_indirect()
Replaces `DRW_shgroup_call_procedural_triangles_indirect`.
This makes the indirect drawing more flexible.
Not all primitive types are supported but it is just a matter of adding
them.
2022-08-02 21:53:17 +02:00
9a52f1f720 DRW: Add DRW_shgroup_call_procedural_triangles_indirect
Just like the name suggest, this adds a way to draw a series of proceduraly
positioned triangles using and indirect buffer.
2022-08-02 21:53:17 +02:00
710609a2e0 DRW: GPU Wrapper: Fix invalid cached texture view when ensure() reallocs 2022-08-02 21:53:17 +02:00
22143b351f DRW: GPU wrapper: Make SwapChain renference work
This make using texture reference easier. But now, it makes it mandatory
for the wrapped type to implement the `swap()` static method.
2022-08-02 21:53:17 +02:00
04160ffd12 DRW: GPU wrappers: Expose more ease of use functions and cleanup style 2022-08-02 21:53:17 +02:00
1e5ab041d7 GPUBatch: Add GPU_batch_draw_indirect
This allows rendering a batch with parameters computed by the GPU.

Contains GL backend implementation.
2022-08-02 21:53:17 +02:00
7220619554 EEVEE-Next: Expose Motion blur shutter curve in render panel
It is now fully supported.
Also reorder panels to keep EEVEE-Next panels in the same ordered as
EEVEE's ones.
2022-08-02 21:53:17 +02:00
c5b361335a Cleanup: Simplify functions for adding and removing color attributes
The specific functions for vertex colors and and sculpt vertex colors
can be replaced by more generic attribute functions internally.
Also remove a paramter from one function.
2022-08-02 14:43:36 -05:00
44aa9e40ff Cleanup: Remove unused sculpt and vertex color operators
The "Color Attributes" system from f7bbc7cdbb has replaced
both "Sculpt Vertex Colors" and "Vertex Colors" in the UI. The Operators
for adding and removing them are unused now.

This commit does not break backwards compatibility with the Python
API, it only removes the operators, which generally aren't used by
addons anyway. The mesh RNA properties will be removed in 4.0 (T100153).

Differential Revision: https://developer.blender.org/D15077
2022-08-02 14:17:20 -05:00
a48e5c53a5 Cleanup: Simplify const cast in virtual array construction 2022-08-02 13:44:07 -05:00
2ba2efc296 Cleanup: Simplify arguments to sculpt draw functions
Instead of passing pointers to specific mesh data, rely on
retrieving that data from the mesh internally. This makes
it easier to support retrieving additional data from Mesh
(like active attribute names in D15101 or D15169). It also makes
the functions simpler conceptually, because they're drawing
a mesh with an acceleration strcture on top.

The BKE_id_attribute_copy_domains_temp call was unnecessary
because the GPU_pbvh_mesh_buffers_update function was only
called when Mesh/PBVH_FACES is used in the first place.

Differential Revision: https://developer.blender.org/D15197
2022-08-02 13:32:45 -05:00
e4fd2d5754 Fix T99812: Audio scrubbing freezes Blender 3.2.1
Bug was caused by a change in ffmpeg's API.
2022-08-02 20:17:46 +02:00
5ddaf2fa7b Merge branch 'blender-v3.3-release' 2022-08-02 21:01:54 +03:00
ead8260a49 Object: move collection resync after empty duplicate early-out
As pointed out in rB02b1a209be88 comment, the BKE_main_collection_sync
should be after "nothing to duplicate" early-out.
2022-08-02 21:01:25 +03:00
b010985e4a Fix T99255: Strips inserting incorrectly
When dropping file to sequencer timeline, coordinates for strip position
and overlap handling are used even if not set.

Reset internal state in on_drag_start callback and set is_modal
variable only if coordinates are updated. This way when dragging file
from external file browser, strip is added at current frame as before
modal operator was implemented.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D15333
2022-08-02 19:36:42 +02:00
2d4498e457 Merge branch 'blender-v3.3-release' 2022-08-02 11:11:20 -05:00
efe0e2b183 Fix T96810: Invalid sculpt normals after some operations
Mask and color brushes were using the existing PBVH vertex "update tag"
to mark their modifications. This was mostly unnecessary, and causes
unnecessary calculation of normals. It also caused errors though,
because they didn't tag the corresponding PBVH node for normal
recalculation, causing problems on the borders of nodes, since one
node might accumulate into another's vertex normals, but the other
node wouldn't also accumulate and normalize the normals.

The solution is to only use the update tag for tagging deformed
vertices that need recalculated normals. Everything else is handled at
the PBVH node level (which was already the case, but it wasn't clear).

The update tag was also used for undo to tag the nodes corresponding to
changed vertices. This was wrong though, because normals and visibility
would also be recalculated for just color or mask undo steps. Instead,
just use local arrays to map from vertices to nodes.

Differential Revision: https://developer.blender.org/D15581
2022-08-02 11:00:57 -05:00
ac9d9c993a Merge branch 'blender-v3.3-release' 2022-08-02 17:57:12 +02:00
97b226ac51 Fix T100049: Crash when render finishes
Caused by NULL dereference of `Editing` before NULL check was done.
2022-08-02 17:52:40 +02:00
09ac5f97a7 GPencil: Fix compiler warning
The variable can never be NULL and the comparison was wrong.
2022-08-02 17:03:33 +02:00
dadfdc8226 Merge branch 'blender-v3.3-release' 2022-08-02 09:51:08 -05:00
d3eef4d22a Fix: Use evaluated materials in OBJ exporter
Since 1a81d268a1, materials on object data can change during
evaluation. But a different function is necessary to retrieve materials
taking that into account.

Solves part of T96721.

Differential Revision: https://developer.blender.org/D15595
2022-08-02 09:49:51 -05:00
Pratik Borhade
074ce49de0 Automated testing: Add operators tests
Part of {T84999}
This patch adds test for
- `dissolve_limited`
- `dissolve_mode`
- `merge_normals`

Updated blend file:
{F13162744}

Reviewed By: zazizizou, mont29

Differential Revision: https://developer.blender.org/D15187
2022-08-02 16:43:42 +02:00
84aa8b85a2 Merge branch 'blender-v3.3-release' 2022-08-02 15:07:54 +02:00
e4dd644d6b LibOverride: Add 'editable/clear' toggle to ID template.
Now when an ID template is set to an override ID, `Shift-Click` on the
right button toggles between making it user-editable (if it's a system
override), or clearing any user edit and setting it back to system override.
2022-08-02 15:07:33 +02:00
2a7e83ce18 LibOverride: Expose in public API the utils to get actual override data.
This is useful when input ID is a 'non-override' one (like embedded IDs
or shapekeys), to get override data and 'owner' ID pointer.
2022-08-02 15:07:33 +02:00
0830320a7c CMake: Check if freetype is compiled with brotli support
Because of the recent changes to our core fonts,
Freetype has to support Woff2 fonts or Blender will segfault on startup.

This adds an explicit check for this to inform people compiling Blender
about this requirement.
2022-08-02 14:50:38 +02:00
25a0124bc8 Fix T100119: Light object's parametric vector distorted in blender 3.4
Caused by 38af5b0501.

Adjust barycentric coordinates used for intersection result in the
ray-to-rectangle intersection check.

Differential Revision: https://developer.blender.org/D15592
2022-08-02 14:17:10 +02:00
588791df63 Fix compilation error after recent DNA changes
Apparently, Clang allows to specify underlying enum type in C
but onot GCC. The latter one is actually closer to the standard.
2022-08-02 14:15:53 +02:00
4e2af28bc7 Merge branch 'blender-v3.3-release' 2022-08-02 13:42:14 +02:00
78ad9ebed3 Fix T99715: Only force optimal display during on cage editing.
This loosens the current implementation a bit to only force optimal
display when editing on cage. It used to be any editing mode.

Brings GPU based subdivision closer to the CPU version.
2022-08-02 13:38:34 +02:00
33e4ecc750 Merge branch 'blender-v3.3-release' 2022-08-02 12:55:29 +02:00
33d0b7c5bd Fix T100133: Crash when linking an evaluated object to a collection.
Note that ideally, we should have a protection mechnism at global RNA
level, making e.g. any evaluated data read-only... But for now, give
better (and more consistent) protection for the collections' link/unlink
of children collections  and objects.
2022-08-02 12:54:08 +02:00
fdf34666f0 Fix Unreported : add F-curves only filter to functions only appliable to F-curves channels.
The filter was missing in some places that are using channel data as if it was f-curve channel.
There seems to be no related issue or bug, but still it would be best to have them there.

Reviewed By: sybren

Differential Revision: http://developer.blender.org/D15505
2022-08-02 12:27:53 +02:00
bb7747e7ca Fix undefined behavior in dependency graph tagging
The tagging code was iterating over bits set in the ID_RECALC_ALL and
was casting the flag to IDRecalcFlag. This was triggering an undefined
behavior warning in Clang since the bit might not have a corresponding
value in the enumerator.

The solution is to pre-define all reacalc flags for all bits. While
this seems a bit annoying this seems to be the least fragile solution
from all suggested ones.

Differential Revision: https://developer.blender.org/D15602
2022-08-02 11:50:54 +02:00
1c90ab7bf2 Depsgraph: Make naming and recalc flag sign consistent
Always use unsigned int for the recalc flags. This allows to use
all 32 bit of integer for the flags without worrying about the
sign. Use full notation of `unsigned int` instead of short `uint`
to avoid pulling more headers in.

Whenever depsgraph API allows passing combined recalc flags call
the variable `flags` and use `unsigned int` type for it. For a
single flag use `IDRecalcFlag` flag.

No functional changes expected.
2022-08-02 11:38:16 +02:00
670ced9758 GPencil: Allow import several SVG at time
For SVG is very convenient to be able to import several SVG in one operation. Each SVG is imported as a new Grease Pencil object.

Also, now the SVG file name is used as Object name.

Important: As all SVG imported are converted to Grease Pencil object in the same location of the 3D cursor, the SVG imported are not moved and the result may require a manual fix of location. The same is applied for depth order, the files are imported in alphabetic order according to the File list.

Reviewed By: mendio, pepeland

Differential Revision: https://developer.blender.org/D14865
2022-08-02 09:46:32 +02:00
f263334529 Merge branch 'blender-v3.3-release' 2022-08-02 09:28:38 +03:00
02b1a209be Fix T100118: Crash after Shift+D with nothing selected and then making new object
Regression from rB2d041fc46823, the "nothing to do, return" code path
was not re-enabling layer collection sync. Fixes T100118.
2022-08-02 09:28:17 +03:00
1ac956a9f9 Cleanup: simplify uv parametrizer in preparation for C++
No functional changes.

Add casts required by C++. Simplify destructors. Simplify types.
2022-08-02 10:53:16 +12:00
1dc503b33a Nodes: Remove node after link drag search cancel
Remove the node if the transform operation is cancelled rather than
confirmed. This is consistent with the regular search menu.
2022-08-01 17:03:21 -05:00
2c00889d3e Cleanup: simplify function for adding node to editor
Split it into two functions, one for static node types,
and another for ID names.
2022-08-01 16:32:43 -05:00
6b6d3b86d5 Merge branch 'blender-v3.3-release' 2022-08-01 21:19:27 +03:00
2542fda14d Fix T99502: OBJ/MTL import: behavior changed for missing texture files
Python based OBJ importer, as well as glTF2 importer, are creating
"placeholder" images for texture images that can't be found. These
are empty textures (displayed as magenta), but with their file paths
set so that File > External Data > Report Missing Files can report
them as missing.

Make the new C++ OBJ importer do the same as well. Fixes T99502.
2022-08-01 21:14:14 +03:00
0fade955dd USD import: Handle material purpose
This is a partial fix for T90535.

USD allows binding materials generically as well as for a
specific purpose. I.e., purpose may be generic (unspecified)
or one of

- Full: truest representation of the scene
- Preview: lightweight material for preview

Curently, only generically bound materials, with unspecified
purpose (allPurpose), are imported. This issue is preventing
preview materials from being imported in the Alab scene.

This patch adds logic to attempt to fall back on importing
preview or full materials, in that order, if there is no
generic material bound to the mesh.

Reviewed by: Sybren

Differential Revision: https://developer.blender.org/D15352
2022-08-01 12:14:05 -04:00
Pratik Borhade
3e8bd1f6e4 Fix T100040: Crash when transform applied on multi-user image
Affected by rB8621fdb10dc4
Crash if single-user data is created when we apply transform
on multi-user image data. Crash occurs because creation of new copy
was not handled in `single_obdata_users` for empty objects (image for example)

Reviewed By: dfelinto, mont29

Maniphest Tasks: T100040

Differential Revision: https://developer.blender.org/D15587
2022-08-01 17:16:30 +02:00
99f2b59fe6 Merge branch 'blender-v3.3-release' 2022-08-01 16:53:06 +02:00
4d8018948d Fix T99820: missing 'no more mising' tagging on reloaded libraries.
Can be also backported to 2.93LTS.
2022-08-01 16:52:45 +02:00
577a2a5dbe Merge branch 'blender-v3.3-release' 2022-08-01 15:24:48 +02:00
f08ea76db5 GPU: Fix failing compute tests.
Tests created GPUTextures with incorrect mipmaps.
2022-08-01 15:23:53 +02:00
e0603f77af Merge branch 'blender-v3.3-release' 2022-08-01 15:02:31 +02:00
e9586b14b7 Eevee: Add support of rendering curves with cryptomatte.
There were 2 errors.
1. hair code was used to draw curves
2. vertex shader wasn't aware of curves and failed to compile.
2022-08-01 15:00:47 +02:00
33e5a66f67 Merge branch 'blender-v3.3-release' 2022-08-01 14:48:44 +02:00
55c5eb3312 Eevee: Fix compilation error in eevee-next.
Although eevee-next is disabled in Blender 3.3 there is an error that is
visible when compiling shaders using the shader builder.

This is because of an error in a preprocessing directive (defined should
be define).
2022-08-01 14:47:18 +02:00
19a7a013ce Merge branch 'blender-v3.3-release' 2022-08-01 14:37:16 +02:00
afd1357aa8 tweaks & fixes to UI messages. 2022-08-01 14:36:06 +02:00
Damien Picard
3239cea726 I18n: make presets translatable
Presets are used all over the Blender UI, but were so far untranslatable.

This adds the translation code as well as a new `dump_preset_messages()` function in the message extraction. This goes over all bundled preset file names and extracts them.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15570
2022-08-01 14:09:41 +02:00
Damien Picard
543b47f162 I18n: make newly added constraints' names translatable.
This is the same principle as D15418 and D15532, but this time it's
only really needed for "IK".

Nevertheless it's probably good to add them anyway in case they get
renamed and don't share a translation with other messages somewhere
else in the code, for instance if it is decided that new constraint names
shouldn’t include spaces, like other data do.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15571
2022-08-01 14:08:53 +02:00
Damien Picard
1875c5d24c I18n: make Grease Pencil modifiers and shader FX translatable.
Pretty much like D15418: add `N_()` macro around names for
Grease Pencil modifiers and shader FX.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15532
2022-08-01 13:58:23 +02:00
76169472d3 Cycles: Resolve recent performance regression in oneAPI implementation for Intel® Arc™ GPUs
Recently, performance with oneAPI have regressed due some recent
changes in Blender itself. This commit's changes is resolving this
and also improve compilation time for oneAPI backend first
execution (or Blender compilation time in case of AoT).

Regression have appeared after 5152c7c152 and not related to the
changes itself, but increase of kernels complexity introduced with
it. Changes in this commit is marking some Blender functions as
noinlined for oneAPI backend, which helps GPU compiler to deal with
this complexity without any negative side-effects on performance.
2022-08-01 12:45:34 +02:00
0adedaa4cc Merge branch 'blender-v3.3-release' 2022-08-01 13:39:59 +03:00
e2be6bc03f Fix T100076: OBJ import: new importer doesn't use //relative/image/paths
The Python based importer had logic to immediately turn image paths
into relative-to-blender-file paths, if user preference for relative
paths is used (which is on by default). The new importer code did not
have that. Fixes T100076.
2022-08-01 13:39:08 +03:00
Jeroen Bakker
3393b7137e RenderReport: Add option to add platform specific overrides.
Reference images in the reference_override_dir will be chosen before
images in reference_dir. This allows platform specific reference
images, with a common base.

Ignored when set to None. The caller is responsible
of setting the reference override dir as the unit test is more aware
what the definition of a platform is.

Patch adds `gpu.platform.device_type_get` function to get the device
type that blender has detected.

Reviewed By: brecht

Maniphest Tasks: T99046

Differential Revision: https://developer.blender.org/D15265
2022-08-01 10:57:32 +02:00
6749a4a8f0 Cleanup: missing braces warning 2022-08-01 11:02:18 +10:00
ca172677b1 Cleanup: simplify uv parametrizer in preparation for C++
Replace `PChart` allocation with simpler calloc/free
2022-08-01 09:46:39 +12:00
17567c235a Cleanup: Remove mesh edge "tmp tag"
Ref T95966. Also fixes modification of input mesh,
which should be considered constant.
2022-07-31 11:56:44 -05:00
5b1ad3d7cf Merge branch 'blender-v3.3-release' 2022-07-31 18:32:26 +03:00
bea5281919 Fix T100075: OBJ import: images loaded multiple times instead of being reused
The new OBJ/MTL importer was creating a new image for any referenced
texture, even if another material (or another property of the same
material) already referenced the same texture. Make it use
BKE_image_load_exists function just like Collada or USD importers do.

Fixes T100075. Extended test coverage to count imported images;
without the fix import_cubes_with_textures_rel would have incorrectly
created 5 images instead of 4.
2022-07-31 18:10:48 +03:00
8c8c744f9d Merge branch 'blender-v3.3-release' 2022-07-31 13:19:35 +02:00
27e6962bed Fix T100086: GPencil Bezier curve edit not updated after smoothing
The stroke was recalculated, but the curve data was not updated.
2022-07-31 13:19:09 +02:00
a49b49d934 Cleanup: simplify uv parametrizer in preparation for C++
Replaces PCHART_HAS_PINS with `bool has_pins`.
2022-07-31 19:17:46 +12:00
3c5620aabd Cleanup: Move interface_region_tooltip.c and header to C++ 2022-07-30 16:40:41 -05:00
af6f0f1757 Fix failing blenlib test from previous commit
Commit 310be2e37c did not update UI_MENU_ARROW_SEP used in tests.
2022-07-30 09:27:32 -07:00
310be2e37c UI: UI_MENU_ARROW_SEP Unicode Character
Use a smaller arrow text character as menu item separator.

See D15578 for examples and details.

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

Reviewed by Julian Eisel
2022-07-30 07:54:12 -07:00
a581460728 UV: Add options for uv select similar in island mode
In island selection mode, add new options for uv select similar:

* Area UV
* Area 3D
* Face (number of faces in island)

See also https://developer.blender.org/T47437
Differential Revision: https://developer.blender.org/D15553
2022-07-30 23:24:11 +12:00
d31886b3fe Cleanup: braces around statements in OBJ parser 2022-07-30 13:10:35 +03:00
1a0fab56b4 Merge remote-tracking branch 'origin/blender-v3.3-release' 2022-07-29 23:23:07 -07:00
8ae14bc1d7 Fix 100035: Make UDIM detection less aggressive
There's been a handful of reports where "obviously" not a UDIM filenames
were detected as such during image open.[1]

This change makes the detection less aggressive by enforcing that the
4-digit sequence be delineated on both sides by one of the following 3
characters ., -, _

This fixes the problem for such filenames as:
"screenshot-1080p.png", "Image-1920x1080.png", "(1999) Photo.png", and
"antiguaChestnut_X_1240Wx814H.png"

[1] T97366 T98918 T99154 T100035

Differential Revision: https://developer.blender.org/D15573
2022-07-29 23:17:41 -07:00
aa7734c9da Cleanup: Clang tidy 2022-07-29 23:23:50 -05:00
599a7ddf17 Cleanup: Move five interface files to C++
Builds on all four platforms on the buildbot. Includes clang tidy fixes.
2022-07-29 23:22:31 -05:00
e6b1e97dd7 Sculpt: fix broken triangle/vertex count for DynTopo 2022-07-29 19:12:40 -07:00
d7cfb6ac71 Sculpt: Opaque vertex type for sculpt
This is a port of sculpt-dev's `SculptVertRef` refactor
(note that `SculptVertRef was renamed to PBVHVertRef`)
to master. `PBVHVertRef` is a structure that abstracts
the concept of a vertex in the sculpt code; it's simply
an `intptr_t` wrapped in a struct.

For `PBVH_FACES` and `PBVH_GRIDS` this struct stores a
vertex index, but for `BMesh` it stores a direct pointer
to a BMVert.  The intptr_t is wrapped in a struct to prevent
the accidental usage of it as an index.

There are many reasons to do this:

* Right now `BMesh` verts are not logical sculpt verts;
  to use the sculpt API they must first be converted to indices.
  This requires a lot of indirect lookups into tables, leading to performance
  loss.  It has also led to greater code complexity and duplication.
* Having an abstract vertex type makes it feasible to have one unified
  temporary attribute API for all three PBVH modes, which in turn
  made it rather trivial to port sculpt brushes to DynTopo in
  sculpt-dev (e.g. the layer brush, draw sharp, the smooth brushes,
  the paint brushes, etc).  This attribute API will be in a future patch.
* We need to do this anyway for the eventual move to C++.

Differential Revision: https://developer.blender.org/D14272
Reviewed By: Brecht Van Lommel
Ref D14272
2022-07-29 19:03:51 -07:00
27a16abe81 Sculpt: fix name collision in DynTopo temp attributes
The attributes PBVH_BMESH uss to store the owning node
for vertices and faces were being created with the same
name, which is no long allowed.
2022-07-29 18:58:36 -07:00
9b9417b661 Cleanup: Replace reinterpret_cast<> with static_cast<> in UI code 2022-07-29 18:45:12 +02:00
03cd794119 Fix attempt for MSVC build error after 42ccbb7cd1 2022-07-29 18:10:26 +02:00
091156f64a Merge branch 'blender-v3.3-release' 2022-07-29 18:00:50 +02:00
Brecht Van Lommel
cfd16c04f8 Build: hide all symbols except a few required ones on Linux
Instead of specifying which symbols to hide, we hide all and make a few
visible. Some users may be relying on calling internal Blender functions,
but Windows is already hiding all of them and this is just not supported.

Fixes T99900: crash with some third-party Python libraries since OneAPI

Ref T76442

Differential Revision: https://developer.blender.org/D14971
2022-07-29 17:54:32 +02:00
42ccbb7cd1 Cleanup: Move RNA path functions into own C++ file
Adds `rna_path.cc` and `RNA_path.h`.

`rna_access.c` is a quite big file, which makes it rather hard and
inconvenient to navigate. RNA path functions form a nicely coherent unit
that can stand well on it's own, so it makes sense to split them off to
mitigate the problem. Moreover, I was looking into refactoring the quite
convoluted/overloaded `rna_path_parse()`, and found that some C++
features may help greatly with that. So having that code compile in C++
would be helpful to attempt that.

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

Reviewed by: Brecht Van Lommel, Campbell Barton, Bastien Montagne
2022-07-29 16:56:48 +02:00
187d90f036 Merge branch 'blender-v3.3-release' 2022-07-29 15:33:25 +02:00
1665e40e16 install_deps: Add handling of libaom, update ffmpeg build for it.
Ref T98555.
2022-07-29 15:32:02 +02:00
d3879e9aaa Merge branch 'blender-v3.3-release' 2022-07-29 15:17:40 +02:00
065dfe744c install_deps: bump IMath/OpenEXR to 3.1.5.
Ref T98555.
2022-07-29 15:17:15 +02:00
3a138a74e5 install_deps: add building of Alembic binaries.
Those are used by alembic regression tests.
2022-07-29 15:17:15 +02:00
Tianhao Chai
b862cf0b9f Fix Cycles build error with CUDA on arm64
Checking arm64 assembly support before CUDA/Metal would cause NVCC to
generate inline arm64 assembly.

Differential Revision: https://developer.blender.org/D15569
2022-07-29 14:57:09 +02:00
a679164cf6 Merge branch 'blender-v3.3-release' 2022-07-29 12:25:31 +02:00
ae0b8e904c Fix (unreported) lib-linking of ID properties not taking library parameter.
While this was not a critical issue (that lib pointer is only used for
some kind of sanity check that no linked data uses local ID pointers),
better to keep `IDP_BlendReadLib` in sync with all other lib-linking
code.
2022-07-29 12:25:15 +02:00
b639e60864 Realtime Compositor: Add needed GPU module changes
This patch implements the necessary changes to the GPU module that are
needed by the realtime compositor.

A new function GPU_material_from_callbacks was added to construct a GPU
material from a number of callbacks. A callback to construct the
material graph by adding and linking the necessary GPU material nodes.
And the existing code generator callback. This essentially allows the
construction of GPU materials independent of node trees and without the
need to do any node tree localization.

A new composite source output to the code generator was added. This
output contains the serialization of nodes that are tagged with
GPU_NODE_TAG_COMPOSITOR, which are the nodes linked to the newly added
composite output links.

Two new GPU uniform setters were added for int2 and matrix3 types.

Shader create info now supports generated compute sources.

Shaders starting with gpu_shader_compositor are now considered part of
the shader library.

Additionally, two fixes were implemented. First, GPU setter node
de-duplication now appropriately increments the reference count of the
references resources. Second, unlinked sockets now get their value from
their associated GPU node stack instead of the socket itself.

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

Reviewed By: Clement
2022-07-29 08:47:52 +02:00
c3ca487498 Render: Propagate view updates to draw engines
Currently, draw engines are not notified of view updates if a render
engine is active and was updated. It is unclear why this is the case
currently, but this behavior was part of the initial commit.

This patch propagates view updates regardless if the update was handled
by an active render engine. This is needed by the realtime compositor as
it implements logic for view updates, which currently does not execute
if Cycles is rendering for instance.

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

Reviewed By: Brecht
2022-07-29 08:30:51 +02:00
4815772fda Cleanup: quiet warnings in recent BLF and rna_ui changes 2022-07-29 13:48:09 +10:00
e9bd6abde3 BLF: New Font Stack for Better Language Coverage
Replace our existing two fonts with a stack of new fonts to increase
and improve language coverage and to add many new symbols and icons.
Covers glyphs of top 44 languages - 1.5 billion more potential users.

See D10887 for lots of details.

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

Reviewed by Brecht Van Lommel
2022-07-28 20:09:20 -07:00
c0845abd89 BLF: Fonts with FT_Face Optional
Allow FontBLFs to exist with NULL FT_Face, added only when actually
needed. Speeds up startup and unused fonts are not loaded.

See D15258 for more details.

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

Reviewed by Brecht Van Lommel
2022-07-28 17:50:34 -07:00
848dd4a40a BLF: Don't Print Empty Strings
Optimize font drawing by skipping empty strings.

See D15472 for more details.

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

Reviewed by Campbell Barton
2022-07-28 17:28:05 -07:00
e261290cb6 Merge branch 'blender-v3.3-release' 2022-07-28 17:40:42 -05:00
6ca602dd9f Fix T99761: Curves sculpt mode crash with empty curves
The virtual arrays may be null if the curves are empty,
it's simple to just skip the domain interpolation completely.
2022-07-28 17:39:10 -05:00
a9c74a0cd0 Fix set iterator test failure on macOS
This is a quite interesting case, where two arguments to a function are
evaluated in different order on Apple Clang than on GCC and I guess
MSVC. Left a comment on that.
2022-07-28 23:53:33 +02:00
3d91a853b2 Cleanup: Nodes: Store node group idname in tree type
There was already a utility to retrieve the correct node group idname
from the context, `node_group_idname`, but often it's clearer to
use lower-level arguments, or the context isn't accessible.
Storing the group idname in the tree type makes it accessible
without rewriting it elsewhere.
2022-07-28 16:34:17 -05:00
4757a5ad33 Cleanup: Make BKE_idprop.h self sufficient
It relied on uint, which is defined in a separate header.
2022-07-28 16:20:36 -05:00
eea1f9b1df Merge branch 'blender-v3.3-release' 2022-07-28 16:08:36 -05:00
1adeae56e6 Fix: Grammar mistake in info message 2022-07-28 16:08:20 -05:00
5c2fff306e Cleanup: Use LISTBASE_FOREACH macro 2022-07-28 16:02:46 -05:00
72d8a40a3d Cleanup: Use const context argument for UIList callbacks 2022-07-28 16:02:15 -05:00
cf61be6190 Cleanup: Use new IDProperty creation API for geometry ndoes modifier
Use the API from 36068487d0 instead
of the uglier `IDPropertyTemplate` API.
2022-07-28 15:50:39 -05:00
543ea41569 Cleanup: Remove unused node "add and link node" operator
The link drag search from 11be151d58 implements
this now. It was added in 3ebe7d970e but never used.
2022-07-28 15:40:32 -05:00
19528cfecd Merge branch 'blender-v3.3-release' 2022-07-28 21:31:14 +02:00
79ab76e156 Cleanup: simplifications and consistency for vector types
* OneAPI: remove separate float3 definition
* OneAPI: disable operator[] to match other GPUs
* OneAPI: make int3 compact to match other GPUs
* Use #pragma once
* Add __KERNEL_NATIVE_VECTOR_TYPES__ to simplify checks
* Remove unused vector3
2022-07-28 21:27:13 +02:00
fb42c5838c Revert "Fix T98773: GPU Subdivision breaks auto selection in UV edit mode"
This reverts commit e2c02655c7. It was already
reverted in the 3.2 branch, as it caused more serious issues than it solved.

Fixes T99805, T99323, T99296.
2022-07-28 21:20:51 +02:00
d094a3722c Fix wrong post-increment operators & test for BLI containers 2022-07-28 20:45:28 +02:00
9c65af2df0 Merge branch 'blender-v3.3-release' 2022-07-28 21:27:14 +03:00
68db023329 ID namemap: fix missing removal of old name in do_versions_rename_id
Was causing an assert that the old name exists in the name map, but
is not present in the actual database. Reported in #blender-coders
2022-07-28 21:26:30 +03:00
ae89fcfdaf Merge branch 'blender-v3.3-release' 2022-07-28 14:36:49 -03:00
fafb901baa PyDoc: fix 2D builtin shaders documentation
2D shaders require the `vec2` attribute for "pos" (not `vec3`)
2022-07-28 14:36:07 -03:00
2b9d4af261 EEVEE-Next: UI: Make Vector pass greyed out when motion blur is enabled
Also clears the render result to 0 to avoid invalid motion vectors.
2022-07-28 17:01:05 +02:00
53fc9add51 EEVEE-Next: Cleanup: Isolate render result readback and prototype progress
Still not working but the idea is to read the result and display the
first image sample so that user has a better feedback of the
rendering.
2022-07-28 17:01:05 +02:00
1e0aa2612c EEVEE-Next: Motion Blur new implementation
The new implementation leverage compute shaders to reduce the
number of passes and complexity.

The max blur amount is now detected automatically, replacing the property
in the render panel by a simple checkbox.

The dilation algorithm has also been rewritten from scratch into a 1 pass
algorithm that does the dilation more efficiently and more precisely.

Some differences with the old implementation can be observed in areas with
complex motion.
2022-07-28 17:01:05 +02:00
82327ce01d DRW: TextureFromPool: Change API to use acquire / release
This removes the quirk of having to call the sync function for each new
render loop.

# Conflicts:
#	source/blender/draw/engines/eevee_next/eevee_view.cc
2022-07-28 17:00:46 +02:00
0830ff55d8 EEVEE-Next: Fix Vector render pass 2022-07-28 16:58:01 +02:00
aacdaa7b1a Merge branch 'blender-v3.3-release' 2022-07-28 16:32:27 +02:00
ea23e937ce Cleanup/refactor: Readfile: Add dedicated function to insert ID pointers in libmap.
New `oldnewmap_lib_insert` does nothing special, it just wraps around existing
`oldnewmap_insert`, but it's the logical counter part of `oldnewmap_liblookup`.

It also helps tremendously when debuging complex ID pointers issues in
readfile.c code.
2022-07-28 16:29:57 +02:00
f3be8e66d7 Fix (studio-reported) crash in some rare cases in blendfile read code.
Crash would happen when a linked ID would become missing, that was
'pre-declared' and used only once as a 'weak link' in another library
stored before the one it came from.

In that case, the place-holder generated in read code would be freed in
`read_library_clear_weak_links`, when handling its 'owner' library, but
since all previous libraries in the list had already been 'lib_linked'
and their filedata (and related libmap) freed, the update of the libmaps
in `read_library_clear_weak_links` would not apply to data from those
previous libraries, leading to ID pointers there pointing to freed
memory.

This fix should also be backported to 2.93.
2022-07-28 16:29:57 +02:00
69bf74bd76 Merge branch 'blender-v3.3-release' 2022-07-28 16:40:37 +03:00
c49717a824 Fix T100017: OBJ: new importer does not import vertices that aren't part of any face
The Python based importer had a special case handling of "no faces in
the whole file at all", where it ended up treating the whole file
as essentially a point-cloud-like object (just loose vertices, no
faces or edges). The new importer code was missing this special case.

Fixes T100017. Added gtest coverage that was failing without the fix.
2022-07-28 16:39:42 +03:00
Iliay Katueshenock
07e201ec13 Geometry Nodes: add assert to check if node supports lazyness
Only nodes supporting lazyness can mark inputs as unused. For other
nodes, this is done automatically of all outputs are unused.

Differential Revision: https://developer.blender.org/D15409
2022-07-28 13:39:40 +02:00
d892f96cb1 Cleanup: Fix typo in comment 2022-07-28 12:52:20 +02:00
d034c28f51 Merge branch 'blender-v3.3-release' 2022-07-28 11:42:46 +02:00
ccb9d5d307 Curves: enable density brush when first entering curves sculpt mode
Previously, no tool was selected, which was a bug.
2022-07-28 11:41:36 +02:00
aa7d130347 Curves: improve handling of empty surface meshes 2022-07-28 11:37:35 +02:00
6ae9565d06 Cleanup: quiet GCC stringop-overflow warning 2022-07-28 16:08:59 +10:00
d41f0c7b15 Cleanup: unused header 2022-07-28 16:01:29 +10:00
a98102e32e Merge branch 'blender-v3.3-release' 2022-07-28 09:39:57 +10:00
8d4fa03e5c BLI_math: improve symmetrical values from sin_cos_from_fraction
When plotting equally distant points around a circle support an extra
axis of symmetry so twice as many exact values are repeated than
originally added in [0], see code-comments for a detailed explanation.
Tests to ensure accuracy and exact symmetry have been added too.

Follow up on fix for T87779.

[0]: 087f27a52f
2022-07-28 09:39:54 +10:00
397731d4df BLI_math: improve symmetrical values from sin_cos_from_fraction
When plotting equally distant points around a circle support an extra
axis of symmetry so twice as many exact values are repeated than
originally added in [0], see code-comments for a detailed explanation.
Tests to ensure accuracy and exact symmetry have been added too.

Follow up on fix for T87779.

[0]: 087f27a52f
2022-07-28 09:34:46 +10:00
ff048f5d27 Curves: Avoid virtual function overhead when finding selected curves
This showed up on a profile of sculpting with the comb brush.
Use a span instead of a virtual array.
2022-07-27 15:41:32 -05:00
165fa9e2a1 Merge branch 'blender-v3.3-release' 2022-07-27 21:26:18 +02:00
38af5b0501 Cycles: switch Cycles triangle barycentric convention to match Embree/OptiX
Simplifies intersection code a little and slightly improves precision regarding
self intersection.

The parametric texture coordinate in shader nodes is still the same as before
for compatibility.
2022-07-27 21:03:33 +02:00
69f2732a13 Cleanup: remove unnecessary bvh_instance_motion_pop 2022-07-27 21:02:21 +02:00
cd47d1b2ed Fix broken BVH2 on CPU after recent changes
Runtime switching between Embree and BVH2 got lost.
2022-07-27 20:58:02 +02:00
55fb2abc81 Curves: Bring back parallel copying of curve and point attributes
This was removed in cacdea7f4a to fix a bug, but copying point
and curve attributes should be fine as long as the attribute arrays are
retrieved before-hand.

Differential Revision: https://developer.blender.org/D15541
2022-07-27 11:52:11 -05:00
0dcfd93c6e Fix: curves edit hints not propagated in Join Geometry node
Found while investigating why crazy-space editing didn't work in T100026.
2022-07-27 18:38:45 +02:00
6e5eb46d73 Fix T100026: crash with zero-sized attributes
The problem was that zero-sized and non-existant attributes were
handled the same in some parts of the attribute API, which led to
unexpected behavior.

The solution is to properly differentiate the case when an attribute
does not exist and when it is just empty (because the geometry
is empty).

Differential Revision: https://developer.blender.org/D15557
2022-07-27 18:20:22 +02:00
d6b970dd7b Merge branch 'blender-v3.3-release' 2022-07-27 18:07:29 +02:00
84a3ff63d0 Fix: missing evaluated offsets in Resample Curve node
Differential Revision: https://developer.blender.org/D15556
2022-07-27 18:05:31 +02:00
84272ce19a Fix: add missing return
It was correct but less efficient without this early return.
2022-07-27 17:54:49 +02:00
5560da7ceb Revert "Blender 3.3 splashscreen"
This reverts commit d61ab45385.
2022-07-27 17:32:21 +02:00
37ebd66570 Revert "Blender 3.3 - Beta"
This reverts commit 32a9aac3b8.
2022-07-27 17:32:05 +02:00
3b71a62390 Merge branch 'blender-v3.3-release' 2022-07-27 17:31:49 +02:00
d61ab45385 Blender 3.3 splashscreen
Credits: Piotr Krynski
2022-07-27 17:25:56 +02:00
b2dd1f8f01 Fix build include for rna_curves.c
* Since curves are no longer experimental, this should be included at any time.
2022-07-27 17:19:15 +02:00
32a9aac3b8 Blender 3.3 - Beta
* BLENDER_VERSION_CYCLE set to beta
* Update pipeline_config.yaml to point to 3.2 branches and svn tags
* Update and uncomment BLENDER_VERSION in download.cmake
2022-07-27 17:14:21 +02:00
9015952c9c Blender 3.4 Alpha: Start of new release cycle. 2022-07-27 16:53:19 +02:00
83362f87bb Blender 3.3: Finalizing version bump. 2022-07-27 16:33:49 +02:00
415f88d8b0 Fix wrong fileversion usage in own recent rB9ac81ed6abfb. 2022-07-27 16:20:50 +02:00
ea4b1d027d Geometry Nodes: Rename "Field on Domain" to "Interpolate Domain"
This name doesn't require understanding of fields, and
is phrased as an action which is consistent with other nodes.
Discussed in the latest geometry nodes sub-module meeting.
2022-07-27 08:56:17 -05:00
Erik Abrahamsson
c8ae1fce60 Geometry Nodes: Shortest Paths nodes
This adds three new nodes:
* `Shortest Edge Paths`: Actually finds the shortest paths.
* `Edge Paths to Curves`: Converts the paths to separate curves.
  This may generate a quadratic amount of data, making it slow
  for large meshes.
* `Edge Paths to Selection`: Generates an edge selection that
  contains all edges that are part of a path. This can be used
  with the Separate Geometry node to only keep the edges that
  are part of a path. For large meshes, this approach can be
  much faster than the `Edge Paths to Curves` node, because
  less data is created.

Differential Revision: https://developer.blender.org/D15274
2022-07-27 15:38:44 +02:00
9ac81ed6ab Fix corrupted blend files after issues from new name_map code.
Add a version of #BKE_main_namemap_validate that also fixes the issues,
and call it in a do_version to fix recent .blend files saved after the
regression introduced in rB7f8d05131a77.

This is mandatory to fix some production files here at the studio, among
other things.
2022-07-27 15:33:29 +02:00
9f53272df4 Fix more issues with new name map and liboverrides.
Follow-up to rB13e17507c069, forgot to handle shapekeys...
2022-07-27 15:33:29 +02:00
58dcd20998 ID namemap: Fix more issues when changing libs.
Fix tests, and some issue when making an ID local.

There are probably a few more issues still though.
2022-07-27 15:33:29 +02:00
Amelie Fondevilla
4843b161d6 Fix T99870 : Prevents crash when rearranging channels in dopesheet
The function to rearrange channels only works for F-curves channels for now, adding the `FCURVESONLY` filter prevents the function to be called for grease pencil channels, thereby fixing the crash.

Reviewed by : sybren
Differential Revision: http://developer.blender.org/D15504
2022-07-27 11:40:44 +02:00
7324f32a94 ID namemap tests: Use consistency check, fix an issue.
Massively use the new consistency check in namemap regression tests, and
fix an issue with library data tests revealed by those checks.
2022-07-27 11:22:48 +02:00
18dc611b40 ID namemap: Add check for consistency.
Add a util function to check that content of a given Main and the
namemaps in it are consistent.

Add some asserts calling this check after file read, and after some
override operations.
2022-07-27 11:22:48 +02:00
1e55b58e4f UI: Sort tools in curves sculpting mode
The previous order was based on the order of when the tools were
developed. Instead we now cluster them based on similar functionality:

* Selection
* Add/Remove
* Deform/Transform
* Annotation

Done in collaboration with Pablo Vazquez.
2022-07-27 11:15:48 +02:00
13e17507c0 Fix crashes due to non-uniqueness in ID names in some cases.
Liboverrides are doing some very low-level manipulation of IDs in apply
code, to reduce over-head of name and sorting handling.

This requires specific care to ensure thatr the new namemap runtime data
remains up-to-date and valid. Otherwise, names of existing IDs would be
missing from the map, which would later lead to having several different
IDs with the same name. Critical corruption in Blender ID management.

Reported by animators at the Blender studio.

Regression from rB7f8d05131a77.
2022-07-27 11:10:45 +02:00
4dd409a185 Fix T99976: Animated visibility not rendering properly in viewport
A mistake in the 0dcee6a386 which made specific driven visibility
to work, but did not properly handle actual time-based visibility.

The basic idea of the change is to preserve recalculation flags of
nodes which were tagged for update but were not evaluated due to
visibility constraints. In the file from the report this makes it
so tagging which is done first time ID is in the dependency graph
are handled when the ID actually becomes visible. This is what
solved the root of the problem from the report: there was missing
geometry update since it was "swallowed" by the evaluation during
the object being invisible. In other configurations this change
allows to handle pending geometry updates due to animated modifiers
be handled when object becomes visible without time change.

This change also solves visibility issue of the synchronization
component which also started to be handled badly since the
previous fix attempt. Basically, the needed exception in its
visibility handling did not happen and a regular logic was used
for it.

Tested with files from the T99733, T99976, and from the Heist
project.

Differential Revision: https://developer.blender.org/D15544
2022-07-27 10:19:42 +02:00
d706d0460c Cycles oneAPI: simplify num_concurrent_states selection
The number of Execution Units and resident "threads" (simd width * threads
per EUs) are now exposed and used to select the number of states using
a simplified heuristic.
2022-07-27 09:45:33 +02:00
38e270ae30 Cleanup: Move wm_dragdrop.c to C++ 2022-07-26 23:15:33 -05:00
e67710b908 deps/oiio: fix build issue on windows
tiff now outputs tiffd.lib for debug builds
oiio was not informed about this and had
a build error because of it.
2022-07-26 20:59:44 -06:00
f43a8835dc deps/alembic: add missing imath dependency
if alembic builds before imath it'll cause a build error.
2022-07-26 20:54:27 -06:00
Jun Mizutani
2ca18e78f9 Sculpt: Remove debug printf
Reviewed By: Joseph Eagar
Differential Revision: D15547
Ref D15547
2022-07-26 14:25:58 -07:00
b75d0c7e7a Geometry Nodes: Implement link drag search for two nodes
It was never added for the field on domain and field at index nodes.
They need special handling because they have many what should be
a multi-type socket declaration.
2022-07-26 16:12:42 -05:00
f14f81e5ac Nodes: Allow using escape key to exit node resizing 2022-07-26 16:03:43 -05:00
faa0c7aa6f Cleanup: Move mesh_tessellate.c to C++ 2022-07-26 14:41:34 -05:00
Falk David
88f0d483bd Python: Expose property to mute action groups
This patch adds a `mute` RNA property on `ActionGroup`s that allows them to be easily muted/unmuted from python.
This uses the existing `AGRP_MUTED` flag which was also accessible from the user interface.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D15329
2022-07-26 21:32:05 +02:00
8571093f99 GPencil: Small UI change in overlay for consistency
To keep consistency is better add the word `Inactive` for `Fade Layers` and `Fade Objects`  to keep the same naming used in other areas of the overlay panel.

Reviewed by: Matias Mendiola
2022-07-26 16:39:17 +02:00
2b8e35eeb0 Fix T99984: Small GPencil overlay UI bugs in Edit Mode
This commit fixes the opacity for curves hiding the option.

Actually, the curve points and handles drawing is using the same code that mesh curves and the opacity is not supported. While this feature will be added for mesh curves and gpencil, now it's better to hide this option.

Reviewed: Matias Mendiola

Note: The handle problem reported in this task was fixed in  a separated commit: 203e7ba332
2022-07-26 16:34:27 +02:00
1998269b10 Refactor: Extract color attributes as generic attributes
Previously there was a special extraction process for "vertex colors"
that copied the color data to the GPU with a special format. Instead,
this patch replaces this with use of the generic attribute extraction.
This reduces the number of code paths, allowing easier optimization
in the future.

To make it possible to use the generic extraction system for attributes
but also assign aliases for use by shaders, some changes are necessary.
First, the GPU material attribute can now store whether it actually refers
to the default color attribute, rather than a specific name. This replaces
the hack to use `CD_MCOL` in the color attribute shader node. Second,
the extraction code checks the names against the default and active
names and assigns aliases if the request corresponds to a special active
attribute. Finally, support for byte color attributes was added to the
generic attribute extraction.

Differential Revision: https://developer.blender.org/D15205
2022-07-26 08:37:38 -05:00
5945a90df9 Fix T98788: bad first curve tangent when first points have same position 2022-07-26 15:25:59 +02:00
72f77598a2 Fix T98798: tag collection geometry when changing instance offset
Changing the instance offset moves the entire "collection geometry".
So other features that depend on the geometry should be reevaluated.
2022-07-26 14:59:40 +02:00
ac1554bcf6 Fix T98982: cannot change default value of some node group input types 2022-07-26 14:49:12 +02:00
5aba7f9774 Geometry Nodes: Hide value button for field at index node
Changing the value doesn't accomplish anything, since the retrieved
value would be the same for every index then. So it's best to hide it
to make the node clearer.
2022-07-26 07:42:32 -05:00
78b7140b02 deps: update TIFF and OpenEXR
* OpenEXR 3.1.4 -> 3.1.5, this fixes several issues OSS fuzz found.
* libtiff 4.3.0 -> 4.4.0, this fixes several CVE's.

This also converts the harvest of libtiff on windows to a post install handler,
there's a few left but Windows is getting close to being harvest free.

Differential Revision: https://developer.blender.org/D15478
2022-07-26 13:25:58 +02:00
aa788b759a deps: FFmpeg vpx/aom-av1 updates
This is a refresh of our current FFmpeg 5.0.0 (unchanged) version with the
following changes:

* libvpx all platforms: enable SSE3/4/AVX/AVX2 instruction sets. libvpx has a
  proper CPUID check in place and will not call the faster kernels unless it is
  sure the CPU supports it. So we can safely enable this, this partially
  resolves T95743 (completely on Linux and macOS).

* libvpx Windows - threading was disabled due to a shared dependency on
  libwinpthreads.dll which we prefer not to distribute. However when configure
  cannot find pthreads it will happily fall back on a win32 threads based
  emulation layer. This also resolves the final part of T95743.

* libaom-av1 - new dependency required for D14920, this is a somewhat odd
  dependency, it's cmake based, but still needs the perl environment setup, so
  we have to setup the env and call cmake our selves for the configure, build
  and install commands. This dep has the same libwinpthreads issue as vpx on
  Windows, however since it's cmake based, it's easier to prevent cmake from
  detecting it.

Differential Revision: https://developer.blender.org/D15399
2022-07-26 13:25:58 +02:00
caf907626d Fix T99271: modifier errors are not cleared 2022-07-26 13:01:30 +02:00
c5712c6795 Fix T99373: add some padding in spreadsheet vector columns
This improves readability in some cases (e.g. in T99373).
2022-07-26 12:36:44 +02:00
Nate Rupsis
b08c5381ac 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 11:43:05 +02:00
e4a779264c 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 11:43:05 +02:00
Iliay Katueshenock
c94ca54cda 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 11:10:16 +02:00
203e7ba332 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 11:07:28 +02:00
c597d6cb64 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 10:53:08 +02:00
c869f54dcb Cleanup: Typo in comments: data-lock -> data-block. 2022-07-26 10:00:20 +02:00
bdb4ebebf1 Cleanup: quiet GCC cast-function-type warnings for gflags 2022-07-26 14:47:12 +10:00
c3bc53162a Cleanup: format 2022-07-26 13:23:45 +10:00
f1f89ca751 Cleanup: spelling in comments 2022-07-26 13:21:21 +10:00
3ae85a0d8f 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 13:21:15 +10:00
37ad72ab23 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 12:51:01 +10:00
4cf6524731 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 00:17:37 +02:00
f76a2c0d18 Fix: Fix attribute writer debug warnings in terminal
Use an imperfect solution, since this code will be replaced soon anyway.
2022-07-25 16:06:28 -05:00
462f99bf38 Sculpt: Fix T99779, pbvh gets wrong active vertex for multires
The recent multires winding fix missed a code branch.
2022-07-25 11:53:48 -07:00
fb9f12eeec 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-25 19:26:12 +02:00
46dbfce7fc 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-25 19:26:12 +02:00
703dff333c 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-25 14:13:48 -03:00
00a3533429 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-25 11:59:33 -05:00
739136caca Fix: Assert in resample curve node with single point curve 2022-07-25 11:53:22 -05:00
f26aa186b2 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-25 17:43:35 +02:00
Andrii Symkin
793d203139 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-25 17:36:58 +02:00
7a74d91e32 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-25 16:34:22 +02:00
Arye Ramaty
c6ce70855a 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-25 08:56:24 -05:00
881ef0548a 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-25 15:19:29 +02:00
484ad31653 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-25 13:27:40 +02:00
023eb2ea7c 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-25 13:27:40 +02:00
d567785658 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-25 13:16:59 +02:00
332d547ab7 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-25 13:10:34 +02:00
b9e66af686 Fix T99851: Subdivide Curve node does not initialize attributes of end point 2022-07-25 12:45:04 +02:00
2c81b4d4cf Fix T99880: no node timing for frames in node groups 2022-07-25 12:27:45 +02:00
5feb3541f4 Fix T99889: Fillet Curve node uses wrong radius 2022-07-25 12:20:54 +02:00
Ramil Roosileht
cf9dd3c0d8 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-25 12:15:27 +02:00
6f1cdcba85 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-25 11:54:49 +02:00
c5afef1224 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-25 11:44:56 +02:00
1c05f30e4d 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-25 11:42:27 +02:00
53113a2e57 Geometry: detect when the sample uv is in multiple triangles 2022-07-25 11:32:39 +02:00
c5394f3db8 EEVEE-Next: Fix float3 passes being incorrect 2022-07-25 11:25:24 +02:00
f814871e81 EEVEE-Next: Fix some Material compilation errors 2022-07-25 11:25:24 +02:00
47d1a7484c EEVEE-Next: Display compatible properties panels
Only a few are kept not available as their features are not yet supported.
2022-07-25 11:25:24 +02:00
cd9ebc816e Fix build error with WITH_CYCLES_KERNEL_NATIVE_ONLY on macOS Arm
-march=native is not supported for all architectures.
2022-07-25 11:23:25 +02:00
72fb92ded8 Fix T99961: crash when spreadsheet shows volume grids 2022-07-25 11:22:14 +02:00
cacdea7f4a 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-25 11:14:42 +02:00
Alex Parker
44258b5ad0 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-25 08:14:32 +02:00
7808ee9bd7 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-24 20:03:16 -05:00
Lukas Stockner
6db059e3d7 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-24 21:33:04 +02:00
f7d5aaa365 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-24 21:18:11 +02:00
d26c29d8e4 Fix T98367: Light group passes do not work when shadow catcher is used 2022-07-24 20:36:46 +02:00
31365c6b9e 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-24 12:46:28 -05:00
ad632a13d9 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-24 19:24:50 +02:00
b1c49b3b2a 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-24 19:24:50 +02:00
a5bcb4c148 EEVEE-Next: Make animated viewport non jittered when disabling denoising 2022-07-24 19:24:50 +02:00
68101fea68 EEVEE-Next: Add back background opacity toggle 2022-07-24 19:24:50 +02:00
8ac5b1fdb3 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-24 19:24:50 +02:00
bd9bb56f18 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-24 19:24:50 +02:00
364babab65 EEVEE-Next: Fix background velocity 2022-07-24 19:24:50 +02:00
0fcc04e7bf Cleanup: Fix off-by-half-errors with udim search 2022-07-24 14:48:30 +12:00
f1f2c26223 Cleanup: Simplify uv sculpt tool
No functional changes.
2022-07-24 13:48:53 +12:00
c94c0d988a 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-23 19:59:59 -05:00
0c3851d31f EEVEE-Next: Film: Rename filter_size for clarity and add box filter ...
... as a debug option.
2022-07-23 22:57:10 +02:00
3ea2b4ac31 EEVEE-Next: Film: Fix incorrect anti-aliasing
There was a confusion about what space the offset was in.
2022-07-23 22:57:10 +02:00
7c6d546f3a 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-23 12:15:59 -04:00
d53ea1d0af Fix T99905: wrong toposort when the node tree is cyclic 2022-07-23 14:37:58 +02:00
092732d113 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-23 15:16:14 +03:00
beb746135d Fix T99830: missing update after reordering node group sockets 2022-07-23 13:30:15 +02:00
5da807e00f Fix: Store Named Attribute node not working when attribute did not exist 2022-07-23 12:14:45 +02:00
fc8b9efb24 Update RNA to User manual mappings 2022-07-22 21:00:34 -04:00
82467e5dcf Cleanup: Typo with uv sphere normal creation
Regression from 087f27a52f
2022-07-23 09:12:13 +12:00
80b2fc59d1 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-22 15:49:53 -05:00
7d8b651268 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-22 21:03:06 +02:00
676a2f690c 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-22 20:32:17 +02:00
35843ddcd8 Fix T99835: Incorrect title case for two node names 2022-07-22 11:36:55 -05:00
98395e0bdf Cleanup: Use r_ prefix for boolean return parameters
Also rearrange some lines to simplify logic.
2022-07-22 10:49:09 -05:00
c40971d79a 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-22 10:31:40 -05:00
e4eaf424b9 Fix nodes not transforming
Error in {rB98bf714b37c1}
2022-07-22 12:17:22 -03:00
6bcda04d1f 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-22 09:59:28 -05:00
1f94b56d77 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-22 15:39:41 +02:00
Germano Cavalcante
98bf714b37 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-22 10:01:27 -03:00
185eeeaaac 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-22 22:15:00 +10:00
003dfae270 Cycles: enable oneAPI in Linux release builds
0f50ae131f didn't do it reliably
since it was deactivated explicitly a bit above.
2022-07-22 13:03:49 +02:00
e0d4aede4d BMesh: move bmesh_mesh to C++
This allows parts of the code to be threaded more easily.
2022-07-22 20:40:31 +10:00
95e60b4ffd Cleanup: move crazyspace.c to c++
Doing this in preparation for D15407.
2022-07-22 12:33:08 +02:00
087f27a52f 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-22 13:59:36 +10:00
08c5d99e88 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-22 13:07:24 +10:00
72e249974a 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-22 12:25:10 +10:00
d3db38cfb1 Cleanup: quiet nonull-compare warnings with GCC 2022-07-22 12:23:33 +10:00
7725740543 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-22 11:17:16 +10:00
aa1ffc093c 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-21 19:44:06 -05:00
7a4a6ccad7 Cleanups: Small changes to armature deform
Use const pointers, remove unused data member for parallel callback,
use listbase macro.
2022-07-21 17:21:56 -05:00
ada6012518 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-21 12:13:42 -05:00
Sebastiano Barrera
a5c2d0018c 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-21 19:02:03 +02:00
611be46cc9 Cleanup: compiler warning 2022-07-21 19:01:19 +02:00
a36f029459 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-21 18:11:13 +02:00
ef5b435e8f 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-21 16:41:51 +02:00
d431b1416b EEVEE-Next: Add back option to disable TAA (Viewport Denoising 2022-07-21 16:41:51 +02:00
b0f9639733 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-21 16:39:07 +02:00
396b7a6ec8 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-21 09:34:48 -05:00
412d93c298 GPU: Fix compilation with WITH_GPU_BUILDTIME_SHADER_BUILDER option 2022-07-21 15:50:35 +02:00
92eb59341c EEVEE-Next: Filter NaN at output to avoid propagation. 2022-07-21 15:50:35 +02:00
9f00e138ac Cleanup: DRW: common_math_geom_lib.glsl: Fix variable name style 2022-07-21 15:50:35 +02:00
e022753d7a 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-21 15:50:35 +02:00
2bad3577c0 DRW: common_math_geom_lib.glsl: Add line_aabb_clipping_dist 2022-07-21 15:50:35 +02:00
4ba6bac2f1 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-21 08:30:07 -05:00
63be57307e 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-21 08:15:06 -05:00
95ab16004d Cleanup: Remove debug print in test 2022-07-21 08:00:30 -05:00
03338e0270 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-21 21:47:41 +10:00
a06b04f92d Cleanup: Simplify relation flags assignment 2022-07-21 12:54:35 +02:00
2034e8c42d 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-21 12:47:44 +02:00
538da79c6d 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-21 12:23:38 +02:00
d099e0d2a4 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-21 12:18:57 +02:00
f7252e9692 Cleanup: Unused forward declaration 2022-07-21 12:16:31 +02:00
10b048fd9e Fix T99885: Invalid dependency graph state when curves surface is invisible
Differential Revision: https://developer.blender.org/D15510
2022-07-21 11:26:36 +02:00
Bastien Montagne
ee3facd087 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-21 10:18:43 +02:00
0dcee6a386 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-21 09:49:16 +02:00
4089b7b80b 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-21 09:48:59 +02:00
d6faee2824 Cleanup: format 2022-07-21 17:45:36 +10:00
2eeedbbca9 Cleanup: add ISMOUSE_MOTION macro
Replace verbose ELEM(..) usage, now each kind of mouse event has it's
own macro.
2022-07-21 16:23:33 +10:00
7a73685460 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-21 16:07:11 +10:00
095b8d8688 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-21 15:54:39 +10:00
4ec0a8705b 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-21 15:28:01 +10:00
dd158f1cab Fix failing cycles test from previous commit
Deprecated custom data type CD_MTEXPOLY has inconsistent data usage.

Reviewed By: Campbell Barton
2022-07-21 16:28:56 +12:00
c171e8b95c 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-21 15:24:38 +12:00
46a2592eef Cleanup: spelling in comments, typos in tool-tips 2022-07-21 13:21:53 +10:00
e75adb979b Fix T99678: Crash applying non-existent modifiers
Regression in [0] accessed the modifier type before NULL check.

[0]: 78fc5ea1c3
2022-07-21 12:52:24 +10:00
9f68369247 Fix T99687: Cloth filter crash
The code was failing to exclude the sculpt object from
the list of collision objects.
2022-07-20 15:17:07 -07:00
eb281e4b24 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-20 16:40:05 -05:00
fe108d85b4 Cleanup: Remove unused function 2022-07-20 14:30:44 -05:00
d34f8ac3d9 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-20 13:18:03 -05:00
5d4574ea0e 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-20 18:23:03 +02:00
c4d8e28aa7 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-20 17:16:15 +02:00
0c6ae51d9f Fix missing registration of grid view items in the view 2022-07-20 17:16:15 +02:00
712960cefd Cleanup: use BLI_strncpy instead of strcpy
Using `strcpy` resulted in `stringop-truncation` warnings for me.
2022-07-20 16:08:02 +02:00
3ea91cecc9 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-20 15:57:16 +02:00
Wannes Malfait
7561183830 Fix T99667: regression in Delete Geometry node
Differential Revision: https://developer.blender.org/D15445
2022-07-20 15:49:50 +02:00
29c68e2523 Fix T99869: Edge crease no longer working
Missed in d14c2d549b
2022-07-20 10:28:23 -03:00
a814c7091b 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-20 14:54:32 +02:00
7f8d05131a 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-20 14:27:14 +03:00
8d69c6c4e7 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-20 14:18:17 +03:00
e6855507a5 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-20 14:18:17 +03:00
054a169be0 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-20 14:18:17 +03:00
ae49e0e8be Cleanup: unused parameter in own recent commit rB92ca920c52b9. 2022-07-20 11:09:16 +02:00
Damien Picard
c48dc61749 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-20 11:05:07 +02:00
Bastien Montagne
92ca920c52 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-20 10:55:08 +02:00
ecf4f4a71f Curves: fix uninitialized curve type when adding new curves 2022-07-20 10:47:23 +02:00
c3b9a4e001 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-19 22:34:32 -05:00
215f805ce6 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-19 21:48:32 -05:00
2551cf9087 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-19 18:50:27 -05:00
5d6e4822d8 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-19 18:29:23 -05:00
40ffb94ab4 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-19 18:16:12 -05:00
410a6efb74 Point Cloud: Remove redundant custom data pointers
Similar to e9f82d3dc7, but for point clouds instead.

Differential Revision: https://developer.blender.org/D15487
2022-07-19 18:06:56 -05:00
e9f82d3dc7 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-19 18:01:04 -05:00
Pratik Borhade
28985ccc05 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-19 14:20:44 -05:00
43d04c7eeb UI Code Quality: Move eyedropper files to own folder
Part of T98518
2022-07-19 19:33:38 +02:00
Tomek Gubala
3b7ac10d62 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-19 19:29:03 +02:00
75e62df429 Cleanup: compiler warning 2022-07-19 19:22:13 +02:00
cd478fbfb3 Fix error printed in console when running Shade Flat operator
Only the Shade Smooth operator has autosmooth settings.
2022-07-19 19:22:13 +02:00
edc89c7f46 Fix build error when not using unity build 2022-07-19 19:22:13 +02:00
d14c2d549b 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-19 14:13:00 -03:00
597955d0a8 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-19 12:10:45 -05:00
16b145bc62 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-19 18:04:03 +02:00
fb9dc810f1 UI Code Quality: Move view related files to own folder
Part of T98518.
2022-07-19 18:04:03 +02:00
Amélie Fondevilla
801513efa0 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-19 17:49:10 +02:00
87ae10a050 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-19 10:45:01 -05:00
35b4e3a350 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-19 10:30:19 -05:00
c771dd5e9c 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-19 17:22:53 +02:00
6a1ab4747b 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-19 10:16:30 -05:00
9246ff373a Metal: Add license header to new files 2022-07-19 17:14:39 +02:00
Jason Fielder
9835d5e58b 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-19 17:12:39 +02:00
Jason Fielder
6bba4d864e 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-19 17:02:15 +02:00
3370c1a8a7 Cleanup: Add comment for geometry nodes lazyness 2022-07-19 09:54:20 -05:00
ad5e3d30a2 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-19 16:36:57 +02:00
2e3fb58128 Cleanup: Apply clang-format 2022-07-19 16:33:09 +02:00
5bee991132 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-19 16:31:23 +02:00
348ec37f52 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-19 16:31:23 +02:00
Colin Basnett
2f834bfc14 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-19 16:07:30 +02:00
Colin Basnett
4812eda3c5 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-19 15:58:37 +02:00
2232855b50 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-19 15:49:45 +02:00
95fd7c3679 Depsgraph: Cleanup, Make variable less ambiguous and more clear 2022-07-19 15:27:20 +02:00
bc6b612d8b Depsgraph: Make variable naming more clear
Disambiguate from nodes visibility flags.
2022-07-19 15:25:49 +02:00
Ethan-Hall
44f1495b57 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-19 15:20:53 +02:00
e8465f941c Depsgraph: Cleanup, use nested namespace definition 2022-07-19 14:44:07 +02:00
835203fde8 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-19 14:36:36 +02:00
73f8a7ca0a Depsgraph: Cleanup, comments wrapping and spacing between lines
Should make it easier to read. No functional changes expected.
2022-07-19 14:25:02 +02:00
6d2100f7de Depsgraph: Introduce operation code for visibility operation
No functional changes, just makes code more semantically clear.
2022-07-19 13:00:19 +02:00
99faebfca6 Depsgraph: Cleanup, don't mic static function and anonymous namespace 2022-07-19 12:51:24 +02:00
2280a71f90 Depsgraph: Refactor evaluation into smaller reusable functions
Should be no functional changes.
2022-07-19 12:41:47 +02:00
9b2b61a07b Depsgraph: Cleanup, use nested namespace definition 2022-07-19 11:40:18 +02:00
d3c063188e Depsgraph: Make name and name tag optional in component node
Matches the builder API, making some code less verbose.
2022-07-19 11:31:44 +02:00
ff98b5eaa8 Depsgraph: Clarify comment in the component node 2022-07-19 11:29:00 +02:00
e00a027c1e 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-19 11:18:30 +02:00
533a5a6a8c 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-18 20:38:19 -07:00
bbf87c4f75 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-19 13:33:02 +10:00
7ebd1f4b79 Cleanup: quiet compiler warnings 2022-07-19 13:32:53 +10:00
37922eab90 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-19 13:26:24 +12:00
135e530356 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-19 10:26:28 +12:00
Henrik Dick
d175eb6c30 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-18 23:33:30 +02:00
8358cc7963 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-18 17:40:48 +02:00
cd21022b78 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-18 17:44:46 +03:00
935b7a6f65 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-18 17:38:00 +03:00
1f8567ac68 Fix T99750: crash with file output node, after image colorspace saving changes 2022-07-18 15:50:39 +02:00
757041560f 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-18 15:36:34 +02:00
3407ed5f9b Cleanup: change internal Cycles compact BVH default to match UI 2022-07-18 15:34:13 +02:00
Damien Picard
dec8854bf3 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-18 15:10:08 +02:00
Jun Mizutani
47f3b53756 Fix T99742: crash when generating rigify rigs, after recent changes
Differential Revision: https://developer.blender.org/D15473
2022-07-18 14:47:48 +02:00
c7f788b877 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-18 13:59:08 +02:00
3c016fbfd0 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-18 20:00:21 +10:00
cd1e4ae448 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-16 17:27:25 -07:00
9a14887905 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-16 16:45:41 -07:00
d136a996ca Audaspace: minor formatting fix for last commit. 2022-07-16 22:20:08 +02:00
Colin Basnett
1e4c557d82 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-16 22:14:19 +02:00
0a8d21e0c9 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-16 17:30:17 +10:00
49babc7caa 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-16 17:23:42 +10:00
f76b537d48 Fix T99744: NULL pointer free with corrupt zSTD reading 2022-07-16 16:32:36 +10:00
bf49e6040c Fix error in assertion after 92a99c1496 2022-07-16 16:12:48 +10:00
b985437283 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-15 20:10:42 +02:00
92a99c1496 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-15 19:11:07 +02:00
5152c7c152 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-15 18:46:24 +02:00
bb376da6df Fix Cycles MetalRT error after recent specialization changes 2022-07-15 18:28:13 +02:00
03aeef64d5 Cleanup: compiler warnings 2022-07-15 16:57:04 +02:00
c505f19efe Fix compiler error in debug builds after 1cf465bbc3 2022-07-15 16:52:01 +02:00
1cf465bbc3 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-15 16:31:28 +02:00
5e1229f253 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-15 16:30:11 +02:00
82f65d8971 Cleanup: VSE waveform drawing
No functional changes.
2022-07-15 15:52:37 +02:00
011d3c75a7 Cleanup: compiler warning 2022-07-15 15:20:53 +02:00
00dc747702 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-15 22:16:44 +10:00
Damien Picard
180db0f752 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-15 14:15:40 +02:00
914617f8fd 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-15 14:15:40 +02:00
523bbf7065 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-15 13:42:47 +02:00
da4ef05e4d 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-15 13:40:04 +02:00
5653c5fcdd 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-15 13:40:04 +02:00
79da7f2a8f 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-15 13:40:04 +02:00
Damien Picard
2e70d5cb98 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-15 13:40:04 +02:00
5ddbc14bb2 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-15 13:40:04 +02:00
9ea1b88f0f Cleanup: add utlity function to compute render resolution
Instead of duplicating logic many times.
2022-07-15 13:40:04 +02:00
b8ffd43bd2 Cleanup: make format 2022-07-15 13:40:04 +02:00
4d7c990180 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-15 23:18:13 +12:00
e69c4482f1 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-15 11:42:58 +02:00
Martijn Versteegh
8e1323f633 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-15 11:23:26 +02:00
f4d7ea2cf6 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-15 11:16:14 +02:00
98f688ac42 GPU: Fix shader builder on hardware that does not have all features 2022-07-15 11:16:14 +02:00
862170c0b1 Cleanup: GPU: Replace NULL by nullptr from C++ files 2022-07-15 11:16:14 +02:00
ca1daf4cda 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-15 11:03:00 +02:00
c2715dc416 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-15 10:54:10 +02:00
63ea0f7581 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-15 10:21:27 +03:00
8fd2b79ca1 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-15 10:20:04 +03:00
d8094f9212 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-15 15:42:24 +10:00
60f260eb6a 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-15 15:36:21 +10:00
d14d570580 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-15 14:53:38 +10:00
c8e8f107bf Fix T99711: Eternal loop reading blend file thumbnail
Account for negative BHead length (already handled by blend file loading).
2022-07-15 14:53:38 +10:00
675f6ef089 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-14 21:27:58 -07:00
178868cf42 Fix T79304: improve uv island calculation when in edge selection mode
Differential Revision: https://developer.blender.org/D15419
2022-07-15 14:19:48 +12:00
0e9367fc29 Cleanup: separate clipUVTransform into two different functions
No functional changes.

Prep for D15420 / T98061.
2022-07-15 10:44:11 +12:00
b1329d7eaa 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-14 12:18:35 -06:00
9fedcde750 Modifiers: fix mesh to volume modifier on non-volume objects 2022-07-14 20:05:23 +02:00
bdd0ac5bce 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-14 19:21:56 +02:00
1ef686bd26 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-14 19:21:22 +02:00
b6de6da59a 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-14 18:50:16 +02:00
3b15467e97 Fix T99702: Gpencil Flip strokes did not support multiframe edit
This was a missing feature and this commit solves this.
2022-07-14 16:42:26 +02:00
Olivier Maury
1b5db02a02 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-14 16:36:38 +02:00
28c3739a9b Cleanup: replace state flow macros in the kernel with functions 2022-07-14 16:36:38 +02:00
5539fb3121 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-14 16:36:38 +02:00
02ce29c6ee Improve Tool tip for Add-on search
Differential Revision: https://developer.blender.org/D15411
2022-07-14 16:33:04 +02:00
4b1d315017 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-14 14:26:18 +01:00
47d4ce498e Cleanup: minor changes to camera frame fitting
Use const vars & make order of min/max checks consistent.
2022-07-14 22:08:30 +10:00
2d04012e57 Cleanup: spelling in comments
Also remove duplicate comments in bmesh_log.h, caused by automated
comment relocation in [0].

[0]: c4e041da23
2022-07-14 22:02:52 +10:00
9dfabc1de3 Cleanup: remove redundant event->val check for 3D text insertion 2022-07-14 22:01:43 +10:00
93f74299f0 Cleanup: clang-tidy changes to GHOST_SystemX11
Also remove redundant check.
2022-07-14 21:55:46 +10:00
cdd8b96e3b GHOST: remove redundant ascii argument to GHOST_EventKey
Now only the utf8 buffer is used there is no reason to pass both.
2022-07-14 21:54:28 +10:00
eb3e56a36e 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-14 13:52:44 +02:00
db80cf6ad7 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-14 21:10:22 +10:00
64e196422e 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-14 21:04:16 +10:00
7fa7722350 Cleanup: format, unused argument 2022-07-14 20:53:20 +10:00
6cd30d5ff0 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-14 13:41:43 +03:00
9024ac31be 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-14 11:17:59 +01:00
cb62095c1c Correct error with IME from d6fef73ef1 2022-07-14 20:07:06 +10:00
96cc603037 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-14 11:49:28 +02:00
c8a07ef663 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-14 11:32:01 +02:00
bcdce4ffd8 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-14 10:47:26 +02:00
44e530e1b1 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-14 10:35:59 +02:00
Damien Picard
9d73bbd966 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-14 10:29:10 +02:00
Colin Basnett
8e3879ab52 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-14 10:24:32 +02:00
Iliay Katueshenock
77df9d788a Fix T99239: weird behavior in Field on Domain node 2022-07-14 10:05:24 +02:00
Damien Picard
f48fadc953 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-14 10:01:09 +02:00
Damien Picard
1571ee66b5 I18N: Allow translating newly added GP data names, and a missing Surface one. 2022-07-14 10:01:09 +02:00
3935bf255e 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-14 09:57:08 +02:00
411bcf1fe7 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-14 17:04:22 +10:00
b35e33317d 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-14 16:10:13 +10:00
d6fef73ef1 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-14 15:59:19 +10:00
816a73891b 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-14 15:58:46 +10:00
d3374e5337 Fix build and warnings from previous commit. 2022-07-14 16:19:21 +12:00
931779197a Fix T99684: Upgrade Averages Island Scale with options Scale UV and Shear
Differential Revision: https://developer.blender.org/D15421
2022-07-14 15:42:08 +12:00
09a74ff8b6 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-14 09:46:58 +10:00
50d832634e Docs: Fix out of order parameters
Fixes T99672
2022-07-13 16:25:57 -04:00
144d9f2b2e 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-13 17:40:35 +02:00
88fbf0a8fc 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-13 16:11:59 +02:00
ccdf189d3c 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-13 08:43:57 -04:00
441dd08dba 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-13 08:30:40 -04:00
c484599687 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-13 07:10:09 -04:00
c8be3d3b27 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-13 12:56:48 +02:00
74888cdbfd 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-13 11:15:19 +02:00
a084839605 Cleanup: logical order of axis defines, assign variables for readability 2022-07-13 16:42:06 +10:00
b3913d7551 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-13 16:18:16 +10:00
9422627155 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-13 16:18:14 +10:00
8f543a73ab Fix T99659: Improve UV Island calculation with hidden faces.
Simplify interface, regularize implementation and some light cleanup.

See also: T79304 and D15419.
2022-07-13 11:42:42 +12:00
d0a552b5c6 Fix: set dangling pointer to null
The data has been moved somewhere else, the span should not
keep a pointer to it.
2022-07-12 18:47:51 +02:00
5f09440d5a 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-12 18:40:14 +02:00
9f153949f9 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-12 18:31:33 +02:00
1c382a4940 Curves: improve error checking in deform curves on surface node 2022-07-12 17:10:23 +02:00
02aefa7659 Fix: wrong node name in menu 2022-07-12 17:10:23 +02:00
b767628173 Fix: Memory leaks in indexer code
Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D15376
2022-07-12 16:58:04 +02:00
Khoi Dau
93253d5dcc 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-12 11:34:41 -03:00
d58072caf4 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-12 16:27:06 +02:00
47dd42485e 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-12 15:55:32 +02:00
4a445c8dc0 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-12 15:34:40 +02:00
f72cedffb6 Cleanup: Use interpf instead of repeating the logic
This makes the code clearer.
2022-07-12 10:20:01 -03:00
2d1fe736fa 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-12 10:11:05 -03:00
57097e9a85 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-12 14:39:08 +02:00
RedMser
4344b2bf19 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-12 13:00:56 +02:00
52b7f2b089 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-12 19:50:40 +10:00
bb3a538843 Fix: Incorrect coordinates used in BLI_rct*_isect_segment functions
Ref D15330.
2022-07-12 19:28:26 +10:00
8bd32019ca 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-12 10:26:52 +02:00
6e6da22eb0 Fix: crash when iterating over all attributes 2022-07-12 09:42:19 +02:00
b8d1e576bc Cleanup: use array for internal _bpy methods 2022-07-12 16:11:19 +10:00
ae6a4fcc7a 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-12 16:11:19 +10:00
00c7e760b3 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-12 16:05:13 +10:00
2a1d12d7a0 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-11 19:16:04 +02:00
995c904d00 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-11 19:16:04 +02:00
8ca09e6c5e 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-11 16:45:07 +02:00
Jeroen Bakker
76d8614236 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-11 16:12:36 +02:00
6e426259b4 Fix T99218: light group add button should be disabled when name is empty
Previously it was inactive but still clickable.

Ref D15316
2022-07-11 14:02:38 +02:00
6ca5ac2084 GPU: Update shader builder stubs.
Fixes workflow when using WITH_GPU_SHADER_BUILDER=On.
2022-07-11 13:36:29 +02:00
275419f6fd Fix/Cleanup UI messages. 2022-07-11 12:46:22 +02:00
1c4c904786 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-11 12:09:09 +02:00
da101118d4 Cleanup: Remove unused operator name storage in UI lists 2022-07-11 11:17:08 +02:00
7357176b57 Fix T99383: Wrong origdata type in color filter 2022-07-11 00:19:53 -07:00
cb39058f2f 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-10 23:39:45 -07:00
133d398120 PyAPI: add Matrix.is_identity read-only attribute
Add a convenient way of checking if the matrix is an identity matrix.
2022-07-11 12:45:00 +10:00
d51bc8215f 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-11 10:13:07 +08:00
d4a4691c0c Cleanup: spelling in comments 2022-07-11 10:38:04 +10:00
a83502f05f Cleanup: remove unused GHOST function getAnyModifiedState.
Remove unused GHOST_WindowManager::getAnyModifiedState()
2022-07-11 10:38:02 +10:00
7f4ee97b9e 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-10 18:50:11 -04:00
6543290116 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-10 14:50:17 -04:00
fad857f473 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-10 20:09:29 +03:00
4114ace616 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-10 18:27:38 +03:00
443690604f 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-09 22:46:53 +10:00
1de14061cb 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-09 22:27:30 +10:00
9a1d772339 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-09 22:27:28 +10:00
ef970b7756 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-09 22:27:27 +10:00
b5d22a8134 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-09 22:27:26 +10:00
80f8b7cbbb 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-09 02:09:07 -06:00
e3801a2bd4 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-09 10:39:53 +03:00
d9e00fbbf6 Cleanup: quiet class-memaccess warning 2022-07-09 15:08:23 +10:00
bc2121147f Cleanup: Remove unused variable 2022-07-08 18:47:31 -05:00
2ee6891728 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-08 18:07:07 +02:00
d8e980a4a6 Fix bug in recently added MutableVArraySpan move constructor 2022-07-08 16:27:47 +02:00
8159e0a666 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-08 16:21:32 +02:00
f639b59a29 Cleanup: convert brush.c to C++
In preparation of refactoring for texture nodes.
2022-07-08 16:21:32 +02:00
b876ce2a4a 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-08 16:16:56 +02:00
f391e8f316 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-08 15:44:06 +02:00
0f50ae131f 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-08 15:39:13 +02:00
5723bf926d 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-08 08:32:32 -05:00
becb1530b1 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-08 15:11:32 +02:00
2c55d8c1cf Cleanup: make format 2022-07-08 15:11:32 +02:00
05b38ecc78 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-08 14:47:10 +02:00
aa78278ef6 Fix build error without unity build, after recent changes 2022-07-08 14:38:21 +02:00
155bb95353 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-08 14:05:11 +02:00
Jeroen Bakker
a8f7d41d38 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-08 12:08:31 +02:00
Damien Picard
2c4dfe3453 Add a few missing UI strings to translation.
Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15392
2022-07-08 11:55:01 +02:00
754dae6c76 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-08 19:40:10 +10:00
47616992f8 GHOST: use ELEM/ARRAY_SIZE/UNPACK macros to avoid repetition
Also use UNLIKELY macro for checks for very unlikely scenarios.
2022-07-08 19:39:11 +10:00
418d82af28 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-08 19:36:31 +10:00
c4b32f1b29 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-07 22:33:57 -05:00
b98a937db6 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-08 11:33:22 +10:00
03173d63c0 Cleanup: spelling in comments
Also move mis-placed doc-string.
2022-07-08 09:48:49 +10:00
9ef3736959 Cleanup: format 2022-07-08 09:10:24 +10:00
56bf92f0f6 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-07 14:29:37 -07:00
b9c0eed206 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-07 12:59:16 -07:00
fc06b4c033 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-07 21:01:30 +02:00
52fa0c4251 Cleanup: Remove unused variable 2022-07-07 13:43:13 -05:00
4e9e44ad28 Cleanup: improve asserts in generic span 2022-07-07 19:27:30 +02:00
ba62e20af6 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-07 19:19:18 +02:00
7cfea48752 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-07 18:19:11 +02:00
b8605ee458 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-07 18:14:05 +02:00
e0cc86978c 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-07 18:08:18 +02:00
f9a805164a 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-07 17:19:59 +02:00
Bastien Montagne
fcf1a9ff71 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-07 16:25:34 +02:00
c76e1ecac6 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-07 16:15:44 +02:00
59e1009f10 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-07 09:01:46 -05:00
85ef8e1945 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-07 08:55:36 -05:00
a91f9c2c01 Cleanup: Use generic index mask utility
This may lead to improved performance from multithreading as well.
2022-07-07 08:49:23 -05:00
f0ac55f519 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-07 08:35:47 -05:00
Amélie Fondevilla
a26038ff38 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-07 15:31:06 +02:00
Pratik Borhade
3063d90cfc 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-07 15:24:17 +02:00
eb7218de8d 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-07 15:22:21 +02:00
9a4927031d Cleanup: Remove redundant filtering of legacy normal attribute
This is already done inside of `attribute_search_add_items`.
2022-07-07 08:15:29 -05:00
ed7dc4282c Cleanup: Correct comment with spreadsheet enum type 2022-07-07 08:14:00 -05:00
5c3dc52536 Cleanup: Improve variable name
The new name makes more sense in non-node-related contexts.
2022-07-07 08:13:11 -05:00
e3ef56ef91 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-07 08:06:30 -05:00
5d6e7df4a8 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-07 21:44:48 +10:00
a27024e36d 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-07 13:01:02 +02:00
97dd107070 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-07 13:01:02 +02:00
051a341cf0 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-07 11:51:38 +02:00
14980c9b3a 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-07 02:36:54 -07:00
f256201876 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-07 02:12:36 -07:00
50f9c1c09c 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-07 11:34:13 +03:00
bddcb89cda 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-07 11:34:13 +03:00
28105caaa3 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-07 09:47:59 +02:00
843ad51d18 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-07 16:36:46 +10:00
34c701abbd 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-07 15:24:48 +10:00
3f657e7ef1 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-07 12:30:47 +10:00
83c0f6ac37 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-07 12:30:45 +10:00
5c790fd52b Cleanup: use boolean types & early exit on failure for PyDriver
Also use __func__ for printing the funciton name.
2022-07-07 12:30:44 +10:00
709e620977 Cleanup: format 2022-07-07 12:30:42 +10:00
378f65f7d9 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-07 12:30:40 +10:00
3354ec3fb3 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-06 16:21:56 -04:00
2a60b979cc 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-06 15:03:21 -05:00
2d041fc468 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-06 21:30:50 +03:00
190ad73590 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-06 18:55:38 +02:00
debb233787 Cleanup: fix comments in oneAPI kernel.cpp 2022-07-06 18:55:38 +02:00
fae68ec651 Fix T99464: Curves sculpt add 3D brush symmetry broken
The brush transform was not applied to the view direction.
2022-07-06 11:53:18 -05:00
8ea5a5259d 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-06 18:21:20 +02:00
82fc8786ea 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-06 21:14:34 +05:30
0df574b55e 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-06 17:26:23 +02:00
6636edbb00 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-06 15:20:38 +02:00
9d0777e514 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-06 21:07:29 +10:00
da85245704 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-06 12:40:39 +02:00
94323bb427 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-06 13:30:15 +03:00
4b0e7fe511 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-06 10:53:22 +02:00
26f721b516 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-06 09:05:20 +03:00
e58e023e1a 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-06 15:30:47 +10:00
d9505831a4 Cleanup: declare local variables static 2022-07-06 15:28:54 +10:00
db9e08a0d1 Cleanup: spelling in comments 2022-07-06 15:28:54 +10:00
Loren Osborn
1f0048cc2d Cleanup: Fix compiler warnings
Use consistent class/struct declaration in forward declarations.

Differential Revision: https://developer.blender.org/D15382
2022-07-06 00:06:16 -05:00
faac25fefe 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-05 18:01:08 -05:00
Iliay Katueshenock
1a820680a1 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-05 17:50:59 -05:00
9435ee8c65 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-05 16:08:37 -05:00
7688f0ace7 Curves: Move type conversion to the geometry module
This helps to separate concerns, and makes the functionality
available for edit mode.
2022-07-05 15:51:12 -05:00
c52a18abf8 UI: Curves Sculpting - Remove duplicated entry for Curve Length 2022-07-05 17:50:27 +02:00
883d8ea16c Fix: Memleak in sequencer drag and drop code 2022-07-05 16:32:20 +02:00
329efa23d0 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-05 15:58:04 +02:00
31f0845b7e Fix tracking header not being self-sufficient
It used size_t type without including any header to define it.
2022-07-05 15:58:04 +02:00
8f0907b797 BLI: add float3x3 * float3 operator overload 2022-07-05 15:38:30 +02:00
d4099465cd 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-05 15:37:34 +02:00
b98d116257 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-05 15:36:00 +02:00
7ff054c6d1 Cleanup: use curves surface transform utility in operators 2022-07-05 15:06:31 +02:00
c46d4d9fad Curves: move curves surface transforms to blenkernel
This utility struct is useful outside of sculpting code as well.
2022-07-05 15:06:31 +02:00
7f24d90f11 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-05 12:52:21 +02:00
ce1d023667 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-05 12:52:20 +02:00
598a26fd8a 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-05 12:20:59 +02:00
935ef06fd1 NLA: fix punctuation of tooltips 2022-07-05 12:18:20 +02:00
fdb854b932 Cleanup: NLA, reformatting code
No functional changes.
2022-07-05 11:34:40 +02:00
Thibault de Villèle
bd00324c26 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-05 10:51:43 +02:00
322abb2e4b Geometry Nodes: Use alphabetical order for UV nodes in add menu 2022-07-04 23:54:06 -05:00
8c33a53b17 Cleanup: format 2022-07-05 14:34:09 +10:00
9145a4d08f GPU: add missing license header 2022-07-05 13:58:52 +10:00
780c0ea097 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-05 13:41:55 +10:00
dfa5201763 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-05 13:41:53 +10:00
7537369498 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-05 13:41:49 +10:00
6e879c3998 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-04 15:30:42 -05:00
242bfd28ce METAL: Add license header to new files 2022-07-04 20:11:06 +02:00
dccdc6213e Curves: Expose function to calculate vector handles 2022-07-04 11:51:10 -05:00
8fb8a6529f 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-04 19:12:35 +03:00
c63569c0e0 Cleanup: Correct UI view comments 2022-07-04 16:50:46 +02:00
abbc8333ac 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-04 16:08:29 +02:00
af6f3a4020 Cleanup: Remove unused function 2022-07-04 08:50:33 -05:00
1c38bfdc6f Cleanup: Clarify relation name for time relation to modifier 2022-07-04 12:27:45 +02:00
004913dd95 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-04 10:58:53 +02:00
3f5073a8e2 Fix T98884: Fix edge case crashes in gpu subdiv cache code 2022-07-04 01:34:54 -07:00
7be07a9d6e Cleanup: use local variable in smear code instead of ss->cache->bstrength 2022-07-04 01:19:14 -07:00
a720a4aabb Fix T98698: Division by zero in smear code when strength is zero 2022-07-04 01:17:19 -07:00
c5d3846b10 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-04 16:24:04 +10:00
cbb897070d 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-04 16:04:34 +10:00
148dcb3954 Cleanup: spelling in comments 2022-07-04 15:26:57 +10:00
faa97de208 Cleanup: correct function signature for UI_block_add_view for grid_view 2022-07-04 15:07:02 +10:00
9dd27a2c87 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-04 13:45:48 +12:00
929811df63 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-04 13:45:48 +12:00
f4a9a3767e 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-03 20:44:56 -05:00
e86c2f7288 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-03 01:55:38 +02:00
c355be6fae 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-03 01:55:38 +02:00
Iliay Katueshenock
4ffee9a48d 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-02 18:37:32 -05:00
ab444a80a2 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-02 21:51:58 +02:00
69ee9ca90e Fix: Build error with unity builds off after recent cleanup
Mistake in df8d96ab66
2022-07-02 13:04:55 -05:00
01d7dedd74 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-02 10:14:26 -04:00
9bb2afb55e 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-02 10:09:18 -04:00
5d9ade27de BLI: improve span access to virtual arrays
* Make the class names more consistent.
* Implement missing move-constructors and assignment-operators.
2022-07-02 11:45:57 +02:00
3c60d62dba BKE: fix wrong recently added assert 2022-07-02 11:40:36 +02:00
d0e3388848 Cleanup: Simplify logic building in length parameterization
We can construct an IndexRange directly rather than retrieving it.
2022-07-01 09:46:27 -05:00
da00d62c49 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-01 22:50:58 +10:00
56b218296c 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-01 20:46:17 +08:00
b683a37824 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-01 20:54:47 +10:00
5e5fe217ca 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-01 20:35:11 +10:00
41c10ac84a 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-01 11:20:00 +02:00
e7a21275c0 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-01 12:17:50 +03:00
Jason Fielder
4527dd1ce4 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-01 10:31:57 +02:00
3ffc558341 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-01 10:23:58 +02:00
0554537c3c Cleanup: add missing license headers in Cycles oneAPI implementation 2022-07-01 10:13:07 +02:00
bb8953ab49 GHOST/Wayland: map additional cursors from GHOST_TStandardCursor 2022-07-01 18:11:19 +10:00
5b7e7d67a5 Cleanup: GPUCodegen: Remove unused variables 2022-07-01 10:10:58 +02:00
4cba209edd GPUMaterial: Remove the max attribute check
This is needed to make the GPU_attribute used as generic input mechanism.
2022-07-01 10:10:58 +02:00
ccbf9ee482 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-01 18:06:20 +10:00
eff62ea8ab Geometry Nodes: remove warning in Points node
Generating no points in some frames is a perfectly valid use case.
2022-07-01 10:04:35 +02:00
5d57d9f899 Cleanup: remove unused variable 2022-07-01 09:55:20 +02:00
e4bf58e285 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-01 09:44:07 +02:00
72b9e07cf2 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-01 09:44:07 +02:00
dfa5bd689e 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-01 09:44:07 +02:00
c922b9e2c1 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-01 09:44:07 +02:00
b872ad037a Fix T99315: Unit plane track deform compositor node leads to unnecessary blur 2022-07-01 09:42:48 +02:00
16264aebe6 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-01 09:02:07 +02:00
b1d3b14711 Fix crash when creating an off-screen context fails in Wayland
This is very unlikely to happen but better not to crash.
2022-07-01 15:33:51 +10:00
650a15fb9b 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-01 15:16:45 +10:00
bd7b181e10 Cleanup: Remove outdated comments
Point clouds always use geometry_set_eval, and so do volumes.
2022-06-30 21:52:04 -05:00
df8d96ab66 Cleanup: Remove unnecessary includes from geometry nodes header 2022-06-30 21:51:13 -05:00
276e419671 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-06-30 21:42:09 -05:00
7e55ff15b0 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-06-30 21:33:11 -05:00
3d3ba9ca8e 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-01 11:19:01 +10:00
cf64a1d73e Cleanup: spelling in comments 2022-07-01 11:18:58 +10:00
90f4b35bc2 Cleanup: remove unused argument 2022-07-01 11:18:56 +10:00
c15ae2e87b Fix: Correct attribute names in resample curves code 2022-06-30 19:30:06 -05:00
4206b30275 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-06-30 19:29:32 -05:00
32e9c9802e 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-06-30 19:27:41 -05:00
6161ce6e5d Cleanup: Add assert for unsupported legacy curve type 2022-06-30 19:26:51 -05:00
982d6589a8 Cleanup: Remove duplicate include 2022-06-30 19:25:44 -05:00
a69e5c2348 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-06-30 19:17:32 -05:00
95055af668 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-06-30 19:01:02 -05:00
Gaia Clary
106d937a4e 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-06-30 23:13:37 +02:00
f18067aa03 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-06-30 22:45:42 +02:00
a9696f04a0 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-06-30 20:45:37 +02:00
fbcc00d10d Fix broken Cycles performance benchmark after recent logging changes
Ensure full render report is printed with default verbosity.
2022-06-30 19:51:50 +02:00
c9795102c2 Fix build error with Alembic after 65166e145b 2022-06-30 19:47:21 +02:00
e7c58941b1 Fix pointer to pointer passed where single pointer is expected (VSE versioning) 2022-06-30 18:42:22 +02:00
65166e145b 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-06-30 18:38:44 +02:00
66de653784 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-06-30 18:33:34 +02:00
Patrick Huang
79fe27b976 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-06-30 17:19:48 +02:00
34e04ccde2 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-06-30 17:17:25 +02:00
ef268c7893 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-06-30 16:49:42 +02:00
Andrii Symkin
f00d9e80ae 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-06-30 16:25:21 +02:00
6bb703a9ee 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-06-30 15:56:08 +02:00
8bf9d482da Cleanup: colon after params, move text into public doc-strings, spelling 2022-06-30 23:48:22 +10:00
58ccd8338e 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-06-30 23:46:57 +10:00
7c98632289 GHOST/Wayland: use flush instead of roundtrip
Using flush avoids handling new events which complicates logic here.
2022-06-30 23:46:57 +10:00
cfd087673d 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-06-30 23:46:57 +10:00
1cf64434ed 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-06-30 23:46:57 +10:00
6bd2c6789b 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-06-30 23:46:57 +10:00
df40e9d0aa 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-06-30 23:46:57 +10:00
e190b70946 Cleanup: declare GHOST/Wayland methods const
Needed when called by functions that are const too.
2022-06-30 23:46:57 +10:00
e75f3e3feb Cleanup: use "use_" prefix for boolean property 2022-06-30 23:46:57 +10:00
90ccb71969 Fix missing argument, avoid instancing function call in macro 2022-06-30 23:44:13 +10:00
547efb6b1e 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-06-30 15:31:58 +02:00
Amélie Fondevilla
92d7f9ac56 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-06-30 15:20:18 +02:00
416aef4e13 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-06-30 15:09:13 +02:00
Nate Rupsis
0f22b5599a 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-06-30 12:54:27 +02:00
4a7e1c9209 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-06-30 12:51:26 +03:00
c64d1b23df 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-06-30 11:10:19 +02:00
b544225202 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-06-30 10:33:44 +02:00
acdc043c30 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-06-30 10:33:09 +02:00
edbf04ff37 Fix T99290: Wrong color management of plane track image preview
Always consider images as "View as Render" for the plane track image drawing.
2022-06-30 10:24:33 +02:00
Iyad Ahmed
5c726dd4ef 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-06-30 10:14:08 +02:00
c39e932631 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-06-29 23:31:08 -07:00
2185943235 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-06-29 23:22:06 -07:00
f7c6d3705d 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-06-29 23:11:24 -07:00
3cefa13770 Fix T98886: PBVH_GRIDS ignores face smooth flag on first gpu build 2022-06-29 21:05:21 -07:00
feeb8310c8 Cleanup: format 2022-06-30 12:14:23 +10:00
b6c28002ac Cleanup: spelling in comments 2022-06-30 12:14:22 +10:00
209f2b85d7 Cleanup: quiet warning, remove punctuation in description 2022-06-30 12:14:20 +10:00
011327224e 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-06-29 20:52:00 -04:00
0ea282f746 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-06-29 12:28:08 -05:00
Aleksi Juvani
4593fb52cf 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-06-29 12:25:46 -05:00
Martijn Versteegh
d23818fcd9 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-06-29 11:36:46 -05:00
95964444c6 Cleanup: Clang tidy, unused variable warning 2022-06-29 10:57:28 -05:00
1516f7dcde 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-06-29 10:56:17 -05:00
6b508eb012 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-06-29 17:08:50 +02:00
6dd8ceef2a 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-06-29 22:54:29 +08:00
Arye Ramaty
2ac5b55289 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-06-29 16:19:24 +02:00
b708f45922 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-06-29 16:07:13 +02:00
a5ac0375b0 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-06-29 14:12:03 +02:00
45fb7a1db5 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-06-29 14:12:03 +02:00
4a9f60ecd2 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-06-29 14:12:03 +02:00
40f40e9931 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-06-29 14:12:03 +02:00
70c6beeafb 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-06-29 14:12:03 +02:00
087e95d0fe Cleanup: correct type for sequencer SWAP macro 2022-06-29 22:02:04 +10:00
a02992f131 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-06-29 12:58:04 +02:00
302b04a5a3 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-06-29 12:48:34 +02:00
c51b8ec863 BLI: add Vector.append_and_get_index with rvalue parameter
This makes it possible to use this method with `std::unique_ptr`.
2022-06-29 12:07:02 +02:00
43b65150ed Fix uninitialized memory use in key-down events on window activation 2022-06-29 18:21:36 +10:00
930398d5b1 GHOST/Wayland: quiet warning with empty title with libdecor
Set the title before showing the window.
2022-06-29 17:34:43 +10:00
6b2dd3e314 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-06-29 17:34:41 +10:00
b1163d2198 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-06-29 17:34:39 +10:00
Jeroen Bakker
66f826ae85 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-06-29 07:55:51 +02:00
eaec01cad5 Sculpt: Fix backwards normals in PBVH_GRIDS raycasting
Winding order of grid quads was backwards.
2022-06-28 22:30:28 -07:00
2d0877ed7e Fix T99231: Wrong anchored mode test for smear brush 2022-06-28 21:35:55 -07:00
3283bc6367 Cleanup(UV): Remove unused parameter (no functional changes)
Prep for D15263
2022-06-29 13:14:39 +12:00
f32d7dd0c8 Cleanup(UV): Store nboundaries on pchart (no functional changes)
Prep for D15263
2022-06-29 12:31:16 +12:00
68d037190f Cleanup: format 2022-06-29 10:19:02 +10:00
e1dc54c8fc Cleanup: Fix mul_v2_v2_ccw for repeated arguments (no functional changes)
Prep for D15263
2022-06-29 12:14:35 +12:00
6777c420db 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-06-29 10:11:01 +10:00
d94d7a5d8f Cleanup: update curve_fit_nd (no functional changes) 2022-06-29 09:55:44 +10:00
45645936e9 Cleanup: spelling in comments 2022-06-29 09:40:16 +10:00
c0e4532331 Fix T78394: In UV Editor, UV Unwrap respects selection
Differential Revision: D14945
2022-06-29 10:57:41 +12:00
2d18dd9309 Fix: Use distance unit for points node radius input 2022-06-28 16:03:04 -05:00
1c61db5346 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-06-28 15:57:22 -05:00
Siddhartha Jejurkar
33be9c0885 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-06-29 01:18:22 +05:30
c257443192 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-06-28 19:13:57 +02:00
814f360c83 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-06-28 18:48:39 +02:00
e127182065 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-06-28 18:48:39 +02:00
75ad435ceb Cleanup: GPUShader: Fix missing space in debug message 2022-06-28 18:48:38 +02:00
fde7d39051 Cleanup: DRW: Fix misnamed argument and add more info in a function doc 2022-06-28 18:48:38 +02:00
Sayak Biswas
abfa09752f 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-06-28 18:35:43 +02:00
270ed1c716 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-06-28 13:13:48 -03:00
b8064e3312 Build: add HIP version to buildbot configuration 2022-06-28 16:54:45 +02:00
Christian Rauch
bd6912930f 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-06-28 16:54:45 +02:00
614aa9d8ec 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-06-28 16:53:12 +02:00
f9f73473d6 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-06-28 16:52:46 +02:00
b585872450 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-06-28 15:58:08 +02:00
d5dcbabdd2 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-06-28 15:57:06 +02:00
luzpaz
4d982cbb5d Cleanup: fix various typos
Differential Revision: https://developer.blender.org/D15304
2022-06-28 15:56:16 +02:00
0124de9d0e 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-06-28 15:47:41 +02:00
c96f2778f0 Fix: sampling points on mesh surface generates too many points 2022-06-28 13:13:41 +02:00
dfea5e24ad 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-06-28 13:13:41 +02:00
c1ffea157c 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-06-28 10:55:45 +02:00
f9076f3869 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-06-28 16:07:30 +10:00
33fc230ba2 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-06-28 15:54:02 +10:00
Red Mser
e6d50cdd43 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-06-28 15:20:06 +10:00
ca9e1f6391 Cleanup: replace magic number with define for scan-code/key-code offset 2022-06-28 14:43:37 +10:00
dd95deadf3 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-06-28 14:35:14 +10:00
fd7c070861 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-06-28 13:48:05 +10:00
40cd041f74 Cleanup: group wayland event codes in their own doxy section
Also don't pass typedef'd ints as references.
2022-06-28 12:01:29 +10:00
b8cc181808 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-06-28 11:31:12 +10:00
Keith Boshoff
b910114384 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-06-28 10:52:31 +10:00
381fe684e2 GHOST: only use GHOST_PRINT when WITH_GHOST_DEBUG is enabled
Revert part of [0] so only assert behavior is changed.

[0]: 9b5dda3b07
2022-06-28 10:16:28 +10:00
65f4f50640 Cleanup: compiler warnings, remove unused functions 2022-06-28 10:13:24 +10:00
7a44f62bdb Fix T99156: UV parameterizer respects both Pins and Seams
Rgression from: e6e9f1ac5a

Reviewed By: Brecht Van Lommel

Differential Revision: D15292
2022-06-28 10:46:10 +12:00
317dfc1735 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-06-27 19:00:24 -03:00
17a773cdce 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-06-27 22:22:18 +02:00
36348bf4fc Fix error in previous commit - missed include 2022-06-27 22:17:59 +02:00
8eef98710b Fix meta strip has incorrect range when created
Caused by using `startdisp` and `enddisp` to initialize range.
Use handle position instead.
2022-06-27 22:06:07 +02:00
Germano Cavalcante
67e23b4b29 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-06-27 16:54:23 -03:00
a571c74e10 Sculpt: Fix backwards normals in PBVH_GRIDS raycasting
Winding order of grid quads was backwards.
2022-06-27 11:16:05 -07:00
31ebe8982e BLI: Math: Add ceil_to_multiple_u()
Standalone version of a function added to `BLI_math_vector.hh`.
2022-06-27 20:06:32 +02:00
Félix
6b35d9e6fb 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-06-27 19:44:16 +02:00
a2b9b9d3c4 Fix broken build on macOS after recent changes 2022-06-27 17:29:24 +02:00
f0a3d2beb2 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-06-27 16:58:07 +02:00
6f7171525b 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-06-27 16:18:57 +02:00
Sonny Campbell
64a3a11e19 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-06-27 16:09:38 +02:00
6243972319 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-06-27 06:46:29 -07:00
Pratik Borhade
279e7dac7d 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-06-27 10:38:34 -03:00
83c2cbb880 Cleanup: Use assert instead of early exit for asset dragging internals
Instead of failing silently, throw a failed assert in debug builds.
2022-06-27 15:36:25 +02:00
36f5967b99 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-06-27 15:36:25 +02:00
228d79b789 Revert 6de0f29950: BLF: Support for Variable Fonts
Reverting for now, breaks on GCC
2022-06-27 06:32:30 -07:00
6de0f29950 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-06-27 06:07:55 -07:00
151fc2fcd8 Fix T99171: Crash in mesh vertices positions RNA update function
Solution found by Philipp Oeser (@lichtwerk), thanks.
2022-06-27 08:01:54 -05:00
6a2c42a0d5 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-06-27 21:35:32 +10:00
2b806cb955 Cleanup: DRW: Remove drw_view renaming MACROS 2022-06-27 12:46:47 +02:00
ddc6b86a5b Fix color attribute interpolation with GPU subdivision
Handling of 16-bits compression was missing, which gave values that were
way off.
2022-06-27 12:39:39 +02:00
a617929683 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-06-27 20:36:40 +10:00
3cf6516e7b Cleanup: format 2022-06-27 20:27:34 +10:00
Jason Fielder
9130a60d3d 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-06-27 11:45:49 +02:00
7b6b740ace Cleanup: spelling in comments 2022-06-27 17:29:57 +10:00
e1c0d18598 Cleanup: remove redundant has key checks 2022-06-27 17:25:07 +10:00
1cf05f17eb UI: define category for the dope-sheet properties panel
Caused warning on startup, missing from [0].

[0]: 57816a6435
2022-06-27 17:25:07 +10:00
10a2c50733 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-06-27 09:13:40 +02:00
3a8fa77c1f 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-06-27 16:49:21 +10:00
2b6c633b63 GHOST/Wayland: set the minimum window size with libdecor 2022-06-27 16:09:23 +10:00
0e88c2fc59 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-06-27 15:58:07 +10:00
30273b86c7 Fix T98673: Color attribute fill API didn't support editmode 2022-06-26 17:11:03 -07:00
4c3b984b3d 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-06-26 16:15:40 -07:00
77f10fceb2 Cleanup (UV): Remove unused variable do_aspect 2022-06-27 11:13:06 +12:00
81c5b759d6 Fix T99182: Hard code screen_scale for circle drawing in 3D 2022-06-27 10:59:29 +12:00
a646a4b47e Curves: Port string to curves node to the new data-block
Use the conversion implemented in 5606942c63.
2022-06-25 19:09:57 -05:00
be692cc4fe Cleanup: Clang tidy 2022-06-25 19:05:31 -05:00
ef8bb8c0d5 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-06-25 19:41:44 +02:00
22fc0cbd69 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-06-25 19:27:33 +02:00
3237c6dbe8 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-06-25 19:17:08 +02:00
b513c89e84 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-06-25 18:53:26 +02:00
ba1e97f1c6 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-06-25 11:23:19 -05:00
5606942c63 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-06-25 11:11:59 -05:00
2967726a29 Cleanup: add missing override 2022-06-25 18:10:22 +02:00
2a8afc142f 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-06-25 17:28:49 +02:00
9a0a4b0c0d 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-06-25 08:47:31 -05:00
12bde317f4 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-06-24 16:39:58 -05:00
35d2a22846 Cleanup: Remove unused argument 2022-06-24 16:16:43 -05:00
fca94c5e0d 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-06-24 15:48:48 -05:00
f6290cd2a4 Cleanup: Remove unnecessary includes 2022-06-24 15:47:24 -05:00
35da733e6b 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-06-24 19:57:28 +02:00
9b6e86ace1 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-06-24 16:51:56 +02:00
Christian Rauch
29755e1df8 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-06-25 00:10:39 +10:00
f1d191120f 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-06-24 15:36:31 +02:00
ad8add5f0c 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-06-24 23:28:55 +10:00
2580d2bab5 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-06-24 23:19:44 +10:00
77eadbede4 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-06-24 22:16:47 +10:00
585d81ba2b 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-06-24 14:09:15 +02:00
Jeroen Bakker
f748a81f25 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-06-24 13:45:29 +02:00
7927ac2fbe 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-06-24 13:03:29 +02:00
79973494ec Cleanup: Fix building warnings on gcc 9.4.0
Solution by Jacques Lucke
2022-06-24 11:25:12 +02:00
e08c932482 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-06-24 10:23:31 +02:00
3323cd9c9a 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-06-24 14:38:17 +10:00
11f38f59e2 Cleanup: remove unused function WM_cursor_compatible_xy 2022-06-24 14:00:36 +10:00
4c4e8cc926 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-06-24 13:58:21 +10:00
70648683a2 Cleanup: add C++ compatible WL_ARRAY_FOR_EACH macro 2022-06-24 10:22:46 +10:00
cc09661c4e Cleanup: remove unused cursor struct members in GHOST/Wayland 2022-06-24 09:59:37 +10:00
b3a713fffa Cleanup: use const arguments for GHOST/Wayland 2022-06-24 09:58:27 +10:00
9b5dda3b07 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-06-24 09:00:19 +10:00
93de6b912f Docs: correct GHOST_TimerProcPtr time doc-string 2022-06-24 08:46:18 +10:00
4919403c29 Fix outdated pressure/tilt for tablet motions events under GHOST/Wayland
Accumulate tablet data before generating an event using the 'frame'
callback.
2022-06-24 08:19:08 +10:00
41a0411d79 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-06-23 21:32:34 +02:00
b0fe0e6a30 Cleanup: Make function static 2022-06-23 13:03:31 -05:00
0473462241 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-06-23 12:34:31 -05:00
a5ff46e0fc Cleanup: make format 2022-06-23 19:28:39 +02:00
dc64673f6e Fix T97691: undefined behavior sanitizer warning for alignment in RNA functions
Thanks Loren Osborn for investigating this and proposing solutions.

Ref D14798
2022-06-23 19:22:50 +02:00
Max Edge
56435b3268 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-06-23 12:22:23 -05:00
Angel Bueno
792bf82f11 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-06-23 12:16:18 -05:00
9b775ebad7 Cleanup: Remove unused array in vertex paint code
Unused since 4f616c93f7
2022-06-23 12:10:12 -05:00
6dde88c536 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-06-23 12:05:48 -05:00
54182e4925 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-06-23 12:00:25 -05:00
3e5a4d1412 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-06-23 11:51:33 -05:00
633c2f07da 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-06-23 18:36:48 +02:00
2eba15d3e8 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-06-23 11:33:11 -05:00
5c6ffd07e0 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-06-23 18:20:02 +02:00
d1ea39aac7 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-06-23 17:49:26 +02:00
1c83354c63 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-06-23 16:35:11 +02:00
Andrii Symkin
c2a2f3553a 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-06-23 15:02:53 +02:00
b8403b065e 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-06-23 22:25:13 +10:00
e63799e791 Cleanup: fix typo that deactivated clang-format in rna_brush.c 2022-06-23 13:10:26 +02:00
b830263186 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-06-23 11:47:37 +02:00
Colin Basnett
091100bfd7 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-06-23 11:45:53 +02:00
Colin Basnett
2ae4397ec9 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-06-23 11:37:23 +02:00
Colin Basnett
57816a6435 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-06-23 11:12:42 +02:00
Michael Jones
d8e9647ae2 Cycles: Add diagnostic tracing of MTLLibrary compilation time
Reviewed By: sergey

Differential Revision: https://developer.blender.org/D15268
2022-06-23 10:06:20 +01:00
d20bad914e 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-06-23 15:38:43 +10:00
e4f51b3a6e LineArt: Cleanup minor warnings from variable type changes. 2022-06-23 13:22:56 +08:00
743a027862 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-06-23 15:14:18 +10:00
1160a3a3f8 Cleanup: Clang tidy
Mainly duplicate includes and else after return.
2022-06-22 18:58:25 -05:00
d2a3b99ff7 Cleanup: Use const arguments
Also use Curves as an argument instead of Object,
since it's more specific to this situation.
2022-06-22 16:58:22 -05:00
Michael Jones
532b33973b Cycles: Tidy of KernelData patchup code
Reviewed By: sergey

Differential Revision: https://developer.blender.org/D15267
2022-06-22 22:38:00 +01:00
Michael Jones
328a911379 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-06-22 22:32:56 +01:00
5c0d18f682 Cleanup: remove unused sculpt texture cache generation
This has not been used since 5505697ac in 2010.
2022-06-22 19:52:55 +02:00
Ramil Roosileht
b6a76243cd 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-06-22 10:03:27 -07:00
1cde1562e8 Cleanup: simplify macOS make deps instructions 2022-06-22 18:17:47 +02:00
Patrick Huang
9f4ec73101 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-06-22 16:56:20 +02:00
6c3965c027 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-06-22 16:45:20 +02:00
cebc5531e9 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-06-22 09:06:29 -05:00
785931fc3c 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-06-22 09:03:27 -05:00
a3d0f77ded Cleanup: Remove unused function arguments
Solves the corresponding compiler warning.
2022-06-22 10:55:08 +02:00
a7b91fc8bc Cleanup: clang-format 2022-06-22 10:55:08 +02:00
31d80ddeaa 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-06-22 10:48:59 +02:00
Simon Lenz
df2ab4e758 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-06-22 10:45:18 +02:00
Ramil Roosileht
5946ea938a 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-06-22 01:36:13 -07:00
f4d8382c86 Rigid body physics: Move effector force update into substep loop.
The substep loop for rigid bodies causes unequal effects of force fields depedending on the substep setting, larger
substep counts cause a diminishing effect of force fields.
This is because the force to apply on a body is reset in Bullet after each step and needs to be recomputed. Without this
the body will just coast with constant velocity after the first substep. Since the per-step impulse with larger substep
counts is smaller, the effect is that more substeps cause a smaller total impulse.

The fix is to move external force calculation into the substep loop and update forces for each substep.

Note that this may be considered a breaking change, because the breaking commit rB1aa54d4921c2 has been in master for
a long time and after this fix force fields will generally have a much larger effect on rigid bodies (10x for the
default setting of 10 substeps).

Differential Revision: https://developer.blender.org/D15173
2022-06-22 06:37:45 +01:00
75f0aaab3d Cleanup: remove redundant GPU headers 2022-06-22 14:59:42 +10:00
b8289eb1b9 Cleanup: replace BLF defines with enum, formatting 2022-06-22 14:50:22 +10:00
8fab580949 Fix T99078: Crash closing the file selector in Wayland
Ensure wayland handlers run that clear the window immediately after
the window has been removed so dangling pointers to the window
aren't left set.
2022-06-22 13:11:32 +10:00
c08fda3a6b Cleanup: Grammar in comments 2022-06-21 15:47:25 -05:00
256cb68d33 Cleanup: Remove unused argument 2022-06-21 14:17:24 -05:00
d901f8b75b Fix T98960: Baking to active color attribute uses wrong layer
Baking assumed that color attributes could only have two configurations:
float color data type on vertices, or byte color type on face corners.
In reality the options can be combined to make four total options.
This commit handles the four cases explicitly with a somewhat
more scaleable approach (though this should really be C++ code).

This commit also changes some related error messages, tooltips,
and an enum name, in order to make the functionality more obvious.

Differential Revision: https://developer.blender.org/D15244
2022-06-21 14:15:18 -05:00
7140016838 GPencil: Move New Layer option to menu top
The new layer option must be the first in the menu.

Differential Revision: https://developer.blender.org/D15255
2022-06-21 17:04:30 +02:00
d2f47017b9 Fix crash editing anisotropic filter preference from background mode 2022-06-21 16:00:56 +02:00
9622dace3e Cleanup: removed unused Blender Internal bump/normal mapping texture code
The TexResult.nor output does not appear to be used anywhere.
2022-06-21 16:00:56 +02:00
Colin Basnett
d90b320444 Fix T97533: Extrapolation of NLA strips outside current view are not rendered
Do a more thorough search for strips that are not visible themselves,
but still influence the viewed time range.

The problem before was that tracks not immediately visible would not be
drawn at all. The strategy for fixing this was to simply include strips
that are visible only because of their extrapolation mode.

To do this, there is now a new function `get_visible_nla_strips` which
gives a first and last `NlaTrack` that needs to  be drawn.

Tagging along with this is the removal of the strip index indicator from
the name on meta tracks. Because of the new structure of the code, it
would incur a performance penalty to restore the previous behavior
(requiring a linear search for the index). Since this number is of
virtually no utility to the user anyways (it has the look & feel of
developer debugging information), this is something I think we can
safely remove without regret.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14738
2022-06-21 15:40:45 +02:00
7f3af2aaee NLA: when searching for active track/strip, shortcut when none is active
In the `update_active_track()` function, add a shortcut that just sets
`NULL`, instead of searching for `NULL` pointers. Should give a tiny
speedup.
2022-06-21 15:28:11 +02:00
15bc3d260d Fix 2 for T98700: Crash when recursively nesting NLA meta strips
When searching for the active NLA strip, avoid overwriting the found strip
pointer with NULL if it was already found in a previous iteration.

The active strip is searched for while looping over the NLA tracks. If the
active strip was found on a previous track, and not on the current track,
this would effectively set `actstrip = NULL`. This is now avoided.

Another benefit is that the search for the active strip is stopped as soon
as it's found, which should increase performance a tiny bit.
2022-06-21 15:28:11 +02:00
d373206c3f NLA: update comment to reflect the current implementation
No functional changes.
2022-06-21 15:28:11 +02:00
3bb34fb7ee NLA: add BLI_assert_msg() to check for assumption
`find_active_strip_from_listbase()` expects two lists of strips with an
equal number of items. This is now not only documented, but also checked
for in an assertion.
2022-06-21 15:22:52 +02:00
ee78c860b8 LineArt: Move style options to top of the modifier.
Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D15164
2022-06-21 16:10:35 +08:00
84fc086254 Fix T98919: Eevee unlinked aov output nodes don't render.
Eevee rendered an empty image for aov nodes that weren't linked to
any other nodes. When connected the result was OK. The root cause was
that the AOV nodes were not marked as output node and pruned when not
connected to any other nodes. The pruning process is there to reduce
the complexity of the GLSL and improve compilation time and
execution time.
2022-06-21 09:45:40 +02:00
5d3df1c296 Cleanup: remove unneeded code in eevee_bloom.
This had to be added to the previous commit.
2022-06-21 08:27:20 +02:00
3df6e75a26 Fix T98972: EEVEE Bloom Pass Outputs Final Image Instead of Bloom.
Regression introduced by {rBca37654b6327}. This commit reversed the
order of loading uniforms. The bloom renderpass used the previous
loading order to overwrite an existing uniform (bloomBaseAdd).

Due to the new ordering this doesn't work anymore where the render
pass outputted an image similar to the final image. This was fixed
by loading the correct value for bloomAddBase and remove the rewrite.
2022-06-21 08:20:26 +02:00
beaae4533a Cleanup: use full names for generated wayland headers, use own directory
Instead of providing our own names for wayland headers, use the filename
component as the basis for the header names. This matches most reference
documentation for Wayland.

Also generate client protocols into a sub-directory `libwayland`,
instead of generating headers into the ghost directory. Making the
include path more specific & makes it easier to differentiate generated
headers from other build files.
2022-06-21 16:08:03 +10:00
84315368ef Fix error in GHOST_ASSERT under Wayland 2022-06-21 16:08:03 +10:00
697363545f GPU subdiv: fix hidden faces in paint mode when hidden in edit mode
Pass `use_hide` to the compute shaders so that we can override the
hidden face flags, like CPU extraction is doing.
2022-06-21 07:39:37 +02:00
e42c662723 Cleanup: Fix format on previous commit 2022-06-21 17:37:15 +12:00
1154b45526 UV: Add "Select Similar" operator in UV editor
Resolves T47437.

Differential Revision: https://developer.blender.org/D15164
2022-06-21 17:33:39 +12:00
4144a85bda Cleanup: Type safety and asserts around ED_select_similar_compare 2022-06-21 16:39:47 +12:00
d7fbc5708a Fix T99016: GPU subdiv artifacts in weight paint with smooth shading
Flags in the smooth shading case were not properly set.
2022-06-21 06:25:08 +02:00
95465606b3 Fix T99033: KDTree deduplication can erase values
Differential Revision: https://developer.blender.org/D15220
2022-06-21 13:21:41 +12:00
a18c291435 Cleanup (UV): Use blenlib math utilities 2022-06-21 10:42:05 +12:00
3545d8a500 Cleanup: Move paint_vertex_color_ops.c to C++ 2022-06-20 13:57:21 -05:00
522dcc54af Fix T94969: Crash in Volume to Mesh with 0 voxels
Checks if voxel amount or -size is <= 0 and if so, returns early.

Differential Revision: https://developer.blender.org/D15241
2022-06-20 20:12:44 +02:00
9f8cc1bc34 Cleanup: Grammar: a vs an 2022-06-20 10:14:17 -05:00
549f9a1178 Build Deps: Disallow looking for Python in registry for ISPC
Should prevent accidental use of wrong Python.
2022-06-20 17:11:33 +02:00
df3a67fc52 Build Deps: Pass Python3 root to ISPC
Following what is done for LLVM. Being consistent feels good here.

Not strictly needed as the build here passed anyway, but it does
feel good to be consistent.
2022-06-20 17:10:15 +02:00
f86722afc7 Build Deps: Fix ISPVC and OIDN compilation on fresh Windows
Make them to use self-compiled Python, similar to previous fixes
for other libraries.
2022-06-20 16:50:24 +02:00
6a1cc0d855 Fix T99019 EEVEE: Regression: Specular BSDF does not apply occlusion
Since the occlusion input is going to be removed in EEVEE-Next, I just
added a temporary workaround. The occlusion is passed as SSS radius
as the Specular BSDF does not use it.

The final result matches 3.1 release
2022-06-20 16:33:04 +02:00
3bb8b64c47 Fix T99018: EEVEE: Regression: Specular BSDF apply specular color input twice
This was an oversight. I checked that no other node had the same regression.
2022-06-20 16:33:04 +02:00
d2e4bd7995 Curves: extract surface brush sampling into separate function
This functionality will also be necessary in the Density brush.
2022-06-20 16:27:57 +02:00
af983a3eef BLI: add min_inplace and max_inplace functions 2022-06-20 16:27:57 +02:00
06b212c446 Fix: assert when deleting all curves 2022-06-20 16:27:57 +02:00
Simon Lenz
eca0c95d51 Mask Editor: Add mask blending factor for combined overlay
This adds a new parameter to the "Combined" overlay mode of the mask editor.
The "blending factor" allows users to blend the mask exterior with the original
footage to visualise the content of the mask in a more intuitive way.  The
"Alpha" overlay is unaffected by this change.

The existing "Combined" overlay is used like before (covering everything
outside the mask in black), but can be blended with the slider in the mask
overlay to look at the exterior.

This is part of an effort to make mask editing more intuitive & easy to use:
https://developer.blender.org/T93097

Differential Revision: https://developer.blender.org/D13284
2022-06-20 16:04:15 +02:00
72a5bb8ba9 Fix artefacts with GPU subdiv and weight paint face selection
Addendum to previous fix, which was for point selection, this fixes the
face selection mode. The issue is caused by wrong flags used for paint
mode (the edit mode flag was always used). Also add back flag which was
accidentally removed in 16f5d51109.
2022-06-20 14:42:09 +02:00
ff1883307f Cleanup: renaming and consistency for kernel data
* Rename "texture" to "data array". This has not used textures for a long time,
  there are just global memory arrays now. (On old CUDA GPUs there was a cache
  for textures but not global memory, so we used to put all data in textures.)
* For CUDA and HIP, put globals in KernelParams struct like other devices.
* Drop __ prefix for data array names, no possibility for naming conflict now that
  these are in a struct.
2022-06-20 12:30:48 +02:00
b73a52302e Fix T98913: GPU Subdivision: "Show Wire" overlay glitch
Issue is caused by an off by one error which would map some edge loops to
the loops of some the next polygon in the list of polygon, which may not
be a topological neighbor.
2022-06-20 12:14:03 +02:00
088157e447 Cleanup: Add description of more mask editing poll functions
No functional changes.
2022-06-20 11:25:38 +02:00
e658c8851a Refactor: De-duplicate mask operator poll functions
The poll function with same semantic was defined in both screen and
mask space modules. The only reason for this seems to be that the
image editor needed a mask poll function which was private to the
mask module.

Make the mask editing poll functions public, avoiding code duplication.

Also, added a brief explanation about what the poll functions are
checking for.

No user-level changes are expected to happen.
2022-06-20 11:21:09 +02:00
f8cec1ff30 Cleanup: avoid duplicate lookups when setting the cursor
Also use `const char *` for cursor names as there isn't an advantage
in using `std::string`.
2022-06-20 12:18:36 +10:00
a76c1ddecc Fix setting the custom cursor for Hi-DPI displays in Wayland
Changing the cursor would intermittently close Blender's window
(without crashing).

This happened because the size of a cursor must be the a multiple of the
scale, for themed cursor this is always true but with custom cursors
it's not.

Separate theme scale from custom cursor scale to avoid this bug.
In the future we can support Hi-DPI custom cursors, for now they're
scale is always set to 1.
2022-06-20 12:12:05 +10:00
6e8217d35e GHOST/Wayland: refactor cursor handling & fix errors hiding the cursor
- Support showing & hiding the cursor without setting the buffer,
  needed to switch between software and hardware cursor.
- Track the state of the software/hardware cursor.

This resolves glitches switching between cursors sometimes hiding the
cursor.
2022-06-20 12:09:31 +10:00
Iyad Ahmed
6ad9d8e224 STL: Fix missing space in C++ .stl importer info output
Fixes C++ .stl importer info output having no space between the
number and the word after it.

Reviewed By: Aras Pranckevicius
Differential Revision: https://developer.blender.org/D15240
2022-06-19 17:42:58 +03:00
91b5254598 Fix T98874: new obj importer missing an option to import vertex groups
The old Python OBJ importer had a (somewhat confusingly named) "Keep
Vertex Order -> Poly Groups" option, that imported OBJ groups as
"vertex groups" on the resulting mesh. All vertices of any face were
assigned the vertex group, with a 1.0 weight.

The new C++ importer did not have this option. It was trying to do
something with vertex groups, but failing to actually achieve
anything :) -- the vertex groups were created on the wrong object
(later on overwritten by "nomain mesh to main mesh" operation);
vertex weights were set to 1.0/vertex_count, and each vertex was only
set to be in one group, even when it belongs to multiple faces from
different groups. End result was that to the user, vertex groups were
not visible/present at all (see T98874).

This patch adds the import option (named "Vertex Groups"), which is
off by default, and fixes the import code logic to actually do the
right thing. Tested on file from T98874; vertex groups are imported
just like with the Python importer.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D15200
2022-06-19 17:39:54 +03:00
cf8922ef57 Fix T97820: new OBJ importer wrongly producing "sharp" edges in some cases
The new OBJ importer is producing "sharp" edges on some meshes that
should be completely smooth. Only observed on UV-Sphere type meshes
so far (see T97820).

I'm not 100% sure what is the root cause, but my theory was that
maybe due to limited number of float digits that are printed for
vertex normals in the file, the normals that are read in are not
always exactly 1.0 length. And then the Blender's "set custom loop
normals" function (which expects normalized inputs) wrongly marks
some edges as sharp.

Adding explicit normalization for the normals that are read from the
file fixes the wrongly-sharp edges in test cases from T97820. I
have not observed measurable performance impact in importing large
models (e.g. 6-level subdivided Monkey) that contain vertex normals.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D15202
2022-06-19 17:38:32 +03:00
b7e193cdad BLI: avoid unnecessary allocation when converting virtual array 2022-06-19 14:52:51 +02:00
d48735cca2 Functions: speedup multi-function procedure executor
This improves performance of the procedure executor on secondary metrics
(i.e. not for the main use case when many elements are processed together,
but for the use case when a single element is processed at a time).

In my benchmark I'm measuring a 50-60% improvement:
* Procedure with a single function (executed many times): `5.8s -> 2.7s`.
* Procedure with 1000 functions (executed many times): `2.4 -> 1.0s`.

The speedup is mainly achieved in multiple ways:
* Store an `Array` of variable states, instead of a map. The array is indexed
  with indices stored in each variable. This also avoids separately allocating
  variable states.
* Move less data around in the scheduler and use a `Stack` instead of `Map`.
  `Map` was used before because it allows for some optimizations that might
  be more important in the future, but they don't matter right now (e.g. joining
  execution paths that diverged earlier).
* Avoid memory allocations by giving the `LinearAllocator` some memory
  from the stack.
2022-06-19 14:25:56 +02:00
575884b827 Update RNA Manual References 2022-06-18 18:14:54 -04:00
7bf306622e Constraints: handle the custom target at the constraint level.
Since the custom target is a feature implemented at constraint
level, it is more appropriate to handle it in the common wrapper
functions, instead of modifying all the type specific callbacks
like get_constraint_targets and flush_constraint_targets.

Also, tag the special target with a flag so other code can
handle it appropriately where necessary.

This was split from D9732, and effectively reverts and refactors
part of D7437. This patch should cause no functional changes.

Differential Revision: https://developer.blender.org/D15168
2022-06-18 18:43:02 +03:00
b8bd304bd4 Geometry Nodes: speedup Separate XYZ node
This speeds up the node ~20% in common cases, e.g. when only the
X axis is used. The main optimization comes from not writing to memory
that's not used afterwards anymore anyway.

The "optimal code" for just extracting the x axis in a separate loop was
not faster for me. That indicates that the node is bottlenecked by
memory bandwidth, which seems reasonable.
2022-06-18 13:41:08 +02:00
7d030213b2 GHOST/Wayland: implement getAllDisplayDimensions 2022-06-18 21:27:23 +10:00
cf3238c1c7 Fix initial window size being scaled down for Hi-DPI displays in Wayland
getMainDisplayDimensions return values were scaled by the UI-scale,
instead of returning pixel values.

Also correct an error accessing the rotated monitor size,
which happened to be harmless as the value isn't used at the moment.
2022-06-18 21:27:23 +10:00
ac4836af6a Cleanup: Remove unused argument, unnecessary struct keyword 2022-06-18 13:08:15 +02:00
30f244d96f Fix: curves have incorrect resolution attribute after realizing instances
If the resolution attribute existed on some curves, but not on others, it
was initialized to zero by default. However, zero is not a valid resolution.
2022-06-18 13:01:41 +02:00
3c2a2a6c96 Cleanup: Always store attribute name in attribute request
Previously the attribute name was only stored in the request for curves.
Instead, pass it as part of the "add request" function, so that it is
always used. Since the whole attribute pipeline is name-based,
this can simplify code in a few places.
2022-06-18 11:48:51 +02:00
8a3ff496a7 Cleanup: Remove unnecessary switch statement
The types are retrieved by the attribute matching above anyway,
there is no reason to have another switch based on the type.
2022-06-18 11:40:46 +02:00
498f079d2c GHOST/Wayland: support displaying custom software cursors
Add a method to access the custom cursor from GHOST which is used
for drawing a software cursor. This means the knife tools cursor now
work as expected.

Although non-custom cursors are still not supported.
2022-06-18 17:16:42 +10:00
881d1c9bc2 Fix crash in wayland when closing a window
The focus_pointer only pointer was only cleared when the window existed,
which caused a dangling focus_pointer when closing a window.
2022-06-18 16:50:25 +10:00
35b2b9b6e6 Fix T98793: Wayland clamps cursor movement fails with gnome-shell
The current gnome-shell (v42.2) has a bug where grabbing the cursor
doesn't scale the region when confining it to the window.

For Hi-DPI displays this means the cursor may be confined to a quarter
of the window, making grab unusable.

Even though this has been fixed up-stream the issue remains in the
latest release - so workaround the problem by implementing window
confined grab using a software cursor.

This is only used gnome-shell for displays that use Hi-DPI scaling.
2022-06-18 15:06:46 +10:00
5c814e75f2 GHOST: add GHOST_Rect.clampPoint method
Method for clamping a point inside a rectangle.
2022-06-18 14:33:50 +10:00
Ray Molenkamp
600c391a65 Cleanup: Compiler Warning of Sign Conversion #2
Second attempt to silence sign-conversion warning on Linux, introduced
in rB524a9e3db810. Confirmed fix on buildbot.
2022-06-17 13:59:25 -07:00
3d3c0dfe30 Cleanup: Compiler Warning of Sign Conversion
rB524a9e3db810 introduced sign-conversion warning on Linux.

Own Code
2022-06-17 12:46:37 -07:00
5b5811c97b USD: speed up large USD imports by not rebuilding material name map for each object
Previous code was rebuilding "name to material" map for each object
being imported. Which means O(N*M) complexity (N=object count,
M=material count). There was already a TODO comment suggesting that
a single map that's maintained for the whole import would be enough.
This commit does exactly that.

While importing Moana USD scene (260k objects, 18k materials) this
saves about 6 minutes of import time.

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D15222
2022-06-17 22:28:22 +03:00
230f72347a IO: speed up large Alembic & USD imports by doing fewer collection syncs
Previous code was doing N collection syncs when importing N objects
(essentially quadratic complexity in terms of object count). 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. The things done on the importer objects that are
dependent on the sync happening (marking them selected) are done in a
separate loop after the sync.

Timings: importing Moana USD scene (480k objects) on Windows, VS2022
Release build, AMD Ryzen 5950X: 12344sec -> 10979sec (saves 22 minutes).

Reviewed By: Bastien Montagne
Differential Revision: https://developer.blender.org/D15215
2022-06-17 22:22:30 +03:00
Patrick Huang
257b4d138c Fix T93446: search box active result does not reset when typing
Whenever the user edits the query in a search box, the active (highlighted)
result resets to the first. Previously, it would remain at the last
highlighted result, jumping around as the results update.

This is better than the previous behavior. If a user highlights a choice either
on purpose or by accidental mouse movement and continues to type, it is likely
that they are not looking for the currently highlighted choice, so setting it
to the top search result is more useful.

Differential Revision: https://developer.blender.org/D15211
2022-06-17 19:51:13 +02:00
Jim Eckerlein
33bad77043 Draco: update to version 1.5.2
Differential Revision: https://developer.blender.org/D15233
2022-06-17 19:40:01 +02:00
524a9e3db8 BLF: Fallback Font Stack
Allow use of multiple fonts acting together like a fallback stack,
where if a glyph is not found in one it can be retrieved from another.

See D12622 for much more detail

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

Reviewed by Brecht Van Lommel
2022-06-17 10:31:48 -07:00
5485057a27 Cleanup: compiler warnings 2022-06-17 19:18:47 +02:00
0ea173165b Revert "TEST COMMIT: API doc generation changes."
This reverts commit d86af60429.
2022-06-17 18:21:28 +02:00
9bae9d97b1 deps: fix llvm using system python
llvm was using system python, rather than our copy
this went unnoticed on both linux and windows until
sergey tried to build the deps on a clean system with
no system python installed.
2022-06-17 09:38:25 -06:00
d86af60429 TEST COMMIT: API doc generation changes.
This commit is intended to be reverted within a few minutes.

commit 50adc860a652508570dbc7102ef288049a9ffed4
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:43:13 2022 +0200

    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.

commit 88fc683e78f866f1b3cda379c3b90e1f2916ce00
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:36:19 2022 +0200

    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.
2022-06-17 17:07:37 +02:00
3c0162295f Revert "TEST COMMIT: API doc generation changes."
This reverts commit 52b93c423d.
2022-06-17 17:03:32 +02:00
0d43117a40 Cleanup: deduplicate generating transform matrices in curves brushes 2022-06-17 16:57:36 +02:00
23662a9a84 Cleanup: simplify Add Curves brush 2022-06-17 16:57:36 +02:00
52b93c423d TEST COMMIT: API doc generation changes.
This commit is intended to be reverted within a few minutes.

commit 9442d8ef0f255d3c18b610b42aff71229904aaee
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:43:13 2022 +0200

    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.

commit f7fb537078641d2e2de015c08554f5281ce9debd
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:36:19 2022 +0200

    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.
2022-06-17 16:39:36 +02:00
b8f489c65b Revert "TEST COMMIT: API doc generation changes."
This reverts commit 510f3fe9a9.
2022-06-17 16:30:42 +02:00
133095fff4 Curves: refactor Add brush
This splits out the code that samples points on a surface and the
code that initializes new curves. This code will be reused by D15134.

Differential Revision: https://developer.blender.org/D15216
2022-06-17 15:31:21 +02:00
18def163f8 Cleanup: Simplify syntax in curves draw cache file
Also remove some unnecessary logic and change a variable name.
2022-06-17 15:11:41 +02:00
f0b4aa5d59 LibOverride: Handle dependencies in both directions in partial override cases.
When creating etc. a liboverride based on a partial hierarchy
pre-selection (e.g: override hierarchy on the rig object of a
character), now all linked data also using that rig (e.g. all meshes
deformed by that armature) will also automatically be overridden.

This si achieved by following dependencies in the reversed order (from
used IDs to using IDs) when we find one tagged for override.
2022-06-17 14:10:51 +02:00
8d61ca5815 BKE_main: Relations: Add TO/FROM variants of processed flags.
In some cases, it can be usefull to distinguish when an entry has been
processed in which direction (`to` when handling ID pointers used by
the entry, `from` when handling ID using this entry).

Previous `MAINIDRELATIONS_ENTRY_TAGS_PROCESSED` tag is now a combination
of the two new ones.
2022-06-17 14:10:51 +02:00
2c1bffa286 Cleanup: add verbose logging category names instead of numbers
And use them more consistently than before.
2022-06-17 14:08:14 +02:00
24246d9870 Cleanup: replace uint4 by AttributeMap struct 2022-06-17 14:08:14 +02:00
Chris Clyne
838c4a97f1 Geometry Nodes: new Volume Cube node
This commit adds a Volume Cube primitive node. It outputs a volume that
contains a single "density" float grid. The density per voxel can be
controlled with a field that depends on the voxel position (using the
existing Position node). Other field inputs are not supported.

The density field is evaluated on every voxel.

Possible future improvements are listed in D15198.

Differential Revision: https://developer.blender.org/D15198
2022-06-17 13:30:44 +02:00
75489b5887 Geometry Nodes: tweak Volume to Mesh threshold declaration
* Remove the minimum value, because that doesn't make sense in general.
* Add a description.
2022-06-17 13:30:44 +02:00
d54eb5ed20 Fix crash invoking layer add/remove operators without mask 2022-06-17 12:14:30 +02:00
510f3fe9a9 TEST COMMIT: API doc generation changes.
This commit is intended to be reverted within a few minutes.

commit 088497c870630d9b0d405aaa5fd796c77b380731
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:43:13 2022 +0200

    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.

commit 91801f47ad03f4739e97ae4b4edee09687e2cb85
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:36:19 2022 +0200

    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.
2022-06-17 10:46:06 +02:00
10981bc8c0 Fix T98944: Uninitialized XRFrameState can prevent VR/OpenXR viewing
This provides a workaround for the VR session stopping due to an error
in locating controller poses. The problem was that for the actions sync
on the first frame, the session's XrFrameState/predicted display time
had not been initialized yet, which led to an error in xrLocateSpace()
(the error was only observed for some OpenXR runtimes since the first
frame pose state would be inactive for other runtimes, skipping the
call to xrLocateSpace()).

The timing of action updates relative to frame state updates could be
reworked in the future, but for now simply check for a valid display
time to avoid an error on the first frame.
2022-06-17 17:25:48 +09:00
18960c08fd UI: Custom Properties - Rename properties to remove "Use/Is"
There is no need to have use/is in the final name. This is implicitly
represented by the checkbox already.

This does not change the Python API, only the names we show in the user
interface.

* Is Library Overridable -> Library Overridable
* Use Soft Limits -> Soft Limits

Differential Revision: https://developer.blender.org/D15217
2022-06-17 10:08:17 +02:00
96764c3a1f Cleanup: Remove redundant doxygen section
Also remove const for the object argument, since the object data
is logically modified by generating the data.
2022-06-17 09:44:46 +02:00
9830603620 GHOST/Wayland: skip cursor surface operations when hiding the cursor
Also set the buffer scale before setting the cursor (matching SDL).
2022-06-17 17:35:44 +10:00
f59418fd92 Cleanup: use booleans for GHOST C-API
Also use GHOST_ prefix for public functions.
2022-06-17 17:18:06 +10:00
5cda99ff52 Cleanup: clang-tidy for GHOST 2022-06-17 17:15:06 +10:00
c756d08b4a Cleanup: remove redundant string formatting 2022-06-17 17:14:00 +10:00
1152a437e0 Cleanup: remove r_ prefix for non-return values 2022-06-17 17:13:59 +10:00
0ff7a7b3b5 Fix T98663: Eevee compilation error cryptomatte shaders.
On MacOS Eevee cyptomatte shaders fails as it doesn't ignore the `attrib_load`
parameter. I validated that removind the parameter works on Linux/AMD and MacOS
Intel. It could be that there are other platforms that require the dummy parameter.

If this should use a forward declaration and implement an emoty function in the
cryptomatte vertex shader.
2022-06-17 08:25:21 +02:00
62346abc02 Cleanup: spelling in comments 2022-06-17 07:33:06 +10:00
483bc6c9c1 Cleanup: unused variable warning 2022-06-17 07:23:21 +10:00
e2975cb701 Geometry Nodes: add 'Intersecting Edges' output for boolean node
This patch adds a 'Intersecting Edges' output with a boolean selection
that only gives you the new edges on intersections.

Will work on a couple of examples next, this should make some
interesting effects possible (including getting us closer to the "bevel-
after-boolean-usecase")

To achieve this, a Vector is passed to `direct_mesh_boolean` when the
iMesh is still available (and intersecting edges appended), then from
those edge indices a selection will be stored as attribute.

Differential Revision: https://developer.blender.org/D15151
2022-06-16 20:34:27 +02:00
209bf7780e UI: Add file browser operator to edit directory field
This allows using a shortcut from the file browser to edit the directory
path. The shortcut Ctrl + L is quite standard and used in multiple
GNU/Linux desktop desktop environments, Windows, as well as most web
browsers. Safari on macOS uses Cmd + L.

Reviewed by: Jacques Lucke, Julian Eisel

Differential Revision: https://developer.blender.org/D15196
2022-06-16 19:46:37 +02:00
650d2f863d Cleanup: Use const in File Browser filtering operator 2022-06-16 19:46:37 +02:00
b6b5f317a3 Revert "Revert "Revert "TEST COMMIT: API doc generation changes."""
This reverts commit 5a30fe29ef.
2022-06-16 19:35:55 +02:00
23d2e77a54 UI: Add initial "grid view"
Part of T98560.
See https://wiki.blender.org/wiki/Source/Interface/Views

Adds all the basic functionality needed for grid views. They display
items in a grid of rows and columns, typically with a preview image and
a label underneath. Think of the main region in the Asset Browser.

Current features:
- Active item
- Notifier listening (also added this to the tree view)
- Performance: Skip adding buttons that are not scrolled into view
  (solves performance problems for big asset libraries, for example).
- Custom item size
- Preview items (items that draw a preview with a label underneath)
- Margins between items scale so the entire region width is filled with
  column, rather than leaving a big empty block at the right if there's
  not enough space for another column (like the File and current Asset
Browser does it).
- "Data-View Item" theme colors. Not shown in the UI yet.

No user visible changes expected since the grid views aren't used for
anything yet.

This was developed as part of a rewrite of the Asset Browser UI
(`asset-browser-grid-view` branch), see T95653. There's no reason to
keep this part in a branch, continuing development in master makes
things easier.

Grid and tree views have a lot of very similar code, so I'm planning to
unify them to a degree. I kept things separate for the start to first
find out how much and what exactly makes sense to override.
2022-06-16 19:25:50 +02:00
69d3f41d75 Cleanup: Spelling in comment 2022-06-16 17:36:58 +02:00
6562a11c60 Cleanup: use proper variable name
The `SpaceClip *sc` got incorrectly renamed to `SpaceClip *screen`
in the ad85989a3f.
2022-06-16 16:58:33 +02:00
dc11e1164a Fix T98796: avoid unnecessary mesh copy
The call to `get_component_for_write` would sometimes copy the mesh
even when the mesh is replaced with itself. The `replace_mesh` method
handles that case already, so just use that instead.
2022-06-16 16:45:31 +02:00
947ece8d39 LineArt: Variable name cleanups.
Use more descriptive names for some of the two character variables.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D15192
2022-06-16 22:43:53 +08:00
8b9469ec36 Cleanup: Fix build for make lite and add . to code comments
Issue introduced on e6eefdd402.
2022-06-16 16:37:54 +02:00
5a30fe29ef Revert "Revert "TEST COMMIT: API doc generation changes.""
This reverts commit 502089f275.

Enable again temporarily the new test code for API doc generation.
2022-06-16 16:36:42 +02:00
e0c966a3b9 Fix T98904: GPencil sculpt brushes break after you delete a brush
There were two problems here:

1) Console warnings due to brush was None.
2) It was impossible to recreate a brush.

This patch fixes both issues and it is now possible to recreate any brush.

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

Reviewed by: @dflelinto
2022-06-16 16:29:11 +02:00
49b068bc63 Fix T98847: missing null check in versioning code
It's perfectly legal for `nmd->settings.properties` to be null if
there are no properties.
2022-06-16 16:23:45 +02:00
Hamdi Ozbayburtlu
e6eefdd402 Fix T86076: MPEG Settings Ignored at Render
Add a RNA update function for output video codec setting to update
properties that are incompatible with defaults.

Previously video output bitrate settings were omitted because of the
Constant Rate Factor (CRF) default. CRF setting for video codec is only
available for H264, MPEG4 and WEBM/VP9 outputs, so for the others
changing encoder quality mode to constant bitrate (CBR) as CRF is not
supported.

Reviewed By: ISS, mano-wii

Differential Revision: https://developer.blender.org/D15201
2022-06-16 16:03:37 +02:00
dce03ecd5c LibOverride: 3DView: simplification and improvements of override creation.
This commit:
* Removes the popup to choose the root collection when called with a
  linked object selected (in typical cases there is only one valid
  option, if more then the operator fails and report to the user).
* Ensures that the linked reference of newly overridden collections are
  also removed from the ViewLayer (i.e. their local parent collections).
2022-06-16 15:58:40 +02:00
798b49109b ID Type: Sort the items alphabetically
This also renames Hair Curves to Curves. Meaning that until we get
rid of the old curve type we will have both of those entires there:

* Curve
* Curves

This rna enum is used among other things in the driver UI to pick
which data-block you want the property from.
2022-06-16 15:25:09 +02:00
9bed68de13 Fix T98860: VectorProperty type renamed to COORDS (breaking scripts)
Regression in [0] unintentionally renamed COORDINATES.
There was a naming discrepancy when two (nearly) identical arrays,
de-duplicating them caused the error.

[0]: 94444aaadf
2022-06-16 18:10:02 +10:00
36307d8fba Fix (studio-reported) broken 'system override' filtering in liboverride view of the Outliner.
Regression from recent rB717ab5aeaecc.
2022-06-16 09:56:15 +02:00
1064bf58c3 Cleanup: differentiate region/screen relative coordinates
- Avoid ambiguity which caused these values to be confused, use `mval`
  for region relative mouse coordinates, otherwise `event_xy`.

- Pass region relative coordinates to sample_detail_dyntopo &
  sample_detail_voxel as there is no reason to use screen-space values.

- Rename invalid use of mval for screen-space coordinates.
2022-06-16 16:32:35 +10:00
b19751bee2 Fix mouse coords for sculpt ignore background click, sample voxel detail
Both operations used screen-relative coordinates when region-relative
coordinates were expected.
2022-06-16 15:57:28 +10:00
65b1b1cd34 GHOST/Wayland: workaround inability to access window position
Wayland doesn't support accessing the position making functionality that
would map events to other windows fail, sometimes considering windows
overlapping when they weren't (as all window positions were zeroed).

Disable dragging between windows when accessing the window the position
isn't supported.
2022-06-16 15:22:46 +10:00
a17f74ab34 Fix memory leak plugging in new keyboards in wayland 2022-06-16 14:55:37 +10:00
0d644e6d06 Cleanup: return const vector for system & window outputs() method
Move the enter/leave logic into methods so the method can return a const
vector which isn't to be manipulated from other functions.
2022-06-16 14:27:57 +10:00
9dd5c2a7ec Fix error selecting the window scale in wayland
Regression in [0] caused all output to be considered when updating
after monitor outputs changed.

[0]: ac2a56d7f3
2022-06-16 14:18:45 +10:00
1fed24de5a GHOST/Wayland: acquire locks before freeing data on exit 2022-06-16 12:29:22 +10:00
409c62aa61 Fix missing free for drag & drop data with GHOST/Wayland 2022-06-16 12:29:20 +10:00
02012b0cce GHOST/Wayland: account for fractional scale when picking the output
Finding the output with the largest scale now checks fractional scaling.

While this is only a minor difference in most cases, it makes the scale
deterministic instead of depending on the order outputs are added.
2022-06-16 12:29:18 +10:00
fa99323f09 Cleanup: quiet compiler warnings 2022-06-16 12:29:10 +10:00
e6e9f1ac5a Fix T98239: During UV Unwrap, create unique indices for each pinned UV
Originally reported in T75007.

Differential Revision: https://developer.blender.org/D15199
2022-06-16 09:53:50 +12:00
Iyad Ahmed
2804497312 io: remove unnecessary transposes when using mat3_from_axis_conversion
Some I/O code paths (Collada, OBJ) were using mat3_from_axis_conversion
followed by transpose_m3, instead of swapping the axis arguments
which achieves exactly the same result.

Reviewed By: Aras Pranckevicius
Differential Revision: https://developer.blender.org/D15158
2022-06-15 21:46:38 +03:00
43ddfdb1a5 Fix T98909: Outliner - "Show Hierarchy" only shows one level
Error in a4a7af4732.

To allow deleting tree elements while iterating, the new iterators would
get needed data out of the tree element before calling the iterator
callback. This included the info if the element is open or collapsed. So
if the callback would open or collapse elements, the iterator wouldn't
respect that change. Luckily the way the open/collapsed state is stored,
we can still query it after the callback is executed, without having to
access the (possibly freed) tree element.
2022-06-15 20:14:29 +02:00
653100cd65 obj: reduce vertex colors to 4 decimal places, reenable tests
OBJ vertex color related tests were not producing identical results
across various platforms, primarily due to sRGB<->Linear color space
conversions.

While D15193 has just made the color space conversion accuracy match
much closer between platforms, it's still not 100% the same.

This change reduces the amount of decimal places used for exporting
vertex colors, to 4 digits (down from 6). Vertex normals were
already always printed with 4 digits, and colors are conceptually
similar (usually 0..1 range etc.).

This makes the vertex color tests pass again, so re-enable them
after adjusting to 4 decimals expectations.
2022-06-15 21:05:35 +03:00
004d858138 math: improve accuracy of Linear->sRGB conversion SIMD path
srgb_to_linearrgb_v3_v3 is using an approximation of powf that is
SIMD. However, while the accuracy of it is ok, a larger issue is that
it produces different results on Intel compared to ARM architectures.

On ARM (e.g. AppleSilicon), the result of the SIMD code path is much
closer to the reference implementation. This seems to be because of
_mm_rsqrt_ps usage in _bli_math_fastpow512. The ARM/NEON code path
emulates inverse square root with a combination of vrsqrteq_f32
followed by two Newton-Raphson iterations, because blender uses the
SSE2NEON_PRECISE_SQRT define.

This commit adds similar NR iterations to the "actual SSE" code path
as well.

Max error of srgb->linear->srgb conversion roundtrip goes from
0.000211 down to about 0.000062.

Reviewed By: Sergey Sharybin
Differential Revision: https://developer.blender.org/D15193
2022-06-15 20:51:25 +03:00
7e89bbb2ff UI: Implement icons for the curve sculpt tools brushes
I'm using the tool icons for the brush themselves.

Note: This includes a few brushes that are only defined in D15134.
Those are simply the icons rendered with a world background of #282828.
2022-06-15 18:59:33 +02:00
0a3650210f UI: Fix sculpt curve not being able to get brush icons
This commit doesn't add the brush icons themselves, but
it fix the code that allow them to be used.
2022-06-15 18:31:13 +02:00
d3edb3cfc7 Fix missing translation hint in tracking code
Is likely harmless due to Camera being covered by other areas,
but is still good to do a proper hint.
2022-06-15 17:15:05 +02:00
502089f275 Revert "TEST COMMIT: API doc generation changes."
This reverts commit 298372fa06.
2022-06-15 17:11:00 +02:00
298372fa06 TEST COMMIT: API doc generation changes.
This commit is intended to be reverted within a few minutes.

commit 39ffb045a52d16994c1c87ccf3249ff3222a8fca
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:43:13 2022 +0200

    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.

commit fbe354d3fcfa2ad1ed430c3c27e19b99a0266dda
Author: Bastien Montagne <bastien@blender.org>
Date:   Wed Jun 15 15:36:19 2022 +0200

    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.
2022-06-15 16:48:30 +02:00
f0fa90e156 GPencil: Fix crash when using time offset modifier
This fixes a mistake in 60bf561d37, which did not account for offset
frames by the time offset modifier.
2022-06-15 16:15:45 +02:00
fe988f6c7f depsbuilder: build_deps.cmd look for pythonw rather than python
There is a check to be sure no system python is in the path
on windows to be sure deps do not accidentally build against it.

The problem arises on certain versions of windows that ship a
python.exe that just opens up the MS store to download their
python version. The check takes this to be a real python
installation and refuses to build.

This change fixes the issue by looking for pythonw.exe which a
real python install would have, but the MS store opening one that
windows ships (as of now) would not.
2022-06-15 07:47:28 -06:00
60bf561d37 Fix T98853: Blender crashes when moving grease pencil object has any invisible layers
Whats happening is that the modifier keeps adding new frames to the evaluated object resulting in an exponential increase. This is because when preparing the data for the modifiers we only copy visible strokes to the eval object. But the modifiers do not consider visibility and will generate the mirrored strokes even for layers that are hidden. Because those layers have not been copied (only their structure) we run into this issue.

The solution is always copy the active frame of all layers (even if the layer is hidden).
2022-06-15 15:37:39 +02:00
Kevin Curry
2e33172719 Assets: Don't show duplicated catalog name when dragging assets
While dragging assets over a catalog, we would show both the name and
the full catalog path in the drag tooltip. For catalogs at the root
level (catalogs without parents) the name and the full path are the
same, so it would just display the name twice. This is more confusing
than helpful. Now skip displaying the full path in that case.

Reviewed by: Julian Eisel
Addresses T92855

Differential Revision: https://developer.blender.org/D15190
2022-06-15 15:27:20 +02:00
15b4120064 Make Instance Face: Support instanced collections too
Differential Revision: https://developer.blender.org/D15204
2022-06-15 13:53:37 +02:00
41053deba4 GPencil: Avoid console warnings when no Sculpt brush selected
If the brush is deleted, the panel must not be filled.

To recreate the missing Brush is necessary to use `Reset All`

This fix part of T98904
2022-06-15 13:30:14 +02:00
2e6cd70473 Clip editor: Default to average error sort in dopesheet
This is what we agreed on during the workshop.

Differential Revision: https://developer.blender.org/D15194
2022-06-15 12:37:35 +02:00
216a2c0f37 Clip editor: Use Ascending/Descending order instead of "Inverse"
This is more intuitive for artists.
2022-06-15 12:37:31 +02:00
c1a231f40b Clip editor: Sort tracks alphabetically when they have matched error
Is nice to ensure order of tracks when their error is the same or
is not known yet (the clip was not solved yet).
2022-06-15 12:37:31 +02:00
412c468893 UI: Icons - Rename Density and Slide sculpt curve icons
Those tools will get renamed to follow the standard we have
for the other tools (i.e., add sculpt_ in their name).
2022-06-15 11:46:08 +02:00
7cc8f2743e Cleanup: remove redundant key entry from key_repeat_payload_t 2022-06-15 19:33:41 +10:00
e550e400cd Cleanup: internalize struct members for internal wayland types
Missed from 9978689595.
2022-06-15 19:33:41 +10:00
ea39d808b5 Fix T98765: Regression: Unable to select mask points in clip editor
Re-organize de-selection so that there is less conflict between tracking
and masking operators.

Still not fully ideal: the LMB selection does not de-select everything
now since the `mask.select` with `deselect_all` is only added to the
keymap when the RMB is the select mouse. While this is sub-optimal, this
seems to be how mask selection behaved in the Image Editor in 3.1.

Not sure it worth looking into a more complete fix, as it will likely be
too big to be safe for a corrective release.

Differential Revision: https://developer.blender.org/D15183
2022-06-15 10:24:04 +02:00
fc79b17dce GHOST/Wayland: add NULL pointer checks on window access
There were a few callers that missed checking a NULL return value
which can happen in rare cases.
2022-06-15 18:12:09 +10:00
66483c58eb Cleanup: avoid static_cast when accessing wayland windows
Rename get_window to window_from_surface and return a
GHOST_WindowWayland instead of an GHOST_IWindow since most callers
needed to cast. It also makes sense that an call for accessing windows
would return the native type.
2022-06-15 17:54:28 +10:00
f5dae5844c Fix T98699: Face dot colors in UV editor was using wrong color from theme 2022-06-15 19:41:37 +12:00
9978689595 Cleanup: various minor changes to wayland internal conventions
- Initialize values in the struct declarations
  (help avoid accidental uninitialized struct members).
- Use `wl_` prefix for some types to avoid e.g. `output->output`.
- Use `_fn` suffix for locally defined function variables.
- Use `_handle_` as separator for handlers, making function names easier
  to follow as this separates the handler name from the interface.
- Add doxy sections for listeners in GHOST_WaylandWindow.cpp.
2022-06-15 17:38:54 +10:00
f7bfbc357c Fix T98708: Crash on startup - OpenGL4.2 without conservative depth.
Intel iGPU (HD4000) supports OpenGL 4.4 but doesn't support conservative
depth. (GL_ARB_conservative_depth). This change will only check for the
availability of the extension.
2022-06-15 09:12:22 +02:00
b83f33ffca Cleanup: Miscellaneous improvements to draw attribute extraction
- Remove unnecessary braces in switch statements
- Move `default` to the end of other switch items
- Use camel case for type names
- Use `BLI_assert_unreachable()`
2022-06-15 09:07:26 +02:00
4acbb84efa GHOST/Wayland: resolve glitch drawing the software cursor
When grab was disabled, the software cursor would remain displayed
in the image view. Ensure an additional redraw is done to clear the
cursor.
2022-06-15 15:45:50 +10:00
2770010224 GHOST/Wayland: fractional scaling support
GHOST_GetDPIHint now returns a value that takes fractional scaling into
account. Otherwise the integer scale is used since Wayland's API's use
integer scale values exclusively.

Use the same method as SDL to calculate the fractional scale.
2022-06-15 15:30:44 +10:00
08f5219d1c Cleanup: use int32_t[2] for Wayland display size variables 2022-06-15 14:34:06 +10:00
46f93ac6be Cleanup: unused argument warning 2022-06-15 14:30:07 +10:00
04a75c90d5 Cleanup: Move function definition to correct file
Function `SEQ_transform_handle_overlap` was declared in sequencer module
header file, but it was defined in editor/transform module.

Move definition to sequencer module.
2022-06-14 22:24:36 +02:00
20ba130315 Fix T72831: Incorrect animation handling when strips overlap
Function `SEQ_transform_seqbase_shuffle_time` did not have access to
strip effects, and therefore could not handle their animation. Since
now transformation knows what strips can't be directly moved, but their
position depends on other strips, this collection of strips is passed as
argument, so animation can be offset correctly.
2022-06-14 21:55:59 +02:00
a59fedb0bf Fix T98168: Meta strips do not copy animation to another scene
Copy animation for strips that are inside metas.
2022-06-14 20:13:45 +02:00
6737f89e49 Fix T98718: Face Is Planar Node Not handling Certain Conditions
The comparison between dot products of each point of the poly were
not taking into consideration negative values. FLT_MIN was used rather
than -FLT_MAX due to a misunderstanding of the FLT_MIN definition.

Maniphest Tasks: T98718

Differential Revision: https://developer.blender.org/D15161
2022-06-14 12:53:50 -05:00
7a24fe372c Fix T98879: PBVH active attrs only optimization is buggy
PBVH draw has an optimization where it only sends the
active attribute to the GPU in workbench mode.  This
fails if multiple viewports are open with a mix of
workbench and EEVEE mode; it also causes severe lag
if any workbench viewport is in material mode.

There are two solutions: either add the code in sculpt-dev
that checks for EEVEE viewports at the beginning of each frame,
or integrate pbvh draw properly inside the draw manager
and let it handle which attributes should go to the GPU.
2022-06-14 10:02:30 -07:00
f5e7221fbd Cleanup: Fix const correctness of attribute search function
Retrieving a mutable custom data layer from a const ID
should not be possible.
2022-06-14 17:26:07 +02:00
b690f4c2e6 Fix T98875: Adding camera background image shows error
Don't show an error if no operator property is set at all that can be
used to find an image file or ID for dropping. The caller can decide if
this is an error that needs reporting or a valid case, like it is here.
2022-06-14 17:07:40 +02:00
06780aa4e6 Fix T98797: VSE Slip Strip Contents doesn't work properly
Caused by oversight in 7afcfe111a - code relied on fact, that strip
boundary holds old value until updated.

Calculate new offsets based on stored orignal offsets.
2022-06-14 17:04:19 +02:00
25f18e6c49 Cleanup: Snake case for variable name 2022-06-14 16:41:43 +02:00
0f06de8072 Attributes: Add null check in color attribute duplicate operator
It's potentially possible that the attribute duplication could fail,
for whetever reason. There is no great reason not to be safe in
this high-level code.
2022-06-14 16:41:43 +02:00
58a67e6fb6 Attributes: Adjustments to duplicate attribute API function
Use a name argument, for the same reasons as 6eea5f70e3.
Also reuse the layer and unique name creation in `BKE_id_attribute_new`
instead of reimplementing it. Also include a few miscellaneous cleanups
like using const variables and `std::string`.
2022-06-14 16:41:43 +02:00
3012eca350 Fix T98700: Regression: Crash when recursively nesting NLA meta strips
The `update_active_strip_from_listbase()` function took meta-strips in
the "source" list into account, but didn't recurse into the
corresponding meta-strip of the "destination" list. This is now fixed.

`update_active_strip_from_listbase()` needed a few changes to resolve
the issue:
- It was renamed to `find_active_strip_from_listbase()` to limit its
  reponsibility to just finding the active strip. It now leaves the
  assignment to the caller. This reduces the number of parameters by 1
  and makes recursion simpler.
- The destination strips are now, like the source strips, passed as
  `ListBase`, so that both source & dest can be recursed simultaneously.
2022-06-14 16:25:20 +02:00
67254ea37c Outliner: Sanitize material unlinking callback, report errors
The callback would just assume that it's only called on materials, which
may in fact not be the case. It could also be called for other ID types
and layer collections (see `outliner_do_libdata_operation()`). Properly
check this now.

Also avoid faling silently when the object or object-data to unlink from
couldn't be determined. Report this to the user. Operators that just do
nothing are confusing.
2022-06-14 16:21:12 +02:00
e772087ed6 Fix T98753: Outliner Unlink material in Blender File mode crashes
This issue was only exposed by ba49345705. The ID pointer of the
material's parent tree-element wasn't actually pointing to an ID, but to
the list-base containing the IDs. It was just unlikely to cause issues
in practice, although an assert was thrown.

Just don't do anything if the object or object-data to unlink the
material from could not be found. The following commit will introduce a
error message about this.
2022-06-14 16:21:12 +02:00
c7942c31b2 Fix: Don't allow duplicate color attribute operator in edit mode
The internal function relies on `CustomData_copy_data_layer` currently,
which doesn't work for BMesh. Support could be added as a special case
for BMesh, but in the meantime avoid bugs by just changing the poll.
2022-06-14 16:01:52 +02:00
ca9d65cc97 Fix T98813: crash with GPU subdiv in edit mode and instanced geometry
Instancing with geometry nodes uses just the evaluated Mesh, and ignores the
Object that it came from. That meant that it would try to look up the subsurf
modifier on the instancer object which does not have the subsurf modifier.

Instead of storing a session UUID and looking up the modifier data, store a
point to the subsurf modifier runtime data. Unlike the modifier data, this
runtime data is preserved across depsgraph CoW. It must be for the subdiv
descriptor contained in it to stay valid along with the draw cache.

As a bonus, this moves various Mesh_Runtime variables into the subsurf runtime
data, reducing memory usage for meshes not using subdivision surfaces.

Also fixes T98693, issues with subdivision level >= 8 due to integer overflow.

Differential Revision: https://developer.blender.org/D15184
2022-06-14 14:54:25 +02:00
4e96d71ddb Render report: better wording for reference image updating
The old text was suggesting to run `BLENDER_TEST_UPDATE=1 ctest` for
failed tests. Now it's more clear that this is for the regeneration of
reference (ground truth) images, and that it will not touch passing test
cases.

It now also mentions to commit the new reference images to SVN, driving
the point home that this is for updating those, and not for making
failing tests succeed in general.

Over-the-shoulder reviewed by: @sergey
2022-06-14 13:02:39 +02:00
Sonny Campbell
d209629806 Fix T85729: Crash when exporting for USD and Alembic
Ensure the "null" node graph, which is the root node of the export
graph, always exists.

The crash occured when "Use Settings For" was set to Render, "Visible
Objects Only" was ticked, and a single parent object is in the scene but
disabled for render.

Because the only object attached to the root of the project was disabled
for export, there was no "null" root node added to the export graph.
This change will always add an empty "null" node with no children to the
graph at the start. Other objects will get added to its children as
required.

Reviewed By: sybren

Maniphest Tasks: T85729

Differential Revision: https://developer.blender.org/D15182
2022-06-14 12:29:56 +02:00
28f4fc664f Cleanup: Variable name style in STL importer
Designate private variable names as described by the style guide,
and also add `num` at the end of variable names rather than at
the beginning, as discussed in T85728.
2022-06-14 12:04:58 +02:00
4475c38c5c Fix T98715: Crash drag-dropping collection from outliner to ID property
The value of disabled buttons shouldn't be changed through dropping onto
it. Check for the disabled state in the drop operator poll, so the
dragging code will change the cursor to show that dropping isn't
possible at the given cursor location.
2022-06-14 11:56:51 +02:00
06e0776175 obj: disable vertex color tests until it produces identical results across platforms 2022-06-14 12:53:41 +03:00
e903403b41 Curves: support adding keymap items for operators
* Add a new keymap for `curves.*` operators. This is mainly for
  edit mode operators, but since we don't have edit mode yet,
  these operators are also exposed in sculpt mode currently.
* Fix the naming of the "sculpt curves" keymap.
2022-06-14 10:53:06 +02:00
c654a92237 Fix use after free error in 827fa81767 2022-06-14 18:01:51 +10:00
c1d295e905 Fix crash in 827fa81767
Missing null pointer check.
2022-06-14 17:36:18 +10:00
e1f15e3b32 Fix T98782: ignore OBJ face normal indices if no normals are present
Some OBJ files out there (see T98782) have face definitions that
contain vertex normal indices, but the files themselves don't
contain any vertex normals. The code was doing a "hey, that's an
invalid index" and skipping these faces. But the old python importer
was silently ignoring these normal indices, so do the same here.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D15177
2022-06-14 10:23:28 +03:00
1b4f35f6a5 obj: vertex colors support in importer and exporter
Adds support for vertex colors to OBJ I/O.

Importer:

- Supports both "xyzrgb" and "MRGB" vertex color formats.
- Whenever vertex color is present in the file for a model, it is
  imported and a Color attribute is created (per-vertex, full float
  color data type). Color coming from the file is assumed to be sRGB,
  and is converted to linear upon import.

Exporter:

- Option to export the vertex colors. Defaults to "off", since not
  all 3rd party software supports vertex colors.
- When the option is "on", if a mesh has a color attribute layer,
  the active one is exported in "xyzrgb" form. If the mesh has
  per-face-corner colors, they are averaged on the vertices.
  Colors are converted from linear to sRGB upon export.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D15159
2022-06-14 10:19:02 +03:00
827fa81767 Fix cursor coordinates being quantized to the window scale in Wayland
- Apply the scale before converting cursor coordinates to int.
- Store sub-pixel cursor coordinates internally since
  this is what Wayland uses.
- Use `wl_fixed_t xy[2]` for storing coordinates as it simplifies
  assigning/passing x/y coordinates to an argument / variable.
- Also fix drag-and-drop coordinates which ignored scale.
2022-06-14 16:59:33 +10:00
f001c85772 Cleanup: don't define wayland window methods as private
This meant the system couldn't call window methods unless the window
was cast to GHOST_Window.
2022-06-14 15:07:24 +10:00
97f894881c GHOST/Wayland add tablet support
Add support for tablet pressure, tilt and type detection
(eraser, pen.. etc).

There is currently an inconsistency where the tablets cursor is scaled
larger than the mouse cursor (when the UI is scaled). Although there
doesn't seem to be a way to control this from the client.
2022-06-14 14:53:41 +10:00
74e9605455 blend_render_info: minor improvements to file parsing
- Stop once `ENDB` is reached, as files could include additional data.

- Prevent the possibility of an infinite loop from malformed BHEAD
  blocks that could seek backwards in the file.
2022-06-14 14:30:15 +10:00
6c31bd80e3 Cleanup: spelling 2022-06-14 14:30:13 +10:00
b5a5c24396 Cleanup: redundant function calls 2022-06-14 14:30:11 +10:00
0bd6b3e5a0 Cleanup: unused argument, variable warnings 2022-06-14 14:30:09 +10:00
f89ea052f7 Cleanup: remove the need for image scale using a context
Scaling an image shouldn't depend on the current context.
2022-06-14 14:30:06 +10:00
9a063e85a5 Cleanup: quiet unused variable warning 2022-06-14 14:30:04 +10:00
67f5596f19 Fix T98866: GPU subdiv crash in edit mode with loose geometry
The BMesh case was missing when extracting the loose edges flags used for
display, so the code was crashing on unitialized `MEdge` pointer.
2022-06-14 01:39:28 +02:00
77b34a00f9 Fix T97987: Can not keyframe strip mirror in Y axis
Property shared row with toggle for mirror in X axis, so clicking on
decorator added only keyframe for X axis toggle.
2022-06-13 22:35:36 +02:00
afde12e066 Outliner performance: Only expand sub-trees if needed
Before this, we would build the sub-trees of some elements, just to
remove them afterwards. In big files, this would sometimes build ten
thousands of elements unnecessarily. Now support not building those
sub-trees in the first place.

Performance tests in a Sprite Fright production file (release build):
- View Layer display mode, reduced Outliner tree rebuilding from ~45ms
  to 12-17ms
- Library Overrides display mode, Hierarchies view, reduced tree
  rebuilding from 5-6s(!) to 220ms
2022-06-13 22:06:08 +02:00
988fc24930 Fix T93500: Sequence.fps returns 0 when proxy is used
Caused by `seq_open_anim_file` early returning if anim struct exists,
exen if it's not initialized. To ensure `anim` struct is initialized
when `openfile` argument is true, don't do early return.
2022-06-13 20:46:39 +02:00
3b7ce70232 Fix T94499: Knife missed clipping check
The knife BVH raycast functionality was missing a check to discard
points which were clipped.
2022-06-13 19:28:48 +01:00
1c5f09e8a8 Fix T93469: Image not moving in proportion to mouse
Apply scale factor when preview aspect ratio is not 1:1.
2022-06-13 20:12:35 +02:00
1243c2bdae Fix VSE: Effect strip has length of 1 frame when added
Length was set properly when added, but it was clamped by function
`seq_time_effect_range_set`

Add early return for generator effects where offsets can be used
normally.
2022-06-13 18:29:51 +02:00
40d700c6fb UI: Use "bl_order" for UI child panels
The "bl_order" property on add-on UI panels can be used to put
them in a specific order regardless of the order of registering.
This patch makes this ordering also possible for panels inside panels.

Differential Revision: https://developer.blender.org/D15174
2022-06-13 18:27:50 +02:00
e2993719a8 IO: update documentation for HierarchyIterator::weak_export
The documentation for `HierarchyIterator::weak_export` mentions a feature
that was removed at some point. Another example is used to illustrate its
functionality.

No functional changes.
2022-06-13 16:17:00 +02:00
5abe127b3d GPencil: Use better sampling limits.
The problem with T98683 is that sampling interval can be set to very small,
resulting in very dense points. This patch attempts to optimize that a little bit.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D15180
2022-06-13 22:13:16 +08:00
85fde25178 LineArt: General code cleanups.
- Use uintxx_t for all 8/16/64 bit integer types.
- Removed prepend_edge_direct thingy which is no longer needed in current edge iterator model.
- Minor code path adjustments like only copies view vector when necessary etc.
- Correctly handle ies==NULL in edge cutting function.
- White spaces and comments etc.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D15181
2022-06-13 22:13:16 +08:00
10850f0db9 Cleanup: Use more specific includes for grease pencil modifiers
Also remove unused includes in some cases.
This should make these files recompile less often.
2022-06-13 16:02:44 +02:00
19e0b60f3e Cycles: MetalDeviceQueue - capture of multiple dispatches, and some tidying
This patch adds a new mode of gpu capture (env var `CYCLES_DEBUG_METAL_CAPTURE_SAMPLES`) to capture a block of dispatches between "reset" calls. It also fixes member data naming inconsistencies and adds some missing OS version checks.

Screenshot showing .gputrace capture in Xcode 14.0 beta (using `CYCLES_DEBUG_METAL_CAPTURE_SAMPLES="1"` and `CYCLES_DEBUG_METAL_CAPTURE_LIMIT="10"`):

{F13155703}

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D15179
2022-06-13 13:42:07 +01:00
5ada2afb6d Cleanup: fix various typos
Found via codespell -q 3 -S ./intern,./extern -L ans,ba,bording,datas,eiter,fiter,hist,inout,lod,ot,parm,parms,pixelx,pres,te

Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D15155
2022-06-13 13:17:32 +02:00
434133a631 Cleanup: Remove unused variable and parameter in pbvh_update_draw_buffers 2022-06-13 02:46:35 -07:00
9634f7fae3 Cleanup: Move dragging code for buttons to own file
Moves code for managing dragging data from buttons to a separate file.
This way all this closely related code is in one location, making it
easier to see how it all relates, and easier to find.
2022-06-13 11:15:39 +02:00
16f5d51109 Fix T98735: GPU subdiv displays normals for all elements
The normals flags were not setup properly which made normals for all
elements (vertices, faces) to be drawn when using the normals overlay.
Also remove usage of uints for the flag in the APIs.
2022-06-13 06:20:46 +02:00
c55dac9904 Fix T98745: Anchored mode not working for sculpt smear brush 2022-06-12 12:30:46 -07:00
afe57c4001 Fix T98784: PBVH gpu layout check being ignored
Moved gpu vert format checking outside of pbvh_update_draw_buffers,
which isn't called in every code path of BKE_pbvh_draw_cb. This led
to the draw cache being partially populated by old draw buffers
that were subsequently freed, causing a crash.
2022-06-12 12:12:41 -07:00
37097ae62a Fix T98714: Cursor grab restores to the initial location in Wayland
While Wayland can't warp the cursor, it can set a hint for the cursor
restore location when removing the lock.
2022-06-13 00:20:31 +10:00
3ac656d367 GHOST/Wayland: set the minimum window size
Setting Blender's window 1x1 can happen by accident & causes problems,
set the minimum size as all other GHOST implementations do.
2022-06-12 18:21:23 +10:00
7a849678c9 Fix GHOST/Wayland setting the window size
Zoom in the animation player wasn't working:

- The internal window size value wasn't being updated.
- The window size event wasn't being sent.
2022-06-12 17:48:56 +10:00
07a5869cf6 Fix GHOST/Wayland accessing Ctrl & Alt modifier keys
Only the Shift key was working with GHOST's getModifierKeys method.
Now all modifiers are accessible, since there is no way of detecting
left/right modifiers both are set.
2022-06-12 17:48:56 +10:00
ac2a56d7f3 Fix GHOST/Wayland display glitches on startup
Address two glitches on window creation:

- The DPI was zero until the `surface_enter` callback ran which happens
  after redrawing, causing the splash to display with incorrect scale
  before refreshing once the callback had run.

- The window scale was always 1, even when all outputs were HI-DPI.
  Now the maximum scale of all outputs is used. This isn't fool proof in
  the case of multiple monitors having different scales, however it
  doesn't seem possible to detect the scale used ahead of time
  (details in code-comment).
2022-06-12 17:46:39 +10:00
019df1fa73 Cleanup: use int[2] for window size & pending window size
Also store 'size_pending' with scale applied as it's confusing to only
apply scale to one of the size values.
2022-06-12 17:45:54 +10:00
4c7b0804f8 Cleanup (GPU): Improve efficiency of circle drawing. 2022-06-12 17:49:25 +12:00
cc4d46d91e Fix unreported: Choose nsegments for 2D rotation gizmo based on screen scale.
This mostly affects large rotation gizmos at high DPI.
Without this patch, they appear as 32-gons instead of circles.
2022-06-12 17:47:15 +12:00
9d7e731444 Fix unreported: 2D Gizmo bounding box updated to use gizmo scale. 2022-06-12 17:39:35 +12:00
f24d32f791 Fix T98517: Curve Fill Node creating extra edges.
The delaunay2d function, with mode CDT_CONSTRAINTS_VALID_BMESH_WITH_HOLES
sometimes didn't eat away all of the edges. Doing a prepass to remove
the outer edges until they hit the constraints solves this problem.
2022-06-11 12:33:27 -04:00
922861c5dc Cleanup: minor changes to GHOST/Wayland window output access
- Use a window method to handle updating the window after scale changes.
  This avoids the need for methods that return mutable references to
  DPI & scale.
- Remove window.outputs() method that returned window->system->outputs
  as it is misleading to expose these as window outputs when the outpurs
  returned are all known outputs.
- Use a vector instead of an unordered_set to store window outputs,
  while a 'set' does make sense, it means the outputs can't be accessed
  in the order they're added which may be useful for further changes.
- Use early returns.
2022-06-11 21:03:58 +10:00
add1da52ad Fix T97362: forward slashes in USD texture paths
Ensuring that relative paths to textures in exported USDs use
forward slash separators, for cross-platform compatibility.
2022-06-10 15:07:45 -04:00
9e622e1d02 LineArt: Clean up LineartRenderBuffer.
This patch does code clean ups in `LineartRenderBuffer` because it's
grown kinda big and we need better way to organize those variables inside.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D15172
2022-06-10 22:49:37 +08:00
f6268f921a USD import: Handle material name collisions
This is a partial fix for T90535.

Added Material Name Collision USD import menu option, to specify
the behavior when USD materials in different namespaces have the
same name.

The Material Name Collision menu options are

- Make Unique: Import each USD material as a unique Blender material.
- Reference Existing: If a material with the same name already
exists, reference that instead of importing.

Previously, the default behavior was to always keep the existing
material. This was causing an issue in the ALab scene, where
dozens of different USD materials all have the same name,
usdpreviewsurface1, so that only one instance of these materials
would be imported.

Reviewed by: Sybren

Differential Revision: https://developer.blender.org/D14869
2022-06-10 10:15:09 -04:00
717ab5aeae LibOverride: Consider animated/driven properties as part of the 'system override' ones in the Outliner.
Conceptually animated/driven properties are not controlled by the
liboverride system anymore, even though they may generate override
operations. So consider them as part of the 'system overrides' category,
and hide them by default in the Outliner.
2022-06-10 15:56:55 +02:00
4d0f7c3dcd LibOverride: Add util to check if a given Override Property is animated.
Searches in available animdata for fcuve(s) with matching RNA path.
2022-06-10 15:56:55 +02:00
f5d0a40122 RNA path: add util to find the char in an RNA path where the array indexing starts.
Usefull to easily trim away the 'aray index' part of an RNA path, e.g.
when searching for an FCurve (which never contains that index part in
its RNA path).
2022-06-10 15:56:55 +02:00
07341d7b32 Liboverride: Add rna array index return value to BKE_lib_override_rna_property_find.
Very useful e.g. for dealing with FCurves search.
2022-06-10 15:56:55 +02:00
9cad614ad5 Fix T98756: GPencil Set Vertex Color Attribute does not color unpainted
The operator set the color but the factor of the mix value was not updated and as the default value was 0, the color was not vivible and only worked when the stroke was previously painted.
2022-06-10 15:25:56 +02:00
Ramil Roosileht
9670c649d8 Fix regression in the recent unit system change
Resolves unit tests failure since the D15085.
Also addressed API documentation and formatting format.

Differential Revision: https://developer.blender.org/D15162
2022-06-10 11:17:14 +02:00
a24a28db7b Cleanup: inconsistent naming with recent locking checks in Wayland 2022-06-10 18:58:37 +10:00
d83a418c45 Fix T98727: Dynamic Paint does not update normals
Caused by {rB6a3c3c77b3eb}.

Displacement and wave were tagging the original mesh normals dirty,
instead the result's normals need tagging. Seems like a typo in above
commit (similar to rBfe43c170831f).

Maniphest Tasks: T98727

Differential Revision: https://developer.blender.org/D15165
2022-06-10 10:52:42 +02:00
28f852ccc3 Fix T98758: Crash setting the clipboard in Wayland
Accessing the clipboard in wayland wasn't thread safe,
use locks for the clipboard, drag & drop data access and when
setting the systems clipboard.
2022-06-10 18:42:34 +10:00
00aa57594c Fix dropping files in Wayland
There were two problems dropping files into blender:

- The inputs `focus_pointer` was NULL, causing a crash.
- The wl_data_device_manager version was set to 1, causing the Blender
  window to close (when dropping files in gnome-shell 42).

Resolve by storing the drop surface separately from the pointer surface
and bump the device manager version to 3.
2022-06-10 18:36:10 +10:00
178c184825 GHOST/Wayland: define a log handler to help tracking down errors
Many errors involving mis-use or unexpected situations report an
error and close Blender's window buy don't crash, making it difficult
to track down when the error occurs.

Define an error handler prints the error and a back-trace,
it can also be useful for setting a break-point
2022-06-10 18:36:10 +10:00
2601b9832d GHOST: add back-trace handler to the API
Add a back-trace handler to GHOST, so error handlers can include a
back-trace (when supported).

No functional changes.
2022-06-10 18:36:10 +10:00
eb9fa052a1 Clenaup: use early returns in GHOST/Wayland 2022-06-10 18:36:10 +10:00
6a11cd036c Cleanup: Clang tidy 2022-06-10 10:29:35 +02:00
aebca2bd65 Fix: Missing include 2022-06-10 10:11:49 +02:00
e6548c03f9 UI: Sculpt Curves Slide icon 2022-06-09 17:17:58 +02:00
32ee2ffc7d Fix: Crash in selection paint brush with empty curves 2022-06-09 15:40:07 +02:00
14d1ad8dd8 FCurve: optimize search from an RNA path + index.
By checking the index value first instead of a full fledge string
comparision in `BKE_fcurve_find`, we can make that code significatly
faster (from about 10% in a Heist production file to over 45% in a
heavily animated test file).

While this code was already very fast (a few microseconds per call
typically), it gets called a lot from the UI (several hundreds of time
per refresh), among other things.

NOTE: the `UNLIKELY` hint is responsible for 25% to 30% of the
speed improvement.
2022-06-09 15:17:20 +02:00
6d726192be Fix variable being used without being initialized 2022-06-09 10:11:14 -03:00
f37a37cafe Fix GHOST/Wayland memory leak when copying text 2022-06-09 21:32:49 +10:00
41c7c744eb Cleanup: use C-style comments, add missing doxy section 2022-06-09 21:31:08 +10:00
ed15900473 Cleanup: use const variables & arguments 2022-06-09 21:26:48 +10:00
8a6cbcf386 Curves: Port delete geometry node to the new curves type
Add a method to remove points from the new curves type, just like
the existing curve removal function. No functional changes are expected.
The code is simpler because all data is just stored as attributes, but
also different because the point data for all curves is stored in the same
arrays.

Similar performance improvements as other commits in T95443 are
expected, expecially for cases where there are many small curves.

Differential Revision: https://developer.blender.org/D15130
2022-06-09 13:09:04 +02:00
0fddff027e Cleanup: Unused but set variable in Cycles Metal profiler 2022-06-09 10:20:26 +02:00
a91c8d8efa Fix T98686: Cant rename local NLA tracks within a local library override data-block.
We need a specific exception to general rule 'no rename of anim channels
in liboverride data' for the locally-inserted NLA tracks.
2022-06-09 09:50:27 +02:00
62dece5c86 Cleanup: return true/false instead of 0/1 when returnin boolean. 2022-06-09 09:37:19 +02:00
38bfa53081 Fix T78815: Redraw UV Editor on collection visibility change 2022-06-09 17:39:56 +12:00
0926495de4 UI: Tooltip Edit - Copy to selected button
This commit changes the tool tip for the "Copy To Selected Button" operator.
The exiting tool tip for this operator suggests that it will "copy property to selected objects or bones".

However, it will only copies the property value to the selected objects or bones if the property already exists on the selected items.
It does not copy the property.

Differential Revision: https://developer.blender.org/D14528
2022-06-08 23:26:15 -04:00
a632260828 Cleanup: Removed unused variable 2022-06-08 22:28:46 -04:00
96f88511ee Fix T98688: Snapping not working in curve objects with evaluated geometry
It's an old behavior. Not really considered a bug.

But snapping to faces is already supported in this case.
And allowing snapping to other elements is not disruptive.
2022-06-08 21:49:11 -03:00
132e58610d Cleanup: spelling in comments & variables 2022-06-09 10:27:20 +10:00
3bdf1c11fb Cleanup: warnings 2022-06-09 10:17:39 +10:00
84906d47dc Cleanup: format 2022-06-09 10:11:25 +10:00
8b8fbffeea Fix software cursor being used with absolute events in Wayland
The software cursor was being enabled with absolute events,
causing a problem with absolute tablet events.

This caused both cursors to be visible at once when using a tablet
(with D15152 applied).
2022-06-09 10:11:25 +10:00
8a02696724 Fix assert triggered when snapping to evaluated geometry of a Curve
Curves can have a Mesh evaluated, but only objects of type Mesh have
EditMesh.

This bug is harmless because `sctx->editmesh_caches.remove(value)` only
works with pointers and `BKE_editmesh_from_object(ob_eval)`, even though
it doesn't actually return a `BMEditMesh`, it still returns a pointer
that doesn't exist as a key.
2022-06-08 20:52:34 -03:00
530f2abb9b Cleanup: quiet warnings 2022-06-09 09:48:37 +10:00
4ff9c0f4e3 Fix armatures not visible in VR
Now that VR offscreen drawing accounts for object type visibility,
armatures should be displayed when specified.
2022-06-09 06:59:03 +09:00
371fc68678 Paint: Fix Image Editor Cursor Disappearing (T90120)
This patch fixes T90120.  The fundamental problem is that 2d and the old 3d paint modes share a single Paint struct, ToolSettings->imapaint.  This patch is a temporary fix until the new 3d paint mode (which has its own Paint struct) is released.

The patch works by listening for `NC_SCENE|ND_MODE` inside `image_listener` in `space_image.c`.   It does not use `ED_space_image_paint_update` since that requires a `bMain.`  Instead it calls `paint_cursor_start` (which is promoted to `ED_paint_cursor_start`).  `image_paint_poll` is also promoted to an `ED_` function.

Reviewed By: Campbell Barton
Differential Revision: https://developer.blender.org/D14946
Ref D14946
2022-06-08 12:37:29 -07:00
285a68b7bb Sculpt: PBVH Draw Support for EEVEE
This patch adds support for PBVH drawing in EEVEE.

Notes:
  # PBVH_FACES only.  For Multires we'll need an API to get/cache attributes.  DynTopo support will be merged in later with sculpt-dev's DynTopo implementation.
  # Supports vertex color and UV attributes only; other types can be added fairly easily though.
  # Workbench only sends the active vertex color and UV layers to the GPU.
  # Added a new draw engine API method, DRW_cdlayer_attr_aliases_add.  Please review.
  # The vertex format object is now stored in the pbvh.

Reviewed By: Clément Foucault & Brecht Van Lommel & Jeroen Bakker
Differential Revision: https://developer.blender.org/D13897
Ref D13897
2022-06-08 12:30:01 -07:00
Dennis Ranish
9c28f0eb37 D14823: Adds operator to duplicate the active color attribute layer
Fixes T97706

Adds operator to duplicate the active color attribute layer.
Adds `"Color Attribute Specials"` menu to color attribute ui to access the `"geometry.color_attribute_duplicate"` operator.
Internally adds a function that duplicates a referenced CustomDataLayer
- `BKE_id_attribute_duplicate` mostly copies the existing `BKE_id_attribute_new`
- but gets the type and domain from the referenced layer
- and copies the data from the old layer into the new layer

Reviewed By: Joseph Eagar & Hans Goudey & Julien Kaspar
Differential Revision: https://developer.blender.org/D14823
Ref D14823
2022-06-08 12:10:32 -07:00
Ramil Roosileht
f69c565a33 D15085: Fix numbers jumping in edit voxel size widget
Introduces an option for BKE_unit_value_as_string to skip stripping of zeroes, thus reducing flickering when using edit voxel size widget.

{F13125416}

Reviewed By: Julien Kaspar & Joseph Eagar
Differential Revision: https://developer.blender.org/D15085
Ref D15085
2022-06-08 11:51:29 -07:00
fe4e646405 Fix: Incorrect curves and pointcloud bounding boxes
The generic bounds utility used an incorrect initial value. The value
cannot be zero-initialized, because that breaks the case where all
values are greater than zero.
2022-06-08 18:40:14 +02:00
a3e7280bd8 LibOverride: Make 'image/movieclip user` properties editable. 2022-06-08 18:00:42 +02:00
8843705f65 Fix (unreported) missing rna path for some background image properties.
RNA camera code did not handle path for its image/movieclip users
sub-data, and moviclip RNA struct definition did not have a rna path
function at all.
2022-06-08 18:00:42 +02:00
d62e6f1225 RNA nodetree: improve ImageUser path helper.
Refactor the code, and optimize it slightly (no need e.g. to check for
nodes when the nodetree is of a type that cannot have image user nodes).
2022-06-08 18:00:42 +02:00
1a71f9d2b8 Curves: use radius of middle point to determine curve shape
See {rBb69aad60bda23a53482b2c2ae98715c23a715bc8}
for more details.
2022-06-08 16:52:13 +02:00
cc1cc46099 Fix: incorrect curve parameter for catmull rom curves 2022-06-08 16:42:46 +02:00
17971b8a5b Fix: Heap buffer overflow in new curves set type node 2022-06-08 16:16:45 +02:00
9e393fc2f1 Curves: Port set type node to new data-block
This commit ports the "Set Spline Type" node to the new curves type.
Performance should be improved in similar ways to the other refactors
from the conversion task (T95443). Converting to and from Catmull Rom
curves is now supported. There are a few cases where a lot of work can
be skipped: when the number of points doesn't change, and when the
types already match the goal type.

The refactor has a few other explicit goals as well:
 - Don't count on initialization of attribute arrays when they are
   first allocated.
 - Avoid copying the entire data-block when possible.
 - Make decisions about which attributes to copy when changing curves
   more obvious.
 - Use higher-level methods to copy data between curve points.
 - Optimize for the common cases of single types and full selections.
 - Process selected curves of the same types in the same loop.

The Bezier to NURBS conversion is written by Piotr Makal (@pmakal).

Differential Revision: https://developer.blender.org/D14769
2022-06-08 15:37:46 +02:00
Dilith Jayakody
520be607e8 Fix T98624: Curve Pen NURBS extrusion creates duplicates
The initial point count check was only being done for Bezier curves.
This revision fixes T98624 by adding the check for NURBS curves as well.

Reviewed By: HooglyBoogly

Maniphest Tasks: T98624

Differential Revision: https://developer.blender.org/D15140
2022-06-08 18:37:09 +05:30
7a751327fa Fix T98620: Video sequencer screen corruption occurs when resizing.
Added Windows/Intel GPU to the list of work-a-rounds. This will
reduce the performance when using Intel GPUs on all platforms.
2022-06-08 13:15:28 +02:00
ca29376e00 Cleanup: Move sculpt_automasking.c to c++ 2022-06-08 03:33:18 -07:00
b52760a023 Fix T98565: remove unused BRUSH_PAINT icon definition
This could spam the console with errors (potentionally slowing down in
cases).

Was added in rBeae36be372a6, but not used.

Maniphest Tasks: T98565

Differential Revision: https://developer.blender.org/D15113
2022-06-08 11:21:43 +02:00
fe746b2738 Cleanup: Remove unnecessary namespace specification 2022-06-08 11:04:00 +02:00
5b0e9bd975 Cleanup: Use const variables/pointers 2022-06-08 10:48:19 +02:00
6eea5f70e3 Attributes: Use names instead of layers for some functions
This mirrors the C++ attribute API better, separates the implementation
of attributes from CustomData slightly, and makes functions simpler,
clearer, and safer.

Also fix an issue with removing an attribute caused by 97712b018d
meant the first attribute with the given type was removed instead of
the attribute with the given name.
2022-06-08 10:48:19 +02:00
1af652d42e Fix: Improve poll for convert attribute operator
Converting an attribute does not work from edit mode because
there is no attribute API implemented for BMesh, so disable the
operation in that mode and add a poll message.
2022-06-08 10:48:19 +02:00
83fd3767d3 Fix T98618: Drivers don't automatically update when changing active camera
Active camera is a property of Scene, so need to take scene changes into
account for such drivers to work reliably.

The fix covers all the common cases of such configurations, but some of
them might not be yet fully supported. Mainly cases when the target ID
is not covered by the copy-on-write mechanism.

There is a fuller explanation available in the code for the ease of reading
by the future generations.

Differential Revision: https://developer.blender.org/D15146
2022-06-08 09:12:14 +02:00
8d09a12414 Correct missing doxy-sections in 1269bcce81 2022-06-08 16:19:35 +10:00
1269bcce81 Cleanup: use doxy sections for wayland listeners 2022-06-08 16:05:36 +10:00
8edd1d8aa5 CMake: optionally disable OBJ, STL & GPencil SVG support
The following CMake options have been added (enabled by default),
except for the lite build configuration.

- WITH_IO_STL
- WITH_IO_WAVEFRONT_OBJ
- WITH_IO_GPENCIL (for grease pencil SVG importing).
  Note that it was already possible to disable grease pencil export
  by disabling WITH_PUGIXML & WITH_HARU.

This is intended to keep the lite builds fast and small for building,
linking & execution.

Reviewed By: iyadahmed2001, aras_p, antoniov, mont29

Ref D15141
2022-06-08 13:29:32 +10:00
a1d2efd190 GHOST/Wayland: draw a software-cursor when wrapping cursor motion
As Wayland doesn't support moving the cursor, draw a cross-hair cursor
at the location used by Blender.

Without this, the cursor was locked at the location where grab started,
making some actions unusable since the cursor location was invisible.

Resolves T77311.
2022-06-08 13:16:14 +10:00
b3e0101a35 GHOST/Wayland: non-wrapping grab no longer locks the cursor
Grab which didn't wrap would lock the cursor, making actions such
as resizing areas lock the cursor in-place.

Confine the cursor to the window instead.

This behavior was also used for X11 when grabbing the cursor was first
supported but could lock the system if Blender froze while grabbing so
it was disabled [0].

For Wayland this shouldn't be a problem as compositors implement grab
in a way that prevents the client from locking the system.

[0]: 3e3d2b7a4c
2022-06-08 11:45:44 +10:00
173a15bcda BLI: Math: Add description and test to ceil_to_multiple and divide_ceil
I took the decision to assert on unexpected value as the behavior of these
functions are not consistent across the whole integer domain.
2022-06-07 20:08:39 +02:00
a857156578 UI: Curves Sculpt density + smooth brushes
More information in the svn log. But basically the smooth brush
is re-using the previous one we had for hair, and the density is
representing the hair root points that are removed to reach the
desired density.

Those brushes are used by D15134.
2022-06-07 19:08:07 +02:00
3e7d977886 IME Cleanup: Removal of BLT_lang_is_ime_supported
Removal of BLT_lang_is_ime_supported which is always returns true and
is no longer needed.

See D11800 for more details.

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

Reviewed by Campbell Barton
2022-06-07 10:03:26 -07:00
9fda233897 Cleanup: Use const pointers in attribute API 2022-06-07 18:55:56 +02:00
d39e0f9616 Fix: Incorrect logic in attribute search function
If a geometry does not have CustomData for a certain domain,
it may still have CustomData on other domains. In that case
we need to continue to the other domains instead of returning.
This worked for meshes because the domains are all at the
start of the `info` array. It didn't work for curves.
2022-06-07 18:38:39 +02:00
627d42cd56 Merge branch 'blender-v3.2-release'
# Conflicts:
#	source/blender/draw/engines/eevee/shaders/volumetric_vert.glsl
2022-06-07 18:32:34 +02:00
ec493d79fa BLI: Math: Add math::divide_ceil and math::ceil_to_multiple
`math::divide_ceil` is just the vector implementation of `divide_ceil_u`.

`math::ceil_to_multiple` is similar but finaly multiply by the divisor.
It is handy to handle tile buffers resolutions.
2022-06-07 18:31:06 +02:00
b568f445a5 Fix T98647: EEVEE: Camera Data Node's View Vector Broken
Fix regression and remove duplicated computation.
2022-06-07 18:14:16 +02:00
391485f412 Fix EEVEE: Shader error when using volume temperature or color attributes
This bug was unreported. This was triggering a linking error caused by
the vertex shader not having a local version of `attr_load_temperature_post`
and `attr_load_color_post`.
2022-06-07 18:13:09 +02:00
60442b0292 Fix T98091: EEVEE: Volume: Crash caused by non-present grid
This was caused by the `copy_m4_m4` trying to copy the `object_to_texture`
from `drw_grid` which was `nullptr`.

Fixing this also exposed that rendering such volumes (without any valid
grid attributes) is not supported and we should follow what Cycles does.

Differential Revision: https://developer.blender.org/D15147
2022-06-07 18:12:19 +02:00
7974d2bff6 CustomData: Add function to free a named layer
This can be useful to avoid unnecessary boilerplate in various users
of the CustomData API. Split from D14685 and D14769.
2022-06-07 18:00:30 +02:00
9c029a3eb0 Fix T98621: Image does not update when tweaking strip properties
Problem was caused by `startdisp` and `enddisp` still being used after changes
implemented in rB7afcfe111aac.
2022-06-07 17:02:40 +02:00
Monique Dewanchand
e62a33e572 Nodes: Show node description in Node add menu
Though no nodes have descriptions currently, this patch makes it
possible to add descriptions that display in the add menu, for
custom node systems and existing builtin nodes.

Differential Revision: https://developer.blender.org/D14963
2022-06-07 15:40:31 +02:00
ccf0d22e92 Fix T98626: Mesh Deform modifier stops working on a linked collection upon undo.
Regression from rBb66368f3fd9c, we still need to store all data on undo
writes, since overrides are not re-applied after undo/redo.
2022-06-07 15:30:05 +02:00
b69aad60bd Curves: use root/tip radius of the first curve in the viewport
Viewport drawing does not support a per point radius attribute yet.
Instead, it has a fixed set of radius parameters that are used for all
curves in the same object. Now those radii are retrieved from the
radius attribute of the points on the first curve. This allows users
to control the radius of curves to some degree until proper per-point
radius is supported.
2022-06-07 15:03:58 +02:00
Martijn Versteegh
1203bd58be Fix: Make renaming attributes check uniqueness on all domains
This function only checked for uniqueness in the current domain,
while attribute names should be unique among all domains within
a geometry.

Differential Revision: https://developer.blender.org/D15144
2022-06-07 14:52:27 +02:00
503bcaf1a2 Marker drawing: don't restore GPU line width
Adhere to the documented use of `GPU_line_width()` and don't restore the
previously set line width.
2022-06-07 14:36:45 +02:00
f49efed953 Curves: fix transforms in Add brush
Symmetry should be applied in the space of the curves object,
not in the space of the surface object.
2022-06-07 14:21:02 +02:00
3b7e314a28 Cleanup: remove dead code 2022-06-07 14:21:02 +02:00
d422715094 Fix drawing increments after running Spin gizmo
Caused by {ea182deeb9cdd2a9137e98eb0072f57c0fb1e09f}.
2022-06-07 09:12:20 -03:00
1456f30b02 Cleanup: potential dereferencing of a NULL pointer
If `cancel` is `false`, `NULL` `inter` pointer dereferencing could occur.

Currently I haven't found a case where this can happen.

But it's best to avoid.
2022-06-07 09:01:46 -03:00
2918a3a2a3 Cleanup: spelling in comments, minor formatting tweaks 2022-06-07 21:22:55 +10:00
1e0e1ad20f Cleanup: note that checking only the left modifiers isn't a mistake 2022-06-07 21:22:55 +10:00
2935b6a2ac Add Instance Offset operators to Collections property panel
Add three operators to the Collections properties panel:

- `object.instance_offset_to_cursor`, which is already available from
  the Object properties panel. The operator works on the active
  collection, though, so it's weird to not have it in the Collections
  panel.
- `object.instance_offset_from_object` is a new operator, which performs
  the same operation as above, but then based on the active object's
  evaluated world position.
- `object.instance_offset_to_cursor` is also new, and performs the
  opposite of the first operator: it moves the 3D cursor to the
  collection's instance offset.

The first two operators make it easier to set the instance offset. The
last operator makes it possible to actually see the offset in the 3D
viewport; drawing it using some overlay could also work, but that would
be more effort to get right, and then snapping the 3D cursor would still
be useful.

The operators are placed in a popup menu, as to not clutter the
interface too much with various buttons.

Reviewed By: dfelinto, eyecandy

Differential Revision: https://developer.blender.org/D14966
2022-06-07 13:10:13 +02:00
3a8a44b3f9 Keymap: use both left/right modifier keys
Use both left/right modifier keys for:

- Fly Mode.
- Walk Mode.
- Area Split.
- Sculpt Detail Map.
- Sculpt Expand.
- Standard Modal Map

Resolves T98638.
2022-06-07 21:03:08 +10:00
16934c198a LibOverride: Attempt to improve handling of cyclic deps between libraries.
Those cyclic dependencies (lib_A depends on a texture from lib_B, which
links geometry from lib_A) are bad, but previous code did not always
helped much in idendtifying to actuall issue point.

Now, reduce maximum 'recursion' level to 100 (this should already never
be reached in practice), and additionally report warnings when reaching
level 90, so that user gets more context data to identify more easily
the culprit.
2022-06-07 12:53:04 +02:00
Michael Jones
4412e14708 Cycles: Useful Metal backend debug & profiling functionality
This patch adds some useful debugging & profiling env vars to the Metal backend:

- `CYCLES_METAL_PROFILING`: output a per-kernel timing report at the end of the render
- `CYCLES_METAL_DEBUG`: enable per-dispatch tracing (very verbose)
- `CYCLES_DEBUG_METAL_CAPTURE_KERNEL`: enable programatic .gputrace capture for a specified kernel index

Here's an example of the timing report with `CYCLES_METAL_PROFILING` enabled:

```
---------------------------------------------------------------------------------------------------
Kernel name                                 Total threads   Dispatches     Avg. T/D    Time   Time%
---------------------------------------------------------------------------------------------------
integrator_init_from_camera                   657,407,232          161    4,083,274   0.24s   0.51%
integrator_intersect_closest                1,629,288,440          681    2,392,494  15.18s  32.12%
integrator_intersect_shadow                   751,652,291          470    1,599,260   5.80s  12.28%
integrator_shade_background                   304,612,074          263    1,158,220   1.16s   2.45%
integrator_shade_surface                    1,159,764,041          676    1,715,627  20.57s  43.52%
integrator_shade_shadow                       598,885,847          418    1,432,741   1.27s   2.69%
integrator_queued_paths_array               2,969,650,130          805    3,689,006   0.35s   0.74%
integrator_queued_shadow_paths_array          593,936,619          379    1,567,115   0.14s   0.29%
integrator_terminated_paths_array              22,205,417          155      143,260   0.05s   0.10%
integrator_sorted_paths_array               2,517,140,043          676    3,723,579   1.65s   3.50%
integrator_compact_paths_array                648,912,748          155    4,186,533   0.03s   0.07%
integrator_compact_states                      20,872,687          155      134,662   0.14s   0.29%
integrator_terminated_shadow_paths_array      374,100,675          438      854,111   0.16s   0.33%
integrator_compact_shadow_paths_array         503,768,657          438    1,150,156   0.05s   0.10%
integrator_compact_shadow_states               37,664,941          202      186,460   0.23s   0.50%
integrator_reset                               25,165,824            6    4,194,304   0.06s   0.12%
film_convert_combined_half_rgba                 3,110,400            6      518,400   0.00s   0.01%
prefix_sum                                            676          676            1   0.19s   0.40%
---------------------------------------------------------------------------------------------------
                                                                 6,760               47.27s 100.00%
---------------------------------------------------------------------------------------------------
```

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D15044
2022-06-07 11:08:39 +01:00
4fc7e1a880 Cleanup: Correct comments 2022-06-07 11:55:52 +02:00
4637f3e83c Merge branch 'blender-v3.2-release' 2022-06-07 10:52:38 +02:00
58d350b489 GPUMaterial: Make compilation fail when reusing failed GPUPass
This avoid leaving a `GPUMaterial` in a `GPU_MAT_QUEUED` state which would
block rendering.

Fix T98603: Hang when saving project in material preview mode

Maniphest Tasks: T98603

Differential Revision: https://developer.blender.org/D15135
2022-06-07 10:48:13 +02:00
dcbbdc89ea Cleanup: Fix missing-braces warning in draw manager
Good side effect of the change is that it makes it so that the
size of an array is more likely to be calculated at a compile time.

More ideally we'll be using bli::Array instead of the bare array,
but that is outside of the scope of this change.
2022-06-07 10:35:33 +02:00
9ccc21dde3 VSE preview transform autokeying improvements
NOTE: this patch originated in T98015 which was split into multiple
reports. While it could be split into multiple patches these are very
much related so keeping as one for now

This patch fixes the following issues:

[1] autokeying transforms in preview only creates keyframes if there is
an FCurve already
[2] autokeying transforms in preview only creates keyframes for
rotation/scale if rotating/scaling around cursor (should keyframe
position as well)
[3] autokeying transforms in preview does not work during animation
playback

For [1], a param was added to `ED_autokeyframe_property` which can tweak
its default behavior of only creating keyframes on already keyed
properties (which was fine because this is mostly called from buttons
where this behavior is desired). Callers such as gizmos (or the VSE in
our case) can use this additional param so that keyframes are also
created on "not-yet-keyframed" properties.

For [2], the pivot is checked and position properties also keyed if
necessary (which is also consistent with the way objects are keyed in
the 3DView)

For [3], `animrecord_check_state` was changed to be able to work on
scenes as well and the transform system in the VSE preview was made
aware of the screen's `animtimer`.

NOTE: there are still things to be improved for keyframing in the VSE,
the most obvious is probably a `keyframe_insert` operator (with
keyingsets)

Fixes T98429, T98430, T98431

Maniphest Tasks: T98015, T98431, T98430, T98429

Differential Revision: https://developer.blender.org/D15047
2022-06-07 09:53:11 +02:00
4580c18c56 Correct error in 7c4826d971 2022-06-07 17:42:11 +10:00
Joseph Faulkner
b77494ec61 Fix T98527 : corrected label for Korean language in Blender preferences
Patch changes label from '한국 언어' to '한국어'

Reviewed By: persun, PratikPB2123, mont29

Maniphest Tasks: T98527

Differential Revision: https://developer.blender.org/D15120
2022-06-07 09:35:27 +02:00
7c4826d971 Fix T98552: Experimental Tweak Select: Curve handle tweak is difficult
The previous fix [0] only resolved the issue for RMB select,
this works for the tweak tool with LMB select.

[0]: 0f73a27b76
2022-06-07 16:53:54 +10:00
99847cd642 OBJ: Use filename as the default object name
To match the existing Python .obj importer, and to make it easier for
the user to determine which object is which, use the filename for the
default object name instead of "New object".

Differential Revision: https://developer.blender.org/D15133
2022-06-06 22:38:02 -07:00
b4d3ca624e Logging: remove unnecessary newlines 2022-06-07 15:01:03 +10:00
263371dc4e Cleanup: spelling in comments, additional white space 2022-06-07 15:01:03 +10:00
243891104f Cleanup: use doxy sections for mask add operators & functions 2022-06-07 14:40:51 +10:00
af6a68217f Cleanup: format 2022-06-07 14:40:51 +10:00
ea182deeb9 Remove workaround for drawing the rotation gizmo
Since [0], transform gizmos are no longer hidden during transform.

The same can be observed for rotation gizmos.

However, as a workaround for these rotation gizmos, there was already a
drawing utility running.

With the gizmo and the utility this drawing is now being done twice.

So remove the utility/workaround and update the gizmo accordingly.

[0] {648350e456490f8d6258e7de9bf94d3a6a34dbb2}

Differential Revision: https://developer.blender.org/D9542
2022-06-07 00:38:23 -03:00
b3101abcce blend_render_info: Zstd support, skip redundant file reading & cleanup
- Use a context manager to handle file handlers (closing both in the
  case of compressed files).

- Seek past BHead data instead of continually reading
  (checking for 'REND').

- Write errors to the stderr (so callers can differentiate it from the
  stdout).

- Use `surrogateescape` in the unlikely event of encoding errors
  so the result is always a string (possible with files pre 2.4x).

- Remove '.blend' extension check as it excludes `.blend1` files
  (we can assume the caller is passing in blend files).

- Define `__all__` to make it clear only one function is intended
  to be used.
2022-06-07 13:15:56 +10:00
56ede578e7 Cleanup: compiler warnings: unused args, missing include, parenthesis 2022-06-07 11:50:10 +10:00
Iyad Ahmed
7c511f1b47 STL: Add new C++ based STL importer
A new experimentatl STL importer, written in C++. Roughly 7-9x faster than the
Python based one.

Reviewed By: Aras Pranckevicius, Hans Goudey.
Differential Revision: https://developer.blender.org/D14941
2022-06-06 20:57:38 +03:00
14fc89f38f Geometry Nodes: Add Instance Scale Input Node
A field input node for the scale of each top-level instance transform.
The scale can be set with the "Scale Instances" node, but previously
could not be retrieved.

Differential Revision: https://developer.blender.org/D15132
2022-06-06 12:02:59 -05:00
3a57f5a9cf Geometry Nodes: Instance Rotation Node
A field input node for the rotation of each top-level instance transform.
The rotation can be set with the "Rotate Instances" node, but previously
could not be retrieved.

Differential Revision: https://developer.blender.org/D15131
2022-06-06 11:50:13 -05:00
f700aa67ac Geometry Nodes: Fix Assert in Duplicate Elements
The original assert did not take into account the offset size in the loop being -1. The tests were then run in non-debug mode, so while the mesh regressions still passed, the false positive asserts that happened were not caught.

Differential Revision: https://developer.blender.org/D15136
2022-06-06 11:15:24 -05:00
128aa7f3b0 Geometry Nodes: Fix Assert in Duplicate Elements
The original assert did not take into account the offset size in the loop being -1. The tests were then run in non-debug mode, so while the mesh regressions still passed, the false positive asserts that happened were not caught.

Differential Revision: https://developer.blender.org/D15136
2022-06-06 11:10:27 -05:00
3772dda4ab Refactor: Snap-related. Clarified attribute names and refactored #defines into enums
The transformation snapping code contains a bunch of `#define`s, some ambiguously or incorrectly named attributes.  This patch contains refactored code to improve this.  This patch does (should) not change functionality of snapping.

Clarified ambiguously / incorrectly named attributes.

  - "Target" is used to refer to the part of the source that is to be snapped (Active, Median, Center, Closest), but several other areas of Blender use the term "target" to refer to the thing being snapped to and "source" to refer to the thing getting snapped.  Moreover, the implications of the previous terms do not match the descriptions.  For example: `SCE_SNAP_TARGET_CENTER` does not snap the grabbed geometry to the center of the target, but instead "Snap transforamtion center onto target".
  - "Select" refers to the condition for an object to be a possible target for snapping.
  - `SCE_SNAP_MODE_FACE` is renamed to `SCE_SNAP_MODE_FACE_RAYCAST` to better describe its affect and to make way for other face snapping methods (ex: nearest).

Refactored related `#define` into `enum`s.  In particular, constants relating to...

  - `ToolSettings.snap_flag` are now in `enum eSnapFlag`
  - `ToolSettings.snap_mode` are now in `enum eSnapMode`
  - `ToolSettings.snap_source` (was `snap_target`) are now in `enum eSnapSourceSelect`
  - `ToolSettings.snap_flag` (`SCE_SNAP_NO_SELF`) and `TransSnap.target_select` are now in `enum eSnapTargetSelect`

As the terms became more consistent and the constants were packed together into meaningful enumerations, some of the attribute names seemed ambiguous.  For example, it is unclear whether `SnapObjectParams.snap_select` referred to the target or the source.  This patch also adds a small amount of clarity.

This patch also swaps out generic types (ex: `char`, `short`, `ushort`) and unclear hard coded numbers (ex: `0`) used with snap-related enumerations with the actual `enum`s and values.

Note: I did leave myself some comments to follow-up with further refactoring.  Specifically, using "target" and "source" consistently will mean the Python API will need to change (ex: `ToolSettings.snap_target` is not `ToolSettings.snap_source`).  If the API is going to change, it would be good to make sure that the used terms are descriptive enough.  For example, `bpy.ops.transform.translate` uses a `snap` argument to determine if snapping should be enabled while transforming.  Perhaps `use_snap` might be an improvement that's more consistent with other conventions.

This patch is (mostly) a subset of D14591, as suggested by @mano-wii.

Task T69342 proposes to separate the `Absolute Grid Snap` option out from `Increment` snapping method into its own method.  Also, there might be reason to create additional snapping methods or options.  (Indeed, D14591 heads in this direction).  This patch can work along with these suggestions, as this patch is trying to clarify the snapping code and to prompt more work in this area.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D15037
2022-06-06 10:56:22 -04:00
a094cdacf8 BLI: fix memory error when moving VArray_Span
The issue was that the new span still referenced data that was potentially
stored in the old VArray_Span.
2022-06-06 14:01:25 +02:00
7eb2018a0b Fix Windows compiler error
This error was introduced in 176d7bcc2e

Fix provided by @deadpin
2022-06-06 09:42:36 +02:00
bb9647b703 PyDocs: remove sphinx-intl
Cop paste mistake from rB3cd283a424ec92ef85e1856d66f0baa4d2253fc5
2022-06-05 23:13:26 -04:00
3cd283a424 Py Docs: Update Sphinx and dependencies
- Adds python 3.10 support
- Slightly improves performance
2022-06-05 23:05:48 -04:00
011d9cce19 UI: offset scale gizmos instead of scaling their shape
Scaling handles while dragging could be distracting, especially at
extreme values where handles could become large on-screen.

Now all gizmos are shown while scaling.

GIZMO_GT_arrow_3d now now support changing their length while being
dragged as well as negative lengths.
2022-06-06 12:48:49 +10:00
bb34afac56 Cleanup: quiet compiler warning 2022-06-06 12:45:42 +10:00
8589f60546 Curves: Port bounding box node to the new curves type
Avoid the conversion to and from the old type, which could
be a substantial improvement in somce cases.
2022-06-05 21:05:13 +02:00
c7e4c43072 Cleanup: Remove unused BKE_spline.hh includes 2022-06-05 21:00:03 +02:00
93a68f2a90 Curves: Fix overallocation for curve attributes when deleting curves
Curve attributes were allocated to the size of the point domain, which
wouldn't cause bad behavior, just potentially worse performance.
2022-06-05 20:00:06 +02:00
270a24cc64 Fix: incorrect operator warning 2022-06-05 17:51:37 +02:00
545d469879 Cleanup: Move wm_event_system.c to C++
This allows the use of C++ data structures to simplify code and
improve performance.
2022-06-05 16:47:42 +02:00
c4e11122c5 Geometry Nodes: Use fields for delete geometry inversion
The separate geometry and delete geometry nodes often invert the
selection so that deleting elements from a geometry can be implemented
as copying the opposite selection of elements. This should make the two
nodes faster in some cases, since the generic versions of selection
creation functions (i.e. from d3a1e9cbb9) are used instead
of the single threaded code that was used for this node.

The change also makes the deletion/separation code easier to
understand because it doesn't have to pass around the inversion.
2022-06-05 16:46:20 +02:00
72ea37ae5f UI: align gizmo scale handles to both Y and Z axes
This resolves a minor inconsistency displaying the scale gizmo handles
since they're cubes it's noticeable when they're not axes aligned.
2022-06-05 23:43:07 +10:00
648350e456 UI: show gizmo while transforming
When interacting with translate/rotate/scale gizmo, show the gizmo while
it's in use. There are some exceptions to this, as showing all scale
gizmos while scaling causes the gizmos to become large & distracting so
in this case only the gizmo being dragged is shown.

Resolves T63743.
2022-06-05 23:21:50 +10:00
d450a791c3 Cleanup: assign operator type flags in their initialization
Some operators OR'ed the existing flags in a way that made it seem
the value might already have some values set.
Replace this with assignment as no flags are set and the convention
with almost all operators is to write the value directly.
2022-06-05 23:05:38 +10:00
4e3ce04855 Cleanup: Use shorter variable name 2022-06-05 12:37:45 +02:00
e37eebf16f Cleanup: Comments and formatting in mesh extract headers
Also remove accidentally committed WIP commented code.
2022-06-05 12:15:31 +02:00
899ec8b6b8 Curves: use uv coordinates to attach curves to mesh
This implements the new way to attach curves to a mesh surface using
a uv map (based on the recent discussion in T95776).

The curves data block now not only stores a reference to the surface object
but also a name of a uv map on that object. Having a uv map is optional
for most operations, but it will be required later for animation (when the
curves are supposed to be deformed based on deformation of the surface).

The "Empty Hair" operator in the Add menu sets the uv map name automatically
if possible. It's possible to start working without a uv map and to attach the
curves to a uv map later on. It's also possible to reattach the curves to a new
uv map using the "Curves > Snap to Nearest Surface" operator in curves sculpt
mode.

Note, the implementation to do the reverse lookup from uv to a position on the
surface is trivial and inefficient now. A more efficient data structure will be
implemented separately soon.

Differential Revision: https://developer.blender.org/D15125
2022-06-05 12:14:32 +02:00
176d7bcc2e Cleanup: Move remaining mesh draw code to C++
After this commit, all mesh data extraction and drawing code is in C++,
including headers, making it possible to use improved types for future
performance improvements and simplifications.

The only non-trivial changes are in `draw_cache_impl_mesh.cc`,
where use of certain features and macros in C necessitated larger
changes.

Differential Revision: https://developer.blender.org/D15088
2022-06-05 12:04:58 +02:00
31da775ec2 Fix compiling debug build 2022-06-05 12:04:24 +02:00
Pablo Dobarro
e90ba74d3e D15041: Sculpt: Elastic Transform
This implements transform modes for the transform tool and Elastic
Transform. This mode uses the Kelvinlets from elastic deform to apply
the transformation to the mesh, using the cursor radius to control the
elasticity falloff.

{F9269771}

In order for this to work, the transform tool uses incremental mode when
elastic transform is enabled. This allows to integrate the displacement of
the Kelvinet in multiple steps.

Review By: Sergey Sharbin & Daniel Bystedt & Julian Kaspar & Campbell
Barton

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

Ref D15041
2022-06-04 13:50:28 -07:00
e230ccaf8c Fix Wintab button tracking logic.
Shifted flag for buttons changed was incorrectly compared with
unshifted packet flag to determine button press state.

Also fix button tracking storage; button flags are 32 bits whereas the
member variable was 8.

Differential Revision: https://developer.blender.org/D14915
2022-06-04 09:39:32 -07:00
db5ffdd1a4 Cleanup: Use const for retrieved custom data layers 2022-06-04 17:12:17 +02:00
6572ad8620 Cleanup: Use const, make format 2022-06-04 16:51:20 +02:00
a5190dce9d Mesh: Only check dirty normals flag of current domain
The code that checked whether vertex normals needed to be recalculated
was checking the dirty tag for face normals and vertex normals, in an
attempt at increased safety. However, those tags are always set
together anyway. Only checking the vertex dirty tag allows potentially
allocating or updating the normals on the two domains independently,
which could allow further skipping of calculations in some cases.
2022-06-04 16:30:57 +02:00
23f8fc38d9 Cleanup: Remove unnecessary struct keywords 2022-06-04 13:31:30 +02:00
9531eb24b3 Fix T98580: image flip/invert/resize don't work on active UDIM tile 2022-06-03 19:42:22 +02:00
8e02b53ae7 Sculpt: Fix zeroing of last position on stroke start
Fixes bug where clicking in empty space resets
viewport pivot in rotate around active mode
to zero.
2022-06-03 10:41:05 -07:00
2681e480ea Fix T98579: image save operators changing file path to absolute 2022-06-03 19:25:57 +02:00
da45c12bef Merge branch 'blender-v3.2-release' 2022-06-03 19:02:46 +02:00
34f94a02f3 Fix use of OpenGL interop breaking in Hydra viewports that do not support it
Rendering directly to a resource using OpenGL interop and Hgi
doesn't work in Houdini, since it never uses the resulting resource
(it does not call `HdRenderBuffer::GetResource`). But since doing
that simultaneously disables mapping (`HdRenderBuffer::Map` is
not implemented then), nothing was displayed. To fix this, keep
track of whether a Hydra viewport does support displaying a Hgi
resource directly, by checking whether
`HdRenderBuffer::GetResource` is ever called and only enable use
of OpenGL interop if that is the case.

Differential Revision: https://developer.blender.org/D15090
2022-06-03 18:56:30 +02:00
3fe7d049d2 Fix new curve objects showing as UNKNOWN in the outliner
The fix is to unify with the name we had for the old Curves objects.

That means that we will see them bothi (old and new curves) in the outliner
(under two different categories but with different names).

This is considered to be a temporary solution until we remove the old
curve system entirely.
2022-06-03 18:40:14 +02:00
5cc118fc09 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-06-03 17:10:16 +02:00
7f7ed8e098 Fix T98571: corrupted face selection drawing with GPU subdivision
Simple typo in rB55e3930b253e.
2022-06-03 17:09:44 +02:00
6b9a3be03d Cleanup: clang-format 2022-06-03 16:55:21 +02:00
e7156be86e Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-06-03 16:13:51 +02:00
0b38b8dafa Spreadsheet Editor: Support int 8 attribute
This was leading to some crashes and warnings such as:

"Code marked as unreachable has been executed. Please report this as a bug."

Differential Revision: https://developer.blender.org/D15116
2022-06-03 16:13:28 +02:00
e73fd4f0c0 Fix (unreported) important memory leak in Boolean modifier using a Collection operand and Fast mode.
Code handling repetitive boolean operations when using several objects
from a Collection would not handle result mesh properly, re-creating for
each object without properly freeing it.

Further more, existing code was effectively converting the BMesh to mesh
twice, including a modification of the initial (input) mesh, which
modifiers should never do!

Removed the extra useless conversion, which also gives a small
improvement in performances:

With as simple of a scene as four objects (three operands in a
collection, and the modified one) totalling 20k vertices/faces, this
commit:
* Avoids 2MB memory leak per evaluation (!).
* Speeds up boolean evaluation by 5-10%.

Found while investigating some production files of the Project Heist
here at the Blender Studio.
2022-06-03 16:07:05 +02:00
691ab3fc46 Fix (unreported) invalid debug timing code in Boolean modifier code. 2022-06-03 16:07:05 +02:00
1a3ac2f750 Tests: Add basic testing for boolean modifiers.
Test basic Difference operation with both a single Objetc and a
collection of three objects as operands, using BMesh (aka 'FAST') mode.
2022-06-03 16:07:05 +02:00
5d9ebea15d Cleanup: remove unused code 2022-06-03 16:02:04 +02:00
12722bd354 Curves: Add surface UV map name property
In the latest discussions about curves/hair mesh attachement
information (T95776), it was decided to use UV coordinates to
store where on the mesh each root is. For that, we have to specify
which of the UV map attributes to use for UV lookups.

This property isn't used yet, but it will be shortly when refactoring
the attachement information in the add brush and the to particle
system conversion.

Differential Revision: https://developer.blender.org/D15115
2022-06-03 15:54:03 +02:00
2780c7e312 Cleanup: deduplicate resampling curve after moving last point 2022-06-03 15:40:18 +02:00
074010ad6d Fix T98570: Cycles AOVs not working in background shader
Must include the AOV writing feature in background shader evaluation.

Differential Revision: https://developer.blender.org/D15114
2022-06-03 15:34:31 +02:00
9d8fb80f21 Eevee/Workbench: store 8 bit image textures as half float for some color spaces
Same as in Cycles, this is needed for some color space conversions that don't
compress well to byte sRGB, like for example Filmic sRGB.

Ref T68926
2022-06-03 15:25:23 +02:00
4c4056579b Fix typo in colorspace description 2022-06-03 15:25:23 +02:00
d040e1da4f Constraints: introduce wrapper functions to access target lists.
Instead of directly accessing constraint-specific callbacks
in code all over blender, introduce two wrappers to retrieve
and free the target list.

This incidentally revealed a place within the Collada exporter
in BCAnimationSampler.cpp that didn't clean up after retrieving
the targets, resulting in a small memory leak. Fixing this should
be the only functional change in this commit.

This was split off from D9732.

Differential Revision: https://developer.blender.org/D13844
2022-06-03 16:18:26 +03:00
284a3431ae Cycles: Fix rendering of packed UDIM tiles with different sizes
The packed image loader was not aware of the fact that UDIM tiles
can be of a different size.

Exposed Python API required to access this information. It has the
same complexity as the "regular" packed files: in both cases the
ImBuf will be acquired and released to access the information.

While the current workflow of packing UDIMs is not very streamlined,
it is still possible and is something what the studio is using here.

Test file:
{F13130516}

Expected behavior achieved with this patch: a bigger checker board
pattern in viewport render

Actual behavior prior to this patch: either memory corruption, or
wrong/black render result on the plane

Differential Revision: https://developer.blender.org/D15111
2022-06-03 14:23:23 +02:00
fa5cf5360c Merge branch 'blender-v3.2-release' 2022-06-03 14:11:48 +02:00
cf6c8ae01b Fix T98573: Rescaling Image by python wrong
This did not refresh the Image editor, but more importantly this now
appeared cropped (a regression from the partial image updater).

Solved in the RNA function by:
- calling BKE_image_partial_update_mark_full_update
- sending appropriate notifier

Maniphest Tasks: T98573

Differential Revision: https://developer.blender.org/D15110
2022-06-03 14:08:21 +02:00
6b84465352 Cleanup: remove dead code 2022-06-03 13:51:05 +02:00
0a2a8d702a Fix: Curves sculpt mode keymaps missing in preferences
These changes make the curves sculpt mode keymap consistent
with other modes. They now show up in the keymap, for potential
editing of tool shortcuts, etc. I don't fully understand this system,
but at least these changes should make it consistent.

Differential Revision: https://developer.blender.org/D15112
2022-06-03 13:41:16 +02:00
3b51d9065c Cleanup: deduplicate retrieving data from context in curves brushes 2022-06-03 13:39:59 +02:00
5c6053ccb1 Fix misaligned address error when rendering 3D curves in the viewport with Cycles and OptiX 7.4
Acceleration structures in the viewport default to building with the fast
build flag, but the intersection program used for curves was queried with
the fast trace flag. The resulting mismatch caused an exception in the
intersection kernel. Since it's difficult to predict whether dynamic or static
acceleration structures are going to be built at the time of kernel loading,
this fixes the mismatch by always using the fast trace flag for curves.
2022-06-03 12:24:13 +02:00
Angus Stanton
50976657ac Geometry Nodes: Show supported types in geo socket tooltip
Show the supported geometry types returned by geometry
node socket declarations in the socket inspection tooltip.

Differential Revision: https://developer.blender.org/D14802
2022-06-03 10:11:06 +02:00
4eb5163b18 Fix T98459: vertex weight paste/copy inconsistent
In the editmode sidebar, pasting a particular vertex's weight in a
single group was not behaving the same as copying for all groups [in
that the former dis not copy to unassigned vertices whereas the later
did copy to unassigned vertices].

This behaves like this since the introduction in {rB70fd2320c8d2}, but
there does not seem to be a good reason for this?

Now make this consistent and use `BKE_defvert_copy_index` in both cases
(instead of earlying out if unassigned, this will make sure this will
also copy to unassigned).

Maniphest Tasks: T98459

Differential Revision: https://developer.blender.org/D15062
2022-06-03 09:50:45 +02:00
16d329da28 Compositor: add pre/post/cancel handlers and background job info
Main motivation is from T54314 where there was no way to read from a
Viewer image datablock after the compositor has run.
The only solution there was to do a full rerender (which obviously takes
much longer). Adding a handler avoids having to rerender.

This uses new syntax from rBf4456a4d3c97 and also adds "COMPOSITE" as a
job type that can be queried by `bpy.app.is_job_running`.

NOTE: there is another issue when multiple viewers are used and these
get active via RNA (compo execution is not triggered there yet -- unlike
when a viewer is selected in the Editor -- this is an issue of
`ED_node_set_active` vs. only `nodeSetActive`, but this will be tackled
separately)

Maniphest Tasks: T54314

Differential Revision: https://developer.blender.org/D15078
2022-06-03 09:45:08 +02:00
9babe39de9 LineArt: Include minor fixes in branch that's missing in master. 2022-06-03 15:36:27 +08:00
cf5529af12 Cleanup: remove gizmo transform workaround which is no longer needed
Now gizmos forward the original event to transform so assuming an LMB
event is no longer needed.
2022-06-03 15:08:11 +10:00
e87082d8a7 Cleanup: spelling in comments 2022-06-03 15:08:11 +10:00
379672ca0b Cleanup: remove unused, commented MTexFace assignments 2022-06-03 15:08:11 +10:00
9ad19b0453 Merge branch 'blender-v3.2-release' 2022-06-03 13:15:35 +10:00
c4701a027f Fix T98558: island selection in UV editor can crash
Regression in [0]. When zoomed in, we can be within the face of an
island but too far from an edge, in this case
uv_find_nearest_face_multi_ex is used instead of
uv_find_nearest_edge_multi with the consequence that hit.l cannot be
used in uvedit_uv_select_test (it is NULL).

Instead, use uvedit_face_select_test instead in this case.

[0]: d356edf420

Reviewed By: campbellbarton

Ref D15100
2022-06-03 13:14:20 +10:00
1fb36e9a7c Cleanup: DRW: Overlay: Make simple fragment shaders local
This avoids reusing gpu shader files that have different requirements.
2022-06-02 23:50:29 +02:00
4a72b64c7b Cleanup: Split large block of versioning code to separate function
Large blocks of versioning code should be separate to keep
`blo_do_versions_300` more readable.
2022-06-02 22:26:34 +02:00
545b9ddc34 Cleanup: Simplify curves toolbar drawing logic
Use `elif` to clarify that only one case happens.
2022-06-02 22:18:07 +02:00
049e42ef20 Cleanup: DRW: Added basic_ prefix to all *.glsl files in basic/shaders
This is needed to avoid potential naming collision with other engines.
2022-06-02 21:25:38 +02:00
c15e913df8 Cleanup: DRW: Added overlay_ prefix to all *.glsl files in overlay/shaders
This is needed to avoid potential naming collision with other engines
2022-06-02 21:08:05 +02:00
7f47f187c1 EEVEE-Next: Fix compilation of hair domain materials
Also fix formating of `curves_attribute_element_id` which was copy pasted.

# Conflicts:
#	source/blender/draw/engines/eevee_next/shaders/eevee_attributes_lib.glsl
2022-06-02 20:00:05 +02:00
b5fe0f02be Cleanup: DRW: Added overlay_ prefix to all *_info.hh files in overlay 2022-06-02 19:58:10 +02:00
73d8015aa3 Fix T79801: openvdb cache does not support Unicode paths on windows
"Fix" should be taken with a grain of salt, this will fix
the issue on win10 1903 and newer.

OpenVDB uses boosts memory mapped files which call
CreateFileA in the back-end when you feed it a
regular string.

now the encoding for CreateFileA will be whatever the
default is for the system, it internally turns it into
a wide string with said encoding and calls CreateFileW.

This change changes that encoding to UTF-8 for just
blender so we can use utf-8 with any of the narrow
api functions. This is a manifest change and only win10
1903 will look for it, so that sadly limits the fix
to only a subset of users.

While ideally we would have fixed the issue our selves,
some of the calls to openvdb::io::file::open are beyond
our control (ie from inside USD or Mantaflow)

Note: This only changes the behaviour in regard to Win32
API functions, regular CRT functions like fopen or if_stream will
still not accept utf-8 filenames.

Differential Revision: https://developer.blender.org/D14981
Reviewed by: brecht
2022-06-02 11:18:43 -06:00
2b80bfe9d0 Color Management: add Filmic sRGB as an image colorspace
A typical use case is when you want to render with the Filmic view transform, but
composite an existing image in the background that should not be affected by the
view transform.

With this colorspace it's possible to do an inverse Filmic transform, render
everything in scene linear space, and then apply the Filmic transform again.

This is pretty basic in that this is not going to take into account the full view
transform including looks, curves and exposure. But it can be helpful anyway.

Ref T68926
2022-06-02 18:49:04 +02:00
33f5e8f239 Cycles: load 8 bit image textures as half float for some color spaces
For non-raw, non-sRGB color spaces, always use half float even if that uses
more memory. Otherwise the precision loss from conversion to scene linear or
sRGB (as natively understood by the texture sampling) can be too much.

This also required a change to do alpha association ourselves instead of OIIO,
because in OIIO alpha multiplication happens before conversion to half float
and that gives too much precision loss.

Ref T68926
2022-06-02 18:04:38 +02:00
10488d54d9 Cleanup: Use const pointers 2022-06-02 18:02:48 +02:00
91c44920dd Fix: Build error after merge from release branch 2022-06-02 18:02:32 +02:00
3cd6ccd968 Merge branch 'blender-v3.2-release' 2022-06-02 17:54:17 +02:00
2d9c5f3dcf Fix T98556: Crash with extrude node in edit mode
The original index layer was not initialized properly.
Supporting original indices properly for this node is
doable, but for now it is better to simply initialize them
to the "none" value to fix the crash.

Differential Revision: https://developer.blender.org/D15105
2022-06-02 17:53:35 +02:00
96a47af413 Fix T98546: Crash with multires bake and zero levels
The problem was that copying a `CDDerivedMesh` (`CDDM_copy`) doesn't
copy the `vert_normals` reference that it takes from a mesh. Since this
entire area is almost completely broken anyway (mainly in terms of
ownership handling), for now we can just avoid copying the `DerivedMesh`
in the zero levels case.

Longer term, this area should be refactored to remove `DerivedMesh`
and use the newer subdivision evaluation system.

Differential Revision: https://developer.blender.org/D15099
2022-06-02 17:46:38 +02:00
9e43a57d22 Cycles: fix missing attribute update
Differential Revision: https://developer.blender.org/D15102
2022-06-02 16:42:53 +02:00
9580f23596 install_deps: Add support for oneAPI Level Zero library. 2022-06-02 15:53:50 +02:00
1174cdc914 install_deps: raise default ffmpeg version to 5.0, minimum 4.0.
Ref. T98555.
2022-06-02 15:53:50 +02:00
9bb7de274d USD: Enable operator presets when exporting
This patch enables operator presets for USD exports.
The export menu has many options, so enabling the feature
will help users manage their export settings in the same
way they can with other filetypes.

Same as {rB1d668b635632}

Differential Revision: https://developer.blender.org/D14896
2022-06-02 15:07:54 +02:00
432c4c74eb LineArt: Speedup construction of quad trees.
Using multithread for `add_triangles` to speed up quad tree building.
Each thread would lock its respective tile to work on triangle insertion,
intersection calculation, tile splitting and triangle array extension.

Reviewed By: Sebastian Parborg (zeddb), Sergey Sharybin (sergey)

Ref D14953
2022-06-02 20:46:08 +08:00
Bastien Montagne
901791944d Anim: Refactor 'F-curve from rna path' code.
Move into its own new function the the low-level logic to search for a
given RNA path in Action F-curves, then driver F-curves of a given AnimData.

This deduplicates code from `BKE_fcurve_find_by_rna_context_ui` and
`id_data_find_fcurve`, and will allow for future more usages of this
functionality.

Differential Revision: https://developer.blender.org/D15068
2022-06-02 12:28:50 +02:00
3ca76ae0e8 Cleanup: remove "<pep8 compliant>" from headers
It can be assumed that all scripts comply with basic pep8 formatting
regarding white-space, indentation etc.

Also remove note in best practices page & update `tests/python/pep8.py`.

If we want to exclude some scripts from make format,
this can be done by adding them to `ignore_files` in:
source/tools/utils_maintenance/autopep8_format_paths.py

Or using `# nopep8` for to ignore for individual lines.

Ref T98554
2022-06-02 20:16:20 +10:00
48bb144fea PyDoc: reference enum instead of inlining 2022-06-02 20:16:20 +10:00
f4456a4d3c Expose background job info to Python
Add `bpy.app.is_job_running(job_type)` as high-level indicator. Job
types currently exposed are `WM_JOB_TYPE_RENDER`,
`WM_JOB_TYPE_RENDER_PREVIEW`, and `WM_JOB_TYPE_OBJECT_BAKE`, as strings
with the `WM_JOB_TYPE_` prefix removed. The functions can be polled by
Python code to determine whether such background work is still ongoing
or not.

Furthermore, new app handles are added for
`object_bake_{pre,complete,canceled}`, which are called respectively
before an object baking job starts, completes sucessfully, and stops due
to a cancellation.

Motivation: There are various cases where Python can trigger the
execution of a background job, without getting notification that that
background job is done. As a result, it's hard to do things like
cleanups, or auto-quitting Blender after the work is done.

The approach in this commit can easily be extended with other job types,
when the need arises. The rendering of asset previews is one that's
likely to be added sooner than later, as there have already been
requests about this.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D14587
2022-06-02 11:20:17 +02:00
40ecf9d606 Merge branch 'blender-v3.2-release' 2022-06-02 10:05:56 +02:00
33eeed5b3c Fix T98538 EEVEE: Geometry input node breaks with Displacement Texture
This was due to older drivers not honoring varying attributes shadowing by
local variables. Renaming the input argument fixes the issue.
2022-06-02 10:05:14 +02:00
d73adfdc86 PyDoc: changes to the generated conf.py file
- Set the highlight language to python3 (excludes python2 syntax).
- Set the encoding for code highlighting to utf-8 (no need to detect).
- Update deprecated variable name.
- Remove redundant unicode prefixed string.
2022-06-02 15:02:25 +10:00
0f73a27b76 Fix T98552: Experimental Tweak Select: Curve handle tweak is difficult
When this preference is enabled, use selection behavior matching the
graph editor. We may want to make this default (see T98552).
2022-06-02 13:55:06 +10:00
ef3f33dfd3 Cleanup: quiet warnings, remove unused arguments 2022-06-02 13:47:54 +10:00
7afcfe111a VSE: Make time operations self-contained
This patch makes it possible to manipulate strips without need to use
update functions to recalculate effect and meta strips.

Prior to this change function `SEQ_time_update_sequence` had to be used
to update mainly effects and meta strips. This was implemented in a way
that relied on sorted list of strips, which can't always be done and in
rare cases this approach failed.

In case of meta strips, `seqbase` had to be passed and compared with
"active" one to determine whether meta strip should be updated or not.
This is especially weak system that is prone to bugs when functions are
used by python API functions.

Finally, other strip types had startdisp` and `enddisp` fields updated
by this function and a lot of code relied on these fields even if strip
start, length and offsets are available. This is completely
unnecessary.

Implemented changes:
All effects and meta strips are updated when strip handles are moved or
strip is translated, without need to call any update function.

Function `SEQ_time_update_sequence` has been split to
`SEQ_time_update_meta_strip_range` and
`seq_time_update_effects_strip_range`. These functions should be only
used within sequencer module code. Meta update is used for versioning,
which is only reason for it not being declared internally.

Sequence fields `startdisp` and `enddisp` are now only used for
effects to store strip start and end points. These fields should be
used only internally within sequencer module code.
Use function `SEQ_time_*_handle_frame_get` to get strip start and end
points.

To update effects and meta strips with reasonable performance, cache
for "parent" meta strip and attached effects is added to
`SequenceLookup` cache, so it shares invalidation mechanisms.
All caches are populated during single iteration.

There should be no functional changes.

Differential Revision: https://developer.blender.org/D14990
2022-06-02 03:16:20 +02:00
604409b8c7 Cleanup: undeclared warning 2022-06-02 10:07:07 +10:00
f60ac5068a PyDoc: remove CSS override for scrolling long enum lists
Adding a scroll-bar to in-line lists has the down-side that it cuts
of text including warnings or notes that can be included, see: T87008.

Now enums are referenced [0] this is no longer needed, reverting [1].

[0]: 1c6b66c9cf
[1]: 1e8f266591
2022-06-02 10:03:00 +10:00
fb08353f38 Cleanup: replace ParamBool and PBool with bool for GEO_uv API
Also improve const correctness and type correctness.

Reviewed By: brecht

Ref D15075
2022-06-02 09:52:51 +10:00
b450a8c851 Cleanup: remove unused area smoothing logic for UV unwrap
This used to run when holding Shift while unwrapping until 2006 when it
was removed [0].

[0]: e66b5e5cd5

Reviewed By: brecht

Ref D15075
2022-06-02 09:47:01 +10:00
68150b666c Fix T92952: Knife inconsistent angle printout
Knife could display incorrect snapping angle printout in
header/footer because it was not always updated after angle snapping
calculations.
2022-06-01 21:20:53 +01:00
129ea355c8 GPencil: Add support to name new layer when moving to layer
To make it consistent with collections, now it's possible to name the new layer created using the `Move to Layer` option.

Differential Revision: https://developer.blender.org/D15092
2022-06-01 18:25:12 +02:00
bff9841465 Merge branch 'blender-v3.2-release' 2022-06-01 15:44:19 +02:00
a493956eaa Release schedule: Entering Bcon4 for Blender 3.2 (RC) 2022-06-01 15:39:52 +02:00
a1e6245650 Merge branch 'blender-v3.2-release' 2022-06-01 15:04:54 +02:00
e72b86d3cb Fix T98469: Crash trying to add an object to a linked collection that is linked to multiple scenes.
Crash happened because code could not find a valid base in current scene
after adding the object, added some checks for that.

Root of the issue was wrong assumptions in `BKE_object_add` logic, which
would pick the first valid ancestor collection in case initially
selected collection was not editable. In some case, this could pick a
collection not instanced in the current scene's view layer, leading to
not getting a valid base for the newly added object.

Addressed this by adding a new variant of `BKE_collection_object_add`,
`BKE_collection_viewlayer_object_add`, which ensures final collection is
in given viewlayer.
2022-06-01 15:04:34 +02:00
c667069a12 Merge branch 'blender-v3.2-release' 2022-06-01 14:55:26 +02:00
7dd0258d4a Fix T98536: geometry nodes wrong selection on duplicate edges
Code was using the loop [which is looping over the selection] index as
an index for the lookup into the edges directly, but needs to be a
lookupinto the IndexMask.

Also renamed the variable (as used elsewhere) to make this more clear.

If accepted, would be nice to still get this into 3.2.

Maniphest Tasks: T98536

Differential Revision: https://developer.blender.org/D15089
2022-06-01 14:53:35 +02:00
ae0b68e129 Merge branch 'blender-v3.2-release' 2022-06-01 22:46:17 +10:00
e0f3c23ac0 Fix T98370: Shift+RMB Select nodes doesn't work with the tweak tool
The tweak tool was toggling node selection twice, as the selection
key-map is already accounted for in the node key-map there is no need
to duplicate the actions in the tweak tool.
2022-06-01 22:45:45 +10:00
e9eae1b857 Curves: Avoid optimization to avoid storing selection for now
This optimization should be restored when there is proper vizualization
for the selection attributes.
2022-06-01 11:57:38 +02:00
110c90b3cf LineArt: Adding a intersection timer.
This is for conveinence of perfomance comparison.
2022-06-01 16:59:46 +08:00
d3b3d72303 Fix T98520: Sculpt operators can unintentionally clear multires mask
Typo in {rBcf69652618fe}.

Maniphest Tasks: T98520

Differential Revision: https://developer.blender.org/D15087
2022-06-01 10:48:56 +02:00
e5ab1495e5 Merge branch 'blender-v3.2-release' 2022-06-01 10:30:30 +02:00
da7bc51210 Fix failing Cycles Metal MNEE test on buildbot, by disabling it
It appears that Metal and MNEE are still not working.
2022-06-01 10:28:09 +02:00
38acd14fb7 Tweak Object duplicate_move macro tooltips.
Since we have two macros, we can at least have proper different tooltips
for each.
2022-06-01 09:29:42 +02:00
71ce47a71d LineArt: Temporary fix for object loading iterator.
Use `DEG_OBJECT_ITER_BEGIN`for loading objects, this iterator is
technially unsafe to use *during* depsgraph evaluation,
see https://developer.blender.org/D14997 for detailed explainations.
2022-06-01 14:35:33 +08:00
1bf35f1b19 Cleanup: minor changes to sphinx_doc_gen
- Remove unused pymethod2sphinx.
- Correct exception string formatting.
- Define encoding for file reading with execfile(..).
2022-06-01 15:48:20 +10:00
61a7e5be18 Cleanup: '*' prefix C-comment blocks 2022-06-01 15:38:48 +10:00
4cab98f8be Cleanup: spelling in comments, use doxy sections 2022-06-01 15:38:48 +10:00
0f29f2c3e6 Cleanup: remove redundant const qualifiers for scalar & enum types 2022-06-01 15:38:48 +10:00
44bac4c8cc Cleanup: use 'e' prefix for enum types
- CustomDataType -> eCustomDataType
- CustomDataMask -> eCustomDataMask
- AttributeDomain -> eAttrDomain
- NamedAttributeUsage -> eNamedAttrUsage
2022-06-01 15:38:48 +10:00
ca346d2176 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-06-01 07:02:32 +02:00
54d076b20d Fix T98526: broken corner attributes with GPU subdivision
Although reusing the same patch coordinate for all corner pointing the
same vertex works for interpolation vertices, it does work for
interpolation face varying attributes. So we need to keep the original
patch coordinates around for face varying interpolation. This was caused
by the previous fix (a5dcae0c64).
2022-06-01 07:02:05 +02:00
46cb24e7c2 Merge branch 'blender-v3.2-release' 2022-06-01 14:31:55 +10:00
0e8d6c2828 Cleanup: conversion from enum/int warning 2022-06-01 14:30:57 +10:00
65e7d49939 Fix T89726: Fix hitbox of axis gizmo in UV Editor
Use the scale from the wmGizmo.matrix_final as a reference for the
arrow head-size.

Reviewed By: campbellbarton

Ref D15056
2022-06-01 14:23:37 +10:00
ee57afe7e1 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-31 21:09:35 -07:00
12642bdeab Fix T96984: Create new image.browse operator for uiTemplateImage layouts
The existing BUTTONS_OT_file_browse operator that's used for
uiTemplateImage layouts fails to work correctly with UDIM textures.

This is mainly due to it not realizing that it must tokenize the
filepath before signaling that an update has been made. It also doesn't
work correctly when executing its SHIFT-click behavior to open the image
in an external application. Lastly, it doesn't set the filters to Images
and Movies which is suboptimal for the user.

The new operator takes the unique features of BUTTONS_OT_file_browse
and creates a customized variant better suited for images.

Differential Revision: https://developer.blender.org/D14824
2022-05-31 20:57:33 -07:00
b38a59881b Merge branch 'blender-v3.2-release' 2022-05-31 16:35:22 -07:00
6cee404914 GPU subdiv: Fix edit mode vertex color not being uploaded properly
Also cleaned up the code a tad bit.  Note that I
found two more bugs:

* GPU subdivision attribute interpolation
  is producing visual artifacts.
* "Show on cage" mode for subdivision surface
  just shows black colors.
2022-05-31 16:32:42 -07:00
75162ab8c2 Fix T97408: Temporary fix for attribute convert undo
Sculpt undo now detects if an attribute layer has
changed type/domain and unconverts it back.  This
is a temporary workaround to a more fundamental
bug in the undo system.

Memfile undo assumes it can always rebuild the
application state from the prior undo step,
which isn't true with incremental undo systems.

The correct fix is to push an extra undo step prior
to running an operator if an incremental undo system
is active and the operator is using memfile undo.
2022-05-31 15:46:09 -07:00
79cee340a8 Merge branch 'blender-v3.2-release' 2022-05-31 12:45:24 -07:00
511a08585d Fix T98364: Remove improper OPTYPE_UNDO flags
Removed OPTYPE_UNDO flags from the swap brush colors and
sample color operators.  These types of operators are
not supposed to be undoable in the first place.  Also
memfile undo is too buggy for it.
2022-05-31 12:43:07 -07:00
b9f29a0f64 Merge branch 'blender-v3.2-release' 2022-05-31 20:44:56 +02:00
0f47506cde Fix T98501: setting node socket default value is very slow
The issue was that the extend socket (the last empty socket in
Input/Output nodes) was repeatedly removed and added again,
which caused more updates than necessary. Now, the extend
socket is kept if it existed already.

Differential Revision: https://developer.blender.org/D15084
2022-05-31 20:43:53 +02:00
5c80bcf8c2 Functions: speedup preparing multi-function parameters
My benchmark which spend most time preparing function parameters
takes `250 ms` now, from `510 ms` before. This is mainly achieved by
doing less unnecessary work and by giving the compiler more inlined
code to optimize.

* Reserve correct vector sizes and use unchecked `append` function.
* Construct `GVArray` parameters directly in the vector, instead of
  moving/copying them in the vector afterwards.
* Inline some constructors, because that allows the compiler understand
  what is happening, resulting in less code.

This probably has negilible impact on the user experience currently,
because there are other bottlenecks.

Differential Revision: https://developer.blender.org/D15009
2022-05-31 20:41:01 +02:00
484ea573af Merge branch 'blender-v3.2-release' 2022-05-31 19:24:56 +02:00
dc389a6152 Fix T98454: subdivision doesn't propagate int attributes
Differential Revision: https://developer.blender.org/D15083
2022-05-31 19:23:52 +02:00
a1830859fa Curves: Add soft selection in sculpt mode
This commit adds a float selection to curve control points or curves,
a sculpt tool to paint the selection, and uses the selection influence
in the existing sculpt brushes.

The selection is the inverse of the "mask" from mesh sculpt mode
currently. That change is described in more detail here: T97903

Since some sculpt tools are really "per curve" tools, they use the
average point selection of all of their points. The delete brush
considers a curve selected if any of its points have a non-zero
selection.

There is a new option to choose the selection domain, which affects how
painting the selection works. You can also turn the selection off by
clicking on the active domain.

Sculpt brushes can be faster when the selection is small, because
finding selected curves or points is generally faster than the
existing brush intersection and distance checks.

The main limitation currently is that we can't see the selection in the
viewport by default. For now, to see the selection one has to add a
simple material to the curves object as shown in the differential
revision. And one has to switch to Material Preview in the 3d view.

Differential Revision: https://developer.blender.org/D14934
2022-05-31 19:00:24 +02:00
96f20ddc1e Geometry Nodes: Don't allow UI attributes as modifier field inputs
This is an extension of 4669178fc3, applying the same changes to
attributes chosen in the field inputs of the geometry nodes modifier.
If a UI/internal attribute is used, the attribute name button will
have a red alert. Adding a disabled hint is currently a bit more complex.

Also hide UI attributes in attribute search for the named attribute node.

Part of D14934
2022-05-31 18:58:54 +02:00
610619c203 Merge branch 'blender-v3.2-release' 2022-05-31 17:35:16 +02:00
a40b611128 Cleanup: Improve const correctness of ID functions
These functions don't change their inputs, so they can be const,
which is a bit more intuitive and clean to use for callers.

Differential Revision: https://developer.blender.org/D14943
2022-05-31 17:31:32 +02:00
f2cd7e08fe Fix Cycles MNEE not working for Metal
Move MNEE to own kernel, separate from shader ray-tracing. This does introduce
the limitation that a shader can't use both MNEE and AO/bevel, but that seems
like the better trade-off for now.

We can experiment with bigger kernel organization changes later.

Differential Revision: https://developer.blender.org/D15070
2022-05-31 17:24:43 +02:00
908dfd5e0d Merge branch 'blender-v3.2-release' 2022-05-31 10:15:40 -05:00
52cb24a779 Fix T98500: Wrong Selection in Duplicate Points
Differential Revision: https://developer.blender.org/D15071
2022-05-31 10:07:56 -05:00
3060b98842 Cleanup: Simplify dependencies for GMP math header
Previously, the base math headers included GMP headers in all cases.
This was problematic because we don't want all modules that use the
math headers to depend on GMP, and the unnecessary includes could
theoretically have detrimental effects to compile times.

Now `BLI_math_mpq.hh` depends on `BLI_math_base.hh`, so if a file
needs to use exact arithmatic, it can just include the former.

Differential Revision: https://developer.blender.org/D15079
2022-05-31 16:55:14 +02:00
a746cef825 Cleanup: Move lib_override.c to C++
This will allow easier const correctness and use of
nicer data structures like `Vector` and `Map`.
2022-05-31 16:19:50 +02:00
d356a4f280 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-31 16:18:42 +02:00
a5dcae0c64 Fix T97877: broken shadows with GPU subdivision
Issues stems from the mesh not being watertight. This was caused by
floating point precision issues when evaluating patch coordinates at
patch boundaries (loops/corners in different patches pointing to the same
vertex). To fix this we ensure that all loops pointing to the same vertex
share the same patch coordinate. This keeps code simple, and does not
require to track precision issues in floating point math all over the
place.
2022-05-31 16:18:08 +02:00
3d66ee8c97 Intern/atomic: Fix const qualifier for atomic_load_ptr. 2022-05-31 21:05:15 +08:00
e37027634b Intern/atomic: Adding atomic_load/store_ptr support.
We need to provide _ptr ones with _z ones on the API level.

Reviewed By: Sergey Sharybin (sergey)

Ref D15076
2022-05-31 20:09:39 +08:00
4669178fc3 Attributes: Hide internal UI attributes and disallow procedural access
This commit hides "UI attributes" described in T97452 from the UI lists
in mesh, curve, and point cloud properties, and disallow accessing them
in geometry nodes.

Internal UI attributes like selection and hiding values should use the
attribute system for simplicity and performance, but we don't want to
expose those attributes in the attribute panel, which is meant for
regular user interaction. Procedural access may be misleading or cause
problems, as described in the design task above.

These attributes are added by two upcoming patches: D14934, D14685

Differential Revision: https://developer.blender.org/D15069
2022-05-31 13:20:16 +02:00
39c14f4e84 Merge branch 'blender-v3.2-release' 2022-05-31 12:29:41 +02:00
765c16bbd0 Fix wrong asset dropped when dragging from loc. of just cleared asset
See previous commit for an explanation of what went wrong. Similar to
the fix there, we also have to update the dragged data (e.g. the
data-block) referenced by the button.

Committing separately since this could cause further issues.
2022-05-31 12:28:58 +02:00
75ef51cc80 Fix T95394: Crash when dragging from location of just cleared asset
In Blender buttons are recreated over redraws, except of the active
button which is kept alive, and replaces the new version of itself in
the new redraw. In order to do that, the button needs to be recognized.
This process of recognizing and matching buttons from different redraws
isn't always bullet-proof. That's okay-ish, but we have to make sure
that the relevant data of the old active button is updated with the
newest data.

Here the matching would go wrong, and the new active button was
recognized as the old active button, which was in fact removed when the
asset was cleared. This patch makes sure the image buffer attached to
the buttons is updated when buttons were recognized as matching.

Note that the dragging will still use the wrong data-block, this will be
fixed in the following commit.
2022-05-31 12:27:52 +02:00
9301cc74ee Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-31 12:15:37 +02:00
344a8fb3d4 Fix T97086: corrupted UVs with GPU subdivision
When multiple objects are in edit mode, UVs for the objects, except for
the first one (in rendering order) appear corrupted. The corruption is
because the UVs are not evaluated as the compute shader is not bound,
thus we read unitialized memory.

We keep track of the currently bound shader in the GPU context in order
to avoid unnecessary shader switches in case the same shader is used in
consecutive calls. However, the shader used by the OpenSubdiv evaluator
is not part of Blender and therefore not tracked via the GPU context.

When extracting UVs for multiple objects, we only ever run a single
shader (FVar evaluation). However, between the compute calls, we also
call the OpenSubdiv stencil evaluation shader, which uses `glUseProgram`
modifying the current program, outside of our control, which then also
unbinds the Blender compute shader making the compute dispatch fail ("No
active compute shader").

The fact that extracting the UVs for the first rendered object works is
because another (Blender) shader was bound in the GPU context prior to
our binding of our evaluation shader.

To fix this, we remember, in the OpenSubdiv evaluator, the current
program so that it can be reset after the stencil program is done.

Differential Revision: https://developer.blender.org/D15064
2022-05-31 12:15:02 +02:00
0d7e0ffdb5 Cleanup: tabs to spaces for CMake files & sort file-lists 2022-05-31 18:18:24 +10:00
e82141b6b4 Do not provide python libraries for linking if building python module
When building blender as a python module, such as for inclusion in a
wheel, it is not permitted to link against python libraries.
This diff does so by simply unsetting the library when building blender
as a python module, instead of the more heavyweight solution of
switching to the cmake FindPython module.

Reviewed By: LazyDodo, campbellbarton

Ref D15012
2022-05-31 18:18:24 +10:00
247ceca629 Merge branch 'blender-v3.2-release' 2022-05-31 10:06:22 +02:00
18a17d4291 Fix T98403: Crash applying modifiers on non-mesh objects
The operator assumed it was called on a mesh object, which has
mostly been the case because of lack of support for other object
types, but the new curves object is supported, which is the situation
in the report.

Differential Revision: https://developer.blender.org/D15063
2022-05-31 10:05:48 +02:00
Iyad Ahmed
a30e67813d OBJ: Enable undo for experimental OBJ importer
The new OBJ importer operator didn't register an undo event.
This commit enables the register and undo flags for the operator.

Reviewed By: Bastien Montagne, Aras Pranckevicius, Serhiy Striletksy
Differential Revision: https://developer.blender.org/D15051
2022-05-31 11:00:14 +03:00
a3a138b41b Merge branch 'blender-v3.2-release' 2022-05-31 09:52:32 +02:00
5fdd367786 Merge branch 'blender-v3.2-release' 2022-05-31 09:52:03 +02:00
Julien Kaspar
1ebc0ebdc0 UI: Correct sculpt tooltips
Some of the tools in sculpt mode were still referring to the previously  experimental sculpt vertex colors.
They should instead refer to color attributes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D15073
2022-05-31 09:51:26 +02:00
993fd985f0 Cleanup: remove UV handling from OBJECT_OT_modifier_convert
It doesn't make sense to merge UV's when applying a particle-system.
2022-05-31 17:42:44 +10:00
c338388354 Cleanup: rename ED_object_modifier_convert to make it's use clearer
This function is specific to particle-systems which wasn't obvious,
leading to an error in [0] which added UV handling which doesn't make
sense.
2022-05-31 17:40:02 +10:00
c8058e51ee RNA: add macros for EnumPropertyItem layout elements
Add the following macros for enums as support for these features wasn't
all that obvious and there were some inconsistencies in their use.

- RNA_ENUM_ITEM_HEADING(name, description)
- RNA_ENUM_ITEM_SEPR
- RNA_ENUM_ITEM_SEPR_COLUMN
2022-05-31 14:19:06 +10:00
1c6b66c9cf PyDoc: replace in-lined enum references with links where possible
Avoid in-lining large enums such as icons and event types, linking
to them instead.

This mitigates T76453, where long enums took a lot of space in the docs,
this was a problem with `UILayout` where each icon argument would list
all icons. [0] worked around the issue using CSS to scroll the list.
However this has the draw-back where some items are clipped in a way
that's not obvious, see: T87008.

The reason this isn't a complete solution is that Python defined enums
aren't written into their own pages which can be linked to, although
currently there are no large Python enums included in the API docs.
All in-lined enums are now under 20 items.

[0]: 1e8f266591
2022-05-31 14:19:06 +10:00
94444aaadf PyDoc: de-duplicate enums for rna_rna.c & bpy_props.c
Lists of items for bpy.props were duplicated 3 times, now all enums are
defined once in rna_rna.c and referenced from bpy.props doc-strings.
2022-05-31 14:19:06 +10:00
fb86f3ee18 PyDoc: document static enums from RNA_enum_items.h
Create a page for every enum in RNA_enum_items.h, which includes
the enum values and the doc-string for each item.

Each page creates a references which the API reference can be linked to
via the same name as the enum, so :ref:`rna_enum_icon_items` links
to the list of icons for e.g.

This has two main advantages:

- No need to manually duplicate enum values in the doc-strings of
  functions defined in Python's C/API (not RNA defined functions),
  `bpy.props` for example.

- The generated Python API docs can reference these instead of including
  the enums in-line - resulting in unreasonably long lists in the case
  if icons and event types (for example).

These changes will be made separately.
2022-05-31 14:18:32 +10:00
ed2a345402 PyAPI: add _bpy.rna_enum_items_static() for accessing internal enum data
This is method is intended for internal use
(introspection for generating API docs).
2022-05-31 14:07:08 +10:00
7056c7520a RNA: avoid non-standard enum item (enum section using single space)
Also removes stray semicolon in RNA_enum_items.h
2022-05-31 14:07:06 +10:00
ca59391704 Cleanup: Remove outdated comment 2022-05-30 19:30:52 +02:00
Dominik Fill
f523fb1dc9 Fix T96157: Make size of Frame Node label independent from Line Width
This commits corrects the calculation of the Frame Node label size,
making it independent of the 'Line Width' user preference.

Since `U.dpi` is actually DPI divided by `U.pixelsize` and `U.pixelsize`
is calculated from line-width multiplying by `U.pixelsize` undoes
the connection between line-width and label size.
It now stays the same, regardless of the line-width setting.

Reviewed By: Julian Eisel, Harley Acheson

Differential Revision: https://developer.blender.org/D14338
2022-05-30 19:26:03 +02:00
Dominik Fill
c8cef83fae Fix T96157: Make size of Frame Node label independent from Line Width
This commits corrects the calculation of the Frame Node label size,
making it independent of the 'Line Width' user preference.

Since `U.dpi` is actually DPI divided by `U.pixelsize` and `U.pixelsize`
is calculated from line-width multiplying by `U.pixelsize` undoes
the connection between line-width and label size.
It now stays the same, regardless of the line-width setting.

Reviewed By: Julian Eisel, Harley Acheson

Differential Revision: https://developer.blender.org/D14338
2022-05-30 19:19:07 +02:00
b24e091c5a Cleanup: Move attribute.c to C++ 2022-05-30 18:06:39 +02:00
3f9376851b Cleanup: Clang tidy
Mostly duplicate includes, also use nullptr, and using default
member initializers.
2022-05-30 17:46:44 +02:00
3437cf155e LibOverride: Add full support for camera's background images.
Add support for adding (inserting) new background images into an
override of a linked Camera ID.

Request from the Blender studio.

This ended up being more involved than expected as it uncovered some
latent issues with existing background images code. Noticiably, a new
`BKE_camera_background_image_copy` had to be added to handle copying
of background images in a proper, generic ID-management way.
2022-05-30 17:43:22 +02:00
a5d9b3442d Cleanup: Move attribute domain count out of enum
The number of attribute domains is not an attribute domain.
This way it doesn't have to be handled in switch statements.

Differential Revision: https://developer.blender.org/D15065
2022-05-30 17:30:37 +02:00
4267c6280a Fix (unreported) missing rna_path function for BackgroundImage struct. 2022-05-30 17:16:13 +02:00
dd2ed1c55c Cleanup: report errors instead of asserting in case of missing local data on file read.
While this should never happen, this is not a critical failure
preventing Blender to work.
2022-05-30 16:58:27 +02:00
fb62fcf071 Fix polling function for background image removal not checking linked ID.
Linked ID is (almost) never editable... Also rename that function to add
the `_poll` suffix.
2022-05-30 16:58:27 +02:00
e7544e3ce4 Fix (unreported) wrong ID usercount handling in background images removal.
Assuming that an ID pointer is NULL because another 'source type'
property has some specific value is utterly wrong and a gateway to
usercounting bugs.
2022-05-30 16:58:27 +02:00
c1277c5d25 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-30 16:44:22 +02:00
6856290514 Fix T98253: Gpencil Lineart crashes when undoing creation of linked copy
These lines were not used now because the handling of copy data has changed.

Assigning the `eval` data can produce unexpected result, especially since everywhere ID_RECALC_TRANSFORM is used, we also do a copy on write. That should take care of `ob->data` for the eval object.
2022-05-30 16:39:27 +02:00
cd6551d4eb Cleanup: use class instead of struct 2022-05-30 16:28:13 +02:00
fc1ae52994 Fix T98444: Image.save_render not using scene output file type
Also simplify logic because (source == IMA_SRC_VIEWER) and
ELEM(type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) are the same
thing.
2022-05-30 16:24:12 +02:00
de610d06a6 Cleanup: make format 2022-05-30 16:17:25 +02:00
65bd9974d1 Cleanup: make format 2022-05-30 16:16:25 +02:00
afd81e26af Fix T98446: Spreadsheets filter not working on Name column 2022-05-30 16:11:52 +02:00
a9a4bcc3d1 Fix building: stub for OpenSubdiv
Building problem introduced on 24e74f8bef. It affects `make lite`
and other builds that skip OpenSubdiv.
2022-05-30 16:10:22 +02:00
a775389823 Merge branch 'blender-v3.2-release' 2022-05-30 15:42:38 +02:00
70171cdfdf Fix T98488: GPencil weightpaint not visible if first point is no weight
The problem was because the check was done with the total weights of the first element of the array and if this was null or 0, the weights were not duplicated.

As this bug was introduced fixing T97150 due a problem in the weight data, now instead to duplicate all stroke data to create the perimeter for the PDF/SVG, only the points are duplicated because the weights are not needed. This fix the original bug and also reduce the memory used by the export process.
2022-05-30 15:42:08 +02:00
6a59cf0530 Nodes: add separately allocated runtime data for nodes and sockets
This is a follow up to rBbb0fc675822f313c5546a2498a162472c2571ecb.
Now the same kind of run-time data is added to nodes and sockets.

Differential Revision: https://developer.blender.org/D15060
2022-05-30 15:32:16 +02:00
1f85877263 Fix T98461: Crash running screenshot from the command-line
When launching Blender with a script creating a screenshot, the Outliner
tree wasn't initialized and built properly. That is because at this
stage, all visible regions were only tagged for a non-rebuild redraw,
not a full redraw. So ensure all regions are tagged for a full redraw
immediately after file reading. Usually the full redraw would be caused
by a file-read notifier, but the Python expression/script is executed
before notifiers are handled.

Note that even before this was crashing, the Outliner would be empty in
the created screenshot.

Additionally adds an assert to the Outliner to note assumptions
explicitly, rather than crashing later.
2022-05-30 15:17:50 +02:00
Pratik Borhade
a8471459fd Fix T98445: Knife Tool always cuts through
Minor error in if condition used for early return.

Ref D15050
2022-05-30 22:29:16 +10:00
ec8365b9ed Fix building without opensubdiv 2022-05-30 22:29:16 +10:00
7f877ee042 Merge branch 'blender-v3.2-release' 2022-05-30 14:09:13 +02:00
fbeec91abf Cleanup: fix various typos
Contributed by luzpaz

Differential Revision: https://developer.blender.org/D15057
2022-05-30 14:09:07 +02:00
24e74f8bef Fix T98449: Cycles crash changing frame after recent changes
Subdivision did not properly update when evaluating first without and then with
orco coordinates. Now update the subdivision evaluator settings every time, and
reallocate the vertex data buffer when needed.

there is an additional issue in this file where orco coordinates are not
available immediately on the first frame when they should be, and only appear
on the second frame. However that is an old limitation related to the depsgraph
not getting re-evaluated on viewport display mode changes, here we just fix the
crash.
2022-05-30 14:06:03 +02:00
ddebb0f783 Cleanup: Fix typo
Contributed by @luzpaz

Differential Revision: https://developer.blender.org/D15058
2022-05-30 14:05:15 +02:00
bb0fc67582 Nodes: add separately allocated run-time data for bNodeTree
`bNodeTree` has a lot of run-time embedded in it currently. Having a separately
allocated run-time struct has some benefits:
* Run-time data is not stored in files.
* Makes it easy to use c++ types as run-time data.
* More clear distinction between what data only exists at run-time and which doesn't.

This commit doesn't move all run-time data to the new struct yet, only the data where
I know for sure how it is used. The remaining data can be moved separately.

Differential Revision: https://developer.blender.org/D15033
2022-05-30 12:54:07 +02:00
2f77b2daac Nodes: call init function for new node trees in ntreeAddTree
Issue found in D15033, for some more info see comments there.
2022-05-30 12:44:42 +02:00
ce1dd44c68 Merge branch 'blender-v3.2-release' 2022-05-30 03:22:31 -07:00
Bastien Montagne
878a805ae8 Cleanup/simplify BKE_fcurve_find_by_rna_context_ui code.
From reading the code it looks like at some point the code was expecting
the `tptr` PointerRNA to change during the loop? But currently it did
not make any sense to have this complex looping and multi-checking of
RNA path and animdata, since the RNA pointer (and therefore its
`owner_id`) is never modified...

NOTE: there could be much more cleanup done in that area, goal of this
commit is mainly to simplify the logic by removing all the (seamingly)
dead code.

Differential Revision: https://developer.blender.org/D15026
2022-05-30 12:02:10 +02:00
f1c29b9bd3 Fix T98368: Shading artifacts on paint/mask anchored sculpt brushes
I'm not sure what is causing this.  Vertex normals get corrupted
for paint and mask sculpt brushes but not the normal geometric
ones.  Since we don't actually need to recalculate normals
here to begin with I've just disabled it.  The code now
calls the appropriate node mark update function based on
the sculpt tool.
2022-05-30 02:48:04 -07:00
fc3c589b18 Merge branch 'blender-v3.2-release' 2022-05-30 10:14:00 +02:00
a7bda30ca8 Curves: make tangent computation more robust
Previously, when there were multiple curve points at the same or
almost the same position, the computed tangent was unpredictable.

Now, the handling of this case is more explicit, making it more
predictable. In general, when there are duplicate points, it will just use
tangents from neighboring points now.

Also fixes T98209.

Differential Revision: https://developer.blender.org/D15016
2022-05-30 10:12:06 +02:00
16746e8ec2 Cleanup: Tweak geometry component comments 2022-05-30 08:59:58 +02:00
3c0d7152c8 Merge branch 'blender-v3.2-release' 2022-05-29 14:25:53 -05:00
cc4b6c6476 Fix T98400: Duplicate node crash 2022-05-29 14:25:17 -05:00
32bf6455a0 Fix T98400: Duplicate node crash 2022-05-29 14:19:05 -05:00
218f23935c Fix: Failed assert for evaluated lengths of single point curves
Since 2d80f814cc, curves always have evaluated points,
but single point curves do no have any evaluated segments, and the
leading zero length isn't stored in the curves length cache.
2022-05-29 13:43:25 +02:00
86cfc30aac Cleanup: Fix warning from typo in include directive 2022-05-29 11:02:30 +02:00
3152d68b70 Cleanup: Simplify custom data file writing process
Previously the function had a fair amount of ugly boilerplate to avoid
allocating the temporary layers array, and then free it if necessary.
`blender::Vector` solves that problem more elegantly. Passing a span,
using references in a few cases, and using a switch statement also make
the functions simpler.

This refactoring is in preparation for D14583 and D14685.

Differential Revision: https://developer.blender.org/D15011
2022-05-29 11:02:10 +02:00
93e4b15767 Cleanup: clang-tidy for GHOST X11/SDL/Wayland/NULL backends
Also early exit in some functions.
2022-05-29 13:25:58 +10:00
13373a6ccd Merge branch 'blender-v3.2-release' 2022-05-28 22:25:08 -03:00
49368c734b Fix (unreported): cyclic snap of curve handles
The logic of skipping selected handles was inverted
and confusing.
2022-05-28 22:24:43 -03:00
812a9728f8 Select Similar: hide 'compare' from UI when not used
When the 'compare' is not used for the resulting selection, just hide
it. This is the case for 'Vertex Groups' atm (where only membership is
taken into account).

Similar to rB9dc9692b0979.

Differential Revision: https://developer.blender.org/D14979
2022-05-28 12:32:25 +02:00
314e5cb889 XR: Fix controller flicker when switching action sets
This could happen when switching between custom action sets that both
had controller pose actions. Problem was that controller data is
cleared when changing action sets, and this clearing was done when
handling WM events, which always occurs after XR controller data is
updated from GHOST.

Now, instead of activating the action set immediately, delay activation
until just before the next XR actions sync.
2022-05-28 17:23:27 +09:00
16166f69be Fix pasting text from Blender in GHOST/Wayland
The nil terminator character shouldn't be included, causing an extra
character to be added in some cases.
2022-05-28 16:06:54 +10:00
5dfff02437 Fix switching between different grab types with GHOST/Wayland
Since [0], using the view navigation gizmo crashed with Wayland.
This only worked previously because GHOST_kGrabWrap was ignored.

Now the previous grab state is disabled before switching to a new
grab state.

[0]: da9e14b0b9
2022-05-28 15:56:09 +10:00
138a4846e2 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-27 22:16:14 -07:00
86baf6e3ed Re-fix T97366: Support single-file UDIMs
The original fix for T97366 was too restrictive and breaks real-world
cases of single-file UDIM textures. See D13297 for an example.

This patch effectively reverts the original fix and instead fixes the
downstream code to accept single-file ranges as necessary.

Note: This means it is very important for users to make use of the
"UDIM detection" option during `image.open` or drag n' drop scenarios in
order to declare their intent when loading their files.

Differential Revision: https://developer.blender.org/D14853
2022-05-27 22:11:52 -07:00
3f1f4df3fd Fix unreported misuse of Win32 clipboard API
An ASAN build highlighted a longstanding bug during ctrl+c operations
inside various text widgets. The existing code had mismatched memory
lock/unlock calls and was using the wrong allocator.

Fix the code surrounding `SetClipboardData` to be correct per MSDN:
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setclipboarddata

Differential Revision: https://developer.blender.org/D15039
2022-05-27 20:52:52 -07:00
712b0496c1 Merge branch 'blender-v3.2-release' 2022-05-27 20:22:12 +02:00
967f96ee2e Fix T98270: Cycles shows black with color values > 65K in GPU render
After recent changes to Nishita sky to clamp negative colors, the pixels ended
up a bit brighter which lead to them exceeding the half float max value. The
CUDA float to half function seems to need clamping.
2022-05-27 20:14:15 +02:00
7b65086fdf Cleanup: Use new macro for deprecated ID types
Uses the macro introduced in b45f410b31 where it makes sense.
2022-05-27 19:15:58 +02:00
da1dd98101 Merge branch 'blender-v3.2-release' 2022-05-27 19:13:59 +02:00
bd2f9a16fb Merge branch 'blender-v3.2-release' 2022-05-27 17:06:58 +02:00
Arye Ramaty
52c1f983cb UI: add missing tooltips for the shader node options
Differential Revision: https://developer.blender.org/D14878
2022-05-27 17:05:48 +02:00
b45f410b31 Fix T97790: Crash in Outliner "Blender File" mode with old files
IPO data-block types are deprecated since 2.5. Don't show them in the
Outliner at all.

Differential Revision: https://developer.blender.org/D15049
2022-05-27 17:03:25 +02:00
Jagannadhan Ravi
74cf22c42c Fix T96397: Cycles missing HIP support for gfx1035 devices
Such as AMD Radeon RX 6700S.

Differential Revision: https://developer.blender.org/D13495
2022-05-27 16:59:40 +02:00
3a4f2131c2 Fix Cycles not rendering byte precision vertex domain colors
Code was not yet updated to use generic attributes for vertex colors. This also
makes generic attributes work for adaptive subdivision.
2022-05-27 16:55:49 +02:00
9fef80c663 Merge branch 'blender-v3.2-release' 2022-05-27 14:23:00 +02:00
bf6aa5d63d GPencil: Fix unreported Bake animation error
This bug was introduced in commit https://developer.blender.org/rB5188c14718c56e4d088d3c5bb3ce3ed9ed8b7bdc because the object transform was not applied when baking the object.

Thanks to @frogstomp for the head up.
2022-05-27 14:22:09 +02:00
abf8750dbc Cleanup: Cycles, fix "parameter unused" warning
Fix "parameter unused" warning that shows up when building without NanoVDB.

No functional changes.
2022-05-27 13:01:01 +02:00
5b40c48f85 Merge branch 'blender-v3.2-release' 2022-05-27 12:58:07 +02:00
5417b8434a Fix T97918: Crash when changing "Frame All" shortcut from context menu
After removing the default 'Home' shortcut for "Frame All", a NDOF (3D
Mouse) default shortcut was still available for the operator. The event
filtering introduced in 4357fb63db was missing the NDOF filtering
logic. So while the context menu correctly found the NDOF keymap item,
its actual shortcut change/removal code incorrectly filtered out the
NDOF keymap items and thus failed to find the item.
2022-05-27 12:55:24 +02:00
802f107e38 Merge branch 'blender-v3.2-release' 2022-05-27 12:16:31 +02:00
e5c65709a2 Fix T98379: Wrong evaluation when deactivating/activating collections
This is a regression caused by a230445cae.

The internal cause of the issue was that the synchronization component
was no longer tagged as visible (and hence not evaluated) as it not
connected to any directly visible IDs.

Changed the logic in a way that if any component of an ID is evaluated
the synchronization component will be evaluated as well.

The naming of the flag in the component node is a bit confusing, but
for the simplicity of the change for the upcoming release left it
unchanged.
2022-05-27 12:09:14 +02:00
Colin Basnett
8d53ead69b Fix T97500: NLA strip names drawn outside strip
Fix T97500 by removing the logic that for some unknown reason draws the
entire string if the min/max were swapped.

This function is only called in two places, once here in the NLA, and
the VSE. The bug only materializes in the NLA though.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14742
2022-05-27 11:26:52 +02:00
Colin Basnett
f45a735aad Fix T97974: Marker line affected by NLA strip mute
Fix T97974 by having the marker rendering code explicitly set the
required line width.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14890
2022-05-27 11:13:06 +02:00
84189a6340 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-27 11:03:56 +02:00
f41c7723c9 GPU: Remove cached full/scaled image texture.
full scaled image isn't used anymore. It was added to use a different scale when
displaying an image in the image editor. This was replaced by the image engine
redesign.

This change will reduce complexity of {T98375}.
2022-05-27 10:52:49 +02:00
5625a21fc7 Fix fuzzy ID deletion user count check.
`BKE_id_delete` should only check for consistency of user count with
regards to the tags and flags of the ID, not 'protect' nor even warn in
case a 'fake user' ID is deleted (such higher-level checks are to be
handled by higher-level code).

Also replace the assert + debug print by a CLOG error, this avoids
'assert crash' while still failing tests, and always producing a useful
message.

Fixes T98374 and T98260.
2022-05-27 10:49:53 +02:00
da9e14b0b9 Fix GHOST_kGrabHide in Wayland
Dragging number buttons wasn't grabbing the cursor and would stop
when the pointer reached the screen edge & wasn't setting the cursor
visible on completion.
2022-05-27 16:48:20 +10:00
46456a59c4 GHOST/Wayland: support mouse buttons 4-7 2022-05-27 15:55:56 +10:00
7aad4d459e Cleanup: unused argument warnings 2022-05-27 14:51:48 +10:00
6d4f16a776 Fix non-square cursor creation in GHOST/SDL
Currently all cursors are square, so this didn't show up as a bug.
2022-05-27 14:39:21 +10:00
49032a8ca5 Fix error checking the search callback
Error in [0] caused the `set` callback be checked as the search callback.

[0]: 3f3d82cfe9
2022-05-27 14:28:13 +10:00
ae39abe7f3 Fix "day" unit length
The day is currently specified as 90000 seconds which is 25 hours.
Obviously this is wrong, and this commit changes it to 86400s/24 hours.

Differential Revision: https://developer.blender.org/D15034
2022-05-26 18:10:16 +02:00
fdc2b7bfa4 Intern: Adding atomic_load/store support for different types.
Mostly using built-in `__atomic` functions, with a special code path
using `MemoryBarrier()`on windows.

Authored By: Sergey Sharybin (sergey)

Reviewed By: Sergey Sharybin (sergey), Ray molenkamp (LazyDodo)

Ref D15020
2022-05-26 23:06:36 +08:00
bf53956914 Fix T98385: Color attributes not working with GPU subdivision
Contrary to coarse extraction, GPU extraction uses the same buffer for
the coarse data, only the final GPU buffer needs to be offset.
2022-05-26 15:12:30 +02:00
55e3930b25 Fix T98392: GPU subdivision crash with knife tools
The face dots normals may not be always requested, thus leading to a
crash by null pointer dereference.
2022-05-26 14:52:45 +02:00
d6badf6fde Merge branch 'blender-v3.2-release' 2022-05-26 21:25:59 +10:00
2a367689d4 Merge branch 'blender-v3.2-release' 2022-05-26 21:25:54 +10:00
38a2576ace Fix display error after sorting mesh elements
Sorting faces caused the tessellation data to be outdated,
making faces show the wrong materials.

Re-calculate tessellation when re-ordering faces.
2022-05-26 21:23:19 +10:00
790fe55c52 Fix Blender 2.7x keymap faulure to select & drag multiple nodes
A follow up on the fix for T98145 for the 2.7x keymap.
2022-05-26 21:06:44 +10:00
fdb1a7b5e1 Cleanup: struct PHandle merged with alias typedef void ParamHandle
Reviewed By: brecht

Ref D15021
2022-05-26 20:04:54 +10:00
374ce5dcb4 Merge branch 'blender-v3.2-release' 2022-05-26 16:00:15 +10:00
3131107ba3 Fix T94857: 'Gizmo Operator' from python templates spins when dragged
Callbacks used in the gizmo operator template don't support updating
while being dragged, set the EXCLUDE_MODAL flag so the offsets
aren't accumulated. Also fix the offset being applied twice to the
move gizmo.
2022-05-26 15:53:17 +10:00
ae5d3fa2d0 UI: use visible regions when showing candidates for operators data-path
When expanding the data path for the context, use Context.temp_override
to extract context members. Without this, only context-members available
in the preferences were used which misses members which are likely to
be useful.

Iterate over all windows, areas and regions showing unique member as
candidates. The search is limited to WINDOW/PREVIEW region types, the
preferences space type is also excluded. See the doc-string for
rna_path_prop_search_for_context for additional notes on this.
2022-05-26 14:15:59 +10:00
3f3d82cfe9 UI support for showing candidates for string properties
Currently strings are used for cases where a list of identifiers would
be useful to show.

Add support for string properties to reference a callback to populate
candidates to show when editing a string. The user isn't prevented from
typing in text not found in this list, it's just useful as a reference.

Support for expanding the following strings has been added:

- Operator, menu & panel identifiers in the keymap editor.
- WM operators that reference data-paths expand using the
  Python-consoles auto-complete functionality.
- Names of keying sets for insert/delete keyframe operators.

Details:

- `bpy.props.StringProperty` takes an option `search` callback.

- A new string callback has been added, set via
  `RNA_def_property_string_search_func` or
  `RNA_def_property_string_search_func_runtime`.

- Addresses usability issue highlighted by T89560,
  where setting keying set identifiers as strings isn't practical.

- Showing additional right-aligned text in the search results is
  supported but disabled by default as the text is too cramped in most
  string search popups where the feature would make sense. It could be
  enabled as part of other layout tweaks.

Reviewed By: brecht

Ref D14986
2022-05-26 12:16:35 +10:00
11480763b6 Cleanup: format 2022-05-26 12:13:45 +10:00
dc6fe73e70 Outliner: Make use of new C++ based functional iterators
(Not meant to cause user visible changes.)

Makes use of the new iterators introduced in the previous commit. Some
benefits:
- Shorter, simpler, easier to read & understand
- Deduplicates logic
- Centralizes iteration logic, making it easier to replace tree storage
  (as planned), see previous commit.
- Avoids having to pass (sub-)tree to iterate around (often redundant
  since it's just `SpaceOutliner.tree`, even though `SpaceOutliner` is
  already passed).
- Function arguments that are only passed to the recursive call are
  recognized as unused (found and removed a few).

Also does some general cleanups while refactoring the code for the
iterators. Use `const`, use references (signals null is not expected),
early-exit (see 16fd5fa656), remove redundant arguments, etc.
2022-05-25 23:21:15 +02:00
a4a7af4732 Outliner: New C++ based functional tree iterators
(Not meant to cause user visible changes.)

Adds some first new iterators to traverse over tree elements with a
functional syntax. Functional because it meant to be used with C++
lambdas.
For example, this common pattern:
```lang=cpp
void some_recursive_function(SpaceOutliner *space_outliner, ListBase *tree, ...)
{
  LISTBASE_FOREACH (TreeElement *, te, tree) {
    /* ... do something with the element ... */

    /* Recurse into open children. */
    if (TSELEM_OPEN(TREESTORE(te), space_outliner) {
      some_recursive_function(&te->subtree, ...);
    }
  }
}
```
Gets simplified to this:
```lang=cpp
void some_function(SpaceOutliner &space_outliner, ...)
{
  tree_iterator::all_open(space_outliner, [&](TreeElement *te) {
    /* ... do something with the element ... */
  });
}
```

We can add more iterators, e.g. some that support early exiting or
skipping children, returning a custom type, only act on selected
elements, etc.

The following commit will convert a bunch of code to use these. Some
further benefits will become visible there. Not all cases are straight
forward to convert, but hopefully more and more code can be refactored
to work with this. This deduplicates and centralizes the iteration
logic, which will later make it much easier to refactor how the tree
storage is done (e.g. move it to `SpaceOutliner_Runtime` and use a
better container than `ListBase`).
2022-05-25 23:20:05 +02:00
f3c03982e5 Outliner: Fix warning icon not bubbling up correctly to collapsed parent
Design is to have warnings in the sub-tree of a collapsed element show
up next to the collapsed element. But if inside the collapsed element,
there was a uncollapsed one containing yet another element with a
warning, that warning wouldn't "bubble up" to the collapsed parent.

Issue was that the warning lookup would only recurse into collapsed
elements, rather than all elements inside of a collapsed element.

While the actual fix for this could've been simpler, I decided to rework
this code entirely. Recursively querying the warning message is now done
separately from drawing the message once found, which makes the code
easier to follow and implements the single responsibility principle
better.
2022-05-25 20:16:17 +02:00
6feca52349 Outliner: Use general warning mechanics for library overrides
Library overrides were basically using their own system to display
warnings for tree elements, even though for other display elements we
have a more general solution. With the previous commit this has been
generalized further and made trivial to extend.
2022-05-25 20:16:17 +02:00
f1df685f57 Outliner: Refactor element warning and mode column querying
Uses a inheritance based approach for querying warning of tree elements
and the mode column support of display modes.

For the warnings, tree elements can override the
`AbstractTreeElement::getWarning()` method and return a warning string.
The UI will draw the warning column with warning icons. This makes the
warning column more generalized and easier to extend to more use-cases.
E.g. library override elements will use this after a followup commit.

To support mode toggles a display mode can now just return true in the
`AbstractTreeDisplay::supportsModeColumn()` method. This makes it
trivial to add mode columns to other display modes, and less error prone
because there's no need to hunt down a bunch of display mode checks in
different places.
2022-05-25 20:16:17 +02:00
Pablo Dobarro
1a516bb714 Fix T83519: Line Gesture flip state not updating without a mouse move event
The wm_gesture_tag_redraw function was only called on mouse move, so the
flip state preview was not updating just by pressing the F key.

Reviewed By: Severin

Maniphest Tasks: T83519

Differential Revision: https://developer.blender.org/D9779
2022-05-25 18:36:19 +02:00
496394daad UI: Curves Sculpt pinch icon 2022-05-25 17:33:29 +02:00
a337e7738f BLI: use no_unique_address attribute
Even though the `no_unique_address` attribute has only been standardized
in C++20, compilers seem to support it with C++17 already. This attribute
allows reducing the memory footprint of structs which have empty types as
data members (usually that is an allocator or inline buffer in Blender).
Previously, one had to use the empty base optimization to achieve the same
effect, which requires a lot of boilerplate code.

The types that benefit from this the most are `Vector` and `Array`, which
usually become 8 bytes smaller. All types which use these core data structures
get smaller as well of course.

Differential Revision: https://developer.blender.org/D14993
2022-05-25 16:28:07 +02:00
f381c31ac6 UI: Update icons after the latest changes in the generator script
There should be no visible change. The difference is mostly on how we
changed the rounding to handle the conversion from color space to the
new linear space of the attribute colors.

To convert the materials in icon_geom.blend I used:

```
import bpy
from mathutils import Color

def convert_material(material):
  if not material.use_nodes:
    return

  if not material.node_tree:
    return

  node_tree = material.node_tree
  for node in node_tree.nodes:
    if node.type != 'RGB':
      continue

      color_original = node.outputs[0].default_value
      color_new = Color(color_original[:3]).from_srgb_to_scene_linear()
      color = (*color_new, color_original[3])
      node.outputs[0].default_value = color

def main():
  for material in bpy.data.materials:
    convert_material(material)

main()
```
2022-05-25 15:56:48 +02:00
288e7d0af0 Tool Icons: Support curve and objects with modifiers + color space fix
This allows for the new tool icons to use geometry nodes.

In order to do this I also had to use the new API for accessing the
attributes (instead of vertex colors). Which in turn requires a few
changes to use linear color space.

I went ahead and updated the entire code to use the linear space
everywhere. I will update the icon files manually to make sure the final
result is similar to what we have now.

Note: We now use round instead of int. That plus the changes regarding the
color space will lead to some icons to change slightly (no perceived
visual change).

Differential Revision: https://developer.blender.org/D14988
2022-05-25 15:56:48 +02:00
e8eb67bb04 Merge branch 'blender-v3.2-release' 2022-05-25 15:11:06 +02:00
841a354412 Cleanup: Link/append: Remove useless proxy handling code.
This was not effectively doing anything anymore, time to remove it.
2022-05-25 15:09:52 +02:00
b0d2a435a1 Cleanup: Further tweaks to RNA path API const'ness of PointerRNA parameter.
`RNA_path_struct_property_py` cannot get const `ptr` parameter for now
(usage of `RNA_struct_find_property`).

Also make `RNA_path_resolve_` functions take a const PointerRNA
parameter.
2022-05-25 15:09:07 +02:00
a072a264b6 Fix vertex format for mesh attributes with GPU subdivision
A global variable was mistakenly used here which would accumulate the
vertex attributes (leading to an assertion failure after a while), use
the wrong number of components depending on the attribute data type,
among other issues.
2022-05-25 14:51:29 +02:00
ef59c8295f Fix T98355: Line art crash when switch to mesh edit mode.
This fix will ensure not to load any meshes that's being edited, thus
avoiding crashes.

Ref D15022
2022-05-25 20:43:58 +08:00
c27be07d89 Fix T98365: Overlay: Blender 3.2.0 Beta crashes on startup
This was caused by a wrong mass rename on a piece of code used only on
older hardware.
2022-05-25 14:39:58 +02:00
98b66dc040 Fix T96080: hiding elements does not work with GPU subdiv
Faces, edges, and vertices are still shown when GPU subdivision is
actived. This is because the related edit mode flags were ignored by the
subdivision code.

The flags are now passed to the various compute shaders mostly as part of
the extra coarse data, also used for e.g. selection. For loose edges, a
temporary buffer is created when extracting them. Loose vertices are
already taken into account as it reuses the routines for coarse mesh
extraction, although `MeshRenderData.use_hide` was not initialized,
which is fixed now.
2022-05-25 14:31:06 +02:00
MOD
c980ed27f0 Geometry Nodes: skip Capture Attribute node if output is not needed
This results in a speedup if the capture attribute is only needed
under specific circumstances (e.g. when a switch further down the
line is true). Previously, the input field was always evaluated.

Differential Revision: https://developer.blender.org/D15018
2022-05-25 13:58:02 +02:00
53f7c22022 Fix T98359: Handle object that has no feature lines.
In case of line art "occlusion only" or contour not enabled, it's possible for an object
to not produce any feature lines.

This patch checks that to prevent freeing a NULL pointer.
2022-05-25 19:23:23 +08:00
332d87375d UI: Fix ops.sculpt.cloth_filter icon
This icon was using a material with a slightly different shade of
purple. I removed all the duplicated materials in icons_geom.blend
and this was the only "functional" change (though it is not noticeable).
2022-05-25 12:56:51 +02:00
c64e9c6ae2 Cleanup: Add more const'ness to RNA API.
This commit makes PointerRNA passed to RNA path API const.
Main change was in the `path` callback for RNA structs, and indirectly
the `getlength` callback of properties.
2022-05-25 12:23:11 +02:00
4949dd54eb Merge branch 'blender-v3.2-release' 2022-05-25 11:23:53 +02:00
cb3b9358bf Fix T98344: Crash opening file with proxy.
Weird file where the proxy object has a `proxy_group` pointer, which
does not instantiate any collection...
2022-05-25 11:22:17 +02:00
6ec0f62e3f Merge branch 'blender-v3.2-release' 2022-05-25 10:37:14 +02:00
a4e7a5aa4f Fix link/append code not properly setting correct ID in context items.
When appending an already linked data, `BKE_blendfile_append` would not
properly substitute the `item->new_id` pointer of link/append context
items with the local duplicate of the linked ID.

This would cause drag'n'drop of assets to work incorrectly in some
cases. Fixes part of T95706 and T97320.
2022-05-25 10:32:34 +02:00
adaf92b4ab Cleanup: knife tool
- Use early return and continue to reduce right-shift.
- Rename `lv` to `tri_cos` for storing triangle coordinates.
- Reduce variable scope.
2022-05-25 17:49:12 +10:00
80e007fe8c Merge branch 'blender-v3.2-release' 2022-05-25 17:20:10 +10:00
c9a9763e36 Merge branch 'blender-v3.2-release' 2022-05-25 17:20:08 +10:00
aab947eb46 Fix T98349: Knife project resulting selection is wrong
Regression in [0] which removed the call to BVH-tree recalculation
before calculating the selection.

Instead of recalculating the BVH-tree, postpone recalculating mesh data
until after the selection has been calculated.

[0]: 6e77afe6ec
2022-05-25 17:16:25 +10:00
26c6ec5594 Cleanup: remove context argument from EDBM_mesh_knife
Added in [0] but isn't needed as all needed variables are in the
ViewContext. Avoid passing in the context is it makes debugging
issues with MESH_OT_knife_project more difficult to investigate since
it's possible values written to the ViewContext are ignored.

[0]: 6e77afe6ec
2022-05-25 17:16:23 +10:00
8f0612b781 Merge branch 'blender-v3.2-release' 2022-05-25 08:50:15 +02:00
08324ba2c1 Fix T98350: Crash when using clone tool + sequence.
When no image user is known the last used frame of the image is used to
read a frame. When partial updating an image there is always an image user
that would use a zerod out image user, meaning the frame number is set to 0
when using the clone tool.

This fix syncs the frame with the last used frame of the image to ensure
that the buffer exists. There is a bailout in the overlay_edit_uv.c.
2022-05-25 08:46:18 +02:00
e69f3d7db1 GPU: Updated comment about HQ normals workaround. 2022-05-25 08:03:52 +02:00
1ec01b2142 Merge branch 'blender-v3.2-release' 2022-05-25 08:01:58 +02:00
603d3c90a5 GPU: Fix issue that negated HQ normals workaround.
Thanks Germano for pointing it out.
2022-05-25 08:00:53 +02:00
57b87feda1 PyDoc: suppress duplicate object description warning
RenderEngine.render is both a method and an attribute,
while this should be avoided it's not causing a problem in practice
so quiet the warning when generating docs.

Sphinx now builds docs without any warnings.
2022-05-25 13:43:01 +10:00
d46647040d PyDoc: fix generated output for gpu.shader
Inclining built-in shader descriptions used the wrong indentation level.

Link to the built-in shaders instead which avoids the indentation error
and de-duplicates the list which is already shown on the page.
2022-05-25 13:35:39 +10:00
ceff1c2f65 Cleanup: spelling, unbalanced doxy sections 2022-05-25 12:46:55 +10:00
ae73bd3d9e Cleanup: use doxy sections for mathutils types
Also minor improvements & corrections to comments.
2022-05-25 12:37:27 +10:00
b0da080c2c Drag & drop: Use session UUID of IDs instead of name for dropping
Dropping would pass the name of the ID to drop to the properties of the
drop operator. This would then lookup the ID by name. With linking
and/or library overrides, multiple IDs of the same name and type may
exist, which is why the session UUID should be used instead. All
operators used for dropping support this now and the drop code passes
the session UUID instead of the name.

Also see 917c096be6 and 8f79fa9c67.

Some drop operators were already using the session UUIDs. This converts
the remaining ones. The "name" property is kept working as before, since
some scripts use this.

Side-effect: The "Name" property won't show up in the Adjust Last
Operation anymore, which was the case for some of these operators, and
its value won't be remembered over multiple executions of the operator.
Both were not at all useful from what I can tell, and I doubt this was
done intentionally.
2022-05-24 17:08:02 +02:00
7b778166db Cleanup: Use new helpers for passing IDs from drag & drop to operators
There are now some generalized helpers for passing IDs from drag & drop
to operators via operator properties, mostly introduced in 917c096be6
and 8f79fa9c67. These can be used in a bunch of places to reduce
duplicated code and explicitly share a common solution.

Side-effect: The "Name" property won't show up in the Adjust Last
Operation anymore, and its value won't be remembered over multiple
executions of the operator. Both were not at all useful from what I can
tell, and I doubt this was done intentionally.
2022-05-24 17:08:02 +02:00
25d216724b Cleanup: make format 2022-05-24 15:53:16 +02:00
cd412b4454 Drag & drop: Invert priority of name and session UUID in ID lookups
Continuation of 8f79fa9c67 and 917c096be6. The ID's session UUID is
now always priotitized over its name to lookup the ID from drop-box or
operator properties. bc3dbf109c shows what happens if the name happens
to be set for whatever reason and the session UUID isn't prioritized.
2022-05-24 15:36:41 +02:00
961db61fb8 Merge branch 'blender-v3.2-release' 2022-05-24 15:23:13 +02:00
bc3dbf109c Fix T95706: Material asset not applied if appended and then linked
8f79fa9c67 was an attempt to fix this already, but it didn't quite
work. Problem was that the tooltip was messing with the drop-box and
operator properties, setting the name property for its own internal
logic. This name property would then be used rather than the session
UUID to query the material, which gave the wrong material (linking can
result in multiple IDs of the same type with the same name). A followup
commit will further sanitize this.
2022-05-24 15:22:18 +02:00
463077a3d5 Fix possible lingering around of ID after asset dropping failed
More and more of the drop operations are being switched to use the ID's
session UUID rather than the name, but the cleanup after a drop operator
was cancelled assumed they would set the name. They will now first
attempt to use the session UUID and fallback to the name if needed.
2022-05-24 15:21:38 +02:00
258f6cbf93 Merge branch 'blender-v3.2-release' 2022-05-24 15:04:37 +02:00
bfec666dbc Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-24 15:04:00 +02:00
a40a269062 Fix (studio-reported) bad re-assigning of new liboverride from ID template widget.
Shift-click on the 'linked' button in an ID template widget would fail
to properly remap that usage of the linked ID to the newly created
liboverride.
2022-05-24 15:03:04 +02:00
10aa2fa902 Redraw Motion Paths panel after creating motion path
Add notifier such that the Motion Paths panel in the Object Properties tab
gets redrawn, after using the Create Motion Path button.

The reason it didn't update was that the button actually triggers a popup,
and then executes in the context of that popup. It now actually emits a
`ND_DRAW_ANIMVIZ` notifier, and ensures that the panel redraws on that.
2022-05-24 14:57:30 +02:00
2da7977e3e Depsgraph: Implement backtrace functionality
The goal is to make it easier to track down sources of errors during
the dependency graph builder.

With this change whenever a relation can not be added a trace to the
entity which requested the relation will be printed. For example:

```
Failed to add relation "Copy Location"
Could not find op_from: OperationKey(type: BONE, component name: 'MissingBone', operation code: BONE_DONE)

Trace:

Depth    Type                     Name
-----    ----                     ----
1        Object                   Armature.001
2        Pose Channel             Bone
3        Constraint               Copy Location
```

On an implementation detail traced places where `checkIsBuiltAndTag`
is called, with some additional places to help tracking pose channels,
constraints, and modifiers.

Further improvements in granularity are possible, but that could happen
as a followup development once the core part is proven to work.

An example of such improvement would be to have entries in the trace
which will indicate NLA and drivers building. Currently it might be
a bit confusing to see IDs in the trace referenced from driver.

Even with such limitation the current state of the patch brings a
very valuable information (some information is much better than no
information at all).

Differential Revision: https://developer.blender.org/D15017
2022-05-24 14:48:51 +02:00
089175bb1f Merge branch 'blender-v3.2-release' 2022-05-24 13:17:20 +02:00
f29ff7fb7e Fix T98152: Named Attribute node changes data type for non-existant attributes
Skip changing the data type in the node if it is not known.
2022-05-24 11:55:44 +02:00
2ca66d541a Cleanup: Correct misleading comment in UI code 2022-05-24 11:31:19 +02:00
bc1eb513ab Fix buttons not being grayed out
Was using the wrong bitfield in flag comparisons for the drawing code.
The input handling wouldn't be affected. Own mistake in 0d73113452.
2022-05-24 11:31:19 +02:00
Jeroen Bakker
cd77bf44d4 Merge branch 'blender-v3.2-release' 2022-05-24 11:16:48 +02:00
Jeroen Bakker
d1340e1bb2 Fix T97828: Split normals not visible on certain platforms.
It is a know issue that split normals aren't supported when using high
quality normals in the viewport. Some AMD platforms were pushed to use
high quality normals to work around a driver bug where 1010102 texture
formats `GL_INT_2_10_10_10_REV` wasn't uploaded to the GPU.

This change will remove commonly used polaris platforms from the
work-around. This has been tested with a RX480 against the latest AMD
whql drivers (22.5.1). Users need to ensure that they use the latest
drivers that are available on their platform.

Although this change doesn't fix the underlying issue to support edit
normals when high quality normals are enabled. It will not force that
common platforms cannot use a feature as their platform is forced into
using a work-around.
2022-05-24 11:14:10 +02:00
b84264fbc5 Merge branch 'blender-v3.2-release' 2022-05-24 10:40:52 +02:00
ec5b53a018 Fix T98247 EEVEE: Regression: Shader To RGB not displaying textures
This was caused by the nodetree branch duplication not handling incoming
links to the copied node, making all bsdfs nodes use their default values.
2022-05-24 10:35:24 +02:00
174c3ffb4a Fix T98268: replace string node des not handle empty strings correctly
Just use an existing function from blenlib instead of implementing a new version.
2022-05-24 10:21:02 +02:00
123f4db9bd Cleanup: Else after return in depsgraph code 2022-05-24 10:07:54 +02:00
2ea6a0dd4d Fix T98328: missing depsgraph update after adding node group
Adding node groups can change depsgraph relations, so the depsgraph
has to be rebuild.
2022-05-24 10:05:52 +02:00
e07b1b8316 Fix T98317: equal vs not-equal modes in compare node are not exact opposites
For vectors and colors to be not equal, it is enough when they are not equal
in one component.
2022-05-24 09:49:58 +02:00
cd968a3273 EEVEE: support Curves attributes rendering
This adds support to render Curves attributes in EEVEE.

Each attribute is stored in a texture derived from a VBO. As the
shading group needs the textures to be valid upon creation, the
attributes are created and setup during its very creation, instead
of doing it lazily via create_requested which we cannot rely on
anyway as contrary to the mesh batch, we do cannot really tell if
attributes need to be updated or else via some `DRW_batch_requested`.

Since point attributes need refinement, and since attributes are all
cast to vec4/float4 to account for differences in type conversions
between Blender and OpenGL, the refinement shader for points is
used as is. The point attributes are stored for each subdivision level
in CurvesEvalFinalCache. Each subdivision level also keeps track of the
attributes already in use so they are properly updated when needed.

Some basic garbage collection was added similar to what is done
for meshes: if the attributes used over time have been different
from the currently used attributes for too long, then the buffers
are freed, ensuring that stale attributesare removed.

This adds `CurvesInfos` to the shader creation info, which stores
the scope in which the attributes are defined. Scopes are stored
as booleans, in an array indexed by attribute loading order which
is also the order in which the attributes were added to the material.
A mapping is necessary between the indices used for the scoping, and
the ones used in the Curves cache, as this may contain stale
attributes which have not been garbage collected yet.

Common utilities with the mesh code for handling requested
attributes were moved to a separate file.

Differential Revision: https://developer.blender.org/D14916
2022-05-24 05:02:57 +02:00
64a5a7ade1 Merge branch 'blender-v3.2-release' 2022-05-23 22:38:05 -03:00
5744e7d247 Fix GPUIndexBuf not working in python
Since rBb47c5505aa37, Batchs containing GPUIndexBuf initialized via
a PyObject with buffer protocol no longer work.

This was because of an unsafe optimization in the GPUIndexBuf module
for Python.

So remove this micro-optimization.
2022-05-23 22:37:30 -03:00
bb6f0b085e Merge branch 'blender-v3.2-release' 2022-05-24 11:01:38 +10:00
d55e1caa75 Fix T98185: Assertion saving while fullscreen
When saving from the menu the region was not set,
causing the last region in `area->regionbase` to be used
as the region was assigned before comparison.
2022-05-24 10:59:48 +10:00
c968dae054 Fix T98141: Strip rotation is limited to +/360 degrees
This limiting prevented visual keyframing from working correctly and is
not consistent with object rotation, so limiting is removed.
2022-05-23 23:28:21 +02:00
8eda776eef Fix T98057: Adjustment layer blend mode not optimal
Since adjustment layer is meant to replace original image, cross blend
mode is more optimal than alpha over. Same goes for multicam type.
2022-05-23 23:27:07 +02:00
770510915c Merge branch 'blender-v3.2-release' 2022-05-23 22:26:27 +02:00
bdab538b30 Fix Eevee blackbody wrong with non-default scene linear color space
* Port over new code tables from Cycles
* Convert Rec.709 to scene linear for lookup table.
* Move code for wavelength and blackbody to IMB so they can access the
  required transforms, which are not in blenlib.
* Remove clamping from blackbody shader to bypass the texture read.
  Since it's variable now easiest to just always read from the texture
  than pass additional parameters.
* Fold XYZ to RGB conversion into the wavelength table.

Ref T68926
2022-05-23 22:09:44 +02:00
a22ad7fbd3 Fix T98036: Cycles blackbody inaccurate for low temperature and wide gamut
Regenerate blackbody RGB curve fit to not clamp values, and extend down to
800K since it does now change below 965K.

Note that as before, blackbody is only defined in the range 800K to 12000K
and has a fixed value outside of that. But within that range there should
be no more unnecessary gamut clamping.
2022-05-23 22:07:59 +02:00
2655f47ca3 Revert "LineArt: Use CAS for add_triangles."
This reverts commit 14a5a91e0e.

This caused build errors on x64+arm mac builds and some versions
of MSVC, reverting for now till a better solution is found.
2022-05-23 13:11:17 -06:00
b2e5fc72c8 Merge branch 'blender-v3.2-release' 2022-05-23 21:08:01 +02:00
8f79fa9c67 Fix further issues when mixing link & append for asset drag & drop
917c096be6 applied to objects only, this also applies the same fix for
the general 3D View drop operations, e.g. used for dragging materials,
images, worlds, etc.

This is needed to fix T95706, but apparently something else is still
going on. Needs further investigation.
2022-05-23 21:00:01 +02:00
0d6dda4555 Cleanup: Move new utilities for ID lookup operator properties
Move them to a more accessible place, so that other operators in
different files can use them. The following commit needs this.
2022-05-23 20:59:55 +02:00
02c5ca2f22 Fix possible issues when mixing link & append for asset drag & drop
The operators to handle object drag and drop (from the asset browser,
outliner, etc.) used the object name to find the object to add and
place. This is problematic with linking and/or library overrides, since
this may lead to multiple objects with the same name. So the wrong
object would be used by the drop operators.

Partially fixes T97320. T95706 probably needs the same fix but for
materials.

As a side-effect, the "Name" button won't show up in the Adjust Last
Operation panel anymore. This isn't really useful, and I doubt this was
ever intentionally exposed in the UI.
2022-05-23 20:59:47 +02:00
9039fbaa9c Asset Browser: Show "Current File" icon in sidebar source field
If the asset is stored in the current file, display the corresponding
icon in the "Source" button in the sidebar. This is a nice indicator and
helps users learn what this icon represents (it's used in the main
region without text too).
2022-05-23 20:11:42 +02:00
917c096be6 Fix possible issues when mixing link & append for asset drag & drop
The operators to handle object drag and drop (from the asset browser,
outliner, etc.) used the object name to find the object to add and
place. This is problematic with linking and/or library overrides, since
this may lead to multiple objects with the same name. So the wrong
object would be used by the drop operators.

Partially fixes T97320. T95706 probably needs the same fix but for
materials.

As a side-effect, the "Name" button won't show up in the Adjust Last
Operation panel anymore. This isn't really useful, and I doubt this was
ever intentionally exposed in the UI.
2022-05-23 20:11:37 +02:00
ffa262c9f8 obj: remove unneeded CTX_data_ensure_evaluated_depsgraph
As discussed on the chat and pointed out in D15015, that call is
not needed there (none of the other importers do it either).
2022-05-23 20:43:53 +03:00
9e45af530a Fix T98293: Scene stats info not updated after new OBJ import
The importer was not doing a notification that the scene has changed, so
the bottom status bar scene stats info was not updated right after the
new OBJ import.

Reviewed By: Julian Eisel
Differential Revision: https://developer.blender.org/D15015
2022-05-23 20:42:27 +03:00
a8c81ffa83 Cycles: Add half precision float support for volumes with NanoVDB
This patch makes it possible to change the precision with which to
store volume data in the NanoVDB data structure (as float, half, or
using variable bit quantization) via the previously unused precision
field in the volume data block.
It makes it possible to further reduce memory usage during
rendering, at a slight cost to the visual detail of a volume.

Differential Revision: https://developer.blender.org/D10023
2022-05-23 19:08:01 +02:00
14a5a91e0e LineArt: Use CAS for add_triangles.
Using the atomic "compare and swap" method in add_triangles stage
dramatically speeds up the add_triangles call and significantly reduced
the overall calculation time. This is currently the fastest method we
have experimented with so far.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D14953
2022-05-24 00:28:52 +08:00
54f357ed2a Merge branch 'blender-v3.2-release' 2022-05-23 18:17:00 +02:00
ec95f4a5df Fix T96878: When interface translation is enabled, grease pencil layer name is translated in menu.
Those type of entries have to be tagged as not translatable...
2022-05-23 18:16:04 +02:00
0e6d70fec9 Fix "Open Clip" operator in Clip Editor broken
Steps to reproduce were:
- Open Clip Editor
- Call "Open Clip" (e.g. Alt+O)
- Select video file

The file wouldn't be loaded into the Clip Editor.

Caused by 7849b56c3c.
2022-05-23 18:01:11 +02:00
d91711bc85 Fix for crash opening the file selector multiple times
This is part of a fix for T88570, where the file selector would crash
when activated multiple times.

Calling save multiple times would free the operator, leaving a dangling
pointer which was used when panels were visible that accessed the
"active_operator".

Reviewed By: Severin

Ref D14905
2022-05-23 18:01:11 +02:00
bc8e030a84 Fix T88570: Crash when saving after pressing ctrl+S twice.
Existing code to replace the file operation was failing when done from
the window for the file operation itself.

Basically, this patch does two things:
- Implement a well defined window context to use as the "owner" or
  "root" of the File Browser. This will be used for managing the File
  Browser and to execute the file operation, even after the File Browser
  was closed.
- Ensure the context is valid when dealing with file File Browser event
  handlers.

Previously the window context just wasn't well defined and just happened
to work well enough in most cases. Addressing this may unveil further
issues, see T88570#1355740.

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

Reviewed by: Campbell Barton
2022-05-23 18:01:11 +02:00
2b9dfff6f3 Cleanup: GPU: Remove gpu_shader_common_obinfos_lib.glsl
This has been replaced by `draw_object_infos`.
2022-05-23 17:20:12 +02:00
09b7e141d2 Fix T98251: EEVEE: Regression: Wrong normalmaps on scaled objects
This was caused by a missing `normalize`.
2022-05-23 17:20:12 +02:00
e4de0d28c4 EEVEE: Fix unreported broken normal map node modes
A compilation error was making it impossible to use normal map modes other
than tangent.
2022-05-23 17:20:12 +02:00
bce37bc52a Cleanup: GPU: Remove gpu_shader_common_obinfos_lib.glsl
This has been replaced by `draw_object_infos`.
2022-05-23 17:19:37 +02:00
7542dc460f Fix T98251: EEVEE: Regression: Wrong normalmaps on scaled objects
This was caused by a missing `normalize`.
2022-05-23 17:16:15 +02:00
5565d79057 EEVEE: Fix unreported broken normal map node modes
A compilation error was making it impossible to use normal map modes other
than tangent.
2022-05-23 17:13:57 +02:00
16fd5fa656 Cleanup: Early-exit in button handling code, minor cleanups
This should decrease cognitive load because:
- Intention is more explicit
- Shorter visual scope of branches (no need to search for matching
  closing brackets and `else` blocks)
- Visually less busy code because condition-checks and code that
  "actually does things" are separated, with less indentation
- Avoids chaining together a bunch of conditions to a single `if`

Also: Use `const`, correct comment placement, whitespace improvements.
2022-05-23 16:55:43 +02:00
7f1a5f2567 Merge branch 'blender-v3.2-release' 2022-05-23 16:33:04 +02:00
Johannes J
f4d31fbf6c DRW: Fix signed/unsigned mismatches in shader code
Fix the following error messages on Blender startup
since commit 308a12ac64.

This commit fixes T98194.

Reviewed By: fclem
Differential Revision: https://developer.blender.org/D15007
2022-05-23 16:30:18 +02:00
85e3e3be5b Merge branch 'blender-v3.2-release' 2022-05-23 16:24:50 +02:00
aea59428eb Fix T98128: EEVEE: Regression: Inverted surface normal on MacOS Intel GPU
This seems to be caused by the `!` used in conjunction with a macro.
Using the macro directly as condition does not exhibit this issue.
2022-05-23 16:23:50 +02:00
63cf0d0890 Fix T98196: Crash when moving tweaked NLA strip with empty track below
`BKE_nlastrip_find_active()` and `update_active_strip()` now do a more
thorough search for the active strip, by also recursing into
meta-strips.

There were some assumptions in the NLA code that the active strips is
contained in the active track. This assumption turned out to be false:
when there is a meta-strip, the active strip could be inside that, and
then it's not contained in `active_track.strips` directly.

Apart from the above, there are other situations in which the track
pointed to by `AnimData::act_track` does *not* contain the active strip
(even indirectly).

Both these cases can happen when the transform system is moving a strip
that's in tweak mode. Entering tweak mode doesn't just search for the
active track/strip, but also falls back to the last-selected ones. This
means that the track/strip pointers & flags can be out of sync with
what's being tweaked/transformed. Because of this, the assumption that
there is any relation between "active strip" and "active track" has been
removed from the `update_active_strip()` function.

All this searching could be prevented by passing the `AnimData` to the
code that duplicates tracks & strips. That way, when the active
track/strip is dup'ed, the `AnimData` pointers can be updated as well.
That would require more refactoring and thus could introduce other bugs,
so that's left for later.
2022-05-23 16:12:09 +02:00
Aleš Jelovčan
82d7234ed9 GPencil: A Ping Pong effect to Time modifier
This patch adds 4th option to Time offset modifier Modes.

It loops from start frame to end frame and then back to start in reverse direction.
In other words it is a combination of Normal and Reverse mode.

Especially with offset control it adds the ability to create easy looping animations such as cheering crowds, flowers opening and closing at different offsets.

Reviewed By: #grease_pencil, antoniov, pepeland, mendio

Differential Revision: https://developer.blender.org/D14965
2022-05-23 16:03:04 +02:00
698e394e7e Merge branch 'blender-v3.2-release' 2022-05-23 16:02:52 +02:00
9bb4bf5748 Fix missing 64bit casts when calculating Cycles render buffer offset
Found those missing casts while looking into a crash report made in
the Blender Chat. Was unable to reproduce the crash, but the casts
should totally be there to avoid integer overflow.
2022-05-23 15:59:52 +02:00
3e4f84d10d Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-23 15:57:33 +02:00
eb5e7d0a31 Cleanup: clarify what is scene linear color space in conversion conversion
* Rename ambiguous rgb to scene_linear in some places
* Precompute matrices to directly go to scene instead of through XYZ
* Make function signatures more consistent
2022-05-23 15:34:50 +02:00
469ee7ff15 Python API: add mathutils.Color functions to convert color spaces
Between scene linear and sRGB, XYZ, linear Rec.709 and ACES2065-1.

And add some clarifications about color spaces in the docs.

Fixes T98267

Ref T68926

Differential Revision: https://developer.blender.org/D14989
2022-05-23 15:34:50 +02:00
09292b89c3 Fix wrong mouse tolerance in mask editor
There are two issues. The biggest one was that a pixel value was used
to compare a squared distance meaning the tolerance was too strict.
The other issue was that the tolerance in pixels was different to what
the tracking mode is using.

The user-level change is that now it should be easier to tweak the
mask shape.
2022-05-23 15:22:08 +02:00
00506d7a86 Cleanup: Unused field in sculpt DeleteOperation 2022-05-23 15:03:41 +02:00
2f2d13b8c6 Fix T97237: dragging custom node group asset adds broken node
Differential Revision: https://developer.blender.org/D15013
2022-05-23 14:43:20 +02:00
eba6900b08 Fix T98305: Image.save not working for generated images with filepath
This is a place where the API function and operator should differ, for the API
manually setting the filepath and then saving should work. For the UI there is
no filepath visible, so it should open Save As even if there was a filepath set
for example from before changing an image type to Generated.
2022-05-23 12:30:11 +02:00
a833c7f4a5 Fix T98283: Regression: crash when opening file that has Collision modifier on liboverride object
Some RNA property update callbacks can already generate such modifier,
and only one is allowed per object, so had to adapt code actually adding
new modifiers in liboverride apply codebase.
2022-05-23 12:13:33 +02:00
f626fc27f9 Fix T98316: geometry nodes stop updating after duplication
This was a missing depsgraph update.
2022-05-23 12:13:33 +02:00
3fe1079ecf Fix T98258: Duplicated last vertex after GPencil sample.
Also fixed an unreported issue of incorrect interpolation of thickness.

Reviewed By: Aleš Jelovčan (frogstomp), Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D15005
2022-05-23 12:13:33 +02:00
2d67b375a1 Fix T98231: missing update when material output is in group
Differential Revision: https://developer.blender.org/D14998
2022-05-23 12:13:33 +02:00
62a2b92b6b Fix T98283: Regression: crash when opening file that has Collision modifier on liboverride object
Some RNA property update callbacks can already generate such modifier,
and only one is allowed per object, so had to adapt code actually adding
new modifiers in liboverride apply codebase.
2022-05-23 12:11:09 +02:00
a5409d2b59 Fix T98316: geometry nodes stop updating after duplication
This was a missing depsgraph update.
2022-05-23 11:29:55 +02:00
f4101ba4a1 LineArt: Fix adjacent edge sorting.
The sorting end element should be `start+len` not `start+len-1`.
2022-05-23 16:20:23 +08:00
c4e5a7d59a Fix T98258: Duplicated last vertex after GPencil sample.
Also fixed an unreported issue of incorrect interpolation of thickness.

Reviewed By: Aleš Jelovčan (frogstomp), Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D15005
2022-05-23 16:17:00 +08:00
f4a01c8a8b Fix T98101: Handle single point curves in delete brush
The 3D brush utility and the delete brush only considered segments,
so they did not handle single points. Fix by adding special cases for
single point curves.

Differential Revision: https://developer.blender.org/D14944
2022-05-23 09:47:17 +02:00
8f3847aef3 Fix: Sample pressure properly for 3D curves sculpt brushes
For the "Sphere" 3D brushes, the depth and radius are only sampled at
the beginning of the stroke. This didn't work when tablet pressure is
used as a factor for the brush radius. Now the 3D brush depth is found
with the max radius (as if the pressure was 1.0), but the pressure
factor is used afterwards.

Restructuring the way the brush executors stored the radius made
the change a bit clearer, which is where most of the diff comes from.

Differential Revision: https://developer.blender.org/D15002
2022-05-23 09:44:12 +02:00
b81f1b8cf1 Fix T98231: missing update when material output is in group
Differential Revision: https://developer.blender.org/D14998
2022-05-23 09:11:17 +02:00
f93b237194 Merge branch 'blender-v3.2-release' 2022-05-23 08:16:50 +02:00
4418536f69 Fix T98321: Image.update doesn't update the image editor.
Missing call to partial update.
2022-05-23 08:14:38 +02:00
ad33e68348 Cleanup: remove "texture" from ED_mesh_uv_texture_* funcitons
This name made sense when UV's and textures were stored in the same
layer (MTFace & TFace).
2022-05-23 12:43:28 +10:00
1e882b8657 PyDoc: quiet output and minor cleanup
Suppress printing unnecessary output when generating docs.
2022-05-23 12:37:28 +10:00
4d509fd6e1 Fix error in sphinx_doc_gen.py when logging
Regression in 45ed325443
2022-05-23 12:37:22 +10:00
c92f137a75 Merge branch 'blender-v3.2-release' 2022-05-23 12:37:08 +10:00
47b0ca85cd Fix float representation for Python API docs
float_as_string(1000000) resulted in 1e+06.0 which isn't valid notation.
2022-05-23 12:35:37 +10:00
341f1e444f Cleanup: formatting 2022-05-22 21:59:46 -04:00
04ed96136b Merge branch 'blender-v3.2-release' 2022-05-22 21:58:45 -04:00
568b692bcf Compositor: Fix Map Range node To/From Max default value
Mistake from rB5ef5a9fc24668aa264fe0558db9c0fb1246aa37f

Fixes T98322
2022-05-22 21:56:32 -04:00
84e55e3dc2 Fix T98320: GPencil Crash with Length and Build Modifiers
The length modifiers creates a NULL strokes and this is not handled by Build modifier.
2022-05-22 21:10:08 +02:00
d095fcd6b4 Cleanup: Fix build error after previous commit
I'm not sure how that happened, sorry for the noise.
2022-05-22 20:26:25 +02:00
e222e19d82 Cleanup: Use const arguments 2022-05-22 20:06:24 +02:00
fff8f969de Cleanup: Remove unused function
Mesh "MFace" is deprecated and shouldn't be used in any new code anyway.
2022-05-22 13:05:12 +02:00
fdb1f70468 Cleanup: fix wrong type
It's a bit surprising that this compiled. That's probably due to the
`GField` constructor, to be investigated!
2022-05-22 12:01:11 +02:00
9d9f2f1a03 GPU subdiv: smoothly interpolate orco layer
This uses the recently introduced evaluator's vertex
data to smoothly interpolate original coordinates instead
of using linear interpolation.

The orcos are interpolated at the same time as positions
and as such, the specific subdivision routine for the
orco extractor has been removed. The patch evaluation
shader uses a definition to enable code specific to
orco evaluation.

Since the orco layer may not have been requested on first
render, and since orco data is now stored in the OpenSubDiv
evaluator, the evaluator needs to be recreated if an
orco layer is suddenly available. For this, a callback
to check if the evaluator has the data was added. This is
added to the evaluator as the `Subdiv` cache stored in the
modifier is invalidated less often than the Mesh batch cache
and so leads to fewer evaluator recreations.

Differential Revision: https://developer.blender.org/D14999
2022-05-22 09:19:55 +02:00
45ed325443 PyDoc: resolve/quiet warnings for pylint
- Duplicate keys in dict.
- Redefining names.
- Unused arguments.
- Use lazy % formatting in logging functions.
2022-05-22 13:31:36 +10:00
84901adec5 PyDoc: cleanup doc-generator
- Full sentences for comments.
- Use double quotes for strings (which aren't enum ID's).
- Reduce right-shift.
2022-05-22 13:08:38 +10:00
dfb8c90324 Cleanup: Remove unused scrollbar drawing flag
Apparently this was used for progressbar drawing, which doesn't share
the code anymore.
2022-05-21 00:53:54 +02:00
0d73113452 UI Code Quality: Resolve frankenstein bit-flag usage for widget drawing
Previously we would pass button state and draw information to widget
draw callbacks in a rather hacky way. Some specific flags from
`uiBut.flag` were masked out, so their bits could be reused for also
passing `uiBut.drawflag` in the same int. Instead this commit introduces
a state-info struct that can properly hold all the relevant data.

This has the advantage that it's now easier to introduce new state data
that needs to be accessible in the widget callbacks. Since we are
running out of button flags, we plan to reorganize button flags, and
split them up into multiple bitfields. In the widget drawing code, this
would have been a hassle earlier.

Also had to add a new widget callback to draw blocks as widgets (popup
backgrounds), since that would pass block flags where we would usually
pass button flags. This wasn't nice, now it's separated more clearly.
2022-05-21 00:53:54 +02:00
029e6b5174 Geometry Nodes: String to Curves rename Max Width
This patch changes the Text Box Width socket to always have that label
instead of switching to "Max Width" when Overflow mode is picked.

Bug report: T97060

Differential Revision: https://developer.blender.org/D14909
2022-05-20 17:11:27 +02:00
bf352df27a Fix wrong USD image color space export with non-default OpenColorIO config
The names of color spaces in OpenColorIO configs can be arbitrary, so don't
use hardcoded names from our default config.
2022-05-20 17:07:37 +02:00
9b082da708 UI: rename Hue/Saturation node to Hue Saturation Value in shaders and textures
This makes it easier to search for and consistent with compositor nodes.

Differential Revision: https://developer.blender.org/D14914
2022-05-20 16:47:11 +02:00
8d65895af8 UI: Get rid of redundant UI_BUT_IMMEDIATE button flag
This flag was used to activate the hotkey input buttons (e.g. for
"Assign Shortcut") when opened in a popup. Since this was added, other
more generalized ways of getting this same behavior were implemented.
Had to tweak the hotkey button event handling a bit, but it seems to
behave exactly as before now.
2022-05-20 16:35:13 +02:00
de561280fc Cleanup: don't use variable name that matches type alias 2022-05-20 16:32:14 +02:00
b215fe82e8 Cleanup: Further simplification of loop syntax for curve segments
The same changes as 019681b984.
2022-05-20 16:00:26 +02:00
f8239cc9a0 Curves: Use only current brush location for delete brush
Currently the delete brush and some other brushes use the line
segment from the current brush position to the previous position
to find curves to interact with. However, this doesn't work well
with more advanced stroke settings that purposefully use
non-contiguous brush sample locations. This commit makes
the delete brush only use the current sample location.

Differential Revision: https://developer.blender.org/D14992
2022-05-20 13:34:30 +02:00
cea37b3127 Curves: Support pressure in sculpt brushes
Multiply the radius and strength of sculpt brushes by the pressure
when "use pressure" is turned on. The brush system isn't responsible
for this, so the pressure needs to be stored in `StrokeExtension`.

Differential Revision: https://developer.blender.org/D14996
2022-05-20 13:33:42 +02:00
a89f829f12 LibOverride: Add option to Hierarchy Creation to get all data user-editable by default.
Avoids having to manually enable data-blocks for user-edition when you
do not care about what should be edited by whom. Similar to default
behavior before introduction of system overrides (aka non-user-editable
overrides).
2022-05-20 12:02:52 +02:00
019681b984 Cleanup: Simplify loop syntax for curve points 2022-05-20 10:56:19 +02:00
47c2a876bf Merge branch 'blender-v3.2-release' 2022-05-20 10:11:09 +02:00
d4cdae29c1 Fix T98266: Crash with empty mesh boolean node
The output mesh can be null. Also reorganize the WITH_GMP
check to avoid compiling the rest of the node with GMP off.
2022-05-20 10:10:46 +02:00
1d65f7ea91 Merge branch 'blender-v3.2-release' 2022-05-20 09:50:54 +02:00
b8bd20d7e0 Fix T96810: Bitmap race condition in PBVH normal calculation
The final normalization step of sculpt normal calculation iterates over
all unique vertices in each node and marks them as done. However,
storing the done mask in a bitmap meant that multiple threads could
write to a single byte at the same time, because the bits for separate
threads could be stored in the same byte. This is not threadsafe

Fixing this issue seems to improve performance as well. First I tested
just clearing the entire bitmap after the normal calculation. Then I
tested using an array of booleans instead, which turned out to be
slightly better, and simplifies code a bit.

I tested on a Ryzen 3800x, on an 8 million polygon subdivided
Suzanne by using the grab brush with a radius large enough to
affect most of the mesh.

| Original  | Clear Entire Bitmap | Boolean Array |
| --------- | ------------------- | ------------- |
| 67.9 ms   | 59.1 ms             | 57.9 ms       |
| 1.0x      | 1.15x               | 1.17x         |

Differential Revision: https://developer.blender.org/D14985
2022-05-20 09:49:29 +02:00
Martijn Versteegh
8e02b0d5d4 Cleanup: make functions for setting clone/stencil layer more consistent
This was missing in rBf1beb3b3f60be45854285935d6bfcedf839b317c.

Differential Revision: https://developer.blender.org/D14991
2022-05-20 09:36:30 +02:00
af7502dd9b Merge branch 'blender-v3.2-release' 2022-05-20 16:46:52 +10:00
d27f4e8493 Fix popup menu memory activating labels when names matched menu items
When labels in popups (typically headings) matched the name of a button,
the label would be activated instead of the button.

This caused the unwrap menu in the UV editor not to re-select "Unwrap"
when opening a second time.
2022-05-20 16:42:35 +10:00
f049591967 Merge branch 'blender-v3.2-release' 2022-05-20 16:11:28 +10:00
f61dd33f50 Merge branch 'blender-v3.2-release' 2022-05-20 16:11:25 +10:00
f68fb81064 Fix T98145: IC keymap can't select & move multiple nodes
Regression from [0] which changed operator properties without
updating this keymap.

[0]: 4c3e91e5f5
2022-05-20 16:07:32 +10:00
838806be28 WM: return the string length from operator name conversion
- In some cases it avoids using strlen on the result.
- Use ATTR_NONNULL for all arguments.
- Remove NULL pointer check for WM_operator_bl_idname src argument.
- Rename from/to to src/dst.
2022-05-20 13:35:28 +10:00
780ad443fd Include __init__.py in bl_console_utils
Failure to include this file caused script_load_modules test to fail.
2022-05-20 12:41:44 +10:00
930e526cae Cleanup: warnings, spelling, formatting
Avoid multiple `sound.bl_rna.properties["channels"].enum_items` in
the same line. Note we might want a way to avoid having to do this.
2022-05-20 11:24:34 +10:00
42a6c226d0 CMake: fix AUDASPACE disabling WITH_PYTHON for Blender
When AUDASPACE couldn't find NUMPY, it would disable WITH_PYTHON for
the rest of Blender. Now setting the value globally is only done for
standalone AUDASPACE builds. Now it's possible to build Blender with
AUDASPACE & PYTHON but without NUMPY.

While this isn't an especially important configuration to support,
having Python mysteriously disabled is a hassle to troubleshoot.

NOTE: extern/audaspace/CMakeLists.txt has become out sync with the
original [0], it seems this is being maintained in our repository.

[0]: https://github.com/neXyon/audaspace/blob/master/CMakeLists.txt
2022-05-20 11:18:49 +10:00
c1dcc64750 CMake: disable WITH_MOD_FLUID when WITH_PYTHON=OFF 2022-05-20 11:17:32 +10:00
74a34d95d6 Cleanup: move 'console' module to 'bl_console_utils.autocomplete'
The name 'console' for a module was too generic, move into a sub-package
of bl_console_utils, so other console utilities can be added
without creating new top-level modules.
2022-05-20 10:00:40 +10:00
a42307eb65 Fix building with OpenEXR on Linux 2022-05-20 10:00:40 +10:00
f600a2aa6d IMBUF: Thumbnails of all EXR files using less RAM
Specialized thumbnailing function to create previews of all EXR image
files, regardless of type, size, or dimensions. Uses less RAM by only
loading a single row of pixels at a time.

See D14663 for more details and examples.

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

Reviewed by Brecht Van Lommel
2022-05-19 14:55:04 -07:00
1a627d528c Python API: warn that the bgl module is deprecated in the docs
This was already mentioned in the release notes but not the API docs.

Ref T80730
2022-05-19 21:21:28 +02:00
Marcos Perez
89106a695a VSE: Display sound sample rate and channels
Display information about sound media in "Source" category in side panel
similar to movie resolution and framerate.

The specs are stored in the `Sequence` struct, and are extracted at
the moment of struct creation. If the "source file" is changed,
the specs change also.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D14565
2022-05-19 21:05:23 +02:00
9e9895b055 GPencil: Avoid Automerge with Closed strokes
The algorithm is not designed to be used with Closed strokes (cyclic) and actually the result is arbitrary. In order to avoid this, now the closed strokes never are merged.

Related to T98235

Feedback by: @mendio
2022-05-19 18:05:15 +02:00
65e13cc2d2 Merge branch 'blender-v3.2-release' 2022-05-19 12:23:23 -03:00
bc6965cb98 Fix T98230: Automatic Constraint doesn't work if cursor is not moving
The change was kind of intentional on {rB21e72496a629}.

That commit made mouse movement to "select" the contraint in Auto
Constraint a requirement.

This deduplicated the code a bit, but this requirement is not
comfortable for the first "selection" of the contraint.

So the constraint "selection" is now done in two ways:
- If there is no contraint, the "selection" is done immediately;
- If there is already a constraint, the "selection" is delayed by 1 event to simulate a constraint cancellation if there is no mouse movement.
2022-05-19 12:22:30 -03:00
436a7ee651 Merge branch 'blender-v3.2-release' 2022-05-19 16:54:10 +02:00
2d5b91d6a0 Fix (studio-reported) more possibilities to edit content of linked/override collections.
Existing code for the `Move` operator, and some `Collections` panel
operations (Object properties) was absolutely not override-safe, and
sometimes not even linked-data safe.
2022-05-19 16:51:24 +02:00
eb13072399 Merge branch 'blender-v3.2-release' 2022-05-19 16:22:00 +02:00
f8ebb0e1d5 GPencil: Remove icons in Build modifer mode parameter
The list must not use icons.

Feedback by @pablovazquez
2022-05-19 16:21:25 +02:00
d0fabb318e UI: Expose new tool icon: Selection Paint
This icon will be used by the curves paint select brush.
2022-05-19 15:25:38 +02:00
f5b708d1cf Cleanup: Decrease variable scope 2022-05-19 14:08:54 +02:00
29ca935eb8 Cleanup: Remove redundant function
`BKE_object_get_evaluated_mesh` now looks inside `geometry_set_eval`.
2022-05-19 14:02:16 +02:00
4fc96e5000 Merge branch 'blender-v3.2-release'
Conflicts:
	source/blender/blenkernel/intern/lib_override.c
2022-05-19 12:04:07 +02:00
24745e8d27 Fix liboverride extreme resync times in case of libraries dependency loops.
That max number of `10000` level of recursivity was a typo (should have
been `1000`), but even that is way too high, typical sane situation
should not lead to more than a few tens of levels, so reducing the max
level to 200.

Also improve error message with more context info about the issue.

Found while investigating issues for the Blender Studio's Heist production.
2022-05-19 11:59:58 +02:00
74420d95b3 Revert "Fix liboverride extreme resync times in case of libraries dependency loops."
This reverts commit e42e4e8568.

Wrong commit, sorry for the noise.
2022-05-19 11:51:01 +02:00
e42e4e8568 Fix liboverride extreme resync times in case of libraries dependency loops.
That max number of `10000` level of recursivity was a typo (should have
been `1000`), but even that is way too high, typical sane situation
should not lead to more than a few tens of levels, so reducing the max
level to 200.

Also improve error message with more context info about the issue.

Found while investigating issues for the Blender Studio's Heist production.
2022-05-19 11:47:28 +02:00
c88de1594f Fix T98237: Double free with curve object conversion to mesh
In some cases (when there is an evaluated curve), the conversion code
would try to free the evaluated data-block twice, because freeing the
object would free it from `data_eval` and then the data-block was freed
again explicitly. Now check if the data-block is stored in `data_eval`
before freeing `object.data` manually. This is another area that's made
more complex by the fact that we change the meaning of `object.data`
for evaluated objects. The solution is more complicated than it should
be, but it works whether or not an evaluated mesh or curve exists.
2022-05-19 11:10:17 +02:00
f4cbfaded6 Cleanup: Remove unnecessary indentation 2022-05-19 10:00:12 +02:00
2e06c223cc Fix T73250: Override Library will always return to Object Mode on file opening.
Was an old known annoying issue, since the matching RNA property is
read-only we need a manual handling of this in override applying and
resyncing code.
2022-05-19 09:06:33 +02:00
5d0432a2ea Merge branch 'blender-v3.2-release' 2022-05-19 14:32:59 +10:00
a111aae415 Merge branch 'blender-v3.2-release' 2022-05-19 14:32:54 +10:00
ae11233b65 Merge branch 'blender-v3.2-release' 2022-05-19 14:32:51 +10:00
3ecc03c3d6 Fix T93779: Python is unable to set axis aligned views
It wasn't possible to temporarily orbit the view, then set back to an
axis-aligned view.

Details:

- It was possible to change RegionView3D.view_rotation while the view
  kept the axis alignment value (Top, Left, Front .. etc) which
  displayed in the viewport overlay.

  Now changing the view rotation directly or via "view_matrix" resets
  the axis-alignment - clearing when the view is no longer axis-aligned
  or assigning the newly aligned axis.

- RegionView3D.is_orthographic_side_view added in [0] could be assigned
  but wasn't useful as it treated an enum as a boolean only setting the
  RegionView3D.view to RV3D_VIEW_USER or RV3D_VIEW_FRONT.

  Now enabling this aligns the viewport rotation to it's closest
  axis-aligned orientation setting RegionView3D.view & view_axis_roll
  accordingly. Note that the "orthographic" term is misleading as the
  property only relates to axis-alignment, not to the
  perspective/orthographic setting. We could consider deprecating the
  current naming.

[0]: 63bae864f4
2022-05-19 14:31:22 +10:00
76b6741981 Fix View Roll failure to align the quaternion to the view-axis
View roll checked if the resulting roll was close to a view axis
but didn't write the aligned quaternion back to the final result.
Add ED_view3d_quat_to_axis_view_and_reset_quat since most callers
to ED_view3d_quat_to_axis_view will reset the quaternion when a view
aligned axis is found.
2022-05-19 13:06:45 +10:00
41feaa17f3 Cleanup: suppress 'address' warnings for ./extern/glew
Also add comments noting why some warnings shouldn't be added to
strict-flags.
2022-05-19 11:17:01 +10:00
e9c3af3dd7 Cleanup: always assign return args for SCULPT_paint_image_canvas_get
Asserting the variables weren't NULL raised a warning with GCC 12.1,
instead of suppressing the warning, always assign NULL which is often
expected behavior and makes the function work as documented.
2022-05-19 11:17:01 +10:00
6730c11dd9 Cleanup: quiet deprecated-copy warning with GCC 2022-05-19 11:17:01 +10:00
3e2017491a Cleanup: spelling in comments & move doc-strings to headers 2022-05-19 11:17:01 +10:00
30e666f747 Cleanup: format, reduce line length & strip trailing space 2022-05-19 11:17:01 +10:00
ae2d2c9361 DRW: GPU wrappers: Fix resize routines for StorageArrayBuffer
Resizing was not resizing the `data_` buffer. Also use `power_of_2_max_u`.
2022-05-19 00:35:36 +02:00
b16eff2bb3 EEVEE-Next: Fix error on curve prepass caused by velocity commit 2022-05-19 00:35:36 +02:00
b3e53d6daa EEVEE-Next: Fix display of compiling shader countdown
Also fix naming convention on public variable.
2022-05-19 00:35:36 +02:00
f4028630bf EEVEE-Next: Display error instead of crashing on unsupported hardware
This message will remain in effect until we bump up the minimum
hardware requirement.
2022-05-19 00:35:36 +02:00
769cdccd0e Fix assertion raised in Merge By Distance
Harmless assertion in `r_weld_mesh->wpoly_new[r_weld_mesh->wpoly_new_len++]`
that checks the size even though it has enough space.
2022-05-18 19:06:50 -03:00
22812579bb Cleanup: rename 'WeldPoly' member 'len' to 'loop_len'
This avoids confusion.
2022-05-18 18:46:28 -03:00
7ace6dc496 Fix compilation errors with 'USE_WELD_DEBUG' 2022-05-18 18:40:20 -03:00
89ccff62d2 makesdna: centralize DNA header list.
There's currently 4 places that need to be edited when adding
a DNA header, and as you can imagine, this has gotten out of
sync quite a bit.

source/blender/CMakeLists.txt - 84 headers
source/blender/makesdna/intern/CMakeLists.txt - 33 headers
source/blender/makesdna/intern/makesdna.c@includefiles - 77 headers
source/blender/makesdna/intern/makesdna.c@Disabletypes - 76 headers

This diff makes source/blender/CMakeLists.txt the only place
where we need to keep track of dna headers, less maintenance
less mistakes. For all old places there is now a comment reminding
people of the new location.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D13048
2022-05-18 15:09:19 -06:00
699944572f EEVEE-Next: Fix memory leak 2022-05-18 23:01:08 +02:00
0fcfc4cc5b EEVEE-Next: Add Velocity module
This module allow tracking of object and geometry data accross time.
This commit adds no user visible changes.

It work in both viewport (*) and render mode, gives correct motion
for any camera projection type and is compatible with displacement (**).

It is a huge improvement upon the old EEVEE velocity which was only used
for motion blur and only available in render.

It is also an improvement for speed as the animated objects do not need to
be rendered a 3rd time. The code is also much cleaner: no GPUVertBuf
duplication, no GPUBatch amendment, no special cases for different geometry
types, no DRWShadingGroup per object, no double buffering of velocity.

The module is still work in progress as the final output may still be
flawed.

(*): Viewport support is already working but there might be some cases where
mapping will fail. For instance if topology changes but not vertex count.

(**): Displacement does not contribute to motion vectors. Surfaces using
displacement will have the same motion vectors as if they were not displaced.
2022-05-18 23:01:08 +02:00
33c5adba62 GPUStorageBuf: Add GPU_storagebuf_copy_sub_from_vertbuf()
This allows using the Graphic API to copy buffer data.
The GPU module do not expose untyped buffers even if that's what most API
do, so the copy function need to be strongly typed.

Contains GL backend implementation.
2022-05-18 23:01:08 +02:00
9631bb1e17 GLShader: Add glsl_shader_defines.glsl to compute shaders 2022-05-18 23:01:08 +02:00
ca780f4406 GL: Fix gl error during debug name setup for shader storage buffers 2022-05-18 23:01:08 +02:00
4fa743af85 GPUSource: Add error message on source not found
Without this, we could have crashes during static compilation of shaders
without knowing where it would come from.
2022-05-18 23:01:08 +02:00
683570c7fe DRW: Wrappers: Use runtime length of the buffer instead of the initial len
This could have produce errors especially in the iterators.
2022-05-18 23:01:08 +02:00
80811c5638 DRW: Replace StorageFlexibleBuffer with explicit get_or_resize()
This is to avoid hiding resize inside the `[]` operator.
2022-05-18 23:01:08 +02:00
790598fa60 Cleanup: BLI_math_base.h: Document power_of_2_max|min() 2022-05-18 23:01:08 +02:00
fe4ae77ded BLI: float4x4: Add == and != operators 2022-05-18 23:01:08 +02:00
c4c6ea7ea9 BLI: float4x4: Add << operator
Use nice formating to have lining up rows.
2022-05-18 23:01:07 +02:00
c34e3f0f19 DRW: Fix DRW_shgroup_buffer_texture naming
We do not need `_ex` suffix.
2022-05-18 23:01:07 +02:00
28316e0810 Cleanup: Move strip handle manipulation to time section 2022-05-18 21:43:14 +02:00
8ca9ce0986 VSE: Remove still frame offsets
To clarify term still frame: This is portion of strip that displays
static image. This area can exist before or after strip movie content.

Still frames were implemented as strip property, but this was never
displayed in panel. Only way to set still frames was to drag strip
handle with mouse or using python API. This would set either
`seq->*still` or `seq->*ofs` where * stands for `start` or `end`.

When strip had offset, it can't have still frames and vice versa, but
this had to be enforced in RNA functions and everywhere in code where
these fields are set directly. Strip can not have negative offset or
negative number of still frames.

This is not very practical approach and still frames can be simply
implemented as applying negative offset. Merging these offsets would
simplify offset calculations for example in D14962 and could make it
easier to also deprecate usage `seq->*disp` and necessity to call
update functions to recalculate strip boundaries.

For users only functional change is ability to set negative strip offset
using property in side panel.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D14976
2022-05-18 21:26:47 +02:00
214e61fc2c Cleanup: fix Cycles asan warning
Not sure why constructing a ustring inside [] is causing issues here, but
it's slightly more efficient to construct it once anyway.
2022-05-18 18:54:57 +02:00
47dbdf8dd5 Merge branch 'blender-v3.2-release' 2022-05-18 17:21:37 +02:00
14a893f20e Fix T98225: file saved with an object in sculptmode that is disabled in viewports crashes on reload
Issue revealed by rB90e12e823ff0. Hidden objects may not be fully
evaluated by the despgraph, do not attempt to restore edit/sculpt/etc.
modes for those.

Should also be backported to 2.93 LTS release.
2022-05-18 17:19:15 +02:00
b712dbe5de Merge branch 'blender-v3.2-release' 2022-05-18 17:03:19 +02:00
c56103356f Fix incorrect track search area election color
It was following the pattern area selection color instead of its own.
2022-05-18 17:03:10 +02:00
2e70af5cd5 Fix T97761: incorrect mixing of integers
Sometimes integers are mixed using float weights. In those cases
the mixed result has to be converted from into float again.
Previously, this was done using a simple cast, which was unexpected
because e.g. 14.999 would be cast to 14 instead of 15.
Now, the values are rounded properly.

This can affect existing files unfortunately without a good option
for versioning. Gladly, very few files seem to depend on the details
of the old behavior.

Differential Revision: https://developer.blender.org/D14892
2022-05-18 17:00:38 +02:00
342e12d6d9 Subdiv: support interpolating orco coordinates in subdivision surfaces
This makes changes to the opensubdiv module to support additional vertex data
besides the vertex position, that is smootly interpolated the same way. This is
different than varying data which is interpolated linearly.

Fixes T96596: wrong generated texture coordinates with GPU subdivision. In that
bug lazy subdivision would not interpolate orcos.

Later on, this implementation can also be used to remove the modifier stack
mechanism where modifiers are evaluated a second time for orcos, which is messy
and inefficient. But that's a more risky change, this is just the part to fix
the bug in 3.2.

Differential Revision: https://developer.blender.org/D14973
2022-05-18 16:45:38 +02:00
f517b3a295 Fix T98157: improve animation fps with better check in depsgraph
Previously, the depsgraph assumed that every node tree might contain
a reference to a video. This resulted noticeable overhead when there
was no video.

Checking whether a node tree contained a video was relatively expensive
to do in the depsgraph. It is cheaper now due to the structure of the new
node tree updater.

This also adds an additional run-time field to `bNodeTree` (there are
quite a few already). We should move those to a separate run-time
struct, but not as part of a bug fix.

Differential Revision: https://developer.blender.org/D14957
2022-05-18 16:42:49 +02:00
708547ab06 Merge branch 'blender-v3.2-release' 2022-05-18 21:48:34 +10:00
136a06285f Fix T88792: WindowManager.clipboard missing in Python API docs
Support RNA types using the Py/C-API PyGetSetDef defined properties.
Currently `WindowManager.clipboard` is the only instance of this.
2022-05-18 21:43:38 +10:00
8fb2a61966 Cleanup: use "filepath" instead of "filename" for full paths, fileops.c
Handle separately as fileops.c had to be tested on multiple platforms.
2022-05-18 20:26:52 +10:00
f937c186de Fix build error on WIN32 from _bpy.context_members
As of [0] which references context arrays from the Python API,
C++ name mangling caused 'node_context_dir' not to be found for WIN32.

[0]: c8edc458d1
2022-05-18 19:40:23 +10:00
3cd3a4abe3 Merge branch 'blender-v3.2-release' 2022-05-18 10:43:17 +02:00
1fcdb1ea28 Fix (unreported) crash in some rare case when making liboverride.
If making liboverride of an empty collection, this (root of override
hierarchy) collection would get untagged in code when checking for
collections that do not need to be overridden, leading to not overriding
this root collection, and later in code to using NULL pointer.
2022-05-18 10:41:01 +02:00
e8e2bdaa86 Cleanup: Naming of private members 2022-05-18 10:25:58 +02:00
c9ae9e1483 Cleanup: suppress dangling-pointer warning for GCC 12.1+ 2022-05-18 18:06:56 +10:00
df8a9648e2 Cleanup: remove redundant sequencer name checks
The `seq->name + 2` check dates back to 2009 [0] but does nothing.

[0]: 6e0c1cd4e5
2022-05-18 17:53:45 +10:00
c536791f36 Cleanup: remove unused variables, redundant assignments 2022-05-18 17:53:45 +10:00
ba2c6c90fa Merge branch 'blender-v3.2-release' 2022-05-18 09:52:53 +02:00
a820ba0d36 Fix T98216: OpenEXR: No difference in file size between ZIP, DWAA, DWAB.
Check in code would not expect major version of OpenEXR > 2.

Investigated by Jesse Yurkovich (@deadpin), thanks!
2022-05-18 09:51:11 +02:00
418184d1c1 Cleanup: 'space between backslash and return' warning. 2022-05-18 09:41:20 +02:00
6f00b1500c LineArt: Use array instead of lists for edges pending occusion query
It turns out there's no practical use for separating different edge types
before final occlusion stage, also using an array should be faster overall.
So changed those lists into one pending array, it also made the
iteration and occlusion task scheduling simpler.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D14951
2022-05-18 15:34:35 +08:00
9f8254fd34 LineArt: Remove LineartEdge::obindex.
After changing the duplicated edge removal method in D14903,
these two obindex variables are no longer needed.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D14949
2022-05-18 15:34:35 +08:00
369f652c80 LineArt: Use safe lineart_discard_duplicated_edges
The old method doesn't check e for array boundary.
The new method ensures it only access valid elements.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D14903
2022-05-18 15:34:35 +08:00
2719869a2a LineArt: Prioritize connecting chains from the same contour loop
This change allows the chaining function to select edges
from the same contour loop first, thus reduced rouge chain
connections (connected different objects instead of chaining
inside the same object first) and improved chaining quality.

This patch also included the default value change for chain
split threshold (Now don't split by default to make initial
result as smooth as possible)

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D14950
2022-05-18 15:34:34 +08:00
c8edc458d1 PyDoc: support building full API docs on macOS & WIN32
Accessing context members depended on `ctypes` to access symbols
which were hidden for macOS & WIN32.

Add an API call that doesn't require the symbols to be exported.

This allows most symbols to be hidden on Linux, see D14971.
2022-05-18 17:06:03 +10:00
88fbe94d70 Merge branch 'blender-v3.2-release' 2022-05-18 15:34:39 +10:00
77f2cb1686 Fix T98192: Crash when apply transforms after deleting an object 2022-05-18 15:33:44 +10:00
5d1cab0c2f Merge branch 'blender-v3.2-release' 2022-05-18 14:42:55 +10:00
d7053ba030 Fix T98191: Alt-LMB for node detach fails with RMB select
Regression caused by [0] which changed node selection to use
PRESS for selection and CLICK_DRAG to transform the selection.

This conflicted with Alt-LMB which would select the node then
pass-though to node.background_sample, preventing the drag event
from being activated.

Resolve by only activating background-sample when the cursor
isn't over a node or socket.

[0]: 4c3e91e5f5
2022-05-18 14:39:48 +10:00
0af772ef8a Merge branch 'blender-v3.2-release' 2022-05-18 12:19:02 +10:00
ffbeb34f5f Cleanup: format 2022-05-18 12:17:42 +10:00
c38187393a Fix T98214: UV selection crash with wire edges
Regression in ffaaa0bcbf
which removed the NULL pointer check.
2022-05-18 12:15:56 +10:00
ebb492a389 Python: log the status of '--python-use-system-env' on initialization
Report when the PYTHONPATH is expected to be used to help debug Python
initialization issues (see T98131).
2022-05-18 11:37:53 +10:00
df26f4f63a Merge branch 'blender-v3.2-release' 2022-05-17 21:23:55 +02:00
35e73aa347 Fix T98021: Crash when using scene strip as sequencer input
Issue was caused by treating such strip as meta and using
`seq->channels` directly, which is not valid for scene strips.

Pointer to channels is now provided by function
`SEQ_get_seqbase_from_sequence`.
2022-05-17 21:22:21 +02:00
Olivier Maury
b48adbc9d7 Fix T97921: Cycles MNEE issue with light path nodes
Ensure the correct total/diffuse/transmission depth is set when evaluating
shaders for MNEE, consistent with regular light shader evaluation.

Differential Revision: https://developer.blender.org/D14902
2022-05-17 21:07:49 +02:00
b3b5d4cabb Merge branch 'blender-v3.2-release' 2022-05-17 17:34:51 +02:00
83349294b1 Fix T98201: Corrution of filepaths in some case during 'make relative' process.
We need to ensure `Main.filepath` is consistent with the current path
where we are saving the .blend file, otherwise some path processing code
can produce invalid results (happens with e.g. the code syncing the two
path storages in Library IDs).
2022-05-17 17:32:23 +02:00
8fdd3aad9b Fix T98163: Cycles OSL rendering normal maps differently
Match SVM and ensure valid reflection when setting up BSDFs.
2022-05-17 16:46:37 +02:00
0609b4bb49 Fix T98052: Eevee / Workbench background render crash with GPU subdivision
The problem is that depsgraph evaluation happens before the OpenGL context
is initialized, and so modifier evaluation happens without GPU subdivision.
Later the BKE_subsurf_modifier_can_do_gpu_subdiv test in the draw code gives
a different result.

This just checks if the mesh has information for GPU subdivision in the draw
code, and if so uses it. This is only set if the test for supported GPU
subdivision passes in the modifier evaluation.

Additionally it may be good to perform OpenGL context initialization earlier
so background render can take advantage of GPU subdivision, but this is more
complicated.

Differential Revision: https://developer.blender.org/D14969
2022-05-17 16:14:15 +02:00
8c9805fc62 Revert "Outliner: Remove the 'Remap data-block usages' operation."
This reverts commit 30534deced.

After discussion and feedback from users, it's better to keep this tool
available until there is time to properly re-think the whole Outliner's
contextual menu.
2022-05-17 16:09:28 +02:00
939c2387a1 Cleanup: blendloader: add logger to writefile.c, remove some asserts.
Properly use CLOG to report info or errors in `writefile.c`, instead of
printf's.

And remove some assert when logging error reports and the issue is not
critical.
2022-05-17 16:06:54 +02:00
b759a3eac0 Cleanup: Remove asserts when logging error messages.
If we produce CLOG_ERROR messages and the error is not actually
critical, there is no point in asserting too.

Mainly related to ID user counts, and a few other ID management areas.
2022-05-17 16:06:54 +02:00
7a31229011 Cleanup: Use BLI_assert_unreachable() as example in comment of _BLI_assert_abort.
Using `BLI_assert(0)` should typically be avoided now that we have
`BLI_assert_unreachable`...
2022-05-17 16:06:54 +02:00
fb2ae6b8c5 Cleanup: Use switch and BLI_assert_unreachable() more.
Replace some `if/else if` chains by proper `switch` statement.

Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
2022-05-17 16:06:54 +02:00
9a4cb7a732 Cleanup: Use switch and BLI_assert_unreachable() more.
Replace some `if/else if` chains by proper `switch` statement.

Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
2022-05-17 16:06:54 +02:00
6d42cd8ff9 Cleanup: Use switch and BLI_assert_unreachable() more.
Replace some `if/else if` chains by proper `switch` statement.

Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
2022-05-17 16:06:54 +02:00
22bf263269 Cleanup: Use switch and BLI_assert_unreachable() more.
Replace some `if/else if` chains by proper `switch` statement.

Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
2022-05-17 16:06:54 +02:00
c6e3242e18 Cleanup: Use switch and BLI_assert_unreachable() more.
Replace some `if/else if` chains by proper `switch` statement.

Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
2022-05-17 16:06:54 +02:00
ff2d6c2ba8 Cleanup: Use switch and BLI_assert_unreachable() more.
Replace some `if/else if` chains by proper `switch` statement.

Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
2022-05-17 16:06:54 +02:00
c8b740cc00 Merge branch 'blender-v3.2-release' 2022-05-17 16:06:27 +02:00
Aleš Jelovčan
dbc439e41a Fix unreported: GPencil Time offset modifier Reverse only plays 2 times
This patch fixes long standing issue of reverse mode only performing loop 2 times and then stops displaying.

Differential revision: https://developer.blender.org/D14921
2022-05-17 15:59:11 +02:00
dbb6016e94 Cleanup: fix compiler warning 2022-05-17 15:36:22 +02:00
200e63b0bf Fix: Copy and paste error in curves RNA
Use a similar solution for meshes for curves symmetry updating.
2022-05-17 14:59:31 +02:00
ed62b65474 Cleanup: Use const in curves sculpt code
This makes it much clearer what data is supposed to be modified
and what data is just used to influence the operation. The new
`BKE_paint_brush_for_read` function isn't great design, but it
can be removed or renamed if similar changes are applied to
more places.

Also pass pointers explicitly to `sample_curves_3d_brush` rather
than reusing the `bContext`. This makes it clearer what data the
function actually needs.

Differential Revision: https://developer.blender.org/D14967
2022-05-17 13:06:14 +02:00
3ad5510427 Cleanup: Order return arguments last 2022-05-17 13:02:41 +02:00
af6765a49c EEVEE-Next: Fix missing break in switch statement 2022-05-17 12:49:00 +02:00
3ccdc362da EEVEE-Next: Add camera module 2022-05-17 12:39:02 +02:00
46114f0a36 DRW: Add DRW_view_camtexco_get() 2022-05-17 12:34:35 +02:00
c7033bdf26 DRWWrapper: Add StorageFlexibleBuffer
This buffer resizes on access.
2022-05-17 12:34:35 +02:00
65fa34f63f DRW: Add SwapChain container to allow easier usage of double buffering
The template also takes the length of the chain to allow triple buffering.
2022-05-17 12:34:35 +02:00
f9ed31b15d Merge branch 'blender-v3.2-release' 2022-05-17 11:31:59 +02:00
4301b6c896 Fix console errors about missing properties in circle select
A regression since 113b8030ce: circle selection operators does not
define properties like deselect_all and a special name callback is to
be used for those.

This is what was already done for circle select in the 3D viewport.
Some other spaces were using the generic pick operator for the circle
selection which causes error prints in the console.
2022-05-17 11:23:04 +02:00
f752eaadbd Remove incorrect poll method from object.instance_offset_from_cursor
Remove poll method from the `OBJECT_OT_instance_offset_from_cursor`
operator. It was checking for `context.active_object`, but not even doing
anything with the active object. It'll get in the way of exposing this
operator in another area of the interface, though.
2022-05-17 11:00:04 +02:00
c582a2dbd9 Merge branch 'blender-v3.2-release' 2022-05-17 18:12:41 +10:00
eddfa811da Preferences: Moved Sculpt texture paint to prototypes.
Sculpt texture paint should not be considered as a new feature just yet. There
are many designs still missing that could drive changes.
2022-05-17 10:12:22 +02:00
bdb5a50682 Update tests to account for Text.as_string not adding a trailing newline
Regression in tests from [0] tests were written to assume a newline was
added to the result of Text.as_string which is no longer the case.

[0]: f4ff36431c
2022-05-17 18:11:16 +10:00
080e506e28 Merge branch 'blender-v3.2-release' 2022-05-17 17:50:50 +10:00
fcc3a68cac Merge branch 'blender-v3.2-release' 2022-05-17 17:50:45 +10:00
a4ed0f51c1 Fix click detection for simulated events
Refactoring event click-drag detection broke click detection for
simulated events. Resolve this by sharing logic for update previous
values in `wmWindow.eventstate` for regular event handling
(no functional changes for non-simulated events). Failure to detect
clicks for simulated events broke the undo test
`test_undo.view3d_multi_mode_select` in `../lib/tests/ui_simulate/run.py`.
All undo tests now pass.
2022-05-17 17:49:40 +10:00
f4ff36431c Fix text.as_string() adding a trailing new-line
Moving Text.as_string() from Python to C [0] added an extra new-line
causing a round-trip from_string/to_string to add a new-line,
this also broke the undo test `test_undo.text_editor_simple` in
`../lib/tests/ui_simulate/run.py`.

[0]: 231eac160e
2022-05-17 17:49:32 +10:00
f11401d32a Cleanup: Deduplicate Alembic procedural bounding box mesh creation
This removes the manual construction of a box mesh in the mesh sequence
cache modifier when the Alembic procedural is enabled. It also removes
the use of `BKE_object_boundbox_get` which doesn't make sense on a
non-evaluated object.

Differential Revision: https://developer.blender.org/D14958
2022-05-17 09:41:32 +02:00
51195c17ac Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-17 00:30:54 -07:00
210d0f1b80 Fix T96414: Stencil mapping is incorrect for UDIMs
When texture painting, brush textures and brush texture masks were not
transformed to account for UDIM tiles.

Differential Revision: https://developer.blender.org/D14671
2022-05-17 00:27:23 -07:00
c93f3b4596 Cleanup: spelling in comments 2022-05-17 15:34:02 +10:00
1a740c2541 Fix T98185: Assertion saving while fullscreen
When saving from the menu the region was not set,
causing the last region in `area->regionbase` to be used
as the region was assigned before comparison.
2022-05-17 15:16:54 +10:00
48c4c409b8 Fix DPX/CINEON writing full file paths into image headers on WIN32
Use back-slashes to find the file-name component on windows.
2022-05-17 12:54:05 +10:00
5c9ab3e003 Cleanup: use term 'filepath' for full file paths 2022-05-17 12:54:05 +10:00
77ddcc4717 ImBuf: replace exit(1) with assert when writing IRIS images
In this case memory past the buffer bounds would have been written,
potentially crashing. Replace the check with an assert since this
should never happen.

Also don't call exit as failing to write a file shouldn't exit Blender.
2022-05-17 10:50:21 +10:00
7bbf101082 Cleanup: better doc-string for iris, order args & use const variables 2022-05-17 10:43:40 +10:00
1660eff1a2 Cleanup: format 2022-05-17 10:06:13 +10:00
405d32bc80 Cleanup: compiler warnings 2022-05-17 10:01:30 +10:00
8c4bd02b06 VSE: Delete Strip and Scene Data in one step
Actually, delete the strip only deletes the container, but not the linked data. This patch adds the option to delete the scene also. This is very handy for storyboarding.

Reviewed By: ISS

Maniphest Tasks: T97683

Differential Revision: https://developer.blender.org/D14794
2022-05-16 20:20:44 +02:00
be84fe4ce1 VSE: Add new Scene and Strip
This operator allows to add a new scene at the same time that the strip. This is very handy for storyboarding.

Reviewed By: ISS

Maniphest Tasks: T97678

Differential Revision: https://developer.blender.org/D14790
2022-05-16 19:46:20 +02:00
205c6d8d08 VSE: New Change Scene option in Change menu
This is a new option in `C` key menu.

Reviewed By: mendio, ISS

Maniphest Tasks: T97711

Differential Revision: https://developer.blender.org/D14807
2022-05-16 19:41:50 +02:00
6065fbb543 Fix std::optional value() build error on older macOS SDK
No longer happens on the buildbot, but for users building with an older
Xcode, still need to avoid using value().

Differential Revision: https://developer.blender.org/D14883
2022-05-16 19:08:08 +02:00
4be79da9a7 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-16 18:17:37 +02:00
a2dacefb46 Fix T96289: Crash when accessing mesh via ob.data in a driver
Fix a crash when a driver variable targets an object and uses
`data.shape_keys.key["name"].value` in its expression.

The fix consists of adding an extra relation from the targeted object's
`GEOMETRY` component to the driver evaluation. This ensures that its
`data` pointer has been evaluated by the depsgraph and is safe to
follow.

This also resolves the concern raised on rB56407432a6aa.

Reviewed by: brecht

Differential Revision: https://developer.blender.org/D14956
2022-05-16 18:16:18 +02:00
00af3e9472 Fix: Node editor "Group" panel displays for embedded node trees
Embedded node trees are not groups, since their inputs and outputs
are not exposed anywhere. So these panels should not be displayed.
2022-05-16 17:17:16 +02:00
b8c30fb80a Fix image saving incorrectly overrding non-color data color space
In such cases we should not automatically change the color space.
2022-05-16 17:04:09 +02:00
c729ddd741 LibOverride: Do not write Surface Deform modifier binding data.
Skip writing binding data and similar for override modifiers already
present in reference linked data, as this can use a lot of space, and
is fully useless data typically since we already skip writing Mesh
geometry data itself.

Ref. T97967.
2022-05-16 16:56:27 +02:00
5973950b2a LibOverride: Do not write Laplacian Deform modifier binding data.
Skip writing binding data and similar for override modifiers already
present in reference linked data, as this can use a lot of space, and
is fully useless data typically since we already skip writing Mesh
geometry data itself.

Ref. T97967.
2022-05-16 16:56:27 +02:00
e9d7c05754 LibOverride: Do not write Corrective Smooth modifier binding data.
Skip writing binding data and similar for override modifiers already
present in reference linked data, as this can use a lot of space, and
is fully useless data typically since we already skip writing Mesh
geometry data itself.

Ref. T97967.
2022-05-16 16:56:27 +02:00
b66368f3fd LibOverride: Do not write MeshDeform modifier binding data.
Skip writing binding data and similar for override modifiers already
present in reference linked data, as this can use a lot of space, and
is fully useless data typically since we already skip writing Mesh
geometry data itself.

Ref. T97967.
2022-05-16 16:56:27 +02:00
Bastien Montagne
68d203af0b Refactor modifiers writing code.
This changes is needed to give more control to modifiers' writing
callback when defined. It will allow to implement better culling of
needless data when writing e.g. modifiers from library overrides.

Ref. T97967.

Reviewed By: brecht, JacquesLucke

Differential Revision: https://developer.blender.org/D14939
2022-05-16 16:56:27 +02:00
Martijn Versteegh
f1beb3b3f6 Cleanup: make functions for setting active/render layer more consistent
The active/render layer is indexed from the first layer of that type. These functions
incorrectly subtracted the layer index of *each* layer, instead of the first one.
If there's only a single layer this doesn't matter, but when there are multiple layers
it will set the wrong active layer for consecutive layers.

I'm not aware of any actual errors caused by this, because the active and render layers are
only ever queried from the first layer of that type, but it was confusing during debugging a
related issue. This patch makes the behavior of CustomData_set_layer_active_index()
consistent with CustomData_set_layer_active() and the same for render.

Differential Revision: https://developer.blender.org/D14955
2022-05-16 16:34:25 +02:00
b98175008f Cleanup: Tracking, clarify comment 2022-05-16 15:52:54 +02:00
Jeroen Bakker
00eb7594b1 3D Texturing: Undo.
Blender can only support a single undo system per undo step. As sculpting/vertex colors are mutual exclusive operations
out approach is just to switch the undo system when painting on an image.

PBVHNodes contain a list of areas that needs to be pushed to the undo system.

Currently the undo code is in sculpt_paint_image. We should eventually support undo for color filtering and other nodes.
we might need to place it to its own compile unit so more brushes can invoke the same code.

{F13048942}

Reviewed By: brecht

Maniphest Tasks: T97479

Differential Revision: https://developer.blender.org/D14821
2022-05-16 15:42:54 +02:00
0d80c4a2a6 Merge branch 'blender-v3.2-release' 2022-05-16 15:39:34 +02:00
9bd905e73f GPencil: Refine Tooltip for Noise modifier
Feedback by @HooglyBoogly
2022-05-16 15:38:26 +02:00
9df91654dc Fix T98136: Crash undoing "Make Library Override" in some cases.
The 'OVERRIDE_HIDDEN' extra collection would often be mistakenly added
to a linked collection, which is totally forbidden and guaranteed to
crash on undo/redo.

Reworked the code instantiating that extra collection in a more generic
and hopefully robust way now.
2022-05-16 15:37:07 +02:00
f1c27b383b Merge branch 'blender-v3.2-release' 2022-05-16 15:21:27 +02:00
29a3f43da5 Python API: make Image.save and Image.save_render more consistent with operator
Previously these only supported a subset of what the save operator could do,
for example no multilayer or stereo saving, no proper color management. Now
share code with the image save operator so it's more consistent.
2022-05-16 15:20:23 +02:00
Olivier Maury
48754bc146 Fix T97867: Cycles MNEE blocky artefacts for rough refractive interfaces
Made tangent frame consistent across the surface regardless of the sample,
which was not the case with the previous algorithm. Previously, a tangent
frame would stay consistent for the same sample throughout the walk, but not
from sample to sample for the same triangle. This actually resulted in code
simplification.

Also includes additional fixes:

* Fixed an important bug that manifested itself with multiple lights in the
  scene, where caustics had abnormally low amplitude: The final light pdf did
  not include the light distribution pdf.
* Removed unnecessary orthonormal basis generation function, using cycles'
  native one instead.
* Increased solver max iteration back to 64: It turns out we sometimes need
  these extra iterations in cases where projection back to the surface takes
  many steps. The effective solver iteration count, the most expensive part,
  is actually much less than the raw iteration count.

Differential Revision: https://developer.blender.org/D14931
2022-05-16 15:11:54 +02:00
adf183eeae Fix T98153: bpy.ops.image.save_as not working from Python, after recent changes
Make exec and invoke consistent so they both use operator properties if set.
2022-05-16 13:29:22 +02:00
93bcfd19ba Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-16 13:05:57 +02:00
8c24e29338 Fix broken unit test bl_rigging_symmetrize
Fix parameters used in `self.assertAlmostEqual()` call; the code was
passing the error message to the `places` parameter.
2022-05-16 13:03:06 +02:00
cef36f4a95 Cleanup: Remove confirmation poopup from 'make override' 3DView operator.
Inherited from older versions of the code, not needed anymore in most
common cases (like making override from a local empty instantiating a
collection, or if the active object is directly overridable).
2022-05-16 12:24:42 +02:00
717c150eb1 Merge branch 'blender-v3.2-release' 2022-05-16 11:01:01 +02:00
2397287a51 Fix T96503: Assert using PropertyGroup and PointerProperty prop in Panel.
Wrong assert introduced in {rBad63d2f60e24}, added comment in code
explaining why NULL RNA pointer is a valid value to be skipped here.
2022-05-16 10:58:51 +02:00
124aae91e2 Cleanup: shadowing warning 2022-05-16 12:10:38 +10:00
7fc2804f45 Fix: Build error on Windows after recent cleanup 2022-05-15 21:59:10 +02:00
84a7641563 Cleanup: Simplify loop syntax, make function static
Use range based for loops, spans, references, and slice.
Change split from D14685, in order to simplify refactor
to the mesh hide masks.
2022-05-15 20:59:08 +02:00
1c70402c62 Cleanup: Move three mesh editors files to C++
Simplifies refactoring in D14685, allows use of better data structures.
2022-05-15 20:41:11 +02:00
7b091fbb94 Cleanup: Remove includes from DerivedMesh header
Headers should only include other headers when absolutely necessary,
to avoid unnecessary dependencies and increasing compile times.
To make this change simpler, three DerivedMesh functions with a single
use were removed.
2022-05-15 20:27:28 +02:00
024f3ddf61 Cleanup: Clang tidy 2022-05-15 19:33:37 +02:00
ee0c05e886 DRW: Remove accidentaly commited stray global variable 2022-05-15 19:24:10 +02:00
b8de9916ed Fix T98049: crash rendering multilayer EXR with some color spaces 2022-05-15 17:47:20 +02:00
e46a38942a Cleanup: Simplify loop syntax, decrease variable scope
Mostly changes split from D14685, which refactors the hide flags.
2022-05-15 15:41:46 +02:00
3e989e8c8d GPUVertBuf: Add support for binding as buffer texture
This is often needed and somehow cumbersome to set up. This will allow some
code simplifications.
2022-05-15 15:22:47 +02:00
b44cec0eca Cleanup: Remove unused DerivedMesh function 2022-05-15 12:20:13 +02:00
450a190095 Cleanup: Remove unused subsurf ccg functions
This simplifies some refactoring to mesh hide flags (see D14685).
2022-05-15 12:12:14 +02:00
901fc29df1 Cleanup: Fix compile warnings on windows 2022-05-15 11:46:38 +02:00
dcaaa5b6f4 Merge branch 'blender-v3.2-release' 2022-05-15 01:46:42 -07:00
b54abd7ede Fix T80174: Dyntopo not initializing face set values correctly
BMLog was zeroing face sets when creating new faces,
which is not valid.  They're now set to 1.
2022-05-15 01:44:09 -07:00
a46f34d9b3 Merge branch 'blender-v3.2-release' 2022-05-15 00:36:42 -07:00
f9751889df Fix T81715: Unprojected radius mode messes up sculpt texture radius
We really need to fix how unprojected radius (scene unit) works.
What happened is the paint code updates the brush's normal radius
with the current unprojected pixel radius, which was then
used by texture brush tiled mode.

To fix this I just cached the pixel radius at stroke start in
UnifiedPaintSettings->start_pixel_radius.
2022-05-15 00:33:22 -07:00
139a4b6a84 Fix: Build error due to previous commit 2022-05-14 19:46:56 +02:00
ea5bfedb49 Cleanup: Further use of const for retrieved custom data layers
Similar to cf69652618.
2022-05-14 18:57:52 +02:00
e1c8ef551f Cleanup: Use const arguments 2022-05-13 19:20:55 +02:00
c2bbd01b2f Cleanup: Use const arguments 2022-05-13 19:13:43 +02:00
7c9b6cc380 LineArt: Better behavior of smooth tolerance.
This fixes the smooth tolerance feature in master where sometimes you could
get over simplified chains and lose the shape it's supposed to be originally.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D14929
2022-05-14 00:56:09 +08:00
ee363ee7b3 Cleanup: Use standard variable names for curves 2022-05-13 18:44:09 +02:00
cf69652618 Cleanup: Use const when retrieving custom data layers
Knowing when layers are retrieved for write access will be essential
when adding proper copy-on-write support. This commit makes that
clearer by adding `const` where the retrieved data is not modified.

Ref T95842
2022-05-13 18:35:22 +02:00
fa7224d8ed Merge branch 'blender-v3.2-release' 2022-05-13 18:07:31 +02:00
074c695a0d Fix T98072: Regression: When appending a Scene, the Collections that are excluded get instanced into Current Scene.
This was due to using `BKE_scene_has_object` function, which uses the
cache of bases of the viewlayers, which do not have entries for the
content of excluded collections... Now use
`BKE_collection_has_object_recursive` instead.
2022-05-13 18:05:44 +02:00
870ad7d05d Fix T96781: LineArt proper object iterator.
This patch get rid of the _incorrectly used_ DG iterator in object loading,
and uses scene objects iteration to prevent problems.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D14907
2022-05-14 00:04:16 +08:00
ca2fb9bae9 Fix possible null-pointer dererence for active button data
The button returned from `UI_region_active_but_get()` is not guaranteed
to have active button data, so code can't rely on that.
2022-05-13 17:56:28 +02:00
8e717ce55a Fix crash when displaying some button tooltips
Steps to reproduce were:
- Factory startup
- Right-click in 3D View
- Move the mouse over "Shade Flat", wait for the tooltip

The changed logic in 4680331749 to lookup an active button was
incorrect. It didn't respect the priority of active button candidates.
2022-05-13 17:56:18 +02:00
Brecht Van Lommel
5baa3ecda6 Color Management: various improvements and fixes for image saving
* Respect the image file color space setitng for saving in various cases where
  it was previously ignored. Previously it would often use the sRGB or Linear
  color space even when not selected.
* For the Save As operator, add a Color Space option in the file browser to
  choose the color space of the file. Previously this was chosen automatically,
  now it's possible to e.g. resave a Linear image as Linear ACES.
* When changing the file format, the colorspace is automatically changed to an
  appropriate color space for the file format. This already happened before, but
  there was no visibility or control in the operator settings for this.
* Don't change color space when using the Save operator to save over the same
  file.
* Fix missing color space conversion for 16 bit PNGs, where it assumed wrongly
  assumed ibuf->rect would be used for saving. Add BKE_image_format_is_byte to
  more accurately test this.

Fixes T74610

Ref T68926

Differential Revision: https://developer.blender.org/D14899
2022-05-13 17:55:54 +02:00
1e4cd98f0a Fix build error without unity build after recent changes
float3 should have been declared within the blender namespace. And forward
declaration is difficult with templated classes so just include header.
2022-05-13 17:55:54 +02:00
8d43ee1b08 Fix T97518: All buttons with eyedropper highlight if one is hovered
Issue is that the operator acts on the active button, and also uses that in the
poll. So the actually active button would affect the poll of a different
button. For the superimposed icons we need to be able to execute these polls
properly for non-active buttons.

This enables temporarily overriding the active button for lookups via context.
While a bit of a hack it makes sense conceptually.

Reviewed By: Campbell Barton

Maniphest Tasks: T97518

Differential Revision: https://developer.blender.org/D14880
2022-05-13 17:55:52 +02:00
7c9c13cf83 Fix possible null-pointer dererence for active button data
The button returned from `UI_region_active_but_get()` is not guaranteed
to have active button data, so code can't rely on that.
2022-05-13 17:54:12 +02:00
908e6c7c4d Fix crash when displaying some button tooltips
Steps to reproduce were:
- Factory startup
- Right-click in 3D View
- Move the mouse over "Shade Flat", wait for the tooltip

The changed logic in 4680331749 to lookup an active button was
incorrect. It didn't respect the priority of active button candidates.
2022-05-13 17:54:12 +02:00
3f952b3ca3 Merge branch 'blender-v3.2-release' 2022-05-13 17:35:18 +02:00
c2d2cd1468 Fix: Incorrect order in geometry nodes add menu 2022-05-13 17:34:11 +02:00
a0748153b4 Tracking: Move all selection logic to operator exec()
Unlikely that users will notice this, but this makes it so that
the operator behaves consistently across its exec() and invoke()
code paths.
2022-05-13 17:21:55 +02:00
a80ad0a545 Refactor: Use coordinate in API for track selection
Currently no functional changes. Prepares for a change which will
allow to more consistently redo the track selection operator.
2022-05-13 17:18:25 +02:00
4680331749 Fix T97518: All buttons with eyedropper highlight if one is hovered
Issue is that the operator acts on the active button, and also uses that in the
poll. So the actually active button would affect the poll of a different
button. For the superimposed icons we need to be able to execute these polls
properly for non-active buttons.

This enables temporarily overriding the active button for lookups via context.
While a bit of a hack it makes sense conceptually.

Reviewed By: Campbell Barton

Maniphest Tasks: T97518

Differential Revision: https://developer.blender.org/D14880
2022-05-13 15:55:11 +02:00
6f3d155293 Merge branch 'blender-v3.2-release' 2022-05-13 23:42:06 +10:00
05b56d55e8 Fix T97386: Node socket labels swallow click/drag events
Regression caused by [0] which made `ui_but_is_interactive` consider
label buttons with tool-tips to be interactive. This prevented
the clicks to pass through to the nodes for selecting/dragging.

Resolve this by allowing buttons to be activated for the purpose
of showing tool-tips but otherwise considering them disabled
(as if the UI_BUT_DISABLED is set when handling events).

[0]: 484a914647

Reviewed By: Severin

Ref D14932
2022-05-13 23:41:03 +10:00
d6c4317f35 Fix jump when switching accurate marker sliding
As a side effect the "sticky" search area on resize/move is also
resolved now: previously attempt to move search area past to where
it could be would make it hard to move it back. Now the search area
will always respond immediately to mouse motion, even after it got
clamped.
2022-05-13 14:12:01 +02:00
7533bee58b Cleanup: Remove dead code in tracking slide operator
The code was there prior pattern area affine transform and was never
used afterwards.

After so long time it should be safe to remove the unused code.
2022-05-13 14:12:01 +02:00
94ad77100c Merge branch 'blender-v3.2-release' 2022-05-13 12:55:24 +02:00
cbc024c3ca MacOS/AMD: Drawing artifacts in VSE.
Related to the partial revert done for T97272. It seems also that the
workaround should be enabled for any MACOS platform.
2022-05-13 12:54:41 +02:00
6e2270f3d3 Merge branch 'blender-v3.2-release' 2022-05-13 12:47:33 +02:00
e30ccb9a34 Fix crash toggling marker translate with marker offset
The shortcut is G-G.

Caused by loop argument "shadowing".
2022-05-13 12:39:40 +02:00
58555ccc7a Cleanup: format (with autopep8 line wrapping applied) 2022-05-13 19:22:52 +10:00
8741cf2038 Cleanup: Proper state check in marker slide operator
The previous code was had confusing logic, but since it was acting
more as a fall-back it did not cause bugs for users.
2022-05-13 10:42:28 +02:00
42d748be34 pyproject: re-enable line wrapping for autopep8
The problem noted in the configuration file no longer occurs,
re-enabling line wrapping (E501).
2022-05-13 18:05:07 +10:00
fa9e878e79 Fix T97330: UV points missing with some modifiers
When extracting UV point indices, only the vertex points coming from the
original geometry should be drawn. For this, the routines (for subdivision
and coarse meshes) would only consider a vertex to be real if the extraction
type is `MAPPED`, and that an origin index layer on the vertices exist
with a valid origin index for the current vertex.

However, if the extraction type is `MESH`, which can happen with for
example an empty Geometry Node modifier, or with deferred subdivision,
this would consider every vertex to not be "real" and therefore hidden from
the UV editor.

This reworks the condition for "realness" to also consider a vertex to be
real if there is no origin layer on the vertices. The check on the extraction
type is removed as it becomes redundant.

This only modifies the check in the UV data extraction for point indices,
however similar checks exist throughout the extraction code, these will
be dealt with separately in master.

Differential Revision: https://developer.blender.org/D14773
2022-05-13 09:26:34 +02:00
0d1b9eabf2 Merge branch 'blender-v3.2-release' 2022-05-13 16:14:29 +10:00
3e5cb7b23e Merge branch 'blender-v3.2-release' 2022-05-13 16:14:26 +10:00
b3938d2a36 Merge branch 'blender-v3.2-release' 2022-05-13 16:14:20 +10:00
113b8030ce Fix T89909: Circle Select tool status bar doesn't match the operations
Assign get_name functions for select picking and circle select
so modifier keys show the result of holding the modifiers.
2022-05-13 16:09:04 +10:00
470cbad51a Fix T97872: Annotation lines lost AA
Since rB2a7a01b339ad, `lineSmooth` has lost its default value of true.

rBa0a99fb25284 only fixed the problem on master.

But thanks to @hitrpr for spotting the bug in version 3.2 too.

Differential Revision: https://developer.blender.org/D14876
2022-05-12 22:22:27 -03:00
427a2c920a Cleanup: spelling in comments, capitalize tags
Also add missing task-ID reference & remove colon after \note as it
doesn't render properly in doxygen.
2022-05-13 09:29:25 +10:00
906b9f55af Cleanup: remove redundant float to byte conversion for stereo image saving
For non-stereo cases this is automatically handled by IMB_saveiff, no reason for
stereo to do this separately.

Ref D14899
2022-05-12 22:58:27 +02:00
c0df1cd1b3 Cleanup: remove redundant code and data copying image save as operator
Store ImageSaveOptions directly in operator custom data instead of copying
to/from a copy on the stack.

Ref D14899
2022-05-12 22:58:27 +02:00
1159b63a07 Cleanup: move image save options init to image_save.cc
The logic here is tightly coupled to the other image saving code.

Ref D14899
2022-05-12 22:58:27 +02:00
6044c6d09b Cleanup: remove unused function declaration 2022-05-12 22:58:27 +02:00
c09cfdb251 DRW: Fix Compilation on OSX
Caused by rBe4bb898e40ee
2022-05-12 22:10:59 +02:00
Jason Fielder
073139e329 Metal: MTLState module implementation.
MTLState module implementation and supporting functionality in MTLContext for state tracking, texture binding and sampler state caching.

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14827
2022-05-12 20:50:11 +02:00
992ae3f282 DRW: Port draw_shader to C++ 2022-05-12 20:40:23 +02:00
e4bb898e40 DRW: Port draw_hair to C++ 2022-05-12 20:40:23 +02:00
f3f7f8b37b Cleanup: Remove unused gpu_shader_geometry.glsl 2022-05-12 20:40:23 +02:00
17fc8db104 UI: Tweak Sculpting Trim icons
Update the trim icons so they don't show a dashed line. Instead they
have now a continuous red line.

This is important because the sculpting tools are planning to use the
same icons for selection as the regular tools. And those icons use
dashed line to represent selection.

Note the icon file has two new icons which are not used at the moment
(they are in the Unused collection):

* ops.generic.select_paint
* ops.generic.select_line
2022-05-12 18:55:09 +02:00
018acc5688 Build: patch USD to avoid using rdtscp instruction not available on older CPUs
Disable the new more accurate timing code, this is not needed for Blender.
In USD itself this code is disabled on macOS anyway, so it should operate fine
without it.

Ref T97950, T95206

Differential Revision: https://developer.blender.org/D14928
2022-05-12 18:38:51 +02:00
c5b67975cd Cleanup: Fix range loop construct warning 2022-05-12 17:51:03 +02:00
d634194cac Merge branch 'blender-v3.2-release' 2022-05-12 17:45:46 +02:00
2c784f44cf Cleanup: use proper naming in Warp modifier read/write code. 2022-05-12 17:45:16 +02:00
766340856d UI Code Quality: Use derived struct for hot-key buttons
`uiBut` contained a variable that was only used for these hot-key
buttons. This may also help getting rid of the `UI_BUT_IMMEDIATE` flag,
which is also only used for this button type. We are running out of
available bits for flags, so this would be useful.

Continuing the work from 49f088e2d0. Part of T74432.
2022-05-12 17:41:26 +02:00
d1f32b63eb Merge branch 'blender-v3.2-release' 2022-05-12 17:27:18 +02:00
32fd85e6f9 Fix (unreported) bad memory access in read/write code of MeshDeform modifier.
This abuse of one one size value to handle another allocated array of a
different size is bad in itself, but at least now read/write code of
this modifier should not risk invalid memory access anymore.

NOTE: invalid memory access would in practice only happen in case endian
switch would be performed at read time I think (those switches only check
for given length being non-zero, not for a NULL data pointer...).
2022-05-12 17:24:30 +02:00
b24f204e91 Cleanup: Clarify function name and comment logic
This is a bit tricky exceptional case, which originates to an original
motion tracking commit. Took a while to remember what it is ab out so
here is a comment for the future developers.
2022-05-12 17:20:54 +02:00
ccd18691fc Cleanup: Remove another unused hotkey button definition function
See f2c7b56f0f.
2022-05-12 17:05:37 +02:00
f2c7b56f0f Cleanup: Remove unused hotkey button definition function
This isn't used, and I also see any use for it short-term.
2022-05-12 16:56:14 +02:00
3693e1d8e8 Revert commits to increase button flag bitfield size
This reverts the commits 8d9d5da137,
59cd616534 and
98a04ed452.

The commits are causing issues with MSVC, see D14926. I'm working on a
different solution, but that will need some work.
2022-05-12 16:56:14 +02:00
Martijn Versteegh
c31f519954 CMake: Fix missing dependency in bf_editor_curves
curves_ops.cc uses RNA_Prototypes.h. so bf_rna
needs to build before bf_editor_curves.
2022-05-12 08:42:19 -06:00
d9effc1cc6 Fix T98071: Overlay: UV selection inverted bewteen vertex and edge select
Self describing title.

Also remove the layout inside the geometry shader as they are now generated
by the backend.
2022-05-12 15:11:07 +02:00
092cbacd8f Fix T98026 EEVEE: Refression Crash when rendering Cryptomatte passes
This was because the main `surface_vert.glsl` was changed to accomodate the
needs of the `ShaderCreateInfo` but was still used by the cryptomatte
shader. The fix is to include the same libraries as the material shaders
and bypass `attrib_load()`.
2022-05-12 13:58:14 +02:00
65d44093c9 Merge branch 'blender-v3.2-release' 2022-05-12 13:39:17 +02:00
2e8089b6bf Workaround for msvc compiler bug
https://developercommunity.visualstudio.com/t/Alias-template-inside-fold-expression-fa/10040507
2022-05-12 13:38:22 +02:00
dea5d22da1 Cleanup: remove warnings due to maybe-used variables
The variable was only used in some constexpr if-statements.
2022-05-12 13:03:12 +02:00
94a54ab554 Curves: add operator to convert hair particle system to new curves
This creates a new curves object with the name of the particle system.
The generated curves match the current evaluated state of the active hair
particle system.

Attachment information is not transferred currently.

Differential Revision: https://developer.blender.org/D14908
2022-05-12 12:55:50 +02:00
9757b4efb1 OBJ: improve new importer file parsing performance on windows
The OBJ parser was primarily using StringRef for convenience, with
functions like "skip whitespace" or "parse a number" taking an input
stringref, representing an input line, and returning a new stringref,
representing the remainder of the line. This is convenient, but does
more work than strictly needed -- while parsing, only the "beginning"
of the line ever changes by moving forward; the end of the line
always stays the same. We can change the code to take a pair of
pointers (begin of line, end of line) as input, and make the
functions return the new begin of line pointer. This makes the return
value neatly fit into a processor register, which StringRef did not.

On Windows, this does result in non-trivial speedups in the actual
OBJ file parsing part, due to Windows calling convention where return
values larger than 64 bits are returned via memory. Does not
measurably affect performance on Mac/Linux, because the calling
convention there uses a pair of 64-bit registers to return a
StringRef.

End-to-end times of importing several test files, on Windows
(VS2022 build, Ryzen 5950X):

- Monkey subdivided to level 6, no normals (220MB file): 1.25s -> 0.85s
- Rungholt minecraft level (270MB file): 7.0s -> 5.8s
- Blender 3 splash scene (2.4GB file): 49.1s -> 45.5s

The full import process has a lot of other overhead besides actual
OBJ file parsing (mostly creating actual blender objects out of
parsed data). In pure parsing, in the monkey test scene above, the
parsing part goes 1.0s -> 0.6s.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14936
2022-05-12 13:49:05 +03:00
f5077e057b Fix T97380 EEVEE: Weird motion-blur on curves
This was caused by the `mb_data->obmat[]` being wrong because they are
now shared between the particle system and the object.
But Hair need the dupli parent matrix instead of the object matrix.
Disabling `Show Emitter` option fixes the bug.

To avoid this problem, request a different `EEVEE_ObjectMotionData`
for particle systems using a different key pointer in the hash.
This is a bit dirty but there is less code polution using this workaround.

Differential Revision: https://developer.blender.org/D14911
2022-05-12 12:45:56 +02:00
207b0c2a0f Cleanup: De-duplicate region visibility logic in clip editor 2022-05-12 12:40:12 +02:00
dff11551de Merge branch 'blender-v3.2-release' 2022-05-12 20:13:16 +10:00
6f5d172d6c Fix error tagging vertices as loose in the screw modifier
Regression in 90a23dec46.
2022-05-12 20:12:36 +10:00
b04de6d180 Merge branch 'blender-v3.2-release' 2022-05-12 12:00:06 +02:00
77d3e6b439 Curves: Add notifier to update spreadsheet when sculpting 2022-05-12 11:58:11 +02:00
6dcda1b9aa Screw Modifier: avoid unnecessary normal calculation
Normals were being allocated, calculated & freed when the spin modified
merged was enabled.
2022-05-12 19:56:21 +10:00
89306a3a05 Cleanup: Use stronger typing in marker slide operator 2022-05-12 11:37:05 +02:00
87dd8dc740 Cleanup: Hide slide operator specific logic
Use a more semantically clear function in the tracking API.
2022-05-12 11:37:05 +02:00
993d17af90 Cleanup: Reduce indentation level in track slide operator 2022-05-12 11:37:05 +02:00
66dada123c Cleanup: Refactor marker area clamping
Switch from a single function with a lot of branching at its top level
to dedicated function calls with own documentation.
2022-05-12 11:37:05 +02:00
58fe38af9f Cleanup: Remove redundant marker clamping code path
Pattern is expected to be freely resized to any size, and the search
area s to become bigger when needed.

Remove confusing pattern size clamping which was actually clamping
search area.

There should be no functional changes.
2022-05-12 11:37:05 +02:00
a0e63bac02 Cleanup: Strong type for track path clear API
Replace a generic int value with an enum.

Should be no functional changes.
2022-05-12 11:37:05 +02:00
81f23ad57a Cleanup: Move tracking constants to be printable enums
Replace old-style define with an enumerator values. Also move to the
top of the file preparing for making those stronger typed.
2022-05-12 11:37:05 +02:00
ca5f832fe9 Cleanup: More proper sections in tracking code
Follows the code style
2022-05-12 11:37:05 +02:00
0c9892020b Cleanup: More proper sections in subdiv code
Follows the code style.
2022-05-12 11:37:05 +02:00
Ethan Hall
c21cc4dad5 Fix: Paint slot material assignment issues
There are two problems when adding a paint slot to an object without an
existing material. First, the `invoke` method creates a material on the
object. This modifies the object even if the operation is not executed.
Second, the fill color defaults to black when there is no existing
material (even when adding a normal, bump, or displacement layer).

This patch moves the material creation to the `exec` method.
When no material exists on the object, a default Principled BSDF is
referenced for default colors in the `invoke` method.

Differential Revision: https://developer.blender.org/D14828
2022-05-12 11:35:10 +02:00
9599c5415d Merge branch 'blender-v3.2-release' 2022-05-12 11:15:26 +02:00
cb5b33a627 Fix T98056: Screw modifier crash with normal calculation and merging
If merging is enabled, the mesh might be recreated before
the dirty flag can be cleared, which means the normals aren't
valid anymore. To fix this, clearing the dirty flag should happen
before the merging. This is an existing bug, just exposed by
more recent explicit dirty normal tagging.
2022-05-12 11:07:52 +02:00
31202ea628 Merge branch 'blender-v3.2-release' 2022-05-12 01:29:42 -07:00
0eb2244f0a color attributes: Fix broken vertex color node
Fall back onto the old behavior (use the render
color attribute) if the vertex color node's
attribute name is blank.
2022-05-12 01:29:13 -07:00
59637cf073 Merge branch 'blender-v3.2-release' 2022-05-12 17:50:11 +10:00
14175043e5 Merge branch 'blender-v3.2-release' 2022-05-12 17:50:05 +10:00
1242e8b93c Merge branch 'blender-v3.2-release' 2022-05-12 17:49:40 +10:00
295b6e8230 Fix T96367: Crash snapping to instances on an object
In rare cases the mesh has not been evaluated when snapping, this fix
just prevents the crash as is done elsewhere in Blender when the
evaluated mesh isn't available, there is a separate report (T96536)
about evaluation not working properly.
2022-05-12 17:42:43 +10:00
3b0a08b793 Cleanup: format 2022-05-12 14:07:15 +10:00
51fdf4bdfc Cleanup: discarded-qualifier warning, mixing enum/ints 2022-05-12 14:06:35 +10:00
578771ae4d UDIM: Add support for packing inside .blend files
This completes support for tiled texture packing on the Blender / Cycles
side of things.

Most of these changes fall into one of three categories:
- Updating Image handling code to pack/unpack tiled and multi-view images
- Updating Cycles to handle tiled textures through BlenderImageLoader
- Updating OSL to properly handle textures with multiple slots

Differential Revision: https://developer.blender.org/D14395
2022-05-11 20:11:44 -07:00
8d9d5da137 Cleanup (UI): Make space for more internal button flags
Having to manually increase all other flag values to be able to add a
new internal flag is quite annoying. Just make space for a few more
once.
Generally I'd say internal flags are preferable, since it increases
encapsulation. So good to avoid making this a hassle.
2022-05-11 18:29:20 +02:00
Loren Osborn
502e1a44b9 Cleanup: fix compiler warnings on macOS
Differential Revision: https://developer.blender.org/D14917
2022-05-11 18:03:26 +02:00
3e782bba71 Cleanup: Cycles, avoid 'parameter unused' warning
Avoid 'parameter unused' warning when building Cycles without
OpenImageDenoise.

No functional changes.

Over-the-shoulder reviewed by @sergey
2022-05-11 18:00:49 +02:00
007184bcf2 Enable inlining on Apple Silicon. Use new process-wide ShaderCache in order to safely re-enable binary archives
This patch is the same as D14763, but with a fix for unit test failures caused by ShaderCache fetch logic not working in the non-MetalRT case:

```
diff --git a/intern/cycles/device/metal/kernel.mm b/intern/cycles/device/metal/kernel.mm
index ad268ae7057..6aa1a56056e 100644
--- a/intern/cycles/device/metal/kernel.mm
+++ b/intern/cycles/device/metal/kernel.mm
@@ -203,9 +203,12 @@ bool kernel_has_intersection(DeviceKernel device_kernel)

   /* metalrt options */
   request.pipeline->use_metalrt = device->use_metalrt;
-  request.pipeline->metalrt_hair = device->kernel_features & KERNEL_FEATURE_HAIR;
-  request.pipeline->metalrt_hair_thick = device->kernel_features & KERNEL_FEATURE_HAIR_THICK;
-  request.pipeline->metalrt_pointcloud = device->kernel_features & KERNEL_FEATURE_POINTCLOUD;
+  request.pipeline->metalrt_hair = device->use_metalrt &&
+                                   (device->kernel_features & KERNEL_FEATURE_HAIR);
+  request.pipeline->metalrt_hair_thick = device->use_metalrt &&
+                                         (device->kernel_features & KERNEL_FEATURE_HAIR_THICK);
+  request.pipeline->metalrt_pointcloud = device->use_metalrt &&
+                                         (device->kernel_features & KERNEL_FEATURE_POINTCLOUD);

   {
     thread_scoped_lock lock(cache_mutex);
@@ -225,9 +228,9 @@ bool kernel_has_intersection(DeviceKernel device_kernel)

   /* metalrt options */
   bool use_metalrt = device->use_metalrt;
-  bool metalrt_hair = device->kernel_features & KERNEL_FEATURE_HAIR;
-  bool metalrt_hair_thick = device->kernel_features & KERNEL_FEATURE_HAIR_THICK;
-  bool metalrt_pointcloud = device->kernel_features & KERNEL_FEATURE_POINTCLOUD;
+  bool metalrt_hair = use_metalrt && (device->kernel_features & KERNEL_FEATURE_HAIR);
+  bool metalrt_hair_thick = use_metalrt && (device->kernel_features & KERNEL_FEATURE_HAIR_THICK);
+  bool metalrt_pointcloud = use_metalrt && (device->kernel_features & KERNEL_FEATURE_POINTCLOUD);

   MetalKernelPipeline *best_pipeline = nullptr;
   for (auto &pipeline : collection) {

```

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14923
2022-05-11 16:20:59 +01:00
59cd616534 UI: Update rest of UI code for increased button flag bitfield
Needed after 98a04ed452.
2022-05-11 17:07:02 +02:00
8d528241a9 Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-11 16:53:29 +02:00
2001ee6251 Fix T95710: Make Single User > Object Data Animation broken
The operator now not only checks `ob->data` for Actions to duplicate,
but also passes `ob->data` to the duplication function (instead of `ob`).
2022-05-11 16:52:43 +02:00
fa114cc4a0 Merge branch 'blender-v3.2-release' 2022-05-11 16:49:37 +02:00
06a7afb528 Fix T97947: USD will fail to export without file extension
Now add a default ".usdc" file extension if no (or the wrong) extension
is given instead of presenting the user with the error that "no suitable
USD plugin to write is found".

This is in line with how other exporters do this.

Maniphest Tasks: T97947

Differential Revision: https://developer.blender.org/D14895
2022-05-11 16:45:20 +02:00
a4382badb9 Curves: Adjust sculpt mode UI layouts
This patch adjusts the UI layouts for the tool header and the tool
properties in sculpt mode in a few ways. The goals are to better group
related settings, keep fundamental settings easily accessible, fix the
availability of some options, and make better use of space.

1. Remove ID template in tool header
2. Rename "Add Amount" to "Count" for add brush
3. Add "use pressure" toggles to radius and strength sliders
4. Move strength falloff to a popover
5. Move many "Add" brush settings to popover called "Curve Shape"
6. Move two "Grow/Shrink" options to a popover called "Scaling"
7. Don't display "Falloff" panel in properties when it has no effect

See the differential revision for screenshots and more reasoning.

Differential Revision: https://developer.blender.org/D14922
2022-05-11 15:47:49 +02:00
6599d2f03b Fix: Crash with empty curves add interpolate points
The neighbors for an added curve can be empty.
In that case use the constant value instead of interpolating.
2022-05-11 15:40:49 +02:00
e354ba701a Fix T97330: GPU Subdiv compiler error.
GLSL has different max number of ssbo per glsl stage.
This patch checks if the number of compute ssbo blocks matches
our requirements for the GPU Subdiv, before enabling it.

Some platforms allow more ssbo bindings then blocks per stage.
2022-05-11 15:29:52 +02:00
3eb3d363e1 Fix: Build error on windows.
Issue introduced by rBeef98e66cf9e

BLI_math_rotation.h uses M_PI which
gets defined inside BLI_math_base.h
2022-05-11 07:28:48 -06:00
edd892166d Fix T97330: GPU Subdiv compiler error.
GLSL has different max number of ssbo per glsl stage.
This patch checks if the number of compute ssbo blocks matches
our requirements for the GPU Subdiv, before enabling it.

Some platforms allow more ssbo bindings then blocks per stage.
2022-05-11 15:22:01 +02:00
007e95c259 Merge branch 'blender-v3.2-release' 2022-05-11 15:15:45 +02:00
a3f9862262 Fix (unreported) crash in Outliner Overrides Properties view in invalid cases.
We cannot try to get RNA info when the rna path of an override property
is invalid.
2022-05-11 15:14:44 +02:00
87978ff560 Cleanup: rename BLI_str_format_attribute_domain_size
This is useful without any functionality specific to attribute domains,
rename to `BLI_str_format_decimal_unit` to follow naming of a similar
function `BLI_str_format_byte_unit`.
2022-05-11 22:53:02 +10:00
fbf92f5967 Merge branch 'blender-v3.2-release' 2022-05-11 14:03:44 +02:00
b9d02b9ced Fix T97895: Eevee support for Geometry Nodes Color Attributes.
Geometry nodes can generate color attributes that aren't on point or corner domain.
When not found in these domains it will be processed as a common attribute.
2022-05-11 14:01:47 +02:00
Pablo Vazquez
eef98e66cf Mesh: Add Auto Smooth option to Shade Smooth operator
Add a property to the **Shade Smooth** operator to quickly enable the Mesh `use_auto_smooth` option.

The `Angle` property is exposed in the **Adjust Last Operation** panel to make it easy to tweak on multiple objects without having to go to the Properties editor.

The operator is exposed in the `Object` menu and `Object Context Menu`.

=== Demo ===

{F13066173, size=full}

Regarding the implementation, there are multiple ways to go about this (like making a whole new operator altogether), but I think a property is the cleanest/simplest.

I imagine there are simpler ways to achieve this without duplicating the `use_auto_smooth` property in the operator itself (getting it from the Mesh props?), but I couldn't find other operators doing something similar.

Reviewed By: #modeling, mont29

Differential Revision: https://developer.blender.org/D14894
2022-05-11 13:21:59 +02:00
6bd270f3af Fix "Open Clip" operator in Clip Editor broken
Steps to reproduce were:
- Open Clip Editor
- Call "Open Clip" (e.g. Alt+O)
- Select video file

The file wouldn't be loaded into the Clip Editor.

Caused by 7849b56c3c.
2022-05-11 13:18:45 +02:00
8c233cfd78 Merge branch 'blender-v3.2-release' 2022-05-11 20:58:59 +10:00
5045968f24 Revert "Gizmo: optimize intersection tests, fix selection bias"
Manually revert commit [0] as it caused problems macOS (reported T96435).

- Includes fixes from [1] & [2].
- T98037 TODO has been created to keep track of this feature.

Thanks to @jbakker & @sergey for investigating this issue as I wasn't
able to reproduce the bug.

[0]: 0cb5eae9d0
[1]: cb986446e2
[2]: cc8fe1a1cb
2022-05-11 20:55:10 +10:00
61202f6f74 Merge branch 'blender-v3.2-release' 2022-05-11 12:48:23 +02:00
49173399f3 Fix T97173: Color Attributes shading turns black after switching mode.
Sculpt colors tagged the custom data as already created (cd_used), but
should have been tagged as being requested (cd_needed).
2022-05-11 12:44:04 +02:00
b765ea52af Cleanup: Use single quotes for Python enum string 2022-05-11 12:12:11 +02:00
2f799f893e Fix: Hide empty panel in curves sculpt mode tool settings
This panel is empty after rB5b24291be1e0
2022-05-11 12:10:40 +02:00
74a5fb734a Fix: Spline parameter node broken for Catmull Rom curves
Subtracting one from the evaluated index could make the index -1.
That was only necessary for Bezier curves due to the specifics of
the "bezier_evaluated_offsets".
2022-05-11 11:33:52 +02:00
30534deced Outliner: Remove the 'Remap data-block usages' operation.
This feature is very advanced, and the way it was exposed in the
Outliner was very confusing at best.

It remains available through the Python API (`ID.user_remap`) e.g.
2022-05-11 11:25:02 +02:00
2d9a6e4f68 Outliner: Remove 'rename library' feature.
This was historically the only way to change/fix paths of library files
in Blender. However, only changing the path then required a manual
reload of the library, which could be skipped by user, or a save/reload
of the working .blend file, which could lead to corruption of advanced
library usages like overrides.

Prefferred, modern way to change path of a library is to use the
Relocate operation instead. Direct path modification remains possible
through RNA (python console or the Data API view in the Outliner.
2022-05-11 11:25:02 +02:00
be9800e8da Update Ceres to latest upstream version 2.1.0
This release deprecated the Parameterization API and the new Manifolds
API is to be used instead. This is what was done in the Libmv as part
of this change.

Additionally, remove the bundling scripts. Nowadays those are only
leading to a duplicated work to maintain.

No measurable changes on user side is expected.
2022-05-11 09:33:45 +02:00
b30cb05c14 Cleanup: spelling in comments/strings
D14918 from @linux_dr with some other changes included.
2022-05-11 17:02:06 +10:00
Jun Mizutani
195986a719 Fix: Curves interpolate point count option missing from panels
Added in 8852191b77

Differential Revision: https://developer.blender.org/D14919
2022-05-11 08:56:26 +02:00
8650c2b614 Merge branch 'blender-v3.2-release' 2022-05-11 16:34:39 +10:00
82a70ffe40 Merge branch 'blender-v3.2-release' 2022-05-11 16:34:37 +10:00
c0546ff953 Merge branch 'blender-v3.2-release' 2022-05-11 16:34:33 +10:00
0c5a7ca117 Merge branch 'blender-v3.2-release' 2022-05-11 16:34:31 +10:00
ec53e9fa69 Merge branch 'blender-v3.2-release' 2022-05-11 16:34:28 +10:00
ae683a22c6 Merge branch 'blender-v3.2-release' 2022-05-11 16:34:25 +10:00
87d74d03bf Merge branch 'blender-v3.2-release' 2022-05-11 16:34:22 +10:00
8e476c414c Merge branch 'blender-v3.2-release' 2022-05-11 16:34:17 +10:00
690ecaae20 Fix T97153: Knife project crashes
Knife projection BVH-tree lookup could use invalid indices since the
mesh being cut is also used for BVH intersection tests.

Solve by storing triangle indices when knife project is used so a
triangle index can always be used to look up original coordinates of a
triangle.
2022-05-11 16:28:37 +10:00
067f0d40ae Fix knife tool use-after free on completion
Regression in [0] accessed knife data after it had been freed.

[0]: f87029f7b1
2022-05-11 16:28:37 +10:00
a652568570 Cleanup: use 'num' / 'size' suffix instead of 'sz'
GPU code used `sz` as an abbreviation for size, as well as a few other
places. Use size where this represents a size in bytes, see: T85728.
2022-05-11 13:40:09 +10:00
2fa2612b06 Cleanup: use '_num' / '_count' suffix instead of '_ct'
Use num & count (for counters), in drawing code, see: T85728.
2022-05-11 13:38:00 +10:00
42e275a7d4 Cleanup: use '_num' suffix, mostly for curves & spline code
Replace tot/amount & size with num, in keeping with T85728.
2022-05-11 13:38:00 +10:00
8f1a11c35a WM: clear wmEvent.flag for file-select events
Harmless but could cause file-select events to have WM_EVENT_IS_REPEAT
set which logged a warning as this is only intended for keyboard events.
2022-05-11 11:02:01 +10:00
17ab0342ac Cleanup: spelling in comments
Revert change from [0] that assumed UNORM was a mis-spelling of UNIFORM.

[0]: 2c75857f9f
2022-05-11 11:02:01 +10:00
0091c97b32 Cleanup: use '_num' suffix instead of '_size' for CurveGeometry
Follow conventions from T85728.
2022-05-11 11:02:01 +10:00
f9e0b94c2f Cleanup: format 2022-05-11 11:02:01 +10:00
baf8ec2e54 Cleanup: use doxy sections for node_edit.cc 2022-05-11 11:02:01 +10:00
046b45749c Fix cursor snap not acting on selected UVs
Regression in rBd2271cf939.
2022-05-10 21:22:16 -03:00
1bb7fda600 CMake: Fix noisy PUGIXML warning.
When doing a lite build, a warning is displayed
that due to PUGIXML being off WITH_CYCLES_OSL
is being disabled as well.

If WITH_CYCLES is off this is just useless
noise.

this diff changes the warning to only emit when
WITH_CYCLES is on.
2022-05-10 16:38:20 -06:00
b47c5505aa Fix T96892 Overlay: Hiding all of a mesh in edit mode causes visual glitch
This is caused by the geometry shader used by the edit mode line drawing.
If the drawcall uses indexed drawing and if the index buffer only contains
restart indices, it seems the result is 1 glitchy invocation of the
geometry shader.

Workaround by tagging these special case index buffers and bypassing
their drawcall.
2022-05-10 23:36:16 +02:00
74228e2cd2 Fix T97945: Cycles baking max distance is wrong
It was effectively sqrt(max_distance) before this fix.

Thanks to Omar Emara for identifying the solution.
2022-05-10 20:55:03 +02:00
81b797af66 Fix T97908: Cycles missing motion from on pointcloud generated by geometry nodes
Assume geometry is always potentially animated, since we can't use our heuristic
to detect if the object is potentially animated by looking at modifiers on the
object.

The main original reason for this check was to avoid evaluating subdivision
surfaces for many static objects, which is not happening here anyway.
2022-05-10 20:45:30 +02:00
28240f78ce UI: Geometry Nodes Icon
Geometry Nodes (new) icon. So far we were using the generic node-tree
icon for geometry nodes, not anymore.

The new icon is composed of 4 spheres that is a reference to the
original pebbles demo. Scattering points was also the turning point for
the project (which originally was focusing on dynamic effects), and to
this day is one of the first steps for everything procedural such as
hair.

Note that the modifier icon is still showing as white in the outliner.
The alternative is to be blue everywhere.

Patch review and feedback by Hans Goudey.

Icon creation in collaboration with Pablo Vazquez.
2022-05-10 19:33:49 +02:00
Mikhail Matrosov
dcce4a59a0 Fix T97966: Cycles shadow terminator offset wrong for scaled object instances
Differential Revision: https://developer.blender.org/D14893
2022-05-10 18:53:14 +02:00
Olivier Maury
dc55e095e6 Fix T97056: Cycles MNEE not working with glass and pure refraction BSDFs
Differential Revision: https://developer.blender.org/D14901
2022-05-10 18:51:02 +02:00
c171c99fa1 Fix part of T97895: Cycles not rendering edge domain attributes
These aren't really ideal for rendering, but better to show something. Edge
values are averaged at vertices.
2022-05-10 18:29:00 +02:00
8852191b77 Curves: Interpolate point count in add brush
This commit adds an option to interpolate the number of control points
in new curves based on the count in neighboring existing curves. The
idea is to provide a more automatic default than manually controlling
the number of points in a curve, so users don't have to think about
the resolution quite as much.

Internally, some utilities for creating new curves are extracted to a
new header file. These can be used for the various nodes and operators
that create new curves.

The top-bar UI will be adjusted in a separate patch, probably moving
all of the settings that affect the size and shape of the new curves
into a popover.

Differential Revision: https://developer.blender.org/D14877
2022-05-10 18:28:02 +02:00
6f7959f55f Merge branch 'blender-v3.2-release' 2022-05-10 19:12:02 +03:00
3bc037a7eb Fix T96399: New 3.1 OBJ exporter is missing Path Mode setting
New OBJ exporter is missing "Path Mode" setting for exporting .mtl
files. The options that used to be available were: Auto, Absolute,
Relative, Match, Strip Path, Copy. All of them are important. The new
behavior (without any UI option to control it) curiously does not match
any of the previous setting. New behavior is like "Relative, but to the
source blender file, and not the destination export file".

Most of the previous logic was only present in Python based code
(bpy_extras.io_utils.path_reference and friends). The bulk of this
commit is porting that to C++.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14906
2022-05-10 18:58:10 +03:00
9c2613d1b6 Merge branch 'blender-v3.2-release' 2022-05-10 17:57:41 +02:00
1dd1772419 LibOverride: Fix memory leak in resyncing code. 2022-05-10 17:43:01 +02:00
0134ab4b56 LibOverride: Fix bad ID getting hierarchy root updated.
Followup to rB6c679aca1770c37.
2022-05-10 17:42:00 +02:00
6c679aca17 LibOverride: Make process checking validity of hierarchy roots more robust.
Code was not really designed to hanlde corrupted (e.g. local ID) root
hierarchies, now it should handle better those invalid cases and restore
proper sane situation as best as possible.

Fixes crashes with some corrupted files from Blender studio.
2022-05-10 17:32:31 +02:00
cd349dc402 LineArt: Use thread safe bound box.
The old method is not thread safe, which will lead to minor
memory leaks. This patch fixed that.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D14904
2022-05-10 22:01:07 +08:00
c60b570841 Remove debug code enabled in previous commit. 2022-05-10 15:54:59 +02:00
d9d81cb1ff 3d texture painting: Use center uv pixel as anchor.
Previously the bottom left of a pixel was used during pixel extraction what resulted in
that the pixels were moved a bit to the bottom left. By using the center uv pixel the
extracted pixels are more balanced and would improve future features like seam bleeding.
2022-05-10 15:52:28 +02:00
b4b85c5ce2 Merge branch 'blender-v3.2-release' 2022-05-10 23:04:37 +10:00
de71cdb35d Merge branch 'blender-v3.2-release' 2022-05-10 23:04:26 +10:00
4c3e91e5f5 Fix T96520 Node editor: Tweak fails with unselected nodes
Use the same method for node selection and dragging that is used
in the 3D viewport and UV editor. Instead of relying on a modal
operator - use the keymap to handle click/drag events.

Details:

Failure to transform unselected nodes was caused by [0] & [1] however
detecting drag relied on specific behavior which I don't think we should
be depending on.

This error happened when selection was defined both in the key-map for
the tool and for the node-editor.

- The left mouse button would activate selection in both the tool
  and "Node Editor" keymap.

- The first selection would return `FINISHED | PASS_THROUGH` when
  selecting a previously unselected node.

- The same PRESS would trigger a second selection would return
  `RUNNING_MODAL | PASS_THROUGH`,
  (starting a NODE_OT_select as a modal operator).

  - In 3.1 (with tweak events) the modal operator would then exit and
    fall-back to the tweak event which would transform the selected
    nodes.

  - In 3.2 (as of [0]) the PRESS that starts the modal operator is
    considered "handled" and prevents drag event from being detected.

The correct behavior in this case isn't obvious:
If a modal operator starts on pressing a button, using that same the
release to generate drag/click events is disputable.

Even in the case or 3.1 it was inconsistent as tweak events were
generated but click events weren't.

Note: after investigating this bug it turns out a similar issue already
existed in 2.91 and all releases afterwards. While the bug is more
obscure, it's also caused by the tweak event being interrupted as
described here, this commit resolves T81824 as well.

[0]: 4d0f846b93
[1]: 4986f71848

Reviewed By: Severin

Ref D14499
2022-05-10 23:01:56 +10:00
9173dd24ad Fix for crash opening the file selector multiple times
This is part of a fix for T88570, where the file selector would crash
when activated multiple times.

Calling save multiple times would free the operator, leaving a dangling
pointer which was used when panels were visible that accessed the
"active_operator".

Reviewed By: Severin

Ref D14905
2022-05-10 22:56:22 +10:00
502c3d6c21 Cleanup: remove non-existent include
guardedalloc was already included.
2022-05-10 22:56:03 +10:00
15021968c1 DrawManager: Hide lock acquire behind experimental feature.
The acquire locking of the draw manager introduced other issues.
The current implementation was a hacky solution as we know that the
final solution is something totally different {T98016}.

Related issues:
* {T97988}
* {T97600}
2022-05-10 14:31:20 +02:00
b38cd1bcbe Fix: Missing curves type count cache update in add brush 2022-05-10 14:27:36 +02:00
4ffeb2d449 DrawManager: Hide lock acquire behind experimental feature.
The acquire locking of the draw manager introduced other issues.
The current implementation was a hacky solution as we know that the
final solution is something totally different {T98016}.

Related issues:
* {T97988}
* {T97600}
2022-05-10 14:01:02 +02:00
3893ba5d67 Merge branch 'blender-v3.2-release' 2022-05-10 13:09:12 +02:00
7849b56c3c Fix T88570: Crash when saving after pressing ctrl+S twice.
Existing code to replace the file operation was failing when done from
the window for the file operation itself.

Basically, this patch does two things:
- Implement a well defined window context to use as the "owner" or
  "root" of the File Browser. This will be used for managing the File
  Browser and to execute the file operation, even after the File Browser
  was closed.
- Ensure the context is valid when dealing with file File Browser event
  handlers.

Previously the window context just wasn't well defined and just happened
to work well enough in most cases. Addressing this may unveil further
issues, see T88570#1355740.

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

Reviewed by: Campbell Barton
2022-05-10 12:36:43 +02:00
061995775f Fix T95298 ImageEditor: Multi-view images fail to display properly
This was because the shader had wrong output slot order.

This also add a note about why the order is reversed compared to the
texture binding.
2022-05-10 12:33:18 +02:00
a74a267767 Cleanup: Move mesh primitive cube to the geometry module
This allows easy reuse elsewhere in Blender.
2022-05-10 10:21:42 +02:00
77c0e79805 Merge branch 'blender-v3.2-release' 2022-05-10 10:01:10 +02:00
2a2e47b20c Curves: Add disabled message for add empty hair operator
Ref 2ba081f59b
2022-05-10 09:41:04 +02:00
439f86ac89 Fix T97272: Lag when resizing viewports.
Viewports where cleared explicitly due to compatibility reasons with Intel iGPUs.
This slowed down other platforms as well, this wasn't noticeable on all platforms.

This patch will be more selective when to enable the workaround.
Currently only for iGPUs on Mac + Linux.
2022-05-10 08:48:51 +02:00
08a39d32a9 Merge branch 'blender-v3.2-release' 2022-05-10 08:30:56 +02:00
11aa237858 Eevee: Fix GLSL compilation error.
Introduced by {35594f4b92fa4cbb5b848f447b7a3323e572b676}.
Some platforms do not support temp variables to be used as inout parameter.

Detected on Mac with Intel iGPU.
2022-05-10 08:30:21 +02:00
bc256a4507 Fix T50398: Constrain to Image Bounds failed with 2D cursor pivot
Use more robust logic for "Constrain to Image Bounds" when scaling UVs.

Reviewed By: campbellbarton

Ref D14882
2022-05-10 14:42:08 +10:00
501ec81d3e Merge branch 'blender-v3.2-release' 2022-05-09 19:52:27 -07:00
Ramil Roosileht
4bb90b8f4c D14887: Fix artifacts in hue filter
The hue color filter now wraps correctly.  Fixes T97768.

Reviewed By: Julien Kaspar & Joseph Eagar
Differential Revision: https://developer.blender.org/D14887
Ref D14887
2022-05-09 19:46:22 -07:00
ccb4e29873 Merge branch 'blender-v3.2-release' 2022-05-10 11:16:27 +10:00
e7464dffbc Merge branch 'blender-v3.2-release' 2022-05-10 11:16:23 +10:00
1c1e842879 Fix T86358: Use per face aspect correction for primitive UV projections
During UV unwrapping, Cube Projection, Sphere Projection, Cylinder
Projection and Project From View (in the 3D Viewport), when "Correct
Aspect" toggle is active, it now uses a query cache to perform a
per-face aspect ratio ("per_face_aspect") correction for the active
image of each face.

Reviewed By: campbellbarton

Ref D14852
2022-05-10 11:14:59 +10:00
a4c2060b91 Fix T97545 GPU: Crash caused by uncommented quote char in source string
Some drivers completely forbid quote characters even in unused
preprocessor directives.

This patch adds a debug build check for all `.glsl` files that need to
be manually handled. For shared headers with `#include` directives, we
need to do runtime patching of the source to remove the quote.

Also fix an instance of the quotes check failing in `eevee_next`.
2022-05-10 00:47:44 +02:00
b468255453 Cleanup: Return early 2022-05-09 23:59:28 +02:00
b6b94f878f Merge branch 'blender-v3.2-release' 2022-05-09 23:52:44 +02:00
7301547ca7 EEVEE: Fix missing CLOSURE_DEFAULT 2022-05-09 23:52:31 +02:00
35594f4b92 Fix T97985 EEVEE: Shader mixing not working correctly when reusing shader nodes
This was caused by the `Closure` members being added to the final contribution
more than once. The workaround is to clear the members once a closure has
been added to the final contribution. I used `inout` on `Closure` inputs
so that the render engine implementation of mix and add closure nodes
can do its own thing. The nodegraph handling of inout was changed for this
to work.
2022-05-09 23:52:31 +02:00
10865c8f34 Deps/CMake: Add missing dependencies for OCIO
OCIO could build before pystring and imath due to
OCIO missing the dependencies on these two projects

No rebuild required as the build would have failed
during the libs build if you ran into this issue.
2022-05-09 13:34:33 -06:00
6e2b0a38f0 Fix T97984: GPUCodegen: crash when loading demo file
This was caused by the name buffer not being ensured in all cases.

Change the behavior and always create the `NameBuffer`.
2022-05-09 20:06:27 +02:00
bfa1c077cb Fix T97983 EEVEE: Tangent Normal of Curves info behaves differently in Eevee
Curve tangent was correctly mistaken with curve normal.

This patch fixes the name of the output in the glsl function and make curve
attributes more explicit (with `curve_` prefix).

This also improve the normal computation by making it per pixel to match
cycles.

Also ports the changes to eevee-next.
2022-05-09 20:06:27 +02:00
bda9a1b103 Cleanup: simplify filling curve batch cache buffers
Write to arrays directly instead of using the "step" utility.
2022-05-09 18:37:39 +02:00
c2e26406c5 Cleanup: use different hardcoded shape to make the root/tip radius useful
Those settings are intended to be removed at some point, but for now they
are still needed because the radius attribute isn't supported.
2022-05-09 18:37:39 +02:00
Brecht Van Lommel
f4827d08bc Build: disable usage of GLEW, CLEW, CUDA, GLFW in OpenSubdiv
The previous 3.1 libraries (accidentally) used glApi instead of GLEW and were
working for GPU subdivision, so revert to that. There's a suspected conflict
with Blender's own bundled GLEW or other issue with GLEW, causing the crash in
T97737.

The current GPU subdivision implementation does not need OpenCL, CUDA or GLFW.
So also remove libraries needed for that. It's simpler to stick to compute
shaders in OpenGL/Vulkan/Metal and not involve additional APIs.

Ref T95206

Differential Revision: https://developer.blender.org/D14898
2022-05-09 18:30:04 +02:00
78f61bf8c1 Fix T97906: OpenEXR files with lower case xyz channel names not read correctly
Adds some utility functions to avoid using toupper() which depends on the
locale and should not be used for this type of parsing.
2022-05-09 18:28:24 +02:00
c2737913db BLI: Avoid invoking tbb for small parallel_reduce calls
Apply a change similar to e130903060 for
`parallel_reduce`, just like `parallel_for`. I measured a performance
improvement in viewport FPS of at least 10% with 1 million small
instances (one bottleneck was computing many small bounding boxes).
2022-05-09 18:21:50 +02:00
892562b7bf Cleanup: Remove incorrect statement after recent refactor 2022-05-09 18:00:47 +02:00
f9d7313bb7 Fix T97853: Crash with edit mode X-ray and subdivision
The mesh drawing code used a different mesh to check whether or not to
draw face dots and to actually retrieve them. The fix is moving the
responsibility of determining whether to use subsurf face dots to the
creation of `MeshRenderData` where the mesh used for drawing is
known, rather than doing it at a higher level.

Differential Revision: https://developer.blender.org/D14855
2022-05-09 17:39:22 +02:00
686abf1850 Fix T97853: Crash with edit mode X-ray and subdivision
The mesh drawing code used a different mesh to check whether or not to
draw face dots and to actually retrieve them. The fix is moving the
responsibility of determining whether to use subsurf face dots to the
creation of `MeshRenderData` where the mesh used for drawing is
known, rather than doing it at a higher level.

Differential Revision: https://developer.blender.org/D14855
2022-05-09 17:36:54 +02:00
e0e95f7895 Refactor: Move resample curves code to the geometry module
This commit moves the code for the resample curves node to the geometry
module, to allow reusing it in any editor. Split from D14870.
2022-05-09 17:33:41 +02:00
9f8f35008c Move particle system modifier to C++
The modifier is supposed to create a Curves data block soon, which
helps with the transition to the new Curves object in drawing code.
Utilities for the new Curves object are mostly in C++.
2022-05-09 16:59:48 +02:00
5823e749dc Merge branch 'blender-v3.2-release' 2022-05-09 16:35:25 +02:00
43e31d26a9 Fix T97927: bpy.utils.units.to_string uses wrong units for velocity, acceleration, lens length, and power
`TEMPERATURE` type was also missing, not only the new-ish
`TIME_ABSOLUTE` one...

Added a static assert on the size of the `bpyunits_ucategories_items`
array, and a comment on anonymous enum of `B_UNIT_`, in the hope this
won't happen again in the future.
2022-05-09 16:34:11 +02:00
6f773b1a4f Cleanup: typo in variable name. 2022-05-09 16:34:11 +02:00
36e330bd9c UI: Layout tweaks to Curve Guide force field min/max distance
For consistency with other force fields and other areas in Blender.

* Align "Use Max" and "Maximum Distance" in one line.
* Rename "Maximum Distance" to "Max Distance"
* Rename "Minimum Distance" to "Min Distance"
* Move "Minimum Distance" below maximum.
2022-05-09 16:08:45 +02:00
865cdff426 Cleanup: Replace UNUSED with comments (CPP style). 2022-05-09 15:08:34 +02:00
17429fe5e5 GPencil: Tooltip and UI text changes
Apply @pablovazquez feedback.
2022-05-09 14:52:52 +02:00
82060c1697 Remove unused compile flag on linux x86 GCC platforms
The "cast-align" warning is only triggered on Arm CPUs when using GCC.
Currently the only officialy supported ARM platform is the Mac platform
where we use Clang. So this warning never triggers.
2022-05-09 14:30:57 +02:00
95ff5e6d89 Merge branch 'blender-v3.2-release' 2022-05-09 13:40:10 +02:00
0f7da9a72f GPU: Unable to compile material shaders.
This fixes a threading issues when material shaders with textures are used.
It localizes the names of the samplers.
2022-05-09 13:32:13 +02:00
Ethan-Hall
719c86c0a6 Fix: compiler warnings due to recent commit
This is a fix for warnings caused by the patch b96cdbcf7a.

Differential Revision: https://developer.blender.org/D14891
2022-05-09 13:06:42 +02:00
b508999d8d Merge branch 'blender-v3.2-release' 2022-05-09 12:45:16 +02:00
b1b6994129 Minor typo fixes in UI messages. 2022-05-09 12:44:21 +02:00
b8432c2c8e Tweak i18n messages extraction script to avoid unwanted messages.
Code would add a bit too often the identifier of an RNA class to
translated messages, this is only needed if there is no valid label
available for it.
2022-05-09 12:40:26 +02:00
025959da23 Fix T97915: Regression: Blender doesn't translate viewpoint menu items.
Another mistake in rBdb3f5ae48aca.
2022-05-09 12:36:56 +02:00
Colin Basnett
4ac6177b8d Fix T97529: NLA track buttons still work when hidden
NLA track option buttons (lock track, etc.) now no longer respond to
clicks when they are hidden.

The bug stems from the fact that there was duplicate input handling
going on for the buttons: once in the normal button UI system, and then
again in the `mouse_nla_channels` function. The logic in
`mouse_nla_channels` does not inspect whether or not the setting button
is there or not, it just assumes that it is.

This function should no longer be handling mouse input for buttons
(there is even comment suggesting that the button handling to be
deprecated) since the button UI system already handles it. Therefore,
the button handling code has been removed from that
`mouse_nla_channels`.

In addition, the redundant mouse button handling for pressing the "Push
Down Action" button has also been removed from this function as well.

Reviewed By: sybren, lichtwerk

Differential Revision: https://developer.blender.org/D14868
2022-05-09 12:15:16 +02:00
9913196470 Geometry Nodes: use .a_ prefix for anonymous attribute names
Ref T97452.
2022-05-09 11:59:27 +02:00
b651754890 Merge branch 'blender-v3.2-release' 2022-05-09 10:38:53 +02:00
6b95e75d2f Silenced compilation warning in freestyle. 2022-05-09 10:38:46 +02:00
cc3c15fbdd GPU: Fix crash deferred shader compilation.
On certain systems when eevee is used in a 3d viewport could crash. It
happened more often on slower systems or systems with slower glsl compilers.

For example an Intel Mac Mini. The cause was that even if a GPUMaterial
was in used it could be freed.
2022-05-09 09:54:26 +02:00
Ethan-Hall
b96cdbcf7a UI: Add color attribute create to canvas selector
The purpose of this patch is to add the option to create a color
attribute paint slot from the canvas selector when in material mode.

See the discussion here: T97346

---
|Add Image Paint Slot|Add Color Attribute Paint Slot|
|{F13016547 size=full}|{F13032911 size=full}|

Reviewed By: HooglyBoogly, joeedh

Differential Revision: https://developer.blender.org/D14724
2022-05-09 08:21:45 +02:00
Shashank Shekhar
90298c24a2 EEVEE & Viewport: Add a built-in shader called 3D_IMAGE, and expose to the python API
Adds an example python script to the documentation for the 3D_IMAGE shader.

The **use-case** is to draw textures with 3D vertex positions, in XR views as well as non-XR views (in a simpler manner).

**Testing**: I've tested that this compiles and works on my Macbook (with the example python script included in this change). I don't have access to a Windows or Linux machine right now, but this change doesn't look platform-specific and no new glsl shaders have been added or edited by this change. I'll try to get access to a Windows machine, but if someone does have one, I'd be really grateful if they could try this change. Thanks!

**Problem addressed**: The existing 2D_IMAGE shader (exposed in the python API) gets near-clipped when drawn in the
XR view, regardless of the near-clip settings. Additionally, the 2D_IMAGE shader only accepts 2D
positions for the image vertices, which means drawing textures in 3D requires providing
2D coordinates and then pushing a transform-rotate-scale matrix to the GPU, even for
non-XR (i.e. WINDOW) views. The 3D_IMAGE shader is simpler: it accepts 3D vertex positions, and doesn't require
any additional work by the scripter.

**Workaround**: The current workaround is to use custom shaders in the python script.

**Non-intrusive change**: No new glsl shaders were added. This change just bundles two existing shaders: the vertex shader used
by the 3D_IMAGE_MODULATE_ALPHA shader, and the fragment shader used by the 2D_IMAGE shader.

Reviewed By: #eevee_viewport, jbakker

Differential Revision: https://developer.blender.org/D14832
2022-05-09 08:07:37 +02:00
78e7b20c0f Fix T96683: Mipmaps are inaccurate for UDIM textures
For some reasons the mipmap count was not set to max during creation.
Probably it was mistaken with the UDIM tilemap texture which is only
1D and has only one mipmap.
2022-05-07 19:11:34 +02:00
90663acfd5 EEVEE: Fix missing function implementation for volumetric materials
This was leading to linking errors.

Fixes T97779 Regression: World volume noise stopped working
2022-05-07 18:47:48 +02:00
014cdd3441 Fix T97600 Regression: rendering in new window displays flickers
This is because some drivers / GPU actually still do double buffer swapping
but others don't. Adding this do ensure the background color of the first
redraw.

Note that this fix was not tested on the problematic hardware and might not
solve the issue.
2022-05-07 17:38:05 +02:00
9f2e995c3e Fix T97796 EEVEE: Regression: Alpha clipped materials rendered as alpha hashed
This was because the alpha clip thresholding was previously done in the
material nodes codegen. Now it is the responsibility of the engine to
implement it.

This adds a loose uniform that is set by EEVEE itself to control the clip
behavior.
2022-05-07 15:00:37 +02:00
3a035a4417 Fix T97881 EEVEE: First Specular and SSS closure not contributing on alpha blended material
This was because the evaluation was still being deferred just like for the
opaque case.
2022-05-07 13:18:16 +02:00
b28e261753 GPUShader: Add static compilation to clipped shader variations
This allows testing them for errors.
2022-05-07 12:25:40 +02:00
2a2261d7e1 Cleanup: Remove the OSL <UVTILE> workaround
Partially reverts rB46ae0831134 now that we have a new version of
OSL/OIIO that supports <UVTILE> directly.

Differential Revision: https://developer.blender.org/D14851
2022-05-06 21:41:31 -07:00
23be3294ff XR: Expose the OpenXR user paths in the event data for XR events
The use-case is to allow an event handler (in C or a plugin) to
distinguish which hand produced the XR event.

The alternative is to register separate actions for each hand (e.g.
"trigger_left" and "trigger_right"), and duplicate the device bindings
(Oculus, HTC Vive, etc) for each action. Other than the problem of code
duplication, this isn't conceptually efficient since "trigger_left" and
"trigger_right" both represent the same event "trigger", and the
identity of the hand that produced that event is just a property of
that event.

Adds two string fields to the XrEventData called user_path and
user_path_other. The user_path_other field will be populated if the
event is a bimanual one (i.e. two-handed). This follows the pattern
used by the rest of the XrEventData struct for bimanual events (e.g.
state, state_other).

Reviewed By: muxed-reality
2022-05-07 11:39:26 +09:00
98a04ed452 UI: Increase bitfield size for button flags
We were running out of bits :) Only one was left (which D14880 proposes to
use).
2022-05-06 23:48:51 +02:00
5e40c342ae UI: Remove weird looking right aligned text in texture properties
The text would start somewhere in the middle of the line, and just look placed
wrong. Plus it would seem like it's cut off (esp. since we don't add a period).
2022-05-06 23:37:28 +02:00
aee8e49031 Fix T97751: New OBJ IO - File Browser doesn't filter by .obj/.mtl
Makes the File Browser filter by .obj and .mtl files by default again. Note
that this commit focuses on fixing this specific bug, further
refactors/tweaks/fixes are planned (see D14863).

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

Reviewed by: Aras Pranckevicius
2022-05-06 23:05:38 +02:00
aae2ff49f5 Fix T97751: New OBJ IO - File Browser doesn't filter by .obj/.mtl
Makes the File Browser filter by .obj and .mtl files by default again. Note
that this commit focuses on fixing this specific bug, further
refactors/tweaks/fixes are planned (see D14863).

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

Reviewed by: Aras Pranckevicius
2022-05-06 23:03:59 +02:00
92d0ed3000 Merge branch 'blender-v3.2-release' 2022-05-06 16:44:18 +02:00
Demeter Dzadik
26d375467b bpy_extras: Add utilities for getting ID references
An alternate to D14839, implemented in Python and
relying on bpy.data.user_map(). That function
gives us a mapping of what ID is referenced by
what set of IDs. The inverse of this would also
be useful, which is now available from
bpy_extras.id_map_utils.get_id_reference_map().

From there, we can use get_all_referenced_ids()
to get a set of all IDs referenced by a given ID
either directly or indirectly.

To get only the direct references, we can simply
pass the ID of interest as a key to the dictionary
returned from get_id_reference_map().

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D14843
2022-05-06 16:42:59 +02:00
Jeroen Bakker
a7417ba845 DrawManager: Make instance data persistent.
When resizing a viewport all engine instance data was cleared.
This wasn't the intended design and lead to performance regressions
in the image engine.

This patch makes sure that the instance data isn't cleared when
the viewport size changes. When using instance data, draw engines
are responsible to update the textures accordingly.

This could also reduce flickering/stalling when resizing the viewport
in eevee-next.

Fixes T95428.

Reviewed By: fclem

Maniphest Tasks: T95428

Differential Revision: https://developer.blender.org/D14874
2022-05-06 16:17:39 +02:00
a0a99fb252 Fix T97872: Annotation lines lost AA
Since rB2a7a01b339ad, `lineSmooth` has lost its default value of true.

So set the value when creating the shader.

Differential Revision: https://developer.blender.org/D14876
2022-05-06 11:07:14 -03:00
f23f831e91 Clang-tidy: Don't warn about unrecognized compiler flags
When using GCC, clang-tidy will still use clang under the hood but GCC
flags will still be passed. Therefore we will ignore any warnings about
unrecognized flags as we don't care about this when running clang-tidy.
2022-05-06 15:26:54 +02:00
763b8f1423 Clang-tidy: Ignore variable name length and .c/.cc include warnings
After some internal discussion it was decided that we should ignore name
variable length tidy warnings. Otherwise we would have warnings for
every variable that is under three characters long.

Additionally we will also ignore any warnings when including non header
files as the Unity library in our build system uses this excessively
2022-05-06 15:26:54 +02:00
dd2df5ceb0 Fix: Comments in clang-tidy checks list is not allowed
Clang-tidy will not parse any options after the comment.
2022-05-06 15:26:54 +02:00
2ba081f59b Curves: disable Empty Hair operator when there is no active mesh 2022-05-06 15:17:44 +02:00
cdd2c8bd07 Merge branch 'blender-v3.2-release' 2022-05-06 15:07:00 +02:00
acafc7327e Fix T97466: Assert when pack sound in blender DEBUG.
This was very old code from 2008, totaly invalid with new depgraph &
evaluation system, now we just need to tag the Sound ID for update.
2022-05-06 15:05:26 +02:00
edc92f779e Curves: support converting legacy curves to new curves object
This extends the existing object type conversion operator.

Currently, it is limited to converting to curves when the evaluated
source mesh actually has curves. This might not be the case when
it is converted to a mesh by some modifier during evaluation.

Differential Revision: https://developer.blender.org/D14872
2022-05-06 14:39:36 +02:00
c7bffc8fa2 obj: move parsing utilities out of io_common, since they are fairly obj specific
As pointed out in https://developer.blender.org/rB213cd39b6db387bd88f12589fd50ff0e6563cf56#341113,
the utilities are quite OBJ specific due to treating backslash as a line
continuation character. It's unlikely that other formats need that.

No functionality changes, just pure code move (and renamed tests so that
their names reflect obj).

Reviewed By: Campbell Barton
Differential Revision: https://developer.blender.org/D14871
2022-05-06 14:54:09 +03:00
bdfee6d831 EEVEE: Refactor curve nodes
This patches rewrites the GPU shaders of curve nodes for easier future
development. This is a non-functional change. The new code avoids code
duplication by moving common code into BKE curve mapping functions. It
also avoids ambiguous data embedding into the gradient vectors that are
passed to vectors and reduces the size of uniforms uploaded to the
shader by avoiding redundancies.

This is needed in preparation for the viewport compositor, which will
utilize and extend this implementation.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14689
2022-05-06 13:33:23 +02:00
8f6f28a0dc GPU: Move common shaders into a common directory
This patch moves some of the utility library shaders into a common
directory and makes the necessary renames across shaders. Additionally,
material-specific transform functions were moved outside of math utils
into a separate transform_utils.glsl file.

This is needed in preparation for the viewport compositor, which will
make use of some of those utilities and will require all material
specific bit to be removed out of those files.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14688
2022-05-06 12:58:14 +02:00
f5428736a7 Cleanup: Trailing white-space 2022-05-06 12:32:11 +02:00
d02b8c1c3b UI: Expand the Snap Curves to Surface operator
The different methods are too different. It is worth having them as
individual choices by the users.

Differential Revision: https://developer.blender.org/D14873
2022-05-06 12:30:46 +02:00
Ramil Roosileht
90042b7d79 Switch viewport shading for color tools in solid mode
This patch implements T97613, switching viewport shading when using Color Filter and Mask By Color

ALSO, this patch makes it so viewport shading color switches only when SOLID mode is chosen, to prevent color switching when using other shading modes, without user noticing it.
{F13049889}

Reviewed By: JulienKaspar, joeedh, jbakker

Maniphest Tasks: T97613

Differential Revision: https://developer.blender.org/D14765
2022-05-06 12:30:09 +02:00
b1517e26e2 Curves: use old Add > Curve menu for new curves object
* Removes the `Curves` menu (leaving only `Curve`).
* The `Curve > Random` option is still useful for testing, but it's under
  the second experimental flag so that it is turned off when only the
  "master ready" features are enabled.

Differential Revision: https://developer.blender.org/D14861
2022-05-06 12:06:57 +02:00
Piotr Makal
ce3dd12371 USD: add volume/VDB export
Add support for volume (OpenVDB) USD export:

- Allows to export both static and animated volumes.
- Supports volumes that have OpenVDB data from files or are generated in
  Blender with 'Mesh to Volume' modifier.
- For volumes that have generated data in Blender it also exports
  corresponding .vdb files. Those files are saved in a new folder named
  "volumes".
- Slightly changes the USD export UI panel. "Relative Texture Paths"
  becomes "Relative Paths" (and has separate UI box) as the
  functionality will now apply to both textures and volumes. Disabling
  of this option due to "Materials" checkbox being turned off has been
  removed.

Reviewed By: sybren, makowalski

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

Manifest Task: T95407
2022-05-06 11:43:43 +02:00
f3b56246d1 Cleanup: improve const correctness in material API 2022-05-06 11:40:23 +02:00
eac403b6e1 BLI: Add float3x3
This patch adds a float3x3 class that represents a 3x3 matrix. The class
can be used to represent a 2D affine transformation stored in a 3x3
matrix in column major order. The class provides various constructors
and processing methods, which utilizes the existing mat3 utilities in
BLI. Corresponding tests were also added.

This is needed by the upcoming viewport compositor to represent domain
transformations.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14687
2022-05-06 11:22:10 +02:00
908976b09a Merge branch 'blender-v3.2-release' 2022-05-06 11:12:58 +02:00
84756b68e6 Add documentation about Image/ImBuf to python/RNA API.
Related to T95616, the relationship between Image ID and ImBuf 'cached'
buffers can be fairly confusing when using the RNA API.

Reviewed By: campbellbarton, jbakker

Differential Revision: https://developer.blender.org/D14833
2022-05-06 11:11:33 +02:00
477066adee Fix: Handle default better in curves type count cache
When the curve types array isn't allocated, the default type
is Catmull Rom. Because the type counts are calculated eagerly,
they must be in a valid state.
2022-05-06 10:58:54 +02:00
12a1fa9cf4 Cleanup: format 2022-05-06 18:27:44 +10:00
2c75857f9f Cleanup: spelling in comments, use doxygen comments 2022-05-06 17:56:59 +10:00
ae9ef28126 Merge branch 'blender-v3.2-release' 2022-05-06 17:49:29 +10:00
62450e8485 WM: suppress assertion when switching tools
Changing the object mode outside the 3D view would trigger this
assertion. This was harmless, only assert for space types that
define the tools mode.
2022-05-06 17:44:32 +10:00
Andrii Symkin
e58b18888c GHOST: Add support for precision touchpad gestures on Windows
This patch adds support for precision touchpad gestures on Windows 8.1
and newer using Direct Manipulation API. Gestures work exactly like on
macOS, with full support for pan/pinch and inertia. This works by
creating a viewport with a fake scrollable which is reset after every
gesture and converts any changes to the content's transform into GHOST
trackpad events (as explained [here](https://bugzilla.mozilla.org/show_bug.cgi?id=890878)).
The code is based on the implementation from the [Chromium project](https://chromium.googlesource.com/chromium/src/+/refs/heads/master/content/browser/renderer_host/direct_manipulation_helper_win.cc).

Tested on Windows 10.

Fixes {T70754}, {T69264}.

Demo:{F8520272}

Reviewed By: nicholas_rishel

Differential Revision: https://developer.blender.org/D7660
2022-05-06 00:40:27 -07:00
4a4f0a70eb Merge branch 'blender-v3.2-release' 2022-05-06 16:22:58 +10:00
693aa573db Fix T96585: Intersect(Knife) tool is selecting wrong edges
Regression caused by [0] which flushed selection from vertices -> edges,
causing additional edges to be selected. Now selected is flushed based
on the mode, instead of all elements. Note that these function names
could be improved to make it clearer how these flushing functions are
different.

Also skip flushing unless selection is performed.

[0]: 55c82d8380
2022-05-06 16:18:04 +10:00
4dc6d14bdc Merge branch 'blender-v3.2-release' 2022-05-06 13:43:57 +10:00
11f3a388ed Merge branch 'blender-v3.2-release' 2022-05-06 13:43:54 +10:00
11a7da675f Merge branch 'blender-v3.2-release' 2022-05-06 13:43:51 +10:00
e1476ca310 Cleanup: quiet missing-declarations warnings 2022-05-06 13:43:20 +10:00
929a210608 Fix T97758: Applying modifiers bakes shape-keys
Regression in [0] which is useful when applying modifiers as a shape-key
but not when applying modifiers which keeps the existing shape-keys.

[0]: 65c5ebf577
2022-05-06 13:40:54 +10:00
fcbd81fb0f Win32: WM_SETTINGCHANGE lParam Check for NULL
Check that lParam is non-NULL in WM_SETTINGCHANGE message handler.

See D14867 for details.

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

Reviewed by Jesse Yurkovich
2022-05-05 17:48:55 -07:00
1b566b70c1 Fix T95308, T93913: Cycles mist pass wrong with SSS shader
It was wrongly writing passes twice, for both the surface entry and exit points.
We can skip code for filtering closures, emission and holdout also, as these do
nothing with only a subsurface diffuse closure present.
2022-05-05 22:01:45 +02:00
e4931ab86d Cleanup: clang format 2022-05-05 21:57:08 +02:00
108963d508 Merge branch 'blender-v3.2-release' 2022-05-05 21:01:54 +02:00
75a051a6ab Fix T93246: Cycles wrong volume shading after transparent surface
The Russian roulette probability was not taken into account for volumes in all
cases. It should not be left out from the SD_HAS_ONLY_VOLUME case.
2022-05-05 20:51:01 +02:00
4fa71be89a UI: Sort Force Field enums alphabetically
For consistency with the rest of Blender.

* Use a blank icon for "None" type, so the label aligns with the rest.
* Use "None" instead of "Nothing" for Kink type dropdown entry.
2022-05-05 18:00:16 +02:00
26cda38985 Docs: Clarify docs for BMesh methods
The previous docs for `normal_update` methods of `BMVert`, `BMEdge`,
`BMFace`, and `BMesh` were not clear on some behaviors.  These
behaviors are listed in D14370.  This commit updates the docs to be
clearer.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D14370
2022-05-05 11:08:01 -04:00
26bc584e01 Cleanup: Better const correctness for DEG_get_eval_flags_for_id
The ID is not modified by this function, so it can be const.

Needed to tweak const correctness for original ID accessor as
well. Additionally, did the same for accessor of evaluated ID
for symmetry.
2022-05-05 15:52:57 +02:00
47ba541853 Merge branch 'blender-v3.2-release' 2022-05-05 15:39:58 +02:00
b891c72d2d Fix T97575: Toggling fullscreen causes compositor recalc
The root of the issue is that compositor is using refresh mechanism
to handle recalc.

The safest fix which does not require deep refactor is to check to
whether node space was tagged for refresh from listener (currently
it is listeners which are responsible for tackling compositor tree
recalc).

Differential Revision: https://developer.blender.org/D14856
2022-05-05 15:35:59 +02:00
b968e2bf48 Outliner: add icons for nodegroups
These were missing in "Blender File" view.

before
{F13053175}
after
{F13053176}

Differential Revision: https://developer.blender.org/D14859
2022-05-05 14:44:31 +02:00
6fa5d520b8 Cycles: Add support for parallel compilation of OptiX module
OptiX 7.4 adds support for splitting the costly creation of an OptiX
module into smaller tasks that can be executed in parallel on a
thread pool.
This is only really relevant for the "shader_raytrace" kernel variant
as the main one is small and compiles fast either way. It sheds of
a few seconds there (total gain is not massive currently, since it is
difficult for the compiler to split up the huge shading entry point
that is the primary one taking up time, but it is still measurable).

Differential Revision: https://developer.blender.org/D14845
2022-05-05 14:35:41 +02:00
5b24291be1 Curves: move curve sculpt settings out of advanced panel 2022-05-05 14:15:09 +02:00
48f7574716 Merge branch 'blender-v3.2-release' 2022-05-05 15:01:28 +03:00
1830a3dfb5 Fix T97863: new OBJ importer issues with extra whitespace after "f" keywords
While possible extra whitespace after all OBJ/MTL keywords was properly
skipped, it was not done for the "f" (face definition) keyword.

While at it, also support indented keywords, i.e. extra whitespace at
the beginning of the line.

There's a tiny bit of performance drop while importing (e.g. importing
blender 3.0 splash scene: 53.38sec -> 54.21sec on my machine). But
correctness is more important.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14854
2022-05-05 14:59:46 +03:00
ad119d327e Curves: change default name of curves object to Curves 2022-05-05 13:01:39 +02:00
bff9bf728e Fix T97774: don't crash when no brush is selected 2022-05-05 12:52:19 +02:00
611b82621d Merge branch 'blender-v3.2-release' 2022-05-05 20:44:48 +10:00
69c7ff1649 Cleanup: unused parameter warning 2022-05-05 12:43:16 +02:00
be0417d690 Cleanup: Move curve length field input to blenkernel
To use in the geometry module when the resample curves code
is moved there (T97448).
2022-05-05 12:41:48 +02:00
756710800c File missing from 78fc5ea1c3 2022-05-05 20:40:56 +10:00
78fc5ea1c3 Workaround T81065: Merge UV's when applying modifiers
Support merging UV's that share the same vertex and are very close when
applying modifiers.

This is needed to prevent UV's becoming "detached" which can happen when
applying the subdivision surface modifier.

This regression was caused by [0] which removed selection threshold for
nearby coordinates. While restoring the UV selection threshold could be
done - some selection operations that walk around connected UV fans
wouldn't behave in a deterministic way (such as select shortest path).
There are also other cases where UV's may be compared without a
threshold such as tangent calculation and exporters which have their own
logic to handling UV's.

Also resolves T86896, T89903.

[0]: b88dd3b8e7

Reviewed By: sergey

Ref D14841
2022-05-05 20:36:15 +10:00
18bcd8321a Curves: show warning when using Add brush without surface 2022-05-05 12:24:24 +02:00
622c4e4953 Cleanup: Further clarification and renaming of curve field inputs
Differentiate the total length of curves and the accumulated length
at each control point.
2022-05-05 12:21:36 +02:00
c7a345bd60 Merge branch 'blender-v3.2-release' 2022-05-05 20:18:44 +10:00
960a1ddd85 Merge branch 'blender-v3.2-release' 2022-05-05 20:18:41 +10:00
598917f49b Fix T97874: Python exception after undo with image space visible
Ensure tools are initialized with the correct area type set.
2022-05-05 20:13:10 +10:00
7e02c90103 Fix WM_toolsystem_refresh_screen_all failing to refresh tools
Error in 3e1baa7d53.
2022-05-05 20:13:10 +10:00
dbba5c4df9 Curves: control number of control points in new curves
Previously, the number of control points in a new curve was hardcoded.

Differential Revision: https://developer.blender.org/D14857
2022-05-05 12:11:50 +02:00
b4fa74e812 Cleanup: Rename field input class name 2022-05-05 12:07:46 +02:00
09f769bde5 Curves: show Front Faces Only option in tools panel 2022-05-05 12:07:35 +02:00
8d78c3152e Curves: unify "Front Faces Only" name with mesh sculpt mode 2022-05-05 12:07:10 +02:00
a85df96b4f Merge branch 'blender-v3.2-release' 2022-05-05 11:59:34 +02:00
94533ca4b8 Cleanup: EEVEE: Fix clang-tidy warnings and unused var warning 2022-05-05 11:55:13 +02:00
3505d948c6 DRW: Hair: Fix shader compilation of transform feedback shader
Introduced by rBadbe71c3faba.
2022-05-05 11:44:31 +02:00
9ebf8a0c35 Cleanup: Use unsigned short for mesh flag
Solves the compilation warning about sign change when the
default flags are cast from int to short.
2022-05-05 11:38:51 +02:00
060c5a7fa2 Cleanup: Remove unnecessary logic for resample curves node
After 2d80f814cc, we can assume that curves always have at least one
evalauted point, so this complication isn't necessary anymore.
2022-05-05 11:30:16 +02:00
b4fb2a6980 Cleanup: Add comment about mininum curve length 2022-05-05 10:22:21 +02:00
8b54e05e33 Cleanup: sort cmake file lists 2022-05-05 17:33:43 +10:00
eb837ba17e Cleanup: format 2022-05-05 17:33:43 +10:00
6513ce258f Geometry Nodes: Improve performance of mesh to points node
There are fancier possibilities for improvements, like taking ownership
of existing arrays in some cases, but this patch takes a simpler brute
force approach for now.

The first change is to move from the previous loop to using the new
`materialize_compressed_to_uninitialized` method on virtual arrays,
which adds only the selected values to the output. That is a nice
improvement in some cases, corresponding to the "Without Threading"
column in the chart below.

The next change is to call that function in parallel on slices of
the output. To avoid generating too much code, we can avoid
templating based on the type and devirtualizing completely.

The test input is a 4 million point grid, generated by the grid
primitive node. Color and 2D vector attributes were also transferred
to the points.

| Test      | Before | Final No Threading | Final  | Change |
| --------- | ------ | ------------------ | ------ | ------ |
| All Verts | 209 ms | 186 ms             | 170 ms | 0.8x   |
| 1%        | 148 ms | 143 ms             | 133 ms | 0.9x   |
| All Faces | 326 ms | 303 ms             | 87 ms  | 0.27x  |
| 1%  Faces | 70 ms  | 68 ms              | 34 ms  | 0.49x  |

Differential Revision: https://developer.blender.org/D14661
2022-05-05 09:28:46 +02:00
0f567ada9d Docs: add doc-string for BMFace.mat_nr struct member 2022-05-05 17:18:50 +10:00
ddbac88c08 Win32: Dark Mode Title Bar Color
Blender will respect Windows "Dark Mode" setting for title bar color.

See D14847 for details.

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

Reviewed by Ray Molenkamp
2022-05-04 20:19:10 -07:00
836fbb90aa Cleanup: mark library locations as advanced 2022-05-05 11:38:19 +10:00
e33c15951b Cleanup: spelling in comments 2022-05-05 10:55:51 +10:00
d0c2fd0570 Cleanup: use 'r_' prefix for return arguments 2022-05-05 10:44:25 +10:00
d3c895fc41 Cleanup: shadow and format warnings 2022-05-05 10:44:25 +10:00
777b72b5cb Cleanup: unused argument warnings 2022-05-05 10:44:25 +10:00
73fa571598 Merge branch 'blender-v3.2-release' 2022-05-04 21:43:56 -03:00
adbe71c3fa Fix T97835: crash when creating hair particle system on Mac
Recently `gpu_shader_3D_smooth_color_frag.glsl` had the uniform declarations removed.

For shaders without `ShaderCreateInfo` that require this source this results in the error:
```
ERROR (gpu.shader): hair_refine_shader_transform_feedback_workaround_create FragShader:
      |
   54 |   fragColor = finalColor;
      |
      | gpu_shader_3D_smooth_color_frag.glsl:5:0: Error: Use of undeclared identifier 'fragColor'
      | gpu_shader_3D_smooth_color_frag.glsl:5:0: Error: Use of undeclared identifier 'finalColor'
      |
   55 |   fragColor = blender_srgb_to_framebuffer_space(fragColor);
      |
      | gpu_shader_3D_smooth_color_frag.glsl:6:0: Error: Use of undeclared identifier 'fragColor'
      | gpu_shader_3D_smooth_color_frag.glsl:6:0: Error: Use of undeclared identifier 'fragColor'
```

So port that shader to use `ShaderCreateInfo`.
2022-05-04 21:42:38 -03:00
8960c6e060 IMBUF: Faster JPEG Thumbnails
Make preview thumbnails of JPEG files in less time and with less RAM.

See D14727 for more details.

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

Reviewed by Brecht Van Lommel
2022-05-04 16:55:59 -07:00
Juanfran Matheu
ed0964c976 UI: Add Gizmos toggle to SpaceImage
This patch adds the show_gizmo and show_gizmo_navigate properties to the Image and UV editors.

Image Editor:
{F13026317}
UV Editor:
{F13026319}

VIDEO:
{F13026324}

Reviewed By: #user_interface, campbellbarton

Differential Revision: https://developer.blender.org/D14755
2022-05-05 00:23:25 +02:00
f11dba8892 Fix Cycles world light group confusing UI
Move to a subpanel of the Settings panel. Otherwise it seems like it's a
setting of one of the shader nodes.
2022-05-04 21:23:18 +02:00
0fa1c65ee3 Fix T95644: Cycles doesn't update modified object attributes on GPU
evice_update_preprocess is supposed to detect modified attributes and flag the
device_vector for a copy through device_update_flags. However, since object
attributes are only created in device_update_attributes afterwards, they can't
be included in that check.

Change the function that actually updates the device_vector to tag it as
modified as soon as its content gets updated.

Differential Revision: https://developer.blender.org/D14815
2022-05-04 20:07:19 +02:00
54f447ecde Fix T96718: Cycles invalid pixels when using bump normal for light emission
A shader node setup accidentally used the bump normal as emission. Bump
mapping nodes are excluded from light shader evaluation to reduce kernel size
and register pressure, but in that case should write zero instead of leaving
memory uninitialized.

Thanks to Lukas for helping identify the cause.
2022-05-04 20:01:04 +02:00
ac9ebc9de3 Fix Cycles division by zero in material preview render
If the render gets cancelled before the first sample finishes.
2022-05-04 20:01:04 +02:00
319a772b7f Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-04 19:37:48 +02:00
fc0f6d19ad Fix T96845: artifacts with GPU subdivision and mirror modifier
The coarse polygon count was set to the one of the BMesh instead of
the the one of the mesh used for subdivision, which caused the
compute shaders to output wrong data.
2022-05-04 19:31:53 +02:00
5d7ee44406 Fix T95527: wrong motion blur with rigid bodies
This index is not meant for the point cache data array, it's already offset.
2022-05-04 19:28:17 +02:00
1a98bec40e Subdivision node: add input for vertex creases
This adds an input to the Subdivision node to specify a field to use
for controling vertex creases. Common code with edge creasing was
extracted into utility functions to avoid redundancy.

Differential Revision: https://developer.blender.org/D14199
2022-05-04 18:59:08 +02:00
Hallam Roberts
82df48227b Nodes: Add general Combine/Separate Color nodes
Inspired by D12936 and D12929, this patch adds general purpose
"Combine Color" and "Separate Color" nodes to Geometry, Compositor,
Shader and Texture nodes.
- Within Geometry Nodes, it replaces the existing "Combine RGB" and
  "Separate RGB" nodes.
- Within Compositor Nodes, it replaces the existing
  "Combine RGBA/HSVA/YCbCrA/YUVA" and "Separate RGBA/HSVA/YCbCrA/YUVA"
  nodes.
- Within Texture Nodes, it replaces the existing "Combine RGBA" and
  "Separate RGBA" nodes.
- Within Shader Nodes, it replaces the existing "Combine RGB/HSV" and
  "Separate RGB/HSV" nodes.

Python addons have not been updated to the new nodes yet.

**New shader code**
In node_color.h, color.h and gpu_shader_material_color_util.glsl,
missing methods hsl_to_rgb and rgb_to_hsl are added by directly
converting existing C code. They always produce the same result.

**Old code**
As requested by T96219, old nodes still exist but are not displayed in
the add menu. This means Python scripts can still create them as usual.
Otherwise, versioning replaces the old nodes with the new nodes when
opening .blend files.

Differential Revision: https://developer.blender.org/D14034
2022-05-04 18:44:03 +02:00
7d41e1ed40 Merge branch 'blender-v3.2-release' 2022-05-04 17:30:26 +02:00
60772baebf Fix T97709: Compositor: Scenes are being set to no users after doing a full copy.
Similar issue/solution as in rB5188c14718c5 from this Monday actually,
there may be more of those still lurking around... Quite surprising they
all get reported now, this behavior has been in Blender since years.
2022-05-04 17:29:50 +02:00
8ff5836766 Merge branch 'blender-v3.2-release' 2022-05-04 17:19:25 +02:00
b5c3885bf0 Fix T97851: GPencil Bake object transform operator wrong transformation
The problem was the layer transformation was already applied in the layer and if we apply in the bake, we are doing double transformation.

Differential Revision: https://developer.blender.org/D14844
2022-05-04 17:18:58 +02:00
Germano Cavalcante
d2271cf939 Transform: use a threshold for UV snapping
Unlike 3Dview snapping, UV snapping is always done to the UV closest to
the mouse cursor, no matter the distance.

From the user's point of view, this appears to be an inconsistency (See
{T93538}).

Therefore, set a minimum distance for snapping and, as in 3D View and
highlight the snap with a drawing of a circle.

Release Note: https://wiki.blender.org/wiki/Reference/Release_Notes/3.3/Modeling

Reviewed By: #uv_editing, campbellbarton

Maniphest Tasks: T93538

Differential Revision: https://developer.blender.org/D13873
2022-05-04 12:08:17 -03:00
5559ea59a1 Cycles: mark all CUDA 11.x versions as supported
All released versions appear to work fine. Also slightly change wording.
2022-05-04 17:07:39 +02:00
b5b6ae06f9 Build: update outdated description of WITH_TBB option 2022-05-04 17:07:39 +02:00
08daeb9472 LineArt: Clean up file name and license.
lineart_cpp_bridge.cpp changed to .cc
2022-05-04 22:32:50 +08:00
03aba8046e LineArt: Object loading optimization
This patch replaces BMesh conversion into index-based triangle adjacent
lookup method, and use multithread in many steps to speed up object
loading for line art.

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

Reviewed By: Sebastian Parborg (zeddb)
2022-05-04 22:11:33 +08:00
8bd0ed6bd2 Curves: show direction in panel for Grow / Shrink brush settings 2022-05-04 15:37:59 +02:00
a0d139076c Silenced compilation warning on clang. 2022-05-04 15:04:30 +02:00
a52fbeadb1 Merge branch 'blender-v3.2-release' 2022-05-04 15:02:55 +02:00
54b293237e Fix T97375: changing node tree from Python is very slow
The issue was that the `NodeTreeRef` acceleration data structure was
rebuild much more often than necessary. That happened because the
Map Range node accidentally tagged the node tree for change even
though it did not actually change.

Differential Revision: https://developer.blender.org/D14842
2022-05-04 15:02:19 +02:00
82bf11e73f Cleanup: unused parameter 2022-05-04 14:36:16 +02:00
dc1793e85b Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-04 14:33:13 +02:00
d86d7c935e Fix T97827: material preview not displaying textures
Caused by rB281bcc1c1dd6 which did not properly made use
of `vec4` for UVs which are now loaded as attributes.
2022-05-04 14:30:52 +02:00
5162135e14 Curves: add second experimental option for new curves tools
Now there are two experimental feature options:
* "New Curves Type": Enables the new data type and a couple of tools
  that are meant to be in the first release that comes with the new curves object.
* "New Curves Tools": This is only available when the new curve type is available
  as well. It mainly exists to keep some tools experimental even after the initial
  curves object is release officially.
  * For now this only includes the curves edit mode which is not usable yet and
    probably won't be for the initial release.

Differential Revision: https://developer.blender.org/D14840
2022-05-04 14:18:42 +02:00
3bdda67e50 Merge branch 'blender-v3.2-release' 2022-05-04 15:11:25 +03:00
cbeb8770cc Fix T97794: new OBJ importer does not handle quoted MTL paths
Fixes T97794 (which is a reintroduction of an older issue T67266 that
has been fixed in the python importer, but the fix was not in the C++
one). Some software produces OBJ files with mtllib statements like
mtllib "file name in quotes.mtl", and the new importer was not stripping
the quotes away.

While at it, I noticed that MTLParser constructor was taking a StringRef
and treating it as a zero-terminated string, which is not necessarily
the case. Fixed that by explicitly using a StringRefNull type.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14838
2022-05-04 15:10:54 +03:00
48c0738d4a Cleanup: Adjust variable names, miscellaneous changes
Use `src` and `dst` instead of less common variable names,
less redundant logic, simpler use of const, and "typename"
for template arguments instead of "class".
2022-05-04 14:10:22 +02:00
9ee9dd257f Curves: Add method to find indices for curve type in a selection
For example, this can be used to find the indices of all Bezier curves
inside an existing selection. The important part is that it is optimized
for the case when all curves have the same type.
2022-05-04 13:55:13 +02:00
16011e34f0 Curves: Optimize filling all curves with a single type
If all curves are selected for setting the new type,
skip counting the types and just set it directly.
2022-05-04 13:55:13 +02:00
7d7047058a Merge branch 'blender-v3.2-release' 2022-05-04 13:00:04 +02:00
Yann Lanthony
b31f5b8ce7 GPencil: Apply layer transforms to visible frames
Fix regression described in T97799.

Apply layer transform and layer parenting to all visible frames, i.e. active frame + onion skinning frames.

Reviewed By: #grease_pencil, antoniov

Maniphest Tasks: T97799

Differential Revision: https://developer.blender.org/D14829
2022-05-04 12:58:57 +02:00
0f2cc50fc6 Cleanup: Avoid asan overflow warning for RNG seed 2022-05-04 12:58:45 +02:00
caeea212cf Merge branch 'blender-v3.2-release' 2022-05-04 12:28:05 +02:00
302584bd6e Fix T97831: Curve to mesh node can create invalid wire mesh
When the profile only has one control point, its segment count was
determined incorrectly. There needs to be a special case for a single
control point, when there are no segments even if the curve is cyclic.
2022-05-04 12:26:59 +02:00
14d845192a Merge branch 'blender-v3.2-release' 2022-05-04 19:32:12 +10:00
e7ba34599c Merge branch 'blender-v3.2-release' 2022-05-04 19:32:09 +10:00
79e94caa6b Fix error pasting text containing tabs
Regression in [0] which missed updating the string length
when converting tabs to spaces - the pasted string would be shorter.

[0]: e2f4c4db8d
2022-05-04 19:28:11 +10:00
5f8f436dca Allow surface deform when target mesh increases number of vertices
A studio request actually.

The goal is to cover rather typical situation: when the mesh was
bound to target when the target was on subdivision level 0 but
uses a higher subdivision level for rendering. Example of such
setup is a facial hair bound to the face.

The idea of this change is to use first N vertices from the target
where N is the number of vertices on target during binding process.
While this sounds a bit arbitrary it covers typical modifier setup
used for rigging. Arguably, it is not more arbitrary than using a
number of polygons (which is how the modifier was checking for
changes on target before this change).

Quite straightforward change. A bit tricky part was to not break
the behavior since before this change we did not track number of
vertices sued when binding. The naming I'm also not super happy
with and just followed the existing one. Ideally the variables in
DNA will be prefixed with `target_` but doing it for an existing
field would mean compatibility change, and only using prefix for
the new field will introduce weird semantic where the polygons
count will be even more easily confused with a count on the
deforming mesh.

Differential Revision: https://developer.blender.org/D14830
2022-05-04 10:56:33 +02:00
aa1fb4204d Cleanup: More clear name in surface deform modifier
Make it explicit that counter is about target mesh.

Use DNA rename for it so that the files stay compatible.

Also renamed some purely runtime fields to replace `t`
prefix with `target` as the short `t` is super easy
to miss.

Differential Revision: https://developer.blender.org/D14835
2022-05-04 10:56:33 +02:00
2d80f814cc Curves: Use copied original data for invalid NURBS curves
NURBS curves can be invalid when the order is less than the number
of points, or in a few other situations. Currently the evaluated data of
an invalid NURBS curve is empty. This is inconvenient because it
requires checking for empty curves when it otherwise wouldn't be
necessary. This patch replaces that fallback with copying the original
data to the evaluated points. This makes conceptual sense too, as if
the curve couldn't be evaluated-- which wouldn't necessarily delete it.

Usually the UI protects against this happening, but it's currently
possible to create an invalid curve with some operations like the
delete geometry node.

Differential Revision: https://developer.blender.org/D14837
2022-05-04 10:27:46 +02:00
7dc94155f6 Curves: support symmetry in curves sculpting brushes
This adds support for X/Y/Z symmetry for all brushes in curves
sculpt mode. In theory this can be extended to support radial
symmetry, but that's not part of this patch.

It works by essentially applying a brush stroke multiple with
different transforms. This is similiar to how symmetry works in
mesh sculpt mode, but is quite different from how it worked in
the old hair system (there it tried to find matching hair strands
on both sides of the surface; if none was found, symmetry did
not work).

Differential Revision: https://developer.blender.org/D14795
2022-05-04 09:51:32 +02:00
0375720e28 Fix T95165: Custom Normals tools dont update immediately.
Recalc selection count at the end of the circle selection.
This was removed from circle selection as it became a performance
bottleneck, helas some operators rely on it.
2022-05-04 09:22:17 +02:00
aa21087d56 Merge branch 'blender-v3.2-release' 2022-05-04 14:02:23 +10:00
78e8fae346 Merge branch 'blender-v3.2-release' 2022-05-04 14:02:21 +10:00
b1cd3be0d0 Merge branch 'blender-v3.2-release' 2022-05-04 14:02:18 +10:00
f8c8abae38 Merge branch 'blender-v3.2-release' 2022-05-04 14:02:15 +10:00
0383047257 Cleanup: quiet strict-prototypes warning 2022-05-04 14:01:18 +10:00
2a89509e45 License headers: add missing license headers
Add missing license headers based on files in the same directory.
2022-05-04 13:58:53 +10:00
10b1e993f4 Cleanup: make format 2022-05-04 13:52:22 +10:00
8cb30c079d Cleanup: duplicating doc-strings 2022-05-04 13:44:23 +10:00
db63945c36 Docs: add doc-string for ED_view3d_viewcontext_init_object 2022-05-04 11:20:04 +10:00
dc57ab8941 Cleanup: quiet strict-prototypes warning 2022-05-04 11:07:19 +10:00
e86b62f195 Fix wrong task priority for particle distribution and tanget computation
These kinds of depsgraph evaluations should not be marked as low priority as
this could negatively affect playback performance. Low priority should mainly
be used for background tasks.
2022-05-03 23:08:29 +02:00
5b2a6b6ebb Fix T96880: viewport render animation hangs Blender
Isolate frame writing task so that multithreaded image operations don't cause
the thread to start writing another frame. If that happens we may reach the
MAX_SCHEDULED_FRAMES limit, and cause the render thread and writing threads to
deadlock waiting for each other.

Additionally, don't set task priority to low because this may cause the task
scheduler to be slow in scheduling the write and color management tasks.
2022-05-03 23:08:29 +02:00
502c707e0e Merge remote-tracking branch 'origin/blender-v3.2-release' 2022-05-03 22:59:31 +02:00
Ethan-Hall
1d668b6356 Alembic: Enable operator presets when exporting
This patch enables operator presets for Alembic exports.
The export menu has many options, so enabling the feature
will help users manage their export settings in the same
way they can with other filetypes.

This also fixes restoring the default operator value for
setting the frame range.

Differential Revision: https://developer.blender.org/D12849
2022-05-03 22:58:18 +02:00
281bcc1c1d Fix T93179: geonodes UVs and Vertex colors do not work in EEVEE
Overwriting UV map or vertex color data in Geometry nodes will move the
layers to another CustomData channel, and as such, will make attribute
lookup fail from the UVMap and Vertex Color nodes in EEVEE as the
CustomDataType will also be modified (i.e. no longer `CD_MTFACE` or
`CD_MCOL`).

As discussed in T93179, the solution is to use `CD_PROP_AUTO_FROM_NAME`
so that the render engine is able to find the attributes. This also makes
EEVEE emulate Cycles behaviour in this regard. `attr_load_uv` and
`attr_load_color` are also removed in favor of the generic attribute
API in the various GLSL shaders.

Although `CD_PROP_AUTO_FROM_NAME` is now used even for UV maps, the
active UV map is still used in case the attribute name is empty, to
preserve the old behavior.

Differential Revision: https://developer.blender.org/D13730
2022-05-03 22:50:04 +02:00
94205e1d02 Fix T96822: Cycles motion blur + persistent data not updating properly
At the frame before/after an object starts moving, it's transform may not be
modified but its motion would be and requires an update.
2022-05-03 22:16:08 +02:00
947f8ba300 Fix T96338: GPU subdiv crash switching to UV editing
The crash is caused as the data for the UV editor is requested before
the data for the mesh as a separate draw update. Since building the UV
stretch angle buffer requires the position buffer, the latter is not
created yet in this case.

To fix this, create a local position buffer from the subdivision data. An
alternate fix was considered to remove the dependency on the position
buffer by interpolating on the GPU the coarse stretch angle buffer but
this did work. Maybe this will be revisited.
2022-05-03 18:02:10 +02:00
04df0a3b8c Sculpt Curves Puff icon 2022-05-03 17:49:10 +02:00
2062116924 BPY types: add default Geometry Node poll function
Contrary to `CompositorNodeCustomGroup` or `ShaderNodeCustomGroup`,
`GeometryNodeCustomGroups` have to define their own poll function.
This is because their is no predefined poll function for `GeometryNode`,
and it may not be clear for addon developers why `GeometryNode` would
be special here.

This adds `GeometryNode` to `bpy_types.py` and defines such a function
for it like for other builtin node types.

Differential Revision: https://developer.blender.org/D14775
2022-05-03 17:43:03 +02:00
9fb98735ea Refactor: Use boolean array for curves delete brush
No functional or performance changes expected. This change
makes it simpler to run multiple operation "delete" operations
but only reallocate the curves data arrays a single time.
2022-05-03 17:41:09 +02:00
f586c3ba21 Merge branch 'blender-v3.2-release' 2022-05-03 14:49:53 +03:00
5962db093f Fix T97793, Fix T97795: Use correct defaults for missing values in new OBJ importer
- Fix T97793: when a UV coordinate after vt is missing, use zero. While
  at it, also use zeroes for positions & normals, since "maximum
  possible float" is very likely to cause issues in imported meshes.
- Fix T97795: use 1.0 default if -bm value is missing, instead of zero.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14826
2022-05-03 14:45:44 +03:00
5f5e7ac317 Fix T97757: Some MTL import correctness issues in the new OBJ importer
Fix several correctness issues where the new OBJ/MTL importer was not
producing the same results as the old one, mostly because the code for
some reason had slightly different logic. Fixes T97757:

- When .obj file tries to use a material that does not exist, the code
  was continuing to use the previous material, instead of creating new
  default one, as the previous importer did.
- Previous importer was always searching/parsing "foo.mtl" for a
  "foo.obj" file, even if the file itself does not contain
  "mtllib foo.mtl" statement. One file from T97757 repros happens to
  depend on that, so resurrect that behavior.
- When IOR (Ni) or Alpha (d) are not specified in .mtl file, do not
  wrongly set -1 values to the blender material.
- When base (Kd) or emissive (Ke) colors are not specified in the .mtl
  file, do not set them on the blender material.
- Roughness and metallic values used by viewport shading were not set
  onto blender material.
- The logic for when metallic was set to zero was incorrect; it should
  be set to zero when "not using reflection", not when "mtl file does
  not contain metallic".
- Do not produce a warning when illum value is not spelled out in .mtl
  file, treat as default (1).
- Parse illum as a float just like python importer does, as to not
  reintroduce part of T60135.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14822
2022-05-03 14:44:49 +03:00
11d075f07d Cleanup: Move color attribute enums to be reusable
These enum property arrays are used by a few patches
in review. Moving them here means they don't have to
be duplicated.
2022-05-03 12:23:17 +02:00
Nate Rupsis
61e8310b75 NLA: improve visibility of action & active channel
Selecting Action channel in NLA now sets the context in the N-panel. The
actively selected channel is now also drawn in a different way, so that
it's visible which one is selected.

Old:
- The NLA sidebar didn't refresh with the creation of a new action.
- There was no indication of the action channel being selected.

New:
- NLA side bar now refreshed when keyframes are added (new action is created)
- Clicking on the action channel now gives visual indication of being selected

Reviewed By: RiggingDojo, sybren

Maniphest Tasks: T97372

Differential Revision: https://developer.blender.org/D14820
2022-05-03 12:00:42 +02:00
46d7bcc068 Merge branch 'blender-v3.2-release' 2022-05-03 10:56:24 +02:00
a2e3005b42 Fix VSE view clamping not working
Clamping was set up, but `v2d->cur` was never actually modified.
2022-05-03 10:55:05 +02:00
2ea9d1fccf Fix T97720: Fix meta strip shows incorrect mute state.
Caused by only checking mute state for meta strip itself and not the
children.
2022-05-03 10:55:05 +02:00
6b74c8e486 Merge branch 'blender-v3.2-release' 2022-05-03 10:34:46 +02:00
20f819d708 Fix T95541: Broken vertex weight with mirror modifier.
Regression from rB1a7757b0bc69/rBa0acb9bd0cc0. Special handling
(averaging) of weights on merged center vertices also requires to be
'reversed' when new correct merge order is used, compared to previous
behavior.
2022-05-03 10:33:38 +02:00
cd1044fb2b Merge branch 'blender-v3.2-release' 2022-05-03 18:33:24 +10:00
31bf70e35c Merge branch 'blender-v3.2-release' 2022-05-03 18:33:21 +10:00
cfdec85cd9 Cleanup: auto-format 2022-05-03 18:32:12 +10:00
4824cad580 GNUmakefile: include autopep8 in the "make format" target
Run autopep8 as well as clang-format when calling "make format",
the PATHS argument is passed to both utilities which will only operate
on files they support.

For example: `make format PATHS=release/scripts` formats Python scripts,
`make format PATHS=source/blender/blenlib` would format C/C++.
If users really want they can format C/C++ & Python files at the same
time since both formatting utilities filter on file extension.

`make format PATHS="release/scripts/startup/nodeitems_builtins.py source/creator/creator.c"`

A LIBDIR variable has been added to the GNUmakefile to simplify
references to this directory which can be one of 3 possible values.

Reviewed By: sybren, brecht

Ref D14789
2022-05-03 18:32:00 +10:00
61b65e9c9b Merge branch 'blender-v3.2-release' 2022-05-03 18:24:29 +10:00
4196772ae8 Merge branch 'blender-v3.2-release' 2022-05-03 18:24:26 +10:00
3a002bff7a Merge branch 'blender-v3.2-release' 2022-05-03 18:24:22 +10:00
74dfb7ca23 Fix T97731: Python traceback no longer includes line-numbers
Regression caused by [0] that caused the error message to be
created based on a normalized exception (which hid line numbers).

PyC_ExceptionBuffer{_Simple} & BPy_errors_to_report
no longer clears the exception.

This could have been resolved by changing python_script_error_jump
however that would involve changes to reference counting that are more
risky (noted in code-comment).

[0]: 2d2baeaf04
2022-05-03 18:22:54 +10:00
a821a2db3d Cleanup: remove redundant PyErr_Clear calls after PyErr_Fetch 2022-05-03 18:22:54 +10:00
1fc95d829f CMake: fix error building when CUDA_NVCC_EXECUTABLE is missing 2022-05-03 18:22:54 +10:00
f5dc675537 Merge branch 'blender-v3.2-release' 2022-05-03 10:21:35 +02:00
daa9edc9be Fix T97744: Speed effect causes memory leak
Leak was caused because output image buffer was initialized twice. Once
in speed effect strip and then by cross effect strip used for
interpolation feature.
2022-05-03 10:20:41 +02:00
fd98403211 Fix T97733: Crash when adding new scene
Caused by NULL dereference if sequencer data does not exist.
2022-05-03 10:20:41 +02:00
8e71ba12e5 Merge branch 'blender-v3.2-release' 2022-05-03 09:50:32 +02:00
f80e4f0046 Fix T93272: Material index mapping missing for mesh boolean node
This commit implements copying of materials and material indices from
all of the boolean node's input meshes. The materials are added to the
final mesh in the order that they appear when looking through the
materials of the input meshes in the same order of the multi-socket
input node.

All material remapping is done with mesh-level materials. Object-level
materials are not considered, since the meshes don't come from objects.

Merging all materials rather than just the materials on the first mesh
requires a change to the boolean-mesh conversion. This subtly changes
the behavior for object linked materials, but in a good way I think;
now the material remap arrays are respected no matter the number
of materials on the first mesh input.

Differential Revision: https://developer.blender.org/D14788
2022-05-03 09:47:40 +02:00
af2740abc0 Fix T97718: Crash using "Text on Curve"
8e4c3c6a24 mistakenly used the `vec` argument
of `BKE_where_on_path` like it was optional. Fix by
making that argument optional too.
2022-05-03 09:47:40 +02:00
00fb44797a Fix T97543: Changing multipass images doesn't update the image.
Code was partial migrated from the previous image engine. Missing multilayered
images.
2022-05-03 09:47:40 +02:00
cc0c4c17f0 Fix T95752: crash 'Select Linked' after loopcut in multiobject editmode
This was reported explicitly for originally being in face selectmode,
but could also crash when in vertex selectmode (when doing multiple
cuts).

The reason here is that `MESH_OT_loopcut` switches to edge select mode
(needed for `TRANSFORM_OT_edge_slide`, done in `ringsel_finish`), but was
only doing this on the active object's editmesh, all other participating
meshes would keep their selectmode which would now be out of sync with
both the active object's editmesh and scene settings for these.

This causes problems later in 'Select Linked'. Here, a mixture of
objects are used. First the viewcontext is set up with the active
object, then all participating objects are iterated (changing the
viewcontext to another object), then `unified_findnearest` would use that
changed viewcontext which would now contain the last object iterated. To
repeat: this could now have a different selectmode than the active
object which is later **again** used to get the nearest `BMElem` from in
`EDBM_elem_from_selectmode`. So in the failing case, we could get an
edge (but no face because of edge selectmode) from `unified_findnearest`,
`EDBM_elem_from_selectmode` would return NULL though (edge provided, but
in face selectmode), leading to the crash.

To solve this I assume it is best to change selectmode on all
participating meshes in multi-object editmode loopcut if necessary so
these are always in sync for following operations.
Alternatively, `Select Linked` (and probably lots more operators) would
have to be tweaked to pay closer attention which object is really used
to get selectmode from.

Note the selectmode is actually set back from edge selectmode in certain
cases (see `USE_LOOPSLIDE_HACK`), this patch changes that as well to act
on all participating meshes.

Maniphest Tasks: T95752

Differential Revision: https://developer.blender.org/D14791
2022-05-03 09:46:18 +02:00
1a6d0ec71c Fix T93272: Material index mapping missing for mesh boolean node
This commit implements copying of materials and material indices from
all of the boolean node's input meshes. The materials are added to the
final mesh in the order that they appear when looking through the
materials of the input meshes in the same order of the multi-socket
input node.

All material remapping is done with mesh-level materials. Object-level
materials are not considered, since the meshes don't come from objects.

Merging all materials rather than just the materials on the first mesh
requires a change to the boolean-mesh conversion. This subtly changes
the behavior for object linked materials, but in a good way I think;
now the material remap arrays are respected no matter the number
of materials on the first mesh input.

Differential Revision: https://developer.blender.org/D14788
2022-05-03 09:28:35 +02:00
c09c3246eb Fix T97718: Crash using "Text on Curve"
8e4c3c6a24 mistakenly used the `vec` argument
of `BKE_where_on_path` like it was optional. Fix by
making that argument optional too.
2022-05-03 09:25:28 +02:00
3d96fd6fd6 Fix T97543: Changing multipass images doesn't update the image.
Code was partial migrated from the previous image engine. Missing multilayered
images.
2022-05-03 09:12:00 +02:00
56039e30c7 Merge branch 'blender-v3.2-release' 2022-05-03 09:10:57 +02:00
38a4d96a90 Fix T97507: Crash when deleting adjustment layer
Issue was not properly fixed in 3cef9ebaf8 due to oversight.
`SEQ_get_channels_by_seq` returned pointer to `seqbase` instead of `channels`.
2022-05-03 08:47:27 +02:00
e4e5d7781e Fix T97547: Stereo rendering crash.
Viewports weren't drawn as they couldn't get a lock. Resulted in compositing
uninitialized viewports. Fixed by checking that both views were drawn.
2022-05-03 08:21:08 +02:00
e62b5e867d Cleanup: spelling in comments 2022-05-03 15:11:27 +10:00
ab7379ae62 Merge branch 'blender-v3.2-release' 2022-05-03 14:58:09 +10:00
4ee8dfa8b3 Fix use after free error when exiting a temp screen
Regression in [0] caused by checking the screen after event handling.

[0]: d4bdf21929
2022-05-03 14:50:40 +10:00
80c8a7dcb0 Merge branch 'blender-v3.2-release' 2022-05-03 13:27:20 +10:00
8810d0cecd Fix T85379: Cube projection size parameter is wrong
The input size was doubled & inverted.
2022-05-03 13:26:46 +10:00
e5a738af6d Merge branch 'blender-v3.2-release' 2022-05-03 09:49:09 +10:00
ecc2ec724e Cleanup: quiet shadow warning 2022-05-03 09:43:56 +10:00
79d4740eda Cleanup: use context.temp_override
Remove use of deprecated operator context passing.

Also minor clarification in the context.temp_override docs.
2022-05-03 09:32:28 +10:00
309b6319a0 Cleanup: quiet unused variable warning 2022-05-03 09:32:27 +10:00
Henrik Dick
fd7384a751 Merge branch 'blender-v3.2-release' 2022-05-02 22:18:21 +02:00
Henrik Dick
62ef1c08af GPencil: Fix envelope modifier deform mode thickness
The thickness in the deform mode was just correct if the radius when
drawing a stroke was set to 20. Now all factors that influence the
stroke thickness are considered in deform mode.

Differential Revision: https://developer.blender.org/D14691
2022-05-02 22:13:38 +02:00
0d9e22d43c GPencil: New Noise modifier random in Keyframes only
This is for some animation styles that usually copy and paste keyframes and they want avoid that both frames look equal, but they don't want noise randomness changes in the inbetween frames.

The patch adds a new random `Mode` option to select when the noise change.

Reviewed By: pepeland

Maniphest Tasks: T97099

Differential Revision: https://developer.blender.org/D14566
2022-05-02 17:36:58 +02:00
b1e0be0d25 Merge branch 'blender-v3.2-release' 2022-05-02 16:06:42 +02:00
ab5d52a6db GPencil: New Sculpt Auto masking options
Now it's possible to use auto masking at 3 levels:

* Stroke
* Layer
* Material

The masking options can be combined and allows to limit the effect of the sculpt brush.

Diff Revision: https://developer.blender.org/D14589
2022-05-02 16:05:04 +02:00
5188c14718 Fix T97688: Deleting a scene with a scene strip causes the referenced scene to have zero users
Relinking code would weirdly enough allow clearing of extra/fake user
status on IDs used by affected ID, which would be utterly wrong.

Fairly unclear why this was working OK in reported case before rBa71a513def20,
could not spot any obvious reason just from reading code...

Also, in `libblock_remap_data_update_tags`, only transfer fake user
status if `new_id` is not NULL (otherwise that would have removed that
falg from `old_id`, without actually transferring it to anything).
2022-05-02 15:58:53 +02:00
263f56ba49 Add RNA accessor for 'extra user' ID tag,
Not expected to be used directly by users, but very handy to have around
for investigations and debugging.
2022-05-02 15:58:53 +02:00
4c3efb4320 Cleanup: fix "parameter unused" warning
No functional changes.
2022-05-02 14:34:31 +02:00
e07ac34b3f Merge branch 'blender-v3.2-release' 2022-05-02 12:21:15 +02:00
Ethan-Hall
3d5f5c2d9a Color Attributes: Add initial fill color option
This patch adds allows the user to select the initial fill color when
adding a new color attribute layer.

---
{F13035372}

Reviewed By: JulienKaspar, joeedh

Differential Revision: https://developer.blender.org/D14743
2022-05-02 12:18:23 +02:00
38394e1a32 GPU: Remove OCIO workaround for Apple.
OCIO shader was ported to use GPUShaderCreateInfo a while ago. That
made this workaround not needed anymore.

Best to remove it before the release.
2022-05-02 12:15:21 +02:00
d0948dfb17 Merge branch 'blender-v3.2-release' 2022-05-02 11:58:20 +02:00
b54c6a20aa Curves: fix brush position is not under mouse cursor
This was mostly noticable in the case of the Delete brush, when
clicking somewhere in empty space. It used the closest point on
a curve as brush position.
2022-05-02 11:36:42 +02:00
1b0da28038 EEVEE: Fix compiler warning 2022-05-02 11:22:57 +02:00
951fae3578 Revert "Blender 3.2 splashscreen"
This reverts commit d1cbfc81bb.
2022-05-02 11:06:38 +02:00
4f3b562506 Revert "Blender 3.2 - Beta"
This reverts commit da46ed9116.
2022-05-02 11:06:21 +02:00
0c80a0acd8 Merge branch 'blender-v3.2-release' 2022-05-02 11:05:53 +02:00
d1cbfc81bb Blender 3.2 splashscreen
Credits: Oksana Dobrovolska
2022-05-02 10:38:59 +02:00
da46ed9116 Blender 3.2 - Beta
* BLENDER_VERSION_CYCLE set to beta
* Update pipeline_config.yaml to point to 3.2 branches and svn tags
* Update and uncomment BLENDER_VERSION in download.cmake
2022-05-02 10:35:39 +02:00
46b32c9d7b Blender 3.3 bcon1 - alpha
Bump the version number for the new release cycle.
2022-05-02 10:28:30 +02:00
12baea1b8e EEVEE: Fix compilation on MSVC 2022-05-02 10:09:46 +02:00
8ece0816d9 EEVEE: Rewrite: Implement nodetree support with every geometry types
This commit introduce back support for all geometry types and all nodetree support.
Only the forward shading pipeline is implemented for now.

Vertex Displacement is automatically enabled for now.

Lighting & Shading is placeholder.

Related Task: T93220

# Conflicts:
#	source/blender/draw/engines/eevee_next/eevee_engine.cc
#	source/blender/gpu/CMakeLists.txt
2022-05-02 09:35:45 +02:00
f0f44fd92f Curves: support spherical delete brush
Differential Revision: https://developer.blender.org/D14797
2022-05-02 09:18:57 +02:00
a5644f9a28 Cleanup: GPUBuiltinShader: Remove old shader interfaces
This leaves some of the unresolved case where we still need both
implementation.
2022-05-02 01:31:24 +02:00
aaab3c8ad4 Cleanup: GPUShader: Make style consistent in builtin_shader_stages 2022-05-02 01:05:35 +02:00
f0118e9aca GPUShader: Remove GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE
This had only one use and it was for debugging. Remove the shader for now.
This also simplifies the debug drawing even if slower.
2022-05-02 00:57:32 +02:00
5e5e198bbe GPUShader: Port 3D uniform color clipped shaders to use shaderCreateInfo
This should have no functional changes.
2022-05-02 00:44:58 +02:00
0676963809 GPUShader: Port dashed line shaders to use shaderCreateInfo
This should have no functional changes.

This reduce the complexity of the shader by only supporting 2 colors.
We never use more than 2 color in practice and this makes usage not require
a UBO.
2022-05-02 00:35:49 +02:00
2a7a01b339 GPUShader: Port polyline shaders to use shaderCreateInfo
This should have no functional changes.
2022-05-01 23:54:41 +02:00
aa34706aac Fix T97545 DRW: Crash cause by invalid " char in glsl source
Some old compiler do not like this character even if inside an `#error`
directive.
2022-05-01 22:42:07 +02:00
3f0c09f6dd GPUShaderCreateInfo: Add validation for overlapping vertex attribute
Those are usually not supported but some driver silently fix them and most
just silently fail (rendering error).
2022-05-01 22:28:38 +02:00
fc872d738e GPUShader: Port 2D widget shaders to use shaderCreateInfo
This should have no functional changes.
2022-05-01 21:12:59 +02:00
a330b9b0ea GL: Add attribute-less shader workaround for MacOS to the backend
This workaround and the issue was described in D4490. This makes sure
any shader using `shaderCreateInfo` will benefit from the same workaround.
2022-05-01 20:54:33 +02:00
631506d9c3 External Engine: Reuse depth only shader from Basic engine
This removes the usage of `GPU_shader_create_from_info_name()`.
2022-05-01 19:35:37 +02:00
eba06fee49 Basic Engine: Port depth shader (object selection) to shaderCreateInfo
This should have no functional changes.
2022-05-01 19:35:37 +02:00
c87f6242b9 Fix T97644: new 3.2 obj importer does not set blend mode for eevee
The old python importer had a "if do_transparency, set blend_method to
BLEND" type of logic. This bit was missing in the new importer; it was
only setting the eevee blend method when a transparency texture was
present, but not in other cases of transparency (as driven by MTL
"illum" mode).

Reviewd By: Howard Trickey
Differential Revision: https://developer.blender.org/D14783
2022-05-01 20:10:21 +03:00
33518f9da1 Fix T97417: OBJ: support tab and other whitespace characters after obj/mtl keywords
Even if available OBJ/MTL format documentations don't explicitly specify
which characters can possibly separate keywords & arguments, turns out
some files out there in the wild use TAB character after the line
keywords. Which is something the new 3.2 importer was not quite
expecting (T97417).

Fix this by factoring out a utility function that checks if line starts
with a keyword followed by any whitespace, and using that across the
importer. Also fix some other "possible whitespace around name-like
parts" of obj/mtl parser as pointed out by the repro files in T97417.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14782
2022-05-01 20:07:03 +03:00
30d1d4579e Cleanup: Overlay: Remove unused extern datatoc and shader library
These are not needed anymore.
2022-05-01 18:47:51 +02:00
6cad9c7964 Overlay: Port particle display shader to use shaderCreateInfo
This should have no functional changes.
2022-05-01 18:40:48 +02:00
d02d1129f7 Overlay: Port particle edit shader to use shaderCreateInfo
This should have no functional changes.
2022-05-01 18:17:37 +02:00
6861ef62a6 Overlay: Port sculpt mask shader to use shaderCreateInfo
This should have no functional changes.
2022-05-01 18:07:16 +02:00
cc268238ea Overlay: Port wireframe shader to use shaderCreateInfo
This should have no functional changes.
2022-05-01 17:39:32 +02:00
ba22aa8797 Overlay: Port facing shader to use shaderCreateInfo
This should have no functional changes.
2022-05-01 17:14:30 +02:00
e59cc3a814 Overlay: Port gpencil canvas shader to use shaderCreateInfo
This should have no functional changes.
2022-05-01 17:07:20 +02:00
d33801e2bf Overlay: Port image empty shader to use shaderCreateInfo
This should have no functional changes.
2022-05-01 16:30:51 +02:00
1c992cc647 Overlay: Fix non functional outline on wireframe
This was caused by rB6e5877c189df5d6c2dfcaa44ba4c3c9a8b387998.
2022-05-01 15:37:37 +02:00
0dfb6eddc0 Overlay: Port motion path shaders to use shaderCreateInfo
This should have no functional changes.
2022-05-01 15:37:37 +02:00
0c44b03b09 Overlay: Port 2D image overlay shaders to use shaderCreateInfo
This should have no functional changes.
2022-05-01 15:37:37 +02:00
df0616bcd0 Nodes: Fix T90233
- Fix default_value initialization of custom node tree interface:

  This was crashing when adding a custom interface socket to a tree.
  The node_socket_set_typeinfo function was called too early, creating a
  default float socket, which then doesn't match the socket type after
  changing to the custom type.

  The node_socket_set_typeinfo only allocates and initializes
  default_value when it isn't already set. That is because the function is
  used either when creating new sockets or to initialize typeinfo after
  loading files. So default_value has to be either null or has to be
  matching the current type already.

- Fix RNA flag for string return value of the valid_socket_type callback:

  String return values of registerable RNA functions need a
  PROP_THICK_WRAP flag since they don't have a fixed buffer to write into.
2022-05-01 09:27:22 +01:00
171851a6c8 Material: Hide material output socket Thickness as it is not used for now
This is a EEVEE-Next feature that is not yet implemented. Ideally the
socket should only be displayed when EEVEE is in the selected target
engine.
2022-05-01 10:09:23 +02:00
Nate Rupsis
5ff931149b Updating Graph editor channels pin tool tip
Reviewed By: Blendify

Maniphest Tasks: T97631

Differential Revision: https://developer.blender.org/D14766
2022-04-30 23:12:44 -04:00
12217714c7 Overlay: Port depth only & uniform_color shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-30 23:56:31 +02:00
86b37748a7 Overlay: Port background shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-30 23:54:52 +02:00
6e5877c189 Overlay: Port outline shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-30 23:13:27 +02:00
69a43069e8 Overlay: Port edit gpencil shaders to use shaderCreateInfo
This should have (mostly) no functional changes.

Support for clipping was added to the shaders but it is not enabled for now
as we wait for the Gpencil engine to support clipping.
2022-04-30 21:11:55 +02:00
Germano Cavalcante
57b4efc250 Overlay: port paint shaders to use 'GPUShaderCreateInfo'
Simple port.

Also a description of how each shader is used has been added.

NOTE: The shader created using `OVERLAY_shader_paint_vertcol` cannot be tested.
Apparently it is created but not used.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14812
2022-04-30 14:50:57 -03:00
fc40356ed8 Overlay: Port edit lattice shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-30 19:35:51 +02:00
a8e6ee17cc Overlay: Port edit curves shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-30 19:20:37 +02:00
669349bfe4 Overlay: Port edit uv shaders to use shaderCreateInfo
This should have no functional changes.

Removed `antialiasing_vert.glsl` becaus it was actually a duplicate of
`common_fullscreen_vert.glsl`.
2022-04-30 18:25:05 +02:00
b95601fa1a Overlay: Port edit uv shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-30 17:37:19 +02:00
237857cc26 Overlay: Port volume shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-30 16:30:09 +02:00
ac88123e29 Fix T96576: Light leaking when using normal maps with Multiscatter GGX
The Multiscatter GGX code was missing the same-side checks for incoming and
outgoing directions w.r.t. to shading and geometry normal.

Should not be needed for the Glass variant since it intentionally has both
reflection and transmission.
2022-04-30 13:49:45 +02:00
5c92c04518 XR: Add object extras, object types visibility session options
This allows object extras such as image-empties to be shown in the VR
viewport/headset display. Being able to see reference images in VR can
be useful for architectural walkthroughs and 3D modeling applications.

Since users may not want to see all object extras (lights, cameras,
etc.), per-object-type visibility settings are also added as session
options.

By slightly refactoring the definition of the 3D View object types
visibility panel (note: no functional changes), the VR Scene Inspection
add-on can show a similar panel without duplicating code. When VR
selection is possible in the future, the object type select options can
also be enabled.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D14220
2022-04-30 16:23:43 +09:00
Ramil Roosileht
2fc6563a59 D14808: Use saturation as multiplier for saturation filter
A change proposed in T97697, using existing saturation as a multiplier for the filter operation
{F13038602}

Review By: Joseph Eagar, Julian Kaspar
Differential Revision: https://developer.blender.org/D14808
Ref D14808
2022-04-29 20:12:45 -07:00
eaa63c7d68 Overlay: Port extra shaders to use shaderCreateInfo
This should have no functional changes.
2022-04-29 20:38:42 +02:00
fc2c22e90c Cycles: Hydra fixes for stageMetersPerUnit and OpenGL context on Windows
Add "stageMetersPerUnit" render setting for USD files that have that set to
something other than the default (e.g. exported by Blender).

And fix a crash when an application creates a Hydra render pass on a thread
that does not have an OpenGL context current.
2022-04-29 19:19:39 +02:00
9b92ce9dc0 Cycles: add USD as a file format for Cycles standalone rendering
Long term, this should replace the XML format. This reuses the Hydra render
delegate implementation, and so supports the same features. The same command
line options and GUI work for both XML and USD also.

The implementation of this is still disabled, waiting for some refactoring of
USD library linking. However we want the Cycles code to be in sync between
repositories for the 3.2 release.

Ref T96731
2022-04-29 19:19:19 +02:00
060a50a5f7 Cycles: refactor Hydra render delegate building
* Leave code for building the render delegate against other applications and
  their USD libraries to the Cycles repository, since this is not a great fit.
  In the Blender repository, always use Blender's USD libraries now that they
  include Hydra support.
* Hide non-USD symbols from the hdCycles shared library, to avoid library
  version conflicts.
* Share Apple framework linking between the standalone app and plugin.
* Add cycles_hydra module, to be shared between the standalone app and plugin.
* Bring external libs code in sync with standalone repo, adding various missing
  libraries.
* Move some cmake include directories to the top level cycles source folder
  because we need to control their global order, to ensure we link against the
  correct headers with mixed Blender libraries and external USD libraries.
2022-04-29 19:03:06 +02:00
074a8558b7 Fix rendering of wire curves when used as custom bone objects
In the current code we do not render any curves if they have not been
converted to meshes. This change makes the custom bone drawing try to
render mesh objects first and then falls back to curve objects if there
is no mesh data available.

Reviewed By: Clement

Differential Revision: http://developer.blender.org/D14804
2022-04-29 18:22:32 +02:00
3eb9b4dfbc Windows: make.bat change python detection order
Given we are officially on 3.10 now, look
for that version first, followed by any future
version before falling back to 3.9
2022-04-29 10:13:01 -06:00
a6f951b464 Cycles: make Hydra display driver optional, for USD without OpenGL
OpenGL support was removed from Blender's USD precompiled libraries. This
is currently only useful when building against other applications anyway.
2022-04-29 18:08:41 +02:00
e0315a5ef0 Cycles: add profiling command line argument to standalone
Like --cycles-print-stats for Blender.
2022-04-29 18:08:41 +02:00
1a8a69d318 Cleanup: Fix harmless runtime error about null pointer in Outliner tree code.
While the reference would never be used in case of NULL pointer, this
bit of code was not really clear and nice, so make it less ambiguous
now. Also add early return in case a NULL idv pointeris actually passed.
2022-04-29 17:57:46 +02:00
3c7a6718dd Fix T95480: Crash when relocating libraries in some cases.
While code deleting old (relocated to new ones) IDs would work fine in
typical cases, it would fail badly in others, when e.g. drivers would
create 'reversed' dependency from the obdata ID to the object ID.

This commit uses a less efficient, but much safer method. It also
ensures no relocated old IDs is left over in the file (previous version
could easily leave some old IDs from the old library until a full
save/reload cycle happened).
2022-04-29 17:57:46 +02:00
4d464a946a Fix (unreported) library relocating code making indirectly linked IDs direct.
While relatively minor issue, it could become fairly annoying in a big
project, since once an ID is tagged as directly linked it tend to remain
as such.

Now also force indirect tagging when loading new IDs as part of a lib
relocation process, since the ones actually directly linked will be
tagged as such later on.
2022-04-29 17:57:46 +02:00
d779b15485 Fix (unreported) bad handling of ID usercount increment in remapping code.
While this only had minor potential effect, both code incrementing
usercount of newly remapped IDs were wrong.

Original one would by-pass any 'ensured user' handling, newer one would
systematically make the ID directly linked...

`id_us_plus_no_lib` is to be used here.
2022-04-29 17:57:46 +02:00
f44a34fc55 BKE_lib_remap: add comment note about some remapping options.
Fact that those options are only used in a specific case, and that the
same behavior is ensured in a different part of the code in other cases,
is fairly confusing and unfortunate... At least document it.
2022-04-29 17:57:46 +02:00
3b7bce45d2 Fix T97686 DRW: Freeze when switching to material preview or render view
This was caused by the compilation job being created suspended (to avoid
UI slowdown because of the material Preview Icons). The suspended job
wasn't passing the `WM_jobs_test` in `DRW_deferred_shader_remove` and
the material would still be in the compile queue with its status equal to
`GPU_MAT_QUEUED`. This would block the main thread in the waiting loop.
But since the job manager timer needs to execute in the main thread, the
compilation job was never being pushed out of its suspended state.
This lead to a complete lock situation.

The solution is to use `WM_jobs_customdata_from_type` which does exactly
what we need.

Also fixed a nullptr free.
2022-04-29 17:57:38 +02:00
9ef727d3d4 Cycles: make internal integrator defaults match Blender more closely
This does not affect Blender integration, but gives better defaults for
Cycles standalone.
2022-04-29 17:39:04 +02:00
0634bb24ee Cleanup: remove unused server app after network render was removed 2022-04-29 17:39:04 +02:00
0c317e23bf Cleanup: fix various Cycles build warnings with non-default options
* Float/double promotion warnings were mainly meant for avoiding slow
  operatiosn in the kernel. Limit it to that to avoid hard to fix warnings
  in Hydra.
* Const warnings in Hydra iterators.
* Unused variable warnings when building without glog.
* Wrong camera enum comparisons in assert.
* PASS_UNUSED is not a pass type, only for pass offsets.
2022-04-29 17:39:04 +02:00
5d84d9b0d6 Cleanup: Simplify job custom data query API
There were two calls to access job's custom data. One of them
ignored job type, the other one ignored job owner.

Now there is a single function to access job's custom data.
If the job type or owner is not relevant NULL or WM_JOB_TYPE_ANY
can be passes explicitly.

Differential Revision: https://developer.blender.org/D14803
2022-04-29 16:49:52 +02:00
2f49908a5e NLA: Key influence when pushing down to NLA
When pushing down an Action onto an NLA track, set the new Strip's
influence to the Action's influence. This is done by setting a key due
to the way the NLA Strip influence works (it's either animated, or
ignored).

Reviewed By: sybren, RiggingDojo

Differential Revision: https://developer.blender.org/D14719
2022-04-29 16:28:02 +02:00
baae87ce86 Fix: Incorrect custom data maxlayers in rare files
For a single day in 2015 between rBff3d535bc2a6309 and rB945f32e66d6ada,
custom data structs could be written with an incorrect maxlayer field.
This means that custom data structs read from those files would think
they have more space to add new layers than they actually did, causing
a crash if more layers were added. This was found while investigating
a crash from D14365 which adds new face corner layers in versioning.

The fix is to reset all maxlayer integers to totlayer, which is
done when writing files in current Blender anyway.

The file tests/render/motion_blur/camera_zoom_blur_perspective.blend
has this problem as it was added on 2015-07-21, right between the two
commits. Adding three custom data layers in versioning code would crash.

The problem was originally found and investigated by Martijn Versteegh
(@Baardaap), thanks!

Differential Revision: https://developer.blender.org/D14786
2022-04-29 09:20:10 -05:00
473a2c83ea Cleanup: fix unused parameter warning
Fix 'unused parameter' warning when building without OpenColorIO.

No functional changes.
2022-04-29 16:13:23 +02:00
a7db7f88b0 Fix CMake error in new builds after previous NanoVDB fix 2022-04-29 15:38:21 +02:00
1d9c050188 Fix wrong cast from uint to int (2)
Error in rB3d877c8a0d06
2022-04-29 10:22:49 -03:00
a323ada701 Fix wrong cast from uint to int
Error in rB3d877c8a0d06
2022-04-29 10:19:58 -03:00
Demeter Dzadik
7fd11d9c7f T95386: Add Discontinuity (Euler) filter to Dope Sheet.
Add the Discontinuity (Euler) Filter operator to the Dope Sheet->Key
menu, so it's not only available from the Graph Editor->Key menu. On
request of @pablico, see T95386.

This required changing a poll function which is used by a bunch of other
operators, which seemed scary at first, but my thinking is that if an
operator can execute in the Graph Editor, then it should also be able to
execute in the Dope Sheet. I think the only reason this wouldn't be true
is if we were storing animation data in the UI itself, which of course
we don't. So I hope this is okay.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14015
2022-04-29 15:17:27 +02:00
3d877c8a0d Select Engine: port shader to use 'GPUShaderCreateInfo'
Simple port with a few cosmetic changes:
- Attribute named "color" for indices VBO is now called "index"
- The indices VBO is now composed of `int`s instead of `uint`s (this simplifies the source)

Differential Revision: https://developer.blender.org/D14800
2022-04-29 10:15:04 -03:00
a111a0f1e1 Fix missing NanoVDB patch for HIP support, after unifying with OpenVDB
This patch has also been contributed upstream, so will not be needed anymore
soon. Also automatically clear cached variables for new nanovdb location in
libs.
2022-04-29 15:12:46 +02:00
a1b21a3503 CMake: harvest nanovdb from its new location
NanoVDB is now bundled with OpenVDB (since rBb9c37608a9e) instead of a
separate package.

This still doesn't include our patch to support AMD HIP; that'll be
committed separately soon.
2022-04-29 14:34:25 +02:00
d442782dbe Fix Cycles versioning code after recent change
Need to use get() instead of is_property_set() for properties
which are not defined as Property.
2022-04-29 11:49:53 +02:00
62eb190d4e Cleanup: Remove old filter property.
It was kept for forward compatibility during 2.7x.

Reference rB5a45ccaf3e5102ee571599fa9f26a78ac1f6d0f4
2022-04-29 10:36:19 +02:00
fcb0090842 GLState: Avoid possible undefined behavior in state comparison
The bitwise XOR used to compute the delta (`changed`) might produce NaN and
thus produce undefined behavior when comparing to another float (because of
float promotion).
2022-04-29 09:10:07 +02:00
65e7219706 Fix T97097: Color filter saturate affects non-colors
Saturation is now tested for > 0.001 instead of != 0.
We may wish to turn the limit into an operator property
in the future.
2022-04-28 23:24:10 -07:00
cc8fe1a1cb Fix T97120: Gizmo fails to select in orthographic view
Regression in exposed by 49fc4449e7.
2022-04-29 16:21:23 +10:00
7f0163118b Fix T97608: Sculpt sample color op is missing pmap
Add missing call to BKE_sculpt_update_object_for_edit.
2022-04-28 23:19:06 -07:00
720e19a833 Fix T62945: Hotkeys not showing up in brush tooltips 2022-04-28 23:13:53 -07:00
9dadd8bdb1 Fix T97124: Area light size gizmo unselectable
Workaround for MS-Windows NVidia/LLVMPipe combination failing to select
the gizmo unless depth-test was used.
2022-04-29 13:13:30 +10:00
0b5cf91b89 Cleanup: use 'use_' prefix for RNA boolean 2022-04-29 09:43:03 +10:00
1e23304fbc Cleanup: missing declaration warnings & spelling in comments 2022-04-29 09:27:46 +10:00
9a25a34e42 shader_builder: fix build issue on windows
shader_builder had no manifest set, leading
to the classic common control version being
loaded which in turn caused an import error
and made the executable fail to initialize.
2022-04-28 16:57:46 -06:00
4b96517e20 Build: disable Metal for USD libraries also, it fails to build without OpenGL
This only affects macOS.

Ref D14792
2022-04-28 23:49:56 +02:00
f38f12cbbc Cleanup: silence unused variable warnings 2022-04-28 18:41:44 -03:00
810f33d434 Fix: Missing translation in node socket inspection 2022-04-28 15:11:26 -05:00
Ethan-Hall
708fabe3d7 Fix: Socket inspection error for data-block sockets
After rB47276b847017, for certain socket types such as object or
material, the name of the item is not obtained correctly leading
the tooltip to display random non-character memory values as text.

Differential Revision: https://developer.blender.org/D14762
2022-04-28 15:06:24 -05:00
8095875dff Fix T97151: Curve vertex parenting crash with dependency cycle
When the object's position depends on the geometry and the geometry
depends on the object's position, we can't count on the object's
evaluated geometry to be available. Lattices and mesh objects have
equivalent checks in this vertex parenting function.

Differential Revision: https://developer.blender.org/D14781
2022-04-28 14:58:52 -05:00
4b7ed584a8 Cleanup: Overlay: Avoid local variable shadowing 2022-04-28 21:44:15 +02:00
d5f3351f55 Overlay: Port UDIM Grid shader to shaderCreateInfo
Simple Straight forward port.
2022-04-28 21:43:54 +02:00
308a12ac64 Overlay: Port Grid shader to shaderCreateInfo and other code cleanup
Along with the port to createInfo this also:
- Packs constant uniforms in a UBO.
- Share enum declaration and unify names
- Makes codeflow easier to undestand.
- Split grid data to its own struct.

# Conflicts:
#	source/blender/draw/engines/overlay/overlay_grid.c
2022-04-28 21:13:04 +02:00
3d9f0280ff Fix T93899: Incorrect decorator buttons for geometry nodes vector/colors
For properties exposed to the geometry nodes modifier, decorators didn't
work at all for colors and it only worked on the X component of vectors.
The fix is to use -1 for the RNA index of the decorator button instead
of 1, which lets the UI code figure out what to do with arrays.
2022-04-28 13:46:42 -05:00
Ethan-Hall
1425b356b8 UI: Fix consistency issues with attribute tooltips and icons
This patch modifies tooltips of attributes and UV maps to resolve
inconsistencies. It also restores the vertex color icon that went
missing from the UI lists when color attributes replaced vertex colors.

Fixes T97614

Differential Revision: https://developer.blender.org/D14768
2022-04-28 13:08:52 -05:00
c722993ef1 Fix T94467: Cycles baking of normal pass slower than before cycles-x 2022-04-28 19:55:12 +02:00
5b1ec08f04 Fix T93546: Fill curve node ignores last point of non-cylic curves
The node is meant to consider all curves cyclic, which means that it
shouldn't account for one fewer segment on non-cyclic curves.
2022-04-28 11:50:55 -05:00
2d7957727c Fix: Incorrect conversion from C bitfield syntax
Recent cleanups 9a8669ac81 and 1c790555a0
incorrectly interpereted the bitfield width syntax as a default
value. Also resolve two other compilation warnings.
2022-04-28 11:19:12 -05:00
Sebastian Herholz
fbc884d2a8 Ensure BSDF evals and pdfs are zero on invalid samples
Currently, the `eval` and `pdf` are not explicitly set to zero when a BSDF sample is invalid (e.g., below the upper hemisphere), when calling
`bsdf_sample` or `bsdf_eval`. It is assumed that `eval` and `pdf` are set to zero before these functions are called, which can cause problems if not.

This patch fixes this potential problem by explicitly setting `eval` and `pdf` to zero when the sampled direction is invalid.

I also added a sanity check if `eval` and `pdf` are valid (i.e., >= 0.f).
The check is activated when build in debug mode and with the `WITH_CYCLES_DEBUG` set to `ON`.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D14776
2022-04-28 18:14:06 +02:00
Sebastian Herholz
bd327e3bf3 Fix: Sky models can return negative values
When converting from XYZ to RGB it can happen, in some sky models, that the resulting RGB values are negative.
Atm, this is not considered and the returned values for the sky model can be negative.

This patch clamps the returned RGB values to be `= 0.f`

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D14777
2022-04-28 18:14:06 +02:00
Christophe Hery
110eb23005 Fix T97056: Cycles MNEE caustics treated as direct instead of indirect light
This fixes wrong render passs and bounce limits.

Differential Revision: https://developer.blender.org/D14737
2022-04-28 18:00:11 +02:00
4296c1fe25 Fix T97142: When Exporting GPencil, File Dialog Shows No Subfolders
The export had missing the `FILE_TYPE_FOLDER` flag.
2022-04-28 17:58:24 +02:00
099120e54a Cleanup: Fix compiler warnings 2022-04-28 10:53:50 -05:00
Ethan-Hall
024386bb89 UI: Improvements to "Add Color Attribute" menu
Allow the session to save the choice for domain and data type since
it is highly likely that the user intends to use the same settings
for subsequent color attributes.

Use expanded button selectors for domain and data type since there
are only two options for each.

Differential Revision: https://developer.blender.org/D14785
2022-04-28 10:47:23 -05:00
f4718d52f3 Snap Gizmo: update props using gizmo's snap_state
A snap state can be replaced by another snap state of a gizmo or cursor.

The snap gizmo should only change its state, not the current state.

It's not really a problem currently.
2022-04-28 12:41:50 -03:00
16b6d4aeb3 Deps:Specify versions for implicit python modules
D14686 added autopep8 which implicitly dragged in
toml and pycodestyle which were not versioned, this
diff adds explicit versions of these deps so there
won't be any version changes if we rebuild in the
future.

Reviewed By: brecht, sybren

Differential Revision: https://developer.blender.org/D14793
2022-04-28 09:37:22 -06:00
44b318bd22 Fix T97527: multiview camera suffix not working with more than 4 characters
Thanks to Germano Cavalcante for finding the solution.
2022-04-28 17:36:07 +02:00
853713336f Fix non-face oriented snap cursor in dragdrop
If the measure gizmo is enabled, its snap state is used in the snap update.

As it does not require a plane, the orientation of the plane is not
calculated.

However, the calculation of the plane's orientation must prevail over
the states.
2022-04-28 12:33:16 -03:00
91bd63a196 CMake: Reduce dependencies of USD
`PXR_ENABLE_OSL_SUPPORT=OFF`: OpenShadingLanguage is an optional
dependency of the Imaging module. However, since that module was
included for its support for converting primitive shapes (sphere, cube,
etc.) to geometry, OSL is not necessary. Disabling it will make it
simpler to build Blender; currently only Cycles uses OSL.

`PXR_ENABLE_GL_SUPPORT=OFF`: GL support on Linux also links to X11
libraries. Enabling it would break headless or Wayland-only builds.
OpenGL support would be useful if someone wants to work on a Hydra
viewport in Blender; when that's actually being worked on, we could
patch in a new PXR_ENABLE_X11_SUPPORT option (to separate OpenGL from
X11) and contribute it upstream.

`PXR_BUILD_OPENIMAGEIO_PLUGIN=OFF`: It's used for loading image textures
in Hydra Storm / Embree renderers which we don't use.

Reviewed By: LazyDodo, brecht, makowalski

Differential Revision: https://developer.blender.org/D14792
2022-04-28 17:16:04 +02:00
22f5c05cb3 Snap Cursor: split 'ED_view3d_cursor_snap_data_get'
Split 'ED_view3d_cursor_snap_data_get' into 'update' and 'get' functions

Sometimes we just want to update and sometimes we just get the result.

Make it clear.
2022-04-28 11:28:37 -03:00
17769489d9 VSE: Add option to limit timeline view height
When height is limited, it is defined by space occupied by strips,
but at least channels 1 to 7 will be always visible. This allows it to
easily overview timeline content by zooming out to maximum extent in Y
axis and panning in X axis.

More channels can be "created" on demand by moving strip to higher
channel. When strip is removed and highest channel becomes empty, view
will stay as is until it is moved down. Then new highest point is
remembered and it is not possible to pan upwards until strip is moved to
higher channel.

Limiting takes into account height of scrubbing and markers area as
well as scrollers. This means that when zoomed out to maximum extent,
no strips are obstructed by fixed UI element.

Fixes T57976

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D14263
2022-04-28 16:14:51 +02:00
b1b153b88c Cleanup: Improve const correctness of shape key functions 2022-04-28 09:10:50 -05:00
4412cbc6d1 Cleanup: Make RNA function comment more readable
This complex comment was hard to parse visually.
There was some odd line breaking going on, and together with no
indentation for the continued lines, it was just a blob of text with no
visual structure. You wouldn't see easily where the description of an
argument started or ended.
2022-04-28 16:06:09 +02:00
c9c95201d0 Fix T97679: Retrieving shape key normals modifies vertices
Caused by not using the proper duplicated `MVert` array.
Error in b0aaf6ff4a.
2022-04-28 08:45:31 -05:00
0ad73bb965 Geometry Nodes: Add default attribute name to field inputs/outputs
Geometry node group inputs and outputs get a new property that controls
the attribute name used for that field input/output when assigning the
node group to a modifier for the first time. If the default name is assigned
to an input, the default "Use attribute name" is true .

In order to properly detect when a node group is first assigned,
the modifier now clears its properties when clearing the node group.

Ref T96707

Differential Revision: https://developer.blender.org/D14761
2022-04-28 08:39:30 -05:00
b0e47ffdcf UI: Sort VSE modifiers alphabetically 2022-04-28 14:40:31 +02:00
77794b1a7b VSE: Add precise drag and drop and strip previews
This patch adds the drag and drop strip previews in the VSE.
It also adds two new functions to the drag and drop API.

1. "draw_in_view" for callbacks that wants to draw elements in local viewport coordinates
2. "on_drag_start" that can be used for prefetching data only once at the start of the drag.

Reviewed By: Julian, Campbell

Differential Revision: http://developer.blender.org/D14560
2022-04-28 12:55:51 +02:00
Falk David
16fe767d00 GPencil: Fix offset modifier performance regression
When using an offset modifier on a grease pencil object, the performance
could be impacted due to the randomize option introduced by rB6a2bc40e0131.
Even if the option was not used (offset, rotation, scale set to zero), the modifier
would still compute the random transformation matrix.

The patch checks if the randomization is used and only then caluclates the matrix.

Reviewed By: #grease_pencil, antoniov

Differential Revision: https://developer.blender.org/D14553
2022-04-28 12:38:28 +02:00
e8102aea13 Cleanup: fix warning due to unused variable
This warning exists in gcc 9.4.0, apparently because the variable
is not used in some `constexpr` code paths.
2022-04-28 12:21:39 +02:00
37ede15e63 Blender 3.2 Beta - Subversion bump 2022-04-28 11:40:42 +02:00
Kevin C. Burke
eed8c2e655 Fix T96476: Equalize Handles not working on all keyframes
As the default handle type in Blender is 'Auto Clamped' the Equalize
Handles operator will often appear to have no affect on the selected
keyframes on which it is run. If either of the keyframes' handle types
are 'Auto', 'Auto Clamped', or 'Vector', this patch will convert the
handles to 'Aligned'.

Reviewed By: sybren

Maniphest Tasks: T96476

Differential Revision: https://developer.blender.org/D14345
2022-04-28 11:15:50 +02:00
198a763944 Cleanup: spelling in comments
Also use back-slashes for doxy commands.
2022-04-28 14:03:49 +10:00
eb4b79c556 Cleanup: unbalanced doxy sections, add some sections 2022-04-28 14:03:47 +10:00
9e2d80c49e Cleanup: format 2022-04-28 14:03:46 +10:00
74a44e816c Fix error holding stack memory in a uniform
Caused by db622b5a0b
2022-04-28 13:59:20 +10:00
8399375098 Cleanup: Reword comment, rename variables
Use "transform" instead of "obmat", because the meshes
don't necessarily come from objects.
2022-04-27 18:53:56 -05:00
52a5f68562 Revert "Cycles: Enable inlining on Apple Silicon for 1.1x speedup"
This reverts commit b82de02e7c. It is causing
crashes in various regression tests.

Ref D14763
2022-04-28 00:46:43 +02:00
3558f565f1 Fix T97498, T97651: crash in Cycles with TBB 2021 after recent changes 2022-04-28 00:24:13 +02:00
0539208f97 Fix T97666: Blender not starting on macOS 10.14 after library upgrade 2022-04-28 00:24:10 +02:00
e2cd5c6748 EEVEE: Add shader compilation progress in the viewport
Since rBfa43c47c7cb8446b632a4c0f712162ba615fe51f the progress bar do not
show the compilation progress. This was misleading as users could think
it could be canceled or prevent rendering.

Now we just show how many shaders are still in the compilation queue inside
each viewport. This number is more accurate than the percentage that was
previously displayed in the progress bar.
2022-04-28 00:16:18 +02:00
9c82c00b32 GPUMaterial: Rework the deferred compilation to not use double locks
This uses refcounter instead of double thread mutexes. This should be
more robust and avoir use after free situation.

Also remove redundant structures and the use of scene as the job owner.
2022-04-28 00:16:18 +02:00
676198f57f GPUMaterial: Use GPU_MAT_CREATED as a default 2022-04-28 00:16:18 +02:00
c6ce2be496 Fix T97627: Revert Window Redraw When Saving
Removal of the `WM_redraw_windows` call in `wm_file_write` introduced
in rB7a9cfd08a8d7415ff004809cf62570be9152273e as that can cause
crashing while saving from a script.

See D14780 for more details.

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

Reviewed by Campbell Barton
2022-04-27 15:07:34 -07:00
b60f3fe6ad Cleanup: Remove disabled optimization code
Addressing the TODO from the comment isn't a priority at the moment,
and should be solved a bit more generally anyway.
2022-04-27 16:40:30 -05:00
bfb4dcaa1a Fix T97235: PBVH draw cache invalidation bug
The PBVH draw cache wasn't being invalidated in
all cases.  It is now invalidated whenever a PBVH
node's draw buffers are freed.
2022-04-27 13:05:06 -07:00
f3d5114c41 Fix T93285: Wrong instance order when instancing a collection
At least on the Mac, `std::sort` sometimes passes the same value in the
`a` and `b` parameters.

The `true` return is only for cases where `a` is less than `b`.
2022-04-27 11:18:37 -03:00
ce115a2786 GPUCodegen: Fix broken materials after rB478eb3a0e6ed 2022-04-27 16:13:45 +02:00
69a720abb0 Fix broken obj tests from earlier commit
rB08731d70bf66 was not properly checking if subdivision needs to be
evaluated on the CPU.

Thanks Ray Molenkamp for noticing.
2022-04-27 16:02:34 +02:00
478eb3a0e6 GPUCodegen: Keep copy of attribute name in the GPUCodegenCreateInfo
This is to avoid use after free when the `GPUPass` gets compiled after the
original `GPUMaterial` used to create it was freed.

The issue was introduced by rBfa3bd17ae873
2022-04-27 16:01:41 +02:00
c01e33d6ca GPUCodegen: Use spin lock to protect the pass refcounter.
This is not performance critical so using the same global lock should not
pose any issue.
2022-04-27 16:01:41 +02:00
163f6a17e4 Fix T96434: bad performance with viewport statistics and GPU subdivision
The subdivision is always recomputed on the CPU when displaying stats
if the mesh is animated which leads to bad performance.

This caches the subdivision topology counters from the draw code in the
mesh runtime and uses them for the viewport statistics.

Differential Revision: https://developer.blender.org/D14774
2022-04-27 15:30:17 +02:00
08731d70bf Fix T96327: data transfer crash with GPU subdivision
The crash is caused as the subdivision wrapper does not have loop
normals, which are generally computed at the end of the modifier stack
evaluation via `mesh_calc_modifier_final_normals`. (Note that they are
initially computed, but deleted by the subdivision wrapper creation.)

This records in the mesh runtime whether loop normals should have been
computed and computes them alongside the subdivision wrapper.

Differential Revision: https://developer.blender.org/D14489
2022-04-27 14:03:03 +02:00
c5a4159bee Cleanup: format 2022-04-27 14:01:45 +02:00
Jason Fielder
db622b5a0b Metal: GLSL Compatibility - Hosting default uniform values.
There are a number of shaders, most notably grid_frag.glsl, which rely on default assignments to uniform values within shaders. This is not currently supported by the shader uniform push model implemented for the Metal backend, wherein uniform updates are pushed as a singular block of data. Any default assignment would become over-written.

As such, adding assignments of these default values in the high-level, to ensure the correct value is written for all APIs. This likely impacts Vulkan push-constants as well.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14555
2022-04-27 13:00:51 +02:00
cdd4354c81 Metal: MTLTexture core implementation for Metal backend, with minimal surrounding functionality.
This covers implementation of the GPUTexture abstraction for the Metal backend, with additional utility functionality as required.

Some components have been temporarily disabled pending dependencies on upcoming Metal backend components, and these will be addressed as the backend is fleshed out.

One core challenge addressed in the Metal backend is the requirement for read/update routines for textures. MTLBlitCommandEncoders offer a limited range of the full functionality provided by OpenGLs texture update and read functions such that a series of compute kernels have been implemented to provide advanced functionality such as data format conversion and partial/swizzled component updates.

This diff is provided in full, but if further division is required for purposes of code review, this can be done.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14543
2022-04-27 12:36:56 +02:00
68ca12a7fc Fix T96283: last disabled subsurf is used for GPU subdivision
When more than one, consecutive, subdivision modifier is used on a Mesh,
the last subsurf modifier is used for GPU subdivision even though it
might be disabled. This is because retrieving the last subsurf modifier
in the draw code did not check whether the modifier was disabled or not.

To fix this, the session UUID of the modifier which delegated evaluation
to the GPU code is cached and used in the draw to select the right subsurf
modifier.

Differential Revision: https://developer.blender.org/D14488
2022-04-27 10:22:07 +02:00
9a8669ac81 Cleanup: Use bool, remove unnecessary struct keywords 2022-04-26 18:45:40 -05:00
1f270cf99b Snap: Use Map and unique_ptr for snap cache
Use C++ types instead of GHash to make code easier to read and simpler.

Differential Revision: https://developer.blender.org/D14758
2022-04-26 18:33:05 -05:00
b82de02e7c Cycles: Enable inlining on Apple Silicon for 1.1x speedup
This is a stripped down version of D14645 without the scene specialisation optimisations.

The two major changes in this patch are:

- Enables more aggressive inlining on Apple Silicon resulting in a 1.1x speedup and 10% reduction in spill, at the cost of longer pipeline build times
- Revival of shader binary archives through a new ShaderCache which is shared between MetalDevice instances using the same physical MTLDevice. This mitigates the extra compile times via explicit caching (rather than, as before, relying on the implicit system shader cache which can be purged without notice)

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14763
2022-04-26 22:17:16 +01:00
994da7077d Outliner: Add icon column to toggle if library overrides are editable
Adds a column to the right in the Library Overrides Hierarchies view
mode to toggle editability of library overrides.

Note that making a library override non-editable currently involves
clearing all overridden properties. This is an arguable design choice,
we should probably at least warn the user before doing this.

Part of T95802.

Reviewed by: Bastien Montagne

Differential Revision: https://developer.blender.org/D14653
2022-04-26 22:30:33 +02:00
83c8f996f1 UI: Add callback for comparing button identity
The code to compare buttons from the previous to the current frame, to
see if they match (an thus should keep the same state) was quite
generic, and didn't allow much flexibility/customization. For some
cases this isn't enough, and a more specific comparison is needed. Say
if some buttons don't actually store comparable data themselves, only
via the button context. This was the case in D14653.
2022-04-26 22:26:15 +02:00
5fe1624b0e UI: Support setting context for buttons without layout
It was possible to set context pointers for buttons via the layout, but
not for buttons in places where the layout system wasn't used (where
buttons are placed manually). This is needed for buttons in the
Outliner, see D14653.
2022-04-26 22:23:52 +02:00
8016d8a4bd deps_builder/robinmap: remove file copy on windows
- It's not needed, since it's a build time dependency only.
- It was setup to copy to the wrong folder.
2022-04-26 11:02:16 -06:00
296b261299 build_deps.cmd: prevent over-subscription of the cpu.
/maxcpucount:1 and /m are the same option with the latter
one using all cores available, leading to the situation
where msbuild would start N side by side project builds
that all tried to use N cores as well. leading to severe
memory and compute starvation during the deps build.
2022-04-26 10:50:41 -06:00
d8ef52ca47 Fix: some multi-functions are executed more than once
The good thing is that this fix also makes function evaluation a bit faster.
2022-04-26 17:41:16 +02:00
3e7ee3f3bc Geometry Nodes: Move named attribute nodes out of experimental
Remove the experimental option for named attributes nodes show they are
always available.

Ref T91742
2022-04-26 10:18:30 -05:00
ae94e36cfb Geometry Nodes: refactor array devirtualization
Goals:
* Better high level control over where devirtualization occurs. There is always
  a trade-off between performance and compile-time/binary-size.
* Simplify using array devirtualization.
* Better performance for cases where devirtualization wasn't used before.

Many geometry nodes accept fields as inputs. Internally, that means that the
execution functions have to accept so called "virtual arrays" as inputs. Those
 can be e.g. actual arrays, just single values, or lazily computed arrays.
Due to these different possible virtual arrays implementations, access to
individual elements is slower than it would be if everything was just a normal
array (access does through a virtual function call). For more complex execution
functions, this overhead does not matter, but for small functions (like a simple
addition) it very much does. The virtual function call also prevents the compiler
from doing some optimizations (e.g. loop unrolling and inserting simd instructions).

The solution is to "devirtualize" the virtual arrays for small functions where the
overhead is measurable. Essentially, the function is generated many times with
different array types as input. Then there is a run-time dispatch that calls the
best implementation. We have been doing devirtualization in e.g. math nodes
for a long time already. This patch just generalizes the concept and makes it
easier to control. It also makes it easier to investigate the different trade-offs
when it comes to devirtualization.

Nodes that we've optimized using devirtualization before didn't get a speedup.
However, a couple of nodes are using devirtualization now, that didn't before.
Those got a 2-4x speedup in common cases.
* Map Range
* Random Value
* Switch
* Combine XYZ

Differential Revision: https://developer.blender.org/D14628
2022-04-26 17:12:34 +02:00
9a53599180 Geometry Nodes: rename used attributes panel
The new name is `Internal Dependencies`.
* Is more inline with the general goal of the panel.
* Can also show which external objects are used in the node tree in the future.

This name was choosen in the geometry nodes submodule meeting (2022-04-25).

Differential Revision: https://developer.blender.org/D14752
2022-04-26 16:58:53 +02:00
7b16ddeb5a BLI: small optimization to retrieving CPPType from static type 2022-04-26 16:56:21 +02:00
e9334c5df8 Geometry Nodes: Avoid parallel_for_each with a single geometry
The large call stack can be slightly annoying, and it's possible that
invoking TBB in this case corresponds to some overhead like
e130903060.
2022-04-26 09:24:26 -05:00
5c5ec837b3 Utils: Add macro for C++ default arguments in C headers
This macro allows defining a default argument for when the translation
unit is compiled in C++. Otherwise (in C), the argument has to be passed
explicitly.

A couple of benefits:
* Default arguments are a nice quality-of-life feature in C++. It's
  annoying if these can't be used in C++ files, just because the header
  with the function declaration still needs to be C compatible.
* Adds useful information to the API declaration. E.g. that an argument
  can be nullptr.
* Should help us to move to using default arguments more, helping
  readability (arguably)

Used in D14653.

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D14654
2022-04-26 15:47:19 +02:00
96bdd65e74 Curves: Support applying geometry nodes modifier
This commit adds support for the curves object to the apply modifier
operator. A warning is added when the evaluated result of the modifier
doesn't contain any curves data.

Differential Revision: https://developer.blender.org/D14730
2022-04-26 08:07:54 -05:00
db45292d8e Cleanup: Move anonymous attribute removal to geometry component
Implementing removal of anonymous attributes with `GeometryComponent`
instead of `Mesh` makes it more reusable for other types like curves.
2022-04-26 08:06:04 -05:00
b7458f909c Curves: add "Curves" to brush names
Differential Revision: https://developer.blender.org/D14748
2022-04-26 13:10:45 +02:00
Colin Marmond
4e57b6ce77 Animation: Sensible frame range for motion paths
Motion paths can now be initialised to more sensible frame ranges,
rather than simply 1-250:

    - Scene Frame Range
    - Selected Keyframes
    - All Keyframes

Reviewed By: sybren, looch, dfelinto, pablico

Maniphest Tasks: T93047

Differential Revision: https://developer.blender.org/D13687
2022-04-26 12:33:35 +02:00
6cf148227b WM: disable redraw timer in background mode
Crashing in background mode was reported as part of T78854,
disable via the poll function to give a useful error in background mode.
2022-04-26 19:21:12 +10:00
2492d9852b Fix memory leak in Context.temp_override
Add missing check as the context override dict may have been copied
since it was assigned, also initialize the context manager with
PyType_Ready, while it didn't cause any errors - it's expected
that all types are initialized.
2022-04-26 16:51:20 +10:00
e0e737b72b Cleanup: line length for Python scripts 2022-04-26 15:16:11 +10:00
e3724d29ff Cleanup: autopep8 2022-04-26 15:03:04 +10:00
802bc8e233 pyproject: enable aggressive, ignore E501 (line wrapping)
Aggressive needs to be enabled for many useful edits to take effect,
the ignore list is currently used to disable edits that may need
further checks/investigation before they're enabled.

Note that aggressive was already enabled for the:
source/tools/utils/autopep8_clean.py script which was previously used
when applying autopep8.
2022-04-26 14:59:41 +10:00
a28fd0ceb5 Correct over allocation in "Fix Vertex Group Deform" operator
The pointer size was incorrectly being used instead of the float size.
2022-04-26 14:33:04 +10:00
6d12bc9e91 Cleanup: use boolean arguments and return values 2022-04-26 14:25:58 +10:00
a9d1b3d7e3 Cleanup: replace in-line swapping with SWAP macro
Also use bool array for true/false values.
2022-04-26 14:24:44 +10:00
a32f447c54 Cleanup: remove NULL check and outdated comment 2022-04-26 14:02:49 +10:00
c63a6d3057 Cleanup: names in text functions
- Use filepath instead of file.
- Use relbase instead of relpath.

In both cases the new names are used more frequently throughout
exiting functions.
2022-04-26 13:59:54 +10:00
0f583d9d60 PyAPI: support persistent handlers for class & static methods
Support methods being used as persistent callbacks.

Resolves T97555.
2022-04-26 13:47:24 +10:00
07e2bd443e Fix bone "auto-name by axis" failure to clip long names
Failure to clip automatic-names meant named could end with a "." for e.g.

Error in [0] meant the clipped text was copied then
immediately overwritten.

[0]: 354e6b9c18
2022-04-26 13:46:04 +10:00
3221766820 Fix string escaping in override versioning and modifier renaming 2022-04-26 13:46:02 +10:00
a003547a37 Cleanup: unused return value warning 2022-04-26 13:46:00 +10:00
3ea6dbfe73 Cleanup: simplify text copying string operations
- De-duplicate txt_new_linen & txt_new_line.
- Don't accept NULL as input for txt_new_linen & txt_new_line
  (callers can pass in an empty string instead).
- Avoid duplicate strlen calls in txt_new_linen.
- Use memcpy when the length of the string is known in txt_delete_sel &
  BKE_text_load_ex.
2022-04-26 13:45:59 +10:00
98ad294d17 Fix: Correctly copy and update curve type counts cache
Missing from f431be224f.
2022-04-25 18:48:35 -05:00
96834a7bac Fix T97595: Modifier attribute output broken for vertex groups
`attribute_try_create` didn't understand that the vertex group
attribute already existed because it only looks for names in custom
data layers when the domain matches. Using `attribute_exists`
unfortunately requires another loop through all attribute names,
but that should be optimized separately in the future anyway.

Differential Revision: https://developer.blender.org/D14756
2022-04-25 16:44:30 -05:00
3b4b2bcb13 Cleanup: Remove redundant vertex normal dirty tags
Applying the coordinates already tags the normals dirty
2022-04-25 16:30:06 -05:00
c20b99b70c Vertex Paint: Fix brush color space
The brush color wasn't being converted
to scene linear space properly.
2022-04-25 13:24:22 -07:00
a8331d8c9d Cleanup: remove unused function parameter 2022-04-25 13:14:07 -07:00
2bc0e8d304 Fix T81452: Incorrect trim lasso radius
Added a fallback path to compute the
cursor radius for when the stroke
starts over a blank area of space
(in which case SCULPT_cursor_geometry_update
fails).
2022-04-25 13:12:04 -07:00
891268aa82 Mesh: Make vertex normal property read-only
This commit makes the `MeshVertex.normal` property read-only.
In practice it already was, since the value could be overwritten at any
time if code requests updated normals, so this just clarifies that
position and avoids misleading users.

Differential Revision: https://developer.blender.org/D14696
2022-04-25 14:50:57 -05:00
8e1b16534d Fix: Incorrect implicit enum conversion
Hardcode Catmull Rom curves for now, since nothing else is implemented.
2022-04-25 14:48:14 -05:00
2fd8fa8f84 Geometry Nodes: Add "Named" to "Remove Attribute" node name
The goal is to be consistent with the other two nodes that deal with
named attributes. Ref T97512
2022-04-25 14:45:12 -05:00
42878ffc26 Fix T97597: vertex paint initialization was
called by weight paint mode,
	    causing a crash
2022-04-25 12:32:03 -07:00
38eed4ada3 Fix T97553: SCULPT_handles_colors_report called for non-sculpt brushes 2022-04-25 12:26:02 -07:00
296d734344 Sculpt: Remove hardcoded setting of
auto-iteration property in mask filter

Note: Auto-iteration is still set manually
for increase/decrease contrast.  These should
probably become their own operators.
2022-04-25 12:15:48 -07:00
185d9627b3 Fix T97423: Make mask filter less confusing
by showing redo panel.

The A hotkey has "auto iteration" enabled by default,
which calculates the number of times to run the filter
using a heuristic based on vertex count.

To make clear to the user what is going on the redo
panel is now shown for the mask filter operator.

NOTE: I discovered the source of the bug where sculpt
operators' redo panels were greyed out.  The name
fed to SCULPT_undo_push_begin must match the operator
name.  I've added a comment in sculpt_intern explaining
this.
2022-04-25 12:07:55 -07:00
f431be224f Curves: Cache the number of curves of each type
Remembering the number of curves of every type makes it fast to know
whether processing specific to a single curve type has to be done.
This information was accessed in quite a few places, so this should be
an overall reduction in overhead for the new curves type.

The cache is computed eagerly, in other words every time after changing
the curve types. In order to reduce verbosity I added helper functions
for some common ways to set the types.

Differential Revision: https://developer.blender.org/D14732
2022-04-25 13:40:07 -05:00
845e2ed3a2 Cleanup: Use const for smoot scrolling function 2022-04-25 18:15:14 +02:00
e99cb91530 Transform Snap Refactor: dedicate ghash to different SnapData types
Changes:
- Remove `BLI_memarena` (Use `MEM_cnew` and `MEM_delete` to allocate cached data)
- Implement `snap_object_data_mesh_free_ensure` and `snap_object_data_editmesh_free_ensure` and skip need to get original key Object for editmesh data
- Use `BMEditMesh` as key for editmesh `Ghash`
- Make a better distinction between `SnapObjectData`s. (`SnapData_Mesh` and `SnapData_EditMesh`)
2022-04-25 12:40:01 -03:00
d30f701e84 Cleanup: Turn some 'eTFlag' into macros
Some of the enum values are a mixture of others and make it difficult
for the IDE to identify them.

Separating these values makes debugging easier.
2022-04-25 12:35:56 -03:00
35dc4ba9e2 Fix T97401: Snap options ignored for Nurbs surfaces
The editing data of a `SURF`s is similar to that of Curves and should be supported for snapping.

But unlike Curve objects, for snapping, only support the nurb points if the object is in edit mode.

This matches the solution for Meshes and avoids having to create a kind
of "boundbox" for the SURF nurb points.
2022-04-25 12:35:55 -03:00
6963703801 Nodes: show overlays in node editor even when nodes are collapsed 2022-04-25 16:39:13 +02:00
2b3f7c6481 Geometry Nodes: improve attribute dependency overlay
* Adjust width based on node width, necessary to make the longer name below work.
* Show "X Named Attributes" in the overlay.
* Use "Accessed named attributes" in the tooltip.

Differential Revision: https://developer.blender.org/D14751
2022-04-25 16:28:26 +02:00
09710d5f2a Geometry Nodes: show timing overlay above attributes overlay 2022-04-25 16:03:34 +02:00
26afa23b3b Fix: use natural string sorting for attribute names 2022-04-25 16:00:58 +02:00
c2751f8a11 Cleanup: fix unused variable warning in paint_vertex.cc
No functional changes.
2022-04-25 16:00:15 +02:00
654bc35bc8 Geometry Nodes: improve ui when trying to remove built-in attributes
* If removing an attribute failed (even though it exists), don't log it as being used.
* Make warning message a bit more informative.

Differential Revision: https://developer.blender.org/D14750
2022-04-25 15:52:38 +02:00
Pratik Borhade
0a86ab6639 Fix T96925: Fast diagonal movement in walk navigation
View moves faster with two active directions.
This is probably because `dvec` is not normalized when moving in two directions.
Normalizing this direction vector will fix the problem.

Differential Revision: https://developer.blender.org/D14729
2022-04-25 15:46:00 +02:00
Brecht Van Lommel
d2a01bb7cb Build: add autopep8 to bundled Python packages
For use in "make format" to automatically format Python code, see D14686.

Differential Revision: https://developer.blender.org/D14716
2022-04-25 15:45:03 +02:00
0310638e94 Fix build error on Linux + Clang 10 after recent changes to BLI_any
Differential Revision: https://developer.blender.org/D14749
2022-04-25 15:38:20 +02:00
ab032fba39 CMake: harvest zero-level SO files
Zero-level is built as shared library at the moment, so better to harvest
`*.so*` instead of `*.a`.
2022-04-25 15:26:37 +02:00
42368f2ef4 Revert "CMake: add harvesting of fmt library"
This reverts commit 7c55a7ccca. `fmt` is
only a build-time OIIO dependency and doesn't need to be bundled with
Blender.
2022-04-25 14:37:01 +02:00
1640fbe7c6 CMake: add ^NANOVDB to variables to reset after library upgrade
Cycles needed this to build properly after switching to the newly built
libraries.
2022-04-25 14:28:06 +02:00
7c55a7ccca CMake: add harvesting of fmt library
The library was built with `make deps`, but not installed. Now it is.
2022-04-25 14:26:42 +02:00
b4a4004fb1 Fix memory leak in cryptomatte
Since cbf033c055 the `matte_id` will be allocated in the node
storage for the forward compatibility purposes. However, this
field was never freed, leading to memory leak.

Causes annoying popup on macOS when running Cycles tests,
for example render_passes_cryptomatte_asset.blend

Differential Revision: https://developer.blender.org/D14728
2022-04-25 12:00:51 +02:00
a2d32960b4 BLI: optimize constructing new virtual array
Differential Revision: https://developer.blender.org/D14745
2022-04-25 11:51:34 +02:00
Brad Clark
c63d64a2ce NLA: Add Bake Action to the NLA edit menu
Add Bake Action to the NLA edit menu to aid discoverablity and allow
people to understand that Bake Action is part of working with the NLA.

Part of the NLA road map improvement project for the Animation Module.
This was a community request to add access to the Bake without needing
to turn on developer tools in the preferences and then use search in the
NLA for bake.

It seems this was always intended, as the operator is called `nla.bake`.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D14575
2022-04-25 11:42:46 +02:00
416ef3b6b2 Cleanup: spelling in comments 2022-04-25 16:37:42 +10:00
0efe581a5b Cleanup: add missing doxy sections in customdata 2022-04-25 16:34:28 +10:00
29b9187b32 VSE: Update first thumbnail when moving handle
When handles are moved, job is created only for strips that need to
update first thumbnail.

ref T91618
2022-04-25 04:34:15 +02:00
17eb8a9ceb Cleanup: remove special cases for getting internal span or single
Those are handled in the called function already.
2022-04-24 14:33:33 +02:00
dc7f88fd15 BLI: prioritize detecting single values higher than detecting spans
In some contexts, single values can be handled more efficiently than spans.
2022-04-24 14:32:03 +02:00
bba757ef81 Cleanup: various minor changes
- Add missing doxy-section for Apply Parent Inverse Operator
- Use identity for None comparison in Python.
- Remove newline from operator doc-strings.
- Use '*' prefix multi-line C comment blocks.
- Separate filenames from doc-strings.
- Remove break after return.
2022-04-24 13:41:03 +10:00
a6504aa64b Cleanup: clang-format 2022-04-24 13:41:03 +10:00
99fff90eab pyproject: remove settings that cause other uses of autopep8 to fail
While the ability to run `autopep8 .` to format Blender's Python code
is handy, the settings to perform this can conflict with other uses
of autopep8 (which editors may use to auto-format on save).

Some arguments now need to be passed in, e.g:

    autopep8 . --in-place --recursive --jobs=0

We'll likely include this in `make format` convenience target so the
details for invoking autopep8 shouldn't be an issue in the long term.
2022-04-24 13:41:02 +10:00
c486da0238 Mikktspace: Reduce number of data queries to caller
The current code for computing tangents is not exactly fast.
This has been a long-standing issue, and recently came up again with T97378.

The main bottleneck is fetching the mesh data, since it's handled through a callback system and each vertex might have its data queried dozens of times.

I've tried a lot of things to optimize `mikktspace.c`, but unfortunately most weren't that useful:
- Vectorizing SVec3 gives a ~5% speedup, but I'm not sure if the additional ~70 lines of code are worth it
- Keeping an internal copy of the data instead of re-querying all the time helps a lot (~50-60% time reduction), but requires a lot of extra memory (~100 byte per face)
- Going C++ and replacing the internal quicksort with std::sort shows no difference
- Restructuring the entire file to be a header-only library so that the callbacks can be inlined gives ~10% reduction, but is a major change and deviation from the original library

In the end, two simple fixes that actually help remain:
- Don't re-query the number of faces in each loop iteration
- Don't bother looking for identical vertices if there's only one vertex with that hash

With this, time for the test case in T97378 goes from 6.64sec to 4.92sec. It's something I guess.

I feel like completely refactoring this library would not be a bad idea at some point, but for now it does the job...

Differential Revision: https://developer.blender.org/D14675
2022-04-23 15:09:41 +02:00
cfce5a32a7 Fix a failing bmesh_bevel test by fixing buffer overflow.
The uv fix just submitted had a bug where I forgot to wrap around
after adding 1. This apparently worked anyway in a debug build
but not in release build, hence the buildbot tests were failing.
2022-04-22 22:39:05 -04:00
6787cc13d4 Bake: add UDIM tile baking support
Works for both Cycles and multires bake. Triangles are baked to multiple
UDIM images if they span across them, though such UV layouts are generally
discouraged as there is no filtering across UDIM tiles.

The bake margin currently only works within UDIM tiles. For the extend method
this is logical, for the adjacent faces method it may be useful to support
copying pixels from other UDIM tiles, though this seems somewhat complicated.

Fixes T95190

Ref T72390
2022-04-22 23:15:45 +02:00
bdc537e0a7 Fix deprecation warning when building with OpenVDB 9
Based on patch by Sebastian Parborg.
2022-04-22 23:15:41 +02:00
ac8beb4fda Fix T97453: Blender crash when selecting Caching checkbox in VSE
Merge Audaspace fixes from upstream.
2022-04-22 22:36:04 +02:00
ff6098345a Cleanup: Clang tidy, unused variable warnings
Also remove unnecessary uses of `struct` and add const in one place.
2022-04-22 12:41:25 -05:00
7f726b48ac Cleanup: Remove unused variables, adjust comments 2022-04-22 11:48:53 -05:00
Olivier Maury
58be9708bf Cycles: removed UV requirement for MNEE, along with fixes and cleanups
Remove need for shadow caustic caster geometry to have a UV layout. UVs were
useful to maintain a consistent tangent frame across the surface while
performing the walk. A consistent tangent frame is necessary for rough
surfaces where a normal offset encodes the sampled h, which should point
towards the same direction across the mesh.

In order to get a continuous surface parametrization without UVs, the
technique described in this paper was implemented:

"The Natural-Constraint Representation of the Path Space for Efficient
 Light Transport Simulation" (Supplementary Material), SIGGRAPH 2014.

In addition to implementing this feature:
* Shadow caustic casters without smooth normals are now ignored (triggered
  some refactoring and cleaning).
* Hit point calculation was refactored using existing utils functions,
  simplifying the code.
* The max number of solver iterations was reduced to 32, a solution is
  usually found by then.
* Added generalized geometry term clamping (transfer matrix calculation can
  sometimes get unstable).
* Add stop condition to Newton solver for more consistent CPU and GPU result.
* Add support for multi scatter GGX refraction.

Fixes T96990, T96991

Ref T94120

Differential Revision: https://developer.blender.org/D14623
2022-04-22 18:31:15 +02:00
d8abac7357 LibOverride: Add hierarchy creation from IDTemplate UI widget.
This is fairly tricky to perform, since there is often very limited
contextual information available about the 'active' hierarchy to
override.

This commit is a first step, it is expected to handle decently well
cases like objects and obdata (recreating necessary object and
collection hierarchy, and/or hooking it to a potential existing
hierarchy), at least in most common cases.

Ref: {T95707}.
2022-04-22 18:22:58 +02:00
e96623c19b Fix: Build error on macOS after previous commit 2022-04-22 11:21:19 -05:00
b38491b407 Re-fix some comments in bmesh_bevel.c.
The UV fix just committed had gotten out of sync with some changes
that had been made inside some comments (spelling and folding).
2022-04-22 11:59:05 -04:00
5b87862ddc Curves: Further split of curves draw code from particles
Extends the changes started in f31c3f8114 to completely separate
much of the DRW curves code from the particle hair drawing. In the short
term this increases duplication, but the idea is to simplify development
by making it easier to do larger changes to the new code, and the new
system will replace the particle hair at some point.

After this, only the shaders themselves are shared.

Differential Revision: https://developer.blender.org/D14699
2022-04-22 10:44:01 -05:00
Martijn Versteegh
8f05a547d5 BMesh: Add additional attribute access macros
Add macros to get/set boolean attributes, to set float2/float3
attributes and to get float2/float3 attributes via pointer access.
Needed for D14365 and further generic attribute integration.

Differential Revision: https://developer.blender.org/D14708
2022-04-22 10:35:44 -05:00
984cd552f0 Fix T56625: Bevel sometimes made zero area UV faces.
This substantially redoes the logic by which bevel chooses, for
the middle segment when there are an odd number of segments,
which face to interpolate in, and which vertices to snap to which
edges before doing that interpolation. It changes the UV layouts
of a number of the regression tests, for the better.
An example, in the reference bug, is a cube with all seams, unwrapped
and then packed with some margin around them, now looks much
better in UV space when there are an odd number of segments.
2022-04-22 11:32:27 -04:00
a7c65ef4cb Fix T96498: Modifiers affect multiple curve objects
The original mistake I made in b9febb54a4 was thinking
that the input curve object data to `BKE_displist_make_curveTypes`
was already copied from the original. I think I misread some of its
`ID` flags. This commit places the result of curves evaluation in a
duplicated curve instead, and copies the edit mode pointers
necessary for drawing overlays. `Curve` needs to know not to
free those pointers.

I still don't have a full understanding of why some of the tactics I've
used work and others don't. I've probably tried around 8 different
solutions at this point, and this is the best I came up with.

The dependency graph seems to have some handling of edit mode
pointers that make the edit mode overlays work if the evaluated
result is only an empty curve created by the evaluated geometry set.
This doesn't work with the current method and I need to set the
edit mode pointers at the end of evaluation explicitly.

We're constrained by the confusing duality of the old curves system
combined with the new design using the evaluated geometry set.
Older areas of Blender expect the evaluated `Curve` to be a copy
of the original, even if it was replaced by some arbitrary evaluated mesh.

Differential Revision: https://developer.blender.org/D14561
2022-04-22 10:27:15 -05:00
75aa5ecbda Fix (unreported): Placement Tool not orienting the Object to normal
Regression introduced in
{rB721335553ccb5ce4f7a374b958b7d65befa319df}.

`plane_omat` is only computed if `snap_state->draw_plane` is `true`.
2022-04-22 12:15:13 -03:00
fe43c17083 Fix: Assert failure with certain screw modifier settings
Caused by a typo/mistake in rB6a3c3c77b3ebdbcd4455.
2022-04-22 10:03:36 -05:00
024a4da6b3 Fix various typos and other UI messages issues. 2022-04-22 16:19:05 +02:00
535c9308ef Fix T97429: Translateable Unit Names Missing in the File.
Added some regex magic in i18n py module to also extract UI names from
all of our units definitions.

Those enum values are fully dynamically generated, so they cannot be
extracted from RNA introspection.
2022-04-22 16:19:05 +02:00
Ramil Roosileht
50f0103059 Change vertex paint icon color (fix)
Apply standard green tool color to vertex paint tools, to keep icon
color palette more consistent

https://developer.blender.org/D14694
2022-04-22 15:53:43 +02:00
9c279723da Fix Data Transfer Projected Face/Edge Interpolated mode is wrong
Caused by {rBcfa53e0fbeed}

Above commit mixed up source and destination meshes causing bad lookups
on calculated normals.

Now make sure we get normals from our destination mesh to project along.

Note this was only reported for Projected Face Interpolated mode, but
same was true for Projected Edge Interpolated mode (though that one is a
bit weird to test since I think there is generally something wrong with
that mode -- with or without rBcfa53e0fbeed).

Fixes T97528

Maniphest Tasks: T97528

Differential Revision: https://developer.blender.org/D14726
2022-04-22 15:28:12 +02:00
5179b8236b Fix accessing attribute data in editmode
When in mesh editmode, attributes point to bmesh customdata, the
attribute data is empty since custom data is stored per element instead
of a single array there (same es UVs etc.).
Opposed to e.g. UVs, general attributes were not setting their data
length/size to zero in case of editmode though, which could lead to
- crash in Outliner Data Api view [that was reported in T95922]
- RuntimeError such as the following:
```
RuntimeError: bpy_prop_collection[index]: internal error, valid index 0
given in 8 sized collection, but value not found
```

Now check for mesh editmode in `BKE_id_attribute_data_length` (and
return zero in that case).
Alternatively, the check could also be done in
`rna_Attribute_data_length` only (such as UVs do in
`rna_MeshUVLoopLayer_data_length`).

Ref D11998
Fixes T95922

Maniphest Tasks: T95922

Differential Revision: https://developer.blender.org/D14714
2022-04-22 15:25:11 +02:00
048c769774 Fix T97277: Tweak drag transforming is broken for masks (RMB select)
Regression in 4d0f846b93,
passing selection through to drag relied on tweak events running
even when the press event was handled which is not the case for drag.
2022-04-22 17:36:09 +10:00
Ramil Roosileht
b226236b01 Fix - Display correct units in "Edit voxel size" widget
Fix for T84962
Before the patch, edit voxel size always displayed voxel size without units, just as a number in meters.
Now it changes like in the voxel remesh panel and shows correct units
Video:
{F13009428}

In adaptive mode:
{F13009435}

Reviewed By: JulienKaspar

Maniphest Tasks: T84962

Differential Revision: https://developer.blender.org/D14682
2022-04-22 08:09:18 +02:00
Ramil Roosileht
d724d3ae58 Change viewport shading text from "Color" to "Attribute"
This change from T97104

Reviewed By: JulienKaspar, jbakker

Maniphest Tasks: T97104

Differential Revision: https://developer.blender.org/D14620
2022-04-22 08:06:21 +02:00
Ramil Roosileht
33d102e5b2 Reorder sculpt tools
Changed tool order as proposed in [[ https://developer.blender.org/T97206 | T97206 ]]
{F12987559}

Reviewed By: JulienKaspar, jbakker

Maniphest Tasks: T97206

Differential Revision: https://developer.blender.org/D14612
2022-04-22 08:05:45 +02:00
48f369d63a Fix: VSE channels region visible in preview
Hide region for preview and sequencer/preview combined view.
2022-04-22 02:51:10 +02:00
30acc5f9cd pyproject: add configuration for autopep8
This adds pyproject.toml, needed to configure defaults for autopep8.

The file is auto-discovered in a similar way to .clang-format, other
tools could be configured here too. For now just configure autopep8 so
this can be enabled in IDE's without causing unexpected edits such as
wrapping lines over 80 columns in width.

Now autopep8 can be used from the root directory by running: autopep8 .

This uses multiple-jobs to run autopep8 over all Python scripts except
paths that are explicitly ignored in exclude defined by pyproject.toml.

Reviewed By: mont29, brecht, sybren

Ref D14686
2022-04-22 10:13:39 +10:00
2547c3c70c Cleanup: spelling in comments 2022-04-22 10:11:48 +10:00
Brecht Van Lommel
179100c021 Cycles: enable AMD RDNA GPU support on Linux
This enables building of HIP binaries for AMD RDNA and RDNA2 GPUs.

This requires the 22.10 / ROCm 5.1 driver.

Ref T91571

Differential Revision: https://developer.blender.org/D14360
2022-04-22 00:11:55 +02:00
ce95856f2d Fix: VSE channels area has no background
Draw area background even when there is no sequencer data.
2022-04-21 23:40:36 +02:00
74b9c351b9 Fix: Use alphabetical order in geometry nodes add menu 2022-04-21 14:10:02 -05:00
65e4c91bec Fix: Memory leak writing to builtin attribute from modifier
If the attribute already existed, but had a different domain or data type
than the user tried to write to it with (i.e. writing to `position` with
a float), then the data from field evaluation wasn't freed.

This restructures the geometry nodes modifier attribute writing process
to solve that problem and remove some of the nested if statements
that made the process confusing.

One case that still doesn't work is writing to a builtin attribute from
a different domain. If `OutputAttribute` gets that feature then that
could be supported here too.

Differential Revision: https://developer.blender.org/D14706
2022-04-21 14:05:16 -05:00
9de3ed5c82 Fix T97490: snap to multiple objects with linked data can crash
The problem is old.

rB52be06301257 (fixed by rB4b35d6950d4f) just masked it.

`Object->data`, on evaluated objects, is not a safe pointer to get
objects with the same `BMEditData`.

Use `Object->runtime.data_orig` instead.
2022-04-21 14:08:17 -03:00
9a9a46df46 Cleanup: Remove unused argument to mesh modifier evaluation 2022-04-21 12:02:13 -05:00
Germano Cavalcante
e2d8b6dc06 gpu.types.GPUBatch: warn about deprecated primitive types
As `GPU_PRIM_LINE_LOOP` is not supported on Vulkan or Metal and
`GPU_PRIM_TRI_FAN` is not supported on Metal, they will be removed in
future releases.

So it is important to inform users that they are obsolete and may not
be supported for a long time.

Release Notes: https://wiki.blender.org/wiki/Reference/Release_Notes/3.2/Python_API

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D14679
2022-04-21 12:52:38 -03:00
f807e6effe Cleanup: don't use allocation variables in OpenColorIO config
These are only needed for the legacy GPU renderer, which we don't use.
2022-04-21 17:34:46 +02:00
f991f5ad51 Color Management: add ACEScg to the default configuration
For more easily reading and writing ACEScg EXR files.
2022-04-21 17:34:46 +02:00
f6d5d01715 Fix T97502: Issues/crashes with "color_attributes" AttributeGroup
Property collection functions were not really in sync which could result
in crashes in UI_LISTS.

The reason is that attributes of type color defined on domains other than
Points or Corners are still valid, but should really be skipped for the
special "color_attributes".
`rna_AttributeGroup_color_length` itself was fine here, it skips these,
but the iterator (`rna_AttributeGroup_color_iterator_begin` /
`rna_Attributes_noncolor_layer_skip`) wasnt, so when a UI_LIST
filter_items() would iterate the collection it would actually get
results were it shouldnt.

Now check a suiting domain in `rna_Attributes_noncolor_layer_skip` as
well.

Maniphest Tasks: T97502

Differential Revision: https://developer.blender.org/D14717
2022-04-21 16:18:05 +02:00
b9799dfb8a Geometry Nodes: better support for byte color attributes
Since {rBeae36be372a6b16ee3e76eff0485a47da4f3c230} the distinction
between float and byte colors is more explicit in the ui. So far, geometry
nodes couldn't really deal with byte colors in general. This patch fixes that.
There is still only one color socket, which contains float colors. Conversion
to and from byte colors is done when read from or writing to attributes.

* Support writing to byte color attributes in Store Named Attribute node.
* Support converting to/from byte color in attribute conversion operator.
* Support propagating byte color attributes.
* Add all the implicit conversions from byte colors to the other types.
* Display byte colors as integers in spreadsheet.

Differential Revision: https://developer.blender.org/D14705
2022-04-21 16:11:26 +02:00
aca083fbf3 Nodes: raise exception when creating node group input/output fails
Previously this would silently return `None`.
Now the behavior is similar to when new sockets are added to a node.
2022-04-21 15:48:02 +02:00
75a9830d84 install_deps: Update USD to 22.03.
Add back a patch wrongly removed by rBb9c37608a9e9, and add another fix,
for gcc11 build support.

Re {T95206}.
2022-04-21 15:35:12 +02:00
c196ca3740 Functions: fix procedure executor not writing output in correct buffer
The issue was that the executor would forget about the caller provided
storage if the variable is destructed.
2022-04-21 15:29:18 +02:00
0178e694b7 Geometry Nodes: show used named attributes in modifier
This adds a new subpanel to the geometry nodes modifier which is just
used to display information about used attributes.

* A new panel is used because adding this information anywhere else
  clutters the ui too much imo.
* The general layout is similar to that in the tooltip. I found it to be more
  trouble than it's worth to share this code.

Possible future improvements:
* Don't show the panel if there are no used named attributes.
* Add some heuristics to determine which named attributes the user does
  not have to care about because they are only used in the node group
  and don't affect anything else.

Differential Revision: https://developer.blender.org/D14701
2022-04-21 15:10:07 +02:00
ed971a19fa Curves: show sculpt tool settings in panels
Ref T97444.

Differential Revision: https://developer.blender.org/D14700
2022-04-21 14:51:37 +02:00
Colin Basnett
2882cbe685 Fix T97497: NLA strip names are now properly contained within the strip bounds
Very easy fix, the bug seemed to be a result of a typo on the right-most margin.

Old: {F13013777}

New: {F13013782}

Maniphest Tasks: T97497

Differential Revision: https://developer.blender.org/D14711
2022-04-21 10:45:17 +02:00
2e3edb6995 Fix Empty "Only Axis Aligned" viewing angle depends on object scale
This was projecting the unnormalized z scale axis onto the plane defined
by the view vector. If object scale was very small, this made the empty
still visible at viewing angles far from the object axis.

Now use the normalized z scale axis to make this work the same at all
object scales.

Fixes T97004.

Maniphest Tasks: T97004

Differential Revision: https://developer.blender.org/D14557
2022-04-21 10:36:06 +02:00
298e9c7ebd Fix T97465: Moving compositor BG image cannot be cancelled
This was possible with the gizmo, but no using the operator (e.g. from
the sidebar).

Now store original offsets and reset to these on calcel (ESC or RMB).

Maniphest Tasks: T97465

Differential Revision: https://developer.blender.org/D14704
2022-04-21 10:30:41 +02:00
01333cb47f Sculpt: fix missing null pointer check
in workbench_engine.c
2022-04-21 00:58:45 -07:00
c342b3cede Fix T95932: Auto-close text breaks outliner drag-n-drop
Text inserted via TEXT_OT_insert would always have auto-close
logic applies which interfered any insertion of literal strings
containing brackets.

Now auto-closing brackets is restricted to characters read from
events from the operators invoke functions.
2022-04-21 17:56:56 +10:00
4d9ddb4a77 Cleanup: clang format 2022-04-21 09:37:20 +02:00
7a943428de Cleanup: fix various warnings after recent commit 2022-04-21 09:36:39 +02:00
14f2d37ad1 Vertex paint: Fix debug compile error and a
few warnings.
2022-04-21 00:18:12 -07:00
b0c428c063 Fix T97185: Data transfer modifier doesn't display
individual layers.

A few RNA property strings were misspelled.
2022-04-21 00:04:58 -07:00
6f190f7f43 Fix T97469: Sculpt colors crash in multiresolution or dynamic topology modes.
Sculpt paint tools now pop up an error message if
dynamic topology or multires are enabled.

Implementation notes:

* SCULPT_vertex_colors_poll is now a static function in sculpt_ops.c.
  It is now used solely by the legacy color attribute conversion
  operators (SCULPT_OT_vertex_to_loop_colors and SCULPT_OT_loop_to_vertex_colors)
  and should be deleted when they are.
* There is a new method, SCULPT_handles_colors_report, that returns true if
  the sculpt session can handle color attributes; otherwise it returns false
  and displays an error message to the user.
2022-04-20 23:38:55 -07:00
575ade22d4 Commit D14179: Revamp Vertex Paint With C++
- Verrtex paint mode has been refactored into C++ templates.
  It now works with both byte and float colors and point
  & corner attribute domains.
- There is a new API for mixing colors (also based
  on C++ templates).  Unlike the existing APIs byte
  and float colors are interpolated identically.
  Interpolation does happen in a squared rgb space,
  this may be changed in the future.
- Vertex paint now uses the sculpt undo system.

Reviewed By: Brecht Van Lommel.

Differential Revision: https://developer.blender.org/D14179
Ref D14179
2022-04-20 22:14:03 -07:00
Jon Denning
c6ed879f9a Text Editor: add Python 3.10 soft keywords to builtinfunc list
Python 3.10 has added "soft keywords" [0] to their list of identifiers.
This patch adds these soft keywords to the list of builtin functions
that the text editor searches for when highlighting Python code.

The only soft keywords that Python 3.10 current has are: `match`,
`case`, and `_`, but more will likely be added in future versions.

Currently, the `_` soft keyword is ignored from highlighting. It is a
wildcard matching pattern when used with `case` (similar to `default`
for `switch`es in C/C++), but `_` is far more often used in other
contexts where highlighting the `_` might seem strange. For example,
ignoring elements when unpacking tuples (`_, g, _, a = color`).

This patch also updates the commented Python code for creating the list
of keywords, for convenience.

Before:

{F13012878}

After:

{F13012880}

Example from PEP-636 [1]

Note: These soft keywords are only reserved under specific contexts.
However, in order for the text editor to know when the keywords are used
in the appropriate contexts, the text editor would need a full-blown
Python grammar [2] parser. So, for now, these keywords are simply added
in along with the other keywords in order to highlight them in the text
editor.

[0]: https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords
[1]: https://peps.python.org/pep-0636/#matching-specific-values
[2]: https://docs.python.org/3/reference/grammar.html

Ref D14707
2022-04-21 12:35:41 +10:00
5fc488559c Cleanup: explicitly disable autopep8 for rna_manual_reference
Currently the "exclude" option for autopep8 isn't as reliable as it
should be since passing in absolute paths to autopep8 causes
the paths not to match. See: D14686 for details.

So explicitly disable autopep8 in this generated file (the generator
has already been updated).

Also use spaces for indentation otherwise autopep8 re-indents them.
This seems like a bug in autopep8 since it's changing lines with
autopep8 disabled. Use a workaround instead of looking into a fix since
it's simpler for all our Python files to use spaces instead of tabs and
there isn't much benefit mixing indentation for scripts.
2022-04-21 11:16:25 +10:00
b719fa267a Fix typo in previous commit 2022-04-21 02:26:54 +02:00
0c3d2461b7 Cleanup: VSE effect relationship checking
Use `SEQ_relation_is_effect_of_strip` for checking effect-input
relationship where this is applicable.
2022-04-21 02:01:10 +02:00
Shrey Aggarwal
502f3debf9 Fix T70844: Incorrect snappping of strips when effects attached
Sometimes, when moving strip with 2 input effect attached and causing
strip overlap, this overlap is resolved incorrectly - too big offset
is applied. This is because effects are not taken into consideration
when "shuffeling" to resolve overlap.

To fix usual cases (transitions), overlap between strip and it's effect
is considered to be impossible.

There are edge cases, but these would be much more complicated to
implement and could have negative impact on performance.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D14578
2022-04-21 02:01:10 +02:00
ok what
e16ff4132e VSE: Add frame selected operator for preview
This operator moves the view to show the selected visible strips.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D14222
2022-04-21 02:01:10 +02:00
2bd9cbe405 Fix T97254: VSE channel mute does mute sound
Add missing RNA update function
2022-04-21 02:01:10 +02:00
3cef9ebaf8 Fix T97356: Crash when adding adjustment layer strip
Crash was caused by incorrectly assuming, that rendered strip is meta
when editing code in bulk, but this wasn't true and strip had no
channels initialized, which caused crash on NULL dereference.

Correct approach is to find list of channels where on same level as
rendered strip, similar to how `SEQ_get_seqbase_by_seq` function works
for list of strips.
2022-04-21 02:01:10 +02:00
b67ccc333a GL: Change array macro to not conflict with opensubdiv variable names
Fix T97449 GPU subdivision: Crash on adding subdivision surface modifier
2022-04-20 21:32:03 +02:00
4a03c5acf9 Revert "Fix GPU subdivision: Crash on adding subdivision surface modifier"
The fix does not fix the case of shaders comming from the OpenSubdiv API.

This reverts commit f5191b8760.
2022-04-20 21:32:03 +02:00
8d2da45f98 Revert "Fix Cycles HIP assuming warp size 32"
This reverts commit 390b9f1305. It seems to
break things on Linux for unknown reasons, so leave it out for now. A solution
to this will be required for Vega cards though.
2022-04-20 18:09:23 +02:00
3a6813ea65 LibOverride: Make 'custom bone shape' and 'bbone custom handle' non-overridable.
There is not much point in having those editable in overrides, and since
those are pointers, their value always differs from ref linked ID vs.
local override one, generating 'noise' in Outliner's override property
view.
2022-04-20 17:03:05 +02:00
Jung Jaeyun
56d1d19c88 UI: Add option to create color attribute directly from canvas selector.
Added + and - buttons to create and delete color attributes from canvas selector.

{T97345}

{F13006374}

Reviewed By: jbakker, Ethan1080

Maniphest Tasks: T97345

Differential Revision: https://developer.blender.org/D14672
2022-04-20 16:55:33 +02:00
604c33e694 Build: updates for Blender to build against new 3.2 libraries
Building against the existing 3.1 libraries should continue to work, until
the precompiled libraries are committed for all platforms.

* Enable WebP by default.
* Update Windows for new library file names.
* Automatically clear outdated CMake cache variables when upgrading to new
  libraries.
* Fix static library linking order issues on Linux for OpenEXR and OpenVDB.

Implemented by Ray Molenkamp, Sybren Stüvel and Brecht Van Lommel.

Ref T95206
2022-04-20 16:42:16 +02:00
b9c37608a9 Build: upgrade many library dependencies to new versions for Blender 3.2
This only updates the build system, precompiled libraries for the various
platforms will be committed over the coming week.

New:
fmt 8.0.0
level_zero v1.7.15
pystring v1.1.3
robinmap v0.6.2
webp 1.2.2

Updated:
alembic 1.8.3
blosc 1.21.1
boost 1.78.0
embree 3.13.3
ffmpeg 5.0
fftw 3.3.10
flac 1.3.4
imath 3.1.4
ispc v1.17.0
jpeg 2.1.3
ogg 1.3.5
oidn 1.4.3
openal 1.21.1
opencolorio 2.1.1
openexr 3.1.4
openimageio v2.3.13.0
openjpeg 2.4.0
opensubdiv v3_4_4
openvdb 9.0.0
osl 1.11.17.0
sdl 2.0.20
tbb 2020_u3
tiff 4.3.0
usd 22.03
vorbis 1.3.7
vpx 1.11.0
x264 35fe20d1b
zlib 1.2.12

Implemented by Ray Molenkamp, Sybren Stüvel and Brecht Van Lommel.

Ref T95206
2022-04-20 16:42:16 +02:00
7cb6fb0183 Cleanup: Remove redundant types from custom data masks
Colors and byte colors are already included in `CD_MASK_PROP_ALL`.
2022-04-20 09:12:40 -05:00
03ec505fa5 Cleanup: Rename CD_MLOOPCOL to CD_PROP_BYTE_COLOR
The "PROP" in the name reflects its generic status, and removing
"LOOP" makes sense because it is no longer associated with just
mesh face corners. In general the goal is to remove extra semantic
meaning from the custom data types.
2022-04-20 09:10:10 -05:00
0385e2f1f9 PBVH: Pass Mesh to extract internals.
More mesh data is required when extracting the UV seams. This is an
API change for to support this future enhancement.
2022-04-20 13:42:51 +02:00
5b8a3ccd37 Fix T94775: Buggy liboverride default apply code for items insertion in RNA collections.
For some reason, the rework of liboverride handling of Collection items
insertion (rB33c5e7bcd5e5) completely missed to update accordingly the
default liboverride apply code...

Many thanks to Wayde Moss (@GuiltyGhost) for the investigation and
proposed solution.
2022-04-20 11:05:54 +02:00
97dbcf9746 Fix (unreported) huge liboverride slow-down due to non-disabled UV layer props.
Was revealed by yesterday's fix (rB6f56bd4083f9).
2022-04-20 10:10:29 +02:00
8adc7cad00 Fix compilation without OpenVDB 2022-04-20 09:58:42 +02:00
31a2feceb8 Cleanup: remove unused curves toolsetting 2022-04-20 09:51:14 +02:00
f5191b8760 Fix GPU subdivision: Crash on adding subdivision surface modifier
This was caused by the use of a reserved keyword macro that is not
directly used but causes an error on some compiler.

Change the occurences to not match the macros.
2022-04-20 09:12:02 +02:00
65a1fcdaf7 Cleanup: run autopep8 on tests/performance/benchmark
This file was skipped by source/tools/utils/autopep8_clean.py
since it doesn't have a .py extension, running the autopep8 tool
recursively detects Python scripts without extensions.
2022-04-20 17:07:46 +10:00
67a4908bfc Cleanup: re-run autopep8 with E401 enabled
Put imports on their own line which was almost always the case already.
2022-04-20 16:26:49 +10:00
3adef61942 Cleanup: run autopep8 on release/scripts/presets 2022-04-20 16:21:04 +10:00
41b8e0316a Cleanup: use autopep8 on release/lts 2022-04-20 16:18:42 +10:00
28e068b55c Cleanup: run autopep8 on release/scripts/freestyle 2022-04-20 16:18:30 +10:00
8898251584 Cleanup: run autopep8 on intern/cycles/
Disable autopep8 for the block that yields passes in list_render_passes,
for better readability.
2022-04-20 16:10:05 +10:00
11dd7941af Cleanup: run autopep8 with max-line-length=120 (missed a file) 2022-04-20 15:55:17 +10:00
67516d0dae Cleanup: run autopep8 with max-line-length=120 2022-04-20 15:47:24 +10:00
8ed8fa80f4 Cleanup: use autopep8 for bl_i18n_utils.settings
Disable autopep8 for some regex blocks that use indentation
to signify regex grouping.
2022-04-20 15:39:36 +10:00
08dbd3bc7f Cleanup: run autopep8 on release/scripts/modules/ 2022-04-20 15:12:10 +10:00
38d8b088e7 Cleanup: run autopep8 on release/scripts/templates_py 2022-04-20 15:11:22 +10:00
c2cdbe1e88 Cleanup: run autopep8 on doc/ 2022-04-20 15:10:14 +10:00
df3316cbe9 Cleanup: run autopep8 on build_files/
Replace multiple hashes with over-lines for make_source_archive.py.
2022-04-20 15:08:46 +10:00
972a697f82 PyAPI: improve deprecation warning for bpy.ops context override
- Increase the stack level so the reported line number references
  script authors code (not Blender's wrapper function).
- Include the operator name and poll/call usage in the warning.
2022-04-20 13:17:16 +10:00
feea852b10 Fix crash passing no arguments to Context.temp_override 2022-04-20 13:01:14 +10:00
9364e17936 Docs: update examples to use Context.temp_override 2022-04-20 12:49:13 +10:00
f438344cf2 PyAPI: temporary context override support
Support a way to temporarily override the context from Python.

- Added method `Context.temp_override` context manager.
- Special support for windowing variables "window", "area" and "region",
  other context members such as "active_object".
- Nesting context overrides is supported.
- Previous windowing members are restored when the context exists unless
  they have been removed.
- Overriding context members by passing a dictionary into operators in
  `bpy.ops` has been deprecated and warns when used.

This allows the window in a newly loaded file to be used, see: T92464

Reviewed by: mont29

Ref D13126
2022-04-20 12:19:35 +10:00
6d9268c2c7 PyAPI: utility functions for parsing typed RNA arguments
These functions can be used with PyArg_ParseTupleAndKeywords
(and related functions) to take typed RNA arguments without
having to extract and type-check them separately.

No functional changes, extracted from D13126.
2022-04-20 12:16:11 +10:00
16afff2ddc Cleanup: spelling in comments 2022-04-20 10:41:31 +10:00
42717596d0 Cleanup: clang-format 2022-04-20 10:41:31 +10:00
f8f8edbe1a Cleanup: unused argument warning 2022-04-20 10:41:31 +10:00
Nate Rupsis
75ccfa63d0 UI: Fix typo in Apply Parent Inverse tooltip
There's a small typo in the tool tip for applying the Parent Inverse. This patch fixes that typo

old:
{F13010751}

new:
{F13010749}

Reviewed By: Blendify

Maniphest Tasks: T97437

Differential Revision: https://developer.blender.org/D14693
2022-04-19 20:40:59 -04:00
6a3c3c77b3 Mesh: Avoid unnecessary normal calculation and dirty tags
This is mostly a cleanup to avoid hardcoding the eager calculation of
normals it isn't necessary, by reducing calls to `BKE_mesh_calc_normals`
and by removing calls to `BKE_mesh_normals_tag_dirty` when the mesh
is newly created and already has dirty normals anyway. This reduces
boilerplate code and makes the "dirty by default" state more clear.
Any regressions from this commit should be easy to fix, though the
lazy calculation is solid enough that none are expected.
2022-04-19 17:08:02 -05:00
9ec94c3882 Cleanup: Don't recalculate normals in versioning code
Normals are not read from files anymore, calculating them in versioning
is unnecessary and wasteful.
2022-04-19 16:51:58 -05:00
d813ee55fd Fix: Incorrect info message in set material node
The node does have support for curves since c4f7f59c65.
2022-04-19 13:20:19 -05:00
5a06996722 Fix: Assert when sculpting empty curves 2022-04-19 12:09:29 -05:00
67962824e9 GPU: Fix Adresse Sanitizer errors 2022-04-19 19:03:40 +02:00
37d298391e Cleanup: GPUMaterial: Remove GPU_material_is_volume_shader 2022-04-19 19:03:40 +02:00
2890c11cd7 Cycles: add support for volume motion blur
This adds support for rendering motion blur for volumes, using their
velocity field. This works for fluid simulations and imported VDB
volumes. For the latter, the name of the velocity field can be set per
volume object, with automatic detection of velocity fields that are
split into 3 scalar grids.

A new parameter is also added to scale velocity for more artistic control.

Like for Alembic and USD caches, a parameter to set the unit of time in
which the velocity vectors are expressed is also added. For Blender gas
simulations, the velocity unit should always be in seconds, so this is
only exposed for volume objects which may come from external OpenVDB
files.

These parameters are available under the `Render` panels for the fluid
domain and the volume object data properties respectively.

Credits: kernel advection code from Tangent Animation's Blackbird based
on earlier work by Geraldine Chua

Differential Revision: https://developer.blender.org/D14629
2022-04-19 17:07:53 +02:00
56cfd60d43 Cleanup: remove unused code 2022-04-19 16:50:25 +02:00
Robert Guetzkow
721a9bc35c Fix T97338: Correct reference count for COM handling and removal of gotos
The fix ensures that the reference count for `IShellItem *pSI` is decremented,
preventing a memory leak. For `IFileOperation *pfo` the decrement of the
reference count is only attempted when `CoCreateInstance` is successful.
Additionally, the gotos have been replaced with nested if/else statements.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14681
2022-04-19 16:30:22 +02:00
Germano Cavalcante
3e98331a09 PyGPU: remove outdated function 'code_from_builtin'
Since shader sources are now parsed on demand via `GPUShaderCreateInfo`,
sources are not available to be read via
`GPU_shader_get_builtin_shader_code`.

Currently this results in a crash as the code tries to read `NULL`
pointers.

`GPU_shader_get_builtin_shader_code` was created with the intention of
informing the user how a builtin shader works, thus "replacing"
detailed documentation.

Therefore this function doesn't really have a practical use in an addon.

So, instead of updating the function (which would require several
changes to the gpu module), remove it and improve the documentation.

Release Notes: https://wiki.blender.org/wiki/Reference/Release_Notes/3.2/Python_API#Breaking_Changes

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14678
2022-04-19 11:23:51 -03:00
47de3659f0 improve hover tip for 'Lock Object Modes' property 2022-04-19 15:58:28 +02:00
6f56bd4083 Fix wrong logic in comparison code of RNA collection proerties.
Noted as part of T94775 investigation by Wayde Moss (@GuiltyGhost),
thanks!

NOTE: this mistake probably did not have any pratical impact in current
code, at least for overrides.
2022-04-19 15:53:54 +02:00
767939231d DRW: Volume: Fix warning about unused variable 2022-04-19 14:47:09 +02:00
058ce64be0 Fix: Uninitialized paint brush when using byte textures.
This is a fix for the 3d texturing brush.
2022-04-19 12:31:00 +02:00
14a2706886 EEVEE: Fix compilation caused by missing file 2022-04-19 12:27:27 +02:00
fa3bd17ae8 GPU: Replace GPUMaterialVolumeGrid by GPUMaterialAttribute
This is to make the codegen and shading nodes object type agnostic. This
is essential for flexibility of the engine to use the nodetree as it see
fits.

The essential volume attributes struct properties are moved to the
`GPUMaterialAttribute` which see its final input name set on creation.

The binding process is centralized into `draw_volume.cc` to avoid
duplicating the code between multiple engines. It mimics the hair attributes
process.

Volume object grid transforms and other per object uniforms are packed into
one UBO per object. The grid transform is now based on object which simplify
the matrix preparations.

This also gets rid of the double transforms and use object info orco factors
for volume objects.

Tagging @brecht because he did the initial implementation of Volume Grids.
2022-04-19 12:09:18 +02:00
1e3f4c70ab Material: Add name to default shaders
Improve debugging experience.
2022-04-19 12:09:18 +02:00
c2c17cc076 Workbench: Volume: Fix errors about unboud texture 2022-04-19 12:09:18 +02:00
6296cb5129 DRW: Centralize smoke domain texture management
This code was duplicated in multiple engines. Now it is the draw manager
responsability to manage the throwaway fluid textures.
2022-04-19 12:09:18 +02:00
eccc9d8eba Cleanup: Remove unused function in Cycles queue
Noticed while looking into oneAPI patch.

Seems to be unused, without clear indication why/when it might be
needed. Removing the function simplifies adding the new backend.

Differential Revision: https://developer.blender.org/D14652
2022-04-19 10:32:07 +02:00
3035235def Cleanup: run autopep8 on tests/ 2022-04-19 15:25:55 +10:00
58d86527ae Cleanup: run autopep8 on release/scripts/startup/ 2022-04-19 15:07:04 +10:00
8c25889bb6 Refactor: Move mesh face dot tag out of MVert
Continuing the refactors described in T93602, this commit moves
the face dot tag set by the subdivision surface modifier out of
`MVert` to `MeshRuntime`. This clarifies its status as runtime data
and allows further refactoring of mesh positions in the future.

Before, `BKE_modifiers_uses_subsurf_facedots` was used to check
whether subsurf face dots should be drawn, but now we can just check
if the tags exist on the mesh. Modifiers that create new new geometry
or modify topology will already remove the array by clearing mesh
runtime data.

Differential Revision: https://developer.blender.org/D14680
2022-04-18 23:48:43 -05:00
775f0d76d5 Fix missing C/Python methods in API docs
The following methods weren't included in API docs.

- BlendDataLibraries.load
- BlendDataLibraries.write
- Text.region_as_string
- Text.region_from_string
2022-04-19 13:08:48 +10:00
7e045094c1 PyDoc: quiet warnings for duplicate members bpy.context 2022-04-19 12:19:08 +10:00
f401741544 PyDoc: remove multiple children properties for Bone type
This doesn't cause any functional change as the RNA property
of Bone wasn't overridden by the _GenericBone's property,
however the `children` property was documented twice, causing a warning.
2022-04-19 12:18:53 +10:00
76acc5e999 PyDoc: fix including literal text immediately after function args
Literal text from examples could be included directly after function
arguments, this caused a warning with mis-matching indentation.
2022-04-19 12:17:58 +10:00
adcce654e3 Cleanup: Use correct capitalization of "F-Curve" 2022-04-18 20:17:41 -04:00
Colin Basnett
549f68149d UI: Fix typo in UI description for bpy.types.ActionFCurves.remove function
The UI description for the `bpy.types.ActionFCurves.remove` was incorrect;
seemingly a copy-paste typo from the `rna_Action_groups_remove` function.

Reviewed By: sybren, Blendify

Differential Revision: https://developer.blender.org/D14659
2022-04-18 20:11:45 -04:00
b90e892a17 Fix call of 'BLI_assert' instead 'BLI_assert_msg'
Error in 5da02548e9
2022-04-18 19:15:46 -03:00
5da02548e9 Cleanup: remove redundant 'DEG_get_original_object' call
The `BMEditMesh` pointer is the same in the original or evaluated mesh.

Also a clang-format was missed.
2022-04-18 19:00:55 -03:00
a0c2d6bf85 Transform: small optimization in snap to edit mesh
In some cases, selected elements do not contribute to snapping.
So ignore these elements when creating the edit meshes bound box.
2022-04-18 18:25:16 -03:00
bec057a453 Fix assert on meshes without mloop in snap code
Meshes without loops are still valid for snapping.
2022-04-18 18:24:50 -03:00
03d39a04a3 Fix T97002: Preserve multi socket link order
Preserve multi socket link order when copying nodes or adding a new
group input sockets by linking directly to multi inputs from the group
input node's extension socket.

This is done by also copying the `multi_input_socket_index` when
the new links are created by copying existing or temporary links.

Reviewed By: Hans Goudey

Differential Revision: http://developer.blender.org/D14535
2022-04-18 22:28:03 +02:00
314b27850c Cleanup: Remove incorrect comment 2022-04-18 14:08:29 -05:00
95cce6f6b0 Cleanup: Move object_modifier.c to C++
This allows using C++ only APIs/data structures, and potentially
simplifies adding support to apply modifiers for the Curves object.
2022-04-18 12:40:23 -05:00
98fc998c70 Cleanup: Clang tidy
- Inconsistent parameter names
- Else after return
- Braces around statements
- Qualified auto
- Also (not clang tidy): Pass StringRef by value, unused parameter
2022-04-18 12:36:37 -05:00
fc58368263 Build: link with GameController and CoreHaptics frameworks on macOS
In preparation of upcoming SDL upgrade, which uses these.
2022-04-18 19:14:36 +02:00
2cb76a6c8d Cleanup: consistently use parallel_for without tbb namespace in Cycles 2022-04-18 19:14:36 +02:00
029b0df81a Fix Cycles blackbody shader not taking into account OpenColorIO config
Keep the existing Rec.709 fit and convert to other colorspace if needed, it
seems accurate enough in practice, and keeps the same performance for the
default case.
2022-04-18 19:14:34 +02:00
41b3feea85 Fix Cycles build error with latest TBB after recent changes
From changes in 869a46df29, ref D14454
2022-04-18 18:49:35 +02:00
Angus Stanton
ccd2e89d37 Fix T94559: Copying geometry node group does not copy animation data
Reimplement copy geometry node groups in C. The version implemented in
Python could also manually copy the animation data, but it's more
standard to do this with `BKE_id_copy_ex` and `LIB_ID_COPY_ACTIONS`.

Differential Revision: https://developer.blender.org/D14615
2022-04-18 10:15:30 -05:00
ef2b8c1c3a Nodes: Remove unnecessary RNA pointer creation
`rna_NodeSocket_refine` and `rna_Node_refine` take significant time
when building the `NodeTreeRef` acceleration data structure, but they
aren't used at all. This commit removes their eager calculation and
instead creates them on-demand in the `rna()` functions. They also
aren't inlined to avoid including `RNA_prototypes.h` in the header.

Differential Revision: https://developer.blender.org/D14674
2022-04-18 10:12:17 -05:00
933fed2a17 Minor tweaks to labels/tooltips of override operation in the Outliner. 2022-04-18 12:21:33 +02:00
bf80dc2bd4 Add debugging info for Wintab activated by argument --debug-wintab.
Bonus: Added docs for `--debug-ghost`.

Differential Revision: https://developer.blender.org/D14610
2022-04-17 15:21:59 -07:00
213cd39b6d OBJ: further optimize, cleanup and harden the new C++ importer
Continued improvements to the new C++ based OBJ importer.

Performance: about 2x faster.
- Rungholt.obj (several meshes, 263MB file): Windows 12.7s -> 5.9s, Mac 7.7s -> 3.1s.
- Blender 3.0 splash (24k meshes, 2.4GB file): Windows 97.3s -> 53.6s, Mac 137.3s -> 80.0s.
- "Windows" is VS2022, AMD Ryzen 5950X (32 threads), "Mac" is Xcode/clang 13, M1Max (10 threads).
- Slightly reduced memory usage during import as well.

The performance gains are a combination of several things:
- Replacing `std::stof` / `std::stoi` with C++17 `from_chars`.
- Stop reading input file char-by-char using `std::getline`, and instead read in 64kb chunks, and parse from there (taking care of possibly handling lines split mid-way due to chunk boundaries).
- Removing abstractions for splitting a line by some char,
- Avoid tiny memory allocations: instead of storing a vector of polygon corners in each face, store all the corners in one big array, and per-face only store indices "where do corners start, and how many". Likewise, don't store full string names of material/group names for each face; only store indices into overall material/group names arrays.
- Stop always doing mesh validation, which is slow. Do it just like the Alembic importer does: only do validation if found some invalid faces during import, or if requested by the user via an import setting checkbox (which defaults to off).
- Stop doing "collection sync" for each object being added; instead do the collection sync right after creating all the objects.

Cleanup / Robustness:

This reworking of parser (see "removing abstractions" point above) means that all the functions that were in `parser_string_utils` file are gone, and replaced with different set of functions. However they are not OBJ specific, so as pointed out during review of the previous differential, they are now in `source/blender/io/common` library.

Added gtest coverage for said functions as well; something that was only indirectly covered by obj tests previously.

Rework of some bits of parsing made the parser actually better able to deal with invalid syntax. E.g. previously, if a face corner were a `/123` string, it would have incorrectly treated that as a vertex index (since it would get "hey that's one number" after splitting a string by a slash), instead of properly marking it as invalid syntax.

Added gtest coverage for .mtl parsing; something that was not covered by any tests at all previously.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14586
2022-04-17 22:07:43 +03:00
a3eb4027c2 Fix T97095: export of Poly curves, export crash when object contains multiple curve types
- Was not exporting "Poly" curves at all,
- Had a crash when a single object contains multiple curves of different types -- it had a check for "is this nurbs compatible?" only for the first curve, and then proceeded to treat the other curves as nurbs as well, without checking for validity.

Fixed both issues by doing the same logic as in the old python exporter:
- Poly curves are supported,
- Treat object as "nurbs compatible" only if all the curves within it are nurbs compatible.

Added test coverage in the gtest suite. While at it, made "all_curves" test use the "golden obj file template" style test, instead of a manually coded test that checks intermediate objects but does not check the final exported result.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14611
2022-04-17 21:59:55 +03:00
b32cb0266c Fix T96824: New 3.1 OBJ exporter writes incorrect polygon/vertex groups in some cases
The new 3.1 OBJ exporter code had incorrect code to determine which vertex group a polygon belongs to -- for each vertex, it was only looking at the first vertex group it has, and not using the group weight either.

This 99% fixes T96824, but not 100% on the user's submitted mesh -- exactly two faces from that mesh get assigned a different group compared to the old exporter. Either choice is "correct" given that on these two faces there are two vertex groups with equal contribution. The old Python exporter was picking the group based on internal python group name map order, whereas the new C++ exporter is picking the group with the lowest index, in case of ties. I'm not sure if it's possible to fix this TBH, will have to wait until the importer is also C++.

While at it, the new vertex group calculation code was doing a lot of redundant work for each and every face (traversing group lists several times, allocating & freeing memory), so I fixed that. Exporting a 6-level subdivided Monkey mesh with 30 vertex groups was taking 810ms, now takes 330ms.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14500
2022-04-17 21:54:51 +03:00
e88807e71c Cleanup: Use C++ Array type 2022-04-17 13:30:30 -05:00
b9f1b64801 USD/Ctest: Add basic USD-Imaging test.
This adds a basic unit test to check USD has been correctly
build with imaging components to support building both with
the old and new libs, it automatically adds the test when it
detects a library with imaging enabled. (platform devs will
have to pay attention it runs the test to validate the libs
build correctly)

For future use in the code it also defines a USD_HAS_IMAGING
define one could check if we're building against an USD lib
that has it (just because we build/ship with it, doesn't
mean downstream builds will ship with it, so we'll have
to be a little pro-active there)

Reviewed By: sybren

Differential Revision:https://developer.blender.org/D14456
2022-04-16 15:32:48 -06:00
98eb111568 Fix T97366: Misdetection of numbers as UDIMs in certain filepaths
In some circumstances singular files with numbers in their name (like
turntable-1080p.png or frame-1042.png) might be detected as a UDIM.

The root cause in this particular instance was because `BKE_image_get_tile_info`
believed this file to be a tiled texture and replaced the filename with
a tokenized version of it. However, later on, the code inside `image_open_single`
did not believe it was tiled because only 1 file was detected and our
tiled textures require at least 2. This discrepancy lead to the broken
filename situation.

This was a regression since rB180b66ae8a1f as that introduced the
tokenization changes.

Differential Revision: https://developer.blender.org/D14667
2022-04-16 14:18:08 -07:00
2b191cd2b4 Mask by color now auto-creates a
color attribute if one does not exist,
and no longer passes through to the
translate tool on tweak grab.
2022-04-15 18:49:38 -07:00
8eb40d2063 This patch changes Sculpt Multi-Plane Scrape tool icon to be red and have a little outline around the color, like the other scraping tools T97271
Also, as a suggestion, this patch changes Mask By Color and Color Filter to be the same shade of green as paint and smear tool icons

{F12998856}

{F12998857}

{F12998858}

Reviewed By: Julian Kaspar & Joseph Eagar
Differential Revision: https://developer.blender.org/D14632
Ref D14632
2022-04-15 18:06:47 -07:00
dc5ae10692 Fix T96988: Merge by distance node crash with certain input
If the `wpoly` vector was small, the `wpoly_new` pointer could point
to part of its inline buffer on the stack, which becomes invalid out of
that scope. Instead, store `wpoly_new` as a span, and assign it properly
from the moved vector.
2022-04-15 16:55:15 -05:00
cb3c233ed3 Cleanup: Return early 2022-04-15 16:44:15 -05:00
65194f47b0 UI: Improve wording for some USD export descriptions
The HIG mentions that redundant words like "Enables" or "Activates"
shouldn't be used for tooltips of boolean properties. In this case
"When checked" was the redundant language that was implied by
the checkbox itself-- convention is to just state what the property
does when it's on.

Also change a few conjugations to the imperative and simplify
wording slightly, in order to be more consistent with language
elsewhere in Blender, and to be a bit more direct.

Differential Revision: https://developer.blender.org/D14644
2022-04-15 13:50:54 -05:00
ad324316ce Fix: Missing Null Check
Introduced by my recent commit: {rB3acbe2d1e933}

Lead to crash when insert_keyframe_direct() was called. Keyframing
crashed for NLA special properties (influence, animated_time),
driven properties, etc.
2022-04-15 13:45:00 -04:00
089e701191 Fix T97363: Duplicate elements node doesn't tag loose edges 2022-04-15 12:38:34 -05:00
4e6c0669e3 Cleanup: fix warning for differing parameter names 2022-04-15 13:21:07 -04:00
0f9057390d Cleanup: Clang tidy 2022-04-15 11:59:02 -05:00
7484f274dc Curves: Port curve to mesh node to the new data-block
This commit changes the Curve to Mesh node to work with `Curves`
instead of `CurveEval`. The change ends up basically completely
rewriting the node, since the different attribute storage means that
the decisions made previously don't make much sense anymore.

The main loops are now "for each attribute: for each curve combination"
rather than the other way around, with the goal of taking advantage
of the locality of curve attributes. This improvement is quite
noticeable with many small curves; I measured a 4-5x improvement
(around 4-5s to <1s) when converting millions of curves to tens of
millions of faces. I didn't obverse any change in performance compared
to 3.1 with fewer curves though.

The changes also solve an algorithmic flaw where any interpolated
attributes would be evaluated for every curve combination instead
of just once per curve. This can be a large improvement when there
are many profile curves.

The code relies heavily on a function `foreach_curve_combination`
which calculates some basic information about each combination and
calls a templated function. I made assumptions about unnecessary reads
being removed by compiler optimizations. For further performance
improvements in the future that might be an area to investigate.
Another might be using a "for a group of curves: for each attribute:
for each curve" pattern to increase the locality of memory access.

Differential Revision: https://developer.blender.org/D14642
2022-04-15 10:15:48 -05:00
cc6db8921b GPU: Make viewport not acquireable during rendering
This is a partial fix to the fact that rendering with EEVEE or other GL
render engines is currently blocking the whole UI when asking to redraw
a viewport.

This patch just bypasses the viewport bind (containing the Draw Context
lock) and the following drawing. There is an update tagging to not
loose a viewport update if there was one asked.

Other queries other than view redraw (such as selection depth drawing or
offscreen drawing) will still block the whole UI as they need immediate
data feedback.

Ping @Severin for the change in `WM_draw_region_viewport_bind()`.
I'm assuming this is not an issue because it's highly unlikely to
bring up this operator during rendering. But in this case, it would just
lock as usual.

The bypassing in `DRW_notify_view_update` might be a bit overparanoid.
2022-04-15 17:09:30 +02:00
47d961a4b1 Fix: Apply tilt in curves data-block normals calculation
The ported normal calculation from ceed37fc5c neglected to
use the tilt attribute to rotate the normals around the tangents.
This commit adds that behavior back, adding a new math header file
to avoid duplicating the rotation function for normalized axes.

Differential Revision: https://developer.blender.org/D14655
2022-04-15 09:54:45 -05:00
Jeroen Bakker
e96a809a68 PBVH Pixel extractor.
This patch contains an initial pixel extractor for PBVH and an initial paint brush implementation.
PBVH is an accelleration structure blender uses internally to speed up 3d painting operations.
At this moment it is extensively used by sculpt, vertex painting and weight painting.

For the 3d texturing brush we will be using the PBVH for texture painting.
Currently PBVH is organized to work on geometry (vertices, polygons and triangles).
For texture painting this should be extended it to use pixels.

{F12995467}

Screen recording has been done on a Mac Mini with a 6 core 3.3 GHZ Intel processor.

# Scope

This patch only contains an extending uv seams to fix uv seams. This is not actually we want, but was easy to add
to make the brush usable.

Pixels are places in the PBVH_Leaf nodes. We want to introduce a special node for pixels, but that will be done
in a separate patch to keep the code review small. This reduces the painting performance when using
low and medium poly assets.

In workbench textures aren't forced to be shown. For now use Material/Rendered view.

# Rasterization process

The rasterization process will generate the pixel information for a leaf node. In the future those
leaf nodes will be split up into multiple leaf nodes to increase the performance when there
isn't enough geometry. For this patch this was left out of scope.

In order to do so every polygon should be uniquely assigned to a leaf node.

For each leaf node
   for each polygon
     If polygon not assigned
       assign polygon to node.

Polygons are to complicated to be used directly we have to split the polygons into triangles.

For each leaf node
  for each polygon
    extract triangles from polygon.

The list of triangles can be stored inside the leaf node. The list of polygons aren't needed anymore.
Each triangle has:

    poly_index.
    vert_indices
    delta barycentric coordinate between x steps.

Each triangle is rasterized in rows. Sequential pixels (in uv space) are stored in a single structure.

    image position
    barycentric coordinate of the first pixel
    number of pixels
    triangle index inside the leaf node.

During the performed experiments we used a fairly simple rasterization process by
finding the UV bounds of an triangle and calculate the barycentric coordinates per
pixel inside the bounds. Even for complex models and huge images this process is
normally finished within 0.5 second. It could be that we want to change this algorithm
to reduce hickups when nodes are initialized during a stroke.

Reviewed By: brecht

Maniphest Tasks: T96710

Differential Revision: https://developer.blender.org/D14504
2022-04-15 16:40:01 +02:00
25196f8a36 EEVEE: Support disabling all lightprobe object contribution in viewport
This is supported throught the visibility toggle. The light cache will
then only be used for world lighting. This is the behavior as light
objects.
2022-04-15 14:05:18 +02:00
2839fe9a4d Curves: initial geometry nodes support for curves objects
* Curves objects now support the geometry nodes modifier.
* It's possible to use the curves object with the Object Info node.
* The spreadsheet shows the curve data.

The main thing holding this back currently is that the drawing code
for the curves object is very incomplete. E.g. it resamples the curves
always in the end, which is not expected for curves in general.

Differential Revision: https://developer.blender.org/D14277
2022-04-15 09:08:50 +02:00
Wayde Moss
db6287873c Object: Set Parent (Keep Transform Without Inverse)
**Relevant to Artists:** This patch adds an option to the Parenting
menu, `Object (Keep Transform Without Inverse)`, and Apply menu, `Parent
Inverse`. The operators preserve the child's world transform without
using the parent inverse matrix. Effectively, we set the child's origin
to the parent. When the child has an identity local transform, then the
child is world-space aligned with its parent (scale excluded).

**Technical:** In both cases, the hidden parent inverse matrix is
generally set to identity (cleared or "not used") as long as the parent
has no shear. If the parent has shear, then this matrix will not be
entirely cleared. It will contain shear to counter the parent's shear.
This is required, otherwise the object's local matrix cannot be properly
decomposed into location, rotation and scale, and thus cannot preserve
the world transform.

If the child's world transform has shear, then its world transform is
not preserved. This is currently not supported for consistency in the
handling of shear during the other parenting ops: Parent (Keep
Transform), Clear [Parent] and Keep Transform. If it should work, then
another patch should add the support for all of them.

Reviewed By: sybren, RiggingDojo
Differential Revision: https://developer.blender.org/D14581
2022-04-14 20:25:06 -04:00
48ff456a4b Fix T96875: Envelope modifier strokes cannot be eselected with Tweak
The new created strokes were not setting the right `orig` pointers, so the select operator could not select the strokes and points.

Now, the original pointers are set in the new strokes. To set the values is necessary assign the original pointer from the reference stroke because in modifiers the stroke is evaluated, so we need back two levels: Eval->Eval->Orig
2022-04-14 21:51:38 +02:00
48d2f536e1 Fix crash when loading Blender due to recent change
Issue introduced in {rB80859a6cb272}

Only seen on Windows.

The `keyword_parse` lambda function code did not consider `\r` as a
whitespace char, resulting in a wrong parse.

(More investigation needs to be done).
2022-04-14 15:54:09 -03:00
05715eaea1 Fix: Use after free when removing attribute on instances
Assume that only one layer matches the id and return instead
of continuing to iterate over attributes after the layers have
been potentially reallocated.
2022-04-14 13:04:23 -05:00
80859a6cb2 GPU: Make nodetree GLSL Codegen render engine agnostic
This commit removes all EEVEE specific code from the `gpu_shader_material*.glsl`
files. It defines a clear interface to evaluate the closure nodes leaving
more flexibility to the render engine.

Some of the long standing workaround are fixed:
- bump mapping support is no longer duplicating a lot of node and is instead
  compiled into a function call.
- bump rewiring to Normal socket is no longer needed as we now use a global
  `g_data.N` for that.


Closure sampling with upstread weight eval is now supported if the engine needs
it.

This also makes all the material GLSL sources use `GPUSource` for better
debugging experience. The `GPUFunction` parsing now happens in `GPUSource`
creation.

The whole `GPUCodegen` now uses the `ShaderCreateInfo` and is object type
agnostic. Is has also been rewritten in C++.

This patch changes a view behavior for EEVEE:
- Mix shader node factor imput is now clamped.
- Tangent Vector displacement behavior is now matching cycles.
- The chosen BSDF used for SSR might change.
- Hair shading may have very small changes on very large hairs when using hair
  polygon stripes.
- ShaderToRGB node will remove any SSR and SSS form a shader.
- SSS radius input now is no longer a scaling factor but defines an average
  radius. The SSS kernel "shape" (radii) are still defined by the socket default
  values.

Appart from the listed changes no other regressions are expected.
2022-04-14 18:47:58 +02:00
66dc4d4efb Cleanup: Alembic, use a structure to pass parameters
This adds a structure, `ABCReadParams`, to store some parameters passed
to `ABC_read_mesh` so we avoid passing too many parameters, and makes it
easier to add more parameters in the future without worrying about
argument order.

Differential Revision: https://developer.blender.org/D14484
2022-04-14 17:48:31 +02:00
45f30543db Fix T97135: Fix selection issues with parented masks in the MCE
Box, Circle and Lasso select were not taking into account if a
mask(point) was parented; selection was only succeeding in the original
place.

Now check coordinates from evaluated mask (points) instead while
setting selection flags and DEG tagging still happens on the original ID.

Maniphest Tasks: T97135

Differential Revision: https://developer.blender.org/D14651
2022-04-14 16:59:50 +02:00
ad245a25e2 Fix T85756: Adjust Last Operation panel is slow.
Extremely subttle bug that would only appear in some specific
circumstances, would cause memfile undo writing code to falsely detect
some ID as changed because it would get the wrong 'starting point' of
comparison with existing previous memfile step.

See T85756 for detailed explanation and reproducible case.
2022-04-14 16:46:51 +02:00
c71013082d Geometry Nodes: show used named attributes in nodes
This adds a new node editor overlay that helps users to see where
named attributes are used. This is important, because named
attributes can have name collisions between independent node
groups which can lead to hard to find issues.

Differential Revision: https://developer.blender.org/D14618
2022-04-14 16:31:09 +02:00
a9b94e5f81 Fix T95700: Oject Info node does not work with GPU subdivided meshes
When GPU subdivision is enabled the mesh objects remain unsubdivided on
the CPU side, and subdivision should be requested somewhat manually (via
`BKE_object_get_evaluated_mesh`).

When referencing an object, the Object Info node calls
`bke::object_get_evaluated_geometry_set` which first checks if a Geometry
Set is present on the object (unless we have a mesh in edit mode). If so
it will return it, if not, the object type is discriminated, which will
return a properly subdivided mesh object via `add_final_mesh_as_geometry_component`.

The unsubdivided mesh is returned because apparently the check on the
Geometry Set always succeeds (as it is always set in `mesh_build_data`).
However, the mesh inside this Geometry Set is not subdivided.

This adds a check for a MeshComponent in this Geometry Set, and if one
exists, calls `add_final_mesh_as_geometry_component` which will ensure
that the mesh is subdivided on the CPU side as well.

Differential Revision: https://developer.blender.org/D14643
2022-04-14 15:11:58 +02:00
31b2b84b3c Fix T97262: Crash with specific view layer setup
Originally was noticed when using a linked background scene and a scene
camera from another (local) scene.

The root issue was that relation from view layer to object's base flags
evaluation was using wrong view layer. This is because the relation was
created between object and currently built view layer, and it only was
happening once (since the object-level relations are only built once).
Depending on order in which `build_object` was called it was possible
that relation from a wrong view layer was used.

Now the code is better split to indicate which parts of object relations
are built when object comes from a base in the view layer, and which ones
are built on indirect linking of object to the dependency graph.

This patch makes relations correct in the cases when the same object is
used as a base in both active and set scenes. But, the operation which
handles object-level flags might not behave correctly as there is no
known design of what is the proper thing to do in this case. Making a
clear design and implementation of case when object is shared between
active and set scene is outside of the scope of this patch.

Differential Revision: https://developer.blender.org/D14626
2022-04-14 14:57:49 +02:00
1440074cac Tests: Change force disable render test messages to be warnings
These were easilly missable and took some effort to find why the test
were disabled.
2022-04-14 13:10:26 +02:00
c9574412c7 Curves: fix some issues with operator to convert to particle system
Ref T97171.

Differential Revision: https://developer.blender.org/D14637
2022-04-14 12:25:54 +02:00
Jason Fielder
8f0e06a0ca Metal: GPU_PRIM_LINE_LOOP alternative implementations.
Prefer using immVertex3f when 3D shaders are used for 2D rendering due to overhead of vertex padding in hardware. CPU overhead is negligible.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14494
2022-04-14 12:01:31 +02:00
Jason Fielder
e28f07b5c8 Metal: GLSL shader compatibility 4th pass
MSL follows C++ standard convention, and such variable declarations within switch statements must have their scope localised within each case. Adding braces in all cases ensures correct behaviour and avoids 'case ... bypass initialization of local variable' compilation error.

struct initialisation to follow C++ rules for Metal. Implicit constructors replaced with either explicit constructors or list-initialization where appropriate.

Ref T96261

Authored by Apple: Michael Parkin-White

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14451
2022-04-14 12:00:39 +02:00
3acbe2d1e9 NLA: Keyframe Remap Through Upper Strips
Add a new operator, "Start Tweaking Strip Actions (Full Stack)", which
allows you to insert keyframes and preserve the pose that you visually
keyed while upper strips are evaluating,

The old operator has been renamed from "Start Tweaking Strip Actions" to
"Start Tweaking Strip Actions (Lower Stack)" and remains the default for
the hotkey {key TAB}.

**Limitations, Keyframe Remapping Failure Cases**:
1. For *transitions* above the tweaked strip, keyframe remapping will
   fail for channel values that are affected by the transition. A work
   around is to tweak the active strip without evaluating the upper NLA
   stack.

   It's not supported because it's non-trivial and I couldn't figure it
   out for all transition combinations of blend modes. In the future, it
   would be nice if transitions (and metas) supported nested tracks
   instead of using the left/right strips for the transitions. That
   would allow the transitioned strips to overlap in time. It would also
   allow  N strips to be part of the (previously) left and right strips,
   or perhaps even N strips being transitioned in sequence (similar to a
   blend tree). Proper keyframe remapping through all that is currently
   beyond my mathematical ability. And even if I could figure it out,
   would it make sense to keyframe remap through a transition?

   //This case is reported to the user for failed keyframe insertions.//

2. Full replace upper strip that contains the keyed channels.

   //This case is reported to the user for failed keyframe insertions.//

3. When the same action clip occurs multiple times (colored Red to
   denote it's a linked strip) and vertically overlaps the tweaked
   strip, then the remapping will generally fail and is expected to
   fail.

   I don't plan on adding support for this case as it's also non-trivial
   and (hopefully) not a common or expected use case so it shouldn't be
   much of an issue to lack support here.

   For anyone curious on the cases that would work, it works when the
   linked strips aren't time-aligned and when we can insert a keyframe
   into the tweaked strip without modifying the current frame output of
   the other linked strips. Having all frames sampled and the strip
   non-time aligned leads to a working case. But if all key handles are
   AUTO, then it's likely to fail.

   //This case is not reported to the user for failed keyframe
   insertions.//

4. When using Quaternions and a small strip influence on the tweaked
   Combine strip. This was an existing failure case before this patch
   too but worth a mention in case it causes confusion. D10504 has an
   example file with instructions.

   //This case is not reported to the user for failed keyframe insertions. //

5. When an upper Replace strip with high influence and animator keys to
   Quaternion Combine (Replace is fine). This case is similar to (4)
   where Quaternion 180 degree rotation limitations prevent a solution.

   //This case is not reported to the user for failed keyframe insertions.//

Reviewed By: sybren, RiggingDojo

Differential Revision: https://developer.blender.org/D10504
2022-04-14 11:55:08 +02:00
Jason Fielder
b0dc3aff2c Metal: GLSL shader compatibility 3rd pass
Undefined behaviour for divergent control-flow fixes, replacement for partial vector references, and resolution of a number of calculation precision issues occuring on macOS.

Authored by Apple: Michael Parkin-White

Ref: T96261

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14437
2022-04-14 11:49:18 +02:00
Ethan-Hall
d62f443f2d GPUTexture: Fixed typo where wrong enum was used
This patch fixes a typo in commit e59f754c16 which incorrectly uses `GPU_TEXTURE_ARRAY` instead of `GPU_FORMAT_COMPRESSED`.

`GPU_FORMAT_COMPRESSED` and `GPU_TEXTURE_ARRAY` both currently evaluate to 16,  so this patch does not change anything functionally; however, this patch will prevent issues from arising in the future.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14384
2022-04-14 11:46:49 +02:00
Colin Basnett
f1ae6952a8 Animation: Select markers before/after current frame
Add operator to select markers left/right of the current frame
(including the current frame).

`bpy.ops.marker.select_leftright(mode='LEFT', extend=False)`

`mode` can be either 'LEFT' or 'RIGHT'.

The naming and defaults of the above variables match similar operators
(e.g., `bpy.ops.nla.select_leftright`)

This also adds a new sub-menu to the Marker menu found in animation
editors, exposing both the new `bpy.ops.marker.select_leftright`
operator as well as the `bpy.ops.marker.select_all` operator.

Despite the name "Before Current Frame" and "After Current Frame", it
also selects a marker that falls on the current from for both of the
modes. This is to match the behavior found in the `nla.select_leftright`
operator.

RCS: https://blender.community/c/rightclickselect/OgmG/

Reviewed by: sybren, looch

Differential Revision: https://developer.blender.org/D14176
2022-04-14 11:30:12 +02:00
RedMser
d6e7241237 Animation: Add F2 for renaming markers
F2 allows renaming lots of different types of active items, and now it
also works for markers.

Before, Ctrl+M was used, and it's context-sensitive: you often get
"Mirror Keys" instead, when your cursor isn't on the markers region, and
that operator has nothing to do with either renaming or markers.

**What this commit does:**

- Replace Ctrl+M shortcut with F2.
  - Adds the `TOPBAR_PT_name_marker` panel which is implemented similar
    to the global rename panel. This having to press enter twice to
    confirm or escape twice to cancel, which would happen if the
    `marker.rename` operator was called directly.
- Replace usages of `marker.rename` in the UI with `wm.call_panel`.
- To make the Industry Compatible keymap consistent with Blender
  Default, the rename shortcut only works when hovering the markers
  area.

Reviewed By: ChrisLend, sybren

Differential Revision: https://developer.blender.org/D12298
2022-04-14 10:58:14 +02:00
4fa3eadce9 Icons: Re-sync Blender with latest svn icon file
There are no real difference from the previous icons, but since some
manual changes were introduced in the icons file, we still needed
a final sync between them.
2022-04-14 09:57:15 +02:00
b1908f2e0b View 3D: disable object mode selection cycling on first-click
Unlike regular selection cycling that is activated when clicking again
in the same location, object mode would cycle to another object
if the object that was selected happened to already be active.

This made it impossible to click-drag to tweak the active object
if there were other objects behind it as those would be activated first.

Resolves T96752.
2022-04-14 17:20:36 +10:00
678b76d99a Correct error in 405bff7fd8
Was adding 1 to dietime twice in init_particle_interpolation.
2022-04-14 17:03:01 +10:00
405bff7fd8 Fix T68290: Baked particles don't render in final frame
Particles baked into memory would never load the final frame because
of an off-by-one error calculating the particles `dietime`.

This value indicates the frame which the particle ceases to exist but
was being set to the end-frame which caused this bug as the scenes
end-frame is inclusive.

While the last frame was properly written and read from memory,
the `dietime` was set to the last frame causing all the particles to be
considered dead when calculating the cached particle system.
2022-04-14 16:58:15 +10:00
bc8dcf6db7 Cleanup: unused argument warning 2022-04-14 16:58:09 +10:00
180163c4e4 Cleanup: Further hair to curves renaming
These were missed in previous passes. Also remove some logic
in `draw_hair.c` that was redundant after f31c3f8114.
2022-04-13 22:52:09 -05:00
f31c3f8114 Curves: Split curve EEVEE/workbench functions from particle hair
The GPU evaluation for curves will have to change significantly from the
current particle hair drawing code, due to its more general use cases
and support for more curve types. To simplify that process and avoid
introducing regressions for the rendering of hair particle systems,
this commit splits drawing functions for the curves object and
particle hair.

The changes are just inlining of functions and copying code
where necessary.

Differential Revision: https://developer.blender.org/D14576
2022-04-13 22:07:31 -05:00
f84f9eb8ed Fix T96563: tangents artifacts with GPU subdivision
When tangent are computed from generated coordinates, the result for GPU
subdivision would be compressed to 16-bit when it shouldn't.
2022-04-14 03:49:44 +02:00
3e25561d51 Fix part of T96596: wrong generated coordinates with GPU subdivision
Problem is that the orco layer was not taken care of by the GPU
subdivision routines. This only handles the issues for EEVEE/Workbench.
For Cycles, this would need to be handled at the wrapper level somehow.
2022-04-14 03:39:28 +02:00
927cb5bfac Cleanup: separate format-units for Python argument parsing
Recent addition to the Python API [0] didn't follow this convention.
See [1] for the rationale behind this change.

[0]: 9bc678969a
[1]: 982aea88e0
2022-04-14 11:21:51 +10:00
f076493dbb Keymap: restore key-shortcut to remove from local-view
Use Alt-Slash to remove objects from local-view (was M prior to [0]),
following the convention of using Alt to perform the reverse of an
action. Also remove the confirmation menu as this key as it can be
undone and it's not likely to be pressed by accident.

This can be useful to quickly subtract items from a complex selection
with items that only become visible when entering local-view.

The M key was originally used in 2.4x since moving between layers wasn't
possible. Now moving between collections is possible in local-view
the keys collided.

[0]: cf5d582b77
2022-04-14 11:14:32 +10:00
3f305b9ab3 Fix T97053: on cage GPU subdivision shows subdivided edges as actual
edges

When wireframe mode is turned on, the subdivision edges not originating
from coarse edges were also drawn as regular edges, which would confuse
users trying to select them. These should not be drawn in edit mode,
only in object mode when optimal display is turned off (matching the CPU
subdivision case).
2022-04-14 03:04:37 +02:00
8826db8f03 Fix T97310: BLF Line Height While Text Wrapping
Fix word-wrapped tooltip text not showing by aligning to pixel grid.

See D14639 for more details.

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

Reviewed by Campbell Barton
2022-04-13 17:45:32 -07:00
8e4c3c6a24 Cleanup: Make curve deform argument optional
The "dir" argument to `BKE_where_on_path` was only actually
used in a few places. It's easier to see where those are if there
isn't always a dummy argument.
2022-04-13 19:22:10 -05:00
0ba061c3bc Edit Mesh: Parallelize bounds calculation with deform modifiers
When displaying a deform modifier in edit mode, a cached
array of positions is used. Parallelizing bounds calculation when
that array exists can improve the framerate when editing slightly
(a few percent). I observed an improvement of the min/max itself
of about 10x (4-5ms to 0.4ms).
2022-04-13 18:49:11 -05:00
232b388455 Cleanup: Declare variables where initialized
Also adjust comment formatting and use nullptr
where the previous commit missed.
2022-04-13 18:02:21 -05:00
ad3378215c Cleanup: Clang tidy 2022-04-13 17:51:20 -05:00
abd02da4bd Cleanup: Move three mesh files to C++
This will allow easier interaction with other areas also using C++
features, and a potential optimization to edit mesh bounding box
calculation.
2022-04-13 17:51:05 -05:00
5a98e38275 Curves: Avoid duplicating evaluated positions with all poly curves
If all of the curves are poly curves, the evaluated positions are the
same as the original positions. In this case just reuse the original
positions span as the evaluated positions.
2022-04-13 17:13:30 -05:00
078aa677b6 Fix: Curves: Add missing builtin attribute definition 2022-04-13 17:05:35 -05:00
a8ee279aa9 Fix: Use consistent type for nurbs order attribute
An 8 bit integer should be enough for now. We can change this if we ever
want to allow increasing the order past 256.
2022-04-13 17:00:18 -05:00
94495049a8 Fix: Assert evaluating single point Bezier curve
Just return early in that case to keep the rest of the function simpler.
2022-04-13 16:57:13 -05:00
95236d8a75 Rename Color Attributes domain from "Point" to "Vertex"
Addresses T97257, to make it consistent with regular attributes tab

Review by: Julian Kaspar

Differential Revision: https://developer.blender.org/D14631
Ref D14631
2022-04-13 09:53:31 -07:00
6da5ee8368 Fix: compilation error with MSVC
Similar issue as e22fd7247a.
2022-04-13 10:15:00 -06:00
Hallam Roberts
7dc4ac71e8 Fix T97278: wrong hair particle shape with kink spiral
Revert change from 3da84d8b that incorrectly used M_PI_4.

Differential Revision: https://developer.blender.org/D14636
2022-04-13 16:23:47 +02:00
9c09e5ba24 Fix some usages of 'GPU_shader_get_uniform_block'
`GPU_shader_get_uniform_block` is marked as deprecated and the value
returned does not match what `GPU_uniformbuf_bind` expects.

Also, small typo fix in python error message.

Differential Revision: https://developer.blender.org/D14638
2022-04-13 10:51:51 -03:00
e22fd7247a Fix compilation error with MSVC
Caused by previous DNA change.
2022-04-13 15:19:36 +02:00
fb84408aa5 Cleanup: Update icons_geom CMakeLists.txt 2022-04-13 15:18:16 +02:00
0a57d6d076 Docs: correct RST syntax for GPU documentation 2022-04-13 22:39:26 +10:00
24fea2bdc4 Cleanup: Split paint_canvas into BKE and ED.
The BKE part is needed for the 3d texture paiting brush to be part of blender
kernel.
2022-04-13 14:27:19 +02:00
babd027fae Cleanup: make format 2022-04-13 12:30:29 +02:00
cf5d582b77 Fix T97207: Move to Collections Menu Grayed out when in Local View
This behaviour was introduced in a687d98e67 to bring the old obscure
"M" operator to remove objects from the local view. In order to avoid
the keymap clash with the Move to Collection operator, the Move to
Collection was artificially restricted to work in local view.

In retrospect, the "Remove from Local View" operator is in the menu anyways,
so it didn't even need to have a shortcut (back in 2.79 the operator was
not in a menu).

The changes introduced here are:
* No shortcut for "Remove from Local View"
* No more restrictions to "Move/Link to Collection" from local view.

Thanks for Philipp Oeser for digging the old commit that introduced this
and for the rationale on the changes.
2022-04-13 12:29:19 +02:00
c31b89e76e Cycles: Add support for "stageMetersPerUnit" Hydra render setting
This can be useful to match transforms to what native Cycles
would see in Blender, as USD typically uses centimeters, but
Blender uses meters. This patch also fixes the hardcoded focal
length multiplicator, which is now using the same units as
everything else. Default of "stageMetersPerUnit" is 0.01 to match
the USD default of centimeters.

Differential Revision: https://developer.blender.org/D14630
2022-04-13 12:24:21 +02:00
3a88f151c4 Cleanup: Proper printing of a string
Print it as a "%s" so that possible percentage symbols in the
error message does not cause issues.

Use proper assert (assert(true) is a no-op).

Also use `empty()` instead of `length()`.

Reviewed with Clement in real life.
2022-04-13 11:55:37 +02:00
402845744f Cleanup: Strict compiler warning in remesher 2022-04-13 11:51:38 +02:00
25c357124d Cover some DNA files with C++ utility macros
Solves compilation warning with Clang, and moves manipulation with
DNA structures to the designed way for C++.

The tests and few other places are update to the new code by Jacques.

Ref T96847

Maniphest Tasks: T96847

Differential Revision: https://developer.blender.org/D14625
2022-04-13 11:48:12 +02:00
da66c0519f Fix (unreported) collections not being append-reusable.
Related to T97289, appending collections would never re-use already
appended one, since the flag was not set for this ID type...
2022-04-13 10:28:48 +02:00
a63982a65b Fix T97289: Linked collection assets disappear.
After appending, new link/append code would delete linked IDs, even if
those where pre-existing. Note that this would actually lead to invalid
memory access later in append code (ASAN crash).
2022-04-13 10:28:48 +02:00
4a70561bbd Fix T97164: Voxel remesh only supports vertex float
color attributes.

Voxel remesher now supports all color attribute
types.
2022-04-13 00:48:10 -07:00
e0c8d0913b Curves: remove Test1 brush
This was one of multiple placeholder brushes to simplify development.
Having it is not necessary anymore.

It was a brush that could add new curves according to a specific density.
This functionality will be brought back as a new brush later.

Ref T97255.
2022-04-13 09:27:54 +02:00
d1418dd151 Updated voxel remesher defaults
Implements T97163
Newly created meshes have all voxel remesher checkboxes aside from Fix Poles enabled.
Startup files updated with versioning.

Reviewed By @JulianKaspar
Differential Revision: https://developer.blender.org/D14608
Ref D14608
2022-04-12 23:33:36 -07:00
567aad9dcd Fix T97152: Selection tools do nothing in particle hair edit
Regression in [0] which caused canceled PRESS events not to generate
CLICK_DRAG.

Resolve by checking for an active brush tool in poll instead of the
PARTICLE_OT_brush_edit invoke function.

[0]: 4d0f846b93,
2022-04-13 16:27:21 +10:00
9a659f2573 WM: improve logging for handling operators
- Add logging for CLICK_DRAG event handling to debug drag events.
- Use logging API for reporting the key-map, operator and event.

This command now prints useful information for investigating
key-map and event handling issues:

  blender --log "wm.handler.*" --log-level 4
2022-04-13 16:10:32 +10:00
02de1bff1e Cleanup: warning for 'float' to 'int' with MSVC 2022-04-13 14:22:58 +10:00
7d3db7a3ae Cleanup: use C++ comments for disabled code
Also ensure space around text in C-comment blocks.
2022-04-13 13:47:04 +10:00
4b5195a9d7 Cleanup: clang-format 2022-04-13 13:45:42 +10:00
21ae323dbf Cleanup: avoid redundant float/int conversions in BLF
Internally many offsets for BLF were integers but exposed as floats,
since these are used in pixel-space, many callers were converging them
back to integers. Simplify logic by using ints.
2022-04-13 13:06:29 +10:00
ae43872ad5 BLF: sub-pixel positioning support
Support sub-pixel kerning and hinting for future support for improved
character placement. No user visible changes have been made.

- Calculate sub-pixel offsets, using integer maths.
- Use convenience functions to perform the conversions and hide the
  underlying values.
- Use `ft_pix` type to distinguish values that use sub-pixel integer
  values from freetype and values rounded to pixels.

This was originally based on D12999 by @harley with the user visible
changes removed so they can be applied separately.
2022-04-13 11:58:42 +10:00
d0a70adf8f Cleanup: shadowed variable warning 2022-04-13 11:57:45 +10:00
af17676005 gpy.types.GPUUniformBuf: support any object exposing buffer interface
Since uniform buffers are generally structs and not sequences,
`BPyGPU_BufferType` objects are not suitable for filling the buffer.
2022-04-12 22:44:57 -03:00
132576ebb1 gpu.types.Buffer: fill buffer interface with just what is requested
Use the `flags` parameter to avoid unnecessary allocations.
2022-04-12 22:34:52 -03:00
8fad71799f Fix size of MAT3 and MAT4 in GPUShaderCreateInfo.push_constant
It was being wrongly multiplied by 2.
2022-04-12 22:31:27 -03:00
17a19069db Fix cases where 'Py_buffer' might not be released 2022-04-12 22:16:09 -03:00
cd4a9c488f Fix possible pointer being freed without being allocated in pygpu module
The `clear` method can be called before dealloc, which can
mislead buffer ownership.
2022-04-12 20:52:50 -03:00
Germano Cavalcante
9bc678969a pyGPU: Port 'StageInterfaceInfo' and 'ShaderCreateInfo' types
In order to allow GLSL Cross Compilation across platforms, expose in
Python the `GPUShaderCreateInfo` strategy as detailed in
https://wiki.blender.org/wiki/EEVEE_%26_Viewport/GPU_Module/GLSL_Cross_Compilation

The new features can be listed as follows:
```
>>> gpu.types.GPUShaderCreateInfo.
                                  define(
                                  fragment_out(
                                  fragment_source(
                                  push_constant(
                                  sampler(
                                  typedef_source(
                                  uniform_buf(
                                  vertex_in(
                                  vertex_out(
                                  vertex_source(

>>> gpu.types.GPUStageInterfaceInfo.
                                    flat(
                                    name
                                    no_perspective(
                                    smooth(

>>> gpu.shader.create_from_info(
```

Reviewed By: fclem, campbellbarton

Differential Revision: https://developer.blender.org/D14497
2022-04-12 18:50:56 -03:00
359b6baf32 Fix: Assert when curve has no evaluated points
It is valid for NURBS curves to have no evaluated points in some cases.
2022-04-12 14:56:14 -05:00
b1d915d027 Cleanup: Remove reference to CD_NORMAL in poly custom data
Vertex and face normals are not stored in custom data anymore,
in both Mesh and DerivedMesh.
2022-04-12 13:55:41 -05:00
88ab34488b Cleanup: Correct wording in comments 2022-04-12 13:55:41 -05:00
Michael Jones
869a46df29 Cycles fp consistency for Apple Silicon CPUs
Propagate the fp settings from the main thread to all the worker threads (the fp settings includes the FZ settings among other things) - this guarantees consistency in execution of floating point math regardless if its executed in tbb thread arena or on main thread

Add FZ mode to arm64/aarch64 in parallel to the way its been done on intel processors, currently compiling for arm target does not set this mode at all, hence potentially runs slower and with possible results mismatch with intel x86.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14454
2022-04-12 19:43:47 +01:00
2d472b70e5 Revert "Cycles: enable HIP for Vega and Vega II (Radeon 7) GPUs on Windows"
This is not currently working, reverting until the driver/compiler has a fix.

This reverts commit c46e58817c.
2022-04-12 19:18:58 +02:00
a0957ceab2 Fix T97069: Null collection object during layercollection resync when relinking.
We better handle NULL object pointers before doing layer collections
resync, otherwise said resync process has to deal with those NULL
pointers. By the look of it this mistake has been there since the origin
of the remapping/relinking code.

Also for safety (and optimization), do not perform layer collection
resync from `libblock_remap_data_postprocess_object_update` when
`libblock_remap_data_postprocess_collection_update` is called
immediately afterwards.

Also added same 'skip on NULL collection object pointer' check to
`layer_collection_local_sync` as the one in
`layer_collection_objects_sync`, since it's fairly hard to always
guaranty there is no such NULL pointer when calling that code.
2022-04-12 18:43:26 +02:00
48014fbf14 Fix (unreported) use-after-free case in Properties Editor ID remapping code.
Regression in rBa21bca0e20a051, found while investigating T97069.
2022-04-12 18:43:26 +02:00
77db370cb6 Fix: BMesh Python API errors after vertex_normals addition
64cd927519 didn't update the argument parsing strings,
and updated the docstring of `from_object` incorrectly.

Fixes T97025, T97213
2022-04-12 11:08:21 -05:00
05a1770ab0 Fix T97280: Typo in tooltip of image texture node 2022-04-12 17:36:12 +02:00
ee9688da99 Cleanup: redundant logical not
Overlooked at rB0ebcc711f.

The logical not in this case was only applied to the left hand side of
the comparison.
2022-04-12 10:02:33 -03:00
d1944dee86 Cleanup: remove unused multi-function 2022-04-12 11:59:23 +02:00
5cae213750 Cleanup: pass vectors by reference
Passing them by value caused measurable overhead for me.
2022-04-12 11:56:02 +02:00
b4a2096415 Fix T95679: Outliner 'Unlink' directly on action misses DEG update
Animation would still play in the viewport.

There are two ways to unlink an action from the Outliner:
[1] `Unlink Action` on the Animation Data context menu.
This does `outliner_do_data_operation` / `unlinkact_animdata_fn` and has
the correct DEG update.
[2] `Unlink` on the Action context menu
This does `outliner_do_libdata_operation` / `unlink_action_fn` and was
missing the DEG update.

Now add the missing DEG update to the second case.

Maniphest Tasks: T95679

Differential Revision: https://developer.blender.org/D14089
2022-04-12 11:16:45 +02:00
4fd3d96f46 Fix Pushdown of an action from the Action Editor lacks immediate updates
The issue reported was that the recently introduced manual framerange of
an action (see rB5d59b38605d6) was not having an immediate effect in
case the action was pushed down from the Action Editor and only showed
its effects after e.g. saving and reloading the file. However doing the
same thing (pushing down the action) was working fine when done from the
NLA.

Now bring pushdown in sync (in terms of DEG update tagging) between the
Action Editor and the NLA, meaning that now both the owner and the
action are tagged when pushdown happens from the Action Editor as well.

Fixes T96964.

Maniphest Tasks: T96964

Differential Revision: https://developer.blender.org/D14564
2022-04-12 11:02:44 +02:00
fbca6aeb7c Fix T97132: Create a color attribute automatically
for color filter tool instead of canceling.
2022-04-11 23:25:56 -07:00
4a3bcfa102 Fix T97100: Fix ordering in color attribute list items
The new tab in the properties panel for "Color Attributes" shows the
data type and domain, just like the Attributes tab.
The issue is that the UI does not scale well and can only display the
full names when dragged to an extreme width.
This is due to the inclusion of the render icon in between the
attribute name and attribute type description.

This patch changes the order that items are displayed in the Color
Attributes Panel. Moving the render icon to the very right.
The result is consistent with other parts of the Blender UI and does
not take as much space to display the full text.

Reviewed By: @jbakker
Differential Revision: https://developer.blender.org/D14567
Ref D14567
2022-04-11 23:08:23 -07:00
d683ea4862 Fix T97098: Color filter sharpening artifacts.
Color filter sharpening now clamps the output.
The sharpening delta is now calculated from the
difference of two levels of vertex averaging instead
of one smooth iteration and the base color.

TODO: Sharpen in a different color space;
SRGB-linear has saturation artifacts.  I
tried HSL but it had value artifacts.  I'd
like to try LAB but we don't seem to have
conversion functions for it (at least as far
as I could see).
2022-04-11 22:54:32 -07:00
2451d7d57e Cleanup: use _NUM suffix for space/region type ranges
- Replace SPACE_TYPE_LAST with SPACE_TYPE_NUM (adding 1).
- Rename RGN_TYPE_LEN to RGN_TYPE_NUM

This makes it possible to tag space-type/region-type combinations
with `bool tag[SPACE_TYPE_NUM][RGN_TYPE_NUM]` which reads more clearly
than `bool tag[SPACE_TYPE_LAST + 1][RGN_TYPE_LEN]`.
2022-04-12 11:59:25 +10:00
6f1ad5f5e7 Fix wrong key type for GSet in Grease Pencil same material selection
The type of the key was changed from string to integer in 66da2f537a, but
the GSet was still being created for string keys.

As long as the integers stay small enough, this even kind of works on
little-endian systems, but of course it should use an integer hash instead.
2022-04-12 00:01:30 +02:00
3c62e539af Cleanup: clang-format 2022-04-11 23:49:37 +02:00
484a914647 UI: Add support for showing socket descriptions in tooltips
Currently, hovering over a socket itself shows no tooltip at all, while
hovering over its value field shows "Default value", which is not helpful.

This patch therefore implements socket tooltips following the proposal at
https://blender.community/c/rightclickselect/2Qgbbc/.

A lot of the basic functionality was already implemented for Geometry Nodes,
where hovering over the socket itself shows introspection info.

This patch extends this by:
- Supporting dynamic tooltips on labels, which is important for good tooltip
  coverage in a socket's region of the node.
- Adding a function to setting a dynamic tooltip for an entire uiLayout, which
  avoids needing to set it manually for a wide variety of socket types.
- Hiding the property label field in a tooltip when dynamic tooltip is also
  provided. If really needed, this label can be restored through the dynamic
  tooltip, but in all current cases the label is actually pointless anyways
  since the dynamic tooltip gives more accurate and specific information.
- Adding dynamic tooltips to a socket's UI layout row if it has a description
  configured, both in the Node Editor as well as in the Material Properties.

Note that the patch does not add any actual tooltip content yet, just the
infrastructure to show them. By default, sockets without a description still
show the old "Default value" tooltip.

For an example of how to add socket descriptions, check the Cylinder node
in the Geometry Nodes.

Differential Revision: https://developer.blender.org/D9967
2022-04-11 23:40:48 +02:00
Ethan-Hall
b3525c3487 UI: make snap self inactive if proportional editing
When using proportional editing, the 'project onto self' snap setting
is ignored since proportional editing does not allow snapping to
self. The UI should reflect this fact. This patch makes 'project onto
self' active only when proportional editing is off.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D14496
2022-04-11 17:32:24 -03:00
4aa9888854 PyGPU: make sure the UniformBuffer is padded to 16 bytes
Alignment with `vec4` is a requirement in C++, so it should be a
requirement in Python as well.
2022-04-11 16:59:18 -03:00
07cacb6d14 Fix crash when creating a 'gpu.types.Buffer'
Buffer creation may crash when passed a PyBuffer with no `shape` defined.
(Which is common for strucs).
2022-04-11 16:59:18 -03:00
Christophe Hery
c4f7f59c65 Curves: Add support for new curves type in Set Material node
Simply add the few lines so that the Cycles renderable New Curves
(with a small temporary patch to output the new type to render engines)
would get assigned a shader (in particular a hair shader).

Differential Revision: https://developer.blender.org/D14622
2022-04-11 14:52:20 -05:00
5f2317fa9b Update RNA to user manual references 2022-04-11 15:28:44 -04:00
c65b022e62 Fix OpenColorIO error with configs using <USE_DISPLAY_NAME>
* Don't assume the display colorspace name fully defines the transform
  to display space, this is not true in OpenColorIO 2 where view transforms
  may be defined in more complexs ways than just specifying a colorspace.
* In places where we need to store the display colorspace name, resolve
  <USE_DISPLAY_NAME> token manually.

Ref T96590
2022-04-11 20:10:42 +02:00
a99639792b Fix T97097: Color Filter saturates colors that have no saturation 2022-04-11 10:24:01 -07:00
7163db99c4 Fix T97096: Color filter brush was corrupting alpha. 2022-04-11 10:19:40 -07:00
4aac251b42 Fix adding certain nodes can cause python errors
Adding nodes via `NodeAddOperator` could fail if the node's poll fails
in `rna_NodeTree_node_new`. Examples are trying to add a RenderLayers
node or a Cryptomatte node to a nodegroup.

Now except the python error and use blender error reporting only instead
of throwing full python stacktraces at the user.

Differential Revision: https://developer.blender.org/D14584
2022-04-11 18:49:16 +02:00
e7a69b438f Cleanup: Clarify a few comments in pbvh_intern.h 2022-04-11 09:47:55 -07:00
0329145712 Cleanup: fix attribute.c incorrectly using
CustomDataLayer.type to check for
	 CD_FLAG_TEMPORARY instead of .flag.
2022-04-11 09:40:13 -07:00
0d0a45b89d Fix/workaround i18n script not finding some messages anymore.
For some reasons(c) some base classes (like `bpy.types.Modifier`) are
not listed anymore by a call to
`bpy.types.ID.__base__.__subclasses__()`, unless they are first accessed
explicitely (e.g. by executing `bpy.types.Modifier` etc.).
2022-04-11 15:45:52 +02:00
883dbfb72f Fix T85467: Mask transform center doesn't take parent Track into account
Coordinate checks in `spline_under_mouse_get` need to take place with
the evaluated mask to get the right center. This is now more in line to
how this is done in `ED_mask_point_find_nearest`.

Note: similar issues are reported with box/circle/lasso selection in
T97135, will tackle these separately though.

Maniphest Tasks: T85467

Differential Revision: https://developer.blender.org/D14598
2022-04-11 15:40:55 +02:00
20846596b5 Curves Sculpting Icons: Snake Hook and Grow updates
This implements the icon for snake hook, as well as tweak the
growth brush to make it bigger and with the triangles more
distinct for better reading of the icon.

Differential Revision: https://developer.blender.org/D14616
2022-04-11 15:11:43 +02:00
043555c78f install_deps: Tweak rBbc9c9631a46f, libwebp is not only a dependency from ffmpeg. 2022-04-11 14:52:26 +02:00
Charles Flèche
b6eb7dae59 Fix Cycles missing nullptr check in case mesh has no shader
Did not affect Blender, but could happen with other integrations.

Differential Revision: https://developer.blender.org/D14538
2022-04-11 14:24:59 +02:00
cda3334586 Fix setting key shortcuts for insert keyframe menu items
It was not possible to assign a shortcut to menu items in the insert
key-frame menu going back to version 2.7x. Doing so would replace the
current key that opens the insert keyframe menu (I-key by default),
instead of binding a key to insert a key-frame for the keying-set
referenced by the menu item.

Now each menu item can be bound to a key or added to the "Quick
Favorites" menu, directly inserting a key-frame for the corresponding
keying-set.

Note that users must use the operator `anim.keyframe_insert_by_name`
when setting up key-shortcuts as `anim.keyframe_insert` is only intended
to launch the menu.

Keymap Editor:

When editing these key-map items in the key-map editor, the keying-set
identifier must be used. At the moment the key-map editor doesn't
support showing a drop-down list. The identifiers can be used from the
tool-tip or the info editor.

{F12994924}

Details:

Use `ANIM_OT_keyframe_insert_by_name` instead of
`ANIM_OT_keyframe_insert_menu` for the insert keyframe popup menu to
resolve the following issues binding keys to keying sets:

- The index of the keying set isn't stable (adding/removing keying sets
  may change it).
- Binding a key to items in the popup menu triggers a popup instead of
  inserting a key using the keying set from the menu item.

While support for using the current operator could be improved, it will
still only work for built-in keying sets, so I'd prefer to use an
operator that is intended for key-bindings.

Besides supporting binding keys to menu items there are no functional
changes.

Reviewed By: sybren

Ref D14289
2022-04-11 21:10:05 +10:00
b2143da253 BMesh Python API: add access to vertex crease layer
This simply adds access to the vertex crease layer from Python
code. Documentation was modified to remove "Edge" as it is
shared between edges and vertices, similarly to bevel weights.

Differential Revision: https://developer.blender.org/D14605
2022-04-11 11:54:11 +02:00
e03810693c Cleanup: use doxy-comments and r_ prefix return arguments 2022-04-11 15:42:28 +10:00
5e47056e8d Cleanup: malformed C-style comment blocks, spelling
- Missing star prefix.
- Unnecessary indentation.
- Blank line after dot-points
  (otherwise doxygen merges with the previous dot-point).
- Use back-slash for doxygen commands.
- Correct spelling.
2022-04-11 12:03:09 +10:00
1c264ebdc0 Cleanup: quotes, line length 2022-04-11 11:40:58 +10:00
2e77a8f974 Render: Add operators to add all used or remove all unused lightgroups
These operators build a list of all lightgroups that are used by the view layer's
scene and either add all used lightgroups that are not part of the view layer yet
or remove all lightgroups in the view layer that are not being used.

Differential Revision: https://developer.blender.org/D14596
2022-04-10 18:45:16 +02:00
0b05e0b97e Fix T97159: AOV Pass in Cycles always gets Alpha Value of 1 for whole image
As far as I can see, it makes a lot of sense to have the alpha channel here, it matches the 2.x behavior and also matches what Eevee is doing.

Differential Revision: https://developer.blender.org/D14595
2022-04-10 18:43:57 +02:00
Viktoriia Safiullina
a4f970e86b UI: improve descriptions for camera lens and lens unit
Differential Revision: https://developer.blender.org/D14602
2022-04-10 16:31:11 +02:00
Martijn Versteegh
811371a6bd Fix T96942: disable Adjacent Faces margin for UVs and tangent space bake
Use the Extend method for these, as these do not work correctly. For UVs
it's better to extend the UVs from the same face, and for tangent space
the normals should be encoded in a matching tangent space.

Later the Adjacent Faces method might be improved to support these cases.

Ref T96977

Differential Revision: https://developer.blender.org/D14572
2022-04-10 16:31:11 +02:00
Simon Lenz
1db3e26c74 Mask: refactor mask_rasterize vector copying into a utility function
Add a separate scanline function scanfill_vert_add_v2_with_depth that
adds a vertex from 2D coordinate array & the specified z-value.

Ref D13460
2022-04-10 17:29:06 +10:00
8315e97754 Cleanup: missing-prototypes warning 2022-04-10 17:25:33 +10:00
881c566032 Cleanup compilation warnings.
Missing include statement.
2022-04-09 20:15:07 +02:00
749636bdb9 Missing forward declaration. 2022-04-09 20:10:44 +02:00
ceed37fc5c Curves: Port tangent and normal calculation to the new data-block
Port the "Normal" and "Curve Tangent" nodes to the new curves data-block
to avoid the conversion to `CurveEval`. This should make them faster by
avoiding all that copying, but otherwise nothing else has changed.

This also includes a fix to move the normal mode as a built-in curve
attribute when converting to and from `CurveEval`. The attribute is
needed because the option is used implicitly in many nodes currently.

Differential Revision: https://developer.blender.org/D14609
2022-04-09 12:46:30 -05:00
69a4d113e8 Fix T97133: Crash when creating a scene copy
Crash happened in sequencer editor, because pointer to displayed
channels was not set in `scene_copy_data`.
2022-04-09 18:16:21 +02:00
3f2d5dfc0d GPencil: Fix unreported error in Grab Brush for transformed layers
If the layer was transformed the grab brush was not initialized as expected because it was using an untrasformed matrix.
2022-04-09 16:39:35 +02:00
32da64c17e Fix T95276: Effect strip animation not updated when moving strips
Since effect strips can't be transformed directly, their selection had
to be forced in order to process them. This often failed in more
complicated scenarios, because there was no attempt to parse hierarchy
completely. In worst case only one effect in chain would be selected.
This code was marked by `XXX_DURIAN_ANIM_TX_HACK`.

Instead solution described above, a collection of strips that depend
on non effect strip position is built by function
`query_time_dependent_strips_strips` and it is stored in `TransSeq`.
In `flushTransSeq` this collection is iterated and transformation offset
is applied to effect strip animation. Strips in collection should be
consistent with true state of dependency and should be complete.

Functional changes:
- When 2-input effect strip changes position, animation is offset even
if only handles are moved. This only applies to 2-input effect however.
- Selection is not extended to include effect strips anymore. If effects
are to be moved, they must be selected manually. This is because
previously it was very hard to reorganize effects in chain, since moving
first strip in chain would always select anywhere from 1 to n effects.
So creating or filling gap in channel would almos always result in
collision especially if their order in timeline doesn't perfectly
represent their order in chain.
2022-04-09 16:29:40 +02:00
a3827d4b29 Fix: error in previous commit 2022-04-09 11:24:30 +02:00
Angus Stanton
a45976957e Curves: correctly initialize new attributes
Previously, the new attributes were zero-initialized. However, sometimes
the default has to be something else. The old behavior led to unexpected
behavior in the Snap Curves to Surface operator in Deform mode, when the
curves were not attached to the surface before.

Differential Revision: https://developer.blender.org/D14588
2022-04-09 10:51:07 +02:00
92c89d7b87 UDIM: Move UDIM grid controls to the Overlay panel
This change moves the grid panel UI from the View tab up into the
Overlay panel.

Reasons to move to the Overlay panel include:
 - Consistency with the grid options in the 3D viewport
 - The grid has been drawn as an Overlay for quite some time already

Additional changes that now make sense to have:
 - The grid responds to the main Overlay show/hide toggle
 - Adds a toggle to show/hide the grid which is consistent with overlays in general

As before, these grid controls are only available for active UV edit
sessions.

Differential Revision: https://developer.blender.org/D11862
2022-04-08 21:40:05 -07:00
502d16e667 Fix: Various fixes and cleanups in new curves code
- Use "curve" instead of "spline" in comments
- Use non-plural variable names
- Tag topology dirty after resolution modified rather than positions
- Reorder enum values to change which value is zero (and the default)
- Remove a duplicate unused variable
2022-04-08 17:50:00 -05:00
4f96190122 Fix: Build issue with MSVC
draw_common.h was included in a C++ file
leading to the linker looking for the
decorated name for `G_draw` which lead
to a linker error.

adding an extern "C" for C++ fixes
the issue.
2022-04-08 12:52:35 -06:00
eb40b231f9 Add a utility for sampling segment indices and factors from arbitrary
lengths along a set of points. This can be used for the sample curves
node, or finding new points along a curve when extending
or shrinking it.

This commit uses it in the snake hook brush as an example.

The logic is similar to the uniform length sampling, but the next
sample length is retrieved from the input instead of multiplication.

For the sample node in the future, though this sort of sampling can be
potentially done more efficiently for specific curve types besides
poly curves, it's simpler, at least as a start, to work on a set of
evaluated points that can be treated like a poly curve.

Differential Revision: https://developer.blender.org/D14571
2022-04-08 13:13:35 -05:00
bc9c9631a4 install_deps: only install codecs libs if building ffmpeg.
Avoid installing all the ogg, theora, xvid etc. codec lib dev packages
unless we actually build ffmpeg itself. Otherwise they are not necessary
for Blender build itself.
2022-04-08 18:58:55 +02:00
e15320568a Curves edit mode: show dots for points
This adds support to show dots for the curves points when in edit mode,
using a specific overlay.

This also adds `DRW_curves_batch_cache_create_requested` which for now
only creates the point buffer for the newly added `edit_points` batch.
In the future, this will also handle other edit mode overlays, and
probably also replace the current curves batch cache creation.

Maniphest Tasks: T95770

Differential Revision: https://developer.blender.org/D14262
2022-04-08 18:23:40 +02:00
3039b215ba GPencil: Fix unreported missing Sculpt popover menu
The menu with the options was not visible because the tool checked must be the sculpt, not draw.

This was broken in old version, but I cannot determine when or if never worked at expected.
2022-04-08 18:16:07 +02:00
d55a64a4fa install_deps: Add pystring and libwebp.
Re. {T95206}.
2022-04-08 18:12:20 +02:00
2c19d2eb2e Cleanup: quiet a couple more compilation warnings on MSVC 2022-04-08 18:06:09 +02:00
c0a9ec222f Alembic: fix clamping of frame offset during exports
The `frame_offset` used for creating `TimeSamplings` when exporting was
being clamped, which would make subframe sampling potentially fail, or
get out of sync.
2022-04-08 18:01:26 +02:00
f3a475a767 Cleanup: CacheFile, use double precision for time
Both the Alembic and USD libraries use double precision floating
point numbers internally to store time. However the Alembic I/O
code defaulted to floats even though Blender's Scene FPS, which is
generally used for look ups, is stored using a double type. Such
downcasts could lead to imprecise lookups, and would cause
compilation warnings (at least on MSVC).

This modifies the Alembic exporter and importer to make use of
doubles for the current scene time, and only downcasting to float
at the very last steps (e.g. for vertex interpolation). For the
importer, doubles are also used for computing interpolation weights,
as it is based on a time offset.

Although the USD code already used doubles internally, floats were used
at the C API level. Those were replaced as well.

Differential Revision: https://developer.blender.org/D13855
2022-04-08 17:57:35 +02:00
Jeroen Bakker
8b7cd1ed2a Painting: Canvas switcher for painting brushes/tools.
This patch adds color attributes to TexPaintSlot. This allows an easier selection
when painting color attributes.

Previously when selecting a paint tool the user had to start a stroke, before the
UI reflected the correct TexPaintSlot. Now when switching the slot the active
tool is checked and immediate the UI is drawn correctly.

In the future the canvas selector will also be used to select an image or image texture node
to paint on. Basic implementation has already been done inside this patch.

A limitation of this patch is that is isn't possible anymore to rename images directly from
the selection panel. This is currently allowed in master. But as CustomDataLayers
aren't ID fields and not owned by the material supporting this wouldn't be easy.

{F12953989}

In the future we should update the create slot operator to also include color attributes.
Sources could also be extended to use other areas of the object that use image textures
(particles, geom nodes, etc... ).

Reviewed By: brecht

Maniphest Tasks: T96709

Differential Revision: https://developer.blender.org/D14455
2022-04-08 16:42:50 +02:00
63d2980efa NLA: Remove Hold resetting between Hold_Forward Behavior
Avoid Blender overwriting artist's choices. The automatic change from
"Hold" (i.e. bidirectional extrapolation) to "Hold Forward" (i.e. only
extrapolate forward in time) has been removed.

This patch does not change strip evaluation. Between two strips, the
first with `None` extrapolation and the next with `Hold`, neither strip
will evaluate, which matches previous behavior. A future patch can
change the evaluation behavior.

Reviewed By: RiggingDojo, sybren

Maniphest Tasks: T82230

Differential Revision: https://developer.blender.org/D14230
2022-04-08 15:36:56 +02:00
f2455c7939 install_deps: Update OpenEXR to 3.1.4, Add Imath 3.1.4.
This has been... painful to get working.
2022-04-08 15:31:09 +02:00
9743f76582 Fix: accidentally swapped value with itself
Found in T96889.
2022-04-08 15:19:33 +02:00
db918ae9a4 install_deps: proper update of OpenVDB to 9.0.
Previous commit (rBrB59681a7ccdcf) was effectively doing nothing, due to
weird hacks we had to do with OpenVDB 8.0 to 'integrate' NanoVDB.

Now OpenVDB 9.0 natively includes NanoVDB, which allows us to greatly
simplify that part of the code in install_deps.
2022-04-08 14:51:01 +02:00
9439ac41eb I/O tests: change all_geometry scene to not have subd surface, and always print obj failure output diff details
The all_objects.blend test scene (in subversion tests repo) contained an
object with a subdivision surface. Which changes vertex positions
slightly, depending on used OpenSubDiv version and the compile flags. It
seems that the intent of the test was "test export of meshes that use
modifiers", so I changed that object to be a cube with a simple "taper"
modifier instead.

While at it, changed OBJ exporter test code to always print the
"expected and what we got" text difference details, when a test fails.
Much easier to see than just "the files are different" output. The code
to print that was behind an off by default flag for some reason.

This diff should get comitted together with updated all_objects templates
in subversion tests repo.

Reviewed By: Sebastian Parborg
Differential Revision: https://developer.blender.org/D14597
2022-04-08 15:09:22 +03:00
aa1e8bb9ab Fix T97150: Export GPencil to PDF or SVG crashes blender
The problem was the original file had some vertex  weight information, but the weights array was empty, so the duplication was not done and the free memory crashed.

To avoid this type of errors, now before duplicate weights the function checks the pointer and also the number of weights elements in the array to avoid the duplicatiopn of empty data.
2022-04-08 12:18:27 +02:00
aa46a67634 Fix lightgroup creation without a specified name 2022-04-08 11:51:31 +02:00
a410cea291 Fix prefix used for display OCIO shader
Didn't notice this to have real harmful behavior, but is still best
to do things properly.
2022-04-08 11:27:51 +02:00
30f9ebb644 Curves: expose convert to particle system operator in sculpt mode
Ref T96889.
2022-04-08 10:58:33 +02:00
ee292a1d66 PyAPI: use keyword only arguments for Text.region_{from/to} string
This is the convention for most parts of Blender Python API.
2022-04-08 13:28:55 +10:00
982aea88e0 Cleanup: separate format-units for Python argument parsing
With the increased use of multi-character format units and keyword-only
arguments these are increasingly difficult to make sense of.

Split the string onto multiple lines, one per argument.
While verbose it's easier to understand and add new arguments.
2022-04-08 11:49:50 +10:00
87a3bf3356 Cleanup: Define new curves normal mode in DNA
Don't include the tangent mode for now, since that
was never implemented for geometry nodes curves.
2022-04-07 18:10:29 -05:00
3214028ae8 Cycles: Support adding Lightgroups from the object/world properties
Currently, only Lightgroups that exist in the current view layer can be
selected from object or world properties.

The internal UI code already has support for search fields that accept
unknown input, so I just added that to the API and use it for lightgroups.

When a lightgroup is entered that does not exist in the current view layer
(e.g. because it's completely new, because the view layer was switched or
because it was deleted earlier), a new button next to it becomes active and
adds it to the view layer when pressed.

Differential Revision: https://developer.blender.org/D14540
2022-04-08 01:08:03 +02:00
5dd8551021 Fix T97144 Overlay: Illegal recursive expansion of macros
Was caused by the shaderCreateInfo port.
2022-04-07 22:51:31 +02:00
d197e272bb Fix Clang/Linux build error after line primitive parallelization 2022-04-07 20:36:15 +02:00
aaa5a80763 Fix Cycles build error after recent changes 2022-04-07 20:33:34 +02:00
0de0950ad5 Cycles: various Linux build fixes related to Hydra render delegate
* Add missing GLEW and hgiGL libraries for Hydra
* Fix wrong case sensitive include
* Fix link errors by adding external libs to static Hydra lib
* Work around weird Hydra link error with MAX_SAMPLES
* Use Embree by default for Hydra
* Sync external libs code with standalone
* Update version number to match Blender
* Remove unneeded CLEW/GLEW from test executable

None of this should affect Cycles in Blender.

Ref T96731
2022-04-07 19:52:53 +02:00
51a7e4b488 Cleanup: remove unused mface tesselation code from modifier stack
This seems to serve no purpose anymore, I don't see anywhere that
CD_MFACE is requested for modifier evaluation, and it's confusing
to have this in this final normals computation function.

Found while looking into D14579.

Differential Revision: https://developer.blender.org/D14580
2022-04-07 19:48:54 +02:00
be799749dc Fix T97035: crash transferring face corner data
The mechanism to instance meshes when there are no modifiers did not take
into account that modifiers might get re-evaluated from an operator that
requests loop normals. Now check for that case and no longer use the
instance then.

In the future, a better solution may be to compute loop normals on demand
as is already done for poly and vertex normals, but that would be a big
change.

Differential Revision: https://developer.blender.org/D14579
2022-04-07 19:48:54 +02:00
46c54b12b0 Cleanup: Return early in metaball tessellation code
Also declare variables where initialized and use const.
2022-04-07 12:34:06 -05:00
a5beca7ba0 BLI: inline fast path of IndexRange::as_span
This frequently showed up in profiling but shouldn't.

This also updates the code to use atomics for more correctness and
adds multi-threading for better performance.
2022-04-07 19:28:41 +02:00
67c42e7f03 Functions: optimize simple generated multi-functions
This implements two optimizations:
* Reduce virtual function call overhead when a non-standard virtual
  array is used as input.
* Use a lambda in `type_conversion.cc`.

In my test setup, which creates a float attribute filled with the index,
the running time drops from `4.0 ms` to `2.0 ms`.

Differential Revision: https://developer.blender.org/D14585
2022-04-07 18:48:29 +02:00
8f344b530a Geometry Nodes: Parallelize mesh line node
I observed a 4-5x performance improvement (from 50ms to 12ms)
with five million points, though obviously the change depends on
the hardware.

In the future we may want to disable the parallelization in
`parallel_invoke` when there is a small amount of points.

Differential Revision: https://developer.blender.org/D14590
2022-04-07 11:44:32 -05:00
Henrik Dick
f8c21937d2 GPencil: Add skip option to envelope modifier
This patch adds an option to only use every n-th segment of the
envelope result. This can be used to reduce the complexity of the
result.

Differential Revision: http://developer.blender.org/D14503
2022-04-07 17:41:49 +02:00
1a09024eac Cleanup: Compilation warning about virtual functions
Method which overrides a base class's virtual methods are expetced to
be marked with `override`. This also gives better idea to the developers
about what is going on.
2022-04-07 17:14:47 +02:00
9db15f502c Fix T97123: Applying modifier to multi-user: other objects were also converted
The first element of the iterator was not being tested against the flag.
So in some cases it would lead to more objects been made into
single-user than the active (or selected) ones.
2022-04-07 15:18:20 +02:00
8306f89c37 Cleanup: add clarifying comment to bpy_app_getsets
No functional changes.
2022-04-07 13:20:32 +02:00
434521a9e2 Curves: improve Add menu for new curves object
The goal is to make the Add menu more convenient for the new curves object.
The following changes are done:
* Add `curves` submenu.
* Add an `Empty Hair` operator that also sets the surface object.
* Rename the old operator to `Random`. It's mostly for testing at this point.

Differential Revision: https://developer.blender.org/D14556
2022-04-07 13:02:03 +02:00
50869b408b Curves: operator to snap curves to surface
This operator snaps the first point of every curve to the corresponding
surface object. The shape of individual curves or their orientation is
not changed.

There are two different attachment modes:
* `Nearest`: Move each curve so that the first point is on the closest
  point on the surface. This should be used when the topology of the
  surface mesh changed, but the shape generally stayed the same.
* `Deform`: Use the existing attachment information that is stored
  for curves to move curves to their new location when the surface
  mesh was deformed. This generally does not work when the
  topology changed.

The purpose of the operator is to help setup the "ground truth"
for how curves are attached to the surface. When the ground
truth surface changed, the original curves have to be updated
as well. Deforming curves based on an animated surface will be
done with geometry nodes independent of the operator.

In the UI, the operator is currently exposed in curves sculpt mode
in the `Curves > Snap Curves to Surface` menu.

Differential Revision: https://developer.blender.org/D14515
2022-04-07 12:50:15 +02:00
e5c7f37223 Cleanup: make CustomMF_* implementations more similar 2022-04-07 11:51:47 +02:00
6d1fbd249b Pose Library: avoid errors in the legacy panel when the add-on is disabled
Avoid errors in the legacy Pose Library panel (in Armature properties)
when the Pose Library add-on is disabled.

It's unfortunate that a built-in panel now has knowledge of an add-on.
Then again, it's temporary (one or two Blender releases), and it now uses
feature detection instead of just assuming the add-on is enabled.
2022-04-07 11:27:23 +02:00
951e43bee8 Pose Library: use the right icon for the "More Info" button 2022-04-07 11:27:23 +02:00
7b7c78c4dc Cleanup: remove incorrect comment
No functional changes.
2022-04-07 11:27:23 +02:00
1d18c0682f Fix T96888: data transfer operator crash in certain situation
The operator could crash in case the context "object" was overridden
from python, but the "active_object" wasnt (and the active object was
not a mesh).

Reason for the crash is a mismatch in the operators poll function
`data_transfer_poll` vs. `dt_layers_select_src_itemf` -- in the former,
the overriden "object" was respected (and if this was a mesh, the poll
was permissive), in the later it wasnt and only the "active_object" was
used (if this was not a mesh, a crash would happen trying to get an
evaluated mesh).

Now rectify how the object which is used is being fetched -> use
`ED_object_active_context` everywhere (see also rBe560bbe1d584).

Maniphest Tasks: T96888

Differential Revision: https://developer.blender.org/D14552
2022-04-07 10:52:20 +02:00
384a02a214 BLI: add missing materialize methods for virtual arrays
This does two things:
* Introduce new `materialize_compressed` methods. Those are used
  when the dst array should not have any gaps.
* Add materialize methods in various classes where they were missing
  (and therefore caused overhead, because slower fallbacks had to be used).
2022-04-07 10:02:34 +02:00
2aff04917f Functions: parallelize materializing arrays after field evaluation
This improves performance e.g. when creating an integer attribute
based on an index field. For 4 million vertices, I measured a speedup
from 3.5 ms to 1.2 ms.
2022-04-07 09:48:07 +02:00
fd5e5dac89 Geometry Nodes: avoid data copy in store named attribute node 2022-04-07 09:40:37 +02:00
120a17a45a BLI: add CPPType utility to copy elements to a shorter array 2022-04-07 09:34:07 +02:00
e2f4c4db8d Cleanup: pass the buffer length into txt_insert_buf
Also remove redundant NULL check.
2022-04-07 15:45:20 +10:00
Matheus Santos
f49a736ff4 Text Editor: Get/Set region text API
Add the ability to get/set the selected text.

**Calling the new methods:**

- `bpy.data.texts["Text"].region_as_string()`
- `bpy.data.texts["Text"].region_from_string("Replacement")`
2022-04-07 15:17:04 +10:00
7cd6bda206 Cleanup: spelling in comments, minor reformatting changes 2022-04-07 14:48:20 +10:00
792a481bee Cleanup: clang-format 2022-04-07 14:34:51 +10:00
Aleksi Juvani
81ec3dce65 Geometry Nodes: Add "Connected" mode to Merge by Distance node
Expose the "Connected" mode from the weld modifier in the
"Merge by Distance" geometry node. This method only merges
vertices along existing edges, but it can be much faster
because it doesn't have to build a KD Tree of all selected
points.

Differential Revision: https://developer.blender.org/D14321
2022-04-06 17:30:56 -05:00
Yevgeny Makarov
181d577d7d Fix T86200: Properties editor rearranges columns poorly when very wide
Use a regular property split layout instead of a grid flow.
Also fix part of T65393.

Differential Revision: https://developer.blender.org/D13558
2022-04-06 17:08:23 -05:00
Ujwal Kundur
f16033c0f5 Fix T91541: Naming of Freestyle Curvature 3D modifier
Change the modifier name in the modifier stack to "Curvature 3D"
to be consistent with the modifier name in the drop-down.

Differential Revision: https://developer.blender.org/D14476
2022-04-06 17:05:33 -05:00
Pratik Borhade
77ae30517f Fix: UI alignment in knife tool settings popover
Remove the extra space given for decorators on right of the popover.

Differential Revision: https://developer.blender.org/D14518
2022-04-06 17:01:07 -05:00
Aleksi Juvani
236643606e Fix: Division by zero in UV packing function
If all islands had a size of zero, a division by zero would occur in
`GEO_uv_parametrizer_pack`, causing the UV coordinates to be set to
NaN. An alternative approach would be to skip packing islands with a
zero size, but If UV coordinates are for example outside the 0-1 range,
it's better if they get moved into that range.

Differential Revision: https://developer.blender.org/D14522
2022-04-06 16:58:59 -05:00
Mattias Fredriksson
52af51708f Fix: Copy resolution when creating CurveEval from Curves
Set the curve resolution to Bezier and Nurbs curves when converting
data using `curves_to_curve_eval`. This was missed in 9ec12c26f1.

Differential Revision: https://developer.blender.org/D14577
2022-04-06 16:54:22 -05:00
Mattias Fredriksson
c9f485195b Cleanup: Incorrect comment in IndexRange header 2022-04-06 16:53:58 -05:00
8551e89068 Curves: Name mutable data retrieval functions explicitly
Add "for_write" on function names that retrieve mutable data arrays.
Though this makes function names longer, it's likely worth it because
it allows more easily using the const functions in a non-const context,
and reduces cases of mistakenly retrieving with edit access.

In the long term, this situation might change more if we implement
attributes storage that is accessible directly on `CurvesGeometry`
without duplicating the attribute API on geometry components,
which is currently the rough plan.

Differential Revision: https://developer.blender.org/D14562
2022-04-06 16:30:27 -05:00
8b04308953 Curves: Hair to Curves rename in Cycles/EEVEE UI
Change uses of "Hair" in Render Settings UI in the property editor
and the "Hair Info" node to use the "Curves" name to reflect the
design described in T95355, where hair is just a use case of a more
general curves data type.

While these settings still affect the particle hair system,
the idea is that if we have to choose one naming scheme to align
with, we should choose the option that aligns with future plans
and current development efforts, especially since the particle
system is considered a legacy feature.

A few notes:
- "Principled Hair BSDF" is not affected since it's meant for hair.
- Python API property identifiers are not affected.

Differential Revision: https://developer.blender.org/D14573
2022-04-06 16:20:38 -05:00
74db0f3d5f Fix: Curve parameter node broken for Bezier curves after refactor
The last length value was not initialized, and all length values were
moved one position towards the front of each curve incorrectly.
Also fix an assert when a curve only had a single point.
2022-04-06 16:13:06 -05:00
eb470bfbfe BVH Utils: use fall-through in 'BKE_bvhtree_from_mesh_get'
This deduplicates the code a bit.
2022-04-06 17:36:56 -03:00
99b82116ef Cleanup: remove workaround to set treedata members
This workaround is not needed since
228f7f1c85
2022-04-06 16:37:47 -03:00
howetuft
fcf06d2ad7 Fix standalone image output not working when not running in background mode
Differential Revision: https://developer.blender.org/D14471
2022-04-06 21:30:10 +02:00
howetuft
013d0631e6 Add CMake option to control CUDA host compiler
This revision allows to specify CUDA host compiler (nvcc's -ccbin command
line option) when configuring the build. It addresses the case where the
C/C++ compiler to be used in CUDA toolchain should be different from the
default C/C++ compiler, for instance in case of compilers versions conflicts
or multiple installed compilers.

The new CMake option is named `CUDA_HOST_COMPILER` and can be used as follows:
`cmake -DCUDA_HOST_COMPILER=<path-to-host-compiler>`

If the option is not specified, the build configuration behaves as previously.

Differential Revision: https://developer.blender.org/D14248
2022-04-06 21:30:07 +02:00
6aaae44473 Fix: Missing virtual destructor on virtual class
This caused an ASAN report for new/delete type mismatch
when using the snake hook brush in curves sculpt mode.
2022-04-06 11:42:52 -05:00
d8a9bcea6c Fix F-Curve visibility toggle disabled for library overridden rig
When showing an action data-block added to a library overridden object
in the Graph Editor, the visibility toggles would be disabled.
Toggling the visibility should be possible still and works with the
shortcuts, just the button was incorrectly disabled.

Also added the usual disabled hint for the tooltip.

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

Reviewed by: Bastien Montagne
2022-04-06 18:30:51 +02:00
c14ed182f5 Fix T96595: Animation not duplicated for meta children
Iterate over meta strip content and duplicate animation for all strips.
recursively.
2022-04-06 15:12:16 +02:00
Bastien Montagne
1ec93507e1 API doc: Tweak sphinx to get date of source commit instead of build date.
This commit disables the 'last updated' value (which is the date the
sphinx doc is generated), and instead modifies the 'commit' field from
the 'html_context' data to get:
  - a link to the commit itself.
  - the date of that commit.

This avoids having the whole documentation detected as changed every
time it is re-generated by the buildbot.

Reviewed By: dfelinto, campbellbarton

Differential Revision: https://developer.blender.org/D14429
2022-04-06 11:43:14 +02:00
Bastien Montagne
e06399c223 Fix badly broken caches handling during undo/redo.
Original rework of caches during undo/redo (see D8183) had a very bad
flaw hidden in it: using the key of a ghash as source of data.

While this was effectively working then (cache pointer itself being part
of the key, and said cache pointers not being cleared on file write),
this is a general very bad way to do things.

Now that cache pointers are more and more cleared on file write (as part
of clearing runtime-data to reduce false-positives when checking if an
ID has changed or not), this has to be fixed properly by:
* Not storing the cache pointer itself in the IDCacheKey.
* In undo context, in readfile code trying to preserve caches, store the
  cache pointers as values of the mapping, together with the usages counter

The first change potentially affects all usages of
`BKE_idtype_id_foreach_cache`, but in practice this code is only used by
memfile reading code (i.e. undo) currently.

Related to T97015.

Reviewed By: brecht

Maniphest Tasks: T97015

Differential Revision: https://developer.blender.org/D14559
2022-04-06 11:37:15 +02:00
8dd3387eb7 Cleanup: spelling & poor wording in code & comments 2022-04-06 19:08:10 +10:00
2d2baeaf04 Fix: T78228 Send all python errors to info editor
Python exceptions are now shown in the info editor,
this also resolves an old bug where errors were printed twice.

This was originally based on D9752 by @ShadowChaser although many
changes have been made from the original patch.

Details:

- BPy_errors_to_report no longer prints additional output.
- BKE_report_print_test was added so it's possible to check if calling
  BKE_report also printed to the stdout.
- Callers to BPy_errors_to_report are responsible for ensuring output
  is printed to the stdout/stderr.
- Python exceptions no longer add a trailing newline,
  needed to avoid blank-space when displayed in the info-editor.
2022-04-06 18:02:58 +10:00
e4f71e5ef3 Fix off by one error placing the text cursor from a Python exception
Off by one error placing text from an error.
2022-04-06 13:14:21 +10:00
2e9e2715ef Cleanup: use context.path_resolve instead of eval(..) 2022-04-06 11:48:56 +10:00
7bb8eeb3a8 PyAPI: Add Context.path_resolve wrapper that supports context members
This avoids script authors using `eval("context.%s" % data_path)`
to access paths starting from the context,
which isn't good practice especially if the data_path isn't trusted.

Now it's possible to resplve paths such as:

   context.path_resolve('active_object.modifiers[0].name')
2022-04-06 11:48:51 +10:00
5d31252c76 Fix accessing an empty context succeeding when it shouldn't
Internally an empty string is used to access context member `__dir__`,
which caused `getattr(context, "")` to succeed returning None.
2022-04-06 11:47:43 +10:00
f208713b02 UI: use a faster method of finding colliding layer names
Access the keys of the collection instead of the layers names
and use a set to detect collisions. There is no need to access the
duplicate layers themselves. Roughly twice as fast.
2022-04-06 11:42:44 +10:00
8bd28ef16c Doxygen: update doxyfile to 1.9.3
Resolves deprecation warnings.
2022-04-06 11:42:42 +10:00
11b0824d89 Cleanup: line wrapping, remove unused args, variables in UI scripts 2022-04-06 09:40:14 +10:00
a776385b26 Cleanup: zero initialize VColRef before setting members
Ensures new members will be zeroed, the compiler is able to optimize
this into identical compiled output.
2022-04-06 09:40:13 +10:00
20bb859d9b Cleanup: quiet compiler warnings
Ideally this wouldn't be needed, I couldn't find a good solution
to avoid casting when comparing const/non-const pointers in this case.
2022-04-06 09:40:11 +10:00
931ae424b9 BVH Utils: remove 'isolate' parameter
This is an internal usage parameter.

No functional changes.
2022-04-05 20:33:06 -03:00
9fbf7f1180 BVH Utils: Remove '_allocated' members from 'BVHTreeFromMesh'
The parameters indicating whether it is allocated are always `false` and
it is up to the caller to free them.

Also clang-format was triggered.
2022-04-05 19:56:03 -03:00
Germano Cavalcante
684b95804e Refactor: remove cache parameters from bvhtree_from_ functions
The `BVHCacheType bvh_cache_type` parameter defines specific
`BVHTrees` that cannot be customized.

So it doesn't make sense to pass this value to any
`*bvhtree_from_[...]_ex` function as the `BVHTrees` created in these
cases are custom and cannot be saved in the cache.

This also resulted in a nice cleanup in the code.

Differential Revision: https://developer.blender.org/D14479
2022-04-05 19:32:56 -03:00
bb7e3c2b56 Cleanup: Simplify if statements, clang tidy 2022-04-05 16:40:44 -05:00
228f7f1c85 Refactor: Deduplicate and simplify BVH Utils code
In summary the changes are:
- Merge all `bvhtree_from_mesh_*.*_setup_data` in a single utility
- Create `bvhtree_from_editmesh_setup_data`
- Setup data only once in `BKE_bvhtree_from_mesh_get` and `BKE_bvhtree_from_editmesh_get`

Also the behavior of `BKE_bvhtree_from_mesh_get` and
`BKE_bvhtree_from_editmesh_get` changed a bit:
- If a null tree is cached, don't set the `data` to zero. This tree is not an error and the others data can still be used.
- If a null tree is returned, don't set the `data` to zero. Matches the previous change.

Differential Revision: https://developer.blender.org/D14549
2022-04-05 18:14:22 -03:00
7a5e663843 Fix: Pass const arguments to object snapping 2022-04-05 16:13:55 -05:00
7455bb85cc GPencil: Fix buiding with GTEST 2022-04-05 22:53:10 +02:00
5f1adfc508 Cleanup: fix various typos
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D14443
2022-04-05 22:21:13 +02:00
0d43ff43a4 Fix T96904: texture paint sample tool not working with closest interpolation
For drawing pixel art. Based on patch by Philipp Oeser.
2022-04-05 21:32:03 +02:00
eae36be372 Refactor: Unify vertex and sculpt colors into new
color attribute system.

This commit removes sculpt colors from experimental
status and unifies it with vertex colors. It
introduces the concept of "color attributes", which
are any attributes that represents colors.  Color
attributes can be represented with byte or floating-point
numbers and can be stored in either vertices or
face corners.

Color attributes share a common namespace
(so you can no longer have a floating-point
sculpt color attribute and a byte vertex color
attribute with the same name).

Note: this commit does not include vertex paint mode,
      which is a separate patch, see:
      https://developer.blender.org/D14179

Differential Revision: https://developer.blender.org/D12587
Ref D12587
2022-04-05 11:42:55 -07:00
a3e122b9ae Curves: fix missing updates switching to sculpt mode
This would cause the viewport to draw stale data until a stroke
is done.
2022-04-05 20:00:31 +02:00
fc8bcd26c0 Curves: fix edit mode detection
This adds missing cases to detect edit mode for Curves objects.
Unlike other object types, Curves do not have specific edit data,
rather we edit the original data directly, and rely on `Object.mode`.

For this, `BKE_object_data_is_in_editmode` had to be modified to
take a pointer to the object. This affects two places: the outliner
and the dependency graph. For the former place, the object pointer
is readily available, and we can use it. For the latter, the object
pointer is not available, however since it is used to update edit
mode pointers, and since Curves do not have such data, we can
safely pass null to the function here.

This also fixes the assertion failure that happens when closing a file
in edit mode.

Differential Revision: https://developer.blender.org/D14330
2022-04-05 19:59:20 +02:00
4de704a6df Overlay: Fix edit mode shader compilation after recent commit
This was caused by rBd889762590a4f068aa312879976e98dbd0ee93fc
2022-04-05 18:56:31 +02:00
b84255f590 Curves: Port legacy curve viewport drawing to the new data-block
Instead of using `CurveEval` to draw the curve wire edges, use
the new `Curves` data-block, which is already built as part of
an object's evaluated geometry set whenever there is a
`CurveComponent`.

This means that we can remove `Curve`'s temporary ownership
of `CurveEval` for drawing (added in 9ec12c26f1),
which caused a memory leak as described in T96498.

In my testing this improved performance by around 1.5x during
viewport playback, back to the performance of 3.1 before the
curve data structure transition started.

The next step of using the GPU to do the final curve evaluation
for the viewport is described in T96455, but is unrelated.

Differential Revision: https://developer.blender.org/D14551
2022-04-05 11:36:12 -05:00
edcbf741df Refactor: Evaluate surface objects as mesh components
This commit furthers some of the changes that were started in
rBb9febb54a492 and subsequent commits by changing the way surface
objects are presented to render engines and other users of evaluated
objects in the same way. Instead of presenting evaluated surface objects
as an `OB_SURF` object with an evaluated mesh, `OB_SURF` objects
can now have an evaluated geometry set, which uses the same system
as other object types to deal with multi-type evaluated data.

This clarification makes it more obvious that lots of code that dealt
with the `DispList` type isn't used. It wasn't before either, now it's
just *by design*. Over 1100 lines can be removed. The legacy curve
draw cache code is much simpler now too. The idea behind the further
removal of `DispList` is that it's better to focus optimization efforts
on a single mesh data structure.

One expected functional change is that the evaluated mesh from surface
objects can now be used in geometry nodes with the object info node.

Cycles and the OBJ IO tests had to be tweaked to avoid using evaluated
surface objects instead of the newly exposed mesh objects.

Differential Revision: https://developer.blender.org/D14550
2022-04-05 11:31:18 -05:00
e513687288 Cycles: Fix a few type casting warnings
Stumbled over the `integrate_surface_volume_only_bounce` kernel
function not returning the right type. The others too showed up as
warnings when building Cycles as a standalone which didn't have
those warnings disabled.

Differential Revision: https://developer.blender.org/D14558
2022-04-05 18:09:21 +02:00
f60cffad38 Cycles: Use USD dependencies when building Hydra render delegate
Adds support for linking with some of the dependencies of a USD
build instead of the precompiled libraries from Blender, specifically
OpenSubdiv, OpenVDB and TBB. Other dependencies keep using the
precompiled libraries from Blender, since they are linked statically
anyway so it does't matter as much. Plus they have interdependencies
that are difficult to resolve when only using selected libraries from
the USD build and can't simply assume that USD was built with all
of them.

This patch also makes building the Hydra render delegate via the
standalone repository work and fixes various small issues I ran into
in general on Windows (e.g. the use of both fixed paths and
`find_package` did not seem to work correctly). Building both the
standalone Cycles application and the Hydra render delegate at the
same time is supported now as well (the paths in the USD plugin JSON
file are updated accordingly).

All that needs to be done now to build is to specify a `PXR_ROOT`
or `USD_ROOT` CMake variable pointing to the USD installation,
everything else is taken care of automatically (CMake targets are
loaded from the `pxrTargets.cmake` of USD and linked into the
render delegate and OpenSubdiv, OpenVDB and TBB are replaced
with those from USD when they exist).

Differential Revision: https://developer.blender.org/D14523
2022-04-05 17:23:52 +02:00
190334b47d Curves: new Grow/Shrink brush
This adds a new Grow/Shrink brush which is similar to the Length
brush in the old hair system.
* It's possible to switch between growing and shrinking by hold
  down ctrl and/or by changing the direction enum.
* 3d brush is supported.
* Different brush falloffs are supported.
* Supports scaling curves uniformly or shrinking/extrapolating
  them. Extrapolation is linear only in this patch.
* A minimum length settings helps to avoid creating zero-sized curves.

Differential Revision: https://developer.blender.org/D14474
2022-04-05 15:24:12 +02:00
e40b0d52cf Preferences: enable Duplicate Data for curves and point cloud objects
Those geometry types are expected to behave the same as e.g. mesh
with respect to data copying. The fact that this was not enabled
already was an oversight in the initial commit that added these types.

Differential Revision: https://developer.blender.org/D14554
2022-04-05 15:19:43 +02:00
fc848e9440 Fix T97010 GPencil: Artifacts on Grease Pencil
Was caused by wrong name for uniform update.

Regression introduced in rBeccb0b222e34
2022-04-05 15:08:05 +02:00
d5550c7b2c Fix T97071: Duplicating strip in locked channel creates overlapping strips
Add flag `SEQ_IGNORE_CHANNEL_LOCK` to indicate, that channel lock
should not apply to strip. This flag must be cleared after
transformation.
2022-04-05 14:56:50 +02:00
d889762590 Cleanup: Change globalBlock members to snake case
This avoid conflicting defines in GLSL

Fix T96998 Blender 3.2.0 Alpha crashes on startup
2022-04-05 14:36:53 +02:00
c8d658c5ed Cleanup: Overlays: Remove unused facefill shader 2022-04-05 14:35:36 +02:00
328dfab423 Fix T97003: color-management settings can't be animated
Regression in [0] which missed excluding FRAME_CHANGE from
deg_recalc_flags_for_legacy_zero causing all
DEG_id_tag_update(&scene->id, 0) calls to re-calculate animation data.

When this tagging was done in the RNA update function, changing
key-framed values in the UI would be immediate reset to their
keyed-values.

Thanks to Philipp Oeser for finding the root cause.

[0]: 35aedd87e7
2022-04-05 21:04:46 +10:00
Pratik Borhade
f87029f7b1 Fix T96424: Don't register undo step for empty knife cut
Prevents undo push when no cut has been made.

Reviewed By: campbellbarton

Ref D14329
2022-04-05 20:55:10 +10:00
Pratik Borhade
d00de988c3 WM: avoid unnecessary undo step creation when duplicating
Calling duplicate operation without selecting anything registers an undo
step. If nothing is selected (keyframe, curve, object, etc.), cancel the
operator execution to prevent undo push.

Patch improves following operators:

- ACTION_OT_duplicate
- GPENCIL_OT_duplicate
- GRAPH_OT_duplicate
- MESH_OT_duplicate
- NODE_OT_duplicate
- OBJECT_OT_duplicate

Reviewed By: campbellbarton

Ref D14511
2022-04-05 20:30:00 +10:00
d88b821d28 Fix: wrong operator return value 2022-04-05 12:04:47 +02:00
Alaska
850b887339 Fix T96745: UI: Change "Inverts" to "Invert" for selection tool
This is to improve grammatical consistency with other selection options.

Maniphest Tasks: T96745

Differential Revision: https://developer.blender.org/D14444
2022-04-05 09:24:27 +02:00
Yann Lanthony
7cf3e713f7 Gizmos: enable gizmos for the action space
Support gizmos for the the action space type based on how it is done for
other types of spaces in Blender (e.g: view3d, image).

See patch submission for sample code.

Reviewed By: campbellbarton, sybren

Ref D13999
2022-04-05 17:14:40 +10:00
c1d461bcbc Cleanup: avoid unnecessary undo steps for curves & simplify code
Some edit-curve operators used an 'ok' variable to represent
if the selection was found and if a change was made.

Previously it would only return cancel if an error was shown
causing a redundant undo step to be added without a selection.

Since this is simple behavior that shouldn't need much explanation,
use two variables with meaningful names to avoid confusion.

Reviewing D14511 highlighted this issue.
2022-04-05 13:15:57 +10:00
8333b681a7 Keymap: use "use_tweak_select_passthrough" preference for tweak tool
This experimental preference was not making much difference with
selection set to left-mouse for the 3D view and UV editor. Now dragging
the existing selection is possible when this preference is enabled.
2022-04-05 12:29:34 +10:00
53261df6f0 Fix keymap "use_tweak_tool_lmb_interaction" blocking sequencer scrub
Ignore this experimental preference for the sequencer.
2022-04-05 12:29:32 +10:00
0f530b0b03 Fix T96885: drag fallback on tweak is using active tool instead
Ensure the fallback transforms on drag when used as a fallback.
2022-04-05 12:29:31 +10:00
f2b9bbd194 Fix T97032: Tweak Select preference causes selection issues
Disable select-passthrough on release events.
2022-04-05 12:29:29 +10:00
d5f5788b10 Keymap: remove reference to missing view2d_edge_pan property
This was added [0] but the property is missing in the operator.

[0]: e49fef45ce
2022-04-05 10:24:32 +10:00
1d86d61782 Fix: Assert fails when evaluating single point Bezier curve
Return early when there is only one point,
since that means there are no segments.
2022-04-04 18:42:01 -05:00
43a582a2ab Sequencer: skip redundant F-curve GSet allocation 2022-04-05 09:30:26 +10:00
25a283acce Fix memory leak duplicating sequencer strips
Regression in [0] also skip creating a GSet when there are no F-curves.

[0]: e74420124f
2022-04-05 09:23:14 +10:00
11183ebc3c Fix T97034: tweak strips uses cursor position after threshold reached 2022-04-05 09:11:51 +10:00
e994b72812 UI: move "use_select_nearest_on_first_click" into it's own panel
Add a new panel called "Tweaks" so we can get feedback from users
about minor tweaks to behavior as exposing these minor changes.

Currently this only has a single item in it, however we may want to
get feedback from users about small changes in the future so I'd
prefer to have a place to list these kinds of options.

Ref D14542
2022-04-05 08:51:36 +10:00
521fab080b Cleanup: use doxygen links to struct members 2022-04-05 08:02:01 +10:00
b51d6d5068 Cleanup: clang-format
Also add space below file references.
2022-04-05 08:01:46 +10:00
744369c114 Cleanup: move doc-strings into headers
- The comment for create_normals was moved into an inline note
  as it's not related to the public API.
- Use a colon after parameters.

Ref T92709
2022-04-05 07:49:36 +10:00
22184f3aee Cleanup: spelling in comments 2022-04-05 07:39:40 +10:00
5eab5713c0 Fix T97019: Regression - GPencil Shrinkwrap modifier not longer working
Bug introduced in the smooth function changes done in commit rBd4e1458db3a0e0eaf80219dc8e6d10cb27620793

Differential Revision: https://developer.blender.org/D14548
2022-04-04 22:33:20 +02:00
Germano Cavalcante
0ebcc711fc Fix T95678: Thumbnails are not working with big / large Objects
The internal camera used to render the thumbnails also has to consider
`clip_start` and `clip_end`.

Reviewed By: Severin

Maniphest Tasks: T95678

Differential Revision: https://developer.blender.org/D14138
2022-04-04 16:20:34 -03:00
b5f3f8ef1d Fix collection assets hidden in old files with asset browser open
Make sure the filtering in the Asset Browser doesn't filter out
collection assets.
2022-04-04 17:54:39 +02:00
9eb4cb956b Cleanup: Remove unused function
Unused after 943b919fe8
2022-04-04 10:28:10 -05:00
432ad4c632 Cleanup: Move interface.c to C++
This is similar to 4537eb0c3b
2022-04-04 10:24:14 -05:00
9c962b2e2b Fix T96999: RNA mesh transform does not mark normals dirty 2022-04-04 09:59:45 -05:00
aa1ae1d3c8 Fix overlapping GPU device bitmasks
This did not end up affecting actual behavior, but it is wrong.
Found by Ethan Hall.

Ref D14525
2022-04-04 16:38:30 +02:00
d6f5b02940 OBJ: fix printf specifier compile warning on some compilers 2022-04-04 17:37:13 +03:00
e4289f2360 Fix errors in sequencer channel headers
Failing constraint test uncovered crashes on NULL dereference and
missing channels initialization in `SEQ_editing_ensure()`.
2022-04-04 16:30:16 +02:00
e7f4aa8f0c Fix T96838: Missing translations in link drag search 2022-04-04 08:46:53 -05:00
81b55d7988 Pose library: add deprecation notices
The legacy Pose Library operators now refer to the "Legacy Pose Library",
and their description mentions they are deprecated and will be removed
from Blender 3.3. The same was added to the `Object.pose_library` RNA
property.

Ref: T93405

The removal of these deprecated properties is tracked in T93406.
2022-04-04 15:26:02 +02:00
a824c076b7 Pose library: remove much of old pose library interface
Remove much of the old legacy pose library:
- Remove from the Pose & Armature menus.
- Remove from the default keymap.
- Pose Library panel in Armature properties: Add "(legacy)" to title.
- Add note that the functionality of that panel is obsolete, with a
  button that opens the manual on the chapter of the new pose library.
- Add button to convert the selected legacy pose library to pose assets.
- The rest of the functionality is greyed out to further communicate
  it's been deprecated. It's still functional, though.

Ref: T93405
2022-04-04 14:43:17 +02:00
068d2b0861 Fix T96575: Can't set vertex theme color
UV editor used wire color for drawing unselected vertices.
Add color variable to shader, so theme color can be used.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D14373
2022-04-04 14:28:55 +02:00
e49fef45ce VSE: Use edge panning
Add edge panning feature to transform operator. It works in same way as
in node editor, but Y axis is limited by usable range up to 128
channels.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D14310
2022-04-04 14:28:55 +02:00
3ce6c5adfc UserDef: Add experimental flag for 3d texturing brush.
This only adds a experimental flag to enable the 3d texturing brush,
so future developments could check. Currently the flag does nothing
as no functionality of the 3d texturing brush has been implemented.
2022-04-04 14:12:33 +02:00
a818a0f427 BlenLib: Add ushort2 to math vec types.
Needed for the 3d texturing brush project.
2022-04-04 14:12:33 +02:00
9c2b5900c0 Move ImageTileWrapper to BKE.
ImageTileWrapper is a wrapper around ImageTile to centralize tile calculations when
using CPP. Currentry used by the image engine and will be used for the 3d
texturing brush project.
2022-04-04 14:12:33 +02:00
a56f53ad56 OBJ: fix mac/linux tests and compile warnings in the new obj importer
Related to D13958
2022-04-04 14:58:45 +03:00
277fa2f441 VSE: Add channel headers
This patch adds channel region to VSE timeline area for drawing channel
headers. It is synchronizedwith timeline region. 3 basic features are
implemented - channel visibility, locking and name.

Channel data is stored in `SeqTimelineChannel` which can be top-level
owned by `Editing`, or it is owned by meta strip to support nesting.
Strip properties are completely independent and channel properties are
applied on top of particular strip property, thus overriding it.

Implementation is separate from channel regions in other editors. This
is mainly because style and topology is quite different in VSE. But
also code seems to be much more readable this way.

Currently channels use functions similar to VSE timeline to draw
background to provide illusion of transparency, but only for background
and sfra/efra regions.

Great portion of this patch is change from using strip visibility and
lock status to include channel state - this is facilitated by functions
`SEQ_transform_is_locked` and `SEQ_render_is_muted`

Originally this included changes in D14263, but patch was split for
easier review.

Reviewed By: fsiddi, Severin

Differential Revision: https://developer.blender.org/D13836
2022-04-04 12:56:43 +02:00
5a0b4e97e6 Fix memleak in VSE proxy creation.
We didn't properly free allocated ffmpeg data structures.
2022-04-04 12:43:54 +02:00
e6a9b22384 OBJ: New C++ based wavefront OBJ importer
This takes state of soc-2020-io-performance branch as it was at
e9bbfd0c8c (2021 Oct 31), merges latest master (2022 Apr 4),
adds a bunch of tests, and fixes a bunch of stuff found by said
tests. The fixes are detailed in the differential.

Timings on my machine (Windows, VS2022 release build, AMD Ryzen
5950X 32 threads):

- Rungholt minecraft level (269MB file, 1 mesh): 54.2s -> 14.2s
  (memory usage: 7.0GB -> 1.9GB).
- Blender 3.0 splash scene: "I waited for 90 minutes and gave up"
  -> 109s. Now, this time is not great, but at least 20% of the
  time is spent assigning unique names for the imported objects
  (the scene has 24 thousand objects). This is not specific to obj
  importer, but rather a general issue across blender overall.

Test suite file updates done in Subversion tests repository.

Reviewed By: @howardt, @sybren
Differential Revision: https://developer.blender.org/D13958
2022-04-04 13:36:10 +03:00
ee3f71d747 Functions: allow for better compiler optimization
This extracts the inner loops into a separate function.
There are two main reasons for this:
* Allows using `__restrict` to indicate that no other parameter
  aliases with the output array. This allows for better optimization.
* Makes it easier to search for the generated assembly code,
  especially with the `BLI_NOINLINE`.
2022-04-04 11:57:58 +02:00
992d51bbcf Cleanup: Simplify zero-initializing DNA structures in C++
Avoids duplication of type which previously was specified twice in a line.
2022-04-04 11:47:28 +02:00
e5688f67aa Cleanup: Left-over debug print in own recent commit.
Kudos to Aaron Carlisle (@Blendify) for noticing it!
2022-04-04 11:36:39 +02:00
5dbd6968a6 Cleanup: clang-tidy 2022-04-04 15:43:25 +10:00
f699dbba86 Cleanup: use event parameters for functions that create key-map items
Replace 5 arguments with a single struct as the same arguments
are used in many places.

This didn't read well and was confusing with both arguments named
`val` & `value` in the case of WM_modalkeymap_add_item.
2022-04-04 14:32:42 +10:00
0ef96cd392 Cleanup: ensure space after file named in headers
Add blank lines after file references to avoid them being interpreted as
doc-strings the following declarations.
2022-04-04 13:34:42 +10:00
dc5b1d6c75 Cleanup: pass selection threshold to curve picking
Remove the extended version of ED_curve_editnurb_select_pick,
pass the size threshold directly to this function but as the distance in
pixels instead of a multiplier for ED_view3d_select_dist_px.

Using a multiplier is a less direct way to reference the threshold.
2022-04-04 13:11:44 +10:00
ff82bb5e3a Curve Pen Tool: set the first newly added points active
Other newly created points were already active, just not for newly
created curves.
2022-04-04 12:55:56 +10:00
0cb9926cd9 Fix crash removing the last point of a spline with the new pen tool 2022-04-04 12:42:11 +10:00
e26cc6aee3 Cleanup: indentation 2022-04-04 12:35:33 +10:00
85a0115c44 Cleanup: spelling in comments 2022-04-04 12:35:33 +10:00
27fea7a3a5 Cleanup: clang-format
Add ccl_gpu_kernel_postfix as a statement macro to prevent the following
declarations from being indented.
2022-04-04 12:35:33 +10:00
f6a20fca5e Cleanup: compiler warnings 2022-04-04 12:35:33 +10:00
637fe6f5ff Fix T97001: Grease pencil array modifier relative offset broken
This has been broken for two years, since rB29f3af952725,
which retrieved the bounding box from an object and immediately
overwrote it with -1, 1. That commit had another problem though--
the modifier stack shouldn't use object level data, it should use
data from the previous modifier.

Differential Revision: https://developer.blender.org/D14524
2022-04-03 12:57:37 -05:00
933d56d9e9 Curves: Support set origin and apply transform operators
Add support for the Curves object to the "Set Origin" and "Apply Object
Tansform" operators. Also change the automatic handle calculation to
avoid adding Bezier attributes if they don't need to be added.

Differential Revision: https://developer.blender.org/D14526
2022-04-03 12:54:42 -05:00
f6baba695c Curves: Inline some simple methods
These functions are very simple, but some of them were showing up in
in profiles for curves sculpt mode and various curve nodes. Making sure
they are inlined will allow avoiding the compiler to optimize this logic
much better.

Differential Revision: https://developer.blender.org/D14529
2022-04-03 12:51:05 -05:00
Dilith Jayakody
336082acba Curves: Curve Pen
This tool can be used to rapidly edit curves. The current set of
functionalities for Bezier splines are as follows:

The functionalities are divided into three versions of the operator:
* Left-Click
* Ctrl + Left-Click
* Double Click

All current functionalities and their defaults are as follows:
* Extrude Point: Add a point connected to an existing point.
Enabled for Left-Click.
* Extrude Handle Type: Type of the handles of the extruded points.
Can be either Vector or Auto. Defaults to Vector.
* Delete Point: Delete existing point.
Enabled for Ctrl + Left-Click.
* Insert Point: Insert a point into a curve segment.
Enabled for Ctrl + Left-Click.
* Move Segment: Move curve segment.
Enabled for Left-Click.
* Select Point: Select a single point or handle at a time.
Enabled for Left-Click.
* Move point: Move existing points or handles.
Enabled for Left-Click.
* Close Spline: Close spline by clicking the endpoints consecutively.
Defaults to True.
* Close Spline Method: The condition for Close Spline to activate.
Can be one of None, On Press or On Click.
Defaults to On Click for Left-Click and None for the others.
  * None: Functionality is turned off.
  * On Press: Activate on mouse down.
  This makes it possible to move the handles by dragging immediately
  after closing the spline.
  * On Click: Activate on mouse release.
  This makes it possible to avoid triggering the Close Spline
  functionality by dragging afterward.
* Toggle Vector: Toggle handle between Vector and Auto handle types.
Enabled for Double Click on a handle.
* Cycle Handle Type: Cycle between all four handle types.
Enabled for Double Click on the middle point of a Bezier point.

The keybindings for the following functionalities can be adjusted from
the modal keymap
* Free-Align Toggle: Toggle between Free and Align handle types.
Defaults to Left Shift. Activated on hold.
* Move Adjacent Handle: Move the closer handle of the adjacent vertex.
Defaults to Left Ctrl. Activated on hold.
* Move Entire: Move the entire point by moving by grabbing on the handle
Defaults to Spacebar. Activated on hold.
* Link Handles: Mirror the movement of one handle onto the other.
Defaults to Right Ctrl. Activated on press.
* Lock Handle Angle: Move the handle along its current angle.
Defaults to Left Alt. Activated on hold.

All the above functionalities, except for Move Segment and
those that work with handles, work similarly in the case of Poly
and NURBS splines.

Reviewed By: HooglyBoogly, weasel, campbellbarton
Differential Revision: http://developer.blender.org/D12155
2022-04-03 22:37:22 +05:30
1cdf8b19e5 Fix T96957: creating paint curve crashes
This was essentially double free due to a dangling pointer,
because `op->customdata` was not properly set to null after
the paint stroke was freed.
2022-04-03 10:49:20 +02:00
be699936af Cleanup: Move interface View2D files to C++
Similar to 4537eb0c3b
2022-04-03 00:00:42 -05:00
79ff65d07b Fix T96978: Objects that emit light do not appear in light groups
The initial commit only wrote direct and indirect lighting into the lightgroup passes,
but not rays that directly hit the light source itself.
2022-04-02 23:46:22 +02:00
4537eb0c3b Cleanup: Remove interface region files to C++
Moves all `interface_region*` files to C++ except for the tooptip region
which is slightly more complicated. Also move a few other files as well.
This helps to simplify and speed up code, especially through the use
of better C++ data structures. This change builds on all platforms on
the buildbot.
2022-04-02 16:17:48 -05:00
Alaska
351c00d29a Fix T96973: Re-add Cycles shading menu to lights
This patch re-adds the shading menu to lights to allow people to use lights in light groups.
This patch also hides all settings in the shading menu that are not useful for the light object.

Reviewed By: lukasstockner97

Maniphest Tasks: T96973

Differential Revision: https://developer.blender.org/D14527
2022-04-02 22:42:57 +02:00
a567bef5cc Fix: Assert with set origin operation and single active object
Array has bounds checking that a raw pointer didn't have before.
2022-04-01 23:22:51 -05:00
ad35453cd1 Cycles: Add support for light groups
Light groups are a type of pass that only contains lighting from a subset of light sources.
They are created in the View layer, and light sources (lamps, objects with emissive materials
and/or the environment) can be assigned to a group.

Currently, each light group ends up generating its own version of the Combined pass.
In the future, additional types of passes (e.g. shadowcatcher) might be getting their own
per-lightgroup versions.

The lightgroup creation and assignment is not Cycles-specific, so Eevee or external render
engines could make use of it in the future.

Note that Lightgroups are identified by their name - therefore, the name of the Lightgroup
in the View Layer and the name that's set in an object's settings must match for it to be
included.
Currently, changing a Lightgroup's name does not update objects - this is planned for the
future, along with other features such as denoising for light groups and viewing them in
preview renders.

Original patch by Alex Fuller (@mistaed), with some polishing by Lukas Stockner (@lukasstockner97).

Differential Revision: https://developer.blender.org/D12871
2022-04-02 06:14:27 +02:00
5387d33e5f Cleanup: Further use of const for object bounding boxes
Also solves two warnings from the previous similar commit,
f688e3cc31. The change to the grease pencil
modifier is quite suspicious, but doesn't change the behavior,
which was already broken.
2022-04-01 18:30:09 -05:00
69c07adb51 Cleanup: Remove object bounding box function
This abstraction doesn't serve any purpose after 11c6d4e88e.
The flag on bounding boxes isn't used, except for the dirty tag.
2022-04-01 14:58:32 -05:00
59c3194f8e Cleanup: Use float3 type
This can help make some refactoring to bounding boxes slightly easier.
2022-04-01 14:48:48 -05:00
11c6d4e88e Cleanup: Remove unused boundbox flag
This flag hasn't been used for around four years. The convention in this
header seems to be commenting out the flag and adding "UNUSED" after it.
2022-04-01 13:55:17 -05:00
f688e3cc31 Cleanup: Use const for bounding boxes where possible 2022-04-01 13:45:02 -05:00
999f6526b1 Fix compiler error when building without USD and alembic 2022-04-01 20:12:09 +02:00
Stefan Werner
65dcb5ebd3 Cycles: Semantically separate 2D and 3D texture objects
Currently there are no functional changes.

Preparing for an upcoming oneAPI integration where such separation
in types is needed.
2022-04-01 19:44:31 +02:00
Stefan Werner
9c6dff70c8 Cycles: Introduce postfix for kernel body definition
Increases flexibility of code-generation for kernel entry points.

Currently no functional changes, preparing for integration with oneAPI.
2022-04-01 19:44:02 +02:00
Stefan Werner
542c03fed5 Cycles: Use single floating point precision sine/cosine in sky
Should be no functional changes.
2022-04-01 19:43:34 +02:00
Stefan Werner
633c8fc3c8 Cycles: Optimize Nishita sky
Reduce register pressure.
Helps with kernel compile time and render time.

Should be no functional changes.
2022-04-01 19:42:00 +02:00
8bec875586 install_deps: Update Embree to 3.13.3 and OIDN to 1.4.3.
Re {T95206}.
2022-04-01 17:47:15 +02:00
Olivier Maury
1fb0247497 Cycles: approximate shadow caustics using manifold next event estimation
This adds support for selective rendering of caustics in shadows of refractive
objects. Example uses are rendering of underwater caustics and eye caustics.

This is based on "Manifold Next Event Estimation", a method developed for
production rendering. The idea is to selectively enable shadow caustics on a
few objects in the scene where they have a big visual impact, without impacting
render performance for the rest of the scene.

The Shadow Caustic option must be manually enabled on light, caustic receiver
and caster objects. For such light paths, the Filter Glossy option will be
ignored and replaced by sharp caustics.

Currently this method has a various limitations:

* Only caustics in shadows of refractive objects work, which means no caustics
  from reflection or caustics that outside shadows. Only up to 4 refractive
  caustic bounces are supported.
* Caustic caster objects should have smooth normals.
* Not currently support for Metal GPU rendering.

In the future this method may be extended for more general caustics.

TECHNICAL DETAILS

This code adds manifold next event estimation through refractive surface(s) as a
new sampling technique for direct lighting, i.e. finding the point on the
refractive surface(s) along the path to a light sample, which satisfies Fermat's
principle for a given microfacet normal and the path's end points. This
technique involves walking on the "specular manifold" using a pseudo newton
solver. Such a manifold is defined by the specular constraint matrix from the
manifold exploration framework [2]. For each refractive interface, this
constraint is defined by enforcing that the generalized half-vector projection
onto the interface local tangent plane is null. The newton solver guides the
walk by linearizing the manifold locally before reprojecting the linear solution
onto the refractive surface. See paper [1] for more details about the technique
itself and [3] for the half-vector light transport formulation, from which it is
derived.

[1] Manifold Next Event Estimation
Johannes Hanika, Marc Droske, and Luca Fascione. 2015.
Comput. Graph. Forum 34, 4 (July 2015), 87–97.
https://jo.dreggn.org/home/2015_mnee.pdf

[2] Manifold exploration: a Markov Chain Monte Carlo technique for rendering
scenes with difficult specular transport Wenzel Jakob and Steve Marschner.
2012. ACM Trans. Graph. 31, 4, Article 58 (July 2012), 13 pages.
https://www.cs.cornell.edu/projects/manifolds-sg12/

[3] The Natural-Constraint Representation of the Path Space for Efficient
Light Transport Simulation. Anton S. Kaplanyan, Johannes Hanika, and Carsten
Dachsbacher. 2014. ACM Trans. Graph. 33, 4, Article 102 (July 2014), 13 pages.
https://cg.ivd.kit.edu/english/HSLT.php

The code for this samping technique was inserted at the light sampling stage
(direct lighting). If the walk is successful, it turns off path regularization
using a specialized flag in the path state (PATH_MNEE_SUCCESS). This flag tells
the integrator not to blur the brdf roughness further down the path (in a child
ray created from BSDF sampling). In addition, using a cascading mechanism of
flag values, we cull connections to caustic lights for this and children rays,
which should be resolved through MNEE.

This mechanism also cancels the MIS bsdf counter part at the casutic receiver
depth, in essence leaving MNEE as the only sampling technique from receivers
through refractive casters to caustic lights. This choice might not be optimal
when the light gets large wrt to the receiver, though this is usually not when
you want to use MNEE.

This connection culling strategy removes a fair amount of fireflies, at the cost
of introducing a slight bias. Because of the selective nature of the culling
mechanism, reflective caustics still benefit from the native path
regularization, which further removes fireflies on other surfaces (bouncing
light off casters).

Differential Revision: https://developer.blender.org/D13533
2022-04-01 17:45:39 +02:00
253e4e7ed2 Assets: Enable collection assets (no longer experimental)
With automatic collection previews (810e225c26) and a toggle for
collection instancing (previous commit) supported, there are no known
blocking issues for collection assets. There are still further
improvements to come as part of regular developemt (e.g. bounding box
based snapping).
2022-04-01 16:51:29 +02:00
eb1ede5693 Assets: Instancing operator option for collection asset dropping
Makes it possible to toggle instancing via the "Adjust Last Operation"
panel after dropping a collection asset into the viewport.

A design task that puts this into more context is pending still, but
this is a useful option to have either way.

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

Reviewed by: Bastien Montagne
2022-04-01 16:44:52 +02:00
1de051a7a9 install_deps: Updated Alembic to 1.8.3 and OSD to 3.4.4.
Re {T95206}.
2022-04-01 16:43:29 +02:00
e81d7bfcc9 Cycles: enable Alembic procedural for final renders
The Alembic procedural was only enabled during viewport renders
originally because it did not have any caching strategy. Now that
is does, we can allow its usage in final renders.

This also removes the `dag_eval_mode` argument passing to
`ModifierTypeInfo.dependsOnTime` which was originally added to detect if
we are doing a viewport render for enabling the procedural.

Differential Revision: https://developer.blender.org/D14520
2022-04-01 16:30:45 +02:00
5c80543c43 Cleanup: Move geometry set fields to a separate header
This commit moves declarations that depend on `FN_field.hh` out of
`BKE_geometry_set.hh` into `BKE_geometry_fields.hh`. This helps to
reduce the number of areas that need to depend on the functions module,
which recently came in in review of D11591.

In the future we may have a library of standard field inputs in order to
make composing algorithms easier, so it makes sense to have a header
that could contain them and some basic related utilities relating the
concepts of geometry and fields.

Reducing use of unnecessary headers may also reduce compilation time.

Differential Revision: https://developer.blender.org/D14517
2022-04-01 08:40:45 -05:00
3ecdfd0938 Geometry Nodes: Add search to named attribute input node
This commit adds attribute search the the attribute input field node.
Because it's a field node, finding which attribute to display without
increasing the complexity a lot isn't obvious. In this commit, all
attributes used by nodes in the current group are included.

When an attribute is chosen from the list, the node's data type is
updated, and links connected to the output socket are reconnected.

Ref T96271

Differential Revision: https://developer.blender.org/D14516
2022-04-01 08:33:03 -05:00
00ba51d37b Geometry Nodes: Port set handle nodes to new data-block
This commit ports the "Set Handle Positions" and "Set Hanle Type"
nodes to use the new curves data-block. The nodes become simpler
and likely much faster too, though they're usually not the bottleneck
anyway.

Most of the code is ported from `BezierSpline` directly. The majority
of the complexity comes from the interaction between different
automatically calculated handle types. In comparison `BezierSpline`,
the calculation of auto handles is done eagerly-- mostly because it's
simpler. Eventually lazy calculation might be good to add.

Differential Revision: https://developer.blender.org/D14464
2022-04-01 08:12:41 -05:00
a250d3d1b7 Fix compositor memory leak after recent color management changes 2022-04-01 15:04:18 +02:00
d120a083da Fix T96763: New OBJ Exporter Incorrectly saving the materials in the MTL file
Original report (T96763) only reported the issue of double-space before the texture path, but while adding test coverage I found some other issues that I fixed while at it:

- Incorrectly emits two spaces between `map_Xx` keyword and the texture path, leading to some 3rd party software not finding the textures,
- Emissive texture map (`map_Ke`) was not exported,
- When Mapping node is used on the texture UVs, the "Location" and "Scale" values were mixed up (location written as "scale", scale written as "location).

Added gtest coverage.

Reviewed By: Howard Trickey

Differential Revision: https://developer.blender.org/D14519
2022-04-01 14:59:19 +03:00
b073f58a8e Fix T96930: Cloth Disk cache not being saved and being deleted on files that have been linked and library override enabled.
PointCache handing is just horrible from RNA, makes dealing with
overrides a nightmare...

Ended up having to add a specific 'apply' callback for the `use_disk_cache`
property, that would explicitely NOT call the the `update` callback of
this property, to avoid having the whole disk cache nuked away...

But the whole thing remains fairly britle, to say the least.
2022-04-01 12:41:59 +02:00
1264142f78 LibOverride: RNA Apply: let apply function responsible for calling update or not on overridden properties.
While this is the desired behavior in almost cases, there are a few
hairy nightmares that may require not to do so.

NOTE: this change should should not modify any current behavior at all.
2022-04-01 12:35:25 +02:00
d34c4089f1 Fix T96931: Crash on load with library overrides + multiple cloth cache slots.
Not really clear why that would only show with multiple caches... But
point cache system is beyond brittle anyway.

This fix solves the issue at two different levels:
* General safety check in `rna_Cache_info_length` that we do get a valid
  `pid`.
* Forbid usage of this `PointCache.info` RNA property in any
  diffing/LibOverride processing (since it's by definition runtime, volatile
  data).
2022-04-01 11:05:30 +02:00
9a67f9173b Cleanup: Improve variable naming
The variable `ofs` in `widget_numslider` was referring to the radius.
`rad` is more clear and consistent with the other widget functions.
2022-04-01 07:05:50 +02:00
aab9047f9d Fix T88785: Keep value slider from clipping
Keep the value slider from clipping through rounded corners for
low values by ensuring the width of the slider rectangle is at least
twice the corner radius.

Reviewed By: Hans Goudey

Differential Revision: https://developer.blender.org/D11474
2022-04-01 06:51:22 +02:00
42853bacc9 GPencil: Fix regression with dots uvs
This was introduced by rBeccb0b222e3465baa71430223c5ee2f0206a7b02.
2022-03-31 19:14:31 +02:00
ce5428b294 install_deps: Update OCIO to 2.1.1 and OIIO to 2.3.13.
Re {T95206}.
2022-03-31 17:40:37 +02:00
59681a7ccd install_deps: Update openVDB to 9.0.
Re {T95206}.
2022-03-31 16:56:34 +02:00
3d5085375f install_deps: default boost version to 1.78 and TBB to 2020_U3.
Re  T95206.
2022-03-31 16:25:02 +02:00
ca28f376f7 OBJ: mark the new 3.1+ exporter as experimental for now
While it still has known issues/bugs/limitations. Also do not make it the very first export menu item, while at it.

Differential: D14512
2022-03-31 16:15:02 +03:00
4c1393c202 Fix T76746: Alembic, wrong result importing back exported curves
In Alembic curve topology is stored with an array of values describing
how many points each sub-curve has. Instead of writing the number of
points for the current curve, the Alembic exporter would write the
accumulated number of points.

This error has existed since the initial implementation.
2022-03-31 15:01:27 +02:00
eb4155cc1e Fix T94888: LineArt use the same triangulation as viewport.
This fixes inconsistencies between line art output and viewport triangulation result.
2022-03-31 21:00:26 +08:00
2f7171622d DRW: Rename DRW_shgroup_uniform_vec4_array_copy to mat4_copy
This function was not used for anything other than mat4. This
was because of a limitation of the DRW module/
This makes it cleaner for the GLSL and also less tempting to use
it for other unconventional purpose.
2022-03-31 13:48:17 +02:00
ca37654b63 Fix T96920 DRW: Regression: Hair strands are drawn in wrong place
This was caused by the recent changes made to the way we handle matrix
copies. The matrix copy assumed that the uniform iteration was the same
as creation order. But this was far from true. The reality was that
the iterator was reverse for `unichunk` but not for `unichunk->uniforms`
so this was recreating wrong matrix.

I rewrote this part to always use reverse iteration and fix the
copy destination.

Also I simplified the code making the assumption this won't be used for
anything else than mat4.
2022-03-31 13:36:04 +02:00
0c6dc7c59e Outliner: New "Hierarchies" view mode for Library Overrides
Adds a dropdown for the Library Overrides display mode that lets users
choose between a "Properties" and a "Hierachies" view mode. The former
is what was previously there (a mode that displays all overridden
properties with buttons to edit the values), the latter is new. It
displays the hierarchical relationships between library overridden
data-blocks. E.g. to override the mesh of an object inside a linked
collection, the entire collection > object > mesh hierarchy needs to be
overridden (whereby the former two will be automatically overridden
using system overrides).
The Hierarchies mode will also show the override hierarchies of
data-blocks that were linked and are overridden in the source file. This
information is useful to have, especially for debugging scenes.

Part of T95802.

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

Reviewed by: Bastien Montagne
2022-03-31 12:21:14 +02:00
2202259e9c Fix T96909: crash when assigning new node group to group node
The node group returned by `bpy.data.node_groups.new(...)` was not
updated properly.
2022-03-31 11:57:45 +02:00
dc73c71b3b Fix T96915: GPU subdivision modifier: Smooth Shade doesn't work
Simple error in an earlier commit, the flags should be or-ed.
2022-03-31 11:52:46 +02:00
7e54f5c218 Cleanup: make format 2022-03-31 11:00:42 +02:00
0d223f6aca Cleanup: Unused variable in release build warning 2022-03-31 09:26:46 +02:00
92f2b77e78 Cleanup: Compilation warnings in gpencil code after DNA C++ changes
Direct replacement of code:
- memcpy of a single point is done as a shallow_copy() assignment.
- memcpy of a range of points is done with an explicit cast to void*
  to tell compiler that we really want to memcpy even a non-trivial
  type.

In some cases it seems that memcpy can be used more (points are copied
in a loop). Those left as-is since this is supposed to be a simple
cleanup.

Differential Revision: https://developer.blender.org/D14505
2022-03-31 09:18:21 +02:00
ae1f8315f7 Depsgraph: minor optimization in order of checks
Checking BKE_image_user_id_has_animation loops over ID users
which never needs to run for material & world data-blocks.
2022-03-31 13:07:14 +11:00
3d132ead50 Cleanup: spelling, trailing space for comment-blocks 2022-03-31 13:01:41 +11:00
41ee5382f6 Cleanup: Remove unnecessary namespace specification 2022-03-30 20:55:40 -05:00
762d3a48e8 Cleanup: Avoid storing pointers for attribute search callback
It's better to use some local/stable identifiier to avoid relying on
the data not being freed in between creating the search menu and
the exec function. This is similar to c473b2ce8b.
2022-03-30 20:54:11 -05:00
Gilberto Rodrigues
49858bf526 UI: Fix outliner and buttons icons alignment
029cf23d71 changed some icons alignment, but after 9be49a1069
the icons don't align anymore. This commit reverts 029cf23d71 and
also makes a couple of other outliner icons left aligned, instead of
right aligned, for consistency and general alignment.

Differential Revision: https://developer.blender.org/D14501
2022-03-30 18:57:24 -05:00
8466fd4bd1 Cleanup: Curves draw cache renaming, use references
Also change some remaining cases of "hair object" to "curves object".
2022-03-30 18:25:06 -05:00
4edde244da Nodes: Cut hidden links when creating node groups
Add a check to the creation of node groups to remove hidden links
that are connected to the outside of the node group. This avoids
creating sockets in the group's interface that aren't (visibly)
connected to anything within the node group.

Reviewed By: Jacques Lucke, Hans Goudey

Differential Revision: https://developer.blender.org/D14249
2022-03-30 23:07:11 +02:00
2670032038 UI: Improve node editor dot background
This commit makes the dot grid used as background in the node editor
more visually stable when zooming in and out.

The dot grid now uses a continuously subdividing pattern, where
each level of subdivision divides the previous five times, similar to
the line grid in the 3D viewport.

The maximum for the "Grid Levels" theme setting is changed to 3, since
any further subdivisions are too small to be visible.
The "Grid Levels" value for the default themes "Blender Dark" and
"Blender Light" is therefore changed to 3, as well.

Reviewed By: Hans Goudey, Pablo Vazquez

Differential Revision: http://developer.blender.org/D13302
2022-03-30 21:21:57 +02:00
Jason Fielder
922d53a791 Metal: Adding alternative support for GPU_PRIM_TRI_FAN/LINE_LOOP For Metal backend.
- Metal uniform array compatibility in DRW module.
- Guard OpenGL-specific workarounds and flushes behind GPU_type_matches_ex API guard. Add further render boundaries for render paths called outside of the main loop.

Authored by Apple: Michael Parkin-White

Ref: T96261

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14438
2022-03-30 20:31:12 +02:00
84fde382e4 Fix T85689: Assume Win32 Volumes are Valid
Skip validation when inserting items into the Win32 "Volumes" list.
This fixes some long hangs when launching Blender with disconnected
network shares.

See D14506 for more details.

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

Reviewed by Brecht Van Lommel
2022-03-30 11:10:15 -07:00
Jason Fielder
49bc640b76 Metal: GLSL Shader compatibility 5
MSL does not have an implicit global scope, this is emulated via macro's adding an indirection for uniforms, attributes, shader stage inputs and outputs such as:

#define roughness shaderinst->roughness.

Variables in GLSL which exist within uniform blocks can be directly referenced via the global scope, unlike standard C++. This means that variable name pollution occurs if subsequent local variables in the code use the same name, resulting in compilation errors.

A number of these conflicting names have been renamed to ensure unique naming and no further scope pollution.

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14452
2022-03-30 19:53:22 +02:00
Jason Fielder
7c9e128bbf Metal: GLSL Compatibility - explicit mat4_to_mat3 conversion
Explicit constructor for mat3 from a mat4 is not valid and cannot be overloaded.

Adding explicit texture resource type flags for depth textures. This is an explicit requirement for Metal Shading language. This is a temporary compatibility, as this path is already supported in GPU_SHADER_CREATE_INFO under ImageType::DEPTH_2D, though required in shader source for MSL shaders which do not have create info.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14418
2022-03-30 19:47:00 +02:00
60a6fbf5b5 Curves: Port resample node to the new data-block
This commit re-implements the resample curve node to use the new curves
type instead of CurveEval. The largest changes come from the need to
keep track of offsets into the point attribute arrays, and the fact
that the attributes for all curves are stored in a flat array.

Another difference is that a bit more of the logic is handled by
building of the field network inputs. The idea is to let the field
evaluator handle potential optimizations while making the rest of the
code simpler.

When resampling 1 million small poly curves,the node is about 6
times faster compared to 3.1 on my hardware (500ms to 80ms).

This also adds support for Catmull Rom curve inputs.

Differential Revision: https://developer.blender.org/D14435
2022-03-30 10:37:39 -05:00
ba28c10199 Fix T96344: edit mode GPU subdivision crashes with X-ray mode and modifiers
The crash happens because the origindex layers created as part of
the modifier stack evaluation are not set in the `MeshRenderData` when
they should have been.

This is because when selecting in X-ray mode, a subdivision wrapper
is created to ensure that selection happens with a subdivided
geometry, and this replaces the `MDATA` wrapper which is also used to
setup the `MeshRenderData`.

As we do not seemingly have an `MDATA` wrapper, the draw code decides
that we can extract draw buffers directly from the BMesh, instead of
the mapped Mesh with origin indices layers.

To fix this, we should also consider to use mapped extraction if a
subdivision wrapper exists on the mesh.

Differential Revision: https://developer.blender.org/D14485
2022-03-30 17:31:40 +02:00
9b9fda2122 Overlay: Port Armature shader to ShaderCreateInfo
Should have no regression.
2022-03-30 15:50:06 +02:00
883326040e GL: Fix Invalid enum error on Apple Silicon
Guard shader storage related gets and bypass a buggy enum.

Fix T95592 OpenGL Invalid Enum
2022-03-30 15:50:05 +02:00
05a77bb0d8 Overlay: Port Edit Mode shaders to ShaderCreateInfo
This should have no regression.
2022-03-30 15:50:05 +02:00
4cd409ca98 DRW: Port draw_common.c to use shared definition with GLSL
# Conflicts:
#	source/blender/draw/intern/draw_common_shader_shared.h
#	source/blender/draw/intern/shaders/draw_view_info.hh
2022-03-30 15:50:05 +02:00
fb524d1675 GPUShaderCreateInfo: Add DepthWrite option
This option lets specify explicitely how the fragment shader will change
the fragment's depth.
2022-03-30 15:13:25 +02:00
5aa81594e6 GPU: ShaderBuilder: Remove do_static_compilation_ inheritance
This is because the inheritance is not done before checking if the shader
should be statically compiled. Also some inheritance scheme
might have intermediate permutation that are not compilable.
2022-03-30 15:13:25 +02:00
Pratik Borhade
66010b6deb Add soft limit for Bevel segments in modifier.
The recent change to allow a max segments of 1000 in the modifier
causes a lag when dragging or wheeling in the segments box.
This change makes the soft limit back to 100, but you can still
type numbers up to 1000 in the box.

Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D14477
2022-03-30 08:51:20 -04:00
9c3adb789a GPU: ShaderBuilder: Fix compilation on non-Mac platform
Regression introduced in rB664eb1936946a077498a17c22576763c664e3186
2022-03-30 14:02:11 +02:00
ecafa4c27c Compositor: Fix Missing output UI for Normal node
There were multiple issues at hand here:

- The default value has been changed to `{0, 0, 1}` see: rB25f1783673de636a6f0ca4457df8c05bc685981a
- The output needs the subtype set `PROP_DIRECTION`
- The noder properties were missing in `node_composit_set_butfunc`

Fixes T96860
2022-03-30 08:00:23 -04:00
3656e66ac2 Curves: support converting curves to legacy hair system
This adds a new operator that converts all selected curves objects
into hair particle systems on their respective surface objects. Existing
particle systems with the correct name are updated, otherwise a new
particle system is added.

The purpose of the operator is the make the new curve sculpting tools
useful even before all functionality is ported over from the old hair system.

The operator can be found in the `Object > Convert` menu in object mode,
when a curves object is active.

Differential Revision: https://developer.blender.org/D14441
2022-03-30 13:29:49 +02:00
9b25fafbec Cleanup: Left over from review of apply transform
I miss the review notes about this for the
8621fdb10d commit.
2022-03-30 12:24:46 +02:00
ebb49ddd83 GPencil: Fix double-free issue in update cache
When a `GPencilUpdateCacheNode` is created, it always allocates the
`children` pointer. This should not be freed until the whole cache is
deleted.
The `cache_node_update` would free the `children` pointer in a specific
case, causing a double-free later when the cache was removed.
2022-03-30 11:41:27 +02:00
8621fdb10d Apply Object Transform: Multi-user data support
The current behaviour is to prevent multi-user data from having its
transformation applied.

However in some particular cases it is possible to apply them:
* If all the users of the multi-user data are part of the selection.
* If not all the users are in the selection but the selection is made
single-user.

The active object is used as reference to set the transformation of the
other selected objects.

Note: For simplicity sake, this new behaviour is only available if all
the selection is using the same data.

Differential Revision: https://developer.blender.org/D14377
2022-03-30 11:07:57 +02:00
35f34a3cf8 Modifiers: Support applying modifiers for multi-user data
The current behaviour is to prevent multi-user data from having its
modifier applied.

Instead, with this patch, we now warn the user that if they want to
proceed the object will be made single-user.

Note that this only makes the object data single-user. Not the material
or actions.

As a future step we can apply the same behaviour for the Grease Pencil modifiers

Differential Revision: https://developer.blender.org/D14381
2022-03-30 11:06:10 +02:00
218bcff32d Iterator to loop over objects based on a flag 2022-03-30 11:06:01 +02:00
0f94c99ee7 Cleanup: clang-format 2022-03-30 18:02:59 +11:00
a8ec7845e0 Cleanup: use "num" as a suffix in: source/blender/blenlib
Also replace "num" with:
- "number" when it's not used to denote the number of items.
- "digits" when digits in a string are being manipulated.
2022-03-30 18:01:22 +11:00
af3aaf8034 Cleanup: use "num" as a suffix in: source/blender/gpencil_modifiers 2022-03-30 17:41:34 +11:00
e26c89cd76 Fix: Failing curves test after recent commit
87e9451d66 missed updating the behavior for Catmull Rom curves.
2022-03-29 23:39:03 -05:00
e74880a659 Cleanup: use utility function to initialize SelectPick_Params 2022-03-30 15:03:12 +11:00
0f33f0de00 Fix leak transforming in the node-editor without a selection 2022-03-30 14:05:33 +11:00
573b78b351 Cleanup: remove redundant lattice de-selection 2022-03-30 13:18:46 +11:00
Aleksi Juvani
eddffdd398 Cleanup: Move UV edit parameterize code to geometry module
This will allow reusing it elsewhere, such as in a geometry node.

Differential Revision: https://developer.blender.org/D14453
2022-03-29 20:57:59 -05:00
4a93c4bf1d Geometry Nodes: Remove soft min from extrude node scale
Extusion with a negative offset is possible and expected.
2022-03-29 20:46:41 -05:00
2499768e07 Keymap: "Mouse Select & Move" now uses click to de-select others
While it's useful for click-drag to leave the selection as-is
(when clicking on items that are already selected), it's useful
for a single click to de-select all other elements.

This also removes the need for the initial selection to set the object
as active since this is possible by clicking on it.
2022-03-30 12:34:14 +11:00
400ea40dca Curves: Port curves total length node to the new data-block
Ref T95443
2022-03-29 20:24:41 -05:00
62334c6ee4 Curves: Port length node to the new data-block
Ref T95443
2022-03-29 20:17:35 -05:00
f4f89a76a8 Curves: Port parameter node to the new data-block
Using the evaluated lengths cache from 72d25fa41d, re-implement
the curve parameter node with the new data structure. Conceptually
it works the same way, but the code is restructured and cleaned up
a bit as well. This also adds support for Catmull Rom curves.

Differential Revision: https://developer.blender.org/D14461
2022-03-29 20:11:38 -05:00
87e9451d66 Fix: Remove special case from curve segment size function
The idea that curves with two points cannot be cyclic came from some
existing code, but there's not fundamental reason for it, so remove the
check in this function. The case can be handled elsewhere if necessary.
2022-03-29 19:56:38 -05:00
72d25fa41d Curves: Add length cache, length paramerterize utility
This commit adds calculation of lengths along the curve for each
evaluated point. This is used for sampling, resampling, the "curve
parameter" node, and potentially more places in the future.

This commit also includes a utility for calculation of uniform samples
in blenlib. It can find evenlyspaced samples along a sequence of points
and use linear interpolation to move data from those points to the
samples. Making the utility more general aligns better with the more
functional approach of the new curves code and makes the behavior
available elsewhere.

A "color math" header is added to allow very basic interpolation
between two colors in the `blender::math` namespace.

Differential Revision: https://developer.blender.org/D14382
2022-03-29 19:45:59 -05:00
bcb9379c6d Cleanup: quiet warning for description ending with a full stop 2022-03-30 11:41:34 +11:00
9ae98f305a Cleanup: spelling in comments 2022-03-30 11:38:24 +11:00
be8270bc76 Cleanup: use equality instead of contains for single-item sets 2022-03-30 11:27:54 +11:00
87e5c4230f Cleanup: unbalanced doxy sections 2022-03-30 11:17:16 +11:00
ee1d5fb9e4 UI: Fix cosmetic papercuts of the reroute node
Fix small cosmetic issues with the reroute node:
1. Remove special case that allowed curved links to attach vertically.
2. Center align the reroute node's label.

The vertically attached node links could lead to kinks in the otherwise
smooth curves. This would break the visual flow and make the link
potentially intersect the node's label.

The center alignment of the label gives more consistent results for
different label lengths and also reduces the chance of the label
interfering with the node links.

Reviewed By: Hans Goudey, Pablo Vazquez

Differential Revision: D14457
2022-03-29 23:39:50 +02:00
08b4b657b6 Geometry Nodes: Don't create node tree when adding nodes modifier
Don't always create a new geometry nodes node tree when adding a
geometry nodes modifier.

This avoids files getting cluttered with empty and unused geometry node
trees that are created every time a nodes modifier is added to an
object - even if only to apply an already existing.
This is also more consistent with other modifiers that also don't
automatically create new data blocks.

The new modifier still automatically gets populated with a new node
tree when adding it via the "New" button in the header of the
geometry nodes editor.

Reviewed By: Hans Goudey, Dalai Felinto, Pablo Vazquez

Differential Revision: D14458
2022-03-29 22:30:51 +02:00
4eb4c90cf6 GPencil: Remove UI prefix Use in Dot-Dash modifier
The "Use" word must not be used in UI.
2022-03-29 22:26:44 +02:00
ac9ddf54a0 Fix: incorrect assert in new code 2022-03-29 14:39:18 -05:00
ac40d40cb7 GPencil: Fix Windows compiler errors
For non trivial data must be used `MEM_new`
2022-03-29 19:32:28 +02:00
5596f79821 LibOverride: Massive edits to 'editable' IDs checks in editors code.
Add new `BKE_id_is_editable` helper in `BKE_lib_id.h`, that supercedes
previous check (simple `ID_IS_LINKED()` macro) for many editing cases.

This allows to also take into account 'system override' (aka
non-editable override) case.

Ref: {T95707}.
2022-03-29 17:59:55 +02:00
354db59fb1 LibOverride: Rename 'delete hierarchy' to 'clear hierarchy', add 'clear single' operations.
'Delete' was a confusing name, even though it would delete the overrides
it would replace them by linked data.

Adding the 'single' version of that operation made it even more
confusing, since often it has to keep the override ID for sakes of
hierarchy, and just reset it and turn it back into a non-editable system
override.

Ref: {T95707}.
2022-03-29 17:59:43 +02:00
6cc9ba94b7 LibOverride: Implement default 'user override' behavior.
Implement default behavior to decide which overrides remain 'system'
ones, and which become 'user editable' ones, when creating hierarchy
override from 3DView or the Outliner.

3DView:
If from an Empty-instanced collection, only Armature objects in
that collection are user overrides.
If from a set of selected objects, all overrides created from selected
objects are user overrides.

Outliner:
All override IDs created from selected elements in the Outliner are user
overrides.
There is one special case: When a collection is selected, and is
'closed' in the outliner, all its inner armature objects are also user
overrides.

Ref: {T95707}.
2022-03-29 17:59:31 +02:00
d7c802c25f LibOverride: Add initial handling of system overrides in creation/duplication/resync code, and some basic do_version.
When creating with hierarchies, core code only generates system
overrides, responsibility to define 'user overrides' is then for the
higher-level calling code (Editor/Operator-level).

do_version code uses fairly basic euristics, should be good enough here
though in most cases. and can always be refined later if needed.

Ref: {T95707}.
2022-03-29 17:59:17 +02:00
b5f2c77658 LibOverride: make some override properties 'overridable'.
The whole liboverride data is still ignored by override diffing etc.,
but some of their flags should be editable (from script and/or advanced
technical/debug UI). So using a weird combination of flags to achieve
this.

Ref: {T95707}.
2022-03-29 17:59:05 +02:00
9394d455af LibOverride: Add a new 'virtual' non-editable override icon and use it in Outliner.
Ref: {T95707}.
2022-03-29 17:58:53 +02:00
5adcf6c85e LibOverride: Add initial System Override flag.
This merely adds the flag, exposes it in RMA, and uses it in some of the
most common 'is editable' checks (RNA, `BASE_EDITABLE` macro...).

Next step: do_version and defining systemoverrides at creation.

Ref: {T95707}.
2022-03-29 17:58:40 +02:00
1013084038 GPencil: Small UI tweaks to Build modifier
Changes in some names.
2022-03-29 17:38:22 +02:00
9a0e1950ea Cover DNA_gpencil_types.h with C++ structure methods
Ref T96847

Maniphest Tasks: T96847

Differential Revision: https://developer.blender.org/D14487
2022-03-29 17:21:02 +02:00
1f6c2507f8 Cleanup: Remove legacy dupli system from point cloud object
The "dupli" system now has a faster, more powerful, and more flexible
alternative with geometry nodes. Since the point cloud objects haven't
been exposed in the non-experimental UI yet, we can remove the dupli
implementation and the panel for the object type.

Differential Revision: https://developer.blender.org/D14482
2022-03-29 10:16:05 -05:00
c4e4924096 GPencil: Fading for build modifier.
Adds fading support for build modifier so it's not a hard cut off

Reviewed By: Antonio Vazquez (antoniov), Matias Mendiola (mendio)

Differential Revision: https://developer.blender.org/D14309
2022-03-29 22:46:56 +08:00
Henrik Dick
0e0977f3e6 GPencil: Fix sculpt mask ignoring one point strokes
The check for the selected status was missing in the case
where the stroke one has one point.

Differential Revision: http://developer.blender.org/D14490
2022-03-29 16:22:52 +02:00
810e225c26 Assets: Support automatic collection previews
Adds supports for collection previews that are rendered automatically when
collections are marked as assets. (Or when preview rendering is triggered
differently, e.g. through the //Refresh Data-Block Previews// operator).

Idea in this patch is to create a collection instance empty outside of main for
the collection, and then reuse the object rendering code to render the preview.
This keeps things very simple and works just fine.

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

Reviewed by: Bastien Montagne
2022-03-29 15:37:22 +02:00
Yuki Hashimoto
9ec77d709c Fix T63795: Display custom properties with brackets in info
When custom properties are changed, they are displayed with brackets in
info.

Ref D14380
2022-03-30 00:29:15 +11:00
4a5cd4e6c7 Fix T96844: Crash when switching workspaces and outliner modes
Error exposed by ba49345705. Code just assumed that the tree-element
pointed to a real ID, but this is often not the case, and the ID pointer
contains completely different data. E.g. before ba49345705, it would
be a pointer to one of the `Main` listbases, so this code would have
undefined behavior. Now the pointer is null for elements in the "Current
File" element, causing a null-pointer dereference rather than undefined
behavior (that just happened to virtually always result in the intended
code path).
2022-03-29 15:24:02 +02:00
fced604acf Curves: improve Snake Hook brush
This implements the spherical brush and different falloff
modes for the Snake Hook brush.

Differential Revision: https://developer.blender.org/D14408
2022-03-29 14:46:14 +02:00
4def6e8072 Icons: Programmatically create indirect library icon, remove from SVG
The indirect library data icon was just a grayed out version of the
regular one. This graying out is now done in code, so the icon can be
removed from the SVG. Note that the icon is still defined as
`ICON_LIBRARY_DATA_INDIRECT` (or `LIBRARY_DATA_INDIRECT` in BPY).
2022-03-29 14:36:06 +02:00
62c73db734 Fix T96835: Grease pencil tweak tool selects but doesn't drag
Use the pass-through matching the view3d.select operator.
2022-03-29 22:20:38 +11:00
2aa49107a2 Fix T96356: artefacts with GPU subdivision and vertex paint mask
The lines paint mask IBO extraction was not implemented for GPU subdivision.
For it to work, we also now need to preserve the subdivision loop to
subdivision edge map, which until now was overwritten to store coarse edges
(the map to coarse edges is still preserved).

Also the paint flag stored in the 4th dimension of the loop normal buffer
was not properly set for flat shaded faces, leading to other kind of
artefacts and render issues.
2022-03-29 12:04:51 +02:00
17757eabc7 Cleanup: Remove commented lines of previous commit 2022-03-29 11:28:38 +02:00
9450057b43 Fix T96799: GPencil weight_get API cannot retrieve weights
The problem was when the stroke had less weights that the total number of vertex groups.

The API checked the total number of groups, but this is not required because `BKE_defvert_find_index` returns NULL is the vertex group index does not exist.
2022-03-29 11:26:13 +02:00
31bcab0ecb Fix (unreported) LibOverride: re-creation of overrides in consecutive partial overrides of a same hierarchy.
If creating partial hierarchy overrides (from the outliner e.g.), that
need to create extra overrides, those could be re-created everytime,
leading to very bad situation where there would be several overrides of
the same reference ID in the same override hierarchy.

This fix makes it so that existing overrides in a given hierarchy will
always be re-used in case other overrides are added to the hierarchy.
2022-03-29 11:21:39 +02:00
c772461741 Cleanup: Use higher level semantic for zeroing DNA objects in C++
Replaces old-style memzero-style of call with zero-initializer.
Allows to shorten typical initialization code to a single line:

  Object foo = blender:🧬:shallow_zero_initialize<Object>()

This will allow to more easily convert designated initializer
which is often used to fill object with zeroes to the explicit
function calls:

  MyDNAStruct foo = {};

will be translated to

  MyDNAStruct foo = blender:🧬:shallow_zero_initialize<MyDNAStruct>();

Differential Revision: https://developer.blender.org/D14486
2022-03-29 11:04:50 +02:00
a264dff4fa BLI: optimize Map/Set/VectorSet.clear methods
Previously, those methods would destruct and reconstruct
the data structure. While that was more simple in initial
implementation, it has some downsides which are not resolved:
* Already allocated memory is lost. So new memory would have
  to be allocated when the data structure is refilled.
* The clearing process itself was slower because it did unnecessary
  work.
2022-03-29 10:41:01 +02:00
29d9bb89ce Cleanup: Remove redundant DNA C++ helper function
Use shallow_copy, no need in copy_memory.

The latter appeared as some last minute solution for a compilation
warning on Friday.
2022-03-29 10:14:57 +02:00
3c6c15d676 Functions: move loops into function builders
This simplifies debugging, and can help improve performance
by making it easier for the compiler.

More optimization might still be possible by using `__restrict` in
a few places.
2022-03-29 10:11:49 +02:00
c55afdf30b BLI: add utility to convert IndexMask to best mask type 2022-03-29 10:07:18 +02:00
7bd614d431 Cleanup: use value initialization instead of copying default value
Value-initialization has the potential to be more efficient.
Also, the code becomes simpler.
2022-03-29 09:29:09 +02:00
d7c6442118 BLI: support value initialization in CPPType
Value initialization differs from default-construction in that it
also zero-initializes trivial types.
2022-03-29 09:29:09 +02:00
d4bdf21929 Fix T96701: RMB select fails to show gizmo on mouse button release
Regression in [0] which removed a special check when tweak events ended.
Add a similar check for drag events that runs drag is disabled in the
main event handling loop.

[0]: 4986f71848
2022-03-29 16:56:55 +11:00
540bfbbb27 Fix T96582: Wipe effect not working
Caused by oversight in 0e38002dd5. Constant x/y value was used to
calculate transition instead of pixel x/y coords.
2022-03-29 05:07:58 +02:00
e74420124f Fix T96699: Splitting strip does not copy animation
Since e49bf4019b, animation is handled explicitly. Split operator
wasn't updated.

Re-use backup-duplicate-restore animation functions, that other
operators use for splitting.
2022-03-29 04:19:27 +02:00
f99beb730a Fix T96347: Pose gizmo shown at wrong location with multiple objects
Regression in [0] error iterating over pose bones which only used the
active-object, also follow the same logic as edit-mode for using the
local-matrix.

[0]: d052169e7e
2022-03-29 12:57:33 +11:00
87d9d33c00 Fix T96691: Heap corruption in file_browse_exec
Regression in [0], also use pad buffer by 1 instead of 2 which is no
longer needed as the trailing slash is no longer added
after allocating the string.

0682af0d63
2022-03-29 11:39:22 +11:00
27424b758a Cleanup: Move two grease pencil files to C++
This is meant to allow using C++ data structures in this file
as a performance improvement. Particularly `Vector` instead
of `ListBase` for `duplilist`. This changes builds on all
platforms on the buildbot.
2022-03-28 16:29:36 -05:00
fc288d3970 Cleanup: Move scene.c to C++
This is meant to allow using C++ data structures in this file
as a performance improvement. Particularly `Vector` instead
of `ListBase` for `duplilist`. This change builds and passes
tests on all platforms on the buildbot.
2022-03-28 15:53:19 -05:00
c9f54cd644 Cleanup: Use const mesh arguments
Also correct an enum value from review of D14475.
2022-03-28 15:12:30 -05:00
037f789111 Cleanup: Move transform_snap_object.c to C++
This is meant to allow using C++ data structures in this file
as a performance improvement. Particularly `Vector` instead
of `ListBase` for `duplilist`.

Differential Revision: https://developer.blender.org/D14475
2022-03-28 14:59:42 -05:00
21e72496a6 Fix T96728: 'Automatic Constraint' using the wrong orientation
If the `Automatic Constraint` modifier was activated while an axis
constraint was already set, the orientation used would be the default
orientation of the mode and not that of the scene.

This was because the `initSelectConstraint` function was not called in
this case and the `Automatic Constraint` mode was enabled by other
indirect means.

So the solution is to call `initSelectConstraint` in either case and
remove these "indirect means" of enabling `Automatic Constraint`.
2022-03-28 14:21:33 -03:00
df4d6c22cf Transform: avoid excessive recalculation with 'TREDRAW_SOFT'
Contrary to the initial intention (in rB9916e0193c36), `TREDRAW_SOFT`
flag, when isolated, is not cleared in `transformApply` and therefore is
used in the `drawTransformApply` callback which basically recalculates
the `transformation` which finally clears the flag.

So remove the `drawTransformApply` callback so `transformApply` is not
called when unnecessary.

Differential Revision: https://developer.blender.org/D14430
2022-03-28 14:18:56 -03:00
854af0cd09 Cleanup/Refactor: remove unused 'SNAP_ONLY_ACTIVE' enum parameter
`SNAP_ONLY_ACTIVE` was implemented in order to be used in the Knife tool,
but the project did not go ahead.
2022-03-28 13:55:13 -03:00
39df927b4a Transform: Improve 'absolute grid snap' support detection
The solution supposedly listed all cases that `absolute grid snapping`
was supported. But it ignored some occasions like: Editing Surface
objects, Texture Space.

List now only the cases where this feature should not be supported.
2022-03-28 13:55:13 -03:00
4c66021ccc Cleanup: transform, use early returns
This makes the flow clearer and avoids many `else` conditions.
2022-03-28 13:55:12 -03:00
8b5292a60e Outliner: Don't show indirectly linked Library Overrides properties
The Library Overrides display mode is meant to show overridden
properties from the current file only, not library overrides in
data-blocks that just were linked in. The upcoming Hierarchies view mode
for Library Overrides will also display linked in data-blocks that have
overrides in the source file (but not the individual overridden
properties), see T95802.
2022-03-28 18:03:57 +02:00
2e99295d5e Fix T96812: Regression: Snapping is broken with proportional editing
This was a mistake in the conditional structure introduced in 4b35d6950d

This commit also adds a new type of snap exclusion: `SNAP_NOT_EDITED`.

Thanks to @Ethan1080 for pointing out the error.
2022-03-28 11:26:48 -03:00
e6dfe570cc Fix T96828: GPencil primitives handlers not working
Following the logic is not necessary to check the mouse button because the status has changed before.
2022-03-28 13:11:07 +02:00
555e7c2091 Cleanup: Use bool literals in return statements of text editor poll functions. 2022-03-28 12:11:44 +02:00
da130d751f Fix various UI messages issues. 2022-03-28 10:40:14 +02:00
587efa9949 Fix (unreported) crash in some mesh-from-object code.
Crashed e.g. FBX exporter.

Mistake in rB0c33e84020deca.
2022-03-28 09:53:17 +02:00
af1341322f Fix T96670: bake from multires not reflected in the Image Editor. 2022-03-28 08:28:09 +02:00
387b34f0c2 Cleanup: return success from python_script_error_jump
Relying on checks for the assignment of return arguments isn't so
clear especially when there are multiple return arguments.
2022-03-28 17:15:41 +11:00
1466f480c4 Python: select the start-end range of syntax errors
Python 3.10's syntax errors can specify a range.
Use this for text editor error selection.
2022-03-28 17:06:38 +11:00
0ce6ed4753 Cleanup: variable/argument naming for Python exception access
Names filename/filepath/fn were used interchangeably.
2022-03-28 16:54:31 +11:00
3ea90de9e6 Fix text editor failure to move the cursor for syntax errors
This broke between 3.0 and 3.1, upgrading to Python 3.10 seems the
likely cause as this code didn't change.
2022-03-28 16:44:25 +11:00
e8fd2d8469 Cleanup: early exit when there is no exception
Reduces noise in D9752, no functional change as PyErr_NormalizeException
doesn't do anything when there is no exception set.
2022-03-28 15:06:47 +11:00
6f305577b3 Cleanup: use "num" as a suffix in: source/blender/modifiers
Also rename DNA struct members.
2022-03-28 14:41:31 +11:00
24839fdefa Cleanup: use "num" as a suffix in: source/blender/nodes 2022-03-28 14:14:31 +11:00
556384ca1d Cleanup: use "num" as a suffix in: source/blender/render
See T85728
2022-03-28 14:14:31 +11:00
83c274ccfc Cleanup: use "num" as a suffix in: source/blender/python
See T85728
2022-03-28 14:14:31 +11:00
77155ae1c0 Cleanup: Reduce duplication to prepare for UDIM packing
In preparation for supporting packing of UDIM tiled textures, this patch
refactors a small portion of image.cc. The refactor should lead to less
duplicate code now and when Tiled images are added in the near future.

This patch is based on the prior work done for D6492 where it was
requested this part be split and can be summarized as follows:
 - `load_sequence_single` is removed and merged with `load_image_single`
 - `image_load_sequence_file` is removed and merged with `image_load_image_file`

Reviewed By: lukasstockner97

Differential Revision: https://developer.blender.org/D14327
2022-03-27 17:49:26 -07:00
e2e4c1daaa OBJ: use fmt library instead of sprintf for faster formatting
On Windows/MSVC this gives a minor (~20%) speedup presumably due to a faster float/int formatter. On macOS (Xcode13), this gives a massive speedup, since snprintf that is in system libraries ends up spending almost all the time inside some locale-related mutex lock.

The actual exporter code becomes quite a bit smaller too, since it does not have to do any juggling to support std::string arguments, and the buffer handling code is smaller as well.

Windows (VS2022 release build, Ryzen 5950X 32 threads) timings:
- Blender 3.0 splash scene (2.4GB obj): 4.57s -> 3.86s
- Monkey subdivided level 6 (330MB obj): 1.10s -> 0.99s

macOS (Xcode 13 release build, Apple M1Max) timings:
- Blender 3.0 splash scene (2.4GB obj): 21.03s -> 5.52s
- Monkey subdivided level 6 (330MB obj): 3.28s -> 1.20s

Linux (ThreadRipper 3960X 48 threads) timings:
- Blender 3.0 splash scene (2.4GB obj): 10.10s -> 4.40s
- Monkey subdivided level 6 (330MB obj): 2.16s -> 1.37s

The produced obj/mtl files are identical to before.

Reviewed By: Howard Trickey, Dalai Felinto

Differential Revision: https://developer.blender.org/D13998
2022-03-27 14:25:48 +03:00
3e12488b4e Cleanup: Remove frameserver cmake definition
Left over from rBaab5ac25f2c2e6fbc50f9fb352e71ef0ae0ba2f1
2022-03-26 21:59:22 -04:00
Lictex Steaven
08d2428632 GPencil: Add an xray toggle for each annotation layer
so a layer can be occluded by the scene instead of always showing in front

---

{F12827163}

Reviewed By: fclem, antoniov

Differential Revision: https://developer.blender.org/D13931
2022-03-26 18:26:43 +01:00
082b063f2a Increase bevel segment limit in modifier from 100 to 1000.
A user asked for this increase. The performance lags when reaching
the upper limit of this number of segments, but if you need that
many segments, I guess you are willing to wait.
2022-03-26 13:20:16 -04:00
ffafe494f6 Cleanup: Remove double #ifdef WITH_TBB check 2022-03-26 09:55:08 -06:00
9d25418a52 Fix T95901: Crash in Fill curve (set to N-gon)
The code that eats away faces until you find input faces in
the Constrained Delaunay Triangulation goes too far and crashes
when there are no input faces. In the test case there were input
faces but they only had two vertices, so were all ignored.
2022-03-26 10:47:09 -04:00
4039e94422 Fix T96790: Gpencil Inverted Fill makes extra stroke at origin
The problem was the stroke was created in the inverted loop before checking if the total of points is 0 and exit the loop.

Also some code Cleanup.
2022-03-26 13:20:46 +01:00
23bbc0d748 DRW: Port draw_common.c to use shared definition with GLSL 2022-03-26 13:16:01 +01:00
6073b6b874 GPU: ShaderBuilder: Skip shader compilation for unsupported shaders. 2022-03-26 13:16:01 +01:00
ab97add5fa GL: Fix shader error logging on Apple M1 hardware 2022-03-26 13:16:01 +01:00
664eb19369 GPU: ShaderBuilder: Fix compilation on Mac
This is less than ideal as it seems to link against all
of blender disregarding the stubs.
2022-03-26 13:16:01 +01:00
9c41767d57 Cleanup: move eFileSel_Action from DNA to WM_api.h
This isn't stored in blend files so it can be moved out of DNA.

Also use an enum for `WM_FILESEL_*` members.
2022-03-26 18:42:33 +11:00
4d5e8e5477 Fix incorrect argument for rigid-body world export 2022-03-26 18:36:28 +11:00
c01afe9562 Cleanup: use "use_" prefix for booleans 2022-03-26 18:04:27 +11:00
c330c7a5da Cleanup: quiet compiler warning 2022-03-26 18:04:19 +11:00
1909fd2781 Windows/Installer: Fix capital B in shortcut
the shortcut placed on the desktop and in the start
menu on windows were labelled `blender` rather than `Blender`

spotted by @Severin
2022-03-25 15:17:48 -06:00
6bf51ab03a CMake: Give some extra space to info_cfg_option
WITH_PYTHON_INSTALL_ZSTANDARD was too long and
didn't align very well compared to the other
items in the list.
2022-03-25 14:33:39 -06:00
ba49345705 Fix Outliner highlighting multiple base elements in different libraries
In the Blender File display mode of the Outliner, mouse hovering a
"base" element (e.g. "Objects", "Materials", ...) would also highlight
that same base element in other libraries linked into the scene. In fact
operations like (un)collapsing would be applied to both too.
Issue was that we'd always use the listbase containing the data-blocks
from the current main as a way to identify the tree element. So for the
same data-block types we'd use the same listbase pointers. Instead use
the the library pointer + a per library index.
2022-03-25 19:00:04 +01:00
2631b44e71 MSVC: Fix linker issue with USD
USD requires to be linked with /WHOLEARCHIVE so
the linker won't remove their static initializers.

This strangely has never worked for MSVC since
the flags were set on the LINK_FLAGS property
which is only used to link .dll and .exe files,
given this is a static lib, the flags were not
used, nor did CMake propagate the link directive
to the final targets that did link. Not quite sure
how this has not lead to more problems in the past.

Setting the link directive on the INTERFACE_LINK_OPTIONS
makes cmake do the right thing.

Differential Revision: https://developer.blender.org/D14394
Reviewed by: sybren
2022-03-25 10:15:11 -06:00
19bcfba56f USD I/O: explicitly set or clear the OPTYPE_UNDO flag
Exporting USD cannot be undone, but importing should be undo'able.
2022-03-25 16:53:17 +01:00
2fc77071b5 Image editor: not updating after image operation.
Fixes T96324, T96312, T96323
2022-03-25 16:36:50 +01:00
c671a26637 USD: Support building against USD 21.11+
For 3.2 USD will be bumped to a newer version with some
slight API changes, however since we cannot simultaneously
land the libs for all platforms as well as these code changes,
we'll have to support both 21.02 and 21.11+ for at least a
short period of time making the code slightly more messy than
it could have been.

Differential Revision: https://developer.blender.org/D14184
Reviewed by: sybren
2022-03-25 09:29:39 -06:00
378022c797 BLI: Adjust interpolation to support integers, other tweaks
In order to allow interpolation of integers with a float, add a separate
template parameter for the factor and multiplication types.
Also move some helper constexpr variables to the "base" header
(reversing the dependency to "base" -> "vector").

This also adds a distance function for scalar types, which is
helpful to allow sharing code between vectors and basic types.

Differential Revision: https://developer.blender.org/D14446
2022-03-25 09:57:10 -05:00
1243cb803e Cleanup: Add asserts, remove default case 2022-03-25 09:12:31 -05:00
cea51c1bb5 Curves: Bezier and general interpolate to evaluated utility
This commit implements generic evaluation for Bezier curves (which is
really just linear interpolation, since attributes are not stored on
Bezier handles). For complete parity with the old curve type, we would
have to add options for this (RNA: `Spline.radius_interpolation`),
but it's not clear that we want to do that.

This also adds a generic `interpolate_to_evaluate` utility on curves
that hides the implementation details. Though there is theoretically
a performance cost to that, without some abstraction calling code
would usually be too complex.

Differential Revision: https://developer.blender.org/D14447
2022-03-25 09:03:35 -05:00
c0016d85b2 Curves: Add a utility to count curves of each type
This commit adds a utility that returns an array with the number
of curves of every type. One use case for this is detecting whether
to remove handle or NURBS attributes when changing curve types.
It's best to avoid using this when it's not necessary, but sometimes
it can't really be avoided, and having a utility at least makes using
an optimized version simple.

In the future, this information can be cached in the curves runtime.

Differential Revision: https://developer.blender.org/D14448
2022-03-25 09:00:30 -05:00
59de9ceda0 MSVC: Fix build issue with webp
The webp variables should only be set if
the libs actually exist in the lib folder
2022-03-25 07:31:15 -06:00
97f2210157 GPencil: Cyclic flag for dot dash modifier
Cyclic option per segment, allows interesting "loop" visual effects.

Reviewed by: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D14439
2022-03-25 20:13:50 +08:00
Henrik Dick
d4e1458db3 GPencil: Improve smooth operation
This patch makes the grease pencil smooth operation symmetric.
It also increases the performance a lot if strong smoothing is
required. Additionally there is an option for the position smooth
operation to keep the shape closer to the original for more iterations.

Since the result differs from the previous algorithm, versioning is used
to change the iterations and factor to match the old result.

Differential Revision: http://developer.blender.org/D14325
2022-03-25 11:51:45 +01:00
0c33e84020 Fix compilation warnings after previous change
Thanks Jacques for finding solution for deprecation warning
which was generated by GCC for constructor.

The rest of the change is related on fixing memaccess warning
which was happening when memset/memcpy was used directly on
the DNA object pointer. Now there are two utility functions
for this:

- blender:🧬:zero_memory
- blender:🧬:copy_memory
2022-03-25 11:45:50 +01:00
03df72ee4e Implement C++ methods for DNA structures
This change makes it possible to add implementation of common
C++ methods for DNA structures which helps ensuring unsafe
operations like shallow copy are done explicitly.

For example, creating a shallow copy used to be:

  Object temp_object = *input_object;

In the C++ context it was seen like the temp_object is
properly decoupled from the input object, while in the
reality is it not. Now this code becomes:

  Object temp_object = blender:🧬:shallow_copy(*input_object);

The copy and move constructor and assignment operators are
now explicitly disabled.

Other than a more explicit resource management this change
also solves a lot of warnings generated by the implicitly
defined copy constructors w.r.t dealing with deprecated fields.
These warnings were generated by Apple Clang when a shallow
object copy was created via implicitly defined copy constructor.

In order to enable C++ methods for DNA structures a newly added
macro `DNA_DEFINE_CXX_METHODS()` is to be used:

  tpyedef struct Object {
    DNA_DEFINE_CXX_METHODS(Object)
    ...
  } Object;

For the shallow copy use `blender:🧬:shallow_copy()`.

The implementation of the memcpy is hidden via an internal DNA
function to avoid pulling `string.h` into every DNA header.
This means that the solution does not affect on the headers
dependencies.

---

Ideally `DNA_shallow_copy` would be defined in a more explicit
header, but don;t think we have a suitable one already. Maybe
we can introduce `DNA_access.h` ?

Differential Revision: https://developer.blender.org/D14427
2022-03-25 11:45:50 +01:00
75b8c4fc18 LibOverride: Prevent some more potential modification of overridden collections. 2022-03-25 11:39:06 +01:00
484af996aa Revert "Implement C++ methods for DNA structures"
This reverts commit 8c44793228.

Apparently, this generated a lot of warnings in GCC.

Didn't find a quick solution and is it not something I want to be
trading between (more quiet Clang in an expense of less quiet GCC).

Will re-iterate on the patch are re-commit it.
2022-03-25 10:57:13 +01:00
8c44793228 Implement C++ methods for DNA structures
This change makes it possible to add implementation of common
C++ methods for DNA structures which helps ensuring unsafe
operations like shallow copy are done explicitly.

For example, creating a shallow copy used to be:

  Object temp_object = *input_object;

In the C++ context it was seen like the temp_object is
properly decoupled from the input object, while in the
reality is it not. Now this code becomes:

  Object temp_object = blender:🧬:shallow_copy(*input_object);

The copy and move constructor and assignment operators are
now explicitly disabled.

Other than a more explicit resource management this change
also solves a lot of warnings generated by the implicitly
defined copy constructors w.r.t dealing with deprecated fields.
These warnings were generated by Apple Clang when a shallow
object copy was created via implicitly defined copy constructor.

In order to enable C++ methods for DNA structures a newly added
macro `DNA_DEFINE_CXX_METHODS()` is to be used:

  tpyedef struct Object {
    DNA_DEFINE_CXX_METHODS(Object)
    ...
  } Object;

For the shallow copy use `blender:🧬:shallow_copy()`.

The implementation of the memcpy is hidden via an internal DNA
function to avoid pulling `string.h` into every DNA header.
This means that the solution does not affect on the headers
dependencies.

---

Ideally `DNA_shallow_copy` would be defined in a more explicit
header, but don;t think we have a suitable one already. Maybe
we can introduce `DNA_access.h` ?

Differential Revision: https://developer.blender.org/D14427
2022-03-25 10:37:56 +01:00
315210c22b XR: Fix crash on executing some action operators
Since the XR area does not have any region geometry, hud updates from
operators would cause invalid access when updating region sizes.
2022-03-25 13:22:04 +09:00
93f2ebe7dd Cleanup: use doxy sections for customdata.cc 2022-03-25 14:54:16 +11:00
8ed4638960 Fix: Small fixes for NURBS evaluation
Clear the nurbs basis cache dirty flag when its evaluation finishes.
Remove an incorrect assert that the evaluated size couldn't be zero.
It can, when `check_valid_size_and_order` returns false.
2022-03-24 22:31:50 -05:00
9b2879f8b3 Cleanup: Simplify logic, rename variables
Return the map of gathered attributes directly, use simpler
naming for "attributes" and "gathered_attributes".
2022-03-24 22:29:23 -05:00
83c99ccb21 Cleanup: Use more specific variable name 2022-03-24 22:17:54 -05:00
797a1356ca Curves: Tweak evaluated offset functions
Add a function to retrieve the points for an index range of curves,
and move "ensuring" the offsets to a separate function, since it's
often nicer to call that if you don't need the result span immediately.
2022-03-24 20:58:01 -05:00
6e72e3fdb2 Cleanup: Further renaming in new curves code
A follow-up to e253f9f66d. Follow the policy from T85728
completely (using "num" as a prefix) and rename another function.
2022-03-24 20:48:08 -05:00
d3999683ff WebP: Fix use after free 2022-03-24 21:21:18 -04:00
6e86cf0daa Docs: include WEBP in --help text 2022-03-25 12:10:30 +11:00
2eeb79805c Cleanup: remove argument to doxygen \file
Doxygen doesn't require this to be set.
2022-03-25 12:10:30 +11:00
1ba20947cc Cleanup: rename CustomDataExternal.filename => filepath
Reserve "filename" when only the name component is used.
2022-03-25 12:10:30 +11:00
7d1d9e6015 Cleanup: rename ParticleSettings.child_nbr => child_percent
child_nbr was used as a percentage as well as the final
number of particles. Rename to avoid confusion.
2022-03-25 12:10:21 +11:00
4d46fac65d Cleanup: use count or num instead of nbr
Follow conventions from T85728.
2022-03-25 12:04:20 +11:00
c594cfbe50 Cleanup: use array syntax for sizeof, zero before float suffix 2022-03-25 12:04:19 +11:00
bbd787275f Cleanup: spelling in comments, strings 2022-03-25 12:04:16 +11:00
1d2dfc5e9e Cleanup: sort cmake file lists 2022-03-25 12:04:14 +11:00
a446c53f16 Cleanup: unused warnings 2022-03-25 12:04:12 +11:00
d3a1e9cbb9 Geometry Nodes: Multi-thread creation of selection from field
When boolean fields are evaluated and used as selections, we create
a vector of indices. This process is currently single-threaded, but
226f0c4fef added a more optimized multi-threaded version
of this process. It's simple to use this in the field evaluator.

I tested this with the set position node and a random
value node set to boolean mode on a Ryzen 2700x:
|              | Before  |  After  | Improvement |
| 10% Selected | 40.5 ms | 29.0 ms | 1.4x        |
| 90% Selected | 115 ms  | 45.3 ms | 2.5x        |

In the future there could be a specialized version for non-span
virtual array selections that uses `materialize` to lower virtual
call overhead.

Differential Revision: https://developer.blender.org/D14436
2022-03-24 18:48:38 -05:00
b030ec8760 BLF Cleanup: Use FreeType Enum FT_Err_Ok
Replace comparisons of FT_Error against 0 with FT_Err_Ok instead.

See D14052 for more details.

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

Reviewed by Campbell Barton
2022-03-24 16:20:10 -07:00
4fd0a69d7b ImBuf: Add support for WebP image format
Currently only supports single image frames (no animation possible).

If quality slider is set to 100 then lossless compression will be used,
otherwise lossy compression is used.

Gives about 35% reduction of filesize  save when re-saving splash screens with lossless
compression.
Also saves much faster, up to 15x faster than PNG with a better compression ratio as a plus.

Note, this is currently left disabled until we have WebP libs (see T95206)

For testing precompiled libs can be downloaded from Google:
https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html

Differential Revision: https://developer.blender.org/D1598
2022-03-24 18:24:06 -04:00
Jesse Yurkovich
07846b31f3 Cleanup: Optimize viewport view data creation
Each time the user clicks the viewport 2 sets of engine views are
created. Each set is currently composed of 8 view objects, each of size
592 bytes.

Because space is not reserved in the vector that holds them, several
unnecessary re-allocation/copy cycles occur as the vector resizes and
the total allocation load is 8880 bytes. This happens twice.

Reduce to just the allocations necessary and with exactly 4736 bytes
allocated for each set
 - Before: 8 allocations and 8 deallocations totaling 17760 bytes
 - After: 2 allocations and 2 deallocations totaling 9472 bytes

Reviewed By: fclem, jbakker

Differential Revision: https://developer.blender.org/D13782
2022-03-24 21:26:11 +01:00
3c4947cdaa Fix T96756: Blender hanges on rendering after file save, after recent changes 2022-03-24 19:42:59 +01:00
9ef400ddf7 Cycles: don't write light passes for shadow catcher objects
Makes it easier to composite the Combined image from these passes.

Fixes T96758
2022-03-24 19:42:59 +01:00
4a1b0ea902 Fix T94001: OpenColorIO configuration with 1D textures not working 2022-03-24 19:42:59 +01:00
067d0d4466 Fix: Missing "Hair" to "Curves" rename
Missed in fe1816f67f
2022-03-24 13:10:16 -05:00
fb3a0a34b4 Fix: Build error with flag usage and strict warnings 2022-03-24 12:54:30 -05:00
a6214ce7ac Outliner: Don't show empty base elements in the library overrides mode
In the library overrides mode, in some situations there would be empty
base elements like "Collections" or "Objects". Don't show them, it's
confusing wihout use. Code just failed to consider that case.
2022-03-24 18:38:21 +01:00
511dfb7743 Outliner: Don't draw library overrides indicator for override buttons
All the buttons in the Library Overrides display mode would be shown in cyan,
indicating that they are library overrides. Given that this is solely what this
display mode is about, the indicator is just redundant, confusing (why are the
buttons purple?) and looks weird.

Part of T95802.

Reviewed by: Bastien Montagne

Differential Revision: https://developer.blender.org/D14416
2022-03-24 18:17:44 +01:00
ef228d92f2 Fix: Volume grid duplication on USD import.
Fix provided by Piotr Makal in patch D14204.

This patch fixes volume grid duplication which was occurring during
importing USD files. This was caused by calling BKE_volume_grid_add
twice per grid (excluding 'density' grid) for the same Volume
object: (1) in USDVolumeReader::read_object_data and (2) later in
BKE_volume_load.

Differential Revision: https://developer.blender.org/D14204
2022-03-24 12:42:11 -04:00
Lictex Steaven
db4d5d1583 Fix T90110: Dupli Window Not Immediately Active
When creating a new window from a duplicated area - by shift-dragging
on corner action zones - on the Windows platform the resulting window
is initially unresponsive. This patch fixes this by releasing the parent
window's mouse capture.

See D14085 for more details.

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

Reviewed by Ray Molenkamp
2022-03-24 09:41:29 -07:00
dcb520a7af Outliner: Remove list of library overrides from general display modes
There is a dedicated Library Override display mode now, and showing
these elsewhere just adds noise and makes the code problematic to
maintain (since the same element hierarchy will be used in two entirely
different contexts). The corresponding filter settings are removed too.

Part of T95802.

Reviewed by: Bastien Montagne

Differential Revision: https://developer.blender.org/D14411
2022-03-24 17:25:24 +01:00
1ff853a3f0 Outliner: Don't display library overrides from linked files
Instead of having the "Current File" and then the individual libraries
containing indirect library overrides in the Library Overrides display
mode, only show what's in the current file. Agreement was that this
isn't very useful in this view, we may want to add it to the Hierarchy
view though (see T95802).

Part of T95802.

Also expands the top level ID type items ("Objects", "Materials", ...)
by default. See D14410 for details.

Reviewed by: Bastien Montagne

Differential Revision: https://developer.blender.org/D14410
2022-03-24 17:22:37 +01:00
00018bfaa2 Tracking: Fix incorrect angle calculation on marker slide
Now the mouse cursor will exactly follow the tilt/scale sliding area.
2022-03-24 16:56:31 +01:00
dd7250efb1 Tracking: Fix jump when sliding tild/scale of marker
Was a mistake in coordinate handling: need to take possible offset
from the sliding area.

Mouse us still not fully perfectly follows changes of the tilt slide
area, but that is a separate issue.
2022-03-24 16:21:59 +01:00
Henrik Dick
cee6af0056 GPencil: New Envelope Modifier
This new modifier creates a shape known as envelope. It connects all
points that are n points apart. There is also a mode which fits a
single stroke to the envelope shape that is determined by that rule.

For more details, refer to the patch.

Reviewed By: NicksBest, antoniov, frogstomp, mendio

Differential Revision: http://developer.blender.org/D14341
2022-03-24 13:01:46 +01:00
Henrik Dick
dd161ff7a4 Complex Solidify: handle vertex creases
This implements the same interpolation method as for bevel weights
now for vertex and edge creases as well to improve the flexibility.

Differential Revision: http://developer.blender.org/D14170
2022-03-24 12:30:48 +01:00
4a674d08dd Outliner: tweak handling of liboverrides in delete code.
Essentially, we only allow deletion of hierarchy roots of liboverrides,
when hierarchy deletion option is enabled.

Also add some checking code in the generic, non-object/collection ID
delete code, to prevent any deletion of liboverrides that would be part
of a hierarchy.
2022-03-24 12:01:48 +01:00
24c30e001f 3D View: preference to disable selection cycling on first click
Object mode selection does a kind of cycling that excludes the active
selected object. This is separate from regular selection cycling which
is enabled when clicking multiple times without moving the cursor.

This has the down-side that clicking on an object to drag it always
selects the object behind it (in the case of overlapping objects).

Since object mode selection is fundamental functionality, this is
exposed as an experimental preference for user feedback & testing.

See T96752 for details.
2022-03-24 21:48:22 +11:00
643da14a4e Fix make source_archive_complete for release branches
In Blender 3.1 we can't run the source_archive_complete because the
cmake program is trying to download the packages from svn trunk. However
3.2 (aka master) already changed the version of some of the source
packages.

For example the OpenXR-SDK. It should be looking for
OpenXR-SDK-1.0.17.tar.gz in:
https://svn.blender.org/svnroot/bf-blender/tags/blender-3.1-release/lib/packages/

But instead it tries to look for it in:
https://svn.blender.org/svnroot/bf-blender/trunk/lib/packages/

Which can't be found since it was replaced with OpenXR-SDK-1.0.22.tar.gz

---

Release checklist: https://wiki.blender.org/wiki/Process/Release_Checklist

The release checklist was updated to include the new instructions:
`In the release branch, update and uncomment BLENDER_VERSION in download.cmake`

Differential Revision: http://developer.blender.org/D14292
2022-03-24 11:39:34 +01:00
Henrik Dick
acd7a648b1 GPencil: Add Scale Thickness to Pivot Point Pie Menu similar to Only Locations
In my opinion Scale Thickness feels similar to Only Locations and was missing from the pie menu in grease pencil edit mode, so here I added it.

Differential Revision: https://developer.blender.org/D12530
2022-03-24 11:22:33 +01:00
a2c2f6a39e Correct syntax error for MSVC 2022-03-24 21:13:58 +11:00
7a028330d2 Cleanup: clang-format 2022-03-24 11:01:12 +01:00
Henrik Dick
8d4244691a GPencil: lower bounds for gap in dot dash modifier
This patch maximizes the possible bounds for the dash and
gap parameters in the dot dash modifier. This makes e.g.
chopping up lines without gaps possible.

Differential Revision: http://developer.blender.org/D14428
2022-03-24 10:51:14 +01:00
bc290b47cd Keymap: experimental preference always use "Mouse Select & Move"
This was already as a preference for the tweak tool,
this preference enables the option for all selection
in the 3D view & UV editor.

This extends on changes from T96544.
2022-03-24 20:45:13 +11:00
e006e66084 Cleanup: use struct member identifiers for initialization
Relying on the order of struct members can be error prone. Update other
instances of ObjectsVisibleIteratorData initialization for MSVC/C++.
2022-03-24 17:30:45 +11:00
4682a0882f Cleanup: use "filepath" instead of "filename" for full paths
Reserve "filename" when only the name component is used.
2022-03-24 16:54:01 +11:00
5058c4b144 Cleanup: localize finding the nearest non-active object on selection
Move this into it's own block since it only needs to run if the
nearest object is currently selected & active.
2022-03-24 15:56:05 +11:00
0ee95e83ea View 3D: Don't prioritize pose objects unless in pose-mode
Always prioritizing bones caused pose-objects to be selected in object
mode even if they were behind other objects.

Now prioritizing pose bones is limited to pose mode.
2022-03-24 15:56:05 +11:00
3e5e204c81 3D View: order by depth when selecting cycles through objects
When cycling through objects select the nearest first
instead of using the order of object-bases in the view_layer.

This matches how pose selection works.
2022-03-24 15:56:05 +11:00
e67cd1f9a8 Cleanup: remove redundant argument for key-map selection template 2022-03-24 15:56:05 +11:00
6d61cf4e80 Cleanup: Typo, improve variable names
`accumulate_counts_to_offsets` wasn't just used for the point domain.
2022-03-23 23:50:10 -05:00
7ef3a1a6e6 BLI: Add utility for tacking average and min runtime
This is useful to save time manually averaging many timing results.
The minimum is included because often it can be more stable than an
average, and it can help to expose calls from other contexts with lower
times that would make the average useless.

Differential Revision: https://developer.blender.org/D14417
2022-03-23 23:35:23 -05:00
610ec34c1f Geometry Nodes: Improve performance writing to vertex groups
In a test file from T96282, this commit reduces the runtime of the
delete geometry node from 82 ms to 23 ms, a 3.6x improvement.
Writing to vertex groups in other cases should be faster too.

The largest improvement comes from not writing a new weight
of zero if the vertex is not in the group. This mirrors the behavior
of custom data interpolation in `layerInterp_mdeformvert`.
Other improvements come from using `set_all` for writing
output attributes and implementing that method for vertex groups.

I also implemented `materialize` methods. Though I didn't obverse
an improvement from this, I think it's best to remove virtual method
call overhead where it's simple to do so.

The test file for the delete geometry node needs to be updated.
These methods could be parallelized too, but better to do that later.

Differential Revision: https://developer.blender.org/D14420
2022-03-23 23:27:26 -05:00
aeb2c2afaf Cleanup: Clang tidy
- Deprecated headers
- Else after return
- Inconsistent parameter names (I used the most recently modified)
- Raw string literals
2022-03-23 23:24:54 -05:00
e253f9f66d Cleanup: Adjust naming in new curves code
Rename "size" variables and functions to use "num" instead,
based on T85728 (though this doesn't apply to simple C++
containers, it applies here). Rename "range" to "points" in
some functions, so be more specific.

Differential Revision: https://developer.blender.org/D14431
2022-03-23 23:05:46 -05:00
a1598d6835 UDIM: Improve tile format detection in filenames
There are some filenames where the UDIM pattern guessing would fail
unnecessarily. The user can fix these up afterwards but it would be
nicer if they would detect properly in the first place.

Examples:
`test.1001.ver0023.png` would guess wrong since it uses the image
sequence detection code which finds the first sequence from the end. It
would guess `filename.1001.ver<UDIM>.png`

`uv-test.u1_v2.png` would fail detection due to a bug in the processing.

Make this much more reliable and add tests for the most important tile
related get/set/detection functions.

Differential Revision: https://developer.blender.org/D14320
2022-03-23 21:01:36 -07:00
ead2c71a90 Cleanup/fix wrong enum items for object.gpencil_modifier_add
No functional changes as the actual list used for display is generated
at runtime via a callback.
2022-03-24 03:43:41 +01:00
ead9ed7e16 Cleanup: extra property update for ShaderFxGlow.opacity 2022-03-24 03:25:10 +01:00
98d4872d7f Cleanup: remove debug prints 2022-03-24 01:35:27 +01:00
Brian Savery
c46e58817c Cycles: enable HIP for Vega and Vega II (Radeon 7) GPUs on Windows
Basic testing on windows only so far. Will need some testing on Linux as well
when the Linux enablement patch is ready.

Does not enable Vega APUs yet (which would be gfx902 or gfx90c).

Differential Revision: https://developer.blender.org/D14432
2022-03-24 01:12:45 +01:00
ad976c0dd7 Fix missing updates for external render engines rendering tiles
For render image buffers to be acquired, a lock must be provided. Also
fixed wrong usage of release, it must always be called regardless if the
returned image buffer is NULL.
2022-03-24 01:03:47 +01:00
51380b9346 Fix Cycles Metal build error and GCC warning after recent changes
Function overloading of make_float4() doesn't work since it's a macro, just
don't do this minor cleanup then.
2022-03-23 23:25:31 +01:00
d84b4becd3 Fix compile error on GCC
Explicit template specialization has to happen outside of class
definition (some compilers are more lenient). Since it is not possible to
specialize the method without also specializing the enclosing class for
all of its possible types, the method is moved outside of the class, and
specialized there.
2022-03-23 22:01:32 +01:00
945dfd200b Cleanup: add const qualifier
This adds a const qualifier to some code path in the Alembic and USD
importers. More could be added elsewhere. This change is done as it will
be required when GeometrySets are supported and helps keeping diff noise
in the patch to a bare minimum.
2022-03-23 21:32:09 +01:00
03a7747aa6 Cleanup: use nullptr 2022-03-23 21:32:09 +01:00
300239b01f UI: Correct error message wording
Fixes T96724
2022-03-23 16:13:09 -04:00
Yuki Hashimoto
31bfa17a1f Cleanup: delete unused ViewMapIO files in Freestyle
ViewMapIO.h is only included in Controller.cpp init_options().
However, g_models_path and g_flags set here are never used elsewhere.
Therefore, ViewMapIO files can be deleted without affecting anything.

Differential Revision: https://developer.blender.org/D14423
2022-03-23 20:06:12 +01:00
Charles Flèche
e7b1be52e0 Cycles: add Alembic procedural to Cycles standalone xml
Example:

<alembic filepath="/tmp/cube.abc" scale="1.45">
  <object path="/Cube/Cube" />
</alembic>

Differential Revision: https://developer.blender.org/D14391
2022-03-23 20:06:12 +01:00
Ethan-Hall
f5066d43ae Cleanup: use make_float4(f) zero_float4() to simplify code
Differential Revision: https://developer.blender.org/D14426
2022-03-23 20:06:12 +01:00
Ethan-Hall
4e56e738a8 Cycles: optimize CPU texture sampler interpolation
Use templates to optimize the CPU texture sampler to interpolate using
float for single component datatypes instead of using float4 for all types.

Differential Revision: https://developer.blender.org/D14424
2022-03-23 20:06:12 +01:00
d67f9820b8 Curves: improve Comb brush
New supported features:
* 3D/spherical brush that samples a good position on the curves.
* Falloff.

The custom falloff curve mapping is not yet available in the ui because that
requires some more ui reorganization. This is better done when we have
a better understanding of what settings we need exactly.

Currently, the depth of the 3d brush is only sampled once per stroke, when
first pressing LMB. Sometimes it is expected that the depth of the brush can
change within a single brush. However, implementing that in a good way
is not straight forward and might need additional options. Therefore that
will be handled separately. Some experimentation results are in D14376.

Ref T96445.

Differential Revision: https://developer.blender.org/D14376
2022-03-23 18:19:59 +01:00
5d38b13e61 CMake: Rename "USD_LIBRARY_PREFIX" to "PXR_LIB_PREFIX" for consistency
rBc1909770e7f192574ea62449dd14b4254637e604 introduced "PXR_LIB_PREFIX" for building the
dependencies, so only makes sense to use the same name in the Hydra render delegate CMake too
2022-03-23 16:52:02 +01:00
d350976ba0 Cycles: Add Hydra render delegate
This patch adds a Hydra render delegate to Cycles, allowing Cycles to be used for rendering
in applications that provide a Hydra viewport. The implementation was written from scratch
against Cycles X, for integration into the Blender repository to make it possible to continue
developing it in step with the rest of Cycles. For this purpose it follows the style of the rest of
the Cycles code and can be built with a CMake option
(`WITH_CYCLES_HYDRA_RENDER_DELEGATE=1`) similar to the existing standalone version
of Cycles.

Since Hydra render delegates need to be built against the exact USD version and other
dependencies as the target application is using, this is intended to be built separate from
Blender (`WITH_BLENDER=0` CMake option) and with support for library versions different
from what Blender is using. As such the CMake build scripts for Windows had to be modified
slightly, so that the Cycles Hydra render delegate can e.g. be built with MSVC 2017 again
even though Blender requires MSVC 2019 now, and it's possible to specify custom paths to
the USD SDK etc. The codebase supports building against the latest USD release 22.03 and all
the way back to USD 20.08 (with some limitations).

Reviewed By: brecht, LazyDodo

Differential Revision: https://developer.blender.org/D14398
2022-03-23 16:39:05 +01:00
827e9ccb29 Revert "Fix T96728: 'Automatic Constraint' using the wrong orientation"
This reverts commit 6cc83f9079.

That commit removed the feature of cancel the 'Auto Constraint'
if it is enabled without drag.
2022-03-23 12:26:58 -03:00
6cc83f9079 Fix T96728: 'Automatic Constraint' using the wrong orientation
If the `Automatic Constraint` modifier was activated while an axis
constraint was already set, the orientation used would be the default
orientation of the mode and not that of the scene.

This was because the `initSelectConstraint` function was not called in
this case and the `Automatic Constraint` mode was enabled by other
indirect means

So the solution is to call `initSelectConstraint` in either case and
remove these "indirect means" of enabling `Automatic Constraint`.
2022-03-23 12:20:39 -03:00
e25238e146 Fix build error on GCC after recent changes 2022-03-23 16:12:55 +01:00
d40d5e8d0f Cleanup: move Mesh Sequence Cache modifier to C++
This moves `MOD_meshsequencecache.c` to C++ and fixes compile warnings
introduced from the change. This uses C++ style casts, as well as
`nullptr` instead of `NULL`.

This will allow to output `GeometrySets` from the modifier, which is C++.

Differential Revision: https://developer.blender.org/D13662
2022-03-23 15:34:13 +01:00
5ac4e6c911 Color Management: add support for OpenColorIO color space aliases
This enables the configuration to specify aliases for compatibility with other
configurations.

When a colorspace name is saved in a.blend, that is the alias of a colorspace
in the current configuration, it will show the main colorspace from the
configuration in the user interface and Python API instead.

Loading & saving the .blend file does not make any changes to the stored name,
so as to not make hidden modifications. Only when setting the property again
will the alias name be overwritten by the main colorspace name.

Fixes T96049

Differential Revision: https://developer.blender.org/D14419
2022-03-23 15:21:58 +01:00
7aab508e32 Color Management: support different settings for render and compositing output
The Output Properties > Output panel now has a Color Management subpanel to
override scene settings. When set to Override instead of Follow Scene, there
are settings to:

* For OpenEXR, choose a (linear) colorspace for RGBA passes
* For other file formats, use different display/view/look/exposure/gamma

These settings affect animation render output, image save of renders and the
compositor file output node. Additionally, the image save operator and
compositor file output nodes also support overriding color management.

Includes some layout changes to the relevant panels to accomdate the new
settings and to improve consistency. Ideally subpanels would be used to better
organize these settings, however nodes and operators don't currently support
creating subpanels.

Differential Revision: https://developer.blender.org/D14402
2022-03-23 15:21:58 +01:00
Jeroen Bakker
51727fe86f Fix T96502: Compilation error OCIO when using GradingPrimaryTransform.
When using GradingPrimaryTransform the generated GLSL code fails to compile. The actual issue is
inside OCIO (https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/1603).

The reason is that unset clamping values are rendered out as `inf`, which isn't recognizable
by GLSL.

The issue is worked around by defining a default for `inf`.

Reviewed By: brecht

Maniphest Tasks: T96502

Differential Revision: https://developer.blender.org/D14425
2022-03-23 14:13:09 +01:00
3d5d8b7f71 Cleanup: Run clang-format on the OBJ exporter 2022-03-23 12:43:03 +01:00
f22331ad21 Cleanup: Move include statements outside of extern "C"
The linking type is to be specified in thew header when
it is really needed.
2022-03-23 12:43:03 +01:00
2d3a62fe16 Fix invalid NULL check in GPU_viewport_unbind_from_offscreen
Mistake from 1d49293b80.
2022-03-23 21:52:01 +11:00
f634010c6e Event System: improve handling of unknown keys
When converting ghost keys to Blender's event system:

- All keys that aren't part of the GHOST_TKey enum map to EVENT_NONE
  (ignored), note that it's an internal error if the value of key isn't
  a known value.

- Modify the switch statement so any missing members of GHOST_TKey
  warn at compile time (GCC & Clang only).

- GHOST_kKeyUnknown maps to EVT_UNKNOWNKEY.
  We could ignore this key, changing can be evaluated separately.
2022-03-23 21:30:36 +11:00
8f63dccaa9 Event System: ignore keys such as print-screen & num-lock
Avoid adding events with their type set to EVENT_NONE as these
can't be categorized usefully (keyboard/mouse/NDOF ... etc),
and add an extra case that needs to be accounted for.

Adding these events seems to be an unintentional change from [0],
these keys used to be ignored in 2.4x.

[0]: a1c8543f2a
2022-03-23 21:17:59 +11:00
ad370868a2 Fix T96712: Debug Assert with PrintScrn & ScrollLock keys
Caused by 08d8eee006.
2022-03-23 20:52:12 +11:00
94b2d83421 Cleanup: move documentation to headers, other minor corrections 2022-03-23 17:18:42 +11:00
56dba4df3c Revert "Fix T89560: Keymap editor no longer shows keying set dropdown"
This reverts commit e55f4657f7.

It's not intended to support assigning shortcuts to this operator,
which could only work for built-in keying sets caused warnings to be
reported warnings when exporting key-maps.

Prefer D14289, preventing users running into this problem to begin with.
2022-03-23 16:47:47 +11:00
d356edf420 UV: support "Tweak Tool: Left Mouse Select & Move"
- Follow the same conventions as the 3D viewport for UV selection
  (using SelectPick_Params internally).

- Use WM_operator_properties_mouse_select for selection properties.
2022-03-23 16:09:22 +11:00
cf1a0ca612 UI: Change subdiv to subdivision for EEVEE hair
Reviewed By: Blendify

Author: @Alaska

Differential Revision: https://developer.blender.org/D14346
2022-03-22 23:09:36 -04:00
612ec0ecdf Fix T96372: UV editor selection display wrong with GPU subdivision
Vertices were not drawn properly as the logic for mapped mesh was used
in the BMesh case.

Edge display would ignore subdivided edges which would come from coarse
edges when setting display flags.
2022-03-23 04:01:12 +01:00
694fe9f77b Fix outliner/selection updates when selecting in the 3D view
The checks for calling outliner flushing didn't account for
entering pose mode for the first time or that pose-bone selection
can also change the object selection.

Resolve by recording what changed and refresh accordingly.

Also de-duplicate calls to DEG_id_tag_update.
2022-03-23 13:44:15 +11:00
5f350a4acd Cleanup: various improvements to ed_object_select_pick
- Document parameters.
- Add code-comments.
- Remove some historic/unhelpful code-comments.
- Rename argument names that were ambiguous
  (object was a boolean for e.g.).
- Move `gpu` picking into an allocated struct which is only
  allocated & used when using GPU picking.
- Move variable declarations after menu picking has been handled.
2022-03-23 13:44:15 +11:00
4822153b85 Cleanup: spelling in comments 2022-03-23 12:15:50 +11:00
6bb28a1a52 Cleanup: follow Python code-style/conventions 2022-03-23 12:00:33 +11:00
3a038f8a60 CMake: add missing headers to source list 2022-03-23 11:58:59 +11:00
d2336237cf License headers: add license header to source/blender/gpu/metal 2022-03-23 11:47:05 +11:00
366abae3e7 Cleanup: use ifdef to disable enum string allocation
Restore variable removed in [0], using an ifdef to avoid the warning.

[0]: c3ecfdf40b
2022-03-23 11:43:21 +11:00
5c27391b0f UI: Clarify fluid sim CFL Number tooltip
Fixes T93863
2022-03-22 18:06:02 -04:00
cc3ec1fc6f Fix minor error in last commit (4b35d6)
If there is no active object, it is to be expected that we are in
object mode as well.
2022-03-22 17:30:03 -03:00
4b35d6950d Fix T96711: snap in edit mode for selected objects does not work
Regression introduced in 52be063012

The `SNAP_NOT_SELECTED` option should only consider base selected if
we are in object mode.
2022-03-22 17:21:58 -03:00
b7b3c4c40c Fix T96705: Crash when pressing F3 outside a Blender window if Developer extras
If the mouse is not hovering the window, there is no active region. This is a
valid state, but the UI-list filter operator didn't account for that case.
2022-03-22 18:35:28 +01:00
b40ac9684c Tiny visual fixes/tweaks for new library override buttons in Outliner
Tweaks:
- Increase horizontal padding for the buttons from 1 point to 2, looked like an
  unintentional placement error before.

Fixes:
- Missing horizontal padding for array buttons
- Small gap between separator line and right column when using a high interface
  scale
- Properly center buttons vertically.
2022-03-22 18:09:46 +01:00
87a0770bb9 Fix T96361: missing update when changing texture mapping properties 2022-03-22 16:33:55 +01:00
8344ef7394 Fix T96524: Regression: The Material Preview doesn't show
The preview does not work well with deferred render result pixels
allocation: it breaks the refresh and requires to toggle current
panels.

Since there is no tiled rendering for previews we don't save any
memory by deferring pixels allocations, so do it for the render
result during the render result creation.

Differential Revision: https://developer.blender.org/D14414
2022-03-22 16:00:09 +01:00
Leon Schittek
7de3caa05d Fix: Drag link search doesn't always connect to socket
Connecting to some sockets of a few nodes via the drag link search
would fail and trigger an assert, because the picked socket wasn't
available. This was due to some sockets only being available with
certain settings.

This patch fixes these cases by adding the availability conditions of
the socket to the node declaration with the `make_available` method
or manually adding a `node_link_gather_search` function.

Differential Revision: https://developer.blender.org/D14283
2022-03-22 09:57:50 -05:00
Laurynas Duburas
6bbc3b5610 Curve: Validation message split from nurb_check_valid
Split retrieval of translated text for the "invalid" messages for NURBS
curves from the actual calculation, which is a lower-level function.
Also fixes an issue where "At least two points required" would always
display in the "Active Spline" panel.

Differential Revision: https://developer.blender.org/D14315
2022-03-22 09:54:13 -05:00
b0aaf6ff4a Fix T96294: Crash and error with shape key normal calculation
A mistake in the mesh normal refactor caused the wrong mesh to
be used when calculating normals with a shape key's deformation.

This commit fixes the normal calculation by using the correct mesh,
with just adjusted vertex positions, and calculating the results
directly into the result arrays when possible. This completely avoids
the need to make a local copy of the mesh, which makes sense,
since the only thing that changes is the vertex positions.

Differential Revision: https://developer.blender.org/D14317
2022-03-22 09:43:02 -05:00
1c790555a0 Cleanup: Use bool for BMesh creation params
These boolean options are passed as uint, but they would be
easier to understand if using bool.

Differential Revision: https://developer.blender.org/D14405
2022-03-22 09:38:12 -05:00
64cd927519 Fix T96308: Mesh to BMesh conversion doesn't calculate vertex normals
Currently there is a "calc_face_normal" argument to mesh to bmesh
conversion, but vertex normals had always implicitly inherited whatever
dirty state the mesh input's vertex normals were in. Probably they were
most often assumed to not be dirty, but this was never really correct in
the general case.

Ever since the refactor to move vertex normals out of mesh vertices,
cfa53e0fbe, the copying logic has been explicit: copy the
normals when they are not dirty. But it turns out that more control is
needed, and sometimes normals should be calculated for the resulting
BMesh.

This commit adds an option to the conversion to calculate vertex
normals, true by default. In almost all places except the decimate
and edge split modifiers, I just copied the value of the
"calc_face_normals" argument.

Differential Revision: https://developer.blender.org/D14406
2022-03-22 09:33:50 -05:00
86d87fcbdb GL: Fix compilation error on MSVC (for real) 2022-03-22 14:52:51 +01:00
a43f3c761e GL: Fix compilation error on MSVC 2022-03-22 14:51:32 +01:00
e0ce1c45f8 Fix T96577: setting curve handles not working correctly with multiple curves
Differential Revision: https://developer.blender.org/D14409
2022-03-22 14:41:43 +01:00
3b5224b57c Cleanup: refactor passing of color management settings for image save
Make a copy of ImageFormatData that contains the effective color management
settings, and pass that along to the various functions. This will make it
possible to add more complex logic later.

For compositing nodes, passing along view and display settings through
many functions made it harder to add additional settings, so just get those
from the scene now.

Differential Revision: https://developer.blender.org/D14401
2022-03-22 14:15:20 +01:00
2ebcb7fab3 Cleanup: make format and fix warning 2022-03-22 13:44:15 +01:00
Jason Fielder
19c793af35 Metal: Make GLSL shader source MSL compliant also
Metal shading language follows the C++ 14 standard and in some cases requires a greater level of explicitness than GLSL. There are also some small language differences:

- Explicit type-casts (C++ requirements)
- Explicit constant values (C++ requirements, e.g. floating point values using 0.0 instead of 0).
- Metal/OpenGL compatibility paths
- GLSL Function prototypes
- Explicit accessors for vector types when sampling textures.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14378
2022-03-22 12:54:44 +01:00
Jason Fielder
309ea31485 Metal: Initial Implementation of Metal Backend for GPU Module.
Adding WITH_METAL option to CMAKE to guard compilation for macOS only. Implemented stub METALBackend to mirror GPUBackend interface and added capabilities initialisation, along with API initialisation paths.

Global rendering coordination commands added to backend with GPU_render_begin and GPU_render_end() commands globally wrapping GPU work. This is required for Metal to ensure temporary resources are generated within an NSAutoReleasePool and freed accordingly.

Authored by Apple: Michael Parkin-White, Vil Harvey, Marco Giordano, Michael Jones, Morteza Mostajabodaveh, Jason Fielder

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14293
2022-03-22 12:54:34 +01:00
Pratik Borhade
913b6b9ec1 Fix T96624: NLA crash when reordering tracks if no object is selected.
Caused by rBc0bd240ad0a1.
To avoid crash, make boolean value false if active object data is NULL.

Should be backported to 2.93 LTS and 3.1 corrective releases.
2022-03-22 12:04:41 +01:00
3b745f3455 Cleanup: make format + extra parenthesis
Nested ? : get better formatted with some parenthesis around the expressions.
2022-03-22 11:36:10 +01:00
2ba72d847b Fix (unreported) Crash in Array modifier.
Typo (copy/paste mistake) in rB923b28aab85768e2b.
2022-03-22 11:25:54 +01:00
ceaa787e42 Fix T96420: Set ID node not working for instances
Previously, instances used the point domain, but now there is a special
domain for instance attributes that the node has to use.
2022-03-22 11:09:53 +01:00
c1909770e7 CMake: prep USD build & find scripts for USD >= 21.11
Since USD 21.11 the libraries are prefixed with "usd_", i.e.
"libusd_m.a" became "libusd_usd_m.a". This commit adjusts our
`usd.cmake` (for building USD) and `FindUSD.cmake` (for finding the USD
libraries) so that they work with and without this `usd_` prefix.

See for more info:
https://github.com/PixarAnimationStudios/USD/blob/release/CHANGELOG.md#2111---2021-11-01

Reviewed By: LazyDodo, brecht, mont29

Differential Revision: https://developer.blender.org/D14334
2022-03-22 10:56:21 +01:00
47451af027 Cleanup: remove unused code from ed_object_select_pick
- No need to store is_pose_mode, check the object_mode flag instead.

- Remove redundant pose-mode check which now skips object selection.

- Remove disabled grease pencil cursor toggling,
  since I couldn't manage to reproduce a situation where the cursor
  failed to update - also, as there are other places the active object
  can change this would need a more general solution anyway.
2022-03-22 18:07:47 +11:00
6d9de230df Cleanup: refactor 3D view selection picking to early exit for menus
Selecting that opens a menu is now returns early. Handling the menu
selection in-line made this function more difficult to follow.

Also split out selecting an object by it's center into it's own function.
2022-03-22 17:34:37 +11:00
fa96f7381c Cleanup: de-duplicate object-mode locking when selecting 2022-03-22 17:34:37 +11:00
8c072cdc93 Obj: try to fix Linux tests
Related to previous D14368 bug fix, the sorting
operator was not necessarily a stable order sort.
2022-03-22 06:39:50 +02:00
127baac44d Fix pose-selection from menu not activating the object
Unlike the regression from T96663 selecting pose bones from menus
never activated the object.
2022-03-22 13:42:37 +11:00
59870796ea Fix T96663: Selecting a pose-bone doesn't activate the object
Regression in [0] that removed object selection changes while remaining
in pose-mode. This unintentionally removed object activation.

[0]: 859c062a2a
2022-03-22 13:39:01 +11:00
4046f61b39 Fix pose-bone menu selecting before activating the menu
Regression in 1d88aeb95f.
2022-03-22 12:07:00 +11:00
4e1e057ced Cleanup: variable names for menu selection
- Rename baseCount to bone_count, was copy-pasted from object code.
- Also rename baseCount to base_count for object selection,
  following snake case naming conventions.
- Use int instead of short for counters, as there is no reason to use
  short ints.
2022-03-22 11:57:25 +11:00
8bccc7d861 Cleanup: add proper IMB_openexr.h instead of including file from intern/ 2022-03-22 01:30:19 +01:00
9cf40eee4b Fix build error when WITH_OPENEXR=OFF, after recent refactor 2022-03-22 01:30:19 +01:00
fab14f7854 Fix build when using WITH_TBB=OFF after recent changes
And wrap tbb::parallel_sort in blender namespace similar to other TBB
functionality.
2022-03-22 01:30:19 +01:00
976c91cd77 Cleanup: Clang tidy 2022-03-21 17:12:22 -05:00
def1c0c538 Cleanup: Small changes to multires bake normals access
- Order return arguments last, add `r_` prefix
- Use explicit size on array argument
- Avoid double negative in if statement
2022-03-21 17:11:39 -05:00
3a8a7d93f9 Fix T96401: Broken multires baked normals result
A 7 year old commit, 2ec00ea0c1, used incorrect indexing for
the optional array of precomputed poly normals. Apparently that code
path was never used, or this issue would have been discovered earlier.
Recent changes calculate normals on a temporary mesh and use those
for the "low-res" layer, meaning the precomputed path was always taken.
2022-03-21 16:55:55 -05:00
923b28aab8 Fix T96494: Array modifier with caps crash on curve objects
Since 3b6ee8cee7, a list of vertex groups cannot be retrieved
from curve objects for merging because curve objects do not support
vertex groups. Previously the empty list on the object was returned.
Only mesh objects are supported for the caps.
2022-03-21 14:44:39 -05:00
eb1755be35 Fix T96511: New OBJ exporter no longer groups faces by material
Old python exporter in 3.0 and earlier ordered faces by material,
but the new C++ exporter in 3.1+ did not, and was just writing them
in whatever is the order of the mesh data structure.

This mostly does not cause problems, except in some apps e.g.
Procreate -- for large enough meshes, this lack of
"order by material" (which ends up having more usemtl lines)
ends up creating more mesh subsets than necessary inside Procreate.

The change is not computationally heavy, e.g. exporting 6-level
subdivided Monkey mesh goes 1085ms -> 1105ms on my machine.

Reviewed By: @howardt
Differential Revision: https://developer.blender.org/D14368
2022-03-21 20:20:09 +02:00
a58be397e2 Curves: new Add brush
This adds a new Add brush for the new curves object type in sculpt mode.
The brush is used to insert new curves (typically hair) on the surface object.

Supported features:
* Add single curve exactly at the cursor position when `Add Amount` is 1.
* Front faces only.
* Independent interpolate shape and interpolate length settings.
* Smooth and flat shading affects curve shape interpolation.
* Spherical and projection brush.

This also adds the `surface_triangle_index` and `surface_triangle_coordinate`
attributes. Those store information about what position on the surface each
added curve is attached to:
* `surface_triangle_index` (`int`): Index of the internal triangle that a curve
  is attached to. `-1` when the curve is not attached to the surface.
* `surface_triangle_coordinate` (`float2`): First two numbers of a barycentric
  coordinate that reference a specific position within the triangle.

Ref T96444.

Differential Revision: https://developer.blender.org/D14340
2022-03-21 18:59:03 +01:00
Ethan-Hall
f8d19ec5a3 UI: improve names and tooltips in viewport preferences
Rename OpenGL to GPU, Show to Text Info Overlay, and various other tweaks.

Differential Revision: https://developer.blender.org/D14344
2022-03-21 18:09:43 +01:00
Hallam Roberts
c7e25a25b0 Fix T96132: Cycles RGB/Vector/Float Curve shaders ignore extrapolation setting
Differential Revision: https://developer.blender.org/D14393
2022-03-21 17:41:17 +01:00
f92e3b39f1 UI: Use title case for labels 2022-03-21 11:35:17 -05:00
8530e48f86 Cleanup: move render image and multilayer EXR write code to image_save.cc
These share a lot of logic with regular image saving and should be unified
more in the future.
2022-03-21 16:38:13 +01:00
b96462519f Cleanup: move image_save.c to c++ 2022-03-21 16:38:13 +01:00
1897df891c Cleanup: move OpenEXR channel name construction to OpenEXR code 2022-03-21 16:38:13 +01:00
6e4d2fa914 Cleanup: add image_format.cc for functions related to ImageFormatData
Also fixes missing code to read/write/free/copy color management settings
in various places. This can't be set through the UI currently, but still
should be handled consistently.
2022-03-21 16:38:13 +01:00
Ethan-Hall
4abb8a14a2 Cycles: make 3D texture sampling at boundaries more similar to GPU
CPU code for cubic interpolation with clip texture extension only performed
texture interpolation inside the range of [0,1]. As a result, even though the
volume's color is sampled using cubic interpolation, the boundary is not
being interpolated. The GPU appears was interpolating samples that span the
clip boundary softening the edge, which the CPU now does also.

This commit also includes refactoring of 2D and 3D texture sampling in
preparation of adding new extension modes.

Differential Revision: https://developer.blender.org/D14295
2022-03-21 16:38:13 +01:00
Ethan-Hall
be3eef19c0 GPU: Allow the user to set an anisotropic filtering setting below the implementation-defined value of GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
Allow the user to set an anisotropic filtering setting below the implementation-defined value of `GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT`.

This bug-fix is also needed for 2.93 LTS.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14392
2022-03-21 13:47:08 +01:00
Hallam Roberts
c5456819ee Fix T96655: Bloom crashes Eevee
This patch fixes T96655, bloom crashing Eevee.

The error occurs because rB472fc0c55848b2e2d428cfb4f7debb80a4e12081 added `vec3 safe_color(vec3 c)` to `common_math_lib.glsl`.

However, `vec3 safe_color(vec3 c)` already exists in `effect_bloom_frag.glsl`.
This means `vec3 safe_color(vec3 c)` is duplicated within `common_math_lib.glsl` and `effect_bloom_frag.glsl`.

{F12938060 size=full}

The duplicate code in `effect_bloom_frag.glsl` can be removed since it's no longer needed.

(I checked the remaining methods, there shouldn't be any additional duplicate code)

Reviewed By: fclem

Maniphest Tasks: T96655

Differential Revision: https://developer.blender.org/D14396
2022-03-21 13:20:06 +01:00
Sergey Sharybin
ae21729557 Cycles: Un-pause render when switching to rendered viewport
Consider switching to rendered shading type as a request to start
rendering, without requiring to un-pause.

This minimizes amount of clicks needed to start rendering after
viewport was paused once, and then shading mode got changed.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14244
2022-03-21 10:59:08 +01:00
Pierre Risch
e4278b72bb T84815: Missing preview image in compositing file output node
Hello,
I saw that this revision was stalled for a few months so I tried to update it.
https://developer.blender.org/D10995
I added a function that adds a preview on the first connected input of the file output node.
I removed the preview on the single layer format
Thanks

Reviewed By: #compositing, jbakker

Maniphest Tasks: T84815

Differential Revision: https://developer.blender.org/D14219
2022-03-21 10:56:40 +01:00
9ed63ebb45 Fix T96572: eevee crash with motion blur and stereoscopy
This was a use-after-free bug due to dangling pointers.
2022-03-21 10:05:39 +01:00
fb87578698 Fix T96255: Node socket fails to drag
This is a general issue exposed by moving from tweak to click-drag
events [0], however this bug would have existed for both click &
click-drag events beforehand.

Since [1] the following behavior could occur:

- Click-drag the cursor away from the button.
- Leaving the button would flag it as disabled.
- The disabled button would then break
  causing the event to be considered handled.
- Once handled no click / click-drag action would be tested.

The bug would only happen if the cursor left the button before the drag
threshold was reached which tended to happen with an UI-scale 2 or more.
Or with an increased drag threshold.

Revert [1] (fix for T78503), which is no longer needed since as of [2].

[0]: 4986f71848
[1]: 6f96dd8576
[2]: 87c13ac68c
2022-03-21 18:20:44 +11:00
c4ce1b70e3 Correct error in 3dc44f8c89
The array for event.flag was too big, harmless but incorrect.
Remove the size from the declaration as it's not needed.
2022-03-21 17:21:28 +11:00
3dc44f8c89 Event System: improve event printing
- Use set-style printing of modifier flags instead of booleans.
- Include event.flag.
- Print on a single line (so output can be more easily filtered).
2022-03-21 17:19:26 +11:00
52af3b20d4 Cleanup: cursor motion events now have value set to KM_NOTHING
In some cases value of cursor motion events was set from the last event
written to the wmWindow.eventstate. Avoid potential errors by ensuring
cursor motion events always have their value set to KM_NOTHING.
2022-03-21 15:49:15 +11:00
8ecaa2d624 Fix T96510: ASAN failure when selecting text in Text Editor
Regression in 541ba68991
2022-03-21 13:36:07 +11:00
Aras Pranckevicius
b9123b806f Fix T96470 new obj exporter writing material groups
This is patch D14349 from Aras Pranckevicius.

The logic in the code was _completely different_ from the documentation
and what the python exporter in 3.0 did. The new code assumed that
"export material groups" meant "append material name to the object name",
and was only ever kicking in when the "export object groups" option was
also checked. But the proper behavior (as in 3.0 exporter & the online docs),
is to emit g objectname_materialname before each usemtl line. Which is something entirely else.
2022-03-20 08:59:16 -04:00
Aras Pranckevicius
5bfdaaa800 Fix T96415: new OBJ exporter was applying scaling factor incorrectly
This is patch D14347 from Aras Pranckevicius.

Instead of scaling "the scene" (i.e. transform vertices by object matrix,
then multiply by scale factor), it was instead first applying the scale
factor in local space, and then transforming by the object matrix.
2022-03-19 17:14:53 -04:00
eccb0b222e GPencil: Port main object shader to ShaderCreateInfo
This is quite a huge cleanup. Making use of the `common_gpencil_lib.glsl`
to share more codes and use more consistent codestyle.

The gpencil engine specifics are now out of the `gpencil_vertex()`
function making it easier to add more features.

There should be no regression as all workarounds are kept as is.
2022-03-19 22:05:34 +01:00
36b02c3815 GPUSource: Fix failure case in the enum preprocessor
Some C headers might define the typedefs of the enum themselves.
Even if they are guarded by preprocessor `#if`, our enum preprocessor
has no idea of the validity of the statement. So we just bypass
if there is a typedef just before any `enum` keywords.

Note that the typedef matching is quite fragile.
2022-03-19 22:05:34 +01:00
472fc0c558 DRW: Port improvements in common_math_lib.glsl from eevee-rewrite
Mostly quality of life functions and macros.
2022-03-19 22:05:34 +01:00
6ae03375b6 DRW: Make use of shader shared header
# Conflicts:
#	source/blender/draw/intern/draw_manager.h
#	source/blender/draw/intern/draw_manager_exec.c
#	source/blender/draw/intern/draw_shader_shared.h
2022-03-19 22:05:34 +01:00
3eaf345352 DRW: Introduce GPencil common GLSL library
This library contains the needed functions to render GPencil object
geometry. Centralizing these will make it possible for other draw
engines (EEVEE, Overlay) to reuse the same vertex shader code and
possibly the same fragment rejection methods.
2022-03-19 22:05:34 +01:00
84a0e04296 GPencil: Use ShaderCreateInfo for fullscreen shaders
Simple port. Shouldn't break anything.
2022-03-19 22:05:34 +01:00
568c453ff3 GPencil: Use ShaderCreateInfo for antialiasing shaders
Simple port. Shouldn't break anything.
2022-03-19 22:05:34 +01:00
337343ecc9 GPencil: Use ShaderCreateInfo for vfx shaders
Simple port. Shouldn't break anything.
2022-03-19 22:05:34 +01:00
d7ecd4a0f3 DRW: Add new texture from pool acquire/release mechanism
This adds a simple and more manageable temp texture behavior.

The texture is garanteed to be available only between the acquire/release pair.
This makes the same engine able to reuse the textures and even overlap the acquire
& release calls.
2022-03-19 22:05:34 +01:00
dbf1e7c07f DRW: GPU wrappers: Some quality of life improvements
- Add name support to storage buffers
- Delete view functions for TextureFromPool
- Add support for different size acquire and assert on mulitple acquire
- Allow multiple release
2022-03-19 22:05:34 +01:00
Aras Pranckevicius
8aa365745a Fix T96430: new OBJ exporter wrong normals for non-uniform scale, and wrong face order for negative scale
This applies patch D14343 from Aras Pranckevicius, with a description:

The new 3.1+ OBJ exporter did not have correct logic when faced with
non-uniform & mirrored (negative on odd number of axes) object scale:

- Normals were not transformed correctly (should use inverse transpose of the matrix),
 and were not normalized,
- Face order was not "flipped" when transform has negative scale on odd number of axes
 (visible when using "face orientation" viewport overlay).
2022-03-19 16:20:22 -04:00
873801d25e Make Format Changes
Only formatting changes found by running "make format", no functional
changes

Committed without review, but with verbal approval by Hans Goudey
2022-03-19 10:24:56 -07:00
f381c73a21 Fix T95257: Filter files on "name" and "relpath"
When filtering File Browser items by name, use entry's "name" field as
well as the "relpath" field since they can vary.

See D13940 for details.

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

Reviewed by Bastien Montagne
2022-03-19 09:23:05 -07:00
82c852f387 Fix D14173: Chinese IME Full Width Numbers
Windows IME: Fix duplicated initial character when entering numbers
while in Chinese full width character mode.

See D14354 for more details.

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

Reviewed by Brecht Van Lommel
2022-03-19 09:05:10 -07:00
8711483632 BLI: generalize converting CPPType to static type
Previously, the conversion was done manually for a fixed set of types.
Now, there is a more general utility that can be used in other contexts
(outside of geometry nodes attribute processing) as well.
2022-03-19 10:57:40 +01:00
3e16f3b3ef BLI: move generic data structures to blenlib
This is a follow up to rB2252bc6a5527cd7360d1ccfe7a2d1bc640a8dfa6.
2022-03-19 08:26:29 +01:00
c655146b87 Fix T96584: Properly translate operator on splash screen
The previous fix looks to have been accidentally removed as part of
rB7aec5b06227.

Restore the change.
2022-03-18 20:31:24 -07:00
7fed213ba4 Revert "Compositor: Support backdrop offset for the Viewer node"
This reverts commit 33409f9f1c, as it breaks
panning in the image editor.

Fixes T96543
2022-03-19 00:37:30 +01:00
356073c13e Cleanup: Move object_transform.c to C++
Compilation and clang tidy fixes, use Vector instead of the
macro-based C array system. Builds on all platforms on the
buildbot.
2022-03-18 15:50:46 -05:00
2297db5c49 DRW: gpu wrappers: Fix compilation in release mode 2022-03-18 20:59:48 +01:00
16dd382f06 GPUTexture: Add Cube view as 2D array
This is useful to read/write to the textures directly using compute
shaders and imageLoad/Store.
2022-03-18 20:59:44 +01:00
c509a12fd8 DRW: Expose stencil view in gpu_wrapper 2022-03-18 20:59:40 +01:00
daa26ac0f5 Cleanup: DRW: Fix comments in DRW_gpu_wrapper 2022-03-18 20:59:37 +01:00
e5c2bfb341 DRW: Add support for compute indirect command.
This just expose the GPU API through DRW.
2022-03-18 20:59:33 +01:00
d7df0dcccb GPU: Add indirect dispatch support.
This uses a StorageBuf as the source of indirect dispatch argument.
The user needs to make sure the parameters are in the right order.

There is no support for argument offset for the moment as there is no
need for it. But this might be added in the future.

Note that the indirect buffer is synchronized at the backend level. This is
done for practical reasons and because this feature is almost always used
for GPU driven pipeline.
2022-03-18 20:59:27 +01:00
7ee816e32f GPU: StorageBuf: Add method to clear the buffer in place.
This is a faster way to clear a buffer instead of reuploading new data.
It is equivalent to `memset` and runs directly on the GPU.

This is better to clear huge buffers and to avoid the sync cost of data upload.
2022-03-18 20:59:20 +01:00
5bd38f3be8 Cleanup: GPUStorageBuf: Fix header license 2022-03-18 20:57:15 +01:00
33b4e21820 Cleanup: SSBO: Rename ubo to ssbo in arguments. 2022-03-18 20:54:58 +01:00
93bf17d952 GPU: Add support for stencil buffer texturing mode.
This adds the possibility to read the stencil buffer inside shaders.
This is only available on GL 4.3 so use it accordingly.
2022-03-18 20:54:42 +01:00
054957659f GL: Check texture framebuffer feedback only if not using compute pipeline.
This was getting in the way in multiple instances. Compute shaders dispatch
are still made in the presence of the last bound framebuffer even if they
do not interact with it.
2022-03-18 20:54:27 +01:00
935136f844 GPUTexture: Fix bug in texture view creation
The switch case was based on an uninitialized value.
2022-03-18 20:54:18 +01:00
081255671a GL: Add missing format in image layout conversion 2022-03-18 20:54:02 +01:00
3f484c502f GPUShaderCreateInfo: Add explicit early_fragment_test 2022-03-18 20:53:52 +01:00
0f08453ea9 DRW: Add simple texture view wrappers to draw::Texture 2022-03-18 20:53:41 +01:00
3b75ca2f60 GPUTexture: Expose layer & mip count 2022-03-18 20:53:17 +01:00
374cb32d4a GLShader: Fix two small issues with compute shader generated code 2022-03-18 20:53:04 +01:00
2580869901 DRW: Add support for GPUStorageBuf in wrappers
# Conflicts:
#	source/blender/draw/engines/eevee/eevee_light.cc
#	source/blender/draw/engines/eevee/eevee_shadow.cc
2022-03-18 20:50:25 +01:00
8c93f8c6cc DRW: Add support for GPUStorageBuf 2022-03-18 20:49:45 +01:00
bacfd55a0e GPU/GL: Add StorageBuf implementation
Almost 1:1 identical to UniformBuf implementation.
2022-03-18 20:49:41 +01:00
4544761a2d GPUShader: Fix crash when compilation error is a linking error 2022-03-18 20:49:22 +01:00
59f53f5802 EEVEE: Add new experimental "EEVEE Next" option
This is supposed to hold the latest improvement from the EEVEE rewrite branch.
Note that a restart is necessary in order for the engine to appear.

The registration code is a bit convoluted as it needs to be after the WM_init.
2022-03-18 20:49:09 +01:00
Christoph Lendenfeld
37b93b5df8 Animation: Blend To Default Implementation
Add a new operator to the Graph Editor that blends selected keyframes
to their default value.
The operator can be accessed from
Key>Slider Operators>Blend To Default Value

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9376
Ref: D9367
2022-03-18 20:07:16 +01:00
63f9cb5a0b Fix T96608: GPencil Simplify must check general Simplify switch
As the grease pencil simplify is a subotion of general simplify, if the general switch is disabled, the grease pencil simplify must be disabled too.

This patch also disable the UI panel.
2022-03-18 19:50:38 +01:00
298d8a7b4a Curves: Port reverse curves node to the new data-block
Create a function on CurvesGeometry that can also be used for an edit
mode operator in the future. Dealing with CustomData directly means the
code is a bit more verbose than would be ideal, but this would be a
simple thing to clean up in the future if we get an attribute API here.

Also change the reverse node to first work on a read-only geometry
component, and only get write access if there is a curve selected.

Differential Revision: https://developer.blender.org/D14375
2022-03-18 12:24:05 -05:00
d2726e4626 Cleanup: Remove unnecessary namespace usage, use const 2022-03-18 12:21:13 -05:00
b2cb99d3fd Curves: Port fill curve node to the new data-block
This will mostly just remove the overhead of converting
to and from the old curves type, though it also does open
some opportunities for multi-threading in the future.
2022-03-18 12:18:19 -05:00
8146c996eb Fix: Curves last evaluated segment is empty
A mistake in 8538c69921. The offsets include the segment at the
corresponding index, but the evaluated offset calculation was adjusting
the offset for the second to last segment.
2022-03-18 12:05:14 -05:00
5d7f4f2cab Curves: Port transform node to new data-block
Make the new curves' translate and transform functions also affect
the handle position attributes.

Differential Revision: https://developer.blender.org/D14372
2022-03-18 10:30:27 -05:00
fe9e7036b0 Fix UV's not aligning with image.
This reverts a part of {rB33409f9f1cd42e899f2706fe7878e5e89b50d617}.
2022-03-18 14:17:19 +01:00
65b8b38787 Cleanup: Redundant parenthesis 2022-03-18 14:16:16 +01:00
c3ecfdf40b Cleanup: Compilation warnings
Mainly -Wset-but-unused-variable.
Makes default compilation on macOS way less noisy.

Differential Revision: https://developer.blender.org/D14357
2022-03-18 12:07:08 +01:00
2252bc6a55 BLI: move CPPType to blenlib
For more detail about `CPPType`, see `BLI_cpp_type.hh` and D14367.

Differential Revision: https://developer.blender.org/D14367
2022-03-18 10:57:45 +01:00
7509a74116 Fix T96278: missing update after alpha socket connection
Differential Revision: https://developer.blender.org/D14299
2022-03-18 10:49:54 +01:00
c7954d5904 Cleanup: Remove unused function 2022-03-18 10:34:06 +01:00
578c2f117a Curves: Port handle type selection node to new data-block
The node's structure isn't changed, it basically still works the
same way. The use of virtual arrays could be optimized in the
future if necessary.
2022-03-18 00:16:54 -05:00
389807624d Curves: Port Bezier Segment node to the new data-block
Ref T95443
2022-03-17 22:47:56 -05:00
0eb394af74 Fix resizing nodes not respecting the drag-start
Resizing nodes used the cursor location when the event was triggered
instead of the drag-start, harmless but means the drag location isn't
under the cursor especially with a high drag threshold.

Noticed when investigating other drag issues,
unrelated to recent changes to drag behavior.
2022-03-18 13:20:11 +11:00
5035fbdd23 License headers: use SPDX identifiers in intern/itasc
Added license headers based on the original LGPL files from:
gitlab.kuleuven.be/rob-itasc
2022-03-18 10:27:01 +11:00
a0e2373b7e Docs: add license text file for LGPL2.1 2022-03-18 10:27:01 +11:00
89ab3cdc56 Fix wrong documentation/UI text for NodeLink
`RNA_def_struct_ui_text(srna, ...)` was reused for `is_valid` and `is_muted`
which would set the documentation to theirs (actually to that of the last
call).

`RNA_def_property_ui_text(prop, ...)` should be used for the properties.
2022-03-17 23:57:06 +01:00
a67c7693a7 Fix typo in smooth brush tooltip 2022-03-17 23:56:55 +01:00
8407c0b64e Cleanup: unused class members. 2022-03-17 23:56:18 +01:00
d4bd9f6a27 Curves: Port convex hull node to new data-block
This uses the evaluated positions calculations from 8538c69921.
2022-03-17 17:45:37 -05:00
7bdba5f1e0 Cleanup: Remove unused includes 2022-03-17 17:16:53 -05:00
0835996cc9 Cleanup: Rename "spline" variables to "curve"
Ref T95355
2022-03-17 17:08:36 -05:00
ee2d39b3a7 Cleanup: Reorganize duplicate elements file
Use sections to keep all the code for a specific mode together,
rather than keeping the attribute duplication separate.
2022-03-17 16:46:58 -05:00
663bd38ed6 Curves: Port duplicate elements node to new data-block
Remove the conversion to and from `CurveEval` by supporting the
new Curves data-block in the node. This allows for some simplifications
to the code, as well as a fix for transfering curve domain attributes
when duplicating the curve domain.

The performance improvements (obverved through the timings overlay)
can be relatively massive with many curves. When duplicating 10000
4-point curves to become 2 million curves, I observed an approximate
150x improvement, from about 3 seconds to about 20ms.
2022-03-17 16:36:43 -05:00
6d97a5f93c Cleanup: Miscellaneous improvements to duplicate geometry node
- Pass less redundant information in function arguments.
- Use `IndexRange` more instead of direct offset calculations.
- Use specific geometry component types for specialized functions.
- Use const arguments.
- Declare variables closer to where they are created or used.
- Remove some redundant logic.
- Simplify the description for the output geometry.
2022-03-17 16:23:58 -05:00
7fed4c06c2 Fix keying-set selector broken
The menu for Timeline > Keying > Active Keying Set wouldn't show up.

Caused by d8e3bcf770. The function to attach search menu data to the button
would be called twice with different arguments for the same button now.
Shouldn't be an issue in general, but the first call now had the unexpected
side effect that the button would get disabled. Make sure it's re-enabled when
the second call sets the proper search data now.
2022-03-17 17:52:50 +01:00
17906794f5 Fix T96330: Three times slower 'relink to new id' process in 3.1.
Caused by rB43bc494892c3, moving this 'new id' relink to generic
remapping code added the over-head of proper, generic post-processing,
compared to the special-cases previous code was only designed to handle.

Fortunately with recent 'multi-remapping' work we can easily rewrite
that new id relink code to use the multi-remapping approach too.

No behavioral change is expected from this commit, besides the improved
performances (essentially restored to what they where before
rB43bc494892c3).
2022-03-17 17:23:57 +01:00
Henrik Dick
236ef11a07 GPencil: Fix cyclic flag cleared by simplify modifier
Change the sample mode to don't duplicate the last vertex of the
stroke and instead use the cyclic flag to close previously cyclic
strokes. This is necessary for the following modifiers.

Reviewed By: NicksBest

Differential Revision: http://developer.blender.org/D14359
2022-03-17 14:09:29 +01:00
d0968a9c52 BLI: add probabilistic rounding utility 2022-03-17 12:48:41 +01:00
8f68cff01b Cleanup: name enums 2022-03-17 12:42:01 +01:00
dd483215e5 Hair: Sculpt Mode Icons
From hair particle mode:
* Add
* Comb
* Cut
* Grow

New:
* Delete

Only comb and delete are used at the moment (by the new tools which are
under experimental).
2022-03-17 12:12:53 +01:00
b6702aa604 Curves: separate sculpt brushes into separate files
This makes it easier to work on these brushes in parallel.
2022-03-17 10:04:02 +01:00
884b167f74 View 3D: scale object center selection penalty by the pixel size
All screen-space UI thresholds should scale by the interface scale.
2022-03-17 20:02:37 +11:00
e0a8f9b78e Fix unintended de-selection when selecting the object center
Selecting an object that was already active & selected would de-select
it when the cursor was over the objects center.

This was caused by [0] that added a check which assumed more than one
hits from GPU_select meant there were multiple objects to select from.
This is not necessarily the case since bones, camera tracks or the
objects own center can add additional hits.

Resolve by keeping track of the best hit with & without the
active-selected object, only using the non-active-selected if it's found.

[0] 1550573360
2022-03-17 18:21:47 +11:00
bb735bd518 Tweak Tool: supports select & tweak on LMB (with RMB-select key-map)
Support for differentiating the tweak tool from the 3D cursor when
select is set to RMB.

This is currently an experimental preference:
Tweak Tool: Left Mouse Select & Drag

When enabled the tweak tool can now tweak the existing selection
without de-selecting first, a single click can be used to replace
the selection.
This matches selection in the graph & node editors.

This preferences is only available with "Developer Extras" enabled.

Ref T96544.
2022-03-17 16:47:14 +11:00
3017585ebf View 3D: the select operator now uses the cancel flag on failure
Needed so mapping selection to click doesn't pass the click event
through to setting the 3D cursor for e.g.

While this doesn't happen with the default key-map, setting selection
to LMB-click would set the 3D cursor as well (when the selection
fell through to nothing).
2022-03-17 16:22:33 +11:00
859c062a2a View 3D: multi-object pose selection no longer de-selects objects
De-selecting objects meant that selecting a bone would de-select
all the other pose objects - making exiting & entering pose-mode
loose the current set of pose objects.

Match edit-mode behavior: avoid de-selecting objects in the current mode
(unless the action is explicitly performed in the outliner for e.g.).
2022-03-17 14:39:38 +11:00
ba6d59a85a Cleanup: simplify logic for skipping object selection
Previously setting the 'basact' to NULL was done, but this wasn't
so simple to use with deselect_all which needs to check if there was
anything found at the cursor.

Add a 'handled' variable to differentiate this case, when set
don't attempt object selection.
2022-03-17 14:38:38 +11:00
42f430e9a2 Cleanup: minor clarifications to comments & use const variables 2022-03-17 14:37:23 +11:00
83fd242546 Fix 3D view movie-clip track selection
While basic single track selection worked,
toggling and de-selection has been broken since at least 2.83.

Support SelectPick_Params with the exception of deselect_all
which doesn't make sense for tracks as de-selecting all objects
is expected in that case.
2022-03-17 14:37:22 +11:00
7bc6a04767 Cleanup: split movie clip track selection into it's own function
This was an involved operation to include inline,
making ed_object_select_pick more difficult to follow.

Prepare for track selection to properly support SelectPick_Params.
2022-03-17 14:37:21 +11:00
1d88aeb95f View 3D: support for select passthrough when picking selected items
Currently this isn't used in the key-map, it will eventually
allow the 3D viewports tweak tool to match the behavior of other
editors that support tweaking a selection without first de-selecting
all other elements.
2022-03-17 14:37:20 +11:00
ea0c86e961 Cleanup: spelling in comments
Use <pre>..</pre> for pseudo-code.
2022-03-17 10:08:41 +11:00
27388f7f46 Cleanup: include argument names for drop-box callbacks
Indicates typical names for callbacks and allows them to be documented.
2022-03-17 10:08:41 +11:00
Habib Gahbiche
33409f9f1c Compositor: Support backdrop offset for the Viewer node
This is only part of the experimental "Full Frame" mode (disabled
by default). See T88150.

Currently the viewer node uses buffer paddings to display image offset
in the backdrop as a temporal solution implemented for {D12466}.
This solution is inefficient memory and performance-wise. Another
issue is that the paddings are part the image when saved.

This patch instead sets the offset in the Viewer node image
as variables and makes the backdrop take it into account
when drawing the image or any related gizmo.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12750
2022-03-16 23:28:36 +01:00
22de21bef1 Fix: Compiler error on windows and mac
The previous fix including `<algorithm>` was an improvement
but not the actual error, which appears to be that `int64_t` is
long long int on one platform but just long int on another.
The fix includes the template argument directly.
2022-03-16 16:49:31 -05:00
7a4af7a01b Fix: Build error after curve evaluation commit 2022-03-16 16:29:24 -05:00
8538c69921 Curves: Initial evaluation for curves data-block
This patch adds evaluation for NURBS, Bezier, and Catmull Rom
curves for the new `Curves` data-block. The main difference from
the code in `BKE_spline.hh` is that the functionality is not
encapsulated in classes. Instead, each function has arguments
for all of the information it needs. This makes the code more
reusable and removes a bunch of unnecessary complications
for keeping track of state.

NURBS and Bezier evaluation works the same way as existing code.
The Catmull Rom implementation is new, with the basis function
based on Cycles code. All three types have some basic tests.

For NURBS and Catmull Rom curves, evaluating positions is the
same as any generic attribute, so it's implemented by the generic
interpolation to evaluated points. Bezier curves are a bit special,
because the "handle" control points are stored in a separate attribute.
This patch doesn't include generic interpolation to evaluated points
for Bezier curves.

Ref T95942

Differential Revision: https://developer.blender.org/D14284
2022-03-16 15:47:00 -05:00
9af791f873 Fix: Update icons for hair to curves rename
ddf189892c missed recreating the icons with the new names.
This commit runs `make icons` and replaces the names in CMake.
2022-03-16 12:48:00 -05:00
Bastien Montagne
7e06fc11b7 Add 'multiple' variant of ID relink function.
Similar to other changes to ID remapping, gives huge speedups in some
cases, like certain types of liboverride creation.

Case from {T96092} goes from 1725 seconds (almost 30 minutes) to 45
seconds to generate the liboverride, on my machine.

Reviewed By: jbakker

Maniphest Tasks: T96092

Differential Revision: https://developer.blender.org/D14240
2022-03-16 18:34:20 +01:00
2564d152d6 Cleanup: Remove unnecessary namespace specification
Ever since d5b72fb06c, shader nodes have been in the
`blender::nodes` namespace, so they don't need to use that to access
Blender's C++ types and functions.
2022-03-16 12:33:36 -05:00
263c5b33d6 Fix: Build error from missing build dependencies
Somehow exposed after 943b919fe8, linking could fail because
bf_nodes was not properly configured as a dependency of bf_nodes_shader.
Also add the dependency to the geometry nodes module.
2022-03-16 12:20:05 -05:00
390b9f1305 Fix Cycles HIP assuming warp size 32
In HIP these masks are 64 bit, while in CUDA only 32 bit.
2022-03-16 18:05:48 +01:00
076079454f Cleanup: remove some unused Cycles GPU code
To make porting to other architectures easier, clarifying that this does not
need to be supported. The unused parallel_reduce implementation assumed warp
size 32, but is easy to update if we ever need it in the future.
2022-03-16 18:05:08 +01:00
213d00607e Cleanup: Further removal for legacy geometry nodes
943b919fe8 missed removing the experimental
option and the nodes from the add menu.
2022-03-16 10:56:53 -05:00
79e74b1486 Fix T96518: Gpencil Fill freezes when use invert and click inside areas
When using inverted filling and click inside a closed area and not outside as is expected, the algorithm to detect the contour to fill is unable to find the filling shape and try to fill outside of the valid index.

The infinite loop was adding more memory for each loop and the process continued while there was system resources and finally crashed the system.

As the tool in negative mode is designed to fill all areas when you click outside of any shape, now the algorithm check if the outline is not working as expected and cancels the filling process.
2022-03-16 16:30:53 +01:00
943b919fe8 Geometry Nodes: Remove legacy node code
This commit removes the implementations of legacy nodes,
their type definitions, and related code that becomes unused.
Now that we have two releases that included the legacy nodes,
there is not much reason to include them still. Removing the
code means refactoring will be easier, and old code doesn't
have to be tested and maintained.

After this commit, the legacy nodes will be undefined in the UI,
so 3.0 or 3.1 should be used to convert files to the fields system.

The net change is 12184 lines removed!

The tooltip for legacy nodes mentioned that we would remove
them before 4.0, which was purposefully a bit vague to allow
us this flexibility. In a poll in a devtalk post showed that the
majority of people were okay with removing the nodes.
https://devtalk.blender.org/t/geometry-nodes-backward-compatibility-poll/20199

Differential Revision: https://developer.blender.org/D14353
2022-03-16 08:51:11 -05:00
cb267cec55 Fix T96512: Crash selecting an edge
Regression in 5e5285baf6.
2022-03-16 23:42:31 +11:00
31f31496af Document some flags controlling BKE_library_foreach_ID_link behavior. 2022-03-16 13:15:41 +01:00
42e13ea4bf Cleanup: Deprecated field access in outliner_duplicate
Solved by introducing introducing a variant of MEM_cnew which behaves
as a copy-constructor for a trivial types.

Alternative approach would be to surround DNA structs with clang/gcc
diagnostics push/modify/pop so that implicitly defined constructors
and copy operators are allowed to access deprecated fields.

The downside of the DNA approach is that it will require some way to
easily apply diagnostics modifications to many structs, which is not
possible currently.

The newly added MEM_cnew has other good usecases, so is easiest to
use this route, at least for now.

Differential Revision: https://developer.blender.org/D14356
2022-03-16 12:38:23 +01:00
ddc54a2a6b Cleanup: Remove use of deprecated std::iterator in Freestyle
Resolves a fair amount of noisy warnings with default build on macOS.

Tested using render_layer render test which includes Freestyle layer.

Differential Revision: https://developer.blender.org/D14355
2022-03-16 11:56:30 +01:00
fbc36c77b0 Fix error with pose & deselect_all with 5e5285baf6 2022-03-16 21:25:38 +11:00
79ae5f5014 Fix T96386: crash when changing shader to node group in properties
The previous code updated the wrong node tree. The result was that
the new group node did not have the socket that was supposed to
be linked.
2022-03-16 11:23:45 +01:00
a45108840e CMake: Extra flags to ignore for strict compiler
Solves warnings generated by default build on macOS.
2022-03-16 10:33:04 +01:00
2d42187395 View 3D: refactor edit-mode meta-element selection
Meta-element selection now follows conventions for other picking
functions (e.g. EDBM_select_pick).

- Split meta-element find-nearest into a separate function.

- Cycle the meta-element starting from the active & selected
  instead of comparing & setting a static variable.

- Order elements using depth (from front-to-back)
  when cycling multiple elements.
2022-03-16 20:09:55 +11:00
9df27e7f00 Fix object centers & geometry selecting meta-elements in edit-mode 2022-03-16 19:57:47 +11:00
4f37b548bd Cleanup: de-duplicate struct declaration
Also use boolean instead of int.
2022-03-16 15:55:10 +11:00
8cfdad99a0 Cleanup: incorrect comments, use C comments 2022-03-16 15:30:22 +11:00
24ada9c960 Cleanup: Remove volatile from RenderResult and related APIs
Volatile fields were introduced to the RenderResult struct years ago[1].

However, volatile is most likely not doing what it was intended to do
in this instance, and is problematic when moving files to c++ (see
discussion from D13962). There are complex rules around what happens to
these fields but none of them guarantee what the above commit alluded to.

This patch drops the volatile and cleans up the APIs surrounding it.

[1] rB7930c40051ef1b1a26140629cf1299aa89eed859

Passing on all platforms:
https://builder.blender.org/admin/#/builders/18/builds/338

Differential Revision: https://developer.blender.org/D14298
2022-03-15 21:12:49 -07:00
f1501ac060 Cleanup: rename variables in view3d_select_exec
- Rename 'location' to 'mval', typically used for region cursor coords.
- Rename 'retval' to 'changed', typically used for operators
  when their return value depends on a change being made.
2022-03-16 15:05:05 +11:00
5e5285baf6 View 3D: move picking arguments into a struct & minor refactor
- Add SelectPick_Params struct to make picking logic more
  straightforward and easier to extend.

- Use `eSelectOp` instead of booleans (extend, deselect, toggle)
  which were used to represent 4 states (which wasn't obvious).

- Handle deselect_all when pocking instead of view3d_select_exec,
  de-duplicate de-selection which was already needed in when replacing
  the selection in picking functions.

- Handle outliner update & notifiers in the picking functions
  instead of view3d_select_exec.

- Fix particle select deselect_all option which did nothing.
2022-03-16 14:48:25 +11:00
9a763d24f2 Fix missing update selecting 3D text-box 2022-03-16 13:40:16 +11:00
be7855591e Cleanup: rename cnt to count
Follow naming from T85728.
2022-03-16 11:58:22 +11:00
379bd6d50c Curves: Port count spline length output to new data-block
This fixes T96487 in a similar way to 5791835678,
and also removes the conversion to old curve type for the
"Point Count" output.
2022-03-15 16:22:36 -05:00
d8e3bcf770 Outliner: Display buttons to edit library override properties
As proposed in T95802, this adds buttons to a new column on the right to modify
the override in the Library Override display mode. Some further usability
improvements are planned. E.g. this does not yet expand collections (modifiers,
constraints, etc) nicely or group modified properties of a modifier together.
Vector properties with more than 3 items or matrices aren't displayed nicely
yet, they are just squeezed into the column. If this actually becomes a problem
there are some ideas to address this.

Differential Revision: https://developer.blender.org/D14268
2022-03-15 18:48:52 +01:00
7f77bd95d9 Fix T96381: Cycles GPU wrong render with camera inside multiple volumes 2022-03-15 18:42:08 +01:00
c2f9133b29 Fix Cycles kernel error on Metal after recent changes 2022-03-15 17:56:45 +01:00
630d2b6497 Cycles: allow Adaptive Sampling with Scrambling Distance
While the correlation may not work well with adaptive sampling, in practice
this appears to work ok in most cases

Automatic scrambling distance uses the minimum samples from adaptive sampling,
which provides a good default estimate to avoid artifacts.

Contributed by Alaska.

Differential Revision: https://developer.blender.org/D13325
2022-03-15 16:12:13 +01:00
f9d3632cde Cycles: change Scrambling Distance Multiplier to a soft limit
This allows users to type in values larger than 1, for use in conjunction
with automatic scrambling distance.

Contributed by Alaska.

Differential Revision: https://developer.blender.org/D13580
2022-03-15 16:12:13 +01:00
af51b0d8d8 Fix T96417: Cycles issue with multiscatter GGX and self intersection avoidance
When the light direction is not pointing away from the geometric normal and
there is a shadow terminator offset, self intersection is supposed to occur.
2022-03-15 16:12:13 +01:00
19bff8eb51 Fix T96263: command line rendering affected by current scene subframe 2022-03-15 16:12:13 +01:00
2613a2552d Fix some properties missing in the UI for new Curves object type
Missed some renames from HAIR to CURVES.
2022-03-15 16:12:13 +01:00
3bb4597b2d Disable GPU subdivision if the maximum number of SSBO binding is reached
Some old platforms and drivers have limited amount of SSBO binding per
compute shader. This disables GPU subdivision if we cannot possibly
bind all required buffers within this limit.

For now the maximum number of buffers used by the GPU code is hardcoded,
but will be programmatically detected when shader creation is automated.

Ref D14337
2022-03-15 16:07:32 +01:00
45b637e1e7 GPU capabilities: detect max SSBO bindings
This adds detection of the maximum number of shader storage buffer
bindings that is supported on the current platform. This can be
useful to turn off features that require compute shaders but use
more buffer bindings than available.

Differential Revision: https://developer.blender.org/D14337
2022-03-15 16:04:41 +01:00
e08180fdab Fix slow tracking of long sequences
The performance issue was noticeable when tracking a lot of tracks
which are using keyframe pattern matching. What was happening is that
at some cache gets filled in and the furthest away frame gets removed
from the cache: the frame at marker's keyframe gets removed and needs
to be re-read from disk on the next tracking step.

This change makes it so frames at markers' keyframes are not removed
from cache during tracking.

Steps to easily reproduce:
- Set cache size to 512 Mb.
- Open image sequence in clip editor
- Detect features
- Track all markers

Originally was reported by Rik, thanks!
2022-03-15 15:50:40 +01:00
2156841c8c Fix T96452: Armature corrupted after undoing 'Join' operation.
Modified source Armature ID in the join operation was not properly
tagged as such for the depsgraph (and therefore memfile undo)..

Issue caused/revealed by rBe648e388874a.

Should be backported to 3.1 should we make a corrective release.
2022-03-15 15:02:39 +01:00
256d36683b Cleanup: remove redundant 'extern StructRNA' declarations
After rB9b298cf3dbec, the `StructRNA` declarations can now be accessed via
`RNA prototypes.h`

Also, since all redundated declarations are now removed,
`_WM_MESSAGE_EXTERN_BEGIN` and `_WM_MESSAGE_EXTERN_END` are also no
longer needed.

Differential Revision: https://developer.blender.org/D14342
2022-03-15 09:14:38 -03:00
7ec2c5c10b Cleanup: Remove confusing double negation in RNA helper function
Much more readable that way.
2022-03-15 13:11:41 +01:00
46b35c6836 Cleanup: remove accidental shallow mesh copy 2022-03-15 12:32:18 +01:00
49fc4449e7 Fix T96357: Issue clicking on stem of arrow gizmos to scale on axis
Caused by 0cb5eae9d0 which restored
support for 3D depth when selecting gizmos - making it difficult
to select single lines drawn in front of other gizmos.
Previously the first hit was always used.

Resolve by using a margin around arrow stems when selecting
which was already done for 2D arrows.
2022-03-15 20:03:33 +11:00
a0a572ce8b Cleanup: correct unbalanced doxy sections 2022-03-15 17:29:54 +11:00
683c130b06 Docs: correct doc-string for BPY_driver_reset
Remove outdated reference to "pydrivers.py", also document BPY_DECREF.
2022-03-15 15:31:11 +11:00
8c60050d30 Cleanup: comments in bpy_driver.c, minor corrections 2022-03-15 15:20:38 +11:00
7c24804d62 Cleanup: de-duplicate Py_DECREF when evaluating PyDrivers 2022-03-15 15:06:25 +11:00
977c958242 Fix memory leak when there is an error evaluating a PyDriver
In practice users are unlikely to ever run into this error.
2022-03-15 15:03:27 +11:00
3cbf20228e Cleanup: use single back-ticks in regular comments
Double back-ticks are used for RST literals.
2022-03-15 14:53:49 +11:00
f410efbda0 UI: expose "Dolly View" in the menu
This is mainly to expose the shortcut to make Dolly discoverable.
2022-03-15 13:01:10 +11:00
Iyad Ahmed
fc259d4c30 Fix gpu.types.GPUTexture not passing data buffer to 3D textures
Missed in rB4430e8a00810ca8df2fa20029c4cb8078e8cdbe6

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D14333
2022-03-14 16:06:32 -03:00
d4e46c13cc Geometry Nodes: Add named attribute nodes behind experimental flag
This commit adds three nodes:
- `Remove Attribute`: Removes an attribute with the given name
- `Named Attribute`: A field input node
- `Store Named Attribute`: Puts results of a field in a named attribute

They are added behind a new experimental feature flag, because further
development of attribute search and name dependency visualization will
happen as separate steps.

Ref T91742

Differential Revision: https://developer.blender.org/D12685
2022-03-14 11:48:11 -05:00
a5578351c3 Auto-generate RNA-structs declarations in RNA_prototypes.h
So far it was needed to declare a new RNA struct to `RNA_access.h` manually.
Since 9b298cf3db we generate a `RNA_prototypes.h` for RNA property
declarations. Now this also includes the RNA struct declarations, so they don't
have to be added manually anymore.

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

Reviewed by: brecht, campbellbarton
2022-03-14 17:08:46 +01:00
cc98b40f87 Cleanup: Clang tidy 2022-03-14 10:55:48 -05:00
9b298cf3db RNA: Generate property declerations header, solving msg-bus C++ incompatibility
Lets `makesrna` generate a `RNA_prototypes.h` header with declarations for all
RNA properties. This can be included in regular source files when needing to
reference RNA properties statically.

This solves an issue on MSVC with adding such declarations in functions, like
we used to do. See 800fc17367. Removes any such declarations and the related
FIXME comments.

Reviewed By: campbellbarton, LazyDodo, brecht

Differential Revision: https://developer.blender.org/D13837
2022-03-14 16:50:49 +01:00
cff6eb6580 Cleanup: Remove duplicate Bake modifier code
This patch remove all duplicate code for the same Bake modifier logic.

Still some modifiers need custom bake functions and cannot use this generic bake.
2022-03-14 16:13:59 +01:00
8c4ddd5dde Fix dead-lock in movie cache
Steps to reproduce:
- Add image sequence to movie clip editor.
- Set cache limit to a low value in the user preferences.
- Playback until old frames starts to be removed from cache.
- Jump to the beginning of the image sequence.

The reason of dead-lock comes from two factors:
- Due to global nature of the cache limiter calls needs to be
  guarded with locks.
- Image buffers stored in the cache can have their own cache
  (which is used for color management).

Didn't find a better solution than to use recursive lock.
Kind of makes sense since the thread-guardable resource is
recursive (moviecache can have nested moviecaches).

Differential Revision: https://developer.blender.org/D14331
2022-03-14 14:46:49 +01:00
e0241e0860 Convert moviecache to C++ 2022-03-14 14:46:22 +01:00
a5cd1799fc Cleanup: Deduplicate code in Multiply modifier 2022-03-14 11:35:26 +01:00
8eb189925e Cleanup: Make more obvious from the name that function is not public 2022-03-14 11:21:23 +01:00
7306417ae4 Revert "Animation: Sensible frame range for motion paths"
This reverts commit 1558b270e9.

An earlier commit (rB101fadcf6b93c) introduced some new functionality,
which was overlooked in reviewing this commit & got broken.

Will re-commit after the issue has been fixed.

Ref: D13687
2022-03-14 11:17:45 +01:00
Henrik Dick
4045b3d7b6 GPencil: Fix offset modifier negative scale thickness
If the scale in the offset modifier was set to a value lower than -1,
the object would get mirrored. The problem was, that the thickness
was set to 0 by that. This fix makes the thickness calculation only
use the absolute values.

Differential Revision: http://developer.blender.org/D14324
2022-03-14 11:11:22 +01:00
bf5e9ef2df Fix T96402: fix case when material output is contained in node group
For now just assume that a node group without output sockets is
an output node. Ideally, we would use run-time information stored
on the node group itself to determine if the group contains a
top-level output node (e.g. Material Output). That can be
implemented separately.

In the larger scheme of things, top-level outputs within node
groups seem to break the node group abstraction and reusability
a bit.
2022-03-14 10:49:35 +01:00
c6642f06ab Fix T96395: NDOF entries prevent loading of custom keymaps in 3.2
Even though the default key-map didn't use NDOF types some key-maps did.
2022-03-14 20:42:12 +11:00
82e7956f12 Fix T96396: cannot set active node group output with Python
This is essentially the same fix as in rB22a341d9d8d3d337f79df228ab2e4e0726f81430.
2022-03-14 10:21:47 +01:00
b3d0abd893 Fix T96378: B-Bone selection fails in pose-mode
Regression in 3267c91b4d.
2022-03-14 20:10:24 +11:00
d7dd7403a8 WM: avoid hard coded modifier key checks in object.hide_collection
These checks aren't always valid when there are multiple events
in the queue.
2022-03-14 15:50:06 +11:00
541ba68991 Cleanup: use size_t for BLF text API functions
Also minor cleanup to txt_sel_to_buf:

- Use memcpy instead of strncpy as the strings don't contain nil bytes.
- Replace while loops with for loops.
2022-03-14 14:25:33 +11:00
a5571fd0e8 Cleanup: spelling 2022-03-14 14:25:32 +11:00
6ea1455ce3 Fix mistake in 4c951bfa82
Removed WITH_SYSTEM_GLEW by mistake, thanks to @The_Orb for spotting.
2022-03-14 14:25:31 +11:00
b959f603da Fix T96267: Sidebar Tab Font Size Correction
Correction to the calculation of font size used for the tabs on the
Sidebar so that they are always the same size as other content on the
panel.

See D14322 for more details.

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

Reviewed by Brecht Van Lommel
2022-03-13 17:08:15 -07:00
4ec1c8bc9c Cleanup: Use helper variable, const argument 2022-03-13 16:53:48 -05:00
25b4e41875 Curve: Store NURBS basis cache as a single vector
Instead of allocating a vector of the basis weights cache for
each evaluated point, allocate a single vector for all of the
weights. This should reduce memory usage by avoiding the
overhead of storing many vectors. I noticed a small performance
improvement to evaluated position calculation with an order of 5,
which is larger than `Vector`'s default inline buffer capacity.

This change is possible because of previous commits that
made the basis cache for each evaluated point always have
the same "order" size.
2022-03-13 16:53:48 -05:00
3c8182409c Cleanup: Simplify NURBS basis cache arguments
Only pass a mutable span and a return argument to the calculation
function, so it's simpler and doesn't worry about where either are
stored.
2022-03-13 16:53:48 -05:00
29dc6fb1c1 Curve: Remove temporary buffer during NURBS evaluation
Currently a single buffer is used as working space for all evaluated
points. In order to make evaluations more independent, opening
options like multi-threading in the future, instead use a separate
array for each call. Using an inline buffer capacity higher than
the default allows a few percent performance improvement, and removes
allocations for every evaluated point.
2022-03-13 16:53:48 -05:00
34a61ceeaa Cleanup: Remove unnecessary NURBS optimization
The step after calculating the NURBS basis for a single evaluated
point trimmed extra zeroes from the weights. However, in practice
this rarely did anything, only for the first and last evaluated point
of certain knot configurations. Remove it in order to simplify code.

Also use a separate span for the result, to clarify its length.
2022-03-13 16:53:48 -05:00
Octave C
3b16530aa1 UI: Fix incoherent brush size in popover menu and brush settings
Previously, the popover menu in sculpt/texture paint mode did not
take into account the `UnifiedBrushSettings` for the unit.

To fix this,  the behavior of `class _draw_tool_settings_context_mode`  is matched
by checking the same conditions when setting up the UI of the right-click popover menu.

Fixes T81616

Reviewed By: #sculpt_paint_texture, pablodp606

Maniphest Tasks: T81616

Differential Revision: https://developer.blender.org/D9168
2022-03-13 17:45:35 -04:00
Yevgeny Makarov
301fac5ded UI: Fix Label alignment in top bar
Label alignment in top bar by using `ui_text_icon_width_ex` instead of `w_hint`

Old:

{F12733743}

New:

{F12733742}

Fixes T61558

Reviewed By: Severin

Maniphest Tasks: T61558

Differential Revision: https://developer.blender.org/D13552
2022-03-13 17:38:55 -04:00
Henrik Dick
a6b5d5bfe8 GPencil: Simplify modifier minimal vert count fix
Lower the minimal vert count for all simplify modes.

Differential Revision: http://developer.blender.org/D14319
2022-03-13 17:21:30 +01:00
Aras Pranckevicius
70720c42c2 Fix T96303: C++ OBJ exporter needs presets and skip modifiers.
This patch, D14303, from Aras Pranckevicius adds presets to the OBJ exporter,
and also adds a checkbox (default on) to apply modifiers before export.
2022-03-13 12:04:52 -04:00
91dbc28363 Cleanup: clang format 2022-03-13 00:49:41 -05:00
f6b7396610 Fix transform gizmo check for shift to constrain to a plane
The eventstate was checked instead of the current event being handled,
causing the check to be invalid in some cases.
2022-03-12 21:29:14 +11:00
a2bb3c4cad GPencil: Fix unreported select error in Normalize operator
The curve selection was wrongly checked.
2022-03-12 10:48:42 +01:00
8617ab153e Fix T96352: Gpencil crash using Normalize Thickness with Curves
The stroke curve data could be NULL.
2022-03-12 10:33:32 +01:00
Dilith Jayakody
39c070ed8f Fix T96229: GN Fillet Node unexpected limit radius behavior for 3 point splines
This commit fixes T96229.

The maximum possible radius was being used for 3 point
splines, regardless of the current radius.

Reviewed By: HooglyBoogly

Maniphest Tasks: T96229

Differential Revision: https://developer.blender.org/D14311
2022-03-12 10:19:26 +05:30
f19582ebf4 UI: Use property split in curves surface panel 2022-03-11 14:57:50 -06:00
db7c4d7a1c Cleanup: Use new enum for NURBS curve knots modes
Move the definition of the enum to `Curves` DNA, since the values
will be saved in files, and ongoing development needs to use this.
2022-03-11 14:55:42 -06:00
bd9f94e917 Fix T94692: Show Cached OneDrive Thumbnails
When OneDrive files are offline, show preexisting thumbnails.

See D13930 for details.

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

Reviewed by Julian Eisel
2022-03-11 10:05:16 -08:00
22807d2075 Curves: Move constructor/assignment
Add the ability to move `CurvesGeometry` without copying its attributes
and data. The benefit is more intuitive management of the data-block
copying, and less overhead for copying in some cases. The "moved-from"
source is left in an empty but valid state. A test file is added to test
the move constructor.
2022-03-11 11:34:03 -06:00
Ethan-Hall
3b28c785d4 Cycles: show viewport hair settings when using Cycles
Before this patch, users had to switch render engines just to change how the
hair should be displayed in solid and material preview viewport shading modes.

Differential Revision: https://developer.blender.org/D14290
2022-03-11 18:27:58 +01:00
Ethan-Hall
3902bebf18 Cycles: make smart interpolation fallback to cubic for GPU
Matching CPU and Eevee behavior.

Differential Revision: https://developer.blender.org/D14296
2022-03-11 18:27:58 +01:00
1842cef210 Fix wrong line width when using Show Lines in Histogram scope
By not resetting the line width, other scopes were using the
wrong line thickness.

Contributed by RedMser.

Differential Revision: https://developer.blender.org/D12030
2022-03-11 18:27:58 +01:00
Hallam Roberts
3da84d8b08 Cleanup: use M_PI_2 and M_PI_4 where possible
The constant M_PI_4 is added to GLSL to ensure it works there too.

Differential Revision: https://developer.blender.org/D14288
2022-03-11 18:27:58 +01:00
62a0984d72 Cleanup: fix source typos homogenous->homogeneous
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D14306
2022-03-11 18:27:58 +01:00
e1a1dc868b Cleanup: fix source comment typos
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D14307
2022-03-11 18:27:58 +01:00
dbd9472ef5 Fix: Assert in set spline type node after recent commit
My own error when committing 0602852860. It appears that
the "Endpoint" knots modes should be handled together, otherwise
out of bounds array access is possible.
2022-03-11 11:27:34 -06:00
ae3c8bc9f0 Fix T85689: Replace SHGetFileInfoW for Drive Name
Win32: Replace SHGetFileInfoW as means to get friendly display names
for volumes because it causes long pauses for disconnected remote
drives.

See D14305 for more details.

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

Reviewed by Brecht Van Lommel
2022-03-11 09:26:59 -08:00
5c86f0369c Fix: Deleting vertex group attribute can change original mesh
There was an error with the attribute API implementation for vertex
groups. If the vertex group layer referenced an original mesh, it wasn't
properly duplicated for writing.
2022-03-11 11:25:59 -06:00
28434dab0c Cleanup: Use helper variable
For a NURBS curve, the order is just the degree plus one.
So just pass around the degree instead of always subtracting one.
2022-03-11 10:46:48 -06:00
9097c97767 Fix T96243: Workbench Curvature not rendering in background.
When rendering using the command line the curvature wasn't rendered. The reason
was that the ui_scale wasn't initialized and therefore the same pixels where
sampled to detect the curvature. This is fixed by setting the ui_scale to 1 for any
image render.
2022-03-11 13:52:12 +01:00
9bee8e46a1 Event System: limit early evaluation of drag actions to mouse buttons
Change early drag evaluation added in
1f1dcf41d5 to only apply to drag events
from mouse buttons. Otherwise pressing two keyboard keys at one would
create a drag event for the first pressed key. While this didn't cause
any bugs as far as I know, this behavior makes most sense for drags
that come from cursor input.
2022-03-11 23:06:45 +11:00
c87c12b2a4 Event System: only set press values in win->eventstate
Only set press events in the windows eventstate, not the current event
since it's not useful for these to be set current events press values.
This makes it possible for a press event to access values for the
previous press.
2022-03-11 23:04:11 +11:00
789b1617f7 Fix out of order event handling when calling operators from gizmos
Activating a gizmo used the windows eventstate which may have values
newer than the event used to activate the gizmo.

This meant transforms check for the key that activated transform
could be incorrect.

Support passing an event when calling operators to avoid this problem.
2022-03-11 22:49:47 +11:00
e20fe18706 Correct error in 1032f111d0
Thanks to Jacques Lucke for spotting.
2022-03-11 22:37:16 +11:00
f4c8b4eb3e Fix threading conflict with movie cache line
It was possible that a render thread will be freeing cache while the
interface is iterating over cache items to build cache line.

Found while looking into T94738. It might be a fix, but I am unable
to reproduce the original issue, so can not know for sure whether
there is something else going or or not.
2022-03-11 12:34:37 +01:00
f6564df351 Cleanup: remove duplicate compiler attribute 2022-03-11 15:29:11 +11:00
cf58648409 Correct error in d2222d5b2c 2022-03-11 15:27:34 +11:00
d2222d5b2c RNA: use a function to access the nurbs error message
It makes more sense to use a function in this case as this
creates an error message which is not data associated with
the NURBS curve.
2022-03-11 15:21:30 +11:00
8cc5483331 Text: use simplified logic for txt_to_buf
This function was copied from txt_sel_to_buf, including unnecessary
complexity to support selection as well as checks for the cursor
which don't make sense when copying the whole buffer.

Use a simple loop to copy all text into the destination buffer.
2022-03-11 15:14:14 +11:00
231eac160e PyAPI: use C/RNA API for Text.from_string/to_string
Use faster C code for getting the buffer from text.
2022-03-11 14:44:02 +11:00
1032f111d0 RNA: support functions returning allocated strings
Now it's possible for a C/RNA function to return a dynamic string,
The PROP_NEVER_NULL flag is also supported so a NULL string returns
None in Python.
2022-03-11 14:42:39 +11:00
f527d6582b Cleanup: remove unused variable 2022-03-11 12:38:34 +11:00
d73726dbbe Cleanup: use doxy sections for the outliner 2022-03-11 12:00:08 +11:00
0327a464ba Fix dragging items in the outliner
Regression in b8960267dd,
it's important for box-select to use the drag start to check
if the cursor is over an icon.
2022-03-11 11:46:23 +11:00
Laurynas Duburas
0602852860 Curve: Improve NURBS knot generation modes
This patch enables all 8 combinations of Nurbs modes: Cyclic,
Bezier and Endpoint. Also removes restriction on Bezier Nurbs order.

The most significant changes are mode combinations bringing new
meaning. In D13891 is a scheme showing NURBS with same control
points in a modes, and also further description of each possible case.

Differential Revision: https://developer.blender.org/D13891
2022-03-10 18:34:27 -06:00
27fb63381e Fix T94121: PyAPI: ID property group returns wrong type with iter()
Regression in 265d97556a.
Where iterating directly on a property group failed, e.g.:
`iter(group)`, tests missed this since only `group.keys()`
was checked.
2022-03-11 10:26:27 +11:00
4a8bd31825 Cleanup: use doxy sections in image.cc
Also minor improvements & clarifications to comments.
2022-03-11 09:41:48 +11:00
d449deec21 Cleanup: use enum for local versioning enum 2022-03-11 09:27:37 +11:00
Germano Cavalcante
e3de755ae3 Transform/UI: individualize the option to use snap per editor type
`3DView`'s `use_snap` option has little or nothing to do with using
snapping in `UV`, `Nodes` or `Sequencer`.
So there are no real advantages to keeping these options in sync.

Therefore, individualize the option to use snap for each "spacetype".

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13310
2022-03-10 18:47:38 -03:00
edcb2ad7b3 Fix: Handle handles reset when realizing with other curve types
The result handle attributes for non-bezier types are zeroed.
By mistake though, the entire array was zeroed, not just the
area corresponding to that curves source.
2022-03-10 15:42:30 -06:00
fe3a9fcce1 Fix incorrect meta strip background color
When viewing meta strip, it had orange color. This was caused by
overflow because of hard-coded offset. Theme got darker, and background
was also set again further in code, but redundant drawing was removed in
f4492629ea.
2022-03-10 20:26:21 +01:00
3f91e7d779 Curves: actually delete curves with Delete brush
Previously, the position was just set to zero as part of the prototype.

Differential Revision: https://developer.blender.org/D14291
2022-03-10 18:06:43 +01:00
22a341d9d8 Fix T96292: unable to set active material output using Python
Differential Revision: https://developer.blender.org/D14301
2022-03-10 18:04:07 +01:00
338fe9e2b5 Cleanup: Reduce duplication in realize instances code
Realizing and copying attributes of meshes, curves, and points are very
similar processes, but currently the logic is duplicated three times in
the realize instances code. This commit combines the implementation
for copying generic attributes and creating the result id attribute.

The functions for threaded copying and filling should ideally be in
some file elsewhere, since they're not just useful here. But it's not
clear where they would go yet.

Differential Revision: https://developer.blender.org/D14294
2022-03-10 09:37:56 -06:00
8cdee3a6d4 Fix T93710: Artifacts denoising hi-res images using OPtiX
Caused by an integer overflow in the tiling utilities of OptiX SDK.

Seems for now it's easier to copy and modify code to our sources so
that we don't need to bump SDK version requirement (which might lead
to an increased driver requirement as well).

There are still some fixes needed from a newer driver to have such
denoising to work properly: Windows requires 511.79, Linux 510.54.

Thanks Patrick for investigation!

Differential Revision: https://developer.blender.org/D14300
2022-03-10 16:17:59 +01:00
Ethan-Hall
34d8ef8fa4 Fix: closest image texture interpolation inconsistent in geometry nodes
The `-0.5f` offset is inconsistent with shader nodes.
See D14235 for an example file.

Differential Revision: https://developer.blender.org/D14235
2022-03-10 11:38:08 +01:00
7b62203fc7 IK: make Ik chain length non-animatable
Mark the chain length of regular and spline IK constraints
non-animatable. Changing the IK chain length requires a rebuild of
depsgraph relations. This makes it unsuitable for animation. It's better
to simply avoid having this property animatable than to allow animation
but produce unstable results.

Ref: T96203
2022-03-10 11:34:51 +01:00
1f1dcf41d5 Event System: key-press while dragging now activates drag first
When dragging with a large threshold (using a tablet for example),
it's possible to press another key before the drag threshold is reached.

So tweaking then pressing X would show the delete popup instead of
transforming along the X-axis.

Now key presses while dragging cause the drag event to be evaluated
before the key press.

Note that to properly base the mouse-move event on the previous
state the last handled event is now stored in the window.
Without this the inserted mouse-move event may contain invalid values
from the next event (it's modifier state or other `prev_*` values).

Requested by @JulienKaspar.
2022-03-10 21:26:15 +11:00
ef6d108b75 Fix T96279: 'Emulate 3 button mouse' fails to emulate MMB
Regression in 08d8eee006 caused
emulate-middle mouse to work once, clearing the modifier key.

Now the modifier key from emulated mouse events is never stored
in the windows event-state.
2022-03-10 20:50:58 +11:00
b33d38ebd9 Cleanup: de-duplicate event customdata freeing logic 2022-03-10 16:44:47 +11:00
8c3aee2faf Cleanup: use SPDX license header 2022-03-10 16:27:18 +11:00
36dd3f42bc Cleanup: use 'WM_file_' prefix for file operations 2022-03-10 16:27:18 +11:00
1829232598 Cleanup: spelling in comments & some minor clarifications 2022-03-10 16:27:18 +11:00
0ef8a6179d Cleanup: Move image.c to c++
Passing on all platforms:
https://builder.blender.org/admin/#/builders/18/builds/329

Differential Revision: https://developer.blender.org/D13962
2022-03-09 21:03:02 -08:00
f379943734 Cleanup: Simplify/deduplicate curves built-in attribute access
Separate two templated functions that deal with custom data so that
each built-in attribute accessor doesn't need the same boilerplace and
logic.
2022-03-09 22:59:39 -06:00
24c543d4af Fix: Add missing break 2022-03-09 10:27:08 -06:00
115ff08fdb Fix: Use "construct" instead of "assign" for uninitialized memory
The realize instances code used "assign", but the attribute buffers on
the result aren't necessarily initialized. This doesn't make a difference
for trivial types like `int`, but it would with more complex types.
2022-03-09 10:23:17 -06:00
6c6f591f90 Curves: Port realize instances node to the new data-block
This commit replaces the temporary conversion to `CurveEval` with
use of the new curves data-block. The end result is that the
process looks more like the other components-- somewhere in between
meshes and point clouds in terms of complexity.

The final result is that the logic between meshes and curves is
very similar. There are a few different strategies to reduce
duplication here, so I'll investigate that separately.

There is some special behavior for the radius and handle position
attributes. I used the attribute API to store spans of these
attributes temporarily. Using access methods on `CurvesGeometry`
would be reasonable to, storing spans separately feels a bit more
predictable for now though.

There should be significant performance improvements in some cases,
I haven't tested that specifically though.

Differential Revision: https://developer.blender.org/D14247
2022-03-09 09:58:02 -06:00
39c50d8f31 Outliner: Ensure compiler error when passing wrong tree-element to macro
Passing a `TreeElement *` instead of its `TreeStoreElement *` to
`TSELEM_OPEN()` would seem to work but cause a bug. Add a type check
that will cause a compiler error if it fails.
2022-03-09 15:28:16 +01:00
8e3a58578a Outliner: Correct check for element culling
I don't see a reason to use 2x the element height for the "in-view"
checks. That seems incorrect (although shouldn't cause issues). So
remove that, I don't expect behavior changes.
2022-03-09 15:23:51 +01:00
c4d3d10401 Cleanup: Deduplicate Outliner item culling logic
For whatever reason the "in-view" check was using 2x the element height.
From what I can see this isn't needed, so I'll remove it in a follow-up
commit.
2022-03-09 15:23:51 +01:00
beaf2baeff Cleanup: fix wrong spelling of texture and indentation
Contributed by luzpaz.

Ref D14271, D14270
2022-03-09 15:07:38 +01:00
Ethan-Hall
ef3d76fbaa Fix wrong detection of alpha for grayscale images, after recent changes
Differential Revision: https://developer.blender.org/D14286
2022-03-09 14:53:07 +01:00
6be665926c LibOverride/Outliner: Restrict further operations over liboverrides.
Restrict a lot deletion/moving around of liboverride objects and
collections in the Outliner.

While some of those operations may be valid in some specific cases, in
the vast majority of cases they would just end up breaking override
hierarchies/relationships.

Part of T95708/T95707.
2022-03-09 12:50:04 +01:00
6a7066c2c1 LibOverride: Add a 'is hierarchy root' macro check. 2022-03-09 12:50:04 +01:00
4da282a161 Curves: rename initial brushes
The brushes that are still called "Test" still need to be changed
until they can get their correct name.

Ref T96259.
2022-03-09 11:33:33 +01:00
010ea688f1 Fix T96233: Crash with gpencil data with vertex groups
Blender crashes when a multi-user grease pencil object has vertex
groups and is modified by modifiers, layer transform or parenting.

The fix makes sure that we copy the vertex group names list.

Reviewed By: antoniov

Maniphest Tasks: T96233

Differential Revision: https://developer.blender.org/D14275
2022-03-09 11:22:51 +01:00
04e89c5b06 Fix T96165: Incorrect render of barcelone scene with BVH2
Fix T95462: Partly transparent objects appear to glow in the dark

The issue was caused by incorrect check for exceeded number
of transparent bounces: the same maximum distance was used
for picking up N closest intersections and counting overall
intersections count.

Now made it so intersection count is using ray distance which
matches the way how Embree and OptiX implementation works.

Benchmark result:
{F12907888}

There is no big time difference in the pabellon scene. The
Victor scene timing doesn't seem to be very reliable as the
variance in time across different benchmark runs is quite
high.

Differential Revision: https://developer.blender.org/D14280
2022-03-09 10:37:19 +01:00
801d7b4921 Fix T95738: wrong "Bottom" selection for cone without base
Original patch by @lone_noel with changes by me.

Differential Revision: https://developer.blender.org/D14102
2022-03-09 10:34:59 +01:00
1f9d85f56a Fix cursor drag failing to use click-start
Error in b8960267dd,
the flag was cleared before use.
2022-03-09 17:18:31 +11:00
9416004092 Cleanup: use doxygen comments & sections for animation files 2022-03-09 16:29:22 +11:00
136f0910ff Fix T96250: Invalid default for uv_relax_method
Correct the default & version existing files.
2022-03-09 16:10:19 +11:00
20f53f6984 Correct assert in 399ac1ff11
Pass NULL instead of an empty string.
2022-03-09 13:43:39 +11:00
399ac1ff11 Fix subtype & default for keying set operator properties
Error in 1a12c9edab,
also correct descriptions.
2022-03-09 13:23:00 +11:00
e55f4657f7 Fix T89560: Keymap editor no longer shows keying set dropdown
Include built-in keying sets when ANIM_keying_sets_enum_itemf is called
without a context to allow binding keys to built-in keying sets.
2022-03-09 13:02:29 +11:00
2146256563 Cleanup: use ELEM macro 2022-03-09 10:13:43 +11:00
626c844105 Cleanup: rename wmEvent.prev_click_* to prev_press_*
At the time of naming these members only some event types generated
click events so it made some sense to differentiate a click.

Now all buttons support click & drag it's more logical to use the
prefix "prev_press_" as any press event will set these values.

Also update doc-strings.
2022-03-09 09:25:14 +11:00
353376c783 Fix T92331: Duplicated Window Should Not Be Modal
Operator area_dupli_invoke should not create modal windows.

See D14253 for details.

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

Reviewed by Brecht Van Lommel
2022-03-08 13:57:35 -08:00
Aleksi Juvani
eb326c7b40 Attributes: Implement CustomData interpolation for boolean data type
This commit fixes an issue, where for instance, when merging vertices
with the "Merge by Distance" geometry node, the resulting vertices had
their boolean attributes set unpredictably.

Boolean attributes are implemented as custom data, and when welding
vertices, the custom data for the resulting vertices comes from
interpolating the custom data of the source vertices.

This commit implements the missing interpolation function for the
boolean custom data type. This interpolation function is implemented in
terms of the logical or operation, that is to say, if any of the source
vertices (with a weight greater than zero) have the boolean set, the
boolean will also be set on the resulting vertex.

This logic matches 95981c9876.

In geometry nodes, attribute interpolation generally does not use the
CustomData API for performance reasons, but other areas of Blender
still do.

Differential Revision: https://developer.blender.org/D14172
2022-03-08 15:51:53 -06:00
521d4190a0 Fix T96146: Subdivide curve node uninitialized dangling handles
Handles of non-cyclic bezier curves were not initialized.
Now properly copy the dangling handle positions and types
from the source curve.
2022-03-08 15:45:37 -06:00
b8960267dd Event System: drag events no longer default to the drag start location
This avoids transform jumping which is a problem when tweaking values a
small amount. A fix for T40549 was made box-select used the location
when the key was pressed.

While it's important for box-select or any operator where it's expected
the drag-start location is used, this is only needed in some cases.
Since the event stores the click location and the current location,
no longer overwrite the events real location. Operators that depend on
using the drag-start can use this location if they need.

In some cases the region relative cursor location (Event.mval) now needs
to be calculated based on the click location.

- Added `WM_event_drag_start_mval` for convenient access to the region
  relative drag-start location (for drag events).
- Added `WM_event_drag_start_xy` for window relative coordinates.
- Added Python property Event.mouse_prev_click_x/y

Resolves T93599.

Reviewed By: Severin

Ref D14213
2022-03-09 08:38:42 +11:00
Hallam Roberts
156e07232e Geometry Nodes: Tiny optimization to UV Sphere primitive
Prevents a few unneeded calls to `std::sin`, with an observed
performance improvement of about 1 percent.

Differential Revision: https://developer.blender.org/D14279
2022-03-08 14:39:58 -06:00
d09695b4dd Cleanup: Clang tidy 2022-03-08 13:28:22 -06:00
90c3147e05 Cleanup: Correct comment
Normals aren't stored in custom data anymore, nor are they stored in
MVert for comparisons.
2022-03-08 12:31:21 -06:00
c7ff99b100 Merge branch 'blender-v3.1-release' 2022-03-08 12:19:50 -06:00
c77597cd0e Fix T95843: Invalid mesh runtime data after sculpt undo
When the geometry of the sculpt mesh was replaced when restoring from
a full undo step, the runtime data was not cleared (including any
normals, triangulation data, or any other cached derived data).
In the report, only the invalid normals were observed.

The fix is to simply clear these caches. Later they will be reallocated
and recalculated if necessary. Since the whole mesh replaced here
anyway, this should be a safe fix.

Differential Revision: https://developer.blender.org/D14282
2022-03-08 12:16:42 -06:00
ffea47530d Merge branch 'blender-v3.1-release' 2022-03-08 18:46:23 +01:00
7add8163e4 Blender 3.1 - version bump -> release 2022-03-08 18:36:00 +01:00
b154b8c6f8 Merge branch 'blender-v3.1-release' 2022-03-08 18:34:09 +01:00
b217eb73f5 Licenses: Attribution document for Blender 3.1 2022-03-08 18:27:04 +01:00
50bd8bb175 Cleanup: Remove extra . at the end of RNA string
The strings must not end with point.
2022-03-08 16:55:29 +01:00
c305b88aac Docs: 3.1 release description for Linux appdata 2022-03-08 16:55:19 +01:00
944122d49f Cleanup: Use ELEM macro 2022-03-08 16:44:03 +01:00
62885637fb Cleanup: Make format 2022-03-08 16:41:30 +01:00
Marc Chéhab
e74838d0d0 GPencil: New "Additive" mode for build modifier
The new mode only builds the new strokes in each frame. 

The code is assuming somebody uses "additive" drawing, so that each frame is different only in its NEW strokes. Already existing strokes are skipped. 

I used a simple solution: Count the number of strokes in the previous frame and ignore this many strokes in the current frame.

Differential Revision: https://developer.blender.org/D14252
2022-03-08 16:40:27 +01:00
5791835678 Geometry Nodes: fix spline length node after recent refactor
Differential Revision: https://developer.blender.org/D14276
2022-03-08 16:09:44 +01:00
7bd3762b7c UI: Minor tweaks to IDTemplate operations. 2022-03-08 14:57:47 +01:00
bea7d2e22d LibOverride: Do not assert when root ID is not object/collection.
While uncommon, this is still a valid case...
2022-03-08 14:57:47 +01:00
178f4fa71e Cleanup: fix compiler warning 2022-03-08 13:58:50 +01:00
6f8e65cd7a Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-03-08 13:48:47 +01:00
d5e4cab76c Fix T96224: GPU subdiv crash with smooth normals and tangents
Tangents are computed from UVs on the CPU side when using GPU subdivision
and require that the normals are available there as well (at least for smooth
shading, flat normals can be computed on the fly). This simply adds the missing
normals update call for the `MeshRenderData` setup for the subdivision case.

Differential Revision: https://developer.blender.org/D14278
2022-03-08 13:47:14 +01:00
3a672fe6fb GPU: disable compute shader for problematic drivers
Some drivers for legacy platforms seem to have issues with compute
shaders, as revealed by T94936. This disables compute shader for the
known drivers where this issue is present. It is not clear if the issue
is Windows only or not, so this disable them for all operating systems.

See T94936 for a list of configurations where the issue is reproducible
or not.

Differential Revision: https://developer.blender.org/D14264
2022-03-08 13:39:18 +01:00
64a5fd7a1d Fix wrong edge crease validity check in the Cycles Alembic procedural 2022-03-08 13:38:21 +01:00
3cb3167278 Simplify sound property handling
Sound properties like volume, pitch and muting are handled in
`BKE_sound_add_scene_sound()`. This is unnecessary, because in
properties are then set to real values in `SEQ_edit_update_muting()` and
`seq_update_seq_cb()`.

Alternatively, it may be better to remove all other updates leave them
in `BKE_sound_add_scene_sound()`. But I want to add muting per channel,
whhich is easier and probably cleaner to do with function
`SEQ_edit_update_muting()`.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D14269
2022-03-08 13:16:36 +01:00
73dc8c24e4 PyAPI: optimize depsgraph use in PyDrivers
Avoid re-creating & freeing the depsgraph for every driver evaluation.

Now the depsgraph is kept in the name-space (matching self),
only re-created when the value changes.

In a contrived test-case with many drivers this gave ~15% overall
speedup for animation playback.
2022-03-08 22:15:12 +11:00
f76f48be23 Fix (unreported) liboverride rules from linked data disapearing.
Code cleaning up no-more-needed override data during diffing process
would systematically remove override data from linked IDs.

While this is not a critical issue in theory, it has bad consequences at
the very least on user UI/UX, and potentially can cause bugs in some
corner-cases scenarii.
2022-03-08 12:08:21 +01:00
0df8c22c8a LibOverrides: Tweak to ensure no overrides can be created on linked data.
Was already mostly the case, but from RNA API there was no proper check.
2022-03-08 11:02:22 +01:00
1c1efe3ac6 Fix memory leak evaluating PyDrivers
Missed decref in 686ab4c940 caused every
driver evaluation to create the BPy_StructRNA depsgraph without freeing
the previously allocated depsgraph.
2022-03-08 20:47:43 +11:00
10c11bb897 Curves: add initial comb, grow and shrink brush
The exact behavior of the brushes is still being iterated on, but it
helps having a base implementation that we can work upon.
All of that is still hidden behind an experimental feature flag anyway.

The brushes will get a name in the ui soon.

Differential Revision: https://developer.blender.org/D14241
2022-03-08 10:41:52 +01:00
Jeroen Bakker
1d902a6367 Fix T96213: Crash when texture painting across multiple materials.
Issue only happens in release builds on windows. That said it was an
actual error in the code. This class is compiled inline in release
builds. When updating multiple textures it would reuse the same memory
to collect the changes. When the previous loaded tilenumber was exactly the
same but from a different image the tile buffer wasn't loaded.

Reviewed By: sergey

Maniphest Tasks: T96213

Differential Revision: https://developer.blender.org/D14274
2022-03-08 10:38:38 +01:00
94d2470c41 Curves: increase default viewport resolution for curves object
This part has to be refactored soon anyway, because more types
curves have to be drawn for the new Curves object.

For now, 3 is a better default than 2, because that matches the
actual resolution of the curve currently.
2022-03-08 10:36:46 +01:00
4b598739c5 Curves: disable stroke spacing for curve sculpt brushes
This makes the brushes more smooth, because the brush has an
effect after every mouse move, instead of only every x pixels.

For this to work well, the brushes have to look at the stroke
segments instead of at the mouse positions separately.

A more fine grained check might be added in the future.
2022-03-08 10:33:51 +01:00
b588c09eee Fix: add missing case in switch statement for curves 2022-03-08 10:23:38 +01:00
3d71a05a1d Merge branch 'blender-v3.1-release' 2022-03-08 09:52:47 +01:00
Pratik Borhade
2ddb53de54 Fix T96228: TypeError on use of Copy from Active Track operation
Issue was introduced after the python 3.10 switch
Explicit conversion to int will fix the issue.
Same issue is likely to happen with `MovieTrackingSettings.default_search_size`
So I did the same change over there.

Differential Revision: https://developer.blender.org/D14273
2022-03-08 09:52:17 +01:00
63ac1660c0 Fix T92861: Transform fails for multiple pose object sharing ob-data
Support transforming two pose objects at once even when they share
object data as this is per-object.
2022-03-08 15:13:53 +11:00
3c889fe2b0 Cleanup: pass const scene argument to UV selection functions 2022-03-08 14:45:33 +11:00
06d9c2c223 Cleanup: spelling in comments 2022-03-08 14:32:34 +11:00
c0c840cc31 Cleanup: prefer UNUSED_VARS_NDEBUG for debug only variables
Otherwise it's possible to accidentally use these variables
in debug builds, breaking release builds.
2022-03-08 14:15:34 +11:00
59c972b40a Event System: remove unused NDOF buttons
GHOST always converts NDOF keyboard buttons into keyboard events
so there is no need to expose their values for Blender event types.
2022-03-08 14:01:49 +11:00
88b2bbc649 Event System: support changing NDOF button shortcuts 2022-03-08 13:56:04 +11:00
b58e660828 Event System: click/click-drag support for NDOF buttons
Support this for completeness, as it's simpler to support click-drag
for all events types that support press/release instead of having to
document which kinds buttons support click-drag.
2022-03-08 13:48:40 +11:00
f052fb5646 Event System: add ISKEYBOARD_OR_BUTTON macro
This simplifies checking for event types that support press & release.
2022-03-08 13:48:34 +11:00
08d8eee006 Event System: refactor click detection into function
Also simplify modifier & keymodifier assignment.
2022-03-08 13:48:33 +11:00
08f88bba69 Event System: exclude cursor & NDOF motion from ISHOTKEY() macro
In practice this didn't cause a bug since assigning hot-keys was also
checking for "press" events (which NDOF_MOTION doesn't generate).

Add ISNDOF_BUTTON macro which is now used by ISHOTKEY to avoid
problems in the future.
2022-03-08 13:48:32 +11:00
7b66397664 Cleanup: spelling in comments, use C++ comments for disabled code 2022-03-08 13:48:31 +11:00
901a03725e Curves: Port mesh to curve node to new data-block
The main improvement is a code simplification, because attributes don't
have to be transferred separately for each curve, and all attributes can
be handled generically. Performance improves significantly when the
output contains many curves. Basic testing with a 2 million curve output
shows an approximate 10x performance improvement.
2022-03-07 19:06:40 -06:00
c238728105 Fix: Curves cyclic access function duplicates attribute
This was an oversight in 6594e802ab. First it must check if the
attribute exists before adding it.
2022-03-07 18:58:04 -06:00
b8f1ae5c38 Cleanup: Rename geometry set "curve" to "curves"
Similar to 245722866d, just another function I missed before.
2022-03-07 16:26:55 -06:00
dfd7832a0e Merge branch 'blender-v3.1-release' 2022-03-07 13:58:14 -06:00
2b3367cdf8 Fix T93573: Curve evaluated mesh selected in edit mode
This fixes the second part of T93573 that 8506f3d9fe didn't
properly address. Specifically, outlines of instances still had the
selected color in edit mode in wireframe view. This change is the
same as that commit, just in a different place.

Differential Revision: https://developer.blender.org/D14229
2022-03-07 13:54:49 -06:00
0597902bde Fix memory leak when reading ffmpeg video frames.
We had forgotten to unref packets after reading them.
This lead to a memory leak inside of ffmpeg.
2022-03-07 19:04:51 +01:00
Leon Schittek
1cb303242f UI: align labels of number fields and value sliders
Previously the labels and values in number fields and value sliders
used different padding for the text. This looks weird when they are
placed underneath each other in a column and, as noted by a comment
in the code of `widget_numslider`, they are actually meant to be
aligned.

This patch fixes that by using the same padding that is used for the
number field for the value slider, as well. This also has the benefit,
that the labels of the value sliders don't shift anymore when adjusting
the corner roundness.

Differential Revision: https://developer.blender.org/D14091
2022-03-07 18:32:47 +01:00
21d633f83b GPencil: Temporary fix to avoid crashes on startup
This quick fix will populate the runtime orig pointers to avoid
crashes when a grease pencil object uses layer transforms, parenting
or modifiers.
This will have to be revisited and fixed with a better solution.
2022-03-07 17:48:36 +01:00
Ethan-Hall
15186f4259 Shader Nodes: added alpha mode selector to Image Texture node
Enables image user nodes to display the file alpha mode, similar to the
colorspace setting.

Also removes image_has_alpha in favor of using BKE_image_has_alpha, because it
did not check if the image actually had an alpha channel, just if the file format
was capable of supporting an alpha channel.

Differential Revision: https://developer.blender.org/D14153
2022-03-07 17:39:27 +01:00
Ethan-Hall
5b4ab89663 Shader Nodes: add Alpha output to Object Info node
An alpha component can be specified for an object's color. This adds an alpha
socket to the object info shader node allowing for the alpha component of the
object's color to be accessed in the shader editor.

Differential Revision: https://developer.blender.org/D14141
2022-03-07 17:35:48 +01:00
76f9d83a19 Merge branch 'blender-v3.1-release' 2022-03-07 17:31:32 +01:00
Ethan-Hall
60481e4d99 Fix T96195: f-curve factorized polynomial generator broken UI
The polynomial parameters were not shown correctly.

Differential Revision: https://developer.blender.org/D14254
2022-03-07 17:30:30 +01:00
f130d4f211 Cleanup: fix various typos
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D14203
2022-03-07 17:28:39 +01:00
5bb2b4236d Cleanup: move asssertion-test-only variable into #ifndef NDEBUG block
Move `ToolSettings *ts` into an `#ifdef NDEBUG` block, as it's only used
for a `BLI_assert` call.
2022-03-07 17:10:13 +01:00
2d06b97d29 Fix T95256: Crash when creating off-screen pose asset
Fix crash when creating a pose asset for which the file list entry in
the asset browser is scrolled off-screen. Because of the
off-screen-ness, it wasn't loaded into memory, which eventually caused
an unexpected NULL pointer.

The solution was to use a different function (`filelist_file_find_id`)
that can reliably find the file list entry, after which the cache entry
can be created.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D14265
2022-03-07 17:07:20 +01:00
Leon Schittek
6b8dde93b0 Fix T95531: Draw y axis values in Driver Editor
When drawing the driver editor, only skip drawing the "scrubbing area"
and not the Y-axis values or the scroll bars.

The issue was introduced in rBb3431a88465db2433b46e1f6426c801125d0047d
to avoid drawing the playhead in the Driver Editor but also prevented
the text on the y axis from being drawn.

Reviewed by: Severin, sybren

Maniphest Tasks: T95531

Differential Revision: https://developer.blender.org/D14022
2022-03-07 17:07:20 +01:00
5dca3ee6a2 Fix T95256: Crash when creating off-screen pose asset
Fix crash when creating a pose asset for which the file list entry in
the asset browser is scrolled off-screen. Because of the
off-screen-ness, it wasn't loaded into memory, which eventually caused
an unexpected NULL pointer.

The solution was to use a different function (`filelist_file_find_id`)
that can reliably find the file list entry, after which the cache entry
can be created.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D14265
2022-03-07 17:04:10 +01:00
5ae26e410a Fix T94360: Assert on dragging keyframes
Fix an assert by commenting out the assert.

In normal situations all keyframes are sorted. However, while keys are
transformed, they may change order and then this assertion no longer
holds. The effect is that the drawing isn't perfect during the
transform; the "constant value" bars aren't updated until the
transformation is confirmed. Apart from that, the code runs fine, so it
seems like a workable workaround.
2022-03-07 16:48:44 +01:00
Leon Schittek
ea3b2e8736 Fix T95531: Draw y axis values in Driver Editor
When drawing the driver editor, only skip drawing the "scrubbing area"
and not the Y-axis values or the scroll bars.

The issue was introduced in rBb3431a88465db2433b46e1f6426c801125d0047d
to avoid drawing the playhead in the Driver Editor but also prevented
the text on the y axis from being drawn.

Reviewed by: Severin, sybren

Maniphest Tasks: T95531

Differential Revision: https://developer.blender.org/D14022
2022-03-07 16:24:17 +01:00
5b2d9c0cbe Merge branch 'blender-v3.1-release' 2022-03-07 15:19:05 +01:00
e908ebc094 Fix T96207: wrong default value of Principled BSDF specular tint
Contributed by MysteryPancake.

Differential Revision: https://developer.blender.org/D14256
2022-03-07 14:53:59 +01:00
7f57899823 Merge branch 'blender-v3.1-release' 2022-03-07 12:37:54 +01:00
00f6e4c990 Fix T96180: driver in node tree not updating in real time
Differential Revision: https://developer.blender.org/D14260
2022-03-07 12:37:13 +01:00
4ffe2fec16 Python: Add new annotation_pre & annotation_post handlers
Annotation tool is used as a general mark tool for many add-ons. To be able to detect when an annotation is done is very handy to integrate the annotation tool in add-ons and other studio workflows.

The  new callback names are:  `annotation_pre`  and `annotation_post`

Both callbacks are exposed via the Python module `bpy.app.handlers`

Example use:

```
import bpy

def annotation_starts(gpd):
    print("Annotation starts")

def annotation_done(gpd):
    print("Annotation done")

bpy.app.handlers.annotation_pre.clear()
bpy.app.handlers.annotation_pre.append(annotation_starts)
bpy.app.handlers.annotation_post.clear()
bpy.app.handlers.annotation_post.append(annotation_done)
```

Note: The handlers are called for any annotation tool, including eraser.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D14221
2022-03-07 12:36:47 +01:00
548eabbaa1 Revert "Revert "Fix Crash: Switching to wireframe mode.""
This reverts commit 25fc5876d3.

Committed this unintentionally, looking into an alternate fix.
2022-03-07 22:32:46 +11:00
638c0bd234 Merge branch 'blender-v3.1-release' 2022-03-07 21:52:24 +11:00
a61ee1dcae Cleanup: quiet warnings 2022-03-07 21:51:50 +11:00
0e51defcf4 Fix T95591: Crash on drawing with measure tool with tweak fallback tool
Using press to activate the Tweak tool doesn't work well when used a
fallback tool as the drag event is often used by the current tool -
making it impossible not to select when dragging (unless the fallback
tool is disabled entirely).
Resolve this by using CLICK events when the Tweak tool is used as a
fallback.

Even though this avoids the crash, check for null-pointer de-reference
since changes to the key-map shouldn't cause operators to crash.

Note that the ability for operators to access a gizmo before it's fully
initialized is a more general problem that should be addressed, but out
of scope for a bug-fix.

Reviewed By: zeddb, JulienKaspar, Severin

Maniphest Tasks: T95591

Ref D14231
2022-03-07 21:47:00 +11:00
Yann Lanthony
7ca13eef7c Improve multi-user gpencil data performance with modifiers
When a grease pencil data-block has multiple users and is subject
to modifiers, layer transforms or parenting, performance
(especially playback) is greatly affected.

This was caused by the grease pencil eval process which does per
instance full-copies of the original datablock in case those
kinds of transformations need to be applied.

This commit changes the behavior of the eval process to do shallow
copies (layers with empty frames) of the datablock instead
and duplicates only the visible strokes.

When we need to have a unique eval data
per instance, only copy the strokes of visible
frames to this copy.

Performance:
On a test file with 1350 frames 33k strokes and 480k points
in a single grease pencil object that was instanced 13 times:
 - master: 2.8 - 3.3 fps
 - patch: 42 - 52 fps

Co-authored by: @filedescriptor
This patch was contributed by The SPA Studios.

Reviewed By: #grease_pencil, pepeland

Differential Revision: https://developer.blender.org/D14238
2022-03-07 11:38:56 +01:00
57c5f2a503 Merge branch 'blender-v3.1-release' 2022-03-07 21:35:21 +11:00
72e20785e1 Fix T96205: Active shape key gets lost upon edit mode undo
Regression in d961adb866,
it's important that for the Mesh used for undo storage matches
the shape-key instead of using the coordinates of the Basis key.

Prior to bfdbc78466 a different method of
restoring the basis shape-key coordinates was used (restoring from the
input `Mesh.mvert` array). When undo wrote the edit-mesh into the mesh
this was always NULL so the basis shape keys coordinates were never
used.

Now a parameter has been added so undo can use the active shape for the
meshes vertex coordinates.

Reviewed By: sergey

Maniphest Tasks: T96205

Ref D14258
2022-03-07 21:31:48 +11:00
25fc5876d3 Revert "Fix Crash: Switching to wireframe mode."
This reverts commit cb986446e2.
2022-03-07 19:55:33 +11:00
Jeroen Bakker
073d2390f0 Fix T96163: Image editor doesn't refresh when undo/redo.
Undo would invalidate image owned GPU textures only. Textures
that are owned by the editor were not refreshed. This patch would
invalidate all the GPU textures by marking the whole image dirty.

This can be improved later as we could add partial updates of GPU
textures.

Reviewed By: mont29

Maniphest Tasks: T96163

Differential Revision: https://developer.blender.org/D14259
2022-03-07 08:43:50 +01:00
ad2948face Merge branch 'blender-v3.1-release' 2022-03-07 07:49:52 +01:00
4681987d92 Fix T96156: Snap to 3D cursor can't be undone
Caused by oversight in 2bcf93bbbe. Operator returns `OPERATOR_CANCELLED`
when it should return `OPERATOR_FINISHED`.

Reviewed By: mano-wii, campbellbarton

Differential Revision: https://developer.blender.org/D14243
2022-03-07 07:46:24 +01:00
Red Mser
8ec35c05b2 Curve: sync active material with selection
Changing active spline updates active material index.

Reviewed By: campbellbarton

Ref D14250
2022-03-07 12:06:33 +11:00
fae45a43fa Cleanup: use doxy-sections for pipeline, text_drag & effects
Also improve on the doc-string for RE_RenderFrame & RE_RenderAnim.
2022-03-07 10:51:22 +11:00
a5f972c018 Cleanup: use loops for key-map entries that map values to number keys
Also add __all__ referencing the only two members of the modules
that should be accessed externally.
2022-03-06 21:16:21 +11:00
887ccb8537 Fix T96152: Crash realizing curve instances
The "curve_type" was transferred to instances because it isn't a
built-in curve attribute. Then it was interpolated as a point
domain attribute from the instance domain in the realize
instances node.

The fix was just missing from 9ec12c26f1.
`curve_type` needs to be marked as a built-in attribute.
2022-03-04 22:28:57 -05:00
295d5c6ef5 Fix T96164: Crash with curve domain attributes
When converting from the new type to the old, the curve domain
attributes weren't properly resized, so their data was not properly
allocated.
2022-03-04 11:11:56 -05:00
45079b169d Fix T96160: freezing when using multiple Handle Type Selection nodes
Differential Revision: https://developer.blender.org/D14245
2022-03-04 15:21:18 +01:00
1763ffa0be Cleanup: Unused variable warnings 2022-03-04 07:59:07 -05:00
5eaeb9bd0d GPencil: Fix wrong parameters in gpencil_check_same_material_color
The stroke and fill parameters were flipped.
2022-03-04 08:44:23 +01:00
0212c423bf Cleanup: remove outdated references to tweak 2022-03-04 13:31:16 +11:00
0a4fdcbb5f Cleanup: unused Python variables & imports 2022-03-04 11:07:37 +11:00
6bca614fd8 Cleanup: use doxy-sections in outliner_draw.cc
Also remove outdated comment.
2022-03-04 10:53:06 +11:00
bfd43222c3 Cleanup: use doxy-sections for interface_dropboxes.cc 2022-03-04 10:35:22 +11:00
0a2d61f45c Sequencer: de-duplicate new-scene enum, include in generated docs 2022-03-04 10:31:11 +11:00
65e6bcdd9f Sequencer: disallow assigning scenes to non-seuencer strips 2022-03-04 10:31:11 +11:00
ccefcf46bf Cleanup: use doxy-sections in scene_edit.c 2022-03-04 10:31:11 +11:00
4837ea3ab6 Cleanup: warning & spelling from recent scene/sequencer operator
- Avoid the abbreviation "VSE" as the convention is to use "sequencer".
- Remove dead-code (second return statement).
- Remove unused argument.
2022-03-04 10:31:11 +11:00
8b06c524d2 Cleanup: spelling in comments, function name 2022-03-04 10:31:11 +11:00
Azeem Bande-Ali
fd2519e0b6 UI: Drag & Drop to Properties Materials Panel
Support drag/drop of materials to Properties Material Slots.

See D13549 for more details.

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

Reviewed by Julian Eisel
2022-03-03 15:28:48 -08:00
471f27d66b Curves: Port endpoint selection node to new data-block
The node should be faster than in 3.1, for a few reasons:
- It doesn't need to calculate and allocate the curve offsets.
- It doesn't need to de-reference a pointer for each curve.
- The inputs are accessed from the virual arrays fewer times.

On top of that, I added two other performance improvements:
- The node is multi-threaded when there are many curves.
- There are generated special cases for single value and span inputs.

**Performance**
With a set position node affecting 1 million splines with a selection
based on this node, on an Intel i5 8250U (times are approximate):
| Before | After | Speedup |
| 760 ms | 60 ms | 13x     |

Differential Revision: https://developer.blender.org/D14233
2022-03-03 11:55:31 -05:00
908ac7dce2 Merge branch 'blender-v3.1-release' 2022-03-03 17:47:34 +01:00
769ae5c866 Fix T96139: Cycles doesn't warn if the render is paused
Caused by 6ec83afb1d.

Technically, a regression since 3.0.

Differential Revision: https://developer.blender.org/D14239
2022-03-03 17:21:11 +01:00
d793d18413 BLI: Add functions to IndexRange to mirror Span
Adds functions for special cases of slicing and an `is_empty` method.
2022-03-03 11:14:44 -05:00
e8dc82311d Fix T96145: GPencil eval data not updated correctly
When removing a modifier, changing the layer transform or updating
 the parent of a grease pencil object that has a multi-user datablock
 and animation data, the eval data is not updated properly (after a
 frame change). This can also cause memory leaks.

 The fix makes sure that we free and reset any runtime copy
 (`ob->runtime.gpd_eval`) in `BKE_gpencil_prepare_eval_data`.

 Note: As far as we can tell, `ob->runtime.gpd_orig` is unused and could
 be removed. The assignment in `BKE_gpencil_prepare_eval_data`
 seemed to be unnecessary.

Co-authored-by: @yann-lty

Reviewed By: antoniov

Maniphest Tasks: T96145

Differential Revision: https://developer.blender.org/D14236
2022-03-03 16:01:23 +01:00
6e487228a5 File Browser UI: Allow dragging anywhere in a file preview tile to drag
Previously you'd have to be careful to drag the image itself. Dragging
anywhere else on the tile (e.g. between the preview and the text, or the
text itself) would trigger border select. This often conflicts with user
expectations and causes frustration when trying to work quick, I've seen
many people complain about this.

Note that the "hitbox" for dragging is a bit smaller than the tile, to
not make border select by dragging from in-between the tiles too hard.

Differential Revision: https://developer.blender.org/D14228
2022-03-03 15:17:23 +01:00
544bd0c353 Cleanup: Remove redundant drag image size parameters
Just use the image-buffer size and the already provided scale to
determine the size, not the button size (which would always have to
match the scaled image-buffer size or it would give unexpected results).
2022-03-03 15:04:45 +01:00
1b863041c9 i18n: Fix more potential contextual issues with "Back" UI label.
Add 'ID_ACTION' context to some animation curve interpolation enums.

Related to T95506/T43295.
2022-03-03 14:52:45 +01:00
0f77933031 Merge branch 'blender-v3.1-release' 2022-03-03 13:49:08 +01:00
9c2e385509 Fix Cycles hang in classroom scene with upcomping AMD driver version 22.10
This is a workaround until there is a fix in the HIP compiler or driver.

Differential Revision: https://developer.blender.org/D14232
2022-03-03 13:42:58 +01:00
ffaaa0bcbf UV: Edge selection support
This patch adds edge selection support for UV editing (refer T76545).
Developed as a part of GSoC 2021 project - UV Editor Improvements.

Previously, selections in the UV editor always flushed down to vertices
and this caused multiple issues such as T76343, T78757 and T26676.
This patch fixes that by adding edge selection support for all UV
operators and adding support for flushing selections between vertices
and edges. Updating UV select modes is now done using a separate
operator, which also handles select mode flushing and undo for UV
select modes. Drawing edges (in UV edge mode) is also updated to match
the edit-mesh display in the 3D viewport.

Notes on technical changes made with this patch:
* MLOOPUV_EDGESEL flag is restored (was removed in rB9fa29fe7652a).
* Support for flushing selection between vertices and edges.
* Restored the BMLoopUV.select_edge boolean in the Python API.
* New operator to update UV select modes and flushing.
* UV select mode is now part of editmesh undo.

TODOs added with this patch:
* Edge support for shortest path operator (currently uses vertex path logic).
* Change default theme color instead of reducing contrast with edge-select.
* Proper UV element selections for Reveal Hidden operator.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12028
2022-03-03 17:59:09 +05:30
76879e3702 Outliner: Display respective data-block icon in library overrides mode
Just showing the library override icon for every item doesn't add much
information, it's just redundant. Displaying the data-block type icon on
the other hand can be useful.

Differential Revision: https://developer.blender.org/D14208
2022-03-03 13:18:23 +01:00
9b12889a1a Fix T96140: Crash on color button drag & drop
Use-after-free in context store, which wasn't cleared correctly after
setting and querying.
2022-03-03 12:51:44 +01:00
2d24ba0210 VSE: Allow to create scene in strip properties
This patch adds a button in the scene to add a new one, but this does not change to the new created scene because this breaks the storyboarding workflow.

This is a common request for Storyboarding artists.

Reviewed By: mendio, brecht, ISS

Differential Revision: https://developer.blender.org/D14148
2022-03-03 12:37:48 +01:00
ce0d4ea41c Merge branch 'blender-v3.1-release' 2022-03-03 20:47:07 +11:00
d961adb866 Fix T96135: Mesh coordinates are set to the last edited shape-key
When exiting edit-mode set the vertex coordinates to the basis-shape when editing non-basis keys.

Regression in bfdbc78466.

Reviewed By: sergey

Ref D14234
2022-03-03 20:42:30 +11:00
d66b047ca3 WM: use pass-through for cursor placement operator
This is needed since 4d0f846b93
however change in the operator instead of the event handler is correct,
as accepting a press event should suppress drag events unless
the pass-through flag is set.

This is how select & tweak already works.
2022-03-03 20:35:14 +11:00
ec09ded792 Fix missing i18n context variable in UI py script.
Mistake in own rBdb3f5ae48ac, thanks to Ethan-Hall (@Ethan1080) for the
heads up.
2022-03-03 08:57:06 +01:00
a8df292264 Cleanup: comments in wm_event_system.c 2022-03-03 16:45:40 +11:00
4d0f846b93 Event System: use more thoroughly tested logic for click-drag events
No functional changes, largely restoring old logic & removing the need
for workarounds.

Reverts:
- 13b6cec039.
- aa71414dfc (partially).
2022-03-03 16:07:18 +11:00
9d529407da UI: only wrap cursor motion horizontally when dragging markers
It's not useful to wrap vertical motion when dragging markers.
It was too easy to accidentally wrap the cursor to the top of a region,
as markers need to be dragged from the bottom edge of the region.
2022-03-03 15:48:41 +11:00
d764448f73 Cleanup: use doxygen sections for anim_markers.c 2022-03-03 15:46:26 +11:00
08da699faa Cleanup: rename misleading variable for marker selection cycling
"marker_selected" was the marker after the selected marker
and is used for cycling the selection.
2022-03-03 15:46:15 +11:00
61c288cee5 Fix timeline marker click-drag arbitrary deselection
The logic to cycle selected markers wasn't cycling back to the beginning
of the list.

The marker after the selected marker at the cursor frame was also used
to check if a selection existed, causing dragging to transform all
selected markers to de-select all when when dragging the last marker.
2022-03-03 15:25:02 +11:00
ef431a8705 Cleanup: remove references to key-map modifier values denoting order
This feature was never exposed to users.
2022-03-03 13:57:44 +11:00
3c175caaa3 Cleanup: Rename set handle type node internally to match UI
I've had trouble finding this node a few times now,
it's simpler if the file name matches the name in the UI.
2022-03-02 17:58:17 -05:00
ddf956fb58 Curves: Port set resolution node to the new data-block
The node unnecessarily converted to the old data structure to check if
there were any poly splines. Instead, that warning is just removed,
because the node now still sets resolution values in that case, they
just aren't used (before the values weren't set at all). Either way, it
wasn't clear that looping though all of the curve types was worth
the performance cost here.
2022-03-02 17:50:25 -05:00
2600806c2e Fix: BLI math clamp doesn't work
Return type was wrong, output of std::clamp wasn't used.
2022-03-02 17:09:17 -05:00
ecba8c1243 Fix mistake in seeking cleanup
In `ffmpeg_read_video_frame` fix assignment used as truth value.
In `ffmpeg_seek_recover_stream_position` loop while return value is
greater or equal to 0.
2022-03-02 22:25:43 +01:00
f531dff9b3 Cleanup: Use rectangle for file browser tile drawing
Passing around coordinates for drawing can be quite confusing, it's
often not clear what they represent and where they are currently.
Instead pass around the tile rectangle for drawing and let all code draw
based on that, it's way more clear that way.

Changes shouldn't be user visible.
2022-03-02 19:25:18 +01:00
Nikhil Shringarpurey
721b705499 UI: Comments Misspellings of Vertex/Vertices
Correct misspellings in code comments of "vertex" and "vertices".

See D13932 for more details.

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

Reviewed by Harley Acheson
2022-03-02 10:05:15 -08:00
ca0b728529 Fix T96101: "Remove" button failure on Grease Pencil layer's relation to bone
As the channel was not found, the relation data was not updated.

Now, if the bone is removed, the relation is set.
2022-03-02 17:48:35 +01:00
34267a868a Merge branch 'blender-v3.1-release'
and resolve merge error (version string).
2022-03-02 17:35:09 +01:00
9789a6c6d9 Search: take word order into account in string search
Differential Revision: https://developer.blender.org/D14223
2022-03-02 17:25:39 +01:00
8506f3d9fe Blender 3.1 bcon4 - change release cycle to release candidate
This is still a rolling release candidate with new builds every day
as a preparation to the final release.
2022-03-02 17:17:38 +01:00
ac45540a34 Curves: add brush to add curves on surface
This adds a prototype for the first brush that can add new curves by
painting on a surface. Note that this can only be used when the curves
object has a surface object set in the properties panel.

The brush can take minimum distance into account. This allows
distributing curves with a somewhat consistent density.

Differential Revision: https://developer.blender.org/D14207
2022-03-02 17:15:44 +01:00
037e1ad140 Merge branch 'blender-v3.1-release' 2022-03-02 17:13:57 +01:00
2fb31f34af Fix T95692: incorrect interpolated children particle hair
Differential Revision: https://developer.blender.org/D14227
2022-03-02 17:12:56 +01:00
d86f80f42a Merge branch 'blender-v3.1-release' 2022-03-02 10:55:21 -05:00
216a215ba5 Fix T93573: Remove outline from instances in edit mode
This commit removes the outline from instances generated from an object
when in edit mode. This takes the change in aa13c4b386 a bit further,
with the idea that instance outlines are more like regular outlines.

Because evaluated object data that doesn't match the original object
type is treated as an instance internally, this fixes the way evaluated
meshes for curves objects have an outline, for example.

See the differential revision for a visual comparison.

Differential Revision: https://developer.blender.org/D14226
2022-03-02 10:49:48 -05:00
7935d3668a Fix T95479: geometry nodes crash with cage display
Differential Revision: https://developer.blender.org/D14225
2022-03-02 16:10:42 +01:00
Ethan Hall
1e1d1f15e8 UI: Enable the outliner to use the correct icon for each curve subtype
This patch enables enables the outliner to use the correct icon for each
of the curve subtypes (Curve/Surface/Font).

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

Reviewed by: Julian Eisel
2022-03-02 15:52:17 +01:00
13b6cec039 Fix/Workaround T96120: Crash dropping from the file browser
Since removal of tweak events 4986f71848,
box-select is activating while dragging files.

As far as I can tell this used to work because of differences
int the order tweak / click-drag events are handled.

Apply a workaround since dragging files doesn't prevent other parts
of the UI from activated (it's possible to open menus for e.g),
this is something we will likely want to limit which would resolve
this bug too.
2022-03-03 01:36:14 +11:00
3a0df7d37b Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-03-02 15:22:19 +01:00
6883c47bb5 Fix T94729: GPU subdivision does not support meshes without polygons
There are two issues revealed in the bug report:
- the GPU subdivision does not support meshes with only loose geometry
- the loose geometry is not subdivided

For the first case, checks are added to ensure we still fill the
buffers with loose geometry even if no polygons are present.

For the second case, this adds
`BKE_subdiv_mesh_interpolate_position_on_edge` which encapsulates the
loose vertex interpolation mechanism previously found in
`subdiv_mesh_vertex_of_loose_edge`.

The subdivided loose geometry is stored in a new specific data structure
`DRWSubdivLooseGeom` so as to not pollute `MeshExtractLooseGeom`. These
structures store the corresponding coarse element data, which will be
used for filling GPU buffers appropriately.

Differential Revision: https://developer.blender.org/D14171
2022-03-02 15:19:55 +01:00
47396ea81e Fix T96123: Crash when click-dragging across the visibility icons
Partially revert aa71414dfc

This attempted have the click-drag event compatible with old tweak
events, but needs to be re-thought since it caused events to be handled
in unexpected situations.
2022-03-03 01:11:17 +11:00
4a95c3466f Fix T96085: repeated evaluation of geometry nodes when nothing changed
Differential Revision: https://developer.blender.org/D14216
2022-03-02 14:12:08 +01:00
c23ec04b4e BLI: add scoped-defer utility to add RAII-like behavior to C types
This utility is useful when using C types that own some resource in
a C++ file. It mainly helps in functions that have multiple return
statements, but also simplifies code by moving construction and
destruction closer together.

Differential Revision: https://developer.blender.org/D14215
2022-03-02 12:51:21 +01:00
721335553c Add Object Tool: use the drag-start location for initial placement 2022-03-02 22:29:40 +11:00
Henrik Dick
c2e8e68b65 Fix T95963: change thresholds in complex solidify
This fix contains two parts. There was one critical mistake where
order of two indices was wrong when removing constraint planes from
the array. The other changes are improvements to the used thresholds
to keep everything numerically stable.

Differential Revision: http://developer.blender.org/D14183
2022-03-02 12:14:22 +01:00
ccf4001458 Fix modal item open/close in the outliner since removing tweak events
Correct check for left-mouse event which assumed the alternative was
a tweak event.

Also remove print added by accident.
2022-03-02 22:04:39 +11:00
102644cb8c Fix releasing modifier keys suppressing drag events
Always use event.prev_click_type since this is never set on key-release,
which could still interrupt dragging (box selecting for example).
2022-03-02 21:47:49 +11:00
1747269ea5 Cleanup: misleading code from aa71414dfc
This branch was previously run when the action had been handled,
since action checks were removed it was running. This assignment
does nothing but shouldn't be kept.
2022-03-02 21:47:49 +11:00
51c5a4d85d Merge branch 'blender-v3.1-release' 2022-03-02 11:45:48 +01:00
Brecht Van Lommel
383a6ee78c Fix T94609: geometry nodes always re-evaluated with image texture nodes
previously_visible_components_mask was not preserved for Image ID nodes, which
meant it was always detected as newly visible and tagged to be updated, which
in turn caused the geometry nodes using it to be always updated also.

Reviewed By: sergey, JacquesLucke

Maniphest Tasks: T94609

Differential Revision: https://developer.blender.org/D14217
2022-03-02 11:45:17 +01:00
5086913b28 Fix T96116: Image editor not updated when adding new tile. 2022-03-02 11:42:23 +01:00
f8577db05d Docs: document the use_axis_view argumeht to view_roll_angle
Also remove event print left in by accident.
2022-03-02 18:28:15 +11:00
46a5a15d30 Cleanup: rename direction enum as it's part of the key-map item
Also improve doc-strings for key-map item constants.
2022-03-02 18:00:59 +11:00
7e4c031328 Cleanup: remove all tweak events from key-map presets 2022-03-02 17:29:27 +11:00
4986f71848 Event System: remove tweak events in favor of click-drag
Supporting two kinds of dragging is redundant, remove tweak events as
they only supported 3 mouse buttons and added complexity from using the
'value' to store directions.

Support only click-drag events (KM_CLICK_DRAG) which can be used with
any keyboard or mouse button.

Details:

- A "direction" member has been added to keymap items and events which
  can be used when the event value is set to KM_CLICK_DRAG.

- Keymap items are version patched.

- Loading older key-maps are also updated.

- Currently the key-maps stored in ./release/scripts/presets/keyconfig/
  still reference tweak events & need updating. For now they are updated
  on load.

Note that in general this wont impact add-ons as modal operators don't
receive tweak events.

Reviewed By: brecht

Ref D14214
2022-03-02 15:31:50 +11:00
426ff481a7 Event System: match click-drag & tweak event handling for transform 2022-03-02 14:53:15 +11:00
78372d8b9c Event System: support "Release Confirms" for click-drag events 2022-03-02 14:44:34 +11:00
aa71414dfc Fix click-drag events for dragging markers
Clicking and dragging markers accumulates flags from multiple operators
in a way that can't be interpreted when combine.

Follow tweak behavior for cancelling click-drag events.
2022-03-02 14:28:29 +11:00
cf428b2ebd Fix ignored click-drag events when operators pass-through & finished
Replacing tweak key-map items with click-drag caused selection
in the graph/sequencer/node editors to ignore drag events
(all uses of WM_generic_select_modal).

Operators that return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED
result in the event loop considering the event as being handled.

This stopped WM_CLICK_DRAG events from being generated which is not the
case for tweak events.

As click-drag is intended to be compatible with tweak events,
accept drag events when WM_HANDLER_BREAK isn't set or when
wm_action_not_handled returns true.
2022-03-02 12:25:12 +11:00
aa500c4fca Cleanup: use back-slash for doxygen commands, color after parameters 2022-03-02 12:11:08 +11:00
eabdcdcd44 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-03-02 00:59:03 +01:00
4932269ec3 Fix T94952: normals maps don't render correctly with GPU subdivision
A simple case of missing the tangent VBO. The tangents are computed from
the coarse mesh, and interpolated on the GPU for the final mesh. Code for
initializing the tangents, and the vertex format for the VBO was
factored out of the coarse extraction routine, to be shared with the
subdivision routine.
2022-03-02 00:58:40 +01:00
e03b9f555c Cmake: Re-enable Amaranth add-on
This add-on now conforms to the distribution requirements, see: T95442.
2022-03-01 17:45:45 -05:00
a75e9863fe Cmake: Re-enable Amaranth add-on
This add-on now conforms to the distribution requirements, see: T95442.
2022-03-01 17:45:13 -05:00
10405b15ec Cleanup: Refactor seeking code
Improve readability and reduce indentation levels. No functional changes.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D14075
2022-03-01 23:42:23 +01:00
4491c62260 Fix potential crash during proxy building
Last step of proxy building caused crash due to thread race contition
when acessing ed->seqbase.

Looking at code, it seems that calling IMB_close_anim_proxies on
original strips is unnecessary so this code was removed to resolve this
issue.

Locking seqbase data may be possible, but it's not very practical as
many functions access this data on demand which can easily cause
program to freeze.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D14210
2022-03-01 23:42:23 +01:00
bfe37b7255 Merge branch 'blender-v3.1-release' 2022-03-01 18:35:48 -03:00
9bd586a01e Fix T95608: Mac issues with drag drop on multi-monitor
Mousemove events are sent to windows.

In Windows OS, almost all mousemove events are sent to the window whose
mouse cursor is over.

On MacOS, the window with mousemove events is always the active window.
It doesn't matter if the mouse cursor is inside or outside the window.

So, in order for non-active windows to also have events,
`WM_window_find_under_cursor` is called to find those windows and send
the same events.

The problem is that to find the window, `WM_window_find_under_cursor`
only has the mouse coordinates available, it doesn't differentiate
which monitor these coordinates came from.

So the mouse on one monitor may incorrectly send events to a window on
another monitor.

The solution used is to use a native API on Mac to detect the window
under the cursor.

For Windows and Linux nothing has changed.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14197
2022-03-01 18:25:12 -03:00
e1ec2d0251 Merge branch 'blender-v3.1-release' 2022-03-01 16:31:18 -03:00
8e88af9934 Fix wrong object mode checking in snap code
The value of `OB_MODE_OBJECT` is 0, this makes it unsuitable as a bitflag.

Issue pointed out at https://pvs-studio.com/en/blog/posts/cpp/0922/

Thanks to Andrey Karpov
2022-03-01 16:30:30 -03:00
8322a4f6b7 Fix T92980: missing Cycles video texture update with persistent data 2022-03-01 19:51:30 +01:00
Henrik Dick
6498688e27 GPencil: Improve subdivision modifier
The subdivision modifier for Grease Pencil handles closed strokes
correctly now and does converge to the same shape as the mesh
subdivision surface.

Differential Revision: http://developer.blender.org/D14218
2022-03-01 19:32:02 +01:00
444d57d440 Geometry Nodes: Port most curve primitives to new data-block
Create `Curves` directly, instead of using the conversion from
`CurveEval`. This means that the `tilt` and `radius` attributes
don't need to be allocated. The old behavior is kept by using the
right defaults in the conversion to `CurveEval` later on.

The Bezier segment primitive isn't ported yet, because functions
to provide easy access to built-in attributes used for Bezier curves
haven't been added yet.

Differential Revision: https://developer.blender.org/D14212
2022-03-01 12:06:29 -05:00
f085c2bab5 Cmake: Re-enable tiny cad add-on
This add-on now conforms to the distribution requirements, see: T95442.
2022-03-01 11:58:27 -05:00
89bf5d8ba9 Cmake: Re-enable tiny cad add-on
This add-on now conforms to the distribution requirements, see: T95442.
2022-03-01 11:57:13 -05:00
f98d74c80d Curves: Move curves primitive to object add code
Currently, any time a Curves data-block is created, the `curves_random`
function runs, filling it with 500 random curves, also adding a radius
attribute. This is just left over from the prototype in the initial
commit that added the type.

This commit moves the code that creates the random data to the curve
editors module, like the other primitives are organized.

Differential Revision: https://developer.blender.org/D14211
2022-03-01 11:40:25 -05:00
952a613d38 Cycles: Hide MetalRT checkbox for AMD GPUs
This patch hides the MetalRT checkbox for AMD GPUs, pending fixes for MetalRT argument encoding on AMD.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14175
2022-03-01 16:05:47 +00:00
143bc9f8d4 Merge branch 'blender-v3.1-release' 2022-03-01 23:11:46 +11:00
d681d82d41 Fix T96035: Some tool settings do not work
Oversight in 74611e3555 missed updating
property access to use the tool identifier to lookup the property group.
2022-03-01 23:09:56 +11:00
f493e2f23a Merge branch 'blender-v3.1-release' 2022-03-01 11:46:53 +01:00
629f22f161 Fix T95997: Crash when entering edit mode
The issue was uncovered by the 0f89bcdbeb, but the root cause goes
into a much earlier design violation happened in the code: the modifier
evaluation function is modifying input mesh, which is not something
what is ever expected.

Bring code closer to the older state where such modification is only
done for the object in edit mode.

---

From own tests works seems to work fine, but extra eyes and testing
is needed.

Differential Revision: https://developer.blender.org/D14191
2022-03-01 11:46:38 +01:00
90ec634135 Fix incorrect drag-event threshold when releasing modifiers early
db4313610c added support for modifier
keys to be released while dragging.

The key release events set wmEvent.prev_type which is used select the
drag threshold, causing the wrong threshold to be used.

Add wmEvent.prev_click_type which is only set when the drag begins.
2022-03-01 21:41:08 +11:00
cde5e12c0b Fix T96097: Image editor tile drawing not working.
The image engine is depth aware when using tile drawing the depth is
only updated for the central image what lead to showing the background
on top of other areas.

Also makes sure that switching the tile drawing would lead to an update
of the texture slots.
2022-03-01 11:37:18 +01:00
4b9c77a19a Merge branch 'blender-v3.1-release' 2022-03-01 11:36:46 +01:00
9216cf9cb5 Fix: dangling internal links after removing sockets
This is a follow up for rBd5e73fa13dd275fb9c76b1e41142ab086dd2e6be.
The issue was found with the file in T95997.
2022-03-01 11:34:36 +01:00
476fe7d164 Fix T95979: Bake doesn't update Image editor. 2022-03-01 11:20:54 +01:00
eec1c16200 Fix T96030: Update Image editor after reload. 2022-03-01 11:04:09 +01:00
a5214212cf Fix T96030: ImageEditor not updated for generated images. 2022-03-01 10:51:07 +01:00
d743ef91df Fix 3d texture painting artifacts.
When dimension of images aren't a multifold of 256 parts of the gpu
textures are not updated. This patch will calculate the correct part of
the image that needs to be reuploaded.
2022-03-01 10:45:19 +01:00
4a4701b43c Fix painting on none 256 aligned images.
Internally the update tiles are 256x256. Due to some miscalculations
tiles were not generated correctly if the dimension of the image wasn't
a multifold of 256.
2022-03-01 09:32:58 +01:00
34f6a99433 Fix crash triggered by an introduced assert. 2022-03-01 08:56:58 +01:00
ead84d2ba6 Fix building error in previous commit. 2022-03-01 08:53:23 +01:00
5e9c1feb8a Image Engine: Performance 8 byte images.
Previously we used to cache a float image representation of the image in
rect_float. This adds some incorrect behavior as many areas only expect
one of these buffers to be used.

This patch stores float buffers inside the image engine. This is done per
instance. In the future we should consider making a global cache.
2022-03-01 08:41:25 +01:00
f0bfceb96d Cleanup: remove unused code 2022-03-01 17:22:35 +11:00
9b114d6214 Merge branch 'blender-v3.1-release' 2022-02-28 23:47:43 -05:00
91de337dc5 Cmake: Re-enable tissue add-on
This add-on now conforms to the distribution requirements, see: T95442.
2022-02-28 23:45:59 -05:00
a4e8b3a9a9 Cleanup: remove check_deprecated.py
This was temporarily added back as the build-bot was running it.
2022-03-01 14:09:03 +11:00
8a8424021c Cleanup: move Event.is_repeat & is_direction_inverted to flags
Use a flag for events to avoid adding struct members every time a new
kind of tag is needed - so events remain small.

This also simplifies copying settings as flags can be copied at once
with a mask.
2022-03-01 12:21:27 +11:00
eb0f8317e2 Cleanup: ED_view3d_win_to_delta & ED_view3d_calc_zfac usage
- Rename ED_view3d_win_to_delta `mval` argument to `xy_delta` as it
  as it was misleading since this is an screen-space offset not a region
  relative cursor position (typical use of the name `mval`).
  Also rename the variable passed to this function which also used the
  term `mval` in many places.
- Re-order the output argument of ED_view3d_win_to_delta last.
  use an r_ prefix for return arguments.
- Document how the `zfac` argument is intended to be used.
- Split ED_view3d_calc_zfac into two functions as the `r_flip` argument
  was only used in some special cases.
2022-03-01 11:18:17 +11:00
Leon Schittek
ae6400cfb4 UI: Fix multi input socket outline and highlight
Small fixes to the drawing of multi input sockets:
 - Make the outline thickness consistent with normal node sockets,
   independent from the screen DPI.
 - Only highlight multi input sockets when they are actually selected.
 - Skip selected multi inputs when drawing normal selected sockets.

Differential Revision: https://developer.blender.org/D14192
2022-02-28 18:05:30 -05:00
5777bd719b Cleanup: use doxygen comments, correct spelling
Also move eDupli_ID_Flags doc-string to it's declaration.
2022-03-01 09:36:25 +11:00
94a4dddb1b Fix: Don't tag curves component cache dirty for radius
Changing the radius does not invalidate a cache on
`CurvesGeometry`.
2022-02-28 17:28:54 -05:00
9ebb65323e Fix: Use correct default in Curves to CurveEval conversion
Currently the code expects the radius attribuet to always exist on the
input Curves. This won't be true in the future though, so the correct
default value of one should be used when creating the data on CurveEval,
where the data is not optional.
2022-02-28 17:27:38 -05:00
6594e802ab Curves: Add method to access cyclic attribute
Avoids the need to use the attribute API to access this commonly
used builtin attribute.
2022-02-28 17:20:37 -05:00
4c407f20a6 Cleanup: Move object_add.c to C++
This patch was tested on the buildbot first, it builds on all platforms.
2022-02-28 16:20:55 -05:00
Leon Schittek
75bb99fa40 Nodes: Improve readability of selected node links
This commit improves the drawing of selected node links:
 - Highlight the entire link to make it easier to spot where the link
   is going/coming from.
 - Always draw selected links on top, so they are always clearly
   visible.
 - Don't fade selected node links when the sockets they are connected
   to are out out view.
 - Dragged node links still get a partial highlight when they are only
   attached to one socket.

Differential Revision: https://developer.blender.org/D11930
2022-02-28 15:52:00 -05:00
Wannes Malfait
eeb0279e89 Geometry Nodes: Use std::move in dual mesh node
Add a std::move in some places to prevent arrays from being copied.
These cases were potentially optimized by the compiler, but this makes
it more explicit.

Differential Revision: https://developer.blender.org/D14129
2022-02-28 15:16:01 -05:00
611157057b Cleanup: Use bool instead of int 2022-02-28 15:10:20 -05:00
7c3a5da04b Merge branch 'blender-v3.1-release' 2022-02-28 14:38:41 -05:00
59a133b61f Cmake: Re-enable real snow add-on
This add-on now conforms to the distribution requirements, see: T95442.
2022-02-28 14:38:13 -05:00
96492903aa Merge branch 'blender-v3.1-release' 2022-02-28 19:18:22 +01:00
44b0c70919 Fix T92288, T96041: instancing of shared mesh objects without modifiers broken
New code from the vertex normal refactor cfa53e0fbe combined with older code
from 592759e3d6 that disabled instancing for custom normals and autosmooth
meant that instancing was always disabled.

However we do not need to disable instancing for custom normals and autosmooth
at all, this can be shared between instances just fine.
2022-02-28 18:32:27 +01:00
Henrik Dick
8c932ab43c Fix T96032: add null check to constraint operators
The constraint operators for delete, apply, copy and copy to selected
were missing null checks and could crash blender when called wrongly
from the python api.

Differential Revision: http://developer.blender.org/D14195
2022-02-28 18:26:58 +01:00
245722866d Cleanup: Rename geometry set "curve" functions to "curves"
Ref T95355
2022-02-28 10:53:30 -05:00
9ec12c26f1 Geometry Nodes: Begin conversion to new curves
This commit changes `CurveComponent` to store the new curve
type by adding conversions to and from `CurveEval` in most nodes.
This will temporarily make performance of curves in geometry nodes
much worse, but as functionality is implemented for the new type
and it is used in more places, performance will become better than
before.

We still use `CurveEval` for drawing curves, because the new `Curves`
data-block has no evaluated points yet. So the `Curve` ID is still
generated for rendering in the same way as before. It's also still
needed for drawing curve object edit mode overlays.

The old curve component isn't removed yet, because it is still used
to implement the conversions to and from `CurveEval`.

A few more attributes are added to make this possible:
- `nurbs_weight`: The weight for each control point on NURBS curves.
- `nurbs_order`: The order of the NURBS curve
- `knots_mode`: Necessary for conversion, not defined yet.
- `handle_type_{left/right}`: An 8 bit integer attribute.

Differential Revision: https://developer.blender.org/D14145
2022-02-28 10:46:34 -05:00
37d2c774c1 Fix T96073: Don't remove links when inserting reroute nodes
This was an oversight in rB06ac5992618a75c453e495e06af7c5faf30499a7.
2022-02-28 16:42:15 +01:00
81bb86c750 Cleanup: Remove duplicated comment
Something went wrong here in 61776befc3.
2022-02-28 16:33:34 +01:00
579f42ae52 Cleanup: Move mesh_validate.c to C++
This patch was tested on the build bots on all platforms.
2022-02-28 10:08:26 -05:00
f5159e078e Merge branch 'blender-v3.1-release' 2022-02-28 15:03:17 +01:00
413e87b6b7 Fix T96048: Crash on appending with driver variables loop in shapekeys.
The usual 'shape keys snowflake' nightmare again...
2022-02-28 15:02:17 +01:00
db3f5ae48a Fix T95506: Separate strings for "Back" (operator).
Add a new `EDITOR_VIEW3D` context to those view orientations.
2022-02-28 14:37:07 +01:00
1e848281f9 18n: Add new EDITOR_VIEW3D translation context. 2022-02-28 14:37:07 +01:00
8e940f31fd WM: Allow drop-box polls to use context from UI
The UI context was only set for the operator polls, but not for the
drop-box polls. Initially I thought this wouldn't be needed since the
drop-boxes should leave up context polls to the operator, but in
practice that may not be what API users expect. Plus the tooltip for the
drop-boxes will likely have to access context anyway, so they should be
able to check it beforehand.
2022-02-28 13:14:46 +01:00
Colin Marmont
1558b270e9 Animation: Sensible frame range for motion paths
Motion paths can now be initialised to more sensible frame ranges,
rather than simply 1-250:

- Scene Frame Range
- Selected Keyframes
- All Keyframes

The Motion Paths operators are now also added to the Object context menu
and the Dopesheet context menu.

The scene range operator was removed, because the operators now
automatically find the range when baking the motion paths.

The clear operator now appears separated in "Selected Only" and "All",
because it was not clear for the user what the button was doing.

Reviewed By: sybren, looch

Maniphest Tasks: T93047

Differential Revision: https://developer.blender.org/D13687
2022-02-28 12:28:19 +01:00
6f23401e98 Merge branch 'blender-v3.1-release' 2022-02-28 10:57:12 +01:00
6bbf63f251 Fix T96054: Switching vertex group does not update display
Caused by 0f89bcdbeb and was not fully addressed by 6f9828289f:
tagging an ID with flag 0 is to be seen as an explicit tag for copy
on write.

Would be nice to either consolidate code paths of flag 0 and explicit
component tag, or get rid of tagging with 0 flag, but that is above of
what we can do for the upcoming release.
2022-02-28 10:54:07 +01:00
307d612404 Fix compilation warning. 2022-02-28 09:45:52 +01:00
cb736d2f03 Fix T95298: Multiview images not displaying correctly.
Image users have a multi_index that wasn't updated in case it is a normal
image.
2022-02-28 09:23:45 +01:00
540fd10b4f Fix T95992: Crash Ancored strokes 2d texture painting.
When using ancored stroked the diameter of the stroke can be 0 what
leads to a division by zero that on certain platforms wrap to a large
negative number that cannot be looked up. This fix will clamp the size
of the brush to 1.
2022-02-28 09:03:47 +01:00
2a644deaa7 Fix T95981: Remove implicit conversion in texture paint shader.
This fixes a crash on selected platforms.
2022-02-28 08:40:59 +01:00
db4313610c Event System: drag events now use modifier state on drag start
Now drag & tweak can have modifier keys to be released while dragging.
without this, modifier keys needs to be held which is more noticeable
for tablet input or whenever the drag threshold is set to a large value.

Resolves T89989.
2022-02-28 15:31:01 +11:00
63891f9dad Fix: Crash in Duplicate Element
Return early if a curve has a domain size of 0.
T96060
2022-02-27 15:16:45 -06:00
4f2f3114b7 Fix: Incorrect assert in curves code
The attribute data might be null if the number of curves is zero.
While that is not common, an empty curves data-block is valid.
2022-02-26 17:33:45 -05:00
ee160630c6 Merge branch 'blender-v3.1-release' 2022-02-26 17:57:37 -03:00
4ee4b61dd8 Ghost/Event System: Support mapping more keys
This fixes T93051, T76405 and maybe others.

Characters like '²', '<' are not recognized in Blender's shortcut keys.
And sometimes simple buttons like {key .} and {key /} on the Windows
keyboard, although the symbol is "known", Blender also doesn't
detect for shortcuts.

For Windows, some of the symbols represented by `VK_OEM_[1-8]` values,
depending on the language, are not mapped by Blender.

On Mac there is a fallback reading the "actual character value of the
'remappable' keys". But sometimes the character is not mapped either.

On Windows, the solution now mimics the Mac and tries to read the button's
character as a fallback.

For unmapped characters ('²', '<', '\''), now another value is chosen as a
substitute.

More "substitutes" may be added over time.

Differential Revision: https://developer.blender.org/D14149
2022-02-26 17:56:17 -03:00
576853661c UI: Use title case for labels 2022-02-25 23:34:08 -05:00
d6b3723b08 Cleanup: typos in comments. 2022-02-26 02:15:22 +01:00
ac3f4db719 Cleanup: Mesh normal calculation comments and logic
Some logic and comments in the vertex normal calculation were
left over from when normals were stored in MVert, before
cfa53e0fbe. Normals are never allocated and freed
locally anymore.
2022-02-25 17:47:42 -05:00
1598ab9639 Merge branch 'blender-v3.1-release' 2022-02-25 17:23:14 -05:00
7aa0be4b32 Fix: Failing OBJ export tests due to mesh normals commit
In some cases, the normal edit modifier calculated the normals on one
mesh with the "ensure" functions, then copied the mesh and retrieved
the layers "for write" on the copy. Since 59343ee162, normal
layers are never copied, and normals are allocated with malloc instead
of calloc, so the mutable memory was uninitialized.

Fix by calculating normals on the correct mesh, and also add a warning
to the "for write" functions in the header.
2022-02-25 17:18:07 -05:00
a911f075d7 Fix T93123: viewport lags with custom attributes
The check to see if newly requested attributes are not already in the
cache was not taking into account the possibility that we do not have
new requested attributes (`num_requests == 0`). In this case, if
`attr_used` already had attributes, but `attr_requested` is empty, we
would consider the cache as dirty, and needlessly rebuild the attribute
VBOs.
2022-02-25 22:04:10 +01:00
72a286760f Fix compile warning from earlier commit. 2022-02-25 22:01:17 +01:00
bdf4e1596d Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-25 21:36:09 +01:00
c8b4e0c0b5 Disable GPU subdivision if autosmooth or split normals are used
These features are complicated to support on GPU and hardly compatible
with subdivision in the first place. In the future, with T68891 and
T68893, subdivision and custom smooth shading will be separate workflows.
For now, and to better prepare for this future (although long term
plan), we should discourage workflows mixing subdivision and custom
smooth normals, and as such, this disables GPU subdivision when
autosmoothing or custom split normals are used.

This also adds a message in the modifier's UI to indicate that GPU
subdivision will be disabled if autosmooth or custom split normals are
used on the mesh.

Differential Revision: https://developer.blender.org/D14194
2022-02-25 21:28:13 +01:00
118a219e9d Fix different shading between CPU and GPU subdivision
Reuse the same vertex normals calculation as for the GPU code, by
weighing each vertex normals by the angle of the edges incident to the
vertex on the face.

Additionally, remove limit normals, as the CPU code does not use them
either, and would also cause different shading issues when limit surface
is used.

Fixes T95242: shade smooth artifacts with edge crease and limit surface
Fixes T94919: subdivision, different shading between CPU and GPU
2022-02-25 21:25:13 +01:00
4896e72a4d Fix T95977: Point Info node radius wrong under rotation 2022-02-25 20:51:22 +01:00
1a8db5b717 Fix: Only possible to create one 8 bit integer attribute
The custom data code checks for `LayerTypeInfo.defaultname` before
adding a second layer with a certain type. This was missed in
e7912dfa19. In practice, this default name
is not actually used.
2022-02-25 10:35:14 -05:00
0a6a74bac4 Fix T94396: USD errors opening saved scenes.
Added call to ensure that the USD plugins are registered
when opening a USD cache archive. This is to avoid USD
load errors due to missing USD file format plugins when
opening blender files that contain USD transform cache
constraints and mesh sequence cache modifilers.

Fixes T94396
2022-02-25 09:27:10 -05:00
06f5f29d17 Merge branch 'blender-v3.1-release' 2022-02-25 15:11:01 +01:00
e84b42bfcf Fix (unreported) Outliner 'liboverride create hierarchy' applied on several IDs.
This operation can only be applied on one ID at a time, so only apply it
to the active Outliner item, and not all the selected ones.

Also renamed `Make Library Override` menu entry to `Make Library Override
Single` to emphasis this is not the 'default expected' option for the
user.
2022-02-25 15:06:43 +01:00
6e11cfc56a Curves: add surface object pointer
Ref T95776.

Differential Revision: https://developer.blender.org/D14182
2022-02-25 13:22:42 +01:00
1a853a9e90 LibOverrides: fix handling of hierarchy root in complex cases.
This affects essentially the Outliner 'create hierarchy' tool currenlty.
Previously code did not handle properly hierarchy root in case overrides
where created from a non-root ID (e.g. an object inside of a linked
collection), and in case additional partial overrides were added to an
existing partially overrided hierarchy.

Also did some renaming on the go to avoid using 'reference' in override
context for anything else but the reference linked IDs.
2022-02-25 12:18:48 +01:00
5db32ab5fc Merge branch 'blender-v3.1-release' 2022-02-25 21:51:37 +11:00
0bac962fe5 CMake: exclude add-ons that don't confirm to key requirements
These add-ons don't have documentation on blender.org, see: T95442

These can be re-enabled once documentation has been relocated.
2022-02-25 21:50:00 +11:00
8ddeb71a55 Merge branch 'blender-v3.1-release' 2022-02-25 11:40:19 +01:00
66328db703 Fix T95636: Dragging Material from Asset Browser (Link mode) to Viewport empty space removes this material from all objects
Trust user count to actually delete or not the dragged ID when current
dragging is cancelled, since it may be already used by others.

NOTE: This is more a band-aid fix than anything else, cancelling drag
has a lot of other issues here (like never deleting any indirectly
linked/appended data, etc.). It needs a proper rethink in general.
2022-02-25 11:37:55 +01:00
4c9846eeae Cleanup: Modify comment 2022-02-25 11:24:45 +01:00
8f1ee85ff4 Merge branch 'blender-v3.1-release' 2022-02-25 11:22:17 +01:00
5186a28dec GPencil: Make Fill Dilate expand outside stroke
To keep consistency with the new contract option, the dilate now expand the shape beyond the internal closed area.

Note: This was committed only in master (3.2) by error.
2022-02-25 11:15:56 +01:00
5fd792c1f6 GPencil: Fill Dilate using negative values contract the fill area
This is requested by artist for some animation styles where is necessary to fill the area, but create a gap between fill and stroke.

Also some code cleanup and fix a bug in dilate for top area.

Reviewed By: pepeland, mendio

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

Note: This was committed only in master (3.2) by error.
2022-02-25 11:15:42 +01:00
ad0b3abf53 Cleanup: use flags for wmEvent modifier keys
Using flags makes checking multiple modifiers at once more convenient
and avoids macros/functions such as IS_EVENT_MOD & WM_event_modifier_flag
which have been removed. It also simplifies checking if modifier keys
have changed.
2022-02-25 17:58:22 +11:00
60af7a3496 Fix T95984: Use consistent shifting for persp and ortho cam.
Now always properly shifting camera for ortho and perspective.
2022-02-25 14:07:39 +08:00
e7cae51877 Fix T95984: Use consistent shifting for persp and ortho cam.
Now always properly shifting camera for ortho and perspective.
2022-02-25 13:57:27 +08:00
7d7dd66ba7 GPUTexture: Add support for texture view
This is an OpenGL 4.3 feature that enables creating a texture using a range
of the same data as another texture.
2022-02-24 22:51:19 +01:00
e59f754c16 GPUTexture: Use immutable storage
This means textures need to have the number of mipmap levels specified
upfront. It does not mean the data is immutable.

There is fallback code for OpenGL < 4.2.

Immutable storage will enables texture views in the future.
2022-02-24 22:51:19 +01:00
c23ee6d7b4 Cleanup: Simplify operating on multiple geometry components 2022-02-24 14:02:32 -05:00
5ccbbaed08 Cleanup: Sort include lines 2022-02-24 19:44:07 +01:00
3b3e519edd Nodes: Add include to avoid Windows compiler error
This line was added as request of @HooglyBoogly
2022-02-24 19:43:14 +01:00
9de720f31a Merge branch 'blender-v3.1-release' 2022-02-24 19:40:42 +01:00
8fb7c50aab Fix compiler error in Windows
In some compilers this file fails because the function `BKE_mesh_poly_normals_ensure`is not defined.
2022-02-24 19:38:16 +01:00
0781c22cee Fix T95969, T91856: bake AO to vertex color artifacts after ray offset removal
Without ray offsets intersections at neigbhoring triangles are found, as
the ray start is exactly at the vertex. There was a small offset towards
the center of the triangle, but not enough.

Now this offset computation is moved into Cycles and modified for better
results. It's still not perfect though like any offset approach, especially
with long thin triangles.

Additionaly, this uses the shadow terminate offset for AO rays now, which
helps remove some pre-existing artifacts.
2022-02-24 19:35:36 +01:00
6e396e21e6 Cleanup: remove unused ray offset function 2022-02-24 19:35:36 +01:00
4c66bd5da2 Curves: Use simpler "set" behavior for postion attribute
This is similar to f8fe0e831e, which made the change to the
handle position attributes. This commit removes the way that setting the
`position` attribute also changes the handle position attributes. Now,
the "Set Position" node still has this behavior, but changing the
attribute directly (with the modifier's output attributes) does not.

The previous behavior was a relic of the geometry nodes design
from before fields and the set position node existed.

This makes the transition to the new curves data structure simpler.
There is more room for optimizing the Bezier case of the set position
node in the future.
2022-02-24 12:22:26 -05:00
f4d80ecdfd Cleanup: Typo in comment 2022-02-24 12:01:22 -05:00
cc966c548d Merge branch 'blender-v3.1-release' 2022-02-24 11:57:53 -05:00
7b37d980b9 Fix: Crash switching between sculpt and edit mode
Also fix a couple other places where normals layers weren't properly
tagged dirty or reallocated when the mesh changes.

Caused by cfa53e0fbe. When the size of a mesh changes,
the normal layers need to be reallocated. There were a couple of places
that cleared other runtime data with `BKE_mesh_runtime_clear_geometry`
but didn't deal with normals properly. Clearing the runtime "geometry"
is different from clearing the normals, because sometimes the size of
the normal layers doesn't have to change, in which case simply tagging
them dirty is fine.
2022-02-24 11:56:32 -05:00
7c1b0dec00 Merge branch 'blender-v3.1-release' 2022-02-24 17:43:24 +01:00
f8507ca372 EEVEE: Fix crash when shadow caster count is reduced to 0.
The crash was catched by ASAN. It was caused by the buffer shrinking logic
being faulty.
2022-02-24 17:43:04 +01:00
17301a3163 Fix incorrect Outliner tree-display type returned
Reverts 6d97fdc37e. A function like this should not return a different
tree-display object than of the requested type. This may hide errors,
and leaves the Outliner in an undefined state (where the stored display
mode doesn't match the tree-display object). I rather don't hide the
fact that all display-modes should be handled here, and emit a clear
error if one isn't.
2022-02-24 17:10:19 +01:00
fc8aab755a Fix T96015: Calling wrong operator resulting in python error
Own mistake in rB86fc63c4ca9d36eae7512c5c3e640285d84415d1.
Forgot to change the call from `wm.url_open` to `wm.url_open_preset`.
2022-02-24 11:10:00 -05:00
8d83fc552a GPU: Fix compilation in debug mode
Fixes issue introduced in rB1685b1dba44e02ce1faace4a5de6d6cd0d98ef90
2022-02-24 15:55:22 +01:00
1685b1dba4 OCIO: Fix mip length in texture creation
Also add an assert to avoid reproducing the error in the future.
2022-02-24 15:48:54 +01:00
9be720d85e BLI: support accessing nth last element in Array/Span/Vector
This often helps to make the intend of code more clear compared
to computing the index manually in the caller.
2022-02-24 14:50:13 +01:00
7cab7eb3d6 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-24 14:34:15 +01:00
b7a954218b Fix T95976: on cage GPU subdivision breaks X-ray selection
When X-ray mode is active the selection is done using the mesh data to
select what is closest to the cursor. When GPU subdivision is active with
the "show on cage" modifier option, this fails as the mesh used for selection
is the unsubdivided one.

This creates a subdivision wrapper before running the selection routines to
ensure that subdivision is available on the CPU side as well.

Differential Revision: https://developer.blender.org/D14188
2022-02-24 14:33:48 +01:00
189c5bd9af Merge branch 'blender-v3.1-release' 2022-02-24 12:45:27 +01:00
17e0634902 Fix T95985: crash when assigning a name for an output attribute
This was a double free error which happened because `BM_mesh_bm_from_me`
was taking ownership of arrays that were still owned by the Mesh. Note that
this only happens when the mesh is empty but some custom data layers still
have a non-null data pointer. While usually the data pointer should be null in
this case for performance reasons, other functions should still be able to
handle this situation.

Differential Revision: https://developer.blender.org/D14181
2022-02-24 12:44:02 +01:00
d48e595c78 Fix wrong asset library displayed/loaded in asset view templates
Sometimes when switching asset libraries in the asset view templates
(like the pose library sidebar UI), the wrong library would end up being
shown.
2022-02-24 12:40:40 +01:00
b0eed6fb9a Merge branch 'blender-v3.1-release' 2022-02-24 18:01:53 +11:00
41d607976c Keymap: use 90 degree roll for NDOF roll shortcuts
3Dconnexion documentation states these buttons should roll 90 degrees.
2022-02-24 18:00:18 +11:00
13efaa8a09 3D View: keep the orthographic view when rolling 90 degrees
Support for maintaining orthographic view for view3d.view_roll for an
angle of 90/-90 degrees.
2022-02-24 18:00:17 +11:00
87c2b1988d Keymap: correct NDOF button roll assignment
NDOF ROLL CCW was used for both left & right roll.
2022-02-24 18:00:17 +11:00
e767a2d98b Keymap: correct NDOF button roll assignment
NDOF ROLL CCW was used for both left & right roll.
2022-02-24 17:51:19 +11:00
81df323df4 Tests: disable file output for bl_keymap_validate.py
Left on by accident but should only be used when debugging output.
2022-02-24 17:43:36 +11:00
fe4b53311a Merge branch 'blender-v3.1-release' 2022-02-24 15:25:38 +11:00
f80f7afbf0 Fix 2D view NDOF panning requiring both axes to be non-zero
Possible fix for T86592.
2022-02-24 15:24:09 +11:00
1a6b35157c Cleanup: code comments in vfont_to_curve 2022-02-24 13:20:33 +11:00
b45a3e8747 Cleanup: remove dead code in vfont_to_curve
Also replaces numbers with character literals for tab/space.
2022-02-24 13:14:33 +11:00
24450fa142 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-24 03:01:44 +01:00
d59f45fb15 Cleanup: remove dead code from text wrapping logic
Error from original commit in 2005,
97df61a7e5.
2022-02-24 12:53:11 +11:00
e83e7d49b6 Cleanup: use continue instead of goto for 3D text wrapping logic 2022-02-24 12:53:09 +11:00
ba274d20b4 Fix T95959: crash when exporting subdivision to Alembic
When exporting generated coordinates, the subdivision export code was
using the schema for the non-subdivision case, which is invalid as
non-initialized. This typo existed since the initial commit for the
feature (rBf9567f6c63e75feaf701fa7b78669b9a436f13dd).
2022-02-24 02:46:33 +01:00
affed12bb9 Merge branch 'blender-v3.1-release' 2022-02-24 12:19:17 +11:00
c9582b2752 Fix T95116: Scale to fit fails with a single word & non-zero Y-size
The scale-to-fit option did nothing for single words when
the text box had a height. This happened because it was expected that
text would be wrapped however single words never wrap.

Now the same behavior for zero-height text boxes is used when text
can't be wrapped onto multiple lines.
2022-02-24 12:18:39 +11:00
f8fe0e831e Curves: Use simpler "set" behavior for handle position attributes
The handle position attributes `handle_left` and `handle_right` had
rather complex behavior to get expected behavior when aligned or auto/
vector handles were used. In order to simplify the attribtue API and
make the transition to the new curves data structure simpler, this
commit moves that behavior from the attribute to the "Set Handle
Positions" node. When that node is used, the behavior should be the
same as before. However, if the modifier's output attributes were used
to set handle positions, the behavior may be different. That situation
is expected to be very rare though.
2022-02-23 15:44:55 -05:00
756f7fb23e Geometry Nodes: Face is Planar Node
This adds a node with a boolean field output which returns true if all of the
points of the evaluated face are on the same plane. A float field input allows
for the threshold of the face/point comparison to be adjusted on a per face basis.

One clear use case is to only triangulate faces that are not planar.

Differential Revision: https://developer.blender.org/D13906
2022-02-23 14:19:54 -06:00
86fc63c4ca Cleanup: Simplify manual url version handling
Recently we changed the build pipeline to always create a version
number in the url and point 'dev' to the latest version rather than creating the version number url once we release.

This makes the check to `bpy.app.version_cycle` unnecessary.
2022-02-23 15:00:16 -05:00
6ca85a8cf1 Fix: Build issue on windows
tbb/enumerable_thread_specific.h drags in windows.h
which will define min/max macro's unless you politely
ask it not to.

it's bit of an eyesore, but it is what it is
2022-02-23 12:27:02 -07:00
88712453f6 Fix error with SPDX-License-Identifier 2022-02-23 14:16:46 -05:00
572acba5d1 Merge branch 'blender-v3.1-release' 2022-02-23 14:12:48 -05:00
80be63e2a5 Update RNA to user manual mapping file 2022-02-23 14:10:52 -05:00
b93d4faba8 Fix for last commit: Define for Node numbering 2022-02-23 13:04:46 -06:00
81e89a444e Merge branch 'blender-v3.1-release' 2022-02-23 14:01:20 -05:00
99a6392fb5 Fix OSL trace() not being fully updated for ray offsetting removal
This was the last place still using the ray_offset() function.
2022-02-23 20:01:03 +01:00
dbef66c32f Fix T95952: Uninitialized value used in Bezier Segment node
0fd72a98ac called functions to set bezier handle positions
that used uninitialized memory. The fix is to define the handle positions
explicitly, like before.
2022-02-23 13:57:04 -05:00
7518adc5bb Fix: Attempt to fix build error on windows
`index_mask.cc` ends up including this header, but not much else,
the `<algorithm>` include is necessary on Windows for `std::max`.
2022-02-23 13:02:06 -05:00
226f0c4fef Curves: initial brush implementations for curves sculpt mode
The main goal here is to add the boilerplate code to make it possible
to add the actual sculpt tools more easily. Both brush implementations
added by this patch are meant to be prototypes which will be removed
or refined in the coming weeks.

Ref T95773.

Differential Revision: https://developer.blender.org/D14180
2022-02-23 16:56:27 +01:00
120f16fa1f Geometry Nodes: Duplicate Elements Node
This adds a node which copies part of a geometry a dynamic number
of times.

Different parts of the geometry can be copied differing amounts
of times, controlled by the amount input field. Geometry can also
be ignored by use of the selection input.

The output geometry contains only the copies created by the node.
if the amount input is set to zero, the output geometry will be
empty. The duplicate index output is an integer index with the copy
number of each duplicate.

Differential Revision: https://developer.blender.org/D13701
2022-02-23 09:08:16 -06:00
e32b676baf Merge branch 'blender-v3.1-release' 2022-02-23 09:58:41 -05:00
398538b914 Fix T95987: Data transfer modifier custom normals crash
59343ee162 missed one case of normals being
retrieved from polygon custom data instead of the normals API.
The fix is simple.
2022-02-23 09:49:25 -05:00
1361c6e604 Curves: Add methods to retrieve range for points or curves 2022-02-23 08:54:35 -05:00
b9ce036d6b Merge branch 'blender-v3.1-release' 2022-02-23 14:33:53 +01:00
867e50b886 Fix T95183: Cage gizmo axis unreliable
`orient_matrix` was not initialized.

Reviewed By: lichtwerk

Differential Revision: https://developer.blender.org/D14167
2022-02-23 14:25:00 +01:00
391c3848b1 NDOF: make camera view/pan behavior optional
User request since adding this option in:
51975b89ed

When disabled, use the previous behavior when orbiting a camera view.
2022-02-23 21:25:46 +11:00
3429444905 BLI: add index mask utilities
Sometimes it is useful to get the index ranges that are in an index mask.
That is because some algorithms can process index ranges more efficiently
than generic index masks.

Extracting ranges from an index mask is relatively efficient, because it is
cheap to check if a span of indices contains a contiguous range.
2022-02-23 11:14:07 +01:00
66c0fe5b23 Cleanup: correction to repeated word removal & correct spelling 2022-02-23 20:47:14 +11:00
7393cc1db7 Cleanup: Remove repeated word in comments 2022-02-23 18:24:37 +11:00
Alaska
165b030b19 Cleanup: Remove repeated word in comment
Differential Revision: https://developer.blender.org/D14178
2022-02-23 11:07:04 +05:30
3c0fd287cb Merge branch 'blender-v3.1-release' 2022-02-23 16:29:51 +11:00
74611e3555 Fix T93331: Gizmo tool options reset when switching tools
Drag Action was constantly resetting itself to "move".

Solve this by storing the tool settings per tool and no longer clear
gizmo properties when activating a new tool.
2022-02-23 16:27:26 +11:00
06bc20f61a Fix: Errors in previous cleanup commit
f3ef0763b4 introduced a file by mistake, and didn't add
a new enum type to many switch cases. Sorry for the noise.
2022-02-22 22:15:03 -05:00
f3ef0763b4 Cleanup: Use new curves type enum for CurveEval
Though this is less aesthetically pleasing, it makes the transition to the
new curves type (T95941) a bit simpler, and it has to be done anyway.
2022-02-22 21:52:48 -05:00
c6df7266c7 CMake: move cmake_consistency_check.py into source/tools/ repo
This isn't needed for building Blender so move this along side
other source checking scripts.
2022-02-23 12:31:46 +11:00
e1c33698e6 GNUmakefile: prefer "check_" prefix instead of "test_"
- Reserve "test" for tests & testing frameworks.
- Add "check_mypy" to "make help" text.
- Output to the standard output instead of redirecting to log-files,
  leave redirecting output log-files to the user running the command.
2022-02-23 12:31:46 +11:00
4c423ccbd6 CMake: include missing files
Also use SRC_ prefix for source variables so cmake_consistency_check.py
detects these files as being known to CMake.
2022-02-23 12:31:46 +11:00
4addc1f31e Tests: temporarily add back tests/check_deprecated.py
The build-bot directly referenced this file and doesn't
have publically available configuration.

Add an empty file until this can be removed by the build scripts.
2022-02-23 12:30:54 +11:00
5b4732f81c Cleanup: Use new enum for CurveEval handle types
This will make the transition to the new curves data structure
a bit simple, since the handle types can be copied directly between
the two. The change to CurveEval is simple because it is runtime-only.
2022-02-22 17:37:58 -05:00
0b9cc6725c XR: Use #ifdef for Vive Focus 3 extension
Helps with building against different OpenXR SDK versions (i.e. for
downstream builds that require specific versions), as the extension was
only defined since OpenXR 1.0.22.
2022-02-23 06:56:08 +09:00
d228f05814 Merge branch 'blender-v3.1-release' 2022-02-22 14:40:20 -05:00
2746238dde Python API Docs: Hide version swtich
This still needs some fixes to be ready for release.
2022-02-22 14:39:51 -05:00
529f891878 GPencil: Make Fill Dilate expand outside stroke
To keep consistency with the new contract option, the dilate now expand the shape beyond the internal closed area.
2022-02-22 20:03:34 +01:00
ad3ee84f4e Cleanup: Remove unused mesh dirty flags
These were only set in two places. One was related to "tessellated loop
normal", and the other derived corner normals. The values were never
checked though, after 59343ee162. The handling of dirty face
corner normals is clearly problematic, but in the future it should be
handled like the normal layers on the other domains instead.

Ref D14154, T95839
2022-02-22 13:13:13 -05:00
c7a9f76149 Merge branch 'blender-v3.1-release' 2022-02-22 12:47:05 -05:00
59343ee162 Fix T95839: Data race when lazily creating mesh normal layers
Currently, when normals are calculated for a const mesh, a custom data
layer might be added if it doesn't already exist. Adding a custom data
layer to a mesh is not thread-safe, so this can be a problem in some
situations.

This commit moves derived mesh normals for polygons and
vertices out of `CustomData` to `Mesh_Runtime`. Most of the
hard work for this was already done by rBcfa53e0fbeed7178.
Some changes to logic elsewhere are necessary/helpful:
- No need to call both `BKE_mesh_runtime_clear_cache` and
  `BKE_mesh_normals_tag_dirty`, since the former also does the latter.
- Cleanup/simplify mesh conversion and copying since normals are
  handled with other runtime data.

Storing these normals like other runtime data clarifies their status
as derived data, meaning custom data moves more towards storing
original/editable data. This means normals won't automatically benefit
from the planned copy-on-write refactor (T95845), so it will have to be
added manually like for the other runtime data.

Differential Revision: https://developer.blender.org/D14154
2022-02-22 12:44:15 -05:00
f3d97498c3 Merge branch 'blender-v3.1-release' 2022-02-22 18:03:27 +01:00
ee9949a85f Fix (unreported) LibOverride: missing copying flag member. 2022-02-22 18:01:52 +01:00
29696fb725 UI: ActionZone Swap Areas Between Windows
Allow SCREEN_OT_area_swap to operate between different Blender
windows, and other minor feedback improvements.

See D14135 for more details and demonstrations.

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

Reviewed by Campbell Barton
2022-02-22 08:58:42 -08:00
8ae77efe4e Merge branch 'blender-v3.1-release' 2022-02-22 17:34:07 +01:00
283a4cd40e Fix ffmpeg tests when using ffmpeg 5.0 2022-02-22 17:30:52 +01:00
2f951667c0 OCIO: Fix bool1 vs. bool comparison warning.
Fixes the following warning:
`'!=': unsafe mix of type 'bool1' and type 'bool' in operation`
2022-02-22 17:29:32 +01:00
353fe610ed Fix: Clear mesh runtime cache when adding elements
Currently the RNA functions to add mesh elements like vertices
don't clear the runtime cache of things like triangulation, BVH
trees, etc. This is important, since they might be accessed with
incorrect sizes. This is split from a fix for T95839.
2022-02-22 11:14:50 -05:00
8073c95fe9 Cleanup: Deduplicate logic in RNA_property_editable & co.
Fairly straight-forward, now all the logic for all those 'is editable'
complex checks is gathered into a single util function.
2022-02-22 16:38:04 +01:00
51c7193405 Cycles: Removed numaapi from standalone 2022-02-22 16:34:52 +01:00
b861d3e4c1 Merge branch 'blender-v3.1-release' 2022-02-22 16:08:38 +01:00
ca991e3012 Fix compilation error on certain platforms
Atomic operations performed by the C++ standard library might require
libatomic on platforms which do not have hardware support for those
operations.

This change makes it that such configurations are automatically detected
and -latomic is added when needed.

Differential Revision: https://developer.blender.org/D14106
2022-02-22 15:47:43 +01:00
37fb69e020 Fix (unreported) RNA_property_editable_index.
NOTE: This function is currently unused. However, it does use a callback
defined by a few RNA properties through
`RNA_def_property_editable_array_func`, so don't think it should be
removed without further thinking.

This function had two main issues:
* It was doing bitwise AND on potentially three sources of property
  flag, when actually used `RNA_property_editable` just use one source
  ever.
* It was completely ignoring liboverride cases.

TODO: Deduplicate code between `RNA_property_editable`,
`RNA_property_editable_info` and `RNA_property_editable_index`.
2022-02-22 15:33:52 +01:00
f449b89688 Cleanup: Make RNA_property_editable logic clearer.
Split code in smaller bits with early returns, instead of a giant single
set of checks.

No behavioral change expected here.
2022-02-22 15:18:08 +01:00
472ddc6e27 Merge branch 'blender-v3.1-release' 2022-02-22 15:13:27 +01:00
1d4037645f Cleanup: quiet warnings for FFMPEG before 5.0
Even though 5.0 has been released newer distributions wont include it,
so quiet warnings.
2022-02-22 15:11:35 +01:00
9d8af55eb8 GNUmakefile: missed removing docs for test_deprecated when renaming 2022-02-23 00:05:34 +11:00
66f3545a0b Cleanup: compiler warning 2022-02-22 14:03:11 +01:00
85b39b6be0 Fix subdivision surface modifier doing unnnecessary work
There was accidentally some displacement related code running even when not
using displacement.

Differential Revision: https://developer.blender.org/D14169
2022-02-22 14:03:11 +01:00
6bb4c0e498 GNUmakefile: rename test_depracted to check_deprecated
Also move this utility into the source/tools repo.
2022-02-23 00:00:32 +11:00
4a7559bbcb Cleanup: quiet warnings for FFMPEG before 5.0
Even though 5.0 has been released newer distributions wont include it,
so quiet warnings.
2022-02-23 00:00:32 +11:00
64293a277f Merge branch 'blender-v3.1-release' 2022-02-22 13:57:05 +01:00
4e78a7360e Fix T93784: text and curve objects have no motion blur
Previously, objects and geometries were mapped between frames
using different hash tables in a way that is incompatible with
geometry instances. That is because the geometry mapping happened
without looking at the `persistent_id` of instances, which is not possible
anymore. Now, there is just one mapping that identifies the same
object at multiple points in time.

There are also two new caches for duplicated vbos and textures used for
motion blur. This data has to be duplicated, otherwise it would be freed
when another time step is evaluated. This caching existed before, but is
now a bit more explicit and works for geometry instances as well.

Differential Revision: https://developer.blender.org/D13497
2022-02-22 13:52:15 +01:00
0b4c56b010 Cleanup: Replace eTexPaintMode with classes.
For an upcoming prototype we would introduced a new eTexPaintMode
option. That would add more cases and if statements. This change migrate
the eTexPaintMode to 3 classes. AbstractPaintMode contains a shared interface.
ImagePaintMode for 2d painting and ProjectionPaintMode for 3d painting.
2022-02-22 13:42:44 +01:00
683a77256d Fix compilation issue under windows. 2022-02-22 10:30:02 +01:00
4ba894cbb8 Fix compilation error on certain platforms.
Seems this isn't an issue on newer compilers.
2022-02-22 10:00:03 +01:00
1d4ed6ba29 Convert paint_image to cc. 2022-02-22 10:00:03 +01:00
1ec02b8695 Cleanup: Renamed PaintOperation.custom_paint to stroke_handle. 2022-02-22 10:00:03 +01:00
0cfcb261b1 Merge branch 'blender-v3.1-release' 2022-02-22 19:59:31 +11:00
0ad4d2694b Python: change behavior for CONSOLE_OT_indent_or_autocomplete
Checking only the previous character broke import auto-completion.
2022-02-22 19:57:36 +11:00
7657358447 Cleanup: use doxygen sections 2022-02-22 19:39:55 +11:00
27427f3447 Cleanup: Use switch-statement for eTexPaintMode. 2022-02-22 09:02:52 +01:00
2cd33955be Merge branch 'blender-v3.1-release' 2022-02-22 16:43:23 +11:00
c5b66560de Fix T93629: Reset to defaults undoes all steps when applied twice
Reset Defaults left the undo stack in an invalid state,
with the active undo step left at the previous state then it should
have been.

Now the buttons own undo logic is used to perform undo pushes.
2022-02-22 16:40:07 +11:00
2234bfbcdb GPencil: Simplify sample modifier improvements.
1. Now handles cyclic strokes correctly.

2.  Added a sharp threshold value to allow preservation of sharp corners.

Reviewed By: Antonio Vazquez (antoniov), Aleš Jelovčan (frogstomp)

Ref D14044
2022-02-22 12:54:35 +08:00
0f2e0a25e1 LineArt: Consistent backface culling behavior
1. Now will remove lines if both adjacent faces are back face.

2. Added a check to respect material back face culling setting.

3. Changed label in the modifier to "Force Backface Culling" (which reflect more accurately with what the checkbox does).

Reviewed By: Antonio Vazquez (antoniov), Aleš Jelovčan (frogstomp)

Ref D14041
2022-02-22 12:51:49 +08:00
2fefdaae93 Merge branch 'blender-v3.1-release' 2022-02-21 21:54:59 -03:00
75be58c63d Fix errors in 'gpu.state' documentation
`blend_depth_test_get` --> `depth_test_get`
`depth_mask_set_get` --> `depth_mask_get`

Thanks to @SBCV for pointing out these inconsistencies.
2022-02-21 21:48:17 -03:00
18d3d283ec Fix wrong method name in gpu documentation
`use_program_point_size` --> `program_point_size_set`.
2022-02-21 21:48:02 -03:00
Germano Cavalcante
c73bacc364 Camera: Simplify View Frame code
- No need for `normal_tx` array if we normalize the planes in `plane_tx`.
- No need to calculate the distance squared to a plane (with `dist_signed_squared_to_plane_v3`) if the plane is normalized. `plane_point_side_v3` gets the real distance, accurately, efficiently and also signed.

So normalize the planes of the member `CameraViewFrameData::plane_tx`.
2022-02-21 21:47:46 -03:00
459d9c1e3d Fix (unreported): Issues with 'SNAP_NOT_SELECTED' for pose and edit modes
This is a regression partially introduced in rB0a6f428be7f0.

Bones being transformed into edit mode were snapping to themselves.

And the bones of the pose mode weren't even snapping.

(Curious that this was not reported).
2022-02-21 21:47:24 -03:00
fcda858e32 Cleanup: remove Python 3.9 annotation workarounds 2022-02-22 10:28:01 +11:00
ca12696257 Merge branch 'blender-v3.1-release' 2022-02-22 10:18:15 +11:00
ec5bbebf3e Python: bump minimum version to 3.10
Since Python 3.10 is now supported on all platform,
bump the minimum version to reduce the number of Python versions that
need to be supported simultaneously.

Reviewed By: LazyDodo, sybren, mont29, brecht

Ref D13943
2022-02-22 10:16:25 +11:00
b13bf8556b Cleanup: clang-format 2022-02-22 10:08:38 +11:00
55a4ebc701 Merge branch 'blender-v3.1-release' 2022-02-22 10:08:24 +11:00
6ec57f9083 Merge branch 'blender-v3.1-release' 2022-02-22 10:08:20 +11:00
2a5df72d9b Revert "Cleanup: quiet const cast warning"
This reverts commit 626fb290eb.

This was an intentional change for FFMPEG v5.0,
removing the cast should be done in a version check instead.
2022-02-22 10:07:05 +11:00
bfdbc78466 Fix T44415: Shape keys get out of sync when using undo in edit-mode
This is an alternate fix for T35170 since it caused T44415.
Having the undo system manipulate the key-block coordinates is error
prone as (in the case of T44415) there are situations when it's
important to apply the difference with the original shape key.

This reverts dab0bd9de6, and instead
avoids the problem by not using the data in `Mesh.key` as a reference
for updating shape-keys when exiting edit-mode.

The assumption that the `Mesh.key` in edit-mode won't be modified
until leaving edit-mode isn't always true. Leading to synchronization
errors. (details noted in code-comments).

Resolve this by using shape-key data stored in the BMesh.

Resolving both T35170 & T44415.

Details:

- Remove use of the original vertices when exiting edit mode.
- Remove use of the original shape-key coordinates when exiting
  edit-mode (except as a last resort).
- Move shape-key synchronization into a separate function:
  `bm_to_mesh_key`.
- Split the synchronization loop into two branches,
  depending on the existence of BMesh shape-key coordinates.
- Always write shape-key values back to the BMesh CD_SHAPEKEY layers.
  This was only done in some cases but is now necessary for all
  shape-keys as these are used to calculate offsets where the `Mesh.key`
  was previously used.
- Report a warning when the shape-key layer isn't found as this uses an
  imperfect method of restoring coordinates which should only be used as
  a last resort.

Reviewed By: mont29

Ref D14127
2022-02-22 09:57:07 +11:00
c3d36b7127 Cleanup: clang-format 2022-02-22 09:56:43 +11:00
dde5cc6670 Cleanup: Use curves wrapper 2022-02-21 17:06:17 -05:00
24ddb4b1ad Merge branch 'blender-v3.1-release' 2022-02-21 14:04:38 -05:00
284cef473f Fix T95919: Apply Pose as Rest Pose Operator crashes
A simple mistake with a null mesh in rBcfa53e0fbeed.
2022-02-21 13:59:18 -05:00
48abcc91ae Merge branch 'blender-v3.1-release' 2022-02-21 19:51:50 +01:00
49ae0b5b3c Fix T95923: GPencil Array modifier constant offset works even disabled
The problem was when the Object Offset was enabled because the Constant Offset flag was not checked and the offset always was added to the transformation matrix.
2022-02-21 19:48:11 +01:00
9762dbe94e Merge branch 'blender-v3.1-release' 2022-02-21 13:07:14 -05:00
be6bcaa8c1 Fix T93873: Wrong limits for color socket exposed to modifier
Limit the min and max of the IDProperty for the node group input
from 0 to infinity, and the soft min and max between 0 and 1.

Thanks to @PratikPB2123 for investigation.
2022-02-21 13:01:37 -05:00
b7171d1b82 Cleanup: Use function to check if normals are dirty
This makes the fix for T95839 simpler.
Similar to 969c4a45ce.
2022-02-21 12:17:41 -05:00
a81cc5cbcb Fix: Avoid potential use of dirty normals
Instead of accessing the `CD_NORMAL` layer directly,
use the proper API for accessing mesh normals. Even if the
layer exists, the values might be incorrect due to a deformation.
Related to ef0e21f0ae, 969c4a45ce, and T95839.
2022-02-21 11:40:59 -05:00
869dd2e699 Fix T95154 Eevee AO node: the "only local" option applies "inside" instead
The `custom2` was not being used as a bitflag as it should.
2022-02-21 17:18:45 +01:00
68a2dc58de Weight Proximity: do flag split versioning both in 3.1 and 3.2
The flags overlapped ever since normalize was added, so this
requires versioning to copy the flag value. This needs to be
done both in Blender 3.1 and 3.2.

Differential Revision: https://developer.blender.org/D14165
2022-02-21 18:15:17 +03:00
1234a7ada0 Merge branch 'blender-v3.1-release' 2022-02-21 18:14:41 +03:00
82ff0fa586 Weight Proximity: fix value overlap between Normalize and Invert VGroup.
The flags overlapped ever since normalize was added, so this requires
versioning to copy the flag value.

Differential Revision: https://developer.blender.org/D14165
2022-02-21 18:08:53 +03:00
ed9f763034 Paint: pass operator to stroke update function
This allows accessing properties of the operator that the
stroke belongs to.
2022-02-21 16:07:59 +01:00
38ae311706 Weight Modifiers: use the correct flags for the mask invert property.
The code was using the same flag value for different modifiers,
resulting in matching the toggle to random overlapping flags.

Differential Revision: https://developer.blender.org/D14165
2022-02-21 18:07:08 +03:00
Henrik Dick
68586d2c18 Complex Solidify: improve constraints solver
The constraints solver is now able to handle more cases correctly.
Also the behavior of the boundary fixes is slightly changed if
the constraints thickness mode is used.

Differential Revision: https://developer.blender.org/D14143
2022-02-21 14:13:55 +01:00
fa715a158a Vertex Weight Mix: support Minimum and Maximum mix modes.
The modifier supports arithmetic operations, like Add or Multiply,
but for some reason omits Minimum and Maximum. They are similarly
simple and useful math functions and should be supported.

Differential Revision: https://developer.blender.org/D14164
2022-02-21 16:01:39 +03:00
0f242981ec Workbench: Fix missing world_data ubo during opaque prepass 2022-02-21 13:30:20 +01:00
5c11ca10c0 Merge branch 'blender-v3.1-release' 2022-02-21 23:15:50 +11:00
829812f180 Fix T92467: Path Selection broken when Drag is set to Tweak
When RMB-select uses "Select Tweak" as a fallback tool,
ignore all bindings mapped to the Control key as these are
used for path selection.

This was fixed in 2a2d873124
however that caused shift-select to fail (T93100).
2022-02-21 23:09:34 +11:00
d076e9468c Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-21 13:06:28 +01:00
132f9a2e31 Fix T95596: Crash in versioning of node animation
The node animation versioning code passes `nullptr` to the `oldName` and
`newName` parameters, but those weren't `NULL`-safe. I added an extra
check for this.

No functional changes, just a crash fix.
2022-02-21 13:02:23 +01:00
e2ffe88983 Curves: use paint cursor in curves sculpt mode
Also adds radius and strength control to the tool settings in the ui.
2022-02-21 12:49:36 +01:00
fcb84e32e0 Cleanup: use namespace and code sections 2022-02-21 12:01:30 +01:00
7f2beb79c6 Cleanup: move curves sculpt mode toggle operator to sculpt/paint module
This is necessary, because the operator will have to use functions that
are currently private within this module. E.g. `paint_cursor_start`.
2022-02-21 11:57:43 +01:00
141d5851d7 Paint: decouple op->customdata from PaintStroke
Previously, all operators using `PaintStroke` would have to store
the stroke in `op->customdata`. That made it impossible to store
other operator specific data in `op->customdata` that was unrelated
to the stroke.

This patch changes it so that the `PaintStroke` is passed to api
functions as a separate argument, which allows storing the stroke
as a subfield of some other struct in `op->customdata`.
2022-02-21 11:52:46 +01:00
5be74160c0 macOS/ blender_icons_update.py: prioritise environment variables
Also fix binary name for mac

Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D14161
2022-02-21 15:19:19 +05:30
bce810f057 Fix T95871: Non-float textures report as float.
Althought the float buffers are only used as cache, current code paths
don't look at the flags to identify which kind of image it is. Actual
fix would be to check flags, but that wouldn't be something to add one
week before release.

This commit fixes it by removing the buffers after use in the image
engine.
2022-02-21 07:48:49 +01:00
9189191c5b Fix errors in 'gpu.state' documentation
`blend_depth_test_get` --> `depth_test_get`
`depth_mask_set_get` --> `depth_mask_get`

Thanks to @SBCV for pointing out these inconsistencies.
2022-02-20 23:31:08 -03:00
813895f713 Cleanup: use strict type checking for bl_keymap_validate 2022-02-21 12:21:47 +11:00
167c4c6962 Tests: add duplicate key-map test, also test multiple configurations
Duplicate key-map items (while harmless in most cases) may cause
unexpected behavior or point to mistakes in the key-map,
so best avoid these.
2022-02-21 12:03:56 +11:00
16da9c944c Cleanup: remove duplicate key-map items 2022-02-21 12:01:32 +11:00
1884f6e729 BLI_array: add BLI_array_trim utility to re-allocate the current size
Use this in BKE_view_layer_array_* functions.
2022-02-21 12:01:32 +11:00
7b11c71729 RNA: modify debug mode logic for setting invalid unset values
The previous behavior called RNA_enum_item_add a second time,
filled it's contents with invalid values then subtracted totitem,
this caused an unusual reallocation pattern where MEM_recallocN
would run in order to create the dummy item, then again when adding
another itme (reallocating an array of the same size).

Simply memset the array to 0xff instead.
2022-02-21 12:01:32 +11:00
2554ef986a readfile: free & reallocate arrays in oldnewmap_clear
Even though the size of the map was set back to DEFAULT_SIZE_EXP,
the underlying arrays were left unchained. In some cases this caused
further expansions to result in an unusual reallocation pattern
where MEM_reallocN would run expand the entries into an array
that was in fact the same size.
2022-02-21 12:01:32 +11:00
e93a8c4f74 Cleanup: avoid reallocating arrays at the same size 2022-02-21 12:01:32 +11:00
626fb290eb Cleanup: quiet const cast warning 2022-02-21 12:01:32 +11:00
36d7adf85c Merge branch 'blender-v3.1-release' 2022-02-20 23:15:39 +01:00
1a0a22f95a Fix T95413: Blur node size input crash
Bug was introduced in D12167.

Reading input size from an input socket is not possible in tiled compositor before execution is initialized. A similar change was done for the base class, see BlurBaseOperation::init_data().

Reviewed by: Jeroen Bakker

Differential Revision: https://developer.blender.org/D14067
2022-02-20 23:00:44 +01:00
de886884c0 Fix T95470: LineArt GPU subdiv fix.
Use evaluated mesh instead of ob->data.

Reviewed by: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D14040
2022-02-20 19:40:44 +08:00
Aaron Carlisle
1f79132287 UI: Do not include the text stating an enum item is the default
This adds maintence overhead and it is not that useful when we have reset to default.

If this is something that we want it should be added dynamically.

Reviewed By: HooglyBoogly, Severin, #user_interface

Differential Revision: https://developer.blender.org/D14151
2022-02-19 21:31:53 -05:00
991781c8ea LineArt: GPU subdiv fix.
Use evaluated mesh instead of ob->data.

Reviewed by: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D14040
2022-02-19 22:35:22 +08:00
385d9488e6 Fix incorrect copying of XR action paths
After using MEM_dupallocN() on the original item/binding, the
user/component path ListBase for the new item/binding needs to be
cleared and each path copied separately.
2022-02-19 15:23:34 +09:00
16d5658365 OCIO: Port shader creation logic to use GPUShaderCreateInfo
This commit should suffice to make the shader API agnostic now (given that
all users of it use the GPU API).

This makes the shaders not trigger a false positive error anymore since
the binding slots are now garanteed by the backend and not changed at
after compilation.

This also bundles all uniforms into UBOs. Making them extendable without
limitations of push constants. The generated uniforms from OCIO are not
densely packed in the UBO to avoid complexity. Another approach would be to
use GPU_uniformbuf_create_from_list but this requires converting uniforms
to GPUInputs which is too complex for what it is.

Reviewed by: brecht, jbakker

Differential Revision: https://developer.blender.org/D14123
2022-02-18 22:30:45 +01:00
e81dda4f38 Merge branch 'blender-v3.1-release'
# Conflicts:
#	intern/opencolorio/ocio_shader_shared.hh
2022-02-18 22:29:31 +01:00
93cc892470 Revert "OCIO: Port shader creation logic to use GPUShaderCreateInfo"
This reverts commit 7f7c614ecd.
2022-02-18 22:28:05 +01:00
32660382f5 Revert "OCIO: Fix gpu include file"
This reverts commit 3cebfadb27.
2022-02-18 22:28:01 +01:00
7f68185d34 Merge branch 'blender-v3.1-release' 2022-02-18 15:17:01 -06:00
3cebfadb27 OCIO: Fix gpu include file
Was the cause by ef0e21f0ae
2022-02-18 21:52:29 +01:00
eba3ffc31a GL: Fix possible shift by -1
This can happen when the attribute has been optimized out by the compiler.
2022-02-18 21:33:47 +01:00
7f7c614ecd OCIO: Port shader creation logic to use GPUShaderCreateInfo
This commit should suffice to make the shader API agnostic now (given that
all users of it use the GPU API).

This makes the shaders not trigger a false positive error anymore since
the binding slots are now garanteed by the backend and not changed at
after compilation.

This also bundles all uniforms into UBOs. Making them extendable without
limitations of push constants. The generated uniforms from OCIO are not
densely packed in the UBO to avoid complexity. Another approach would be to
use GPU_uniformbuf_create_from_list but this requires converting uniforms
to GPUInputs which is too complex for what it is.

Reviewed by: brecht, jbakker

Differential Revision: https://developer.blender.org/D14123
2022-02-18 21:33:47 +01:00
ef0e21f0ae Cleanup: Remove unused argument to mesh tessellation
This removes manual handling of normals that was hard-coded
to false in the one place the function was called. This change
will help to make a fix to T95839 simpler.
2022-02-18 13:39:16 -06:00
969c4a45ce Cleanup: Use functions for accessing mesh normal dirty state
It's better not to expose the details of where the dirty flags are
stored to every place that wants to know if the normals are dirty.
Some of these places are relics from before vertex normals were
computed lazily anyway, so this is more of an incrememtal cleanup.
This will make part of the fix for T95839 simpler.
2022-02-18 13:21:36 -06:00
eaa4aa8644 Fix part of T95848: missing updates editing light object nodes
Make relation match material and world nodes. Does not address the reported
issue regarding muted nodes, but another missing update found investigating.
2022-02-18 19:50:53 +01:00
b04d42022f Fix T95338: missing image editor refresh after render compositing
This was an old issue, but recent image partial update changes made this more
likely to happen in some cases. Now ensure that whenever the rendered scene
switches the image is updated.
2022-02-18 19:50:53 +01:00
Dominik Fill
d9d97db018 Fix T87829, T95331: Issues when nodes too close together
This patch aims to fix the issues presented in T87829 and T95331,
namely precision issues while connecting two nodes when being too
close together in the node editor editors, in a few cases even
resulting in the complete inability to connect nodes.

Sockets are found by intersecting a padded rect around the cursor
with the nodes' sockets' location. That creates ambiguities, as it's
possible for the padded rect to intersect with the wrong node,
as the distance between two nodes is smaller than the rect is padded.

The fix in this patch is checking against an unpadded rectangle in
visible_node().

Differential Revision: https://developer.blender.org/D14122
2022-02-18 12:22:51 -06:00
07fbf3108b Merge branch 'blender-v3.1-release' 2022-02-18 11:40:55 -06:00
Wannes Malfait
82fc68ed90 Fix T95542: Dual Mesh crashes with some non-manifold vertices
The problem was that the code for sorting polygons around a vertex
assumed that it was a manifold or boundary vertex. However in some cases
the vertex could still be nonmanifold causing the crash. The cases where
the sorting fails are now detected and these vertices are then marked as
nonmanifold.

Differential Revision: https://developer.blender.org/D14065
2022-02-18 11:35:08 -06:00
Leon Schittek
ddc52f2e1d Fix: Curve to Mesh node creates caps when curve is cyclic
The "Fill Caps" option on the Curve to Mesh node introduced in
rBbc2f4dd8b408ee makes it possible to fill the open ends of the sweep
to create a manifold mesh.

This patch fixes an edge case, where caps were created even when the
rail curve (the curve used in the "Curve" input socket) was cyclic
making the resulting mesh non-manifold.

Differential Revision: https://developer.blender.org/D14124
2022-02-18 11:27:28 -06:00
c2016feadc Merge branch 'blender-v3.1-release' 2022-02-18 18:25:31 +01:00
af6a1b08e3 VSE: Refactor our code to be compatible with ffmpeg 5.0
In ffmpeg 5.0, several variables were made const to try to prevent bad API usage.
Removed some dead code that wasn't used anymore as well.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D14063
2022-02-18 18:24:16 +01:00
16ab6111f7 UI: Speedup preview icon loading from hard drive
Significantly improves loading speed of preview images from disk, e.g. custom
previews loaded using `bpy.utils.previews.ImagePreviewCollection.load()`.

See D14144 for details & comparison videos.

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

Reviewed by: Bastien Montagne
2022-02-18 18:13:06 +01:00
1850a0b2ab Mesh: Avoid creating incorrect original index layers
Currently, whenever any BMesh is converted to a Mesh (except for edit
mode switching), original index (`CD_ORIGINDEX`) layers are added.
This is incorrect, because many operations just convert some Mesh into
a BMesh and then back, but they shouldn't make any assumption about
where their input mesh came from. It might even come from a primitive
in geometry nodes, where there are no original indices at all.

Conceptually, mesh original indices should be filled by the modifier
stack when first creating the evaluated mesh. So that's where they're
moved in this patch. A separate function now fills the indices with their
default (0,1,2,3...) values. The way the mesh wrapper system defers
the BMesh to Mesh conversion makes this a bit less obvious though.

The old behavior is incorrect, but it's also slower, because three
arrays the size of the mesh's vertices, edges, and faces had to be
allocated and filled during the BMesh to Mesh conversion, which just
ends up putting more pressure on the cache. In the many cases where
original indices aren't used, I measured an **8% speedup** for the
conversion (from 76.5ms to 70.7ms).

Generally there is an assumption that BMesh is "original" and Mesh is
"evaluated". After this patch, that assumption isn't quite as strong,
but it still exists for two reasons. First, original indices are added
whenever converting a BMesh "wrapper" to a Mesh. Second, original
indices are not added to the BMesh at the beginning of evaluation,
which assumes that every BMesh in the viewport is original and doesn't
need the mapping.

Differential Revision: https://developer.blender.org/D14018
2022-02-18 10:51:00 -06:00
a08c5c7149 Merge branch 'blender-v3.1-release' 2022-02-18 10:35:11 -06:00
82c3bef765 Fix T94495: Split edges node leads to a crash in edit mode
If original indices exist on the input mesh, also copy them to
the BMesh used for the edge split operation so they aren't lost.

Part of D14018
2022-02-18 10:34:00 -06:00
ddf189892c Cleanup: Rename original curve object type enum
This commit renames enums related the "Curve" object type and ID type
to add `_LEGACY` to the end. The idea is to make our aspirations clearer
in the code and to avoid ambiguities between `CURVE` and `CURVES`.

Ref T95355

To summarize for the record, the plans are:
- In the short/medium term, replace the `Curve` object data type with
 `Curves`
- In the longer term (no immediate plans), use a proper data block for
  3D text and surfaces.

Differential Revision: https://developer.blender.org/D14114
2022-02-18 09:50:29 -06:00
48b17da1d9 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-18 16:36:45 +01:00
1b47d07d76 Fix T95724: boundary error in BLI_str_unescape_ex
Fix boundary error in `BLI_str_unescape_ex`. The `dst_maxncpy` parameter
indicates the maximum buffer size, not the maximum number of characters.

As these are strings, the loop has to stop one byte early to allow space
for the trailing zero byte.

Thanks @mano-wii for the patch!
2022-02-18 16:34:00 +01:00
734c6a4405 Nodes: Update dependency graph when removing some nodes
When removing a node that has a dependence on an ID, like the object
info node, the dependency graph relations weren't updated. This can
cause unexpected performance issues if a complex node tree continues
to depend on an ID that it doesn't actually use anymore. To fix this case,
tag relations for an update if the node has a data-block socket.

Fixes part of T88332

Differential Revision: https://developer.blender.org/D14121
2022-02-18 09:25:13 -06:00
Sayed Amin
ceea3d0f80 Fix T95135: improve error filtering non-existant anim data
If there is no animation at all, or it's all hidden, the Euler Filter
operators poll now fails with a message that explains this a bit more,
instead of just the generic "context is wrong" error.

Reviewed By: sybren

Maniphest Tasks: T95135

Differential Revision: https://developer.blender.org/D13967
2022-02-18 16:24:48 +01:00
aab1561690 LibOverride: Fix resync sometimes deleting root ID of other liboverrides.
While this should not happen in theory, very bad/broken/dirty files can
lead to such situations.

So we need to re-ensure valid root IDs after resync (for now, done after
each 'library indirect level' pass of resync, this may not be 100%
bulletproof though, time will say).

Found while investigating Blender studio issues in Snow parkour short.
2022-02-18 16:08:43 +01:00
d9fe565c85 LibOverride: Fix potential broken cases re ShapeKeys when finding hierarchy root ID.
In some cases broken files could lead to selecting a shapekey as
hierarchy root ID, which is not allowed.

Found while investigating Blender studio issues in Snow parkour short.
2022-02-18 16:06:15 +01:00
303b566b10 Merge branch 'blender-v3.1-release' 2022-02-18 15:32:24 +01:00
e4b7d52fe4 Fix graphics interop resources leak in Cycles
When new display driver is given to the PathTrace ensure that there are
no GPU resources used from it by the work. This solves graphics interop
descriptors leak.

This aqlso fixes Invalid graphics context in cuGraphicsUnregisterResource
error when doing final render on the display GPU.

Fixes T95837: Regression: GPU memory accumulation in Cycles render
Fixes T95733: Cycles Cuda/Optix error message with multi GPU devices. (Invalid graphics context in cuGraphicsUnregisterResource)
Fixes T95651: GPU error (Invalid graphics context in cuGraphicsUnregisterResource)
Fixes T95631: VRAM is not being freed when rendering (Invalid graphics context in cuGraphicsUnregisterResource)
Fixes T89747: Cycles Render - Textures Disappear then Crashes the Render

Maniphest Tasks: T95837, T95733, T95651, T95631, T89747

Differential Revision: https://developer.blender.org/D14146
2022-02-18 15:26:15 +01:00
40cddcd917 Cleanup: Fix incompatible pointer types warnings 2022-02-18 23:21:53 +09:00
af308049bc Merge branch 'blender-v3.1-release' 2022-02-18 14:55:54 +01:00
02f4d63dcc Fix broken shapekeys: check for 'NULL' from pointer too.
Add check for `NULL` `from` pointer to `BLO_main_validate_shapekeys`,
and delete these shapekeys, as they are fully invalid and impossible to
recover.

Found in a studio production file (`animation
test/snow_parkour/shots/0040/0040.lighting.blend`, svn rev `1111`).
Would be nice to know how this was generated too...
2022-02-18 12:29:27 +01:00
5f16e24cc9 Curves: add initial edit mode support
This adds initial support for edit mode for the experimental new curves
object. For now we can only toggle in and out of the mode, no real
interraction is possible.

This patch also adds empty menus in edit mode. Those were added mainly
to quiet warnings as the menus are programmatically added to the edit
mode based on the object type and context.

Ref T95769

Reviewed By: JacquesLucke, HooglyBoogly

Maniphest Tasks: T95769

Differential Revision: https://developer.blender.org/D14136
2022-02-18 11:31:13 +01:00
8b4da9a191 Fix strict compilation warnings 2022-02-18 10:14:34 +01:00
61aaeb3745 Curves: initial brush system integration for curves sculpt mode
This adds the boilerplate code that is necessary to use the tool/brush/paint
systems in the new sculpt curves mode.

Two temporary dummy tools are part of this patch. They do nothing and
only serve to test the boilerplate. When the first actual tool is added,
those dummy tools will be removed.

Differential Revision: https://developer.blender.org/D14117
2022-02-18 09:14:54 +01:00
964d3a38fa XR: Enable Vive Focus 3 controller extension
Allows controller-specific action bindings for the HTC Vive Focus 3
controller. Currently not supported by any OpenXR runtimes (save for
the dedicated Focus 3 runtime in developer early-access:
https://forum.vive.com/topic/11354-openxr-support-for-focus-3-early-access-application-form),
but useful to have for the future.
2022-02-18 17:00:43 +09:00
4ad4d8a59c Cleanup: Use compact license header.
New file introduced in blender-v3.1-release branch.
2022-02-18 08:30:10 +01:00
5c6eefa850 Merge branch 'blender-v3.1-release' 2022-02-18 08:29:32 +01:00
fe26d18889 Fix T95809: Check color space changes to refresh image engine.
Previous commit fixed the compositor node, this commit is related to the
shader tree. Also checks if the color space or alpha mode have changed.
2022-02-18 08:22:18 +01:00
400e57b64a Fix T95809: Compositor Node not directly updated in image editor.
Image wasn't tagged to be dirty.
2022-02-18 08:11:51 +01:00
6efdfeb886 Image Engine: Store image usage to identity changes.
Previous implementation had a copy of the image user, which doesn't
contain all the data to identify changes. This patch introduces a new
struct to store the data and can be extended with other data as well
(color spaces, alpha settings).
2022-02-18 07:55:36 +01:00
ca1f879c02 Cleanup: simplify viewmove_apply
Check for a camera-view before checking if the view is locked
to the cursor/object since the camera-view takes priority,
it reads better to check that first.

Also reuse the event offset variable.
2022-02-18 17:24:10 +11:00
51975b89ed 3D View: Add camera view pan/zoom support for NDOF
NDOF navigation in a camera view now behaves like orthographic pan/zoom.

Note that NDOF orbiting out of the camera view has been disabled,
see code comment for details.

Resolves T93666.
2022-02-18 17:09:49 +11:00
f33e6e0d8c Cleanup: move camera-view pan/zoom into utility functions 2022-02-18 16:48:27 +11:00
ae9dd0cbf9 Merge branch 'blender-v3.1-release' 2022-02-17 23:44:47 -06:00
Pratik Borhade
1d0d810331 Fix T93526: Missing tooltip for attribute search button
For the attribute search button, the tooltip was missing
if the input socket type has attribute toggle activated.

Differential Revision: https://developer.blender.org/D14142
2022-02-17 23:44:16 -06:00
59aaf2036e Fix wrong method name in gpu documentation
`use_program_point_size` --> `program_point_size_set`.
2022-02-17 22:11:08 -03:00
9153bf24cb Merge branch 'blender-v3.1-release' 2022-02-17 20:30:45 +01:00
3cdbeb32d3 Fix build error on some compilers after recent bugfix 2022-02-17 20:30:19 +01:00
ad2577e0cd Merge branch 'blender-v3.1-release' 2022-02-17 19:52:46 +01:00
da6b534274 Fix T95368: wrong white point adaptation for Linear ACES color space
This affected loading of EXR files with set to Linear ACES colorspace, as
well as the sky texture for in some custom OpenColorIO configurations.

Use the builtin OpenColorIO transform from ACES AP0 to XYZ D65 to fix this.
2022-02-17 19:51:43 +01:00
48432c1c92 Fix: Debug build error with vector type division
The idea is to keep `is_any_zero` in the `blender::math` namespace,
so instead of trying to be clever, just move it there and expand the
function where it was used in the class.
2022-02-17 12:36:41 -06:00
b6fe1b0c65 Merge branch 'blender-v3.1-release' 2022-02-17 18:44:18 +01:00
a04300c436 Cleanup: Move more cmake library variables to be advanced
I noticed that there were a few variables that should not be visible per default.
It seems to me to simply be an oversight, so I went ahead and cleaned them up.

Reviewed By: Sybren, Ray molenkamp

Differential Revision: http://developer.blender.org/D14132
2022-02-17 18:42:06 +01:00
8355ac97b4 GPU: Remove runtime sampler texture slot assignment
This avoid potential shader recompilation and is more in line
with vulkan design.
2022-02-17 18:15:31 +01:00
37fa1bc254 OCIO: Port shader creation logic to use GPUShaderCreateInfo
This commit should suffice to make the shader API agnostic now (given that
all users of it use the GPU API).

This makes the shaders not trigger a false positive error anymore since
the binding slots are now garanteed by the backend and not changed at
after compilation.

This also bundles all uniforms into UBOs. Making them extendable without
limitations of push constants. The generated uniforms from OCIO are not
densely packed in the UBO to avoid complexity. Another approach would be to
use GPU_uniformbuf_create_from_list but this requires converting uniforms
to GPUInputs which is too complex for what it is.

Reviewed by: brecht, jbakker

Differential Revision: https://developer.blender.org/D14123
2022-02-17 18:15:31 +01:00
9281ba5812 Fix part of T95654: Cycles crash with text objects in excluded view layers
This is a bug on the Blender side, where the depsgraph does not have proper
relations for text object duplis and fails to include the required materials
in the dependency graph. But at least Cycles should not crash.
2022-02-17 17:30:40 +01:00
b5e3700b79 Cleanup: Replace direct id.lib pointer checks with ID_IS_LINKED macro usages. 2022-02-17 17:08:00 +01:00
c99d1d5d0d Fix build errors on Linux/clang after recent changes 2022-02-17 16:19:26 +01:00
114cc47b78 Fix: Memory leak in recently added curves copy function
Specify that the destination curve must be initialized, and free the
existing attributes (which `CustomData_copy` doesn't do).
2022-02-17 09:05:08 -06:00
Germano Cavalcante
e240c8c5db Camera: Simplify View Frame code
- No need for `normal_tx` array if we normalize the planes in `plane_tx`.
- No need to calculate the distance squared to a plane (with `dist_signed_squared_to_plane_v3`) if the plane is normalized. `plane_point_side_v3` gets the real distance, accurately, efficiently and also signed.

So normalize the planes of the member `CameraViewFrameData::plane_tx`.
2022-02-17 11:51:45 -03:00
a4c800ed02 Merge branch 'blender-v3.1-release' 2022-02-17 15:24:29 +01:00
e5100ca3ad Build: update CMake to support OpenImageIO 2.3.4
FindOpenImageIO was updated to link to separate OpenImageIO_Util for new
versions, where it is required. For older versions, we can not link to it
because there will be duplicated symbols.

Ref D14128
2022-02-17 15:21:09 +01:00
2c9931699e Build: update CMake to support OpenEXR 3
FindOpenEXR was updated to find new lib names and separate Imath. It's all
added to the list of OpenEXR include dirs and libs.

This keeps it compatible with both version 2 and 3 for now, and doesn't
require changes outside the find module.

Ref D14128
2022-02-17 15:21:09 +01:00
cd7550cfe7 Images: update code to support OpenEXR 3
Compatibility with OpenEXR 2 is preserved, since Blender releases and Linux
distribution packages can be on different versions.

Ref D14128
2022-02-17 15:21:09 +01:00
6a283b7a7f Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-17 15:16:31 +01:00
4541249360 Fix compile error on MSVC
`uint` is POSIX type, use `GLuint` like for the rest of the code.
2022-02-17 15:15:46 +01:00
68a09bf5fd Cleanup/fix comment. 2022-02-17 14:36:03 +01:00
433fad50d8 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-17 13:14:47 +01:00
c5dcfb63d9 Fix T94881: GPU subdivision fails with high polycount coarse meshes
Coarse meshes with high polycount would show as corrupted when GPU
subdivision is used with AMD cards This was caused by the OpenSubdiv
library not taking `GL_MAX_COMPUTE_WORK_GROUP_COUNT` into account when
dispatching computes. AMD drivers tend to set the limit lower than
NVidia ones (2^16 for the former, and 2^32 for the latter, at least
on my machine).

This moves the `GLComputeEvaluator` from the OpenSubdiv library into
`intern/opensubdiv` and modifies it to compute a dispatch size in a
similar way as for the draw code: we split the dispatch size into a 2
dimensional value based on `GL_MAX_COMPUTE_WORK_GROUP_COUNT` and
manually compute an index in the shader.

We could have patched the OpenSubdiv library and sent the fix upstream
(which can still be done), however, moving it to our side allows us to
better control the `GLComputeEvaluator` and in the future remove some
redundant work that it does compared to Blender (see T94644) and
probably prepare the ground for Vulkan support. As a matter of fact,
this patch also removes the OpenGL initialization that OpenSubdiv would
do here. This removal is not related to the bug fix, but necessary to not
have to copy more files/code over.

Differential Revision: https://developer.blender.org/D14131
2022-02-17 13:14:19 +01:00
43b40f7bde Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-17 08:41:01 +01:00
be3047c500 Fix T95827: vertex groups do not display correctly with GPU subdivision
Issue caused by 993839ce85 which modified
the coarse face flags update function, but forgot the case where we have
a mapped extraction with no BMesh.
2022-02-17 08:40:38 +01:00
401383f245 Fix vertex groups not rendering properly with GPU subdivision
This was missing the BMesh case. Issue found while investigating T95827.
2022-02-17 08:38:12 +01:00
6a8709ba13 XR: Allow variable count of action map subactions
Previously, the number of action map subactions was limited to two per
action (identified by user_path0, user_path1), however for devices with
more than two user paths (e.g. Vive Tracker) it will be useful to
support a variable amount instead.

For example, a single pose action could then be used to query the
positions of all connected trackers, with each tracker having its own
subaction tracking space.

NOTE: This introduces breaking changes for the XR Python API as follows:
- XrActionMapItem: The new `user_paths` collection property
replaces the `user_path0`/`user_path1` properties.
- XrActionMapBinding: The new `component_paths` collection property
replaces the `component_path0`/`component_path1` properties.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D13949
2022-02-17 15:51:16 +09:00
7d4d8a13ce Merge branch 'blender-v3.1-release' 2022-02-17 15:39:31 +09:00
dd6fd06c15 Fix T76082: VR Scene Inspection: It shows me only a pink screen
This fixes VR pink screen issues when using the DirectX backend, caused
by `wglDXRegisterObjectNV()` failing to register the shared
OpenGL-DirectX render buffer. The issue is mainly present on AMD
graphics, however, there have been reports on NVIDIA as well.

A limited workaround for the SteamVR runtime (AMD only) was provided
in rB82ab2c167844, however this patch provides a more complete solution
that should apply to all OpenXR runtimes. For example, with this patch,
the Windows Mixed Reality runtime that exclusively uses DirectX can now
be used with AMD graphics cards.

Implementation-wise, a `GL_TEXTURE_2D` render target is used as a
fallback for the shared OpenGL-DirectX resource in the case that
registering a render buffer (`GL_RENDERBUFFER`) fails. While using a
texture render target may be less optimal than a render buffer, it
enables proper display in VR using the OpenGL/DirectX interop (tested
on AMD Vega 64).

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D14100
2022-02-17 15:28:29 +09:00
8c8d84fbc5 Cleanup: compiler warning, typo in comment 2022-02-17 16:50:44 +11:00
bdde8c7207 License headers: use SPDX identifiers 2022-02-17 16:47:37 +11:00
Christoph Lendenfeld
b626edd751 fix: RNA property not set for Graph editor breakdown op
After running the breakdown operator for the graph editor,
the factor property in the redo panel didn't reflect the value you chose

to mitigate that issue down the line there is a
new helper function to get the factor value, and
store it at the same time

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D14105
Ref: D14105
2022-02-16 21:55:42 +01:00
8c96ee8903 Cleanup: Deduplicate functions for creating attributes 2022-02-16 14:10:21 -06:00
6862caea5e macOS/bpy module: install text files correctly
Instead of Blender.app (despite building bpy), install license etc in
`Resources/text` of bpy install location. Part of D14111
2022-02-17 01:31:03 +05:30
71545e542c macOS/bpy module: install scripts relative to bpy.so
Brew's Python framework's site-packages is a symlink so the assumption
that Resources and site-packages would be in the same directory
doesn't hold. So install scripts etc relative to bpy.so. Part of D14111
2022-02-17 01:31:03 +05:30
57013e2a44 Merge branch 'blender-v3.1-release' 2022-02-16 19:51:58 +01:00
05697470ab Cleanup: Remove deprecated StringGrid from our openvdb code
StringGrid has been deprecated in openvdb 9.0.0 and will be removed soon

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D14133
2022-02-16 19:49:58 +01:00
f38c2fbef9 Merge branch 'blender-v3.1-release' 2022-02-16 19:03:00 +01:00
0622d2ec61 Fix T95815: missing null check when computing dupli dimensions
Some instances might be "empty" and therefore have no dimensions.
Those should be ignored here.
2022-02-16 18:58:01 +01:00
c324cf1539 Curves: Further implementation of new curves data structure
The general idea here is to wrap the `CurvesGeometry` DNA struct
with a C++ class that can do most of the heavy lifting for the curve
geometry. Using a C++ class allows easier ways to group methods, easier
const correctness, and code that's more readable and faster to write.
This way, it works much more like a version of `CurveEval` that uses
more efficient attribute storage.

This commit adds the structure of some yet-to-be-implemented code,
the largest thing being mutexes and vectors meant to hold lazily
calculated evaluated positions, tangents, and normals. That part might
change slightly, but it's helpful to be able to see the direction this
commit is aiming in. In particular, the inherently single-threaded
accumulated lengths and Bezier evaluated point offsets might be cached.

Ref T95355

Differential Revision: https://developer.blender.org/D14054
2022-02-16 11:32:37 -06:00
5b73017ddb BLI: Generalize short algorithm for finding bounds
Finding the greatest and/or smallest element in an array is a common
need. This commit refactors the point cloud bounds code added in
6d7dbdbb44 to a more general header in blenlib.
This will allow reusing the algorithm for curves without duplicating it.

Differential Revision: https://developer.blender.org/D14053
2022-02-16 10:53:58 -06:00
399168f3c1 BLI: Implement templated math functions for basic types
This is meant to complement the `blender::math` functions recently
added by D13791. It's sometimes desired to template an operation to work
on vector types, but also basic types like `float` and `int`. This patch
adds that ability with a new `BLI_math_base.hh` header.

The existing vector math header is changed to use the `vec_base` type
more explicitly, to allow the compiler's generic function overload resolution
to determine which implementation of each math function to use.
This is a relatively large change, but it also makes the file significantly
easier to understand by reducing the use of macros.

Differential Revision: https://developer.blender.org/D14113
2022-02-16 10:28:26 -06:00
5b3a415a59 Merge branch 'blender-v3.1-release' 2022-02-16 15:59:06 +01:00
257ba175fa Fix: removing anonymous attributes before adding mesh to bmain
This was an issue when e.g. `bpy.data.meshes.new_from_object` was
used on an object that uses geometry nodes.
2022-02-16 15:58:27 +01:00
03ff58b67d Cleanup: Use const qualifier in modifier data copy
Fix possible overflow of Modifier UUID

The code prior this change was re-generating modifier's session UUID
prior to copying this id from the source. This approach has a higher
risk of modifiers session UUID to overflow and start colliding with
existing modifiers.

This change makes it so that modifier copy does not re-generated the
session UUID unless it is needed.

Differential Revision: https://developer.blender.org/D14125
2022-02-16 15:40:03 +01:00
7e312f89d9 Cleanup: Use const qualifier in modifier data copy 2022-02-16 15:40:03 +01:00
259f4e50ef Merge branch 'blender-v3.1-release' 2022-02-16 15:35:18 +01:00
f059bdc823 Cycles: restore basic standalone GUI, now using SDL
GLUT does not support offscreen contexts, which is required for the new
display driver. So we use SDL instead. Note that this requires using a
system SDL package, the Blender precompiled SDL does not include the video
subsystem.

There is currently no text display support, instead info is printed to
the terminal. This would require adding an embedded font and GLSL shaders,
or using GUI library.

Another improvement to be made is supporting OpenColorIO display transforms,
right now we assume Rec.709 scene linear and display.

All OpenGL, GLEW and SDL code was move out of core cycles and into
app/opengl. This serves as a template for apps that want to integrate
Cycles interactive rendering, with a simple OpenGLDisplayDriver example.
In general this would be adapted to the graphics API and color management
used by the app.

Ref T91846
2022-02-16 15:30:43 +01:00
a6267f1167 BLI: Fix compilation error caused by rBa9f023e22638
Explicitly referencing the typename fixes the issue.
2022-02-16 14:40:14 +01:00
3f0e63fcca Merge branch 'blender-v3.1-release' 2022-02-16 11:16:22 +01:00
54972123f7 Fix Image GPU texture.
Due to recent changes there have been reports of incorrect loading of
GPU textures. This fix reverts a part of {D13238} that might be the
source of the issue.
2022-02-16 10:45:46 +01:00
86762e8371 Merge branch 'blender-v3.1-release' 2022-02-16 08:41:40 +01:00
232d5d3f13 Fix T95787: Texture paint: Apply Camera Image crash for certain images
This does not happen with **any** image, but with images that have ID
properties.

ID properties are used to store view projection matrices (e.g. for
reprojection with `Image from View` or `Quick Edit` -- these are the
ones we are interested in), but of course they can be used for anything
else, too. The images in the file from the report have ID properties from
an Addon for example.

So the crash can reliably be reproduced with **any** image doing the
following:
```
bpy.data.images['myImage']['myIDprop'] = "foo"
```
This would lead code in `texture_paint_camera_project_exec` to think the
needed `view_data` is on the image (but in reality it was just some
other IDprop).

Solution is simple: just check `view_data` is really valid after getting
it from the IDprops.

Maniphest Tasks: T95787

Differential Revision: https://developer.blender.org/D14116
2022-02-16 08:35:15 +01:00
18d18b5a98 UV: move sticky selection from image space into tool settings
Having this setting stored in the image space caused low level selection
logic to have to pass around the image space (which could be NULL
in some cases). Use the tool-settings instead since there doesn't seem
to be much/any advantage in having this setting per-space.
2022-02-16 13:46:00 +11:00
a0ad8c57ef License headers: use SPDX identifiers 2022-02-16 13:04:20 +11:00
81223ae164 Cleanup: spelling in comments 2022-02-16 13:04:20 +11:00
37821143dd Cleanup: clang-format, use static sets, sort struct declarations 2022-02-16 13:04:20 +11:00
d3b1cce400 GPUTexture: Add dimensions getter
Pretty straight forward. Returns the texture dimensions count. This is
different from the size.
2022-02-15 22:20:49 +01:00
cbdd578640 Fix: Build error in debug build
Error in a9f023e226
2022-02-15 13:57:17 -06:00
e272bdc171 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-15 20:41:39 +01:00
53fe4f62fe Fix T95806: subdivision missing in Cycles when using autosmooth
Although rB56407432a6a did fix missing subdivision in some cases, in
other cases it did not return the mesh wrapper (like when using
autosmooth, which requires a copy of the mesh), so the non-subdivided
mesh was still returned.
2022-02-15 20:40:58 +01:00
4782713390 Fix T94994: Anim Player Stops working In Video Sequence Editor
Port from upstream: variable was unitialized when device initialization
failed when the WASAPI mixing thread is started.
2022-02-15 20:04:42 +01:00
1efb8e215e Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-15 17:53:51 +01:00
48b26d9c2e Fix T95697: GPU subdivision ignores custom normals
Similarly to the CPU subdivision, we interpolate custom loop normals
from the coarse mesh, and this for the final normals.
2022-02-15 17:53:22 +01:00
430ced76d5 GPU subdiv: fix custom data interpolation for N-gons
Not all coarse vertices were used to compute the center value (off by
one), and the interpolation for the current would always start at the
base corner for the base face instead of the base corner for the current
patch.
2022-02-15 17:53:12 +01:00
a9f023e226 BLI: Change dependencies in vector math files
This patch reverses the dependency between `BLI_math_vec_types.hh` and
`BLI_math_vector.hh`. Now the higher level `blender::math` functions
depend on the header that defines the types they work with, rather than
the other way around.

The initial goal was to allow defining an `enable_if` in the types header
and using it in the math header. But I also think this operations to types
dependency is more natural anyway.

This required changing the includes some files used from the type
header to the math implementation header. I took that change a bit
further removing the C vector math header from the C++ header;
I think that helps to make the transition between the two systems
clearer.

Differential Revision: https://developer.blender.org/D14112
2022-02-15 10:27:03 -06:00
3ed3ee253b Cleanup: Rename file used for calculating mesh edges
This commit renames `mesh_validate.cc` to `mesh_calc_edges.cc`.
I would like to move `mesh_validate.c` to C++, but it makes sense to
keep this specific algorithm in a smaller file.
2022-02-15 09:29:22 -06:00
Michael
b22db23aee Define CLANG_FORMAT_VERSION in install_deps.sh
When running `./blender/build_files/build_environment/install_deps.sh` on Ubuntu 20.04.3 LTS the following error can be seen:
```
./blender/build_files/build_environment/install_deps.sh: line 1266: [: too many arguments
```
This error results from the call:
```
  check_package_version_ge_DEB $CLANG_FORMAT $CLANG_FORMAT_VERSION
```
with `CLANG_FORMAT_VERSION` being undefined.
Also as `clang-format` 13 is already released and hopefully didn't break anything `CLANG_FORMAT_VERSION_MEX` could use version bump.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D13924
2022-02-15 14:12:21 +01:00
07032dd218 Curves: add initial sculpt mode
This adds a new sculpt mode to the experimental new curves object.
Currently, this mode can only be entered and exited, nothing else.
The main initial purpose of this node will be to use it for hair grooming.

The patch also adds the `editors/curves/` directory for the new curves
object, which will be necessary for many other things as well.

I added a completely new mode (`OB_MODE_SCULPT_CURVES`), because
`OB_MODE_SCULPT` seems to be rather specific to meshes, and reusing
it doesn't seem worth the trouble. The tools/brushes used in mesh vs.
curves sculpt mode are quite distinct as well.

I had to add DNA_userdef_enums.h to make the patch compile with C++
(forward declaration of enums isn't allowed). This follows the same
pattern that we use for other enums in dna.

Differential Revision: https://developer.blender.org/D14107
2022-02-15 12:32:15 +01:00
07ed869b94 RNA: add RNA_collection_is_empty & RNA_property_collection_is_empty
Some collections needed to be iterated over to count their length.
Provide a function to check if the collection is empty to avoid this.
2022-02-15 20:13:00 +11:00
4637e83990 Merge branch 'blender-v3.1-release' 2022-02-15 19:51:43 +11:00
597edd299f Merge branch 'blender-v3.1-release' 2022-02-15 19:51:40 +11:00
92a3732ff1 Fix T95791: Unable to switch between multiviews.
Root cause is copy pasting buggy code.
2022-02-15 19:51:30 +11:00
7083ea36e2 Fix T94085: Crash with empty stroke list 2022-02-15 19:49:02 +11:00
d1c7a252eb Fix T95791: Unable to switch between multiviews.
Root cause is copy pasting buggy code.
2022-02-15 09:41:10 +01:00
14dd207b75 License headers: use SPDX for remaining files in Cycles 2022-02-15 17:52:38 +11:00
88b6e5571e License headers: use SPDX for remaining CMake find modules & gtests 2022-02-15 17:45:39 +11:00
fcac0b6fea Fix playing image-sequences with frames containing 9 or more numbers
The path calculation method for animation players: frame-cycler, rv &
mplayer would fail when the number of digits exceeded the range of a
32bit int causing RenderData.frame_path() to raise a ValueError.

Use a simpler method of extracting the range that uses the sign to
detect the beginning of the number.
2022-02-15 17:21:21 +11:00
fa7bd4c069 Cleanup: move utility to create a frame path into a static method
Add PlayRenderedAnim._frame_path_with_number_char since mixing
this logic inline made the code harder to follow.
2022-02-15 17:16:26 +11:00
c146d75808 readme.html: replace IRC with blender.chat, fix typo
- Replace IRC links and channels with blender.chat ones.
- Fix mismatch in text vs link of "GIT and Bug Tracker".
- http -> https for blender links
2022-02-15 11:09:40 +05:30
14d98d0388 CMake: create readme.html with configure_file
Since the output file stays unmodified for most developer builds,
install step installed it redundantly.

Create readme.html using `configure_file`:
- Now it's modified only if final output changes (handled by CMake).
- If input file (from git) or blender version changes,
  it //will// be modified.

Also don't re-implement what CMake can do.

Reviewed By: campbellbarton, LazyDodo
Differential Revision: https://developer.blender.org/D13863
2022-02-15 10:14:35 +05:30
9d01358a68 Cleanup: unused argument warnings 2022-02-15 13:04:31 +11:00
e3a18a890d Cleanup: minor changes to Python argument parsing loop
- Increment the argument index at the end of the loop.
  Otherwise using the index after incrementing required subtracting 1.
- Move error prefix creation into a function: `pyrna_func_error_prefix`
  so it's possible to create an error prefix without duplicate code.

This simplifies further changes for argument parsing from D14047.
2022-02-15 12:57:59 +11:00
a9a05d5597 Merge branch 'blender-v3.1-release' 2022-02-15 01:05:47 +01:00
facd9d8268 Cleanup: clang-format 2022-02-15 01:05:25 +01:00
3d1e978257 Merge branch 'blender-v3.1-release' 2022-02-14 18:01:52 -06:00
1f7f7ca14e Fix T95720: Spreadsheet missing volume grid info
The cell drawing code in 474adc6f88 was missing an
implementation for virtual arrays of strings.
2022-02-14 18:00:45 -06:00
d7d827789b GLShaderInterface: Fix undefined behavior when attributes are optimized away.
Optimized out attributes returns an invalid location `-1` resulting in
an undefined behavior shift.
2022-02-15 00:48:18 +01:00
89b47c1214 Merge branch 'blender-v3.1-release' 2022-02-15 00:11:23 +01:00
302c74e596 GLCompute: Apply state before dispatch 2022-02-15 00:10:50 +01:00
b744081f83 GLDebug: Fix severity check
The check was reversed, leading to less errors being reported.
2022-02-15 00:02:31 +01:00
19b21563d6 GPUTexture: Fix missing enum cases in to_component_len()
This might have caused undersized buffer if using the wrong formats with
`GPU_texture_read()`.
2022-02-15 00:01:04 +01:00
ad1f8a50b0 Cleanup: Use C++ math functions
Use functions from the `math` and `std` namespaces instead
of from `BLI_math_vector.h`.
2022-02-14 15:48:46 -06:00
761274fc19 Merge branch 'blender-v3.1-release' 2022-02-14 12:35:33 -06:00
33d5ecd5b5 Fix T95252: Move duplicate node doesn't do edge-panning
Set "view2d_edge_pan" to true for the NODE_OT_translate_attach operator,
which is used by the duplication operator. This is done in the keymap so
that it's not hard-coded.

Differential Revision: https://developer.blender.org/D13934
2022-02-14 12:34:54 -06:00
7773393d35 Cleanup: Pass const Scene to mesh evaluation 2022-02-14 12:05:54 -06:00
e26194e80d Merge branch 'blender-v3.1-release' 2022-02-14 18:31:19 +01:00
6ae08da5c8 Fix T95756: Crash inserting geometry node after linking modifier
The root issue was caused by a mistake in modifier copy data which was
wrongly re-generating source modifier data identifier.

The c8cca88851 simply exposed a bug in code which always was there
since the modifiers session UUID was introduced.

Shows an importance of const qualifier :)
2022-02-14 18:19:13 +01:00
19403fc852 Merge branch 'blender-v3.1-release' 2022-02-14 17:48:52 +01:00
a5edff4b73 Fix T95778, the macOS minimum versions have been increased for Metal. 2022-02-14 17:47:35 +01:00
d8e2f612ec Cleaunp: Modify comment 2022-02-14 16:39:06 +01:00
56407432a6 Fix T94479: GPU Subdivision surface modifier does not apply to Cycles renders
Since now we delegate the evaluation of the last subsurf modifier in the stack
to the draw code, Cycles does not get a subdivided mesh anymore. This is because
the subdivision wrapper for generating a CPU side subdivision is never created
as it is only ever created via `BKE_object_get_evaluated_mesh` which Cycles does
not call (rather, it accesses the Mesh either via `object.data()`, or via
`object.to_mesh()`).

This ensures that a subdivision wrapper is created when accessing the object data
or converting an Object to a Mesh via the RNA/Python API.

Reviewed by: brecht

Differential Revision: https://developer.blender.org/D14048
2022-02-14 16:36:32 +01:00
3b14224881 GPencil: Fill Dilate using negative values contract the fill area
This is requested by artist for some animation styles where is necessary to fill the area, but create a gap between fill and stroke.

Also some code cleanup and fix a bug in dilate for top area.

Reviewed By: pepeland, mendio

Differential Revision: https://developer.blender.org/D14082
2022-02-14 16:30:09 +01:00
0999a01b03 Fix T95320: CacheFile templates crash when used through Python
The crash is caused as we did not check that the RNA pointer is null
before trying to use it. This moves the existing checks from the
modifier panels into the template functions so the logic is a bit
centralized.
2022-02-14 16:13:25 +01:00
65d4c58060 Fix Cycles assert in debug mode after recent changes
We sometimes call start() on already started renders, just do nothing then.

Ref D14086
2022-02-14 15:45:11 +01:00
15141ec19a Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-14 14:49:11 +01:00
993839ce85 Fix T95177: GPU subdiv crashes mirror modifier in edit-mode
The issue has two causes: on one hand origin indices were not handled
properly, on the other hand the extraction type (Mesh, BMesh, or mapped)
was not detected correctly.

For the second case reuse the MeshRenderData creation from the coarse
code path so that we make the same decisions. Loose geometry extraction
had to be updated to properly handle the BMesh cases.

For the origin indices, in some cases (for edges and faces), the arrays
used by the subdivision code already have the origin indices baked into
them, so mapping them a second time through the origin index layer is
wrong, and could cause out of bounds accesses.

For vertices especially, we would use two arrays: one for mapping
subdivision vertices to coarse vertices, and another one to map coarse
vertices to subdivision loops used for the selection index buffer. The
second one is now removed (which saves a bit of memory) as it is did not
have the proper data setup for use with the origin indices and we can
easily compute it using the first array anyway.
2022-02-14 14:48:44 +01:00
06a492cfdc Fix (studio reported) crash in new resync code.
We do not always resync/replace the root ID of a hierarchy now that we
do partial resync.
2022-02-14 13:26:42 +01:00
c32d3a175d Merge branch 'blender-v3.1-release' 2022-02-14 12:07:59 +01:00
3a9a37d6dc Fix T95601: Missing handling of keyingsets ID pointers in lib_query/foreach_id code.
This will have to be backported to 2.93 and possibly 2.83 if possible.
2022-02-14 12:05:11 +01:00
777953f36b Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-14 11:09:34 +01:00
e0fd31f083 Fix segfault calling id_properties_ui("prop").update()
Fix segfault when calling `some_id.id_properties_ui("propname").update()`,
i.e. call the `update()` function without any keyword arguments. In such
a case, Python passes `kwargs = NULL`, but `PyDict_Contains()` is not
`NULL`-safe.
2022-02-14 11:08:53 +01:00
48e2bf3638 Merge branch 'blender-v3.1-release' 2022-02-14 11:00:30 +01:00
1236d2aea8 Cleanup use c style comments. 2022-02-14 10:58:45 +01:00
d23cf42ba7 Fix T95725: Changing render slot doesn't update displayed image.
Fixed by checking the requested pass, layer and view against the
previous used one.
2022-02-14 10:54:21 +01:00
ab71d833c7 Phase out IMA_GPU_REFRESH.
IMA_GPU_REFRESH is replaced by
BKE_image_partial_update_mark_full_update and should not be used
anymore.
2022-02-14 10:33:56 +01:00
efac4db166 Merge branch 'blender-v3.1-release' 2022-02-14 09:42:03 +01:00
f0e32ef4ff Fix T95699: Compostior backdrop not updated.
The Viewer marked the gpu texture to be out of date. But it should have used
the mark_full_update as the gpu textures
are only used by the render/draw engines.

The image/node editor uses the image engine that have its own GPU textures.
2022-02-14 09:21:05 +01:00
f663a1dc09 Image Engine: Remove region_uv_bounds.
They have been replaced by clipping_uv_bounds. Using region_uv_bounds
could lead to problems when drawing the compositor backdrop.
2022-02-14 09:21:04 +01:00
fe9b3dd5f9 Image Engine: Limit the number of interal textures.
Currently one a single texture slot is used to update the screen.
Current design is implemented to use multiple textures.
for now limit the number of texture slots to 1.
2022-02-14 09:21:04 +01:00
08882ddfc2 Merge branch 'blender-v3.1-release' 2022-02-14 09:09:37 +01:00
33dde170ce Fix T95749: missing update when normal node changes
This node is a bit of a weird case, because it uses the value stored in an
output socket as an input. So when we want to determine if the Dot
changed, we also have to check if the Normal output changed.

A cleaner solution would be to refactor this by either storing the normal
on the node directly (instead of in an output socket), or by exposing it
by a separate input. This refactor should be done separately though.
2022-02-14 09:08:54 +01:00
31be5ce8b9 GNUmakefile: update arguments for 'doc_man' target
Add '--verbose' argument to the script so the destination is printed.
Otherwise there is no hint to where the man page was written.
2022-02-14 16:20:16 +11:00
47b783bbe9 GNUmakefile: remove package targets that no longer exist 2022-02-14 16:12:14 +11:00
963ca15ba4 GNUmakefile: don't echo output for checking utilities & docs
When running checkers, showing commands to activate them adds noise.
2022-02-14 16:09:05 +11:00
0fd66b4f07 GNUmakefile: use PYTHON variable instead of python3
Also update the Python3 binary on macOS.
2022-02-14 16:04:31 +11:00
7d5f6c330f Cleanup: Clang tidy
Use using instead of typedef, remove redundant string init,
use "empty", address qualified auto, use nullptr.
2022-02-13 13:15:53 -06:00
7413c2feed Cleanup: Optimize gl query code path
Currently whenever gl queries are performed for the viewport, a large
1024 byte array is allocated to store the query results (256 of them).

Unfortunately, if any gizmo using a `draw_select` callback is active
(e.g. the transform gizmos), these queries (and allocations) will occur
during every mouse move event.

Change the vector to allow for up to 16 query results before making an
allocation. This provides enough space for every built-in gizmo except
Scale Cage (which needs 27 queries). It also removes unnecessary
allocations from two other related vectors used during query processing.

Differential Revision: https://developer.blender.org/D13784
2022-02-12 21:52:24 -08:00
52be063012 Fix (unreported): Issues with 'SNAP_NOT_SELECTED' for pose and edit modes
This is a regression partially introduced in rB0a6f428be7f0.

Bones being transformed into edit mode were snapping to themselves.

And the bones of the pose mode weren't even snapping.

(Curious that this was not reported).
2022-02-12 16:13:28 -03:00
824f514f8f Fix T94860: GPencil - Avoid drift in Sculpt when mouse/pen is not moved
This fix avoid the drif checking if the previous position is equals to new one, in this case, the pen has not moved and can be canceled.

Differential Revision: https://developer.blender.org/D13870
2022-02-12 10:50:39 +01:00
cf6546863e Merge branch 'blender-v3.1-release' 2022-02-11 20:57:18 -05:00
517afcc858 Fix T91423: View Animation not working with stereoscopic animations
The animation playback did not take into account individual stereoscopic views.

This patch fixes this by playing back the active view render.

Reviewed By: campbellbarton

Maniphest Tasks: T91423

Differential Revision: https://developer.blender.org/D14070
2022-02-11 20:56:51 -05:00
35c261dfcf Merge branch 'blender-v3.1-release' 2022-02-11 23:58:41 +01:00
27d3140b13 Cycles: Fix Metal kernel compilation for AMD GPUs
Workaround for a compilation issue preventing kernels compiling for AMD GPUs: Avoid problematic use of templates on Metal by making `gpu_parallel_active_index_array` a wrapper macro, and moving `blocksize` to be a macro parameter.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14081
2022-02-11 22:52:48 +00:00
Stefan Werner
f3c58c6505 Cycles: Removed redundant/buggy code in multiscatter BSDF
A zero length vector was normalized and the resulting NaN used in further calculations.
This caused trouble on some compilers when using fast math.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D14058
2022-02-11 22:41:17 +01:00
ad53cb0b9d Merge branch 'blender-v3.1-release' 2022-02-11 19:44:27 +01:00
40fce61a6a Cycles: enable Metal on AMD GPUs, set macOS minimum versions
* Apple Silicon support enabled on macOS 12.2+
* AMD support enabled on macOS 12.3+

This patch also fixes a device enumeration crash on certain AMD configs which
was caused by over-release of MTLDevice objects.

Differential Revision: https://developer.blender.org/D14090
2022-02-11 19:22:16 +01:00
Leon Schittek
ed4b032155 UI: Improve node drop shadow
Improve the nodes' drop shadow by making it scale with the view
and replace the loop for the alpha calculation with something more
explicit.

The amount of drop shadow softness was scaled with the zoom level
and therefore had a fixed screen space size. DPI and UI scale
weren't taken into account either. This patch fixes both issues by
basing the shadow softness on the `widget_unit` that scales correctly
in zoomable views and takes UI scale etc. into account.

Differential Revision: https://developer.blender.org/D13356
2022-02-11 11:52:56 -06:00
c070e0864c Fix missing license file from last commit 2022-02-11 18:08:32 +01:00
8fb2926a53 Cycles: show Metal device in preferences also on Intel Macs
In anticipation of enabling AMD Metal support.

Ref D14090, T92212
2022-02-11 17:51:55 +01:00
9cfc7967dd Cycles: use SPDX license headers
* Replace license text in headers with SPDX identifiers.
* Remove specific license info from outdated readme.txt, instead leave details
  to the source files.
* Add list of SPDX license identifiers used, and corresponding license texts.
* Update copyright dates while we're at it.

Ref D14069, T95597
2022-02-11 17:47:34 +01:00
7434b83948 Fix (studio-reported) liboverrides potential infinite loop in hierarchy root doversion.
Drivers make it way too easy to create dependenciy loops between IDs, so
need to use the same trick as in other dependency-following code in this
file to prevent those infinite loops.

hard to predict for sure how bad of a hierarchy root this can end up
producing, but in general cases think this should be OK.
2022-02-11 16:12:28 +01:00
41ef1ac2da Merge branch 'blender-v3.1-release' 2022-02-11 15:36:05 +01:00
9ac1735205 Fix Cycles compilation on 32bit ARM platform
The rbit instruction is only available starting with ARMv6T2 and
the register prefix is different from what AARCH64 uses.

Separate the 32 and 64 bit ARM branches, add missing ISA checks.

Made sure the code works as intended on macMini with Apple silicon,
and on Raspberry Pi 4 B running 32bit Raspbian OS.

Differential Revision: https://developer.blender.org/D14056
2022-02-11 15:27:29 +01:00
Bastien Montagne
1695d38989 LibOverride: Add partial resync.
Reduce compute effort of liboverrides resync process by only re-syncing
the parts of the override hierarchy that actually need it.

The main change compared to existing code (which was systematically resyncing
a whole override hierarchy), is that resyncing now operates over several
sub-hierarchies at once, each defined by their own 'resync root' ID.
This ensures that we do not get several new overrides for the same data inside
of the same hierarchy.

Implements T95682.

Differential Revision: https://developer.blender.org/D14079
2022-02-11 15:18:32 +01:00
e6f3bb984b Merge branch 'blender-v3.1-release' 2022-02-11 14:55:42 +01:00
Jeroen Bakker
a71a513def Remap multiple items in referenced data.
This patch increases the performance when remapping data.
{D13615} introduced a mechanism to remap multiple items in a single go.
This patch uses the same mechanism when remapping data inside ID datablocks.

Benchmark results when loading the village scene of sprite fright on AMD Ryzen 7 3800X 8-Core Processor
Before this patch 115 seconds
When patch applied less than 43 seconds

There is still some room for improvement by porting relink code.

Reviewed By: mont29

Maniphest Tasks: T95279

Differential Revision: https://developer.blender.org/D14043
2022-02-11 14:53:33 +01:00
811cbb6c0a Helper functions for IDRemapper.
Adds helper functions to debug IDRemapper data structure.

`BKE_id_remapper_result_string` converst a given IDRemapperApplyResult
to a readable form for logging purposes.
`BKE_id_remapper_print` prints out the rules inside a IDRemapper struct.
2022-02-11 14:49:47 +01:00
f691d4553b Docs: add license text files for all SPDX identifiers 2022-02-11 14:48:32 +01:00
6ec83afb1d Cycles: refactor to keep session thread alive for duration of session
Instead of creating and destroying threads when starting and stopping renders,
keep a single thread alive for the duration of the session. This makes it so all
display driver OpenGL resource allocation and destruction can happen in the same
thread.

This was implemented as part of trying to solve another bug, but it did not
help. Still I prefer this behavior, to eliminate potential future issues wit
graphics drivers or with future Cycles display driver implementations.

Differential Revision: https://developer.blender.org/D14086
2022-02-11 14:35:10 +01:00
e2728a0056 Fix T95420: Cycles crash with stereo render and tiles
For reasons unclear, destroying and then recreating a vertex buffer in the
render OpenGL context is affecting the immediate mode vertex buffer in the
draw manager OpenGL context.

Instead just create a single vertex buffer and use it for the lifetime of
the render OpenGL context. There's not really any need to have a separate
one per tile as far as I can tell.

Differential Revision: https://developer.blender.org/D14084
2022-02-11 14:35:10 +01:00
6175c569f9 Tests: enable full Cycles Metal device regression tests on buildbot
Now that all tests are passing. This does add about 5 minutes to the macOS
builds on buildbot.

Ref T92212
2022-02-11 14:35:10 +01:00
fcec55796e Cycles: support rendering attributes for Curves objects
This adds support for exporting attributes from a Blender Curves object to Cycles.
The implementation follows that of the Mesh object. This also creates motion blur
data if the "velocity" attribute is present on the Curves.

Ref T94193

Reviewed By: brecht

Maniphest Tasks: T94193

Differential Revision: https://developer.blender.org/D14088
2022-02-11 13:49:00 +01:00
cc6ddfbf68 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-11 13:48:09 +01:00
2496a94384 Fix T95698: deadlock with GPU subdivision
Multithreaded tasks have to be isolated when holding a mutex, which was
missing for the generation of the subdivision wrapper.
2022-02-11 13:45:12 +01:00
a816eaa1ce Cleanup: add descriptions to the IDRemapperApplyOptions. 2022-02-11 12:54:49 +01:00
2d231f837a Merge branch 'blender-v3.1-release' 2022-02-11 20:51:27 +09:00
675f38aca7 Fix excessive re-creation of VR viewport textures
Due to the freeing and re-creation of textures performed when binding
offscreen viewports, VR viewport textures would be needlessly
re-created every drawing iteration, leading to a negative impact on VR
frame rate.

This was brought to light by 6738ecb64e, which introduced an
additional texture clear operation on initialization and was
prohibitively costly on some systems when performed every frame.

Now, the textures for VR viewports will not be always re-created
during offscreen binding, but only when necessary using a pre-drawing
step (`wm_xr_session_surface_offscreen_ensure()`).

Reviewed By: jbakker, fclem

Differential Revision: https://developer.blender.org/D14059
2022-02-11 20:46:55 +09:00
2cad80cbc4 Fix incompatible swapchain format for Quest 2
When using a RGBA16 (`GL_RGBA16`, `DXGI_FORMAT_R16G16B16A16_UNORM`)
swapchain format with Quest 2, no image is presented to the headset.
This can occur when using the SteamVR runtime with an AMD graphics card
(ex. T95374).

Workaround is to move this format after the Quest 2-compatible RGBA16F
formats in the candidates list so that the RGBA16F formats are chosen
instead.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D14024
2022-02-11 20:46:38 +09:00
4fbd00e04c Fix T94268: Closing SteamVR and restarting VR Session crashes Blender
Crash was caused since the function pointers
`s_xrGetOpenGLGraphicsRequirementsKHR_fn`/
`s_xrGetD3D11GraphicsRequirementsKHR_fn` were static and were not
updated with the correct proc address after being set the first time.

As stated in the OpenXR spec: "function pointers returned by
xrGetInstanceProcAddr using one XrInstance may not be valid when used
with objects related to a different XrInstance".

Although it would seem reasonable that the proc address would not
change if the instance was the same (hence the `static XrInstance s_instance;`),
in testing, repeated calls to `xrGetInstanceProcAddress()`
with the same instance still can result in changes (at least for the
SteamVR runtime) so the workaround is to simply set the function pointers
every time, essentially trivializing their `static` designations.

Reviewed By: Severin

Maniphest Tasks: T94268

Differential Revision: https://developer.blender.org/D14023
2022-02-11 20:46:26 +09:00
fd98241cb8 Merge branch 'blender-v3.1-release' 2022-02-11 12:26:33 +01:00
b38f40e904 Geometry Nodes: show indicator when realize instances node is in legacy mode
For the majority of node groups created in Blender 3.0 the behavior does not change.
So far we only found a single file where this setting has an effect.

Differential Revision: https://developer.blender.org/D14078
2022-02-11 12:24:07 +01:00
f19585656f Fix compile warnings.
We should change the API of ntree so we can check with a const. I added
this as a todo for now and used a const cast.
2022-02-11 10:28:59 +01:00
Jeroen Bakker
bccdb143db Refactoring of BKE_library_id_can_use_idtype to use filter_id.
For an upcoming project we would want to match multiple id types in a
single go. To not replicate the implementation using other types we
introduce `BKE_library_id_can_use_filter_id` that returns all supported
types as a filter.

Not all ID types have a filter_id (ID_LI, ID_KE, ID_SCR) These
exceptions are not available in the filter_id function.

Reviewed By: mont29

Maniphest Tasks: T95279

Differential Revision: https://developer.blender.org/D14061
2022-02-11 08:24:33 +01:00
9118cdfff3 File headers: use SPDX license for key-maps 2022-02-11 16:55:49 +11:00
cec0c65c0f License: add GPL-3.0-or-later identifier
Some add-ons use this.
2022-02-11 16:27:17 +11:00
fe55789b6f File headers: manually convert files to use SPDX headers
Also add BSD-2-Clause to SPDX license list.
2022-02-11 15:15:49 +11:00
281ba8a063 File headers: add missing copyright, add MIT to SPDX licenses 2022-02-11 14:56:03 +11:00
f7bbec290d File headers: add license to Python scripts 2022-02-11 14:30:21 +11:00
1df8a5f8fb File headers: use SPDX license for CMake files 2022-02-11 14:23:56 +11:00
9802d50c6b File headers: use SPDX for Zlib license 2022-02-11 14:23:55 +11:00
bff0cf1030 Cleanup: remove white-space before headers 2022-02-11 14:23:54 +11:00
7946f34d64 GNUmakefile: add check_licenses target
This reports files that don't include SPDX headers.
Optionally showing unique headers which is useful to see
irregular/nonstandard headers.
2022-02-11 14:22:27 +11:00
0247dcde65 Cleanup: Remove unused mesh mask definitions
Maintaining and understanding these can be a burden,
so the fewer we have, the better. These particular masks
haven't been used for years.
2022-02-10 21:03:59 -06:00
467c16eab1 Remove New from new obj exporter menu. 2022-02-10 19:32:30 -05:00
355dc28f72 Merge branch 'blender-v3.1-release' 2022-02-10 19:24:43 -05:00
4d29ec42bc Revert "Split Python OBJ importer and exporter, enabling only the importer."
This reverts commit ff9dc1986e.
2022-02-10 19:21:32 -05:00
0263c8238b Remove 'New' from new Obj exporter menu entry. 2022-02-10 19:00:40 -05:00
f39698de77 Revert "Split Python OBJ importer and exporter, enabling only the importer."
This reverts commit ff9dc1986e.
2022-02-10 18:29:29 -05:00
c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00
1a705fa139 Cleanup: clang-format 2022-02-11 09:14:35 +11:00
2cc4747443 Cleanup: Clang tidy
Mismatched parameter names and else after return.
2022-02-10 15:53:37 -06:00
40e8b9775d Fix: Missing changes in recent "Curves" rename
More missing changes in fe1816f67f. This will hopefully fix a
Python API docs build error, and fixes the "Object Types Visibility"
popover.
2022-02-10 15:51:26 -06:00
75bcc096a1 License: add Apache-2.0 to doc/license
Include this as it's used the source/ directory.
2022-02-11 08:50:46 +11:00
Henrik Dick
6804ab2381 Merge branch 'blender-v3.1-release' 2022-02-10 22:39:38 +01:00
Henrik Dick
39bac58cdf Fix: Enable edge bevel weight in solidify if needed
Complex Solidify creates edge bevel weights on the rim if the
according vertex has some vertex bevel weight. If there are no
edge bevel weights, they were left disabled even if vertex bevel
weights are used.
2022-02-10 22:29:10 +01:00
Henrik Dick
5cac5a1a69 Fix: Bevel vertex didn't use weights in some cases
Bevel Vertices did not use vertex/bevel weights if the Width Type
was set to Width or Depth.
2022-02-10 22:14:02 +01:00
516781da80 Fix: Incorrect size used for reading curves data
Copy and paste mistake in fe1816f67f
2022-02-10 11:45:15 -06:00
29674d5e78 Merge branch 'blender-v3.1-release' 2022-02-10 11:34:20 -06:00
88ff5e5fb9 Fix T95458: Line art ignores curve objects with no evaluated mesh
Some curve objects don't have an evaluated mesh at all, but line art
currently assumes that all curve objects have one before converting
it to a mesh internally. Fix this by checking if the curve object has an
evaluated mesh before skipping it.

The remaining problem is that evalauted from non-mesh objects or
evaluated curves from non-curve objects, etc. will be ignored if
"Allow Duplicates" is off. That's a different problem though.

Differential Revision: https://developer.blender.org/D14036
2022-02-10 11:33:36 -06:00
a44366a642 Cycles: Expose "Use MetalRT" checkbox
For curve-heavy scenes, memory consumption regressed when we switched from MetalRT to bvh2. Allow users to opt in to MetalRT to workaround this.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14071
2022-02-10 17:32:46 +00:00
35dedc11d5 Fix T95477: Report error instead of crashing when Metal texture size limits exceeded.
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14074
2022-02-10 17:06:29 +00:00
3d12dd59ce Cycles: Workaround for failing "bake" unit tests in Metal
Allocate "RenderBuffers" with MTLResourceStorageModeShared.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14073
2022-02-10 17:05:13 +00:00
410e4e7ce1 Workaround for T94142: Cycles Metal crash with simultaneous viewport and final render
Disable binary archives on Apple Silicon (issue stems from instancing multiple PSOs from the same binary archive). Pipeline creation still filters through the OS shader cache, mitigating any impact on setup times after the initial render.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14072
2022-02-10 17:04:08 +00:00
25c4000796 Fix T95613: remove anonymous attributes when converting object
This is the same behavior as when applying a geometry nodes modifier
that adds anonymous attributes.
2022-02-10 18:03:37 +01:00
22c60ac8b1 Cleanup: Remove defenition for unused flag 2022-02-10 11:00:47 -06:00
7682d7de04 Refactor: Move PBVH update tag out of MVert
This is part of the project of converting `MVert` into `float3`.
(more details in T93602), The pbvh update flag is removed and
replaced with a bitmap stored in the PBVH structure. This
patch is similar to D13878. This is mainly setup for an eventual
performance improvement by removing the extra data from
mesh vertices, but if it's consistent with testing in the other patch
doing the same thing for another "temp tag", then it may actually
increase the speed of sculpt code slightly, since less memory needs
to be loaded when checking/changing the flags.

Differential Revision: https://developer.blender.org/D14000
2022-02-10 10:59:20 -06:00
2cd1472f86 Merge branch 'blender-v3.1-release' 2022-02-10 17:32:16 +01:00
720d653b41 Fix T95624: video texture not refreshing when changing offset in node
The main issue is that the image and image user is not updated correctly
in `rna_ImageUser_update`. `BKE_image_user_frame_calc` does not set the
correct frame, because the image is null. Also `IMA_GPU_REFRESH` is not
set for the same reason.

When gpu materials are first created, it is expected that the frame is set
correctly, and the flag is set if necessary. Therefore, somewhere during
depsgraph evaluation, those have to be updated. The depsgraph node
to do the update existed already. Now there is a new relation so that it is
executed when the node tree changed, not only when the frame changed.
2022-02-10 17:31:25 +01:00
9a2b206639 Minor cleanup: Use ID_IS_LINKED. 2022-02-10 17:30:07 +01:00
64dd6877aa Merge branch 'blender-v3.1-release' 2022-02-10 10:25:20 -06:00
c0674aa145 Fix T95334: Crash with no vertex normals in multires bake
This is partially caused by a stupid mistake in cfa53e0fbe
where I missed initializing the `vert_normals` pointer in
`MResolvePixelData`. It's also caused by questionable assumptions
from DerivedMesh code that vertex normals would be valid.

The fix used here is to create a temporary mesh with the data necessary
to compute vertex normals, and ensure them here. This is used because
normal calculation is only implemented for `Mesh` and edit mesh, not
`DerivedMesh`. While this might not be great for performance, it's
potentially aligned with future refactoring of this code to remove
`DerivedMesh` completely. Since this is one of the last places the data
structure is used, that would be a great improvement.

Differential Revision: https://developer.blender.org/D13960
2022-02-10 10:10:45 -06:00
d5a88f9bf4 Fix (unreported) over-resync from RNA detection code in linked cases.
While applying liboverrides on linked data, RNA code (in
`rna_property_override_check_resync`) would detect a lot of false positive
regarding IDs needing resync, because the temporary ID used to apply
overrides was always local, breaking the libraries comparison check.

NOTE: that whole 'apply liboverrides' code could use some refreshment,
it did not change much from initila version several years ago, we now
have better tools and control over non-main data.

But for now the 'trick' in that commit should do the job, ultimately
those temps IDs should never be put in Main at all.
2022-02-10 16:58:22 +01:00
ad77b52abc Correction to previous Clang strict warning commit
Need to only pop diagnostic if it was really pushed.

Pointed out by Aras Pranckevicius, thanks!
2022-02-10 16:05:11 +01:00
b73c265974 Merge branch 'blender-v3.1-release' 2022-02-10 16:04:50 +01:00
94f0230230 Fix T95666: Crash when attempting multires linear subdivide
The crash was happening when the mesh had loose edges.

Loose edges are not part of OpenSubdiv topology and hence should not be
communicated to the refiner. Pass ta boolean flag indicating whether an
edge is loose or not in the mesh foreach routines, which seems to be
the easiest way.
2022-02-10 15:51:19 +01:00
e9c9a2183d LibOverride: Fix/improve handling of hierarchy root in tagged creation.
Decouple the reference (linked) root ID and the hierarchy (override) root ID.
Previous code was assuming that the reference ID was always also tagged
for override creation, which is true in current master, but cannot be
assumed in general (and won't be true with partial resync anymore).

Also add asserts to validate conditions that the reference/hierarchy_root
variables must meet.
2022-02-10 14:55:12 +01:00
d16e5babaf Merge branch 'blender-v3.1-release' 2022-02-10 14:12:35 +01:00
04d55038ee Fix size_t -> int -> size_t round trip in Cycles
There are two things achieved by this change:

- No possible downcast of size_t to int when calculating motion steps.
- Disambiguate call to `min()` which was for some reason considered
  ambiguous on 32bit platforms `min(int, unsigned int)`.
- Do the same for the `max()` call to keep them symmetrical.

On an implementation side the `min()` is defined for a fixed width
integer type to disambiguate uint from size_t on 32bit platforms,
and yet be able to use it for 32bit operands on 64bit platforms without
upcast.

This ended up in a bit bigger change as the conditional compile-in of
functions is easiest if the functions is templated. Making the functions
templated required to remove the other source of ambiguity which is
`algorithm.h` which was pulling min/max from std.

Now it is the `math.h` which is the source of truth for min/max.
It was only one place which was relying on `algorithm.h` for these
functions, hence the choice of `math.h` as the safest and least
intrusive.

Fixes 32bit platforms (such as i386) in Debian package build system.

Differential Revision: https://developer.blender.org/D14062
2022-02-10 12:39:41 +01:00
87d2de88fd Fix T95664: missing update after changing active output node 2022-02-10 12:07:48 +01:00
e2befa425a GPencil: Update-on-write using update cache
This implements the update cache described in T95401.

The cache is currently only used for drawing strokes and
sculpting (using the push brush).
**Note: Making use of the cache throughout grease pencil will
have to be done incrementally in other patches. **

The update cache stores what elements have changed in the
original data-block since the last time the eval object
was updated. Additionally, the update cache can store multiple
updates to the data and minimizes the number of elements
that need to be copied.

Elements can be tagged using `BKE_gpencil_tag_full_update` and
`BKE_gpencil_tag_light_update`. A full update means that the element
itself will be copied but also all of the content inside. E.g. when a
layer is tagged for a full update, the layer, all the frames inside the
layer and all the strokes inside the frames will be copied.
A light update means that only the properties of the element are copied
without any of the content. E.g. if a layer is tagged with a light
update, it will copy the layer name, opacity, transform, etc.

When the update cache is in use (e.g. elements have been tagged) then
the depsgraph will not trigger a copy-on-write, but an update-on-write.
This means that the update cache will be used to determine what elements
have changed and then only those elements will be copied over to the
eval object.

If the update cache is empty or the data block was tagged with a full
update, we always fall back to a copy-on-write.

Currently, the update cache is only used by the active depsgraph. This
is because we need to free the update cache after an update-on-write so
it's reset and we need to make sure it is not freed or read by other
depsgraphs.

Co-authored-by: @yann-lty
This patch was contributed by The SPA Studios.

Reviewed By: sergey, antoniov, #dependency_graph, pepeland, mendio

Maniphest Tasks: T95401

Differential Revision: https://developer.blender.org/D13984
2022-02-10 11:35:56 +01:00
84f30ac3a2 Deps: upgrade OpenXR 1.0.17 -> 1.0.22
Simple upgrade of OpenXR to 1.0.22, following the steps from
https://wiki.blender.org/wiki/Source/OpenXR_SDK_Dependency and
rBb69ab42982a1. No changes to Blender code were necessary, only a version
bump.

The primary motivation for this upgrade is to utilize the
`XR_HTCX_vive_tracker_interaction` extension introduced in ver. 1.0.20.
However, the latest release (1.0.22) also adds a number of potentially
useful extensions such as:
- `XR_FB_render_model`
- `XR_HTC_facial_expression`
- `XR_HTC_vive_focus3_controller_interaction`

Ref T95206

Reviewed By: LazyDodo, sybren, mont29

Maniphest Tasks: T95206

Differential Revision: https://developer.blender.org/D13950
2022-02-10 19:15:29 +09:00
Brad Clark
26740aaf51 Fix T84486: NLA, disable "Sync Length" after split
Turn off "Sync Length" when splitting an NLA strip.

The NLA Strip-Action Clip has a setting called "Sync Length" that is on
by default and helps to update the length of the clip to the current
actions keyframes so the strip shows the entire actions stored
animation.

When you split one of these strip-action clips in the NLA to trim it
shorter or to move it somewhere else in the NLA tracks to blend or work
with, the "Sync Length" setting stays checked on.  You can have many
strips in the NLA that all look to the same action, if you split one
strip , you now have two strips showing or linked to the same action.

To see or edit keyframes on a strip, you enter tweak mode. When you exit
tweak mode, if "Sync Length" is active on the strip-action clip
settings, the strip length is changed/reset to match the action keys.
When you have many clips, this causes all of them to evaluate and update
no matter where they are in the NLA.  This destroys/undoes all the user
work to trim down and place the clips in the NLA.

**Description of the proposed solution:**

This patch/change would turn off, the "Sync Length" setting when the
split tool was used on a strip/action clip to help protect the users
choice to trim and keep the clip that length. It doesn't change the
ability to turn the setting back on or off, it just makes sure that the
user doesn't accidentally or unknowingly loose work.

The same process happens when an action is created that has a "manual
range" set that is different than the length of the actions start-end
keyframes. It makes sense to do the same thing for the split tool.

**Alternative solutions:**

While the user could know this and turn off this setting by hand, it is
easy to forget and or the user might think that it only happened to the
one clip they were editing and not realize it happened to all the
trimmed versions, changing the users choice without the user knowing it
happened.

**Limitations of the proposed solution:**

It only fixes the split tool, if another tool was created and some how
impacted the clip length we would need to have that tool also take the
sync length into account.

Reviewed By: sybren

Maniphest Tasks: T84486

Differential Revision: https://developer.blender.org/D10168
2022-02-10 11:08:00 +01:00
9e9355190c Fix compilation with strict Clang flags
There is no `-Wformat-truncation` warning in Clang, so tweak checks
around diagnostics pragma accordingly.
2022-02-10 10:55:50 +01:00
8c18b16829 Merge branch 'blender-v3.1-release' 2022-02-10 10:48:06 +01:00
5312cf50a1 Fix strict warning initializing texture result in compositor
From a strict language point of view the code required a braces around
`trgba` initialization. But it is easier to rely on the fact that fields
which are not specified are zero-initialized.
2022-02-10 10:46:06 +01:00
507a4deef1 Fix invalid creation of partial image updater 2022-02-10 10:42:25 +01:00
e6ad11f06d Cleanup: quiet warnings including RE_pipeline.h directly 2022-02-10 16:45:54 +11:00
c824c06f38 Cleanup: Clang tidy, unused variabel warnings 2022-02-09 23:07:48 -06:00
2887df119c Fix: Complete curves renaming missed in previous commit
This made cycles not render curves. Missed in fe1816f67f
2022-02-09 17:56:19 -06:00
fe80ff446f Cleanup: copyright in headers, spelling in comments
- Order year consistently.
- Minor consistency (case, double-spacing).
- Correct typos.
2022-02-10 10:25:06 +11:00
58761eb11a GNUmakefile: move editor settings to .editorconfig
Remove inline vim/emacs editor configuration,
add makefile to editorconfig instead.
2022-02-10 09:20:34 +11:00
7b0174ef81 Cleanup: remove overly detailed contact info, correct md5 copyright
Also remove copyright text with no assignment.
2022-02-10 09:05:40 +11:00
e420514892 Merge branch 'blender-v3.1-release' 2022-02-09 11:06:34 -06:00
d1202bd641 Fix T95620: Crash When Entering Edit Mode on a Curve
Under some circumstances, simply adding a curve object and going
to edit mode would cause a crash. This is because the evaluated
`CurveEval` was accessed but also freed by the dependency graph.

The fix reverts the part of b76918717d that uses the
`CurveEval` for the curve object bounds. While this isn't ideal,
it was the previous behavior, and some unexpected behavior
with object bounds is much better than a crash. Plus, given the plans
of using the new "Curves" data-block for evaluated curves, this
situation will change relatively soon anyway.
2022-02-09 11:06:10 -06:00
6e14be858c Merge branch 'blender-v3.1-release' 2022-02-09 16:16:34 +01:00
c69ee218d7 Revert "Fix size_t -> int -> size_t round trip in Cycles"
This reverts commit d74bb7be19.

Need to re-iterate to have a proper support of all platforms.
2022-02-09 16:16:21 +01:00
3e67831d3f VSE: Fix sound strip not aligned with movie strip
Strip aligning wasn't done when length of 2 strip is equal, but since
these strips are aligned according to position in stream this can
produce offset.
2022-02-09 16:06:56 +01:00
e098a29606 Merge branch 'blender-v3.1-release' 2022-02-09 15:54:41 +01:00
7313a84c5a Fix T95612: only overwrite existing attributes with matching domain and type
Also fixes T95611 and T95610.

Differential Revision: https://developer.blender.org/D14051
2022-02-09 15:50:03 +01:00
669d3bbad6 Merge branch 'blender-v3.1-release' 2022-02-09 14:46:00 +01:00
d74bb7be19 Fix size_t -> int -> size_t round trip in Cycles
There are two things achieved by this change:

- No possible downcast of size_t to int when calculating motion steps.
- Disambiguate call to min() which was for some reason considered
  ambiguous on 32bit platforms `min(int, unsigned int)`.

On an implementation side the `min()` is defined for a fixed width
integer type to disambiguate uint from size_t on 32bit platforms,
and yet be able to use it for 32bit operands on 64bit platforms without
upcast.

Fixes 32bit platforms (such as i386) in Debian package build system.

Differential Revision: https://developer.blender.org/D13992
2022-02-09 14:45:39 +01:00
3577ccc9c0 Cleanup: Add newline in error message.
Increases readability during debugging.
2022-02-09 14:09:04 +01:00
6345032a49 Cleanup: non-standard license formatting, minor changes 2022-02-09 23:57:12 +11:00
312d6925c4 Cleanup: make file headers more consistent
Also some descriptive text into doc-strings.
2022-02-09 23:47:34 +11:00
b4700a13c6 VSE: Use float for transformation offset
When image position is animated, float makes movement look smoother.
2022-02-09 13:42:58 +01:00
7c10e364b2 BLI: wrap parallel_invoke from tbb 2022-02-09 13:08:04 +01:00
3f061ef050 Merge branch 'blender-v3.1-release' 2022-02-09 12:38:08 +01:00
d82384f7e1 Fix T95640: missing null check in previous commit 2022-02-09 12:36:49 +01:00
312c8fdaf9 Cleanup: Better naming in lib_remap.
Renames is_never_null to violates_never_null.
2022-02-09 11:44:14 +01:00
Alaska
fd6506626b Adjust "Show Backface" tool tip to be more accurate
Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13849
2022-02-09 11:28:39 +01:00
Alaska
d3d9e2abbf Fix small grammatical mistake in Refraction Depth tooltip
Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D13850
2022-02-09 11:26:21 +01:00
bfacb22a93 Merge branch 'blender-v3.1-release' 2022-02-09 11:20:51 +01:00
06ac599261 Fix T91840: do not create invalid links when inserting a node
Differential Revision: https://developer.blender.org/D14050
2022-02-09 11:19:23 +01:00
Colin Basnett
6f01758b47 Added a "Sharpen Less" kernel for the Filter Compositor node
Added a new "Sharpen Less" kernel to the filter compositor node. The intent here is to provide a much less aggressive sharpening filter that can't simply be solved by toning down the factor on the existing sharpen filter.

The existing "Sharpen" filter uses a "box" kernel:

```
-1 -1 -1
-1  9 -1
-1 -1 -1
```

The new "Sharpen Less" filter uses a "diamond" kernel:

```
 0 -1  0
-1  5 -1
 0 -1  0
```

The difference between the two is clear to see in the following side-by-side:

{F12847431}

Below shows the difference between the filtering kernels as applied to a B&W render of Suzanne with the UV grid as a texture. The left side of the render using the existing "Sharpen" filter, and the right side showing the new "Sharpen Less" filter. Notice that the left side is more aggressive in accentuating localized contrasts across the image. This can lead to what appears to be aliasing or striations in the resulting image:

{F12847429}

https://developer.blender.org/T95275
https://blender.community/c/rightclickselect/57Kq/?sorting=hot
{F12847428}

Reviewed By: #compositing, jbakker

Differential Revision: https://developer.blender.org/D14019
2022-02-09 10:28:00 +01:00
81da638c44 Cleanup: move file descriptions into doxygen file section
Continuation of 19100aa57d.
2022-02-09 18:33:29 +11:00
19100aa57d Cleanup: move file descriptions into doxygen file section
Also other minor corrections & reformat particle system copyright.
2022-02-09 18:10:43 +11:00
2c7f2a0ba4 Cleanup: simplify copyright headers for sequence & imbuf 2022-02-09 16:47:15 +11:00
68a21697be Cleanup: remove "The Original Code is: ..." from code comments
This is almost always meaningless as most code has changed
since the comment was added. Besides this, version control can be used
to check if/when a file was modified.

Some cases of this were kept when they contain details
about the original copyright holder.
2022-02-09 16:04:31 +11:00
59a7095f79 Cleanup: use consistent copyright location, move descriptions
Order copyright immediately after the license block,
this was done almost everywhere with a few exceptions.

Remove authors from a few files (we had already removed "Contributors"
section however with old patches being applied this gets added back in).

Also move descriptive text into the doxygen comment block under \file.
In some cases remove the text as it was accidentally copied.
2022-02-09 16:00:16 +11:00
Shrey Aggarwal
f021d46752 Cleanup: GHOST_ISystem::toggleConsole API
GHOST_ISystem::toggleConsole had a somewhat misleading name
it could be fed 4 different values, so it was not as much a
toggle as a set console window state.

This change renames `toggleConsole` to a more appropriately
named `setConsoleWindowState` and replaces the integer it had
to an enum so it's easy to tell what is being asked of it at
the call site.

Reviewed By: LazyDodo
Differential Revision: https://developer.blender.org/D14020
2022-02-08 17:40:48 -07:00
Paolo Acampora
452a7f6731 Fix T91871: Symmetrize Armature on custom bone shape
Symmetrize Armature now also symmetrizes the transform of custom bone
shapes.

Adds a new property to `bpy.ops.armature.symmetrize`:

//Parameters//:

- **direction **(enum in ['NEGATIVE_X', 'POSITIVE_X'], (optional)) –
  **Direction**, Which sides to copy from and to (when both are selected)

- **custom_shape **(enum in ['SYMMETRIZE_SAME', 'SYMMETRIZE_ALL',
  'SYMMETRIZE_NONE'], (optional)) – **Custom Shapes**, Wether to
  symmetrize non symmetric custom bone shapes, all custom shapes, or
  none at all

//Rationale//:

Reviewed By: #animation_rigging, Mets, sybren

Maniphest Tasks: T91871

Differential Revision: https://developer.blender.org/D13416
2022-02-08 18:09:48 +01:00
55c90df316 BLF: Enable Filtering of woff and woff2 Fonts
Add files with extension ".woff" and ".woff2" to FILE_TYPE_FTFONT
file type. Allows selecting and using these types of font files.

See D13822 for more details.

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

Reviewed by Campbell Barton
2022-02-08 08:43:01 -08:00
5d9d2565d2 Cleanup: simplify DNA genfile casting
Avoid using the uint64_t as an intermediate cast since it complicates
behavior for signed types (which first need to be cast to an int64_t).

Assign both old_value_i & old_value_f from the original value to avoid
the need for different handling of signed/unsigned types.

Reviewed By: JacquesLucke

Ref D14039
2022-02-08 22:52:46 +11:00
460d1a4cb3 Eevee: support the no-op Bump node optimization like in Cycles.
A Bump node without a Height input is meaningless and does nothing.
As such, it is available as an old workaround that allows making Node
Group inputs that default to normal when not connected, by routing
via a no-op Bump node before doing math.

Cycles specifically recognizes this use case and either bypasses
the node, or converts it into a Geometry Normal node, but Eevee
was still evaluating it as usual. That incurred performance cost,
and also normalized the vector unlike Cycles.

This implements the same bypass logic for Eevee. Since I'm not
sure if it's possible to totally remove the node at this stage,
it emits a no-op function call to copy the input vector.

Differential Revision: https://developer.blender.org/D14045
2022-02-08 14:37:25 +03:00
3267c91b4d Fix T91253: Slow pose bone selection with many bones
Viewport cull bones during selection to avoid depth-picking
reading the depth buffer for bones that aren't in the viewport.

Files with thousands of bones could hang blender for seconds while
selecting. The issue could still happen with overlapping bones or when
zoomed out so all bones are under the cursor, however in practice this
rarely happens.

Now files with many bones select quickly.

Related changes include:

- Split `BKE_pchan_minmax` out of `BKE_pose_minmax`.
- Add `mat3_to_size_max_axis` to return the length of the largest
  axis (used for scaling the radius).

Reviewed By: sybren

Maniphest Tasks: T91253

Ref D13990
2022-02-08 22:16:51 +11:00
530be35516 Merge branch 'blender-v3.1-release' 2022-02-08 12:13:24 +01:00
de71860555 Fix T95570: missing task isolation when computing normals 2022-02-08 12:12:49 +01:00
923ccf6b10 LibOverride: Use new 'hierarchy root' info in relevant override code.
This new info simplifies greatly the handling of resync and deleting
liboverride hierarchies, and makes those operations more robust to
complex dependencies cases between different hierarchies.

Related to T95283.
2022-02-08 11:22:56 +01:00
98c242affd LibOverride: Add 'hierarchy root ID' info.
This change will make handling of liboverrides hierarchies (especially
resyncing) much easier and efficient. It should also make it more
resilient to 'degenerate' cases, and allow proper support of things like
parenting an override to another override of the same linked data (e.g.
a override character parented to another override of the same
character).

NOTE: this commit only implements minimal changes to add that data and
generate it for existing files on load. Actual refactor of resync code
to take advantage of this new info will happen separately.
2022-02-08 10:51:31 +01:00
32278b79a8 LibOverride: Add 'hierarchy root ID' info.
This change will make handling of liboverrides hierarchies (especially
resyncing) much easier and efficient. It should also make it more
resilient to 'degenerate' cases, and allow proper support of things like
parenting an override to another override of the same linked data (e.g.
a override character parented to another override of the same
character).

NOTE: this commit only implements minimal changes to add that data and
generate it for existing files on load. Actual refactor of resync code
to take advantage of this new info will happen separately.
2022-02-08 10:50:39 +01:00
0617efd51b Merge branch 'blender-v3.1-release' 2022-02-08 10:26:42 +01:00
1995aae6e3 Fix T94415: Nodes: poor selection behavior inside frame nodes
Previously, node selection made no distinction between a frame node and
other nodes. So a frame node would be selected by their whole rect or
center (depending on box/lasso/circle select). As a consequence of this,
box and lasso could not pratically be started inside a frame node (with
the intention to select a subset of contained child nodes) because the
frame would be selected immediately and tweak-transforming started.
Circle selecting would always contain the frame node as well (making
transforming a subset of nodes without also transforming the whole frame
impossible).

Now change selection behavior so that for all selection modes only the
border [the margin area that is automatically added around all nodes,
see note below] of a frame node is considered in selection. This makes
for a much more intuitive experience when arranging nodes inside frames.

note: to make the area of interest for selection/moving more obvious,
the cursor changes when hovering over (as is done for resizing).
note: this also makes the resize margin consistent with other nodes.
note: this also fixes right resize border (was exclusive instead of
inclusive as every other border)

Also fixes T46540.
2022-02-08 10:14:14 +01:00
67c12ed765 Cleanup: remove useless statement.
Layouts are active by default when created, no need to set this
explicitely. Leftover from proxy removal.
2022-02-08 09:16:49 +01:00
8abd8865d2 Mesh: add option to select vertices by similar vertex crease
This adds an option to the "Select Similar" operator in edit mode to
select vertices based on vertex crease similarity. The implementation
follows that of the edge crease, with a 1-dimensional KD-tree used to
store and retrieve vertex indices base on crease values.

To maintain compatibility with old files (scripts), the `SIMEDGE_CREASE`
enumeration identifier remains `CREASE`, while the one for the new
`SIMVERT_CREASE` is `VCREASE` to follow the naming convention of other
enum values.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D14037
2022-02-08 06:10:22 +01:00
Dominik Fill
7047bd41c6 UI: Change computation of node socket position to align with label
This Diff changes the computation of the input and output socket
position to being always aligned with its corresponding label.

Reviewed By: campbellbarton

Ref D14025
2022-02-08 14:55:02 +11:00
667b4bc0e4 Cleanup: clang-format 2022-02-08 14:25:31 +11:00
9d674d9852 Fix dna_genfile error converting signed int types to floating point
Regression in 51befa4108
caused negative values to overflow into a uint64_t.

Resolve by casting to a signed int from originally signed types.

This caused D14033 not to work properly.
2022-02-08 11:54:44 +11:00
7df651367f Cleanup: use an intermediate value for cast_primitive_type
Assign the actual value before casting to large uint64_t/double types.

This improves readability, especially in cases where both pointer
and integer casts were used in one expression, to make matters worse
clang-format treated these casts as a multiplication.

This also made debugging/printing the values more of a hassle.

No functional changes (GCC produced identical output).
2022-02-08 11:54:44 +11:00
e5fc579073 Merge branch 'blender-v3.1-release' 2022-02-07 18:42:58 -06:00
b76918717d Fix T95573: Incorrect bounding box of evaluated curve
Account for `CurveEval`, which stores the proper deformed and
procedurally created data, unlike the `nurb` list, which has always
just meant a copy of the original curve.

Also account for the case when the curve is empty by using a -1, 1,
fallback bounding box in that case, just like mesh objects.
2022-02-07 18:42:31 -06:00
770793e545 Merge branch 'blender-v3.1-release' 2022-02-07 16:11:21 -06:00
Wannes Malfait
229d0ace02 Fix T95532: Merge node deletes everything for empty selections
The problem was that nullptr was returned which is a valid value for
Mesh * and hence the returned optional was treated as having some value.
There was no check for point clouds so that was fixed as well.

Differential Revision: https://developer.blender.org/D14026
2022-02-07 16:08:36 -06:00
11d785edea Fix T95502: macOS app has both python 3.9 and 3.10 executables 2022-02-07 20:51:03 +01:00
674e4640f6 Merge branch 'blender-v3.1-release' 2022-02-07 14:29:26 -05:00
Myles Walcott
880e85fc80 Cleanup: Grammar in doc/python_api
* Its -> It's
* Scripts -> Script's
* then -> than

Several phrasing grammar fixes.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D14021
2022-02-07 14:28:12 -05:00
fe1816f67f Curves: Rename "Hair" types, variables, and functions to "Curves"
Based on discussions from T95355 and T94193, the plan is to use
the name "Curves" to describe the data-block container for multiple
curves. Eventually this will replace the existing "Curve" data-block.
However, it will be a while before the curve data-block can be replaced
so in order to distinguish the two curve types in the UI, "Hair Curves"
will be used, but eventually changed back to "Curves".

This patch renames "hair-related" files, functions, types, and variable
names to this convention. A deep rename is preferred to keep code
consistent and to avoid any "hair" terminology from leaking, since the
new data-block is meant for all curve types, not just hair use cases.

The downside of this naming is that the difference between "Curve"
and "Curves" has become important. That was considered during
design discussons and deemed acceptable, especially given the
non-permanent nature of the somewhat common conflict.

Some points of interest:
- All DNA compatibility is lost, just like rBf59767ff9729.
- I renamed `ID_HA` to `ID_CV` so there is no complete mismatch.
- `hair_curves` is used where necessary to distinguish from the
  existing "curves" plural.
- I didn't rename any of the cycles/rendering code function names,
  since that is also used by the old hair particle system.

Differential Revision: https://developer.blender.org/D14007
2022-02-07 11:56:48 -06:00
b8c764c5d1 Merge branch 'blender-v3.1-release' 2022-02-07 18:45:24 +01:00
65d287a14a Fix T95543: incorrect handling of implicit field inputs in ui 2022-02-07 18:44:30 +01:00
d3e9d74a5f Merge branch 'blender-v3.1-release' 2022-02-07 18:17:29 +01:00
eb071e3d3c Fix: missing null check
This fixes https://github.com/JacquesLucke/animation_nodes/issues/1827.
2022-02-07 18:16:35 +01:00
2f7aecb6ce Merge branch 'blender-v3.1-release' 2022-02-07 17:57:01 +01:00
2f868e5647 Fix T95578: missing update when linking selected nodes
This removes a "narrow" update in `snode_autoconnect` in favor
of the more general update in `node_make_link_exec`.
2022-02-07 17:56:25 +01:00
Charlie Jolly
fe4e85a924 Nodes: Dynamic node class for Map Range node
This patch makes it possible to set the UI color of a node's
header bar and override the default from the node's typeinfo.

Currently the color is taken from the `.nclass`
member of the node's bNodeType->TypeInfo struct.
This is created once when registering the node.
The TypeInfo is used for both UI and non-UI functionality.
Since the TypeInfo is shared, the header bar for the node
can't be changed without changing all nodes of that type.

The Map Range node is shown as a `Converter` or blue color by default.
This patch allows this to be changed dynamically to `Vector` or purple.

This is done by adding a `ui_class` callback to node typeinfo struct.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13936
2022-02-07 15:39:39 +00:00
a7b5982030 Fix missing removal of proxy references in py scripts.
Reported by studio (Hjalti), thanks.
2022-02-07 16:23:26 +01:00
Shrey Aggarwal
a5dd1bc53d Fix T90868: Console window flash when exiting
If the console was hidden on windows, it would
be made visible during shutdown in an effort
not hide a potentially active interactive console
session. This however did not take in account
if blender was actually launched from an interactive
console causing the console window to briefly flash
during shutdown even when launched from the new
launcher, the brief flash concerned some users.

This change adjusts the behaviour to restore the
console only when blender was started from the
console.

Reviewed By: LazyDodo
Differential Revision: https://developer.blender.org/D14016
2022-02-07 08:20:12 -07:00
b3bb51dd83 Fix asset-view template ignoring "Asset Indexing" debug option
If the "Asset Indexing" option was disabled in Preferences > Experimental
> Debugging, the asset-view template (used by pose libraries for
example) would still use the indexing.
2022-02-07 12:18:15 +01:00
d9b1bd01f7 Merge branch 'blender-v3.1-release' 2022-02-07 11:13:06 +01:00
3cd686cae8 Fix UI messages (typos etc.). 2022-02-07 11:12:37 +01:00
Dimitry Kaplin
1c5f2e49b7 VSE: Add filter method to strip transform
Previously, nearest interpolation filter was used for preview, because
it offered good performance and bilinear was used for rendering. This
is not always desirable behavior, so filter method can now be chosen by
user. Chosen method will be used for preview and for rendering.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D12807
2022-02-07 10:41:26 +01:00
6766699530 UV: use grey on black for dashed-line display
Dashed line display was changed since 2.7x, using white on black
instead of grey on black.

This made selection difficult to see as white is brighter
than the default selected color.

Match the grey used in 2.7x.
2022-02-07 15:50:42 +11:00
2b14aa0a39 Cleanup: spelling in comments 2022-02-07 15:33:10 +11:00
7e6066c9c3 Cleanup: clang-format 2022-02-07 15:32:34 +11:00
Henrik Dick
94866ef84f Fix Bevel intersection continuity.
This patch from Henrik Dick improves the continuity between the
grid forming corners and the edge polyons on multisegment bevels.
For details, see patch D13867.
2022-02-06 16:01:57 -05:00
f199f03994 Merge branch 'blender-v3.1-release' 2022-02-06 15:00:21 -05:00
Aras Pranckevicius
1d59a7aa77 Fix T95384: new obj exporter inaccurate roughness value in new exporter.
Fixes T95384. New exporter was missing a fix for T94516 that recently got applied to the python exporter.

Also changed the obj export tests code so that when save_failing_test_output is requested and MTL result is different from the golden expectation, it is saved as well, similar to how it's done for the OBJ file result.
2022-02-06 14:53:07 -05:00
Aras Pranckevicius
9261bc9476 Further speedup of new obj exporter.
This change from Aras further parallelizes wihin large meshes (the previous one
just parallelized over objects).

Some stats: on A Windows machine, AMD Ryzen (32 threads):

(one mesh) Monkey subdivided to level 6: 4.9s -> 1.2s (blender 3.1 was 6.3s; 3.0 was 49.4s).
(one mesh) "Rungholt" minecraft level: 8.5s -> 2.9s (3.1 was 10.5s; 3.0 was 73.7s).
(lots of meshes) Blender 3 splash: 6.2s -> 5.2s (3.1 was 48.9s; 3.0 was 392.3s).

On a Linux machine (Threadripper, 48 threads, writing to SSD):
Monkey - 5.08s -> 1.18s (4.2x speedup)
Rungholt - 9.52s -> 3.22s (2.95x speedup)
Blender 3 splash - 5.91s -> 4.61s (1.28x speedup)

For details see patch D14028.
2022-02-06 14:28:22 -05:00
96cda4da28 GLDebug: Wrap glDispatch function into our debug wrappers 2022-02-06 17:03:05 +01:00
e440691e89 Merge branch 'blender-v3.1-release' 2022-02-06 12:39:56 +01:00
8be20fcc61 GPU: Fix assert when running without --debug-gpu option on older GL
This was caused by rB3a90f93507a344d2b6eb3ae631371348ff977047
2022-02-06 12:39:17 +01:00
48fbf0baea DRW: Add preprocessor error if including common_view_lib.glsl without draw_view
This avoid making include mistake and potentially detect areas that do
not really need common_view_lib.glsl.
2022-02-06 01:25:46 +01:00
085a3662dd GPUShaderCreateInfo: Add duplication error checking of dependency merging
As of now we do not allow additional infos duplication. We could in the future
but for now assert that this is not the case.
2022-02-06 01:25:46 +01:00
153f2c20b2 Merge branch 'blender-v3.1-release' 2022-02-05 17:52:31 -06:00
59a8bdd48c Fix: Displaying any point cloud in the viewport causes crash
Caused by rBf75449b5f2b04b79, which was missing a null check when
attempting to extract a `CustomData` pointer from an mesh that might
be null if the object isn't a mesh object. The commit added null checks
elsewhere, so simply adding them here is a straightforward fix.

Fixes T95526, T95539
2022-02-05 17:52:04 -06:00
94c0a59f95 Merge branch 'blender-v3.1-release'
Also fixed conflicts due to the change in file writing in the new obj exporter
in master, and fixed one of the tests that was added in master but not 3.1.
2022-02-05 18:04:30 -05:00
Aras Pranckevicius
c24b2cdebf Fix T95360, new 3.1 obj exporter losing nurbs curve "endpoint".
The new wavefront .obj exporter in 3.1 was producing slightly invalid parm line syntax (missing u), and was not setting first/last N params to zeroes and ones for curves with "endpoint" flag properly.
2022-02-05 17:51:03 -05:00
bfe6e792c7 Merge branch 'blender-v3.1-release' 2022-02-05 23:09:09 +01:00
3a90f93507 GPU: Debug: Avoid double printing of compilation issues
To avoid that, we simply filter using a debug group.
2022-02-05 23:08:49 +01:00
26b70fce8a GPU: move gpu_shader_shared_utils.h to the public section of the module
This is then easier to include in other modules.
2022-02-05 22:42:34 +01:00
2ee81bf285 Merge branch 'blender-v3.1-release' 2022-02-05 22:18:51 +01:00
f2087dfc69 GPUTexture: Fix missing/wrong cases in to_data_format() 2022-02-05 19:29:45 +01:00
edc0e77afe GPU: Enable CLOG for gpu when --debug-gpu option is set
This is because all of the debug printing is done through CLog now. Without
it the is little point in this option.
2022-02-05 19:27:21 +01:00
7bdfce687b GL: Fix compute shader label error 2022-02-05 19:27:09 +01:00
cbd23a7304 DRW: Fix memory leak in UniformArrayBuffer 2022-02-05 13:59:46 +01:00
e5af6a0d0f GLShaderInterface: Fix SSBO using the ubo mask
This might head lead to a crash when a shader uses both ubo and ssbo.
2022-02-05 13:28:41 +01:00
835dd95046 BLF: Cleanup blf_glyph_cache_find & blf_font_size
Removes unnecessary calls to blf_glyph_cache_find, simplifies
blf_font_size, and reduces calls to it. blf_glyph_cache_new
and blf_glyph_cache_find made static.

See D13374 for more details.

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

Reviewed by Campbell Barton
2022-02-04 18:32:32 -08:00
b1cee36190 BLF: Default Size as Float
Allowing setting and storing of the default font size as float.

See D13230 for more details.

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

Reviewed by Campbell Barton
2022-02-04 18:05:25 -08:00
141da5dc03 Partially pevert "Fix error in b1b1a74af15b4eaa0757ad88acfbcac73b9a64fe"
This partially reverts commit 81d2eda2bf.

That commit introduced unrelated changes.
2022-02-04 23:00:43 -03:00
fbd5b85456 BLF: Removal of blf_font_draw_ascii Declaration
Removal of declaration of unused blf_font_draw_ascii

See D13624 for more details.

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

Reviewed by Campbell Barton
2022-02-04 17:55:50 -08:00
bb3bcf744c BLF: Save fixed_width value in cache
Cache the font size's ideal fixed width column size in the glyph cache
rather than the font itself to improve performance.

See D13226 for more details.

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

Reviewed by Campbell Barton
2022-02-04 17:49:21 -08:00
2a967d444f BLF: blf_glyph_cache_free Made Static
blf_glyph_cache_free does not need to be public.

See D13395 for more details.

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

Reviewed by Campbell Barton
2022-02-04 17:37:23 -08:00
81d2eda2bf Fix error in b1b1a74af1
`op` --> `op->customdata`
2022-02-04 22:12:07 -03:00
b1b1a74af1 Cleanup: set 'op->customdata' out of 'viewops_data_create'
Setting the `op->customdata` out of `viewops_data_create` makes the usage of the function clearer thus making the code easier to read.
2022-02-04 20:38:53 -03:00
ec9f237a9e Cleanup: merge functions with similar usage
`viewops_data_alloc` allocates and stores some pointers in
`ViewOpsData` while `viewops_data_create` reuses already stored
pointers and also stores others in `ViewOpsData`.

The similar names and usages can confuse and in this case it also
creates a dependency on the order in which these functions are called.

Merging these functions simplifies usage and deduplicates code.
2022-02-04 20:16:36 -03:00
f79c8e25f1 Cleanup: Grammar in comments and tooltips
- "own" -> "its own"
- "it's" -> "its"
- Use proper plural
2022-02-04 14:52:52 -06:00
0b4cf2984f Fix: Remove incorrect assert in mesh modifier evaluation
Since we have a node that sets a mesh's auto smooth angle
(unfortunately, in retrospect), we generally can't assume at all
that value is the same as whatever input mesh. Similar asserts
were removed previously in 8216b759e9. While the attempt
at assertions to clarify assumptions is noble, this one doesn't
make sense anymore.

I found this while investigating T95479.

Differential Revision: https://developer.blender.org/D14009
2022-02-04 14:19:04 -06:00
a5be935966 Fix uninitialized value in Cycles BVH after recent changes
Found by asan, unknown if it actually caused an issue.
2022-02-04 20:27:49 +01:00
dc85776b8b GLShader: Fix several low importance issues
- Fix image.format conversion to string
- Fix warnings about ARB_conservative_depth not found even if GL > 4.2
- Add `array(type)` define for portable array definition
2022-02-04 20:21:41 +01:00
c017820692 GPUShader: Improve error/warning logging experience
Thanks to the new `ShaderCreateInfo` we now include source files without
any modification. This let us query which are the source files passed to the
`print_log` function. The log will now include a file with row and column
number which is interpreted as a link in most IDE.

DEBUG_CONTEXT_LINES will add more lines around the error lines for more
context. This is also useful if the error line is imprecise (because of
driver bugs) and the reported line is not sufficient to know the location
of the error.

The DEBUG_DEPENDENCIES option will display the list of included files in
the shader sources. Note that it will not print generated source.

This commit also fixes some issues with unhelpful logs, bogus row & column
numbers, other error format, and bug if row was 0.
2022-02-04 20:21:41 +01:00
671fb286ab GPUShader: Cleanup dependency system to not remove string allocation
Source files are now only referenced and listed for the driver to ingest.
Shader sources now includes generated data if any.
Also cleans up gpu_shader_dependency_get_builtins casts.
2022-02-04 20:21:41 +01:00
ae50527c23 GL: Add all image types in binding setup. 2022-02-04 20:21:41 +01:00
25c50ddd09 GPUFramebuffer: Bump max attachment count to 8
This is needed by eevee-rewrite
2022-02-04 20:21:41 +01:00
77d005ea36 GPUShaderCreateInfo: Merge changes from eevee-rewrite
This includes multiple commits:
- Fix crash when using std::cerr for error output
- Add auto_resource_location which overrides all resources location (not vert input)
- Improve codestyle of error reporting.
- Add type conversion to string and to `eGPUType`
- Add comparison operator (will be used for hash collision resolution).
- Add members related to generated code (codegen)
2022-02-04 20:21:41 +01:00
03fbb3de24 GPUState: Add more barrier types
This will be useful when compute shader will be used more.

Refer to the opengl documentation for their meaning.
https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glMemoryBarrier.xhtml
2022-02-04 20:21:41 +01:00
66e9ee1a2f Cleanup: Remove unused "init" node tree flag
The value of this flag was set, but not used anywhere.

Differential Revision: https://developer.blender.org/D13519
2022-02-04 12:51:03 -06:00
afc2cc393d Merge branch 'blender-v3.1-release' 2022-02-04 19:35:35 +01:00
260e6fd46b Workbench: Fix unreported heavily quantized mesh due to driver issue
Detected on `amdgpu-pro` libGL implementation. The workaround is to not
use explicit location for vertex attributes. This is not a real problem
as we don't rely on them for now.
2022-02-04 19:34:48 +01:00
0446c9c875 Fix: Incorrect default distance for merge by distance node
This was an oversight in the patch that added this node,
the default merge distance is meant to be the same as the weld
modifier, 0.001m, meaning by in most situations it removes
vertices generally at the same location.
2022-02-04 12:21:27 -06:00
b61cb67e6d Fix T94410: stopping Cycles render in 3D viewport quad view keeps using CPU
Only one of the four renders was being stopped.
2022-02-04 18:55:07 +01:00
a5e9f9b346 DRW: Fix a comment 2022-02-04 18:54:32 +01:00
4a1979b55d Cleanup: Overlay: Remove uneeded UBO binds 2022-02-04 18:54:32 +01:00
7b88a206b2 DRW: Add DRW_UNUSED_RESOURCE_TRACKING for ubo and ssbo
When uncommented, this option will make any call binding a resource that is
not present in the shader produce a warning message with its origin.
2022-02-04 18:54:32 +01:00
9aa25ff53d DRW: Add compute_ref calls, barriers calls, and vertex_buffer_ref
- Compute ref let the size of dispatch be modified just before drawing.
- Barrier call makes it possible to chain multiple compute passes in one pass.
- DRW_shgroup_vertex_buffer_ref is the analog of DRW_shgroup_uniform_block_ref.
2022-02-04 18:54:32 +01:00
665997f1cd DRW: Fix bug in cubemap creation in draw::Texture
The order of if clause made impossible to create a cubemap.
2022-02-04 18:54:32 +01:00
edb0e7ca30 Fix T95471: baking normals wrong after recent MVert normals refactor 2022-02-04 18:15:39 +01:00
0f40855a09 Fix T93851: Cycles wrong glossy indirect pass with volumes 2022-02-04 17:53:39 +01:00
b2f5540a02 Fix: Remove incorrect assert in mesh modifier evaluation
Since we have a node that sets a mesh's auto smooth angle
(unfortunately, in retrospect), we generally can't assume at all
that value is the same as whatever input mesh. Similar asserts
were removed previously in 8216b759e9. While the attempt
at assertions to clarify assumptions is noble, this one doesn't
make sense anymore.

I found this while investigating T95479.

Differential Revision: https://developer.blender.org/D14009
2022-02-04 10:32:21 -06:00
e7912dfa19 Attributes: Infrastructure for generic 8-bit integer data type
This commit adds infrastructure for 8 bit signed integer attributes.
This can be useful given the discussion in T94193, where we want to
store spline type, Bezier handle type, and other small enums as
attributes.

This is only exposed in the interface in the attribute lists, so it
shouldn't be an option in geometry nodes, at least for now.
I expect that this type won't be used directly very often, it
should mostly be cast to an enum type. However, with support
for 8 bit integers, it also makes sense to add things like mixing
implementations for consistency.

Differential Revision: https://developer.blender.org/D13721
2022-02-04 10:29:11 -06:00
b2e43a4a9d deps_builder: Update to freetype 2.11.1
Required to solve a crash on windows (T95367)

Mostly an uneventful update, except for FreeType
giving its cmake options a rename.

Reviewed By: brecht, sybren
Differential Revision: https://developer.blender.org/D13968
2022-02-04 09:19:10 -07:00
b4563ab2df Cleanup: avoid generating some functions in all translation units
Every translation unit that included the modified headers generated
some extra code, even though it was not used. This adds unnecessary
compile time overhead and is annoying when investigating the
generated assembly.
2022-02-04 17:18:56 +01:00
4aeb6add6e Guarded allocator: Document non-obvious initialization with MEM_new()
Initialization with `MEM_new()` depends a lot on the initialization rules
of C++, which are not obvious. Calling it with no arguments to be passed
to the constructor may cause the resulting object to be implicitly 0
initialized (or parts of it). This can have an impact on performance
sensitive code, so it's something to document.

Alternatively we could enforce default initialization (as opposed to the
value initalization that happens now), but this could cause
uninitialized memory in a way that isn't obvious either. This is a
possible source of bugs, so Jacques and I decided against it.
2022-02-04 16:57:46 +01:00
RedMser
150f42e6d3 NLA: shortcut to rename active strip
Use the global F2 rename panel for the NLA editor to rename NLA strips.

Reviewed By: sybren, RiggingDojo

Differential Revision: https://developer.blender.org/D12300
2022-02-04 16:39:00 +01:00
7331c86dbf macOS: support building blender-thumbnailer
It was missing framework flags added in `setup_platform_linker_flags`.
Keep it off until QuickLook Thumbnailing is implemented.

Differential Revision: https://developer.blender.org/D13997
2022-02-04 20:57:30 +05:30
b2abcea950 Merge branch 'blender-v3.1-release' 2022-02-04 15:54:37 +01:00
f75449b5f2 Fix T95467: Textures disappear when going to Edit Mesh on Solid Texture mode
The check for existence of custom data layers did not take wrapper nature of
mesh into account.

Quickest and safest for 3.1 solution is to take care of branching of checks
in the draw manager.

Ideally both wrapper and mesh access will happen via the same public API
without branching in the "user" code. That is something outside of the fix
for the coming release though.

Differential Revision: https://developer.blender.org/D14013
2022-02-04 15:54:25 +01:00
7b686970ef Merge branch 'blender-v3.1-release'
# Conflicts:
#	source/blender/draw/engines/workbench/workbench_effect_cavity.c
2022-02-04 15:40:29 +01:00
0b0f4829e1 Cleanup: Removed Object type specific 'make_local' callback.
This callback was only needed to allow specific handling of proxies, now
that theses have been removed the generic
`BKE_lib_id_make_local_generic` code works for objects as well.
2022-02-04 15:35:51 +01:00
2e766ff762 Image Editor: Fix slowdown with 8b colormanaged images.
Byte images are converted to float. Due to an issue how VSE cache is
freeing its images we cannot store these float buffers what leads
to recalculating it for each change in the image editor.

This fix will reduce the slowdown to areas that have the root cause of
the memory leak, so the buffers can be reused between refreshes.

NOTE: The root cause should still be fixed.

Thanks for reporting Sybren!
2022-02-04 15:32:28 +01:00
4eb10e414b Fix wrong use of region size without pixel-size applied
Didn't cause visible issues, because the layout uses spacers to
right-align text, which happens to use the region size with pixel-size
applied for calculations.
2022-02-04 15:29:52 +01:00
3d973d01fa View3D: move some of the early returns from operators to the poll function
Some navigation operators check flags like `RV3D_LOCK_ROTATION` in the
invoke function to see if the operation can be performed.

As the comment indicates, these checks should be in the poll function.

This avoids redundant initialization.

Note that this brings functional changes as now operators with context
`EXEC_DEFAULT`  will also be affected by the flag.
(There doesn't seem to be a problem with the current code).

Differential Revision: https://developer.blender.org/D14005
2022-02-04 11:21:20 -03:00
7099d5b661 Fix: Missing translations from operator descriptions
The strings in the `get_description` functions for operators need
translation, they are not found by the translation system automatically,
and there is no translation applied afterwards either (as far as I could
tell). Some used `N_` before, but most did nothing.

Differential Revision: https://developer.blender.org/D14011
2022-02-04 07:31:53 -06:00
623ff64a27 Fix T81541: Symmetrize Transform Constraint, Y rotational axis unexpected results
The case where Y rotation is mapped to Y rotation was not handled.
This is now fixed.

Also added an automated test to make sure that the symmetrize operator
functions as intended.

Reviewed By: Sybren

Differential Revision: http://developer.blender.org/D9214
2022-02-04 14:21:20 +01:00
0dd3e77d71 Cleanup: Workbench: Remove unused resources in cavity shaders
This avoid uneeded resource binds.
2022-02-04 14:08:27 +01:00
71fff31990 Fix T95427: Crash during dragging a link in a node editor
This was caused by macros interpreted as recursive. Workaround by
not using macros at all and just define local variables which
hopefully will be optimized.
2022-02-04 14:08:27 +01:00
e7b8871d3d Fix T95284 Workbench: "World" Cavity Type Doesn't Render Anything
This was caused by a faulty UBO bind (not updated after renaming).
2022-02-04 14:08:27 +01:00
3adcfbf63c Merge branch 'blender-v3.1-release' 2022-02-04 14:07:06 +01:00
080dd18cdf Fix T95427: Crash during dragging a link in a node editor
This was caused by macros interpreted as recursive. Workaround by
not using macros at all and just define local variables which
hopefully will be optimized.
2022-02-04 14:05:17 +01:00
8e0763827e Fix T95284 Workbench: "World" Cavity Type Doesn't Render Anything
This was caused by a faulty UBO bind (not updated after renaming).
2022-02-04 14:05:17 +01:00
cb986446e2 Fix Crash: Switching to wireframe mode.
Crash introduced by {rB0cb5eae}.

When switching to between drawing modes the region.draw_buffer could be
uninitialized when the gizmo depth test is performed. When the mouse is
placed on top of a gizmo part that could be highlighted would crash.

This fix adds a early exit when depth testing is requested, but there
isn't a draw_buffer. Not sure this is an root cause fix.

Reported by multiple animators in Blender Studio.
2022-02-04 14:00:06 +01:00
f9aab6717b Merge branch 'blender-v3.1-release' 2022-02-04 13:11:18 +01:00
b8a634cb1d Fix T95489: support writing to vertex groups with geometry nodes again
Technically, this can't be relied upon in the long term. It worked more or
less accidentally before. It was broken by a previous fix accidentally. I mainly
bring it back because rBa985f558a6eb16cd6f0 was not expected to have
this side effect.

Note, this change can result in slower performance. Writing to a vertex
groups is less efficient than using a generic attribute.
2022-02-04 13:10:02 +01:00
e6f9a72884 Cleanup: remove unused LOG declaration
No functional changes.
2022-02-04 11:26:06 +01:00
Aras Pranckevicius
a20cfb9eff BLI: use methods specialized for finding a single char in StringRef
Previously, these methods used the more generic substring-finding
algorithm, which is more complex and slower.

Using the more specialized methods results in a noticable speedup
in the obj importer (D13958).

Differential Revision: https://developer.blender.org/D14012
2022-02-04 10:38:05 +01:00
5088d907e5 Compositor: Backdrop mode changes node grid.
When viewing backdrop on top of the node grid, the grid would be
rendered black when the mode wasn't set to RGBA. This fix fixes this by
reverting the previous fix of drawing the backdrop and implement a
different one that recomputes the UV coordinates on the screen edges.
2022-02-04 09:51:25 +01:00
2d429bfdf8 Fix T93425: makesdna crashes during build with LTO on s390x Linux
DNAstr was assumed to be 4-byte aligned which is not necessarily
the case for byte-arrays.

Use a compiler attribute to ensure this is the case.

Thanks to @mtasaka for investigating and providing a patch.
2022-02-04 19:48:00 +11:00
Bastien Montagne
e9fc25835f Remove internal proxy code, and deprecate related DNA data.
Part of T91671.

Not much else to say, this is mainly a massive deletion of code.

Note that a few cleanups possible after this proxy removal were kept out
of this commit to try to reduce a bit its size.

Reviewed By: sergey, brecht

Maniphest Tasks: T91671

Differential Revision: https://developer.blender.org/D13995
2022-02-04 09:30:44 +01:00
5a4eadc2e7 Cleanup: spelling in comments
Also update viewport comments.
2022-02-04 16:07:24 +11:00
39a1b51efd Cleanup: cage3d gizmo used two margin scale values
Replace this with a single margin.
2022-02-04 15:41:31 +11:00
ef951825a5 Merge branch 'blender-v3.1-release' 2022-02-04 15:38:30 +11:00
lictex_
f7a6e8db04 Fix T88579: scale cage doesn't work well for small/large objects
Apply proper view scale for cage 3d's draw_select,
same as draw.

Reviewed By: campbellbarton

Ref D13956
2022-02-04 15:37:07 +11:00
7803312476 Cleanup: halve calls to BLI_str_utf8_size_safe in the text editor
Syntax highlighted text was calculating the utf8 character
size twice per character.
2022-02-04 14:02:53 +11:00
d730f79e0e Cleanup: use mono-space font drawing for single character display
This doesn't make a user visible difference since it's only used for
brackets at the moment, this is more for general correctness as the
width calculation for mono-spaced text drawing is different
(as it uses BLI_wcwidth).
2022-02-04 14:02:53 +11:00
28656293c6 Cleanup: Clang tidy, use braces
Braces missed in b73d3b80fd
2022-02-03 18:27:42 -06:00
3ddc39bec9 Merge branch 'blender-v3.1-release' 2022-02-04 11:17:49 +11:00
ef2685afea Fix assertion snapping to selected in mesh edit-mode
ED_transverts_create_from_obedit expected an evaluated object.

Add flag to request TX_VERT_USE_MAPLOC to be set, which avoids having to
calculate this data when it's not used as well as the requirement
that the input object be evaluated from the depsgraph.
2022-02-04 11:08:34 +11:00
b73d3b80fd Fix T94334: Area close operator crash in 3D view menu
This fixes the crash by removing the `do_view3d_header_buttons` handler.
The code can work at a higher level here, using the operator for setting
the select mode, which makes this patch a cleanup as well.

The operator now has a description callback to add the custom
description used for the behavior in its invoke method.

Differential Revision: https://developer.blender.org/D13660
2022-02-03 17:36:05 -06:00
af426c8508 Cleanup: Add file names back to node header
These were removed in rBbe3f3812dc4b, but it's preferred to keep them.
I had to do a bit of reorganizing, and I corrected the file type too.
2022-02-03 15:34:01 -06:00
3e0ffe5a39 Cleanup: Add comment about unsed custom data type
Since f59767ff97, these hair layer types are unused. Since DNA
compatibility was broken with any files that would contain them, the
indices can be reused to avoid growing custom data's typemap.
2022-02-03 14:35:51 -06:00
c832f4f7d1 Merge branch 'blender-v3.1-release' 2022-02-03 15:22:27 -05:00
a0c1306e8c Py Docs: Fix error is version switch
Slile parameter of 4 was looking for the language in the URL but the API docs do not have a language in the URL.
2022-02-03 15:21:44 -05:00
fd66733ca7 Merge branch 'blender-v3.1-release' 2022-02-03 15:06:31 -05:00
bda210d74a Py Docs: Fix json URL
In the future when we have a docs staging area it will be
important to change where this JSON is pulled from.
For now, always pull from the "Production" versions
2022-02-03 15:06:11 -05:00
56e5b4cc27 Merge branch 'blender-v3.1-release' 2022-02-03 14:38:26 -05:00
e7f74a7d6a Py Docs: Fix typo in previous commit
- Correct spacing
- Add missing comma
2022-02-03 14:37:55 -05:00
c4ffc3355f Merge branch 'blender-v3.1-release' 2022-02-03 14:25:57 -05:00
6a2fc3230f Py Docs: Implement version switch to switch between versions on the website
This commit adds a version switch similar to the one on the user manual,
in the future it would be nice to refactor both of these into a more generic
code that works for both. Maybe develop this into a sphinx extension.

As part of this change I had to change how the blender hash is displayed.
Instead of the version hash in the top left it has been moved to the page footer.

This change will also be backported to 2.93 LTS, 2.93 LTS, and 3.0.
2022-02-03 14:25:26 -05:00
c8dee942be Merge branch 'blender-v3.1-release' 2022-02-03 17:51:56 +01:00
f59767ff97 Curves: Changes to the new curves data-block
This patch refactors the "Hair" data-block, which will soon be renamed
to "Curves". The larger change is switching from an array of `HairCurve`
to find indices in the points array to simply storing an array of offsets.
Using a single integer instead of two halves the amount of memory for that
particular array.

Besides that, there are some other changes in this patch:
- Split the data-structure to a separate `CurveGeometry`
  DNA struct so it is usable for grease pencil too.
- Update naming to be more aligned with newer code and the style guide.
- Add direct access to some arrays in RNA
-- Radius is now retrieved as a regular attribute in Cycles.
-- `HairPoint` has been renamed to `CurvePoint`
-- `HairCurve` has been renamed to `CurveSlice`
- Add comments to the struct in DNA.

The next steps are renaming `Hair` -> `Curves`, and adding support
for other curve types: Bezier, Poly, and NURBS.

Ref T95355

Differential Revision: https://developer.blender.org/D13987
2022-02-03 10:49:51 -06:00
2f591adc1a Fix T95334: Crash with no vertex normals in multires bake
This is partially caused by a stupid mistake in cfa53e0fbe
where I missed initializing the `vert_normals` pointer in
`MResolvePixelData`. It's also caused by questionable assumptions
from DerivedMesh code that vertex normals would be valid.

The fix used here is to create a temporary mesh with the data necessary
to compute vertex normals, and ensure them here. This is used because
normal calculation is only implemented for `Mesh` and edit mesh, not
`DerivedMesh`. While this might not be great for performance, it's
potentially aligned with future refactoring of this code to remove
`DerivedMesh` completely. Since this is one of the last places the data
structure is used, that would be a great improvement.

Differential Revision: https://developer.blender.org/D13960
2022-02-03 10:35:50 -06:00
71cd9f9fbb Fix (unreported) broken logic in proxy to liboverride conversion.
Iterating over scene's objects while we modify those (through proxy to
override conversion code) is call for problems (use after free etc.).

Instead, all proxy objects need to be gathered first in a temporary
list, and processed all at once in a second loop.
2022-02-03 17:19:04 +01:00
7476eb761b Merge branch 'blender-v3.1-release' 2022-02-03 16:59:26 +01:00
4be87e97f4 Fix T94435: remove anonymous attributes when applying modifier
Differential Revision: https://developer.blender.org/D13994
2022-02-03 16:52:16 +01:00
bcded0a158 Merge branch 'blender-v3.1-release' 2022-02-03 15:38:51 +01:00
946c70e6a7 Fix (unreported) broken do_version of hidden layers from pre-2.8 files.
`BKE_collection_object_add` ensures given object is added to an editable
collection, and not e.g. a linked or override one.

However, some processes like do_version manipulate collections also from
libraries, i.e. linked collections, in those cases we need a version of
the code that unconditionnally adds the given object to the given
colleciton.
2022-02-03 15:37:05 +01:00
3bcbbf8992 Split Python OBJ importer and exporter, enabling only the importer.
This is from patch D13988. It removes the "- New" from the menu of the
new obj exporter, changes the default addon to just io_import_obj,
and does the right versioning thing.
Also disables the python tests for the old python exporter.
2022-02-03 09:30:55 -05:00
5920de9247 Merge branch 'blender-v3.1-release' 2022-02-03 14:54:39 +01:00
e4c179f1d8 Cleanup: clang-format 2022-02-03 14:54:03 +01:00
Sebastian Herholz
01f1b51a2e Fix T93565: revert Cycles to old normal behavior for point lights
This patch reverts the normal behavior of the spotlights. In the last fix,
the returned normal of a spot light was equal to its direction. This broke
some texturing methods used by artists.

Differential Revision: https://developer.blender.org/D13991
2022-02-03 14:50:06 +01:00
b4e06bd7d4 Cleanup: Rename 'TRACKBALLSIZE' to 'V3D_OP_TRACKBALLSIZE' 2022-02-03 10:06:09 -03:00
Germano Cavalcante
1963ad52ce Cleanup: Split View3D navigation code into specific compilation units
The view3d_edit.c file is already getting big (5436 lines) and mixes
operators of different uses.

Splitting the code makes it easier to read and simplifies the
implementation of new features.

Differential Revision: https://developer.blender.org/D13976
2022-02-03 10:06:09 -03:00
e5a110719f Fix T91254: Some editing operation indirectly delete objects from override collections.
Those cases are fairly hard to track down... Added some more checks,
also at lower levels, more generic levels of object editing, and fixed
core check in liboverride (previously code was assuming that an override
of a collection only could have overrides of objects or linked objects,
but this is not necessarily true).
2022-02-03 14:00:12 +01:00
ff9dc1986e Split Python OBJ importer and exporter, enabling only the importer.
This is from patch D13988. It removes the "- New" from the menu of the
new obj exporter, changes the default addon to just io_import_obj,
and does the right versioning thing.
Also disables the python tests for the old python exporter.
2022-02-03 07:56:55 -05:00
3bf2a6e3c9 Cleanup: use NULL items for the default sample enum
Using this enum quiets a warning when exporting key-maps.
2022-02-03 23:02:00 +11:00
60a09bc1be Merge branch 'blender-v3.1-release' 2022-02-03 22:59:09 +11:00
6c6556c5bd Docs: correct weight paint sample description 2022-02-03 22:57:24 +11:00
5a2101f754 Merge branch 'blender-v3.1-release' 2022-02-03 22:42:48 +11:00
59b777eedd Fix T95137: Spline calc_length not working with just 1 NURB point
The NURB case did not properly handle a curve with only 1 point.

Ref D13904
2022-02-03 22:40:32 +11:00
9b42620ef2 Merge branch 'blender-v3.1-release' 2022-02-03 21:39:26 +11:00
35aedd87e7 Fix T66913: undo after frame-change doesn't refresh properly
Use the ID.recalc flag to detect when updates after frame-change is
needed. Since comparing the last calculated frame doesn't take undo into
account (see code-comment for details).

`ID_RECALC_AUDIO_SEEK` has been renamed to `ID_RECALC_FRAME_CHANGE`
since this is not only related to audio however internally this flag is
still categorized in `NodeType::AUDIO`.

Reviewed By: sergey

Ref D13942
2022-02-03 21:37:42 +11:00
98cc3c6009 Cleanup: clang-format 2022-02-03 21:32:31 +11:00
b9483ea380 Merge branch 'blender-v3.1-release' 2022-02-03 10:02:36 +01:00
c8cca88851 Fix assert in original modifiers pointer update function
The issue was happening with a specific file where the ID management
code was not fully copying all modifiers because of the extra check
in the `BKE_object_support_modifier_type_check()`.

While it is arguable that copy-on-write should be a 1:1 copy there is
no real need to maintain the per-modifier pointer to its original.
Use its SessionUUID to perform lookup in the original datablock.

Downside of this approach is that it is a linear lookup instead of
direct pointer access, but the upside is that there is less pointers
to manage and that the file with unsupported modifiers does behave
correct without any asserts.

Differential Revision: https://developer.blender.org/D13993
2022-02-03 10:02:20 +01:00
45d5773519 Cleanup: Use utility function to access original modifier in RNA 2022-02-03 10:02:20 +01:00
c80411ce3b Despgraph: Remove asserts from object modifier backup
The modifiers are mapped between original and evaluated objects based on
their session IDs. The pointer to original modifier is no longer needed
for the backup: it remained from the initial implementation which was
rewritten at some point.

This is a preparation for removal of the pointer to original modifier.
2022-02-03 10:02:20 +01:00
e468abc360 Merge branch 'blender-v3.1-release' 2022-02-03 09:59:22 +01:00
c379223053 Fix wrong function call in Cycles acceleration UI poll.
Thanks to Sergey for spotting this mistake.
2022-02-03 09:57:24 +01:00
26fe2c1885 Merge branch 'blender-v3.1-release' 2022-02-03 17:20:47 +11:00
b0847eff2a Fix T93625: fallback tools don't work with RMB select
c9d9bfa84a caused a regression in when
the right-mouse select action was set to "Select & Tweak" (default).

Now the fallback tool works with RMB select as it did before.
2022-02-03 17:14:07 +11:00
eb0e0a3b75 LibOverride: Move proxy conversion code in its own file.
This will allow to keep the access to deprecated DNA proxy data in that
specific file, instead of allowing deprecated accesses in the whole
override kernel code.

Part of T91671.
2022-02-02 17:22:12 +01:00
a83fff7c63 Remove operators to manually convert proxies to liboverrides.
Now that proxy conversions if enforced, those operations are not useful
anymore.

Part of T91671.
2022-02-02 16:56:23 +01:00
f0cfa94d94 Fix T95397: Grease Pencil Icons do not match in Outliner vs Dope Sheet Editor
There was an inconsistency between icons.
2022-02-02 16:33:29 +01:00
04a93b795c Merge branch 'blender-v3.1-release' 2022-02-02 16:30:12 +01:00
43b0ff3054 Fix (unreported) bug in liboverride resync code.
Part of the resynching code would access collections' objects base
cache, which can be invalid at that point (due to previous ID remapping
and/or deletion). Use a custom recursive iterator over collections'
objects instead, since those 'raw' data like collection's objects list,
and collection's children lists, should always be valid.

Found while investigating a studio production file.
2022-02-02 16:25:41 +01:00
40b84ffc50 Draw Manager: Marked work around code.
Mark the work around that was added for the VSE memory leak.
2022-02-02 15:05:06 +01:00
fd35aa48d1 Workaround for VSE memory leak.
This is a temp fix for a memory leak where the VSE isn't aware that a
float representation of the image could exist. The VSE somehow doens't
clears it (refcounter is still 1).

The work around is just to let the image engine clean up all the data it
created. Potential this would add more overhead when buffers are needed
more than once.
2022-02-02 14:20:18 +01:00
e54fba5591 Merge branch 'blender-v3.1-release' 2022-02-02 13:12:12 +01:00
bf8597febe BLI: fix memory leak in VectorSet
The leak happened when the vector set had to grow when it
was empty but it had allocated the keys array already.
2022-02-02 13:11:33 +01:00
4dcaac6d33 Cleanup: comment printing when loading XML
This printed text when the theme was changes from the quick setup.
Also use a context manager for opening a file.
2022-02-02 21:06:38 +11:00
d81c3bcfbb Merge branch 'blender-v3.1-release' 2022-02-02 10:56:00 +01:00
a985f558a6 Fix T95084: evaluate all output attributes before changing geometry
This refactors how output attributes are computed in the geometry
nodes modifier. Previously, all output attributes were computed one
after the other. Every attribute was stored on the geometry directly
after computing it. The issue was that other output attributes might
depend on the already overwritten attributes, leading to unexpected
behavior.

The solution is to compute all output attributes first before changing the
geometry. Under specific circumstances, this refactor can result in a speedup,
because output attributes on the same domain are evaluated together now.
Overwriting existing might have become a bit slower, because we write the
attribute into  new buffer instead of using the existing one.

Differential Revision: https://developer.blender.org/D13983
2022-02-02 10:54:54 +01:00
ff4e04a293 Merge branch 'blender-v3.1-release' 2022-02-02 10:38:24 +01:00
71b451bb62 Fix T95288: Shrinkwrap selection broken in edit mode
Mistake in the 974981a637: f the edit data is not present then the
origindex codepath is to be used. Added a brief note about it on the
top of the file.

More ideally would be to remove edit mesh from non-bmesh-wrappers
but this would require changes in the draw manager to make a proper
decision about drawing edit mode overlays.
2022-02-02 10:35:32 +01:00
829d93ff06 Remove option to not auto-convert proxies on file load.
Now all proxies will always be converted to library overrides. If
conversion fails, they are simply 'disabled'.

This should be the last 'user-visible' step of proxies removal.
Remaining upcoming commits will remove internal ID management, depsgraph
and evaluation code related to proxies.

Also bump the blendfile subversion.

Part of T91671.
2022-02-02 09:47:10 +01:00
049df7ef94 Proxies Removal: Handle conversion to liboverrides also for linked data.
So far linked proxies were just kept as-is, this is no longer an option.

Attempt to convert them into liboverrides as much as possible, though
some cases won't be supported:
- Appending proxies is broken since a long time, so conversion will fail
  here as well.
- When linking data, some cases will fail to convert properly. in
  particular, if the linked proxy object is not instanced in a scene
  (e.g. when linking a collection containing a proxy as an
  epty-instanced collection instead of a view-layer-instanced collection).

NOTE: converion when linking/appending is done unconditionnaly, option
to not convert on file load will be removed in next commit anyway.

Part of T91671.
2022-02-02 09:47:10 +01:00
286fcb3a60 LibOverride: Add 'owner library' info to some liboverride code.
This will help when dealing with liboverrides from other library files,
e.g for resync or proxies conversion.

This commit only affects proxy conversion.

Part of T91671.
2022-02-02 09:47:10 +01:00
4927919613 Cleanup: Use correct identifier for ShaderParameters.
Code use struct and class, but should only have used struct.
2022-02-02 08:32:32 +01:00
e8b3bd15e8 Cleanup: skip redundant steps when the selection buffer is cached
The viewport theme loaded and virtual modifiers allocated unnecessary.
2022-02-02 18:12:53 +11:00
da5e72eb01 Cleanup: exclude bone names & axes from selection drawing
These aren't used for picking bones so there is no need to draw them.
2022-02-02 18:06:51 +11:00
cabc9506f9 Fix crash in recent pose-bone transform cleanup
ff5e8e6d53 dereferenced a NULL pointer
when dragging a bone with a connected parent in pose-mode.
2022-02-02 18:02:13 +11:00
709f67cbf0 Docs: note that Bone.xwidth & zwidth are doubled 2022-02-02 17:31:06 +11:00
9b779993f0 Docs: add doc-string for RNA_property_is_set_ex use_ghost argument 2022-02-02 13:53:46 +11:00
d82372aee3 Cleanup: spelling in comments 2022-02-02 13:53:46 +11:00
811606a064 Cleanup: shadow warning, remove unused flags 2022-02-02 13:53:36 +11:00
9cc4861e6f Compositor: Combine and Separate XYZ Node
We have this node for shader and geometry nodes. Compositor can also
work with vectors, and this can help with that.

Reviewed By: manzanilla

Maniphest Tasks: T95385

Differential Revision: https://developer.blender.org/D12919
2022-02-01 18:18:51 -05:00
c9b578eac8 Geometry Nodes: Remove object transform dependency in some cases
The geometry nodes modifier currently always adds a dependency
relation from the evaluated geometry to the object transform. However,
that can be avoided unless there is a collection or object info node in
"Relative" mode.

In order to avoid requiring dependency graph relations updates often
when editing a node tree, this patch doesn't check if the node is muted
or if the data-block sockets are empty before adding the dependency.

Fixes T95265

Differential Revision: https://developer.blender.org/D13973
2022-02-01 16:27:29 -06:00
b91ae8b14c Merge branch 'blender-v3.1-release' 2022-02-01 22:54:23 +01:00
95fcb41841 Fix T95378: Seek problems when timecodes are used
Function `IMB_indexer_get_seek_pos()` can return non 0 seek position for
frame index 0. This causes seeking to incorrect GOP and scanning ends
with failiure.

Hard-code first frame index seek position to 0.

Differential Revision: https://developer.blender.org/D13974
2022-02-01 22:53:24 +01:00
6b914a43ad Fix error in ff5e8e6d53
And silence unused variable warning.
2022-02-01 18:50:10 -03:00
b127654816 Fix build error
The return value of this function was removed in ff5e8e6d53
2022-02-01 15:46:07 -06:00
a12265f048 Fix T95353: Crash with proxy auto building
Proxy building data were freed before process was started.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13972
2022-02-01 22:46:04 +01:00
03e580c98c Cleanup: Use C++ types 2022-02-01 15:42:04 -06:00
ff5e8e6d53 Cleanup: restructure 'transform_convert_pose_transflags_update'
Move the bones count and `has_translate_rotate` parameter out of the
function as they are not required in some places.
2022-02-01 18:38:26 -03:00
Yevgeny Makarov
7aec5b0622 UI: Adjust Layout on Quick Setup Screen
Some items on the Quick Setup screen can be truncated with some
languages and/or with High DPI monitors. This patch adjusts column
sizes and turns off the expand on Spacebar options, making everything
fit a bit better.

See D9853 for more details.

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

Reviewed by Julian Eisel
2022-02-01 11:17:57 -08:00
2b01964e6c Merge branch 'blender-v3.1-release' 2022-02-01 19:25:36 +01:00
83b6c8f2b1 Fix T95278: Crash on startup because of GLSL recursion
Bypassing the defines which are only there for error checking.
2022-02-01 19:22:50 +01:00
f39ade9e00 GPUShader: Rename createInfo storage Qualifiers
Using opt-in instead of opt-out to make code easier to read.
Add combined flag enum.
Making restrict an inverse flag option because it is so rare to
use it.
2022-02-01 19:05:22 +01:00
9505af72d4 GPUShader: Add support for gpu_BaryCoord and fallback
This adds the possibility to use the `gpu_BaryCoord[NoPersp]`
builtin to support barycentric coordinates without geometry shader.

The `BuiltinBits::LAYER` builtin needs to be manually added
to the `GPUShaderCreateInfo` in order to use this feature.
Note: This is only available for shaders using `GPUShaderCreateInfo`.

A geometry shader fallback is generated if the extension
`AMD_shader_explicit_vertex_parameter` is not available.

`NV_fragment_shader_barycentric` was not considered because it is not
present inside the `glew.h` with use and seems to only be available
with vulkan.
2022-02-01 19:05:22 +01:00
9e42b9827a GPUShader: Add support for vertex shader gl_Layer and fallback
This adds the possibility to use the `gpu_Layer` builtin to
support layered rendering without geometry shader.

The `BuiltinBits::LAYER` builtin needs to be manually added
to the `GPUShaderCreateInfo` in order to use this feature.
Note: This is only available for shaders using `GPUShaderCreateInfo`.

A geometry shader fallback is generated if the extension
`AMD_shader_explicit_vertex_parameter` is not available.
2022-02-01 19:05:22 +01:00
9bbfade772 GPUShader: Improve builtins support in GPUShaderCreateInfo
- Scan all static shaders for builtins on startup.
- Add possibility to manually add builtins.
- `ShaderCreateInfo.builtins_` contain builtins from all stages.
2022-02-01 19:05:22 +01:00
7475f7b0de GPUShader: Expose create_info getter
This allows to check if a create_info extists based on its name.
2022-02-01 19:05:22 +01:00
Falk David
ffb0ecb498 Fix T91463: Separate points makes gap on cyclic stroke
If an entire cyclic stroke was selected, calling "Separate by Points"
would leave a gap in the new object (making the new stroke non-cyclic).

The patch makes sure that if we separate by points and all points are
selected, we fall back to separate by stroke.

Reviewed By: antoniov

Maniphest Tasks: T91463

Differential Revision: https://developer.blender.org/D12527
2022-02-01 18:09:34 +01:00
2110e271f5 Merge branch 'blender-v3.1-release' 2022-02-01 17:53:19 +01:00
2bd71b49e7 Fix T95395: dangling parent pointer when creating node group
Differential Revision: https://developer.blender.org/D13981
2022-02-01 17:48:44 +01:00
Falk David
e9150ac317 Fix T89514: GP draw mode not saved when scene is not the active one
This patch fixes the error that pops up
(`Error: Unable to execute '... Mode Toggle', error changing modes`)
when trying to switch to e.g. draw mode from a grease pencil object
that was saved in draw mode in an inactive scene when the file was loaded.

Note that this does not fix the bigger issue described in T91243.

The fix makes sure that we reset all the mode flags on the grease pencil
data when we set the mode to object mode.

Reviewed By: antoniov

Maniphest Tasks: T89514

Differential Revision: https://developer.blender.org/D12419
2022-02-01 16:02:03 +01:00
32b33e91eb Asset Browser: Use directory name as default when adding asset libraries
When adding an asset library in the Preferences, set the name of the new
library to the chosen directory's name by default. That avoids having to
set it manually which can be annoying. Previously I thought it would be
nice to show the name button in red then, making the user aware that
they have to give it a name, but that appears to be more annoying than
useful/practical after all.
2022-02-01 14:59:11 +01:00
b03fb70eff Silence draw manager warning.
This message isn't useful for users so silenced it.
2022-02-01 13:50:19 +01:00
f8713aae5e Cleanup: Remove unused datatoc definitions. 2022-02-01 12:14:52 +01:00
217e0a2ce6 Fix T95262: instances ignored in Frame Selected operator
The issue was that the code only looked at `dob->ob`
instead of `dob->ob_data` which is necessary since
rB5a9a16334c573c4566dc9b2a314cf0d0ccdcb54f.

This now uses the same pattern that is used in other places
where `BKE_object_replace_data_on_shallow_copy` is used.
2022-02-01 11:58:53 +01:00
84dab8b597 Fix T95314: constant values not shown in spreadsheet 2022-02-01 11:43:48 +01:00
34449ba9a6 Merge branch 'blender-v3.1-release' 2022-02-01 11:04:38 +01:00
6f9828289f Fix T95356: Crash in armature edit mode and certain condition
Blender would have crashed when renaming bone in Edit Mode, Saving, and
than selecting/deselecting.

Caused by a mistake in the 0f89bcdbeb: can not "short-circuit" the
CoW update if it was explicitly requested.

Safest for now solution seems to be to store whether the CoW component
has been explicitly tagged, so that the following configuration can be
supported:

    DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
    DEG_id_tag_update(id, ID_RECALC_COPY_ON_WRITE);

Differential Revision: https://developer.blender.org/D13966
2022-02-01 11:04:19 +01:00
396413dedf Partial Fix: Showing Compositor Backdrop in node editor.
Since splitting the depth and the color shader in the image engine the
backdrop wasn't visible anymore. The reson is that the min max uv
coordinates were never working for the node editor backdrop that uses
its own coordinate space.

This partial fix will ignore the depth test when drawing the color part
of the backdrop. This will still have artifacts that are visible when
showing other options as RGBA.

Proper fix would be to calculate the the uv vbo in uv space and not in
image space.
2022-02-01 10:49:28 +01:00
146618fb22 Fix T95376: Fix crash when switching to UV workspace.
Can also happen in other places when the overlay engine is active. Some
parts of the overlay engine uses builtin shaders, but disable the color
space conversion to the target texture.

Currently there the overlay engine has its own set of libraries it could
include and defined a macro to pass-throught the color space conversion.

The library include mechanism currently fails when it couldn't find the
builtin library in the libraries of the overlay engine. This only
happened in debug mode.

This change will not fail, but warns the developer if a library could
not be included. In the future this should be replaced by a different
mechanism that can disable the builtin library. See {T95382}.
2022-02-01 08:38:34 +01:00
120deaac5b Merge branch 'blender-v3.1-release' 2022-02-01 15:37:14 +11:00
64264a496d Merge branch 'blender-v3.1-release' 2022-02-01 15:37:10 +11:00
c8814fb610 Fix T95185: Invalid normals after undo in sculpt mode
Since d9c6ceb3b8 partial updates to
normals in sculpt-mode were accumulating into the current normal
instead of a zeroed value.

Zero vertex normal values tagged for calculation before accumulation.

Reviewed By: HooglyBoogly

Ref D13975
2022-02-01 15:35:08 +11:00
9ce1135440 Cleanup: remove duplicate vertex normal array in SculptSession
From investigating T95185, it's important the normal returned by
SCULPT_vertex_normal_get always match the PBVH normal array.

Since this is always initialized in the PBVH, there is no advantage
in storing the normal array in two places, it only adds the possibility
that changes in the future causing different meshes normals to be used.

Split out from D13975.
2022-02-01 13:39:19 +11:00
f21f1279fa Merge branch 'blender-v3.1-release' 2022-02-01 13:34:43 +11:00
2e4a1a70da Fix building with audaspace disabled 2022-02-01 13:33:50 +11:00
95005bbe02 Merge branch 'blender-v3.1-release' 2022-02-01 00:10:47 +01:00
f420118335 Fix T93856: VP9 lossless render missing alpha
Since 0ea0ccc4ff, `AV_PIX_FMT_YUV444P` pixel format was used for
lossless renders, which did override `AV_PIX_FMT_YUVA420P` format when
"RGBA" output is chosen. VP9 encoder doesn't seem to support
`AV_PIX_FMT_YUVA444P` pixel format, so use `AV_PIX_FMT_YUVA420P` for
lossless RGBA ouput instead.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13947
2022-02-01 00:00:29 +01:00
1d1859c3c4 Fix compile error with audaspace disabled
Argument was removed in a recent commit.
2022-01-31 23:48:43 +01:00
bff83ecee5 Cleanup: Add missing breaks in previous commit
I missed compile warnings for these. Sorry for the noise.
Also combine assignments with null checks to save a few lines.
2022-01-31 15:43:23 -06:00
71c76d596c Merge branch 'blender-v3.1-release' 2022-01-31 22:32:08 +01:00
2053fc849e Cleanup: Return early, use switch, rename function 2022-01-31 15:27:35 -06:00
68c2650b03 Fix T94287: gaps between strips when adding movies
Currently, audio and video strips are synchronized based on data from
media stream, which is nice, but this causes gaps between strips.
This synchronization was implemented by moving movie strip position
relative to sound, which doesn't make much sense for user which is
mostly interested in editing video.

Code was bit hard to read, so it has been simplified. Ideally video
stream time would be easily accessible so synchronization could be done
at any time, but this is not necessary at this point.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D13948
2022-01-31 22:22:36 +01:00
c3a41a8002 Merge branch 'blender-v3.1-release' 2022-01-31 21:00:28 +01:00
c8c9965df2 Fix crash with non-closed meshes in recent bugfix for texture margin
Ref T95249, D13935
2022-01-31 20:59:25 +01:00
5fabbedb04 Fix Cycles assert in light sampling
There is no object transform on lights.
2022-01-31 20:45:12 +01:00
c4f159cfcd Cleanup: Add back comment removed in recent commit
23775f3914 removed this comment, but it's
preferred to keep it instead.
2022-01-31 12:00:45 -06:00
81ee46da1a Fix: Unutilized curve mapping in vector shader node
This could result in a shading errors is some cases such as undo.

Follow up to rB1405787142d1f87f18631114167675ed145f6d75
2022-01-31 12:59:54 -05:00
716d8436f0 Fix: Unutilized curve mapping in vector shader node
This could result in a shading errors is some cases such as undo.

Follow up to rB1405787142d1f87f18631114167675ed145f6d75
2022-01-31 12:56:40 -05:00
64359f8998 Cleanup: Better name for new Outliner tree element type
The name `type` was confusing, since we usually use that in other ways.

Also updated the relating comments.
2022-01-31 18:36:55 +01:00
fc5ef2452d Cleanup: Namespace alias for internal outliner header
Long namespace qualifiers add visual noice and make code harder to read.
2022-01-31 18:36:55 +01:00
2bd30272ea Merge branch 'blender-v3.1-release' 2022-01-31 12:32:31 -05:00
Leon Schittek
5edb924e57 UI Papercut: Fix gap in node outline
Correct corner radius of the node outline to prevent a noticeable gap in
some cases.

---

Currently we make a small mistake in the creation of the node outline:
We offset the rectangle describing the outline by the outline thickness,
but we don't adjust the corner radius accordingly.
Therefore the rounded corner of the outline and the node body are not
concentric which can sometimes lead to a visible gap at the corner.
How noticeable it is depends on the theme, the screen's dpi and the
line thickness set in the preferences.

Simply adjusting the corner radius for the outline to also be increased
by the outline thickness fixes this small issue.

| display, line thickness | **patch** | **master** |
| --- | --- | --- |
| 1080p, default/thin  | {F12835304} | {F12835305} |
| retina, thin | {F12835306} | {F12835307} |

The issue was mentioned by @hitrpr

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D13955
2022-01-31 12:31:54 -05:00
Martijn Versteegh
8ad5241778 Fix T95250: bake margin adjacent faces uses stale UV map in edit mode
Use the evaluated mesh to generate the Adjacent Faces margin.

Baking used the evaluated mesh, but generating the margin used the base
mesh. This would lead to generating the margin from a stale UV map when the
UV editor was open and the UV map was changed. Fix it by passing the same
mesh as used for baking through to the margin generation.

Differential Revision: https://developer.blender.org/D13938
2022-01-31 18:18:05 +01:00
Martijn Versteegh
83fa6a1b2a Fix T95249: bake margin adjacent faces fails in some directions
The new adjacent faces method border lookup fails in some directions around
45 degrees

* Use 8 Dijkstra directions (also diagonally) to determine which polygon is the
  closest to each pixel. Using only Manhattan distance lead to large parts of
  the texture which were matched with the wrong polygon.

* Use neighbroing polygons for edge search. The Adjacent Faces algorithm needs
  to determine the closest edge, in UV space, each pixel. To speed this up
  first as map is built which finds the closest polygon for each pixel along
  horizontal, vertical and diagonal steps. Because this can sometimes be one
  edge off we first look in the polygon from the map, if that fails also
  check the edges of its neighbouring UV polygons.

Differential Revision: https://developer.blender.org/D13935
2022-01-31 18:18:04 +01:00
Martijn Versteegh
c626301f19 Cleanup: remove wrong assert
Was accidentally left in after refactoring.

Fixes T95347

Differential Revision: https://developer.blender.org/D13963
2022-01-31 18:18:02 +01:00
64ca0f44cb Merge branch 'blender-v3.1-release' 2022-01-31 17:43:43 +01:00
5257257539 Fix T95205: remove attribute only once
The bug was caused by a typo.
2022-01-31 17:40:55 +01:00
9578fe3068 Fix T95341: BGL renders incorrect color
Missing include statements of the gpu_shader_colorspace_lib.glsl in
various shaders ignored the target texture color space.
2022-01-31 15:43:13 +01:00
2216699c64 Cleanup: Change NULL to nullptr. 2022-01-31 15:43:13 +01:00
8cc6623c18 Merge branch 'blender-v3.1-release' 2022-01-31 15:29:02 +01:00
180a68c1dc Fix (studio-reported) missing RNA path for EEVEE render passes.
For those EEVEE passes a bit of trickery with pointer offsets allows to
get the owning viewlayer, so path generation is not too bad.

Also moved ViewLayer path generation itself into a public utils, to
avoid duplicating code.

NOTE: Doing the same for AOV would be needed, but since pointer offsets
won't help us here to find the owning viewlayer, not sure how to do it
nicely yet (only solution I think is to loop over all AOVs of all
ViewLayer of the scene to find it :( ).

Reported by Beau Gerbrands (@Beaug), thanks.
2022-01-31 15:16:36 +01:00
46abc6ce25 Fix T95238: BPY Documentation for Tablet Pressure is Incorrect
Set an appropriate range and default value for the property.
2022-01-31 10:20:34 -03:00
caaec3e0c5 Merge branch 'blender-v3.1-release' 2022-02-01 00:02:08 +11:00
a31859c754 Merge branch 'blender-v3.1-release' 2022-02-01 00:02:05 +11:00
8b4f1e41ea Merge branch 'blender-v3.1-release' 2022-02-01 00:02:02 +11:00
cf871ab967 Merge branch 'blender-v3.1-release' 2022-02-01 00:01:58 +11:00
9badd27fb7 Merge branch 'blender-v3.1-release' 2022-02-01 00:01:54 +11:00
b9718899fa Python: default to version to 3.10 for Linux
This doesn't bump the minimum version, see D13943.
2022-01-31 23:57:10 +11:00
deb90557ea Fix T95332: Crash loading older files.
Image buffer was visible but buffer wasn't available. In the case
the color only overlay of the render result was displayed the image
buffer was not check to be valid.

This patch adds a null pointer check to check in `IMB_alpha_affects_rgb`
to solve this crash.
2022-01-31 12:25:18 +01:00
869180548c Image editor: Fix drawing artifacts with render results.
Use the input depth texture to determine if the color of the texture
should be shown.
2022-01-31 11:59:16 +01:00
75576a3001 Fix (unreported) install_deps: wrong order of actions in python handling.
We need to get installed version of python *after* we actually install/update
the package.
2022-01-31 11:08:14 +01:00
Michael
e43ccfb702 Fix: Specify exact Python version for python3-dev on Debian&Ubuntu
This commit specifies the exact Python version which is included in the
package name, thereby allowing `install_deps.sh` to suggest
"`-D PYTHON_VERSION=3.10`" correctly.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D13925
2022-01-31 10:59:38 +01:00
dfc959eed6 Fix T95299: Empty render results show transparency checkerboard.
When an image buffer cannot be read the checkerboard should not be
drawn.
2022-01-31 10:51:25 +01:00
cfa235b89d Image Editor: Fix background drawing of empty tiles.
Empty (UDIM) tiles where drawn with a transparency checkerboard. They
should be rendered with a border background. The cause is that the image
engine would select a single area that contained all tiles and draw them
as being part of an image.

The fix is to separate the color and depth part of the image engine
shader and only draw the depths of tiles that are enabled.
2022-01-31 09:57:51 +01:00
a727692af7 XR: Print OpenXR SDK version in --debug-xr mode
Helps with version validation when updating the OpenXR dependency.
2022-01-31 16:09:17 +09:00
ed80c887b7 Fix wmTimer.ntime becoming NAN with a zero time-step
While this didn't cause any user visible bugs, this wouldn't
have behaved as intended since the timer would never run again once
wmTimer.ntime was set to NAN.
2022-01-31 14:36:37 +11:00
97dbe235a2 Cleanup: comments and minor changes to GPU_select code
- Remove outdated references to glReadPixels & OpenGL.
- Rename GPUPickState.{gl => gpu}
- Add doc-string for MAXPICKELEMS.
- Use doxygen comments & other minor doc-string improvements.
2022-01-31 14:10:38 +11:00
8815f2f116 Cleanup: use struct for GPU the select buffer
GPU_select originally used GL_SELECT which defined the format for
storing the selection result.

Now this is no longer the case, define our own struct - making the code
easier to follow:

- Avoid having to deal with arrays in both `uint*` and `uint(*)[4]`
  multiplying offsets by 4 in some cases & not others.

- No magic numbers for the offsets of depth & selection-ID.

- No need to allocate unused members to match GL_SELECT
  (halving the buffer size).
2022-01-31 14:10:08 +11:00
9ccdad8a21 Cleanup: use enum type for selection mode & internal algorithm enum 2022-01-31 13:06:56 +11:00
57f6aa4d83 Cleanup: Remove unused "_ex" version of function 2022-01-30 18:15:38 -06:00
79032a8513 Cleanup: Remove unused DerivedMesh flag
The value of this flag was never used.
2022-01-30 18:11:20 -06:00
23775f3914 Cleanup: Remove unused DerivedMesh functions
Remove functions and function pointers that were never set or never
used at all. The "tessface" original index handling in `subsurf_ccg.c`
can be removed because the data was never used.
2022-01-30 18:06:47 -06:00
ac3324f197 Cleanup: spelling in comments 2022-01-31 10:51:33 +11:00
012e41fc8b Cleanup: use our own conventions for tags in comments 2022-01-31 10:49:59 +11:00
14427f5aaa Cleanup: Remove unused DerivedMesh normal handling
This function and flags weren't used outside of DerivedMesh
code, and since the plan is to remove the data structure, it makes
sense to remove complexity where possible.
2022-01-30 17:01:03 -06:00
a04d0de039 Fix T95336: Wrong tooltip for Show Only on Keyframed checkbox
The "Paint" mode is wrong, must be "Draw"
2022-01-30 23:12:23 +01:00
Aras Pranckevicius
1f7013fb90 Speed up the new OBJ exporter via bigger write buffer and parallelization.
This is a patch from Aras Pranckevicius, D13927. See that patch for full
details. On Windows, the many small fprintfs were taking up a large amount
of time and significant speedup comes from using snprintf into chained buffers,
and writing them all out later.
On both Windows and Linux, parallelizing the processing by Object can also lead
to a significant increase in speed.
The 3.0 splash screen scene exports 8 times faster than the current C++ exporter
on a Windows machine with 32 threads, and 5.8 times faster on a Linux machine
with 48 threads.

There is admittedly more memory usage for this, but it is still using 25 times
less memory than the old python exporter on the 3.0 splash screen scene, so
this seems an acceptable tradeoff. If use cases come up for exporting obj files
that exceed the memory size of users, a flag could be added to not parallelize
and write the buffers out every so often.
2022-01-30 15:03:31 -05:00
b315678fea Merge branch 'blender-v3.1-release' 2022-01-30 13:57:45 -05:00
Aras Pranckevicius
07514def19 Fix T95328, new obj exporter not exporting custom normals.
Previously, the new obj exporter was only exporting per-vertex normals for faces
marked as "smooth". But a face can have custom normals, as soon as the normals
data layer exists. This change makes it follow the behavior of USD & Collada
exporters and the old Python one, which also export per-vertex normals as soon
as the layer is there. (From Patch D13957.)
2022-01-30 13:48:03 -05:00
4fcc651435 Revert "UI: Do not translate "Blender""
See rB0c5a9a0e776eeb724f7266694153f98721e34fde for the issue with this.

This reverts commit 0c5a9a0e77.
2022-01-30 12:19:38 -05:00
a58592885c Cleanup: Remove modifier type hair callback
This is similar to e032ca2e25 which removed the
callback for volumes. Now that we have geometry sets, there is
no need to define a callback for every data type, and this wasn't
used. Procedural curves/hair editing will use nodes rather than new
modifier types anyway.
2022-01-30 00:07:07 -06:00
0c5a9a0e77 UI: Do not translate "Blender"
Blender is the name of the software, it does not make sense to
translate into a language's term for the kitchen appliance.
2022-01-29 21:00:12 -05:00
f18172b023 Cleanup: Pass cursor position as a single array to eyedropper functions
Since `event->xy` is now an array these functions can be
simplified to accept the sample point as an array.

Clarifications were also made to variable names:
- `eye->last_x/y` --> `eye->cursor_last`
- `mx/my` --> `cursor`

Differential Revision: https://developer.blender.org/D13671
2022-01-29 20:45:03 -05:00
f8b8727873 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-01-30 01:07:38 +01:00
2cf3ed13da Fix T95315: "Override Layers" panel open crash with null CacheFile 2022-01-30 01:06:56 +01:00
e951e81b0f Cleanup: Cmake: remove unnecessary definitions for internationalization
Previously, macros were ifdefed using the cmake option `WITH_INTERNATIONAL`
However, the is unnecessary as withen the functions themselves have checks for building without internationalization.
This also means that many `add_definitions(-DWITH_INTERNATIONAL)` are also unnecessary.

Reviewed By: mont29, LazyDodo

Differential Revision: https://developer.blender.org/D13929
2022-01-29 17:40:27 -05:00
ec2e9a4352 Merge branch 'blender-v3.1-release' 2022-01-29 13:14:45 -05:00
c9d35ee07c Fix: Eevee: Float Curve node causes issues with compiled shader
This fixes a regression from rBa0edee712a79239133ff840f911f6416d4c41855.
Issue being the curve map not being initialized in the GPU shader function.

Fixes T95221
2022-01-29 13:14:26 -05:00
1405787142 Fix: Eevee: Float Curve node causes issues with compiled shader
This fixes a regression from rBa0edee712a79239133ff840f911f6416d4c41855.
Issue being the curve map not being initialized in the GPU shader function.

Fixes T95221
2022-01-29 13:11:06 -05:00
90a23dec46 Cleanup: Remove mesh vertex "temp tag" flag
As part of the project of converting `MVert` into `float3`
(more details in T93602), this is an easy step, since it
is only locally used runtime data. In the six places it was
used, the flag was replaced by a local bitmap.

By itself this change has no benefits other than making some
code slightly simpler. It only really matters when the other
flags are removed and it can be removed from `MVert`
along with the bevel weight.

Differential Revision: https://developer.blender.org/D13878
2022-01-28 22:40:13 -06:00
0b2864382a Merge branch 'blender-v3.1-release' 2022-01-29 01:42:04 +01:00
544a0f2880 Fix memory leak when adding movie strips
Introduced by b45e71e22c.
2022-01-29 01:31:53 +01:00
d29a079cb6 Merge branch 'blender-v3.1-release' 2022-01-28 17:47:38 -06:00
03b57d3973 Fix T94476: Threading/performance issue with curve to points node
For every spline, *all* of the normals and tangents in the output
were normalized. The node is multithreaded, so sometimes a thread
overwrote the normalized result from another thread.

Fixing this problem also made the node orders of magnitude
faster when there are many splines.
2022-01-28 17:47:14 -06:00
fd1078e105 Fix T62651: Win32 Multiple Adapters Warning
Show a more instructive error message for users who have plugged
multiple monitors into multiple display adapters. And do not exit
if unable to open a child window when in this state.

See D13885 for more details

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

Reviewed by Ray Molenkamp
2022-01-28 15:20:07 -08:00
3435c9a2c1 Merge branch 'blender-v3.1-release' 2022-01-28 23:51:50 +01:00
afdc35b636 Fix typos in rB0a8fa07735cdb89081b652c032c73863e34f8ff1 2022-01-28 23:50:49 +01:00
fe80b6ceac Merge branch 'blender-v3.1-release' 2022-01-28 23:32:51 +01:00
0a8fa07735 Fix T95278: Crash on startup because of GLSL compiler bug
The GLSL defines used to make the uniform names unusable for local variable
is being interpreted as recursive on some implementation.

This avoids it by create a second macro avoiding the recursion.
2022-01-28 23:28:53 +01:00
6b7756279f Fix T93626: Win IME Chinese Numpad Decimal
Allow Windows IME Pinyin, when in Chinese mode, to use numpad decimal
key to enter decimal point.

See D13902 for more details.

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

Reviewed by Brecht Van Lommel
2022-01-28 13:32:46 -08:00
4311a32bc2 Win IME: Ideographic Full Stop to Decimal Point
Convert Ideographic Full Stop, used in Simplified Chinese and Japanese,
to Decimal Point when entering numbers into numerical inputs.

See D13903 for more details

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

Reviewed by Brecht Van Lommel
2022-01-28 13:11:56 -08:00
ace1b6a73a UI: Add OneDrive to System List for Windows
This patch adds a "OneDrive" icon to the File Manager System list for
Windows (only!).

See D11133 for more details.

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

Reviewed by Julian Eisel
2022-01-28 12:22:42 -08:00
26e608d820 Win32: Initialize GHOST_WindowWin32 Members
Initialize m_Bar, m_dropTarget, & m_hWnd members of GHOST_WindowWin32
in constructor's member initializer list. This ensures they are are
set or NULL in destructor if constructor does not complete.

See D13886 for more details.

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

Reviewed by Jesse Yurkovich
2022-01-28 12:03:20 -08:00
82ad1631e4 Fix Cycles assert in light sampling
There is no object transform on lights.
2022-01-28 17:32:18 +01:00
dd4a89e78d Merge branch 'blender-v3.1-release' 2022-01-28 10:06:04 -06:00
cb09485ff2 UI: Use property split in new operator popup
This attribute conversion operator was just added.
The UI looks more consistent with property split.
2022-01-28 10:03:07 -06:00
92d747b0c4 Drag & drop: Support using context of hovered button when dropping
Buttons can hold context and it's very useful to use this as a way to
let buttons provide context for drop operators.
For example, with this D13549 can make the material slot list set the
material-slot pointer for each row, and the drop operator can just query
that.
2022-01-28 16:53:37 +01:00
391bb6e9ba Cleanup: Clang-tidy warning gl_shader.cc 2022-01-28 16:35:05 +01:00
b6f640b953 Cleanup: Clang-tidy warnings.
Silence Clang-tidy warnings in gpu module.
2022-01-28 16:18:13 +01:00
4e93918b35 Merge branch 'blender-v3.1-release' 2022-01-28 15:09:35 +01:00
3b2a1ff716 Image Engine: Remove unused shader parameter Color.
This change removes an unused shader parameter that also collided when a
local varialble with the same name was used on different platforms.
2022-01-28 15:03:45 +01:00
75e61e5a6d Image Engine: Use GPUShaderCreateInfo.
Ported the image engine shaders to use the GPUShaderCreateInfo struct.
No functional changes.
2022-01-28 15:03:45 +01:00
c40d6ebceb Merge branch 'blender-v3.1-release' 2022-01-28 14:46:16 +01:00
430f71fce2 Fix insufficient CPU flags checks for Cycles OIDN
Sometime throughout development some checks got lost during refactor.
This change makes it so that if OIDN is not supported on the current
CPU Cycles will report an error and stop rendering. This behavior is
similar to when an OptiX denoiser is requested and there is no OptiX
compatible device available.

The easiest way to verify this change is to force return false from
the `openimagedenoise_supported()`.

Fixes Cycles part of the T94127.

Differential Revision: https://developer.blender.org/D13944
2022-01-28 14:28:04 +01:00
29a1d8b1d3 Fix compilation error in previous commit. 2022-01-28 14:01:25 +01:00
cdcbdf8ce4 Remove compilation warnings TexResult. 2022-01-28 13:28:31 +01:00
5d74fa314b Fix overread warning in screen operator
Fixes a `stringop-overread` warning, other people are working on fixing
some more :)
2022-01-28 12:40:44 +01:00
7c48196056 Silent compilation warning in space_graph. 2022-01-28 11:48:47 +01:00
be921a04f2 Image engine: Remove unused parameter.
Parameter was used to still be compatible with the previous drawing mode.
The previous mode isn't available anymore so the parameter can should be
removed.
2022-01-28 11:48:47 +01:00
dcb7b3f9f7 Image Engine: Fix issue show alpha flag not reset.
After showing the alpha in the image editor the setting was not reset
so all images in the editor showed as being transparent.

This commit fixes this by resetting the flag before updating.
2022-01-28 11:48:47 +01:00
379814a118 Draw: Remove unused code in image engine shader. 2022-01-28 11:48:47 +01:00
60bd6804db Revert "3.1 splashscreen"
This reverts commit 3aa56608f7.
2022-01-28 11:34:51 +01:00
1a15461612 Merge branch 'blender-v3.1-release' 2022-01-28 11:34:31 +01:00
3aa56608f7 3.1 splashscreen
Credit: Lorenzo Aiello - https://orencloud.artstation.com/
2022-01-28 11:32:12 +01:00
f4031f2be2 Revert "Update pipeline config and point to 3.1 branches."
This reverts commit 5d4583683b.
2022-01-28 11:19:29 +01:00
66e4fdab68 Revert "Blender 3.1 bcon3 (beta)"
This reverts commit d45098024e.
2022-01-28 11:19:10 +01:00
cfe18c3b94 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-01-28 11:11:51 +01:00
f756dc4812 Blender 3.1 Beta- subversion bump 2022-01-28 11:11:11 +01:00
5d4583683b Update pipeline config and point to 3.1 branches. 2022-01-28 11:01:11 +01:00
d45098024e Blender 3.1 bcon3 (beta) 2022-01-28 10:55:28 +01:00
c37b837244 Fix T95060: Outliner: Broken 'make override hierarchy' in indirect linked casae.
In Outliner, 'Make Override Hierarchy' on an indirectly linked data would
fail in case some items higher up in the hierarchy also needed to be
overridden was also indirectly linked.
2022-01-28 10:53:53 +01:00
c0225aa573 Blender 3.2 bcon1 - alpha
Bump the version number for the new release cycle.
2022-01-28 10:48:27 +01:00
49b9b0251b Draw: Remove unused shader.
tile images aren't a special case anymore for the image engine.
2022-01-28 10:47:52 +01:00
78647fbcc0 Fix T95060: Outliner: Broken 'make override hierarchy' in indirect linked casae.
In Outliner, 'Make Override Hierarchy' on an indirectly linked data would
fail in case some items higher up in the hierarchy also needed to be
overridden was also indirectly linked.
2022-01-28 10:24:07 +01:00
e1be275878 Fix typo in comment. 2022-01-28 09:24:11 +01:00
Jeroen Bakker
bdd74e1e93 DrawManager: Image engine support huge images.
Adding better support for drawing huge images in the image/uv editor. Also solved tearing artifacts.
The approach is that for each image/uv editor a screen space gpu texture is created that only contains
the visible pixels. When zooming or panning the gpu texture is rebuild.

Although the solution isn't memory intensive other parts of blender memory usage scales together with
the image size.

* Due to complexity we didn't implement partial updates when drawing images tiled (wrap repeat).
  This could be added, but is complicated as a change in the source could mean many different
  changes on the GPU texture. The work around for now is to tag all gpu textures to be dirty when
  changes are detected.

Original plan was to have 4 screen space images to support panning without gpu texture creation.
For now we don't see the need to implement it as the solution is already fast. Especially when
GPU memory is shared with CPU ram.

Reviewed By: fclem

Maniphest Tasks: T92525, T92903

Differential Revision: https://developer.blender.org/D13424
2022-01-28 08:37:45 +01:00
0a32ac02e9 Image: Partial Update Redesign.
This patch reimplements the image partial updates. Biggest design motivation for the redesign
is that currently GPUTextures must be owned by the image. This reduces flexibility and adds
complexity to a single component especially when we want to have different structures.

The new design is not limited to GPUTextures and can also be used by reducing overhead in image
operations like scaling. Or partial image updating in Cycles.

The usecase in hand is that we want to support virtual images in the image editor so we can
work with images that don't fit in a single GPUTexture.

Using `BKE_image_partial_update_mark_region` or `BKE_image_partial_update_mark_full_update`
a part of an image can be marked as dirty. These regions are stored per ImageTile (UDIM).

When a part of the code wants to receive partial changes it needs to construct a `PartialUpdateUser`
by calling `BKE_image_partial_update_create`. As long as this instance is kept alive the changes can
be received.

When a user wants to update its own data it will call `BKE_image_partial_update_collect_changes`
This will collect the changes since the last time the user called this function. When the partial changes
are available the partial change can be read by calling `BKE_image_partial_update_get_next_change`

It can happen that the introduced mechanism doesn't have the data anymore to construct the
changes since the last time a PartialUpdateUser requested it. In this case it will get a request
to perform a full update.

Maniphest Tasks: T92613

Differential Revision: https://developer.blender.org/D13238
2022-01-28 08:06:19 +01:00
1e0758333d Cleanup: add compiler attributes to BLI_path functions 2022-01-28 15:06:29 +11:00
9523b1478e BLI_path: assert passing relative paths to BLI_path_cmp_normalized
Assert when "//" prefixed relative paths are passed to
BLI_path_cmp_normalized as this can't be expanded
and it's possible the paths come from different blend files.
2022-01-28 15:05:21 +11:00
ebd0e76088 Cleanup: indentation for CMake files
Also minor white-space & case changes.
2022-01-28 14:52:47 +11:00
9f6b19526d Cleanup: spelling in comments
Also minor wording improvements.
2022-01-28 14:52:47 +11:00
7475012e24 Cleanup: rename BLI_paths_equal to BLI_path_cmp_normalized
Changes to recent addition: c85c52f2ce.

Having both BLI_paths_equal and BLI_path_cmp made it ambiguous
which should be used, as `BLI_paths_equal` wasn't the equivalent to
`BLI_path_cmp(..) == 0` as it is for string equals macro `STREQ(..)`.
It's also a more specialized function which is not used for path
comparison throughout Blender's internal path handling logic.

Instead rename this `BLI_path_cmp_normalized` and return the result of
`BLI_path_cmp` to make it clear paths are modified before comparison.

Also add comments about the conventions for Blender's path comparison
as well as a possible equivalent to Python's `os.path.samefile`
for checking if two paths point to the same location on the file-system.
2022-01-28 14:50:16 +11:00
f2b24272dd Fix T93328: Movie seeking doesn't work.
Caused by integer overflow in `steps_per_frame` calculation.
2022-01-27 23:21:45 +01:00
da848b7440 GPUShader: Abort in case of dependency issues.
This is to avoid being flooded with compilation errors that are not helpful.
2022-01-27 22:57:02 +01:00
423bbbbaae BLI_float4x4: Add operator[]
This makes porting existing code using `float[4][4]` easier.
2022-01-27 21:35:43 +01:00
Germano Cavalcante
3775615aea Outliner: avoid creating unnecessary undo steps
The `OUTLINER_OT_item_activate` operator, although it detects when
something changes, always returns `OPERATOR_FINISHED` and thus induces
the creation of undo steps.

So return `OPERATOR_CANCELLED` when nothing changes.

Ref T94080

Reviewed By: Severin

Maniphest Tasks: T94080

Differential Revision: https://developer.blender.org/D13638
2022-01-27 15:41:40 -03:00
a21f1e81e0 DRW: Fix some issues with DRW_gpu_wrapper.hh
- Fix assert on size.
- Fix void * casting.
- Pass extent by values.
- Add swap function to avoid letting the types copyable.
- Add back the GPUTexture * operator on TextureFromPool.
2022-01-27 18:46:01 +01:00
87c13ac68c UX: Prevent click-through panels and used header area
Does two main changes:
* Handle regions in the order as visible on screen. Practically this
  just means handling overlapping regions before non-overlapping ones.
* Don't handle any other regions after having found one containing the
  mouse pointer.

Fixes: T94016, T91538, T91579, T71899 (and a whole bunch of duplicates)
Addresses: T92364

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

Reviewed by: Campbell Barton
2022-01-27 18:40:54 +01:00
4710f3346a Event System: Add debug sanity check "always pass" events
Asserts that such events actually always lead to a handler return value
that actually keeps the event passing.

Reviewed by Campbell Barton as part of
https://developer.blender.org/D13539.
2022-01-27 18:40:54 +01:00
74d68e50d3 Revert "Cleanup: Remove unused variables in winstuff.c"
This reverts commit 32a96b80a3.

this needed an ifdef, not a removal, will land a proper fix later
2022-01-27 10:21:35 -07:00
89dbad9085 Fix T95202: Curve to mesh node inconsistent edge vertex order
Though the edge vertices aren't really meant to have an order,
it can make a difference in operations when there isn't any other
information to make decisions from, like etruding a circle of
loose edges (the situation in the report). This commit changes
the order of the vertices in the final cyclic edge to go in the
same direction as all of the other edges.
2022-01-27 11:21:07 -06:00
834b966b41 Fix T95212: Mirror modifier normals crash
The vertex and face normals from the input mesh
were used to calculate the normals on the result,
which could cause a crash because the result should
be about twice as large.

Also remove an unnecessary dirty tag, since it is handled
automatically when creating a new mesh or in the case
of the mirror modifier, when calculating the new custom
face corner normals.
2022-01-27 11:02:10 -06:00
d7ac659e02 Cleanup: Clang tidy
Use nullptr, use named parameters, fix deprecated header
2022-01-27 10:53:53 -06:00
9c341153a2 Fix T95062: Outliner Library Overrides not refreshed when removing overrides.
Those operations were missing the necessary notification for the
Outliner. This was also affecting RNA API of liboverrides.
2022-01-27 17:52:09 +01:00
279a73e429 Fix: Complete transfer attribute input renaming
Complete the renaming from 6a16a9e661
to include variable names and warning messages.
2022-01-27 10:41:41 -06:00
32a96b80a3 Cleanup: Remove unused variables in winstuff.c
This clears up 4 unused variable warnings coming
from BLI_windows_register_blend_extension
2022-01-27 09:37:11 -07:00
25ac6aa5e4 Fix T85233: Transfer Weights tooltip is wrong.
Swap "active" and "selected" in the tooltip if the `use_reverse_transfer`
option is activated.

Reviewed By: mont29

Maniphest Tasks: T85233

Differential Revision: https://developer.blender.org/D13499
2022-01-27 17:21:01 +01:00
658ae5d63f DRW: Fix DRW_gpu_wrapper.hh
The UBYTE datatype is not supported by the clear fallback. Also fix vector
types headers.
2022-01-27 17:05:02 +01:00
Yevgeny Makarov
58e0aa36ea Fix T93766: 'New Collection' entry in 'Move to collection' menu is not translated.
Also fixes similar issues regarding some liboverride menu entries.

Reviewed By: mont29

Maniphest Tasks: T93766

Differential Revision: https://developer.blender.org/D13513
2022-01-27 16:51:14 +01:00
99ffe1153a install_deps: Downgrade python-ztandard to 0.16.0.
Higher version requires a new version of the ztandard library itself.

Ref. T93161/D13922.
2022-01-27 16:16:14 +01:00
6c483479b8 GLFramebuffer: Add assert to check if framebuffer has the expected data
It came to light that there is no error checking when trying to read
a framebuffer plane without anything attached to it.
2022-01-27 16:13:49 +01:00
Michael Kowalski
c85c52f2ce USD Preview Surface material export.
Add `USD Preview Surface From Nodes` export option, to convert a
Principled BSDF material node network to an approximate USD Preview
Surface shader representation. If this option is disabled, the original
material export behavior is maintained, where viewport setting are saved
to the Preview Surface shader.

Also added the following options for texture export.

  - `Export Textures`: If converting Preview Surface, export textures
    referenced by shader nodes to a 'textures' directory which is a
    sibling of the USD file.
  - `Overwrite Textures`: Allow overwriting existing texture files when
    exporting textures (this option is off by default).
  - `Relative Texture Paths`:  Make texture asset paths relative to the
    USD.

The entry point for the new functionality is
`create_usd_preview_surface_material()`, called from
`USDAbstractWriter::ensure_usd_material()`.  The material conversion
currently handles a small subset of Blender shading nodes,
`BSDF_DIFFUSE`, `BSDF_PRINCIPLED`, `TEX_IMAGE` and `UVMAP`.

Texture export is handled by copying texture files from their original
location to a `textures` folder in the same directory as the USD.
In-memory and packed textures are saved directly to the textures folder.

This patch is based, in part, on code in Tangent Animation's USD
exporter branch.

Reviewed By: sybren, HooglyBoogly

Differential Revision: https://developer.blender.org/D13647
2022-01-27 15:51:50 +01:00
d518550c46 Fix crash on older platform due to unsupported clear command
Clearing using GPU_texture_create_2d for unorm texture needs to use
GPU_DATA_FLOAT to match the conversion requirements.
2022-01-27 15:50:38 +01:00
aa2164da33 Cleanup: Fix const correctness warning 2022-01-27 15:26:43 +01:00
5730668dea Downgrade Python zstandard module to 0.16.0
Downgrade the Python zstandard from 0.17.0 to 0.16.0. The Python package
should be linked against the exact same version of libzstd as Blender is,
otherwise it will refuse to load from within the Blender executable.

Python zstandard 0.17.0 links to 1.5.1, whereas we need 1.5.0.
2022-01-27 15:10:05 +01:00
8a20aec403 CMake/Linux/Python:copy either chardet or charset_normalizer
`chardet` was replaced by `charset_normalizer` for modern `requests`.
With this change, `{make,ninja} install` will also copy the latter into
Blender's install directory.
2022-01-27 15:10:05 +01:00
5400018106 Build: enable Python 3.10 on macOS 2022-01-27 15:03:11 +01:00
6f1ab97c53 Cleanup: Add more const correctness to some functions
These are functions that are used by eevee-rewrite which has more strict
const correctness.
2022-01-27 14:59:37 +01:00
78f29c0467 cmake/windows: Enable Python 3.10 2022-01-27 06:57:25 -07:00
0379ddac7d GPUShaderCreateInfo: Add optionnal check for optimized out resources
This opt-in functionnality enabled developper keep track of unused
resources present in the `GPUShaderCreateInfo` descriptors of their
shaders.

The output is pretty noisy at the moment so we do not enforce its usage.
2022-01-27 10:30:06 +01:00
cf31c4ba18 install_deps: Update OSL to 1.11.17.0 for llvm13 compatibility.
While install_deps tries to stay as close as possible from official
Blender versions of the libraries, it also strives to use as many distro
packages as possible.

OSL 1.11.16.0 is the minimal version that builds with llvm13, which is
the default llvm/clang version in e.g. Debian testing.
2022-01-27 09:06:50 +01:00
a99e43b2b7 install_deps: Update python and deps versions as per T93161/D13922. 2022-01-27 09:06:50 +01:00
5abab0a41a GPUShaderCreateInfo: Remove push_constant indexing
This is too much impractical and offers no real benefit.
2022-01-27 08:54:24 +01:00
a7f7b0b77e Deps builder: Python 3.10.2
Also included:

IDNA 3.2 -> 3.2
Charset Normalizer 2.0.6 -> 2.0.10
UrlLib3 1.26.7 -> 1.26.8
Requests 2.26.0 -> 2.27.1
Cython 0.29.24 -> 0.29.26
ZStandard 0.15.2 -> 0.17.0
Numpy 1.12.2 -> 1.22.0

Reviewed by: brecht
Differential Revision: https://developer.blender.org/D13922
2022-01-26 18:09:50 -07:00
1edf520439 Windows: Retire MSVC 2017 support
The lower bar for building blender
is now MSVC 2019 16.9.16.
2022-01-26 17:56:38 -07:00
0e86c60c28 Geometry Nodes: String to Curves Line/Pivot Point
Adds two new attribute outputs:
"Line" outputs the line number of the character.
"Pivot Point" outputs the selected pivot point position per char.
Some refactoring of the text layout code.

Differential Revision: https://developer.blender.org/D13694
2022-01-26 22:12:50 +01:00
bb1e2a80e4 Cleanup: Workbench: Remove extern shader strings
This is not needed anymore with the new dependency system.
2022-01-26 22:04:49 +01:00
710e46cb2d Cleanup: Move specific node tree execution functions into respective module
`node_exec` had some code that was specific to texture/shader nodes.
These functions  arent used outside there module so limit there declarations.

Also make a function static that is only used in `node_exec.c`

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13899
2022-01-26 15:29:31 -05:00
cab1f1d9a2 Geometry Nodes: Add or improve various socket descriptions 2022-01-26 14:22:23 -06:00
7b615ca186 Cleanup: Remove RNA data from TreeElement, get via type specific class
The `TreeElement.rnaptr` was only needed for RNA tree-elements. Now it
can be gotten through the new type specific classes, e.g.
`TreeElementRNAProperty.getPointerRNA()`.
2022-01-26 19:15:57 +01:00
9dc0379dc0 Cleanup: Improve function name, introduced in own recent commit
I prefer it this way around now, especially since I'm adding a
`getPointerRNA()` too. Good to keep it match the actual struct names.
2022-01-26 19:15:57 +01:00
f6296e502a Cleanup: Small improvements to Outliner RNA path build function
Smaller cleanups to improve readability of a complex function.
2022-01-26 19:15:57 +01:00
fdd84d36ce Fix incorrect index-key in RNA path built from Outliner
Bug introduced in 7cbcfb7f49.
2022-01-26 19:15:57 +01:00
b57db4b79e Cleanup: Reduce void * reliance of new RNA C++ Outliner elements
Continuation of the previous commit, this time addressing the same for
RNA tree-elements.
2022-01-26 19:15:57 +01:00
fc0dd5583c Cleanup: Reduce void * reliance of new sequencer C++ Outliner elements
Plan is to remove things like `TreeElement.directdata` and to instead
expose specific queries in the new type specific tree-element classes.
e.g. like here: `TreeElementSequence.getSequence()`

For now uses `tree_element_cast<>()` to get the new type specific
tree-element, later these should replace `TreeElement` all together.
2022-01-26 19:15:57 +01:00
08e2885796 Outliner: Function to "cast" C-style TreeElement to typed C++ pendant
Add function to safely request the type-specific C++ element from a
C-style `TreeElement`. Looks like this:
```
TreeElementFoo *te_foo = tree_element_cast<TreeElementFoo>(te);
```
The "cast" will return null if the tree-element doesn't match the
requested type.

This is useful for the transition from the C-style type to the new ones.
2022-01-26 19:15:57 +01:00
da1b6c4c02 Outliner: Port sequencer elements to new tree-element design
Continuation of work started in 2e221de4ce and 249e4df110.

Adds new tree-element classes for sequences, strips and strip
duplicates.
2022-01-26 19:15:57 +01:00
d74c2b5c1f Outliner: Add missing sanity checks for RNA tree-elements
Forgot to add these in 9bce134e56. Also tweaked assert to print a
message that was previously communicated via a comment only.
2022-01-26 19:15:57 +01:00
57dfec79f4 DRW: Fix builtin uniform name mismatch
This lead to severe unreported regression, like volume rendering broken
in workbench.
2022-01-26 19:09:05 +01:00
13f2df3c28 Fix/workaround failing Cycles tests on macOS after ray offset changes
Temporarily blacklist a few tests with overlapping objects as they seem to
give different results on this platform.
2022-01-26 18:52:56 +01:00
489b484b7b Cleanup: GPUShaderShared: Complete vector support
Move some declaration from `GPU_shader_shared.h` to the main
common file and add missing vector declarations.
2022-01-26 18:10:59 +01:00
b42adab3a2 GPUShader: Add GLSL source modification pass to support enums
This uses a light parser / string modification pass to convert
C++ enum declaration syntax to GLSL compatible one.

GLSL having no support for enums, we are forced to convert the
enum values to a series of constant uints.

The parser (not really one by the way), being stupidly simple,
will not change anything to the values and thus make some C++
syntax (like omitting the values) not work.

The string replacement happens on all GLSL files on startup.
I did not measure significant changes in blender startup speed.
There is plans to do all of this at compile time.

We limit the scope of the search to `.h` and `.hh` files to prevent
confusing syntax in `.glsl` files.

There is basic error reporting with file, line and char logging
for easy debuggabiliy.

The requirements to use this enum sharing system are already listed in
`gpu_shader_shared_utils.h` and repeated on top of the preprocessor
function.
2022-01-26 18:10:59 +01:00
e729abb0e2 BLI_string_ref: Add back missing rfind()
Must have been removed in a bad merge or something.
2022-01-26 18:10:59 +01:00
William Leeson
74afc86d4b Cycles: remove ray offsetting
Remove small ray offsets that were used to avoid self intersection, and leave
that to the newly added primitive object/prim comparison. These changes together
significantly reduce artifacts on small, large or far away objects.

The balance here is that overlapping primitives are not handled well and should
be avoided (though this was already an issue). The upside is that this is
something a user has control over, whereas the other artifacts had no good
manual solution in many cases.

There is a known issue where the Blender particle system generates overlapping
objects and in turn leads to render differences between CPU and GPU. This will
be addressed separately.

Differential Revision: https://developer.blender.org/D12954
2022-01-26 17:51:05 +01:00
William Leeson
ae44070341 Cycles: explicitly skip self-intersection
Remember the last intersected primitive and skip any intersections with the
same primitive.

Ref D12954
2022-01-26 17:51:05 +01:00
William Leeson
a9bb460766 Cycles: compute triangle location from barycentric instead of re-intersecting
This is a bit more efficient than what we did before.

Ref D12954
2022-01-26 17:51:05 +01:00
974981a637 Fix T95222: Crash selecting vertices with modifier applied on cage
Caused by 0f89bcdbeb where it was needed for cage and evaluated mesh
to have same behavior in respect of having edit_mesh pointer assigned.
This change makes it so that edit_data is not implied to exist when the
edit_mesh pointer is not null. This was already the case in some other
code.
2022-01-26 17:48:45 +01:00
79927e730e LibOverride: Resync: Do not process overrides that should already have been resynced.
Those cases are almost always synptoms of either bug in code, or broken
files. Re-doin resync on them only costs time and causes extra trash
data as a result, without really helping in any way.
2022-01-26 16:20:08 +01:00
990ed109f2 Fix (unreported) missing 'override-exclusion' flag on new RNA mesh data accessors.
Both new normals (from rBb7fe27314b25) and vpaint (from rBf7bbc7cdbb6c)
RNA arrays were missing the `PROPOVERRIDE_IGNORE`. Those huge blobs of
geometry data should never be processed by liboverride code.
2022-01-26 16:20:08 +01:00
37848d1c8e Assets: enable node group assets
This enables support for node group assets. Previously, node group
assets only worked when the "extended asset browser" experimental
features is enabled.

Differential Revision: https://developer.blender.org/D13748
2022-01-26 15:22:15 +01:00
12b26d21b0 Assets: allow creating preview image by rendering active object
For node groups there is no good default preview generation.
Nevertheless, t would be useful to generate a preview image for a
node group by rendering an object in some cases.

This commit adds a new operator that allows updating the preview
image for the active asset by rendering the active object.
Note, the operator can also be used for other asset types, not just
node groups.

The operator can be found in a menu right below the refresh-preview
button. Currently it is the only operator in that menu. In the future,
more operators to create previews may be added.

Differential Revision: https://developer.blender.org/D13747
2022-01-26 15:10:49 +01:00
6738ecb64e Fix T94900: Fix drawing artifacts sequencer+node editor.
The VSE and node editor only uses an overlay buffer to draw to the screen. The
GPUViewport assumes that platforms clears all textures during creation, but
they do not on selected platforms. What would lead to drawing from
uncleared memory.

This patch fixes this by clearing all viewport textures during creation.
2022-01-26 14:48:28 +01:00
5b299e5999 D13910: Workbench: Port shaders to use GPUShaderCreateInfo
Also adds a few things to GPUShader for easily create shaders.
Heavy usage of macros to compose the createInfo and avoid
duplications and copy paste bugs.
This makes the link between the shader request functions
(in workbench_shader.cc) and the actual createInfo a bit
obscure since the names are composed and not searchable.

Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D13910
2022-01-26 12:46:37 +01:00
9bce134e56 Outliner: Port RNA elements to new tree-element design
Continuation of work started in 2e221de4ce and 249e4df110.

Adds new tree-element classes for RNA structs, properties and array
elements. This isn't exactly a copy and paste, even though logic should
effectively be the same. Further cleanups are included to share code in
a nice way, improve code with simple C++ features, etc.
2022-01-26 11:44:58 +01:00
1bf6a880ab ID: Fix failing test cases.
This fixes failing test cases when using `make test`.
See {D13615} for more information.

The fix will perform the id remapping one item at a time. Although not
really nice, this isn't a bottleneck.

The failing test cases is because space_node stores pointers multiple
times and didn't update all pointers. It was not clear why it didn't do
it, but changing the behavior more to the previous behavior fixes the
issue at hand.

I prefer to remove the double storage of the node tree pointers (in
snode and path) to reduce pointer management complexity.
2022-01-26 11:12:52 +01:00
Jeroen Bakker
a21bca0e20 Performance: Remap multiple items in UI
During sprite fright loading of complex scenes would spend a long time in remapping ID's
The remapping process is done on a per ID instance that resulted in a very time consuming
process that goes over every possible ID reference to find out if it needs to be updated.

If there are N of references to ID blocks and there are M ID blocks that needed to be remapped
it would take N*M checks. These checks are scattered around the place and memory.
Each reference would only be updated at most once, but most of the time no update is needed at all.

Idea: By grouping the changes together will reduce the number of checks resulting in improved performance.
This would only require N checks. Additional benefits is improved data locality as data is only loaded once
in the L2 cache.

It has be implemented for the resyncing process and UI editors.
On an Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz 16Gig the resyncing process went
from 170 seconds to 145 seconds (during hotspot recording).

After this patch has been applied we could add similar approach
to references (references between data blocks) and functionality (tagged deletion).
In my understanding this could reduce the resyncing process to less than a second.
Opening the village production file between 10 and 20 seconds.

Flame graphs showing that UI remapping isn't visible anymore (`WM_main_remap_editor_id_reference`)
* Master {F12769210 size=full}
* This patch {F12769211 size=full}

Reviewed By: mont29

Maniphest Tasks: T94185

Differential Revision: https://developer.blender.org/D13615
2022-01-26 11:12:35 +01:00
b3bf46b78d Revert "CMake: include BROTLI_LIBRARIES in FREETYPE_LIBRARIES on UNIX"
This reverts commit 086f191169.

There was apparently a problem using APPEND which wasn't referenced
in the commit log.

Added comment noting the reason for the discrepancy.
2022-01-26 20:51:04 +11:00
0cb5eae9d0 Gizmo: optimize intersection tests, fix selection bias
Use more efficient logic for detecting when gizmos are under the cursor.
Even though this isn't a bottleneck, it runs on cursor motion in the
3D viewport, so avoiding any lag here is beneficial.

The common case for cursor motion without any gizmos was always
drawing two passes (one small, then again if nothing was found).

Now a single draw call at the larger size is used.

In isolation this gives around 1.2x-1.4x speedup.

When there are multiple gizmos a depth-buffer picking is used
(similar to object / bone selection) which is more involved but
still only performs 2x draw calls since the result is cached for reuse.

See note in gizmo_find_intersected_3d for a more detailed explanation.

Also restore the depth values in the selection result as they're
needed for gizmos to use selection bias.
Broken since support for GL_SELECT was removed.
2022-01-26 17:24:21 +11:00
1758dcd423 Fix T94794: Gizmo selection doesn't pick the front-most gizmo
Early on in 2.8x development gizmo-depth used GL_SELECT,
which has been removed. Bind the depth buffer so occlusion queries
use the front-most gizmo.

While this report only mentions face-maps, gizmo depth was ignored in
all cases. This wasn't noticeable in most cases though since the
transform gizmo for example was placed so gizmos didn't overlap.
2022-01-26 17:21:10 +11:00
9338126ecc Fix error using GPU selection cache for selection picking
When calling GPU_select_cache_begin, checking the selection mode used
the last used selection mode, not the one about to be used.

Using border select, then picking would not use the selection cache.

This wasn't noticeable by users as failing to use cache just completes
the selection without it (drawing the depth buffer unnecessarily).
2022-01-26 17:21:10 +11:00
46ae083113 Fix: OSL not recognizing UVTILE images
The OSL image compilation step needed to be taught about the new UVTILE
format for UDIM textures.

A small missing feature from OIIO[1] means this is a bit uglier than it
needs to be. Once we update to a version of OIIO with the fix we can
remove the string replace part.

[1] 35cb6a83e2

Differential Revision: https://developer.blender.org/D13912
2022-01-25 22:00:23 -08:00
b06fff4737 Cleanup: spelling in comments 2022-01-26 16:06:22 +11:00
94d2a611ec Cleanup: unused variable warning, formatting 2022-01-26 16:01:34 +11:00
37e555d2fe CMake: mark all BROTLI libraries as advanced 2022-01-26 16:01:00 +11:00
086f191169 CMake: include BROTLI_LIBRARIES in FREETYPE_LIBRARIES on UNIX
This was already done for APPLE & WIN32, which would
reference these libraries twice.

Now append BROTLI_LIBRARIES to FREETYPE_LIBRARIES when they're
required for linking.

No functional changes as all references to FREETYPE_LIBRARIES also
used BROTLI_LIBRARIES.
2022-01-26 16:00:55 +11:00
4c951bfa82 CMake: add WITH_SYSTEM_FREETYPE to link against the systems freetype 2022-01-26 15:31:30 +11:00
4530449317 CMake: resolve issues using pre-compiled & system libraries for Unix
When LIBDIR existed, searching for system libraries would always
first search 'LIBDIR'.

This meant "WITH_SYSTEM_*" would still prefer LIBDIR versions of
libraries if they exist.

The presence of LIBDIR also ignored the setting for WITH_STATIC_LIBS
which is now restored to the cached value once pre-compiled libraries
have been handled.
2022-01-26 15:20:32 +11:00
c4bedeb018 GLShader: Fix crash caused by redundant uniform declaration
This slipped through during a rebase.
2022-01-26 00:03:27 +01:00
83094d9a0d Fix T94149: Incorrect sound strip length
Fix formula in function `SEQ_sound_update_length`.

Formula for sound strip length was changed in commit ded68fb102, when
strip is added to timeline, but it was not changed in function
mentioned above.
2022-01-25 23:59:50 +01:00
c1b5cea63a Cleanup: Remove useless comments 2022-01-25 16:54:36 -06:00
b45e71e22c VSE: Build proxies only for slow movies
This change applies only for automatic proxy building, when strip
is added to timeline. Manual building process is not affected.

Don't build proxy file if movie is already fast enough to seek.
To determine seek performance, check if whole GOP can be decoded
in 100 milliseconds.

To consider some variation in GOP size, large number of packets are
read, assuming that each packet will produce 1 frame. While this is not
technically correct, it does give quite accurate estimate of maximum GOP
size.

This test will ensure consistent performance on wide array of machines.
Check should be done in order of few milliseconds.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11671
2022-01-25 22:06:46 +01:00
597eaeaa11 Deps builder: add VS2019, remove 2013/2015 support
This will allow building most deps with VS2019
SDL has some linker issues that are resolved in
a newer version, but that would be better handled
in a separate change.

VS2013 and VS2015 support which was broken has
been removed.
2022-01-25 13:55:18 -07:00
52b2769b9c Fix T95169: Assert in weld modifier code
Return early before accessing the array when all edges are merged.
2022-01-25 13:56:00 -06:00
c847122096 Cleanup: Remove leftover hair fade code in Cycles
Missed in rB1687903fb813f6656453fbc7c49237b06437370c
2022-01-25 14:14:39 -05:00
1687903fb8 Cleanup: Remove leftover hair fade code in Cycles. 2022-01-25 19:46:10 +01:00
c89d6b0953 Workbench: Use GPU_ARB_gpu_shader5 instead of GL variant
This is to be able to turn off the extension usage on demand.
2022-01-25 18:51:31 +01:00
2637f94358 GLShader: Fix buffer overflow caused by workaround uniform
In order to use a workaround builtin uniform, we need to count it
just like other uniforms and give it some space in the name buffer.

This also fixes extensions being added after the uniform declaration.
All `#extension` directives are now part of the gl backend.
2022-01-25 18:48:58 +01:00
3e2591c83e Cleanup: Remove unused variable
Mistake in a18bd403bf
2022-01-25 11:08:34 -06:00
0ec94d5359 Geometry Nodes: Port weld modifier to the merge by distance node
This commit moves the weld modifier code to the geometry module
so that it can be used in the "Merge by Distance" geometry node
from ec1b0c2014. The "All" mode is exposed in the node
for now, though we could expose the "Connected" mode in the future.

The modifier itself is responsible for creating the selections from
the vertex group. The "All" mode takes an `IndexMask` for the
selection, and the "Connected" mode takes a boolean array,
since it actually iterates over all edges.

Some disabled code for a BVH mode has not been copied over,
it's still accessible through the patches and git history anyway,
and it made the port slightly simpler.

Differential Revision: https://developer.blender.org/D13907
2022-01-25 11:07:31 -06:00
932d8dba52 Point Cloud: expose in Python API for release, now that Cycles uses it
Previously it was only part of experimental features in beta, however now
renderers can render point clouds generated by geometry nodes. Adding or
converting a point cloud object directly is still hidden by default, since
there is no good way to edit it.
2022-01-25 18:03:52 +01:00
ec1b0c2014 Geometry Nodes: Initial merge by distance node
This implements a merge by distance operation for point clouds.
Besides the geometry input, there are two others-- a selection
input to limit the operation to certain points, and the merge
distance. While it would be a reasonable feature, the distance
does not support a field currently, since that would make
the algorithm significantly more complex.

All attributes are merged to the merged points, with the values
mixed together. This same generic method is used for all attributes,
including `position`. The `id` attribute uses the value from the
first merged index for each point.

For the implementation, most of the effort goes into creating a
merge map to speed up attribute mixing. Some parts are inherently
single-threaded, like finding the final indices accounting for the
merged points. By far most of the time is spend balancing the
KD tree.

Mesh support will be added in the next commit.

Differential Revision: https://developer.blender.org/D13649
2022-01-25 10:51:52 -06:00
97a023a0d5 Cycles: Reorganize Acceleration Structure UI panel.
Only show options that are valid for the used device (CPU, GPU, Multi).

Note: The panel isn't shown for OPTIX anymore, unless Multi device is used.

Reference: https://developer.blender.org/D13592
2022-01-25 17:33:41 +01:00
e2a36a6e45 Cycles: Make Embree compact BVH optional
Make the Embree RTC_SCENE_FLAG_COMPACT flag optional and enabled per default.
Disabling it makes CPU rendering a bit faster in some scenes at the cost of a higher memory usage.

Barbershop renders about 3% faster, victor about 4% on CPU with compact BVH disabled.

Differential Revision: https://developer.blender.org/D13592
2022-01-25 17:22:08 +01:00
f26c36c96b make.bat: unify python detection
Several sub commands tried on their own
to locate python, given I wanted to look
in several locations for a broader libdir
compatibility this is best done in a
central location.

Python 3.9 is still preferred, but if
3.10-3.12 are available that be accepted
as well.

note: this is about the python version
make.bat uses to run various python helper
scripts, this change has no influence on
the python version blender itself uses.
2022-01-25 09:19:03 -07:00
c813a1b358 Cycles: add Point Info node
With (center) position, radius and random value outputs.

Eevee does not yet support rendering point clouds, but an untested
implementation of this node was added for when it does.

Ref T92573
2022-01-25 17:14:20 +01:00
eab066cbf2 VSE: Use timecodes by default
Movies with variable frame rate can cause mismatch of displayed frame
when proxies are used. Since proxies are not used for rendering, this
means, that output may be different than expected. This problem can be
avoided when timecodes are used.

Set used timecode to Record Run. Timecodes are built with proxies at
the same time, therefore if proxies are built and used this will
resolve possible mismatch of output.

Record run is chosen, because it will show frames based on time they
were encoded by encoder and should match behavior as if movie was
played back at normal speed. This change is done only for new strips
in order to not overwrite user defined settings.

Other minor changes:
- When proxies are enabled, size 25% is no longer set by default. It was mostly annoying anyway.
- Silence warning when timecode file is not present. This was introduced in 4adbe31e2f.
  Previously use of timecodes was hard-coded in sequencer and this error would spam console if timecodes would be
  enabled by default and proxies would be never built.

ref: T95093

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13905
2022-01-25 17:07:11 +01:00
Michael
2ed73fc97e Fix T94237: Glitch when copying unaligned ffmpeg buffer
Using a negative linesize to flip an image vertically is supported in
ffmpeg but not for every function.

This method treats frames that need and those that do not need alignment
the same. An RGBA frame buffer with alignment that ffmpeg decides is
optimal for the CPU and build options is allocated by ffmpeg.
The `sws_scale` does the colorspace transformation into this RGBA frame
buffer without flipping. Now the image is upside down and aligned.
The combined unaligning and vertical flipping is then done by
`av_image_copy_to_buffer` which seems to handle negative linesize
correctly.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D13908
2022-01-25 17:07:11 +01:00
a18bd403bf Nodes: Improve link-drag search support for boolean math node
List the operations in the search instead of the "Boolean" socket names.
2022-01-25 09:51:20 -06:00
96667e3391 Fix T93058: Crash on opening old pre-2.80 .blend files.
Layer resync code would not yet fully properly deal with all possible
invalid status of ViewLayer comming from those older files.

Now put 2.80-doversion specific fixes into their own dedicated
function, so that they do not affect actual regular layer resync code
anymore. Also added some sanity-checks in main
`BKE_layer_collection_sync` code.
2022-01-25 16:44:55 +01:00
6c25aabddf GLShader: Fix fallback to gl_BaseInstance
All `#entension` directives needs to be first before any other
token. Add missing `;` after uniform declaration.
2022-01-25 16:23:54 +01:00
0477ca75f0 CMake/Linux: only link to brotli when using static precompiled libraries
The Brotli library only needs to be explicitly linked when using the
statically linked libraries. When using system libs they're shared, and
the .so loading mechanism takes care of dependencies.
2022-01-25 16:18:59 +01:00
Hallam Roberts
14f6afb090 Geometry Nodes: Expand the Boolean Math node
Currently the Boolean Math node only has 3 basic logic gates:
AND, OR, and NOT. This commit adds 6 additional logic gates
for convenience and ease of use.

- **Not And (NAND)** returns true when at least one input is false.
- **Nor (NOR)** returns true when both inputs are false.
- **Equal (XNOR)** returns true when both inputs are equal.
- **Not Equal (XOR)** returns true when both inputs are different.
- **Imply (IMPLY)** returns true unless the first input is true and
  the second is false.
- **Subtract (NIMPLY)** returns true when the first input is true and
  the second is false.

Differential Revision: https://developer.blender.org/D13774
2022-01-25 09:09:39 -06:00
368bfa80f9 Fix: Build issue with MSVC + Python 3.10
ssize_t is a posix type pyconfig.h previously
supplied for MSVC, it appears to have stopped
doing this in the python 3.10 headers.

Py_ssize_t is the type of the field this macro
actually returns, so best to to use that in our
code as well.
2022-01-25 07:54:28 -07:00
460e0a1347 Revert "Performance: Remap multiple items in UI"
This reverts commit 948211679f.
This commit introduced some regressions in the test suite.
As this change is a core part of blender Bastien and I decided to revert
it as the solution isn't clear and needs more investigation.

The following tests FAILED:
	 62 - blendfile_liblink (SEGFAULT)
	 63 - blendfile_library_overrides (SEGFAULT)

It fails in (id_us_ensure_real)
2022-01-25 15:31:46 +01:00
33ba298b5d GPUShader: Add optionnal single shader stage interface for in and out
This makes optionnal the use of a different interface for the geometry
shader stage output. When the vertex and geometry interface instance name
matches, a `_in` and `_out` suffix is added to the end of the instance name.

This makes it easier to have optional geometry shader stages.

# Conflicts:
#	source/blender/gpu/intern/gpu_shader_create_info.hh
2022-01-25 15:08:11 +01:00
Jeroen Bakker
948211679f Performance: Remap multiple items in UI
During sprite fright loading of complex scenes would spend a long time in remapping ID's
The remapping process is done on a per ID instance that resulted in a very time consuming
process that goes over every possible ID reference to find out if it needs to be updated.

If there are N of references to ID blocks and there are M ID blocks that needed to be remapped
it would take N*M checks. These checks are scattered around the place and memory.
Each reference would only be updated at most once, but most of the time no update is needed at all.

Idea: By grouping the changes together will reduce the number of checks resulting in improved performance.
This would only require N checks. Additional benefits is improved data locality as data is only loaded once
in the L2 cache.

It has be implemented for the resyncing process and UI editors.
On an Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz 16Gig the resyncing process went
from 170 seconds to 145 seconds (during hotspot recording).

After this patch has been applied we could add similar approach
to references (references between data blocks) and functionality (tagged deletion).
In my understanding this could reduce the resyncing process to less than a second.
Opening the village production file between 10 and 20 seconds.

Flame graphs showing that UI remapping isn't visible anymore (`WM_main_remap_editor_id_reference`)
* Master {F12769210 size=full}
* This patch {F12769211 size=full}

Reviewed By: mont29

Maniphest Tasks: T94185

Differential Revision: https://developer.blender.org/D13615
2022-01-25 14:51:44 +01:00
Jeroen Bakker
3f42417cd4 Draw: Migrate hair refine compute shader to use create info.
This patch migrates the draw manager hair refine compute shader to use
GPUShaderCreateInfo.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13915
2022-01-25 14:46:45 +01:00
196da819ba Python: Expose crazyspace correction functionality via RNA
Allows to perform correction of coordinate delta/displacement in a
similar way of how sculpt mode handles sculpting on a deformed mesh.
An example of usecase of this is allowing riggers and sciprters to
improve corrective shapekey workflow.

The usage consists of pre-processing and access. For example:

  object.crazyspace_eval(depsgraph, scene)

  # When we have a difference between two vertices and want to convert
  # it to a space to be stored, say, in shapekey:
  delta_in_orig_space = rigged_ob.crazyspace_displacement_to_original(
      vertex_index=i, displacement=delta)

  # The reverse of above.
  delta_in_deformed_space = rigged_ob.crazyspace_displacement_to_deformed(
      vertex_index=i, displacement=delta)

  object.crazyspace_eval_clear()

Fuller explanation with actual usecases and studio examples are written in
the comment:

  https://developer.blender.org/D13892#368898

Differential Revision: https://developer.blender.org/D13892
2022-01-25 14:43:44 +01:00
31296f6f9d CMake/Linux: Fix Brotli library finding on standard distros.
Brotli seems to add a custom postfix to its static libraries by default,
but in Debian at least libraries are just named the same for both shared
and static versions, as usual.

So add standard name after static-specific ones.

Follow-up to rB4c617c06e9cb and rBa000de7c2a4d.
2022-01-25 14:34:33 +01:00
0f89bcdbeb Fix depsgraphs sharing IDs via evaluated edit mesh
The evaluated mesh is a result of evaluated modifiers, and referencing
other evaluated IDs such as materials.
It can not be stored in the EditMesh structure which is intended to be
re-used by many areas. Such sharing was causing ownership errors causing
bugs like

  T93855: Cycles crash with edit mode and simultaneous viewport and final render

The proposed solution is to store the evaluated edit mesh and its cage in
the object's runtime field. The motivation goes as following:

- It allows to avoid ownership problems like the ones in the linked report.
- Object level is chosen over mesh level is because the evaluated mesh
  is affected by modifiers, which are on the object level.

This patch allows to have modifier stack of an object which shares mesh with
an object which is in edit mode to be properly taken into account (before
the change the modifier stack from the active object will be used for all
objects which share the mesh).

There is a change in the way how copy-on-write is handled in the edit mode to
allow proper state update when changing active scene (or having two windows
with different scenes). Previously, the copt-on-write would have been ignored
by skipping tagging CoW component. Now it is ignored from within the CoW
operation callback. This allows to update edit pointers for objects which are
not from the current depsgraph and where the edit_mesh was never assigned in
the case when the depsgraph was evaluated prior the active depsgraph.

There is no user level changes changes expected with the CoW handling changes:
should not affect on neither performance, nor memory consumption.

Tested scenarios:

- Various modifiers configurations of objects sharing mesh and be part of the
  same scene.

- Steps from the reports: T93855, T82952, T77359

This also fixes T76609, T72733 and perhaps other reports.

Differential Revision: https://developer.blender.org/D13824
2022-01-25 14:32:23 +01:00
c5980ada4f GPU: Add GPU_shader_create_from_info_name
This function will be used as the way to build shaders from
create_infos. The previous used method was using a private function.
2022-01-25 14:22:44 +01:00
Kevin C. Burke
17b0c06946 Animation: Equalize Handle Operator
The Equalize Handles operator allows users to make selected handle
lengths uniform: either respecting their original angle from the key
control point or by flattening their angle (removing the overshoot
sometimes produced by certain handle types).

Design: T94172

Reviewed by: sybren

Differential Revision: https://developer.blender.org/D13702
2022-01-25 11:41:40 +01:00
a000de7c2a CMake/Linux: find Brotli library the proper way
Use a `FindBrotli.cmake` module instead of manually appending library
paths.

This is just for Linux; Windows and macOS will be reviewed separately.
2022-01-25 11:34:13 +01:00
a54142f3f1 Cleanup: Replace reinterp cast with static cast.
Conversion of void* should not use the unsafe reinterp cast.
2022-01-25 10:18:32 +01:00
1b1693d43f Fix (unreported) RNA setter for TextEditor's text ID pointer not ensuring real user. 2022-01-25 09:12:13 +01:00
2e9b8689e4 Fix T95037: Allow making local IDs that are not used by anything.
Some IDs (like text ones) can be linked and only kept around thanks to
editors, allow making such IDs local in `BKE_lib_id_make_local_generic`.

Also refactor logic checking whether ID should be made directly local or
copied into its own util function, so that we can remain sure all
special-cases 'make local' code still uses the same logic here.
2022-01-25 09:12:13 +01:00
a2301b1d91 Geometry Nodes: Add description to curve handle input node
The "Relative" input isn't immediately obvious unless one is familar
with that naming pattern, so an explicit description may be helpful.
2022-01-25 00:04:33 -06:00
114b06b3cb Cleanup: Remove unused pixel buffer in read_render_tile
A left over remnant from rB1a134c4c30a643ada1b9a7a037040b5f5c173a28

Differential Revision: https://developer.blender.org/D13901
2022-01-24 20:53:19 -08:00
2bf519d211 Cleanup: Correct location of node function declarations
Currently there are many function declarations in `BKE_node.h` that
don't actually have implementations in blenkernel. This commit moves
the declarations to `NOD_composite.h`, `NOD_texture.h`, and
`NOD_shader.h` instead. This helps to clarify the purpose of the
different modules.

Differential Revision: https://developer.blender.org/D13869
2022-01-24 16:18:30 -06:00
4d799db72f LShaderInterface: Fix interface binding with UBO containing arrays
To avoid the issue we search using the name in the `name_buffer_` which
already have the array suffix stripped out.
2022-01-24 21:25:53 +01:00
5a0c5912a4 Tests: Enable new tests for geometry nodes extrude node
rB95981c9876483256b28
2022-01-24 13:55:32 -06:00
083de503ce GLShaderInterface: Fix interface from createInfo not setting bindings
This is because the `glUniform1i` calls were not preceeded by `glUseProgram`
which made parameters not stick.
2022-01-24 20:26:33 +01:00
04c3b08518 Fix T94355: Cycles wrong GPU bake with adaptive sampling 2022-01-24 19:18:11 +01:00
263f862ba5 Add workaround for broken interface query functions on Intel HD Graphics 4400 and 4600
Fixes T93680

For current drivers of Intel HD Graphics 4400 and 4600, various Program Introspection functions appear broken and return incorrect values, causing crashes in the current handling of SSBOs. Disable use of this feature on those devices. Add checks to features that use SSBOs (Hair and Subdivision Modifier).

Reviewed By: fclem, jbakker

Maniphest Tasks: T93680

Differential Revision: https://developer.blender.org/D13806
2022-01-24 18:48:16 +01:00
e2337b5342 GPU subdiv: reduce memory usage for point IBO
The point IBO should only have data for coarse vertices (or in general,
the vertices in the original mesh). As it used for displaying the
vertices for selection in edit mode, and as it indexes into the VBOs for
the positions and edit data, it is itself only indexed by coarse/
original vertex index.

For the subdivision case, this would allocate space for the final
subdivision vertex and reallocate to make room for loose geometry,
although only the first coarse vertex count amount of data would be.

Now just allocate for the required memory. Also reuse index buffer APIs
instead of doing manual work.
2022-01-24 18:42:37 +01:00
90d61600fc GPU subdiv: fix unitialized data 2022-01-24 18:27:05 +01:00
Jens Ehrhardt
e673cfc2d7 Fix T95099: Have launcher wait for Blender exit
unity launches blender in background mode to do some
file conversions, ever since the launcher got introduced
this process broke.

The root cause here is: Unity looks up the default program
to launch .blend files with, which is now the launcher, then
launches it in background mode with a script to export the data.

The launcher however was designed to exit as quickly as
possible so there would not be an extra background process
lingering. It does not wait for blender to exit and does not
pass back any error codes.

This broke unity's workflow since it assumed if the process
exits and succeeds the data *must* be ready for reading which
no longer holds true.

This change keeps the launcher design as was previously,
*except* when launching in background mode, then it
waits and passes back any error codes, thus restoring
unity's workflow.

Differential Revision: https://developer.blender.org/D13894
Reviewed by: LazyDodo, Brecht
2022-01-24 08:43:38 -07:00
25fa5792e6 Cleanup: Move the "toggle smooth brush" functionality to functions
This is so it will be easier to keep the logic to toggle on/off in sync
because they are declared close to eachother.
2022-01-24 16:00:01 +01:00
a215d7e230 Hook up invert and smooth mode to weight and vertex paint
Previously weight paint wasn't hooked up to the "Smooth" and "Invert" modes.
With this patch it is not possible to use the "Smooth" and "Invert"
modifiers for the draw keybindings.

Reviewed By: Campbell Barton

Differential Revision: http://developer.blender.org/D13857
2022-01-24 16:00:01 +01:00
0928fe8710 Fix T94651: Cycles error with pointcloud vector attribute 2022-01-24 15:58:32 +01:00
4c617c06e9 Linux/CMake: link libbbrotli*.a along with new FreeType
Add `libbrotlidec-static.a` and `libbrotlicommon-static.a` to the CMake
`$FREETYPE_LIBRARIES` variable; they'll be required when the Linux libs
for the FreeType upgrade lands (D13448).

The order of libraries is different compared to the similar lines in the
Windows and Apple CMake files, to prevent linker errors on Linux.
2022-01-24 15:44:03 +01:00
796ef560b4 Fix Image.gl_touch not loading image.
Same fix as for {rBc09f61a9157ddee0e186db52fb7ac0f4cdae09da}
2022-01-24 15:32:04 +01:00
578baf95e0 Cleanup: Remove unused enum
The `SCULPT_TRANSFORM_DISPLACEMENT_INCREMENTAL` value is not actually
being used.

Keeping it in the code only complicates its readability.
2022-01-24 10:18:34 -03:00
e774f2c901 GPUShaderCreateInfo: Add manual validation of bindpoints
Some drivers/glsl compilers will not warn about multiple resources using
the same binding, creating silent errors.

This patch checks for this case and outputs a descriptive error message if
a particular createInfo merge error is founds.

Other validation can be added later.
2022-01-24 13:28:33 +01:00
7708a848c9 Cleanup: sort cmake file lists 2022-01-24 21:23:30 +11:00
4b1f243e4d Cleanup: sort struct forward declarations 2022-01-24 21:16:06 +11:00
f9b6a257bd Cleanup: clang-format 2022-01-24 21:15:25 +11:00
95981c9876 Geometry Nodes: Extrude Mesh Node
This patch introduces an extrude node with three modes. The vertex mode
is quite simple, and just attaches new edges to the selected vertices.
The edge mode attaches new faces to the selected edges. The faces mode
extrudes patches of selected faces, or each selected face individually,
depending on the "Individual" boolean input.

The default value of the "Offset" input is the mesh's normals, which
can be scaled with the "Offset Scale" input.

**Attribute Propagation**
Attributes are transferred to the new elements with specific rules.
Attributes will never change domains for interpolations. Generally
boolean attributes are propagated with "or", meaning any connected
"true" value that is mixed in for other types will cause the new value
to be "true" as well. The `"id"` attribute does not have any special
handling currently.

Vertex Mode
 - Vertex: Copied values of selected vertices.
 - Edge: Averaged values of selected edges. For booleans, edges are
   selected if any connected edges are selected.
Edge Mode
 - Vertex: Copied values of extruded vertices.
 - Connecting edges (vertical): Average values of connected extruded
   edges. For booleans, the edges are selected if any connected
   extruded edges are selected.
 - Duplicate edges: Copied values of selected edges.
 - Face: Averaged values of all faces connected to the selected edge.
   For booleans, faces are selected if any connected original faces
   are selected.
 - Corner: Averaged values of corresponding corners in all faces
   connected to selected edges. For booleans, corners are selected
   if one of those corners are selected.
Face Mode
 - Vertex: Copied values of extruded vertices.
 - Connecting edges (vertical): Average values of connected selected
   edges, not including the edges "on top" of extruded regions.
   For booleans, edges are selected when any connected extruded edges
   were selected.
 - Duplicate edges: Copied values of extruded edges.
 - Face: Copied values of the corresponding selected faces.
 - Corner: Copied values of corresponding corners in selected faces.
Individual Face Mode
 - Vertex: Copied values of extruded vertices.
 - Connecting edges (vertical): Average values of the two neighboring
   edges on each extruded face. For booleans, edges are selected
   when at least one neighbor on the extruded face was selected.
 - Duplicate edges: Copied values of extruded edges.
 - Face: Copied values of the corresponding selected faces.
 - Corner: Copied values of corresponding corners in selected faces.

**Differences from edit mode**
In face mode (non-individual), the behavior can be different than the
extrude tools in edit mode-- this node doesn't handle keeping the back-
faces around in the cases that the edit mode tools do. The planned
"Solidify" node will handle that use case instead. Keeping this node
simpler and faster is preferable at this point, especially because that
sort of "smart" behavior is not that predictable and makes less sense
in a procedural context.

In the future, an "Even Offset" option could be added to this node
hopefully fairly simply. For now it is left out in order to keep
the patch simpler.

**Implementation**
For the implementation, the `Mesh` data structure is used directly
rather than converting to `BMesh` and back like D12224. This optimizes
for large extrusion operations rather than many sequential extrusions.
While this is potentially more verbose, it has some important benefits:
First, there is no conversion to and from `BMesh`. The code only has
to fill arrays and it can do that all at once, making each component of
the algorithm much easier to optimize. It also makes the attribute
interpolation more explicit, and likely faster. Only limited topology
maps must be created in most cases.

While there are some necessary loops and allocations with the size of
the entire mesh, I tried to keep everything I could on the order of the
size of the selection rather than the size of the mesh. In that respect,
the individual faces mode is the best, since there is no topology
information necessary, and the amount of work just depends on the size
of the selection.

Modifying an existing mesh instead of generating a new one was a bit
of a toss-up, but has a few potential benefits:
 - Avoids manually copying over attribute data for original elements.
 - Avoids some overhead of creating a new mesh.
 - Can potentially take advantage of future ammortized mesh growth.
This could be changed easily if it turns out to be the wrong choice.

Differential Revision: https://developer.blender.org/D13709
2022-01-23 22:42:49 -06:00
46475b8e11 Cleanup: Grammar: its self vs. itself 2022-01-23 22:34:56 -06:00
43e3a33082 Cleanup: spelling in comments 2022-01-24 14:35:23 +11:00
c69a581c0b Cleanup: avoid positional struct initialization
When moving to C++ field for initialization was removed.
Favor assignments to field names as it reads better and avoids bugs if
files are ever re-arranged as well as mistakes (see T94784).

Note that the generated optimized output is identical with GCC11.
2022-01-24 14:27:16 +11:00
abf30007ab Geometry Nodes: Triangulate Node - Add Selection Input
This adds a selection field input to the node, faces that are selected and
meet the minimum vertex count threshold will be triangulated.

Differential Revision: https://developer.blender.org/D13804
2022-01-23 13:27:53 -06:00
38c7378949 Geometry Nodes: Relative Handle Position Mode
Add a boolean option to have the Curve Handle Position input node return the
position of the handle relative to each point position.

Differential Revision: https://developer.blender.org/D12947
2022-01-23 12:29:37 -06:00
807c58aae4 Cleanup: separate function for Alembic edge crease reading 2022-01-23 16:35:11 +01:00
889712927f Fix Cycles crash collecting render stats 2022-01-23 16:30:57 +01:00
5c4a5fd40d Cleanup: Improvements to mesh to bmesh conversion
- Use `Array` and `Span` instead of raw pointers.
- Declare variables in smaller scope.
- Use references instead of pointers.
2022-01-22 18:09:30 -06:00
6cd977b903 Fix T94760: Crash building BMesh when opening file
A large polygon in the file from the report caused `alloca`
to exceed the maximum stack size, causing a crash.  Instead
of using `alloca`, use `blender::Array` with an inline buffer.

Based on a patch by Germano Cavalcante (@mano-wii).

Differential Revision: https://developer.blender.org/D13898
2022-01-22 13:06:15 -06:00
dde997086c LineArt: Option to keep contour when using face mark filtering.
When enabled, it will keep contour around the object instead of hide them by rule of face mark,
so the object can always have full contour while filtering out some of the feature lines inside certain regions.

Reviewed By: Antonio Vazquez (antoniov), Aleš Jelovčan (frogstomp)

Differential Revision: https://developer.blender.org/D13847
2022-01-22 16:57:25 +08:00
579e8ebe79 LineArt: Back face culling
Option to discard back faced triangles, this speeds up calculation especially for when you only want to show visible feature lines.

Reviewed By: Antonio Vazquez (antoniov), Aleš Jelovčan (frogstomp)

Differential Revision: https://developer.blender.org/D13848
2022-01-22 16:41:08 +08:00
5ae76fae90 LineArt: Noise tolerant chaining.
Instead of splitting it at each occlusion change, it tolerates short segments of "zig-zag" occlusion incoherence and doesn't split the chain at these points, thus creating a much smoother result.

Reviewed By: Antonio Vazquez (antoniov), Aleš Jelovčan (frogstomp)

Differential Revision: https://developer.blender.org/D13851
2022-01-22 16:13:44 +08:00
e88d966737 BMesh: merge normal and tessellation calculation on undo
This gives a modest speedup as calculating tessellation and face
normals at the same time can be more efficiently multi-threaded.

Also avoids calculating face normals twice,
oversight in d590e223da.
2022-01-22 18:02:12 +11:00
25c99e72cd Fix linking in debug mode
b7878a4d45 seems to have caused linking
issues building debug mode on Linux.

Using extern "C" resolves.
2022-01-22 17:59:09 +11:00
b7878a4d45 Cleanup: Move bmesh_mesh_convert.c to C++
Useful for a simpler bug fix, code clarity,
and easier possible optimizations in the future.
2022-01-21 23:53:15 -06:00
Aras Pranckevicius
9350005d8b Fix T13879 new OBJ exporter not saving files with Unicode characters.
Need to use BLI_fopen instead of fopen.
2022-01-21 20:14:01 -05:00
1f026a3db9 Cleanup: Use references, const variables 2022-01-21 18:20:07 -06:00
Laurynas Duburas
45d038181a Curves: Improve accuracy and clarity of NURBS knots calculation
This commit improves NURBS knot generation by adding proper support
for the combination of the Bezier and cyclic options. In other cases
the resulting knot doesn't change. This cyclic Bezier knot is used to
create accurate accurate "Nurbs Circle", "Nurbs Cylinder" primitives.
"Nurbs Sphere" and "Nurbs Torus" primitives are also improved by
tweaking the spin operator.

The knot vector in 3rd order NURBS curve with Bezier option turned on
(without cyclic) is changed in comparison to previous calculations,
although it doesn't change the curve shape itself.

The accuracy of the of NURBS circle is fixed, which can be checked by
comparing with mesh circle. Tessellation spacing differences in
circular NURBS is also fixed, which is observable with the NURBS
cylinder and sphere primitives. These were causing seam-like effects.

This commit contains comments from Piotr Makal (@pmakal).

Differential Revision: https://developer.blender.org/D11664
2022-01-21 16:40:49 -06:00
d590e223da Fix T94974: Invalid normals in edit mode
Normal layers currently aren't stored in the undo step
mesh storage, since they are not stored in files at all.
However, the edit mesh expects normals to be fully
calculated, and does not keep track of a dirty state.
This patch updates the normals in the BMesh created
by loading an undo step.

Another option would be calculating the normals on
the undo mesh first, which might be better if Mesh
normal calculation is faster than BMesh calculation,
but the preferred method to access vertex normals fails
in this case, because the mesh runtime mutexes are not
initialized for undo-state meshes.

Differential Revision: https://developer.blender.org/D13859
2022-01-21 16:14:00 -06:00
68aa35ae74 Fix T94967: Sculpt mode crashes with missing normals
From an error in rBcfa53e0fbeed, the vertex normals in `SculptSession`
seem to be used, but in the case when no "pbvh" is used, the value of
the pointer is never assigned.

Normals were not generally dirty before this "ensure" function with
regular sculpting operations, so this addition shouldn't have any cost.

Differential Revision: https://developer.blender.org/D13854
2022-01-21 16:12:12 -06:00
294ab84909 Fix T95097: Attribute Capture node UI inconsistency
All other nodes with data type and domain choices have the domain
below the data type. Generally that order makes sense, because it's
consistent with nodes that have no domain drop-down.
2022-01-21 16:08:21 -06:00
1c23a06706 Fix: Applying object transform can create normal layers
Because this operator is used on original objects, it's best to tag
the normals dirty instead of explicitly calculating them, to avoid
unnecessarily storing normal layers on an original object (since
they might have to be recalculated during evaluation anyway).
There may be other places this change is helpful, but being
conservative is likely better for now.

Related to T95125
2022-01-21 16:04:16 -06:00
e07b217669 Build: update macOS for FreeType library with woff2 support
Ref D13448, T93161
2022-01-21 21:36:00 +01:00
32ceb0b807 Fix std::optional value() build error on older macOS SDK
No longer happens on the buildbot, but for users building with an older
Xcode we still need to avoid using value().
2022-01-21 21:36:00 +01:00
4f9be46526 Distribute Points on Faces: Fix missing minimum value for density socket
Negative number density is not a part of this reality.
2022-01-21 15:31:51 -05:00
54d69a2fd1 Fix new OBJ exporter to handle instancing.
The new OBJ exporter did not handle object instances.
The fix is to use a dependency graph iterator, asking for instances.
Unfortunately that iterator makes a temporary copy of instance objects
that does not persist past the iteration, but we need to save all the
objects and meshes to write later, so the Object has to be copied now.

This changed some unit tests. Even though the tests don't have instancing,
the iterator also picks up some Text objects as Mesh ones (which is a good
thing), resulting in two more objects in the all_objects.obj file output.
2022-01-21 14:37:33 -05:00
9d274a609c cmake/win: Platform update for freetype 2.11.0
freetype now depends on brotli
2022-01-21 11:40:53 -07:00
58f8eb54a3 deps/win: fix typo in brotli.cmake
it was harvesting to the zstd folder which
is not where these libs ought to be.
2022-01-21 11:36:56 -07:00
RUben
5b90c046d5 Fix: Object selection delay with many objects
With object collection properties open there was a huge delay when
switching active objects in a large scene, (~10k objects, ~5m vertices).
This is due to a non-optimal function to query all the collections the object is in.

To solve this the code can be simplified by using `bpy.types.Object.users_collection`
This returns all the collections the object is in removing the need to compute this in python.
2022-01-21 13:13:04 -05:00
c20f209b1c Cmake/Deps: Freetype 2.11.0 / brotli 1.0.9
The UI team requested adding woff2 support to freetype.
this required a new dependency brotli.

This changes adds brotili to the builder and bumps
freetype to version 2.11.0

As freetype now depends on other libraries, for consistency
all use of ${FREETYPE_LIBRARY} in cmake has been updated to
use ${FREETYPE_LIBRARIES} adjustments have been made in the
windows platform file, all other platforms use cmake's
FindFreeType.cmake which already sets this variable.

reviewed by: brecht

Differential Revision: https://developer.blender.org/D13448
2022-01-21 10:26:05 -07:00
59fc95bf97 UI: Clarify Active Movie Clip tooltip
See T92299
2022-01-21 12:02:34 -05:00
d034b85f33 Geometry Nodes: new Scale Elements nodes
This node can scale individual edges and faces. When multiple selected
faces/edges share the same vertices, they are scaled together.
The center and scaling factor is averaged in this case.

For some examples see D13757.

Differential Revision: https://developer.blender.org/D13757
2022-01-21 17:34:47 +01:00
Alan Babu
c39d514a4e Geometry Nodes: Flip Faces Node
Currently there is no way to flip normals in geometry nodes. This node
makes that possible by flipping the winding order of selected faces.
The node is purposely not called "Flip Normals", because normals are
derived data, changing them is only a side effect. The real change is
that the vertex and edge indices in the face corners of every selected
polygon are reversed, and face corner attribute data is reversed.

While there are existing utilities to flip a polygon and its custom
data, this node aims to process an attribute's data together instead
of processing all attributes separately for each index.

Differential Revision: https://developer.blender.org/D13809
2022-01-21 09:26:40 -06:00
4251455dcd Geometry Nodes: Mesh Island Node - Rename Index Socket
Rename 'Index' Socket to 'Island Index' to make it more consistent with
'Island Count'

Differential Revision: https://developer.blender.org/D13893
2022-01-21 09:01:18 -06:00
87c5423c5e Geometry Nodes: New Output for Number of Mesh Islands
Adds a second output to the Mesh Islands node that shows the total
number of islands as a field.

Differential Revision: https://developer.blender.org/D13700
2022-01-21 08:30:02 -06:00
Brecht Van Lommel
d68ce0e475 Cycles: add pointcloud implementation for Metal RT
This is not currently working, with an internal compiler error. However
we are currently using BVH2 instead of Metal RT. So this has no effect for
users, it's being committed to avoid the code getting outdated.

Ref T92573, T92212

Differential Revision: https://developer.blender.org/D13632
2022-01-21 14:42:27 +01:00
5e51a5e8a4 Fix error in previous commit. 2022-01-21 14:35:27 +01:00
93065a67c6 GPU: Disable create info for 2d image overlay merge.
This shader needs to use the same interface as the OCIO shader. On Linux
and Windows this seems to be the case. On MacOS however there is a
mismatch that makes the overlay texture to be completely black when
switching to workbench in the Shader workspace.

This is just a temporarily work-around as this should be solved. Due to
the poor GPU debugging facilities on Mac we haven't been able to
pin-point the root cause.
2022-01-21 14:24:30 +01:00
f6888b530a Attributes: add operator to convert generic attributes to other types
Editing of generic attributes on the original objects in edit modes is
still very limited. However, when applying a geometry nodes modifier
that generates new attributes. These attributes will show up in the
Attributes panel.

Currently, our exporters are not capable of exporting generic attributes.
Therefore, for the time being, a work around is to apply geometry nodes
and then convert a generic attribute to a task specific attribute like a
uv map, vertex group or vertex color layer. Once more parts of Blender
support generic attributes, this will become less important.

Currently, only meshes are supported by the operator. However, it would
be relatively easy to extend it to other geometry types.

Differential Revision: https://developer.blender.org/D13838
2022-01-21 12:47:35 +01:00
36c40760a5 .obj: simplify templates in FileHandler, add comments
- Remove redundant template from `FormattingSyntax`.
- Replace one enable_if with static assert for readability
- Add comments

No functional change expected.

Reviewed by: jacqueslucke
Differential Revision: https://developer.blender.org/D13882
2022-01-21 15:28:04 +05:30
23fa5bb723 GPU: Remove unused resources in shader create info.
When adding the shader create infos some additional resources where defined
that doesn't exist in the shader itself. This commit will remove them.
2022-01-21 09:58:58 +01:00
64196a6b29 Cleanup: struct/class mismatch. 2022-01-21 07:52:10 +01:00
872dc1038c UI: exclude "Undo History" from menu search
Undo history was showing in menu search since converting undo history to
a menu from a popup, see: 0e1bb232e6.
2022-01-21 16:30:11 +11:00
53923f502d Fix T95078: Setting digits as modifier in keymap doesn't work
Allow any non-modifier keyboard events to be used.

Note that the existing check for >= EVT_AKEY allowed NDOF and other
non-keyboard events (including modifiers, which didn't work).
2022-01-21 15:20:02 +11:00
20655128c9 Cleanup: event type values & defines
- Use defines instead of magic numbers for F-Key & NDOF range checks.
- Use explicit values for NDOF event types.
- Minor clarification to doc-strings.
- Use doxy-sections.
2022-01-21 15:19:00 +11:00
5fca280c80 Fix: Node link drag search doesn't list shader sockets
Shader sockets were only available when dragging from inputs.
2022-01-20 16:26:43 -06:00
1ac2d2dcb6 Fix T93711: Cycles diffuse/glossy baking does not write alpha
With the change to use render passes internally the alpha channel got lost.
Add support for these render passes to output an alpha channel for baking.
2022-01-20 22:32:35 +01:00
14d261d23a Cleanup: Resolve unused variable warning, make function static 2022-01-20 15:10:56 -06:00
9ca1052226 Fix Python API docs build error
There is probably a better solution that's possible, but the few other
things I tried didn't work, and the build error should be resolved for
the buildbots. This is similar to the "breaks" in the namespace for
functions declared in `ED_node.h`.
2022-01-20 15:10:28 -06:00
4369c5817a Fix T94457: random result using sky texture in light object
Still not well defined, but should not longer use uninitialized values that
gave different results between CPU/GPU and subsequent renders.
2022-01-20 21:28:41 +01:00
22a8e934e4 Fix T94698: artifacts in light passes with mixed volumes and surfaces 2022-01-20 20:55:43 +01:00
e1ae95f6b2 Fix T93520: wrong subframe motion blur with rigid body physics
The code here was using velocity based interpolation copied from particles.
However there is no velocity cached in the rigid body point cache so the
results were non-sensical.
2022-01-20 20:40:55 +01:00
24e00c115c Fix T94712: Cycles missing colorspace transform on grayscale images 2022-01-20 20:40:55 +01:00
2559d79d2f Fix T94582: Cycles mapping shader node incorrectly skipped in Normal mode
Even if no rotation or scale is specified, we must still always normalize
the output.
2022-01-20 20:40:55 +01:00
Charlie Jolly
cc1a48e395 Geometry Nodes: Curve Primitive Arc
This adds a new curve primitive to generate arcs.

Radius mode (default): Generates a fixed radius arc on XY plane
with controls for Angle, Sweep and Invert.

Points mode: Generates a three point curve arc from Start to End
via Middle with an Angle Offset and option to invert the arc.
There are also outputs for arc center, radius and normal direction
relative to the Z-axis.

This patch is based on previous patches
D11713 and D13100 from @guitargeek. Thank you.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13640
2022-01-20 19:04:09 +00:00
6baccc36a0 Fix continuous stream of thumbnail notifiers after redo
This fixes a similar issue as the previous commit, but this time the
continuous notifiers would be sent after redoing. E.g. after moving an
object, and then modifying the transform in the "Adjust Last Operation"
panel.
2022-01-20 18:51:49 +01:00
d552b3c0c0 Fix file/asset thumbnails causing constant stream of notifiers
The thumbnail caching continuously sends `ND_SPACE_FILE_PREVIEW`
notifiers via a timer. But this timer was never ended properly after
thumbnails are fully loaded into the cache.
Wouldn't actually cause a refresh or redraw, send and process the
notifiers.

I already tried to avoid this for the asset view template, but
apparently that wasn't working correctly. For the File/Asset Browser I
never applied that fix to avoid possible regressions before the release.
2022-01-20 18:51:49 +01:00
902a103f80 Cleanup: Move node editor files to proper namespace
This commit moves code in all node editor files to the
`blender::ed::space_node` namespace, except for C API
functions defined in `ED_node.h`, which can only be moved
once all areas calling them are moved to C++.

The change is fairly straightforward, I just moved a couple
of "ED_" code blocks around to make the namespace more
contiguous, and there's the method for adding a pointer to
a struct in a C++ namespace in DNA.

Differential Revision: https://developer.blender.org/D13871
2022-01-20 10:36:56 -06:00
19622ffc5b Cleanup: Remove OpenCL workaround in volume_sample_channel(). 2022-01-20 17:02:20 +01:00
f6c8a78ac6 Cycles: Fix bvh2 gen on Apple Silicon and use it to speed up renders
This patch fixes a correctness issue discovered in the `int4 select(...)` function on Apple Silicon machines, which causes bad bvh2 builds. Although the generated bvh2s give correct renders, the resulting runtime performance is terrible. This fix allows us to switch over to bvh2 on Apple Silicon giving a significant performance uplift for many of the standard benchmarking assets. It also fixes some unit test failures stemming from the use of MetalRT, and trivially enables the new pointcloud primitive.

Ref T92212

Reviewed By: brecht

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D13877
2022-01-20 15:37:49 +00:00
9315215b20 Fix T94726: crash with GPU subdivision on a custom bone shape
Custom bones are drawn by instancing the GPUBatch of the base object. To
access the mesh and its GPUBatch, `BKE_object_get_evaluated_mesh` was
used. However, since GPU subdivision support, this will return a
subdivision wrapper which will never be drawn, and thus will have an
invalid batch, which caused the crash.

`BKE_object_get_evaluated_mesh_no_subsurf` should be used instead, to
return the mesh that will be drawn, and have the subdivision evaluated
on the GPU. Note that the rest of the draw code is already using this
function.
2022-01-20 15:28:08 +01:00
264fe10ddd Cleanup: Remove unused python helper function.
Branched Path has been removed with the Cycles X merge.
2022-01-20 14:34:20 +01:00
969a571e0f Revert "Sculpt: Multires Heal Brush"
This reverts commit ae349eb2d5.
2022-01-20 03:55:41 -08:00
4425e0cd64 Subdivision: add support for vertex creasing
This adds vertex creasing support for OpenSubDiv for modeling, rendering,
Alembic and USD I/O.

For modeling, vertex creasing follows the edge creasing implementation with an
operator accessible through the Vertex menu in Edit Mode, and some parameter in
the properties panel. The option in the Subsurf and Multires to use edge
creasing also affects vertex creasing.

The vertex crease data is stored as a CustomData layer, unlike edge creases
which for now are stored in `MEdge`, but will in the future also be moved to
a `CustomData` layer. See comments for details on the difference in behavior
for the `CD_CREASE` layer between egdes and vertices.

For Cycles this adds sockets on the Mesh node to hold data about which vertices
are creased (one socket for the indices, one for the weigths).

Viewport rendering of vertex creasing reuses the same color scheme as for edges
and creased vertices are drawn bigger than uncreased vertices.

For Alembic and USD, vertex crease support follows the edge crease
implementation, they are always read, but only exported if a `Subsurf` modifier
is present on the Mesh.

Reviewed By: brecht, fclem, sergey, sybren, campbellbarton

Differential Revision: https://developer.blender.org/D10145
2022-01-20 12:21:34 +01:00
9b4c017031 Cleanup: Remove incorrect comment 2022-01-19 23:56:27 -06:00
ae349eb2d5 Sculpt: Multires Heal Brush
This brush fixes the random spikes that
occasionally happen in multires models.
These spikes can be nearly impossible to
fix manually and can make working with
multires a nightmare.
2022-01-19 17:28:22 -08:00
eb3ff1d6f9 Cleanup: spelling in comments 2022-01-20 11:59:20 +11:00
1d536c21dd Cleanup: clang-format 2022-01-20 11:59:20 +11:00
e3f9d9b206 Cleanup: quiet ASAN warnings for divide by zero & NULL memcpy args
No functional changes as the inf value was never used &
memcpy args were only NULL when the size to copy was zero.
2022-01-20 11:59:20 +11:00
b7fe27314b Mesh RNA API: Expose contiguous normal arrays
Since vertex and face normals are now stored on the mesh when necessary,
we can expose them as contiguous arrays of vectors in the Python API.
This can give render engines and other addons easy access to they data
for fast access through a regular collection property.

While "Mesh Vertex" still has a "normal" property in RNA, that is only
maintained in order to avoid breaking the existing API, and accessing
it is less efficient than accessing the normals directly.

I made the normal arrays read-only, because modifying them could
put them in an invalid state. This is inline with how we treat the data
internally, and helps keep relationships between data clear.

Differential Revision: https://developer.blender.org/D13839
2022-01-19 18:43:05 -06:00
b47a1867e8 Cleanup doc comments for sculpt_intern.h 2022-01-19 16:21:14 -08:00
e7db1247b1 Fix: File Browser using asset indexer after Asset Browser was visible
When toggling to a File Browser from an Asset Browesr, the asset indexer
would be used to load files. I couldn't spot issues with that on a
quick look, but this should still be corrected.
2022-01-19 20:43:31 +01:00
293aab2253 Asset Browser: Add debug option to disable asset indexing
Adds an "Asset Indexing" option (enabled by default) to Preferences >
Experimental > Debugging. This is useful when working on the asset
library loading.
2022-01-19 20:12:53 +01:00
9a2d1cd5b7 PyAPI Docs: Prepare for Sphinx 4.5 2022-01-19 14:08:38 -05:00
cd0acba330 CMake: Support external callback in configuration
An external CMake script can be used to debug CMake code, modify/read
target properties, inter-target dependencies, non-cache variables etc.

Reviewed by: LazyDodo, brecht
Differential Revision: https://developer.blender.org/D13830
2022-01-20 00:15:09 +05:30
17cab47ed1 Cycles: Fix T94736: Crash when modifying strength of world environment texture
This patch fixes crash T94736 on Metal in which the launch_params were not being updated to reflect destruction of MetalMem objects.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13875
2022-01-19 18:17:37 +00:00
596ce11556 CMake Cleanup: use set for filepath instead of option
See https://developer.blender.org/D13830#368219
2022-01-19 23:34:25 +05:30
f179637222 Fix T95042: Rendering high-res image in Cycles crashes
Integer overflow when the final frame is handled by the Blender's
output driver.

Thanks Jesse and Thomas for investigation!
2022-01-19 16:03:28 +01:00
ecf2f5ed01 Fix error in previous commit
While doing last minute cleanup in
e49bf4019b,  missed to rename function
in one place.
2022-01-19 14:32:11 +01:00
eddad4e9a1 VSE: Support copy-pasting strips with animation
When copying strips between 2 scenes, it wasn't possible to copy
animation curves along with strips.

In this patch curves are copied into clipboard `ListBase`. When pasted,
original curves are moved into temporary `ListBase` and curves in
clipboard are moved into scene action. This is because when strips from
clipboard have to be renamed, function `SEQ_ensure_unique_name()` does
fix RNA paths of curves, but this is done globally for all curves within
action. After strips are renamed, restore original curves from backup.

Note: This patch handles only fcurves. Drivers and actions are currently
not handled anywhere in VSE.

Fixes T77530

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13845
2022-01-19 14:15:49 +01:00
e49bf4019b Cleanup: VSE animation handling
- Move functions that handle animation to own file - `animation.c`
- Refactor `SEQ_offset_animdata` and `SEQ_free_animdata` functions
- Add function `SEQ_fcurves_by_strip_get` to provide more granular
  and explicit way for operators to handle animation
- Remove function `SEQ_dupe_animdata`, do curve duplication explicitly
  in operator code, which makes more sense to do. Further this function
  was also used for renaming strips which makes no sense.
- Refactor usage of function `SEQ_free_animdata` and remove XXX comment.
  Now this functiuon is no longer called when `Sequence` data is freed
  implicitly, it is done explicitly in high level function
  `SEQ_edit_remove_flagged_sequences`

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13852
2022-01-19 14:12:23 +01:00
1788298804 Cleanup: Strict compiler warning in Cycles
The ustring is not a trivially copyable object from the C++ standard
point of view, so using memcpy on it is strictly wrong. In practice,
however, this is OK since it is just a thin wrapper around char*.

For now use explicit cast to void* same as it was done in other places
of ccl::array implementation. But also localize the place where memory
copy happens to make it easier to support proper non-trivial C++
objects in the future.
2022-01-19 12:01:49 +01:00
8a23d91a50 GPUShaderCreateInfo: Rework geometry shader layout support
This merge the description into one struct only that can be more easily
copied during `finalize()`.

The in and out layout parameters are better named and extended with the
invocation count (with fallback support)
2022-01-19 11:59:57 +01:00
952a4fa456 Fix T94987: Dragged node links are invisible.
Route cause was data alignment mismatch between GPU and CPU. This
mismatch would not allow us to bind the UBO where data wasn't available
on the GPU.

Fixed by using float4 in stead of float2. This could eventually be
packed, but that would lead to less readable code.
2022-01-19 11:32:34 +01:00
71386c08f1 Fix T95039,T94998: Shaders compilation errors on Mac.
Cause was incorrect logic when generating the resource layout. It the
explicit_location_support setting was ignored and the binding were
generated for image, uniform buffers and storage buffers.
2022-01-19 10:28:19 +01:00
eb63646605 BMesh: add mesh debug information printing
- Add BM_mesh_debug_print & BM_mesh_debug_info.
- Report flags in Mesh.cd_flag in BKE_mesh_debug_print
- Move custom data printing into customdata.cc (noted as a TODO).

Note that the term "runtime" has been removed from
`BKE_mesh_runtime_debug_print` since these are useful for debugging any
kind of mesh data.
2022-01-19 17:16:00 +11:00
71879d665d BMesh: improve handling of custom-data flag (Mesh.cd_flag)
Code that handled merging & initializing custom-data from other
meshes sometimes missed checks for this flag, causing bevel weights to
lost when the mesh was converted to a BMesh.

The following changes are a more general fix for T94197.

- Add BM_mesh_copy_init_customdata_from_mesh_array which initializes
  custom-data from multiple meshes at once.
  As well as initializing custom-data layers from Mesh.cd_flag.

  This isn't essential for boolean, however it avoids the overhead of
  resizing custom-data layers.

- Loading mesh data into a BMesh now respects Mesh.cd_flag
  instead of only checking if the BMesh custom-data-layer exists.
  Without this, the order of meshes passed to BM_mesh_bm_from_me could
  give different (incorrect) results.

- Copying mesh data now copies `cd_flag` too. This is a precaution
  as in my tests evaluating modifiers these values always matched.
  Nevertheless it's correct to copy this value as custom-data it's
  self is being copied.
2022-01-19 14:30:10 +11:00
ee6507f2b1 Docs: notes on thumbnail sizes
The rationale for storing thumbnails at different sizes wasn't obvious.
2022-01-19 14:05:56 +11:00
7e3b1e2c8f Fix flipped order of items in the "Undo History" menu
Error in 0e1bb232e6.
2022-01-19 13:25:10 +11:00
2e5aecf557 Fix T94202: GPUFrameBuffer: wrong refcount in the buffer passed for read_color and read_depth
The buffer passed as an argument to `GPUFrameBuffer.read_color` is used
in the return of the function and therefore, if not used, its refcount is
decremented.

So be sure to increment the refcount of the already existing objects that
will be used in the return of a function.
2022-01-18 19:23:16 -03:00
221ff895d9 Cleanup: Use references, LISTBASE_FOREACH macro 2022-01-18 13:32:36 -06:00
a5610da1d5 Fix T93413: Nodes 'Make Links' fails for multi input socket
This was the case for multi input sockets that have a link already.

Since we have multi input sockets, the way we use `socket_is_available`
is not really giving the expected result on these.

When used for input sockets the intention is to find a free socket
(either for noodle **replacement**, then it is always available, or just
the next free available socket).
Now I would think without the intention to replace an existing link, a
multi input socket should still be available.
From the inside of the function, the `replace` argument turns [namewise]
to `allow_used`, which sounds a little different (so one might argue
that if `allow_used` is `False` this should also trigger for already
connected multi input sockets).
In the end, this is an issue with the variable naming though, cant think
of a usecase where the patch change would really go against intentions.

Maniphest Tasks: T93413

Differential Revision: https://developer.blender.org/D13866
2022-01-18 20:23:39 +01:00
9506dcf675 Fix T95029: Arrow gizmo always uses normal direction
Bug possibly introduced in {rBc57e4418bb85aec8bd3615fd775b990badb43d30}.

Interestingly, the orientation set before (NORMAL), even different from
the orientation that was actually used, was allowing the use of
"orient_matrix" ("orient_matrix_type" should have been NORMAL in that
case too).

In any case, make sure the "orient_matrix_type" and "orient_type" are the
same so that the "orient_matrix" is used.
2022-01-18 16:21:48 -03:00
977baeaa26 Cleanup: Make node editor functions private
These operations (sorting and selecting all nodes) should generally
be handled by the node editor and not outside code. They were not
called outside of the node editor, so they can be moved to the editor's
`intern` header.
2022-01-18 13:07:41 -06:00
09ecb089a5 Cleanup: Remove unused node editor toolbar file
This file was added nine years ago, and was unused then.
Now with active tools we use a different approach to create
toolbars, so the file is not relevant.
2022-01-18 12:31:14 -06:00
15657b7ccd Fix warning from rB9925606539. 2022-01-18 18:38:14 +03:00
b88a37a490 Geometry Nodes: new Field at Index node
This node allows accessing data of other elements in the context geometry.
It is similar to the Transfer Attribute node in Index mode. The main difference
is that this node does not require a geometry input, because the context
is used.

The node can e.g. be used to generalize what the Edge Vertices node is doing.
Instead of only being able to get the position of the vertices of an edge,
any field/attribute can be accessed on the vertices.

Differential Revision: https://developer.blender.org/D13825
2022-01-18 16:25:47 +01:00
4d5c08b938 Geometry Nodes: Add Signed Output to Edge Angle Node
Adds a second output to the edge angle node that shows the signed angle
between the two faces, where Convex angles are positive and Concave angles
are negative. This calculation is slower than the unsigned angle, so it
was best to leave both for times where the unsigned angle will suffice.

Differential Revision: https://developer.blender.org/D13796
2022-01-18 09:20:31 -06:00
796e9d442c Geometry Nodes: improve domain interpolation code
It's now easier than before to do the interpolation of attributes
only for the elements that are actually used in some cases.
This can result in a speedup because unnecessary computations
can be avoided. See the patch for a simple performance test.

Differential Revision: https://developer.blender.org/D13828
2022-01-18 16:14:00 +01:00
dfe22a53bb Fix T95003: Shader issue using voronoi noise.
Cause of the issue isn't that clear, but the NVIDIA GLSL compiler
complained that it couldn't find an overloaded function when the second
parameter is an interger. This change fixes it by using a float.
2022-01-18 14:32:26 +01:00
0d7b3ed39c RNA: display exact integer values without fraction if step is integer.
Display exact integer values of a floating point fields without
a fraction if the step is also an exact integer. This is intended
for cases when the value can technically be fractional, but most
commonly is supposed to be integer.

This handling is not applied if the field has any unit except frames,
because integer values aren't special for quantities like length.

The fraction is discarded in the normal display mode and when copying
the value to clipboard, but not when editing to remind the user that
the field allows fractions.

Differential Revision: https://developer.blender.org/D13753
2022-01-18 16:24:54 +03:00
6952228386 UI: fix a precision issue with float field step size.
Fix a precision issue when stepping down from 1 to 0 via the left
decrement button and step 100 results in a small nonzero value.

The reason is that 0.01 can't be precisely represented in binary
and converting to double before multiplication reveals this.

Ref D13753
2022-01-18 16:24:54 +03:00
6a8ad00bcc Cleanup: Avoid possible NULL pointer error
In normal conditions, `gpf` always has a value, but better move inside the NULL checking.
2022-01-18 13:44:41 +01:00
08d008a508 GPU: Create Info for GPU_SHADER_2D_IMAGE_MULTI_RECT_COLOR.
This patch converts GPU_SHADER_2D_IMAGE_MULTI_RECT_COLOR shader to use
the GPUShaderCreateInfo pattern. It can be used as a reference when
converting other shaders.

In this special case the flat uniform vector cannot be used anymore as it
doesn't fit as push constants. To solve this a uniform buffer is used.
2022-01-18 13:17:04 +01:00
2486346f6f Fix T94977: muted link is not ignored in eevee
Add a preprocessing step that removes all muted links from
the localized node tree.

Differential Revision: https://developer.blender.org/D13864
2022-01-18 13:06:49 +01:00
9f8ae130af Fix T95006: missing modifier update after frame change
The previous optimization did not work in general yet, unfortunately.
This change makes the code more correct, but also brings back
some unnecessary updates (e.g. when creating a node group).
2022-01-18 12:58:29 +01:00
5d7ac749c5 Fix T94197: Applying boolean with fast solver clears bevel weights
For boolean operations only one of the meshes was checked to determine
if bevel weights should be created.

Now initialize custom data from both meshes flag.
Note that this is a localized fix to be back-ported, further changes
will be made so edit-mode conversion accounts for this
without the caller needing explicit checks for custom-data flags.
2022-01-18 21:35:10 +11:00
fce0b824a7 Assets: Enabling Asset Indexing.
Asset indexing was disabled as ID property indexing wasn't supported.
Now that ID property support is added we can enable asset indexing.

Check {T91406} for more information about asset indexing.
2022-01-18 11:20:50 +01:00
Jeroen Bakker
36068487d0 AssetsBrowser: Add ID Properties to Asset Indexer
Object/collection asset workflow would need the bounding box for snapping.
The bounding box is stored using ID properties in the scene. Currently ID properties
aren't stored in the asset index, what would break object snapping. For this reason
Asset Indexing is turned off in mater. This patch will introduce the indexing of ID
properties what will allow the indexing to be turned on again.

## Data Mapping ##

For data mapping we store the internal structure of IDProperty to the indexer (including meta-data) to be able to deserialize it back.
```
[
  {
    "name":  ..,
    "value": ..,
    "type": ..,
    /* `subtype` and `length` are only available for IDP_ARRAYs. */
    "subtype": ..,
  },
]
```

| **DNA** | **Serialize type** | **Note** |
| IDProperty.name | StringValue| |
| IDProperty.type | StringValue| "IDP_STRING", "IDP_INT", "IDP_FLOAT", "IDP_ARRAY", "IDP_GROUP", "IDP_DOUBLE"|
| IDProperty.subtype | StringValue| "IDP_INT", "IDP_FLOAT", "IDP_GROUP", "IDP_DOUBLE" |
| IDProperty.value | StringValue | When type is IDP_STRING |
| IDProperty.value | IntValue | When type is IDP_INT |
| IDProperty.value | DoubleValue | When type is IDP_FLOAT/IDP_DOUBLE |
| IDProperty.value | ArrayValue | When type is IDP_GROUP. Recursively uses the same structure as described in this section. |
| IDProperty.value | ArrayValue | When type is IDP_ARRAY. Each element holds a single element as described in this section. |

NOTE: IDP_ID and IDP_IDARRAY aren't supported. The entry will not be added.

Example
```
[
  {
    "name": "MyIntValue,
    "type": "IDP_INT",
    "value": 6,
  },
  {
    "name": "myComplexArray",
    "type": "IDP_ARRAY",
    "subtype": "IDP_GROUP",
    "value": [
        [
          {
            "name": ..
            ....
          }
        ]
    ]
  }
]
```

## Considered alternatives ##

- Add conversion functions inside `asset_indexer`; makes generic code part of a specific solution.
- Add conversion functions inside `BLI_serialize`; would add data transformation responsibilities inside a unit that is currently only responsible for formatting.
- Use direct mapping between IDP properties and Values; leads to missing information and edge cases (empty primitive arrays) that could not be de-serialized.

Reviewed By: Severin, mont29, HooglyBoogly

Maniphest Tasks: T92306

Differential Revision: https://developer.blender.org/D12990
2022-01-18 11:18:11 +01:00
d7822981b1 Python API Docs: add non-invert Bone.convert_local_to_pose example.
This updates the example function to support assigning a subset of
bone matrices. The code was tested to work in real use by @gaiaclary.
2022-01-18 11:45:27 +03:00
542d15b1cd Allow overriding motion path settings.
Motion paths themselves aren't getting saved (not sure if they are
without overrides), but being able to override options makes them
usable even if it's necessary to regenerate every edit session.

Differential Revision: https://developer.blender.org/D13842
2022-01-18 11:45:27 +03:00
1b94631975 CMake: Fix using numpy variable for the zstandard path
Copy paste error in a5917175d8.
2022-01-18 17:23:19 +11:00
6dd89afa96 Fix obj exporter tests by deduping normals and printing with less precision.
Some new obj exporter tests were disabled because the normals were different
in the last decimal place on different platforms.
The old python exporter deduped normals with their coordinates rounded to
four decimal places. This change does the same in the new exporter.
On one test, this produced a file 25% smaller and even ran 10% faster.
2022-01-17 23:22:40 -05:00
db496a0b7d Cleanup: spelling in comments 2022-01-18 14:27:29 +11:00
20df402adc Cleanup: move docs to definition 2022-01-18 14:13:58 +11:00
7220897280 WM: batch rename support for volume & light object data
Also order items to match the "Add" menu.
2022-01-18 12:23:15 +11:00
75d84b1b64 WM: batch rename outliner support for various ID types
The outliner selection can now be used for renaming objects,
object-data & materials.
2022-01-18 12:12:05 +11:00
0fc9526178 Fix for batch rename operating on library collections & materials 2022-01-18 11:50:02 +11:00
84f6d86445 Fix batch renaming selected meta-strips 2022-01-18 11:13:05 +11:00
c11c2a4b91 WM: batch rename collections outside the outliner
Use selected objects collection instances to rename in the 3D view.
2022-01-18 10:47:12 +11:00
Red Mser
54fb1a75ee WM: batch rename collections
User must activate the operator from the outliner,
so that the selected collections can be determined.

Reviewed By: campbellbarton

Ref D13821
2022-01-18 10:26:20 +11:00
0fa36c81d9 Cleanup: quite old-style-declaration warning, strip trailing space 2022-01-18 10:26:18 +11:00
3bbb39ecc1 Cleanup: remove HWND from GHOST_Wintab constructor.
No change in behavior.
2022-01-17 14:07:08 -08:00
44ca984dc7 BLI: Add index_range method to VectorSet
This can simplify iterating through all of the indices in the vector,
which is fairly common, since one of the benefits of the data structure
is that all values are contiguous.
2022-01-17 15:10:52 -06:00
8c1ddee10c Geometry Nodes: Set Handle Type Node: Left and right by default
This node's UI uses a multi-select enum to allow adjusting the
type of both handle sides with the same node. Since usually the
user wants to affect both handles, and it's the multi-select behavior
isn't obvious, selecting both by default is an improvement.
2022-01-17 15:02:15 -06:00
b776c46d2f Fix T94715: multiple volumes using the same .vdb causes freeze
Needs more TBB task isolation, as even freeing an OpenVDB grid uses
multithreading.
2022-01-17 20:36:59 +01:00
Martijn Versteegh
449db0ab1e Baking: new method to generate margin, based on adjacent faces
This significantly reduces discontinuities on UV seams, by giving a better
match of the texture filtered colors on both sides of the seam. It works by
using pixels from adjacent faces across the UV seam.

This new option is called "Adjacent Faces" and is the default. The old option
is called "Extend", and extends border pixels outwards.

Differential Revision: https://developer.blender.org/D13303
2022-01-17 19:36:13 +01:00
8af22719d0 Cleanup: Remove now redundant performance workaround for asset previews
Not needed anymore after aa0ecd179. The removed function was identical
to `icon_draw_rect()` now.

Reverts ab7214ca2e.
2022-01-17 18:26:32 +01:00
fa1fef5081 Cleanup: Correct comments for immediate mode buffer draw functions 2022-01-17 18:26:10 +01:00
194979e929 Cleanup: Improve naming of immediate mode buffer draw functions
Followup to the previous commit. Jeroen and I agreed the old naming was
confusing.
2022-01-17 18:26:10 +01:00
aa0ecd1791 UI: Speed up icon scaling
Use GPU-side scaling to speed up the scaling itself, and to avoid having
to copy the image buffer using the CPU. Mipmapping is used to get decent
filtering when downscaling without ugly artifacts.
In my comparisons, there was barely any difference between the methods
for DPIs >= 1. Below that, the result looks a bit different due to the
different filtering method.

See D13144 for screen-recordings showing the difference.

Part of T92922.

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

Reviewed by: Jeroen Bakker
2022-01-17 18:26:10 +01:00
4d10a46e63 Cleanup: refactor BVH2 in preparation of self intersection skip
Move some logic out of triangle intersection functions and into BVH
traversal, so we can share logic between primitives.

Ref D12954
2022-01-17 17:35:23 +01:00
a25cfc5db2 Texture/Vertex Paint: Add secondary color to the tool header
Before we would only display the secondary color in the N-panel.
Now we also display it in the tool header.
2022-01-17 16:50:20 +01:00
be8f10a4e2 T94828: Appending collection with instancing links nested collections
See T94828 for details.

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

Reviewed by: Bastien Montagne
2022-01-17 16:32:50 +01:00
e3fd0b1d17 Fix compiler warning on Windows
The variable was `uint64_t` and needs `1ull`
2022-01-17 16:08:48 +01:00
7abdd82dfd Fix T94338: bpy.data.libraries.load does not return the right thing.
Typo in rB605cdc4346e5f82, both `eBlendfileLinkAppendForeachItemFlag`
flags had the same value, effectively preventing to filter out direct
vs. indirect appended items.
2022-01-17 15:22:22 +01:00
59fcbdd815 Cleanup: deduplicate condition in transform curve code
Checking `t->around` and `nu->pntsv` does not need to be done in 2 places.
2022-01-17 11:14:44 -03:00
0a08ac2528 Alembic: add support for reading override layers
Override layers are a standard feature of Alembic, where archives can override
data from other archives, provided that the hierarchies match.

This is useful for modifying a UV map, updating an animation, or even creating
some sort of LOD system where low resolution meshes are swapped by high resolution
versions.

It is possible to add UV maps and vertex colors using this system, however, they
will only appear in the spreadsheet editor when viewing evaluated data, as the UV
map and Vertex color UI only show data present on the original mesh.

Implementation wise, this adds a `CacheFileLayer` data structure to the `CacheFile`
DNA, as well as some operators and UI to present and manage the layers. For both
the Alembic importer and the Cycles procedural, the main change is creating an
archive from a list of filepaths, instead of a single one.

After importing the base file through the regular import operator, layers can be added
to or removed from the `CacheFile` via the UI list under the `Override Layers` panel
located in the Mesh Sequence Cache modifier. Layers can also be moved around or
hidden.

See differential page for tests files and demos.

Reviewed by: brecht, sybren

Differential Revision: https://developer.blender.org/D13603
2022-01-17 14:51:04 +01:00
9d3f35a0bf Revert "Revert "GPUShaderCreateInfo for interface abstraction""
This reverts commit edee5a947b.

Fixes compilation error (Missing file BLI_float2.hh)
2022-01-17 14:46:32 +01:00
edee5a947b Revert "GPUShaderCreateInfo for interface abstraction"
This reverts commit 8fb2ff458b.
Missing some files.
2022-01-17 14:34:28 +01:00
Jeroen Bakker
8fb2ff458b GPUShaderCreateInfo for interface abstraction
This is a first part of the Shader Create Info system could be.

A shader create info provides a way to define shader structure, resources
and interfaces. This makes for a quick way to provide backend agnostic
binding informations while also making shader variations easy to declare.

- Clear source input (only one file). Cleans up the GPU api since we can create a
  shader from one descriptor
- Resources and interfaces are generated by the backend (much simpler than parsing).
- Bindings are explicit from position in the array.
- GPUShaderInterface becomes a trivial translation of enums and string copy.
- No external dependency to third party lib.
- Cleaner code, less fragmentation of resources in several libs.
- Easy to modify / extend at runtime.
- no parser involve, very easy to code.
- Does not hold any data, can be static and kept on disc.
- Could hold precompiled bytecode for static shaders.

This also includes a new global dependency system.
GLSL shaders can include other sources by using #pragma BLENDER_REQUIRE(...).

This patch already migrated several builtin shaders. Other shaders should be migrated
one at a time, and could be done inside master.

There is a new compile directive `WITH_GPU_SHADER_BUILDER` this is an optional
directive for linting shaders to increase turn around time.

What is remaining:
- pyGPU API {T94975}
- Migration of other shaders. This could be a community effort.

Reviewed By: jbakker

Maniphest Tasks: T94975

Differential Revision: https://developer.blender.org/D13360
2022-01-17 14:32:28 +01:00
08822801ac Fix T94805: Library weak reference generates "path not found" reports.
No reason to handle those paths here, those are fully internal temp
data, user should not be exposed to it currently.
2022-01-17 14:22:59 +01:00
04feaa8bd0 Core: Library Remap test cases.
For an upcoming refactoring of library remapping we want to be able to test if the logic won't change.
It also increased my experience inside the remapping codebase and find out what exactly needed to
be refactored.

This patch adds test cases for the core functionality of `foreach_libblock_remap_callback`. The test cases
don't cover of all the branches. Also pre-, post-processing, referencing and proxies are not tested.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D13815
2022-01-17 12:45:37 +01:00
e15449623d InstallDeps: Increase 'MEX' version of llvm to 14.
llvm 13 is now default on debian testing, tried it quickly and it seems
to work fine, so raising exclusive maximum value for it to 14.
2022-01-17 10:34:34 +01:00
40c8e23d48 LineArt: Invert collection option.
Allows conveniently selecting an inverse of a collection.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D13846
2022-01-17 17:22:09 +08:00
e1e3043a51 CMake: resolve issue finding mold
The default installation path uses `libexec`, missed this as the
package for Arch replaces this with `lib`,
now both are checked.
2022-01-17 18:12:15 +11:00
Piotr Makal
a84621347d Geometry Nodes: Improve conversion from NURBS to Bezier
This patch improves conversion method from NURBS to Bezier curves,
resulting in exact shape between those two types when provided with
a 3rd degree NURBS curve. Part of T86086.

See the differential revision for more comparisons.

The node still cannot account properly for a NURBS "order" other
than 4 and it does not take into account control point weights.

Differential Revision: https://developer.blender.org/D13546
2022-01-16 22:52:18 -06:00
Alaska
34d424fd64 Fix T94526: Incorrect workspace ordering tooltip
Fix the description for WORKSPACE_OT_reorder_to_back to say "last" in
list rather than "first"

See D13696 for more details.

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

Reviewed by Aaron Carlisle
2022-01-16 15:26:08 -08:00
d914cfcb7a Cleanup: simplify parameters
Use a common `userdata` for the different snap callbacks.
2022-01-16 11:25:51 -03:00
608d51c9c8 Fix T94951: Crash when snapping
Missed in {rBd9c6ceb3b88b6db87490b08e0089f9a18e6c52d6}
2022-01-16 11:25:51 -03:00
bc66cd9868 Fix T94865: GPU subdiv crash switching to texpaint area
The crash is due to the fact that GPU subdivision extraction routines
for edit data (including UVs) only worked for BMesh. However, a Mesh
based version is still needed for texture painting. This adds the
missing components. This also ensures all data are properly initialized
(at least the ones revealed by the bug).
2022-01-16 08:40:38 +01:00
3574f2730d Cleanup: deduplicate GPU subdiv data extraction loops
This puts the loop over the final subdivision quads outside of the mesh
iteration callback. This can also allow for easier parallel execution in
the future if need be.
2022-01-16 07:31:26 +01:00
b87d87b1d3 macOS: fix llvm-ranlib invalid option error 2022-01-16 11:47:55 +05:30
e69020ad0f CMake: only ever enable one alternative linker for UNIX/GCC
Since the option to enable linkers are booleans,
it's possible to enable them all at once.

Now only the first enabled + available linker is used
(with priority given to link is with better performance).
2022-01-15 16:40:24 +11:00
18c5d4ccb3 CMake: use LINKER flags instead of CFLAGS for setting the linker
Set the linker using CMAKE_*_LINKER_FLAGS instead of {C/CXX}FLAGS.

There is no advantage in using the CFLAGS to set the linker, it has the
downside of triggering a full rebuild when changing the linker.

Tested building Blender and the bpy.so Python module.

Ref D13833

Reviewed by: sergey, brecht
2022-01-15 16:12:13 +11:00
9664cc91f3 Fix T94918: GPU subdivision uses viewport levels for final render
The resolution for the subdivision grid traversal was always based on
the viewport setting.
2022-01-15 01:36:18 +01:00
6a16a9e661 Geometry Nodes: Rename transfer attribute geometry input
Conceptually, this is the geometry that data is taken from,
not the target of an operation, so rename it from "Target"
to "Source". This was common user feedback and agreed
on in a recent sub-module meeting.
2022-01-14 16:42:04 -06:00
6e926e9b56 Fix T94852: Geometry Proximity crash when unsuccessful
Before rB644e6c7a3e99ae1d43ed, `fill` was used in the error
cases, but now `fill_indices` is used, which doesn't work when
the span is empty (when only one output is used). The fix is just
to check for that case.
2022-01-14 16:10:38 -06:00
2a095d8bfe Audaspace: port bugfixes from upstream.
Windows audio backend (WASAPI) now automatically switches to
the selected audio device in windows.
2022-01-14 22:51:35 +01:00
9fe704800e Nodes: Support link-drag search with compare node outputs
The search list only displayed the "Result" output socket in this
case, which is unexpected since dragging from an input gives the
operations in the list as well. Also use integer mode when
connecting to boolean sockets.
2022-01-14 14:38:49 -06:00
b7a27efd78 Cleanup: Remove unused subdiv functions
I noticed these when doing final cleanup on rBcfa53e0fbeed.
One use was removed in that commit, the others were unused
going further back a few years.

Differential Revision: https://developer.blender.org/D13834
2022-01-14 14:04:24 -06:00
bba95d1901 Fix possible build error with unity build
`NodeOperationBuilder::Link` could conflict with the list base macros.
To resolve this dont use `using Link`.
2022-01-14 13:46:31 -05:00
67517c7d5c Cleanup: Outliner function names, simplify struct initialization 2022-01-14 19:26:04 +01:00
41495707d2 Fix incorrect destruction of Outliner tree-elements
`TreeElement` isn't a trivial type anymore, so `MEM_delete()` should be
called, which calls the destructor.
AFAICS this would cause a memory leak, since the contained `unique_ptr`
is allocated but not destructed correctly - but it's not using the
guarded allocator so woudn't be reported.
2022-01-14 19:26:04 +01:00
82d5905e4b Cleanup: Use destructor to delete Outliner runtime data
Simplifies and makes things safer due to proper RAII usage.
2022-01-14 19:26:04 +01:00
ca9a749b21 Cleanup: Use smart pointers for Outliner tree display and element types
Smart pointers should be the default choice for C++ owning pointers,
since they let you manage memory using RAII.

Also moved type factory methods into static class functions.
2022-01-14 19:26:04 +01:00
e9a43a3b60 Cleanup: Remove Outliner C-API headers/wrappers
Basically this removes any C <-> C++ glue code. C++ types are accessed
directly via the public C++ APIs.
Contains some related changes like, moving functions that were
previously declared in a now removed header to a different file, whose
header is the more appropriate place (and the source file as well).
But generally I tried to avoid other changes.
2022-01-14 19:26:04 +01:00
9109ea0b96 Disable some failing new obj exporter tests.
The switch to how normals are kept has led to tiny differences in
the normal output values on different platforms. Disabling the failing
tests while working on a solution to this problem.
2022-01-14 12:34:07 -05:00
5703efab88 Fix T94784: Crop node gizmo doesn't work
Fix refactoring mistake in rBcbca71a7cff3
Not the min and max values are initialized properly.
2022-01-14 17:44:18 +01:00
d723fa3d31 blenlib Any tests: Fix unknown pragma warning on Windows.
Part of a5cb7c1e62 is reverted since it 
created unknown pragma warning on windows.
Use a trick to do self-assigning.
Reviewed by Jacques Lucke in chat.
2022-01-14 22:10:28 +05:30
780633ec4b Cleanup: Unused function 2022-01-14 17:37:14 +01:00
301bb5afa5 Cleanup: Remove unused functions 2022-01-14 17:06:16 +01:00
eb33ee566e Fix T: Crash in do-version of older pre-2.80 blender files.
`BKE_layer_collection_sync` was missing a specific handling for one of
those pre-master collection cases,

NOTE: It is a bit unfortunate to have to do 'do-version' code in BKE...
At some point might look into moving this into actual `do_version` file,
but this is not fully trivial not critical improvement for now.
2022-01-14 17:02:05 +01:00
85df7036f7 Fix T94827: Group Input/Output cannot connect to custom sockets
Caused by rBa5c59fb90ef9.

Since Group Input and Output sockets happen to be of type `SOCK_CUSTOM`
[and since rBa5c59fb90ef9 custom py defined sockets are too :)] a check
introduced in rB513066e8ad6f that prevents connections for `SOCK_CUSTOM`
triggered.

Now refine the check, so it specifically looks for NODE_GROUP_INPUT /
NODE_GROUP_OUTPUT, too (this keeps the intention intact to not connect
group inputs to group outputs and vice versa, but allows custom py
defined sockets to connect again) and put it in new utility function.

Maniphest Tasks: T94827

Differential Revision: https://developer.blender.org/D13817
2022-01-14 16:30:59 +01:00
e57365a70b Cleanup split foreach_libblock_remap_callback into smaller functions. 2022-01-14 15:50:42 +01:00
348631cffe Fix: Compilation error caused by missing target relation
bf_nodes/bf_nodes_composite depend on DNA headers
2022-01-14 07:46:00 -07:00
8ae6995e98 Tests: show more precise numbers in benchmark charts 2022-01-14 15:17:22 +01:00
c0d0e2788b Cleanup: compiler warnings with clang 2022-01-14 15:17:22 +01:00
ba48c1ee58 macOS: silence bundle identifier mismatch Xcode warning
Blender.xcodeproj User-supplied CFBundleIdentifier value
'org.blenderfoundation.blender' in the Info.plist must be the same as
the PRODUCT_BUNDLE_IDENTIFIER build setting value ''.

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D13826
2022-01-14 19:33:23 +05:30
6f51cb0ad7 Info.plist: Bump LSMinimumSystemVersion to silence warning
Didn't remove the key-value pair since old Xcode behavior is not
known.

warning: LSMinimumSystemVersion of '10.9.0' is less than the value of
MACOSX_DEPLOYMENT_TARGET '10.13' - setting to '10.13'. (in target
'blender' from project 'Blender')

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D13831
2022-01-14 19:33:06 +05:30
a5cb7c1e62 blenlib/ Any tests: fix self-assignment warning and typo
Fix assignment warning

source/blender/blenlib/tests/BLI_any_test.cc:56:5: warning: explicitly
assigning value of variable of type 'blender::Any<void, 8, 8>'
to itself [-Wself-assign-overloaded]
  c = c;

Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D13835
2022-01-14 19:32:29 +05:30
0cf746c1fa Fix T94878: LineArt crease threshold logic error.
A coding mistake allows default crease to override object crease, now fixed.
2022-01-14 21:43:52 +08:00
c0432d5edb Fix T94089: GPencil Drawing don't Update after paste in Dopesheet
When paste new frames, the datablock need to be tagged to update the drawings.
2022-01-14 13:51:30 +01:00
86b7746e3c Fix T94903: GPencil: Copying keys doesn't preserve Keyframe Type
When a new frame is created, ensure the keytype of source key is used.
2022-01-14 13:05:57 +01:00
0a3de0305c Cleanup: move attribute operators to c++ 2022-01-14 12:53:19 +01:00
c9a8975de5 Fix T94867: viewport render not updating when editing color ramp
The changed node wasn't tagged correctly.
2022-01-14 12:50:53 +01:00
261517e475 Cleanup: Fix warning when compiling without Audaspace 2022-01-14 11:56:02 +01:00
c8e536bac3 Fix T94837: curve tilt on a 2-point-curve is wrong
2-point-curves are treated separately from 3plus-point-curves (assume a
lot of the twisting reduction can be skipped, so there is a dedicated
function for single segment curves).

And while using the 3plus-point-curves function [`make_bevel_list_3D`]
would actually work in this case, the dedicated function
`make_bevel_list_segment_3D` would only consider the tilt of the second
point and would just copy over the quat to the first point as well. Dont
see a reason for this, now consider the first point's tilt as well.

Maniphest Tasks: T94837

Differential Revision: https://developer.blender.org/D13813
2022-01-14 11:26:21 +01:00
e0ac75cb44 Cleanup: Reduce indentation in foreach_libblock_remap_callback. 2022-01-14 09:55:35 +01:00
7c568e7d36 Python API: add "children_recursive" property to Object & Collection
This is a convenience property, already available for bones.

Simplifies D13821 which in-lined this function.
2022-01-14 12:21:56 +11:00
cea588b9ef Cleanup: spelling in comments, C++ style comments for disabled code
Also ensure space at end of comment.
2022-01-14 11:23:46 +11:00
7a0cf2c72f Fix crash caused by exception in Python gizmo target get handler 2022-01-14 10:18:52 +11:00
1bd0a87384 Cleanup: Clang tidy
- modernize-deprecated-headers
- modernize-use-using
- modernize-use-nullptr
- modernize-use-bool-literals
2022-01-13 17:11:38 -06:00
8b3d798374 CMake: add WITH_LINKER_MOLD option for GCC/Clang Unix platforms
Can give considerably faster linking, especially on system with many
cores.

The mold linker recently reached 1.0, see:
https://github.com/rui314/mold

The current stable release of GCC can't use this linker via
-fuse-ld=mold, so this patch uses the "-B" argument to add a binary
directory containing an alternate "ld" command that points to
"mold" (which is part of the default mold installation).

Some timing tests for linking full builds for AMD TR 3970X:

- BFD: 20.78 seconds.
- LLD: 12.16 seconds.
- GOLD: 7.21 seconds.
- MOLD: 2.53 seconds.

Ref D13807

Reviewed by: sergey, brecht
2022-01-14 09:44:58 +11:00
0c5ccae79d Fix: Incorrect logic in mesh validation for removing layers
The mask is only used if it's not zero. Adding the normal mask made
it not zero, but it didn't include anything else, so all custom data
layers except normals were removed. The fix is to only add normals
to the mask when it should be used.
2022-01-13 16:36:50 -06:00
cfa53e0fbe Refactor: Move normals out of MVert, lazy calculation
As described in T91186, this commit moves mesh vertex normals into a
contiguous array of float vectors in a custom data layer, how face
normals are currently stored.

The main interface is documented in `BKE_mesh.h`. Vertex and face
normals are now calculated on-demand and cached, retrieved with an
"ensure" function. Since the logical state of a mesh is now "has
normals when necessary", they can be retrieved from a `const` mesh.

The goal is to use on-demand calculation for all derived data, but
leave room for eager calculation for performance purposes (modifier
evaluation is threaded, but viewport data generation is not).

**Benefits**
This moves us closer to a SoA approach rather than the current AoS
paradigm. Accessing a contiguous `float3` is much more efficient than
retrieving data from a larger struct. The memory requirements for
accessing only normals or vertex locations are smaller, and at the
cost of more memory usage for just normals, they now don't have to
be converted between float and short, which also simplifies code

In the future, the remaining items can be removed from `MVert`,
leaving only `float3`, which has similar benefits (see T93602).

Removing the combination of derived and original data makes it
conceptually simpler to only calculate normals when necessary.
This is especially important now that we have more opportunities
for temporary meshes in geometry nodes.

**Performance**
In addition to the theoretical future performance improvements by
making `MVert == float3`, I've done some basic performance testing
on this patch directly. The data is fairly rough, but it gives an idea
about where things stand generally.
 - Mesh line primitive 4m Verts: 1.16x faster (36 -> 31 ms),
   showing that accessing just `MVert` is now more efficient.
 - Spring Splash Screen: 1.03-1.06 -> 1.06-1.11 FPS, a very slight
   change that at least shows there is no regression.
 - Sprite Fright Snail Smoosh: 3.30-3.40 -> 3.42-3.50 FPS, a small
   but observable speedup.
 - Set Position Node with Scaled Normal: 1.36x faster (53 -> 39 ms),
   shows that using normals in geometry nodes is faster.
 - Normal Calculation 1.6m Vert Cube: 1.19x faster (25 -> 21 ms),
   shows that calculating normals is slightly faster now.
 - File Size of 1.6m Vert Cube: 1.03x smaller (214.7 -> 208.4 MB),
   Normals are not saved in files, which can help with large meshes.

As for memory usage, it may be slightly more in some cases, but
I didn't observe any difference in the production files I tested.

**Tests**
Some modifiers and cycles test results need to be updated with this
commit, for two reasons:
 - The subdivision surface modifier is not responsible for calculating
   normals anymore. In master, the modifier creates different normals
   than the result of the `Mesh` normal calculation, so this is a bug
   fix.
 - There are small differences in the results of some modifiers that
   use normals because they are not converted to and from `short`
   anymore.

**Future improvements**
 - Remove `ModifierTypeInfo::dependsOnNormals`. Code in each modifier
   already retrieves normals if they are needed anyway.
 - Copy normals as part of a better CoW system for attributes.
 - Make more areas use lazy instead of eager normal calculation.
 - Remove `BKE_mesh_normals_tag_dirty` in more places since that is
   now the default state of a new mesh.
 - Possibly apply a similar change to derived face corner normals.

Differential Revision: https://developer.blender.org/D12770
2022-01-13 14:38:25 -06:00
800fc17367 Fix/workaround MSVC compile error with messag-bus
Some of the message-bus macros are not safe to use in C++. This has come
up before, but no good solution was found. Now @LazyDodo, @HooglyBoogly
and I concluded this is the best duct tape "solution" for the moment.
The message-bus API should address this.
2022-01-13 20:40:52 +01:00
1c4a1c13e0 Cleanup: Run make format 2022-01-13 19:56:11 +01:00
5ecaa9a838 Fix compilation error caused by missing target relation
compositor depends on DNA now so that it can access offsets.
2022-01-13 11:34:41 -07:00
3537abe84b Geometry Nodes: Rename String to Curves socket
Today many users seem to think the output from
this node is a single curve with multiple splines.
This patch renames the geometry output socket
from "Curves" to "Curve Instances" to avoid confusion.

Differential Revision: https://developer.blender.org/D13693
2022-01-13 19:17:03 +01:00
743b9c5e1d CMake: fix build issue with gcc+clang-tidy
Precompiled headers are in a compiler specific format,
when using clang-tidy it tries to read the GCC PCH file
and fails at that.

Disable PCH's for now when WITH_CLANG_TIDY is enabled since
a clean work-around doesn't seem readily available.

relevant LLVM/CMake bugs:

https://bugs.llvm.org/show_bug.cgi?id=41579
https://gitlab.kitware.com/cmake/cmake/-/issues/22081

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

Reviewed by: sergey, Blendify
2022-01-13 09:47:14 -07:00
b8157f5bf1 Fix compilation error caused by missing target relation
Space clip depends on DNA now so that it can access offsets.
2022-01-13 17:25:57 +01:00
22dc865a86 Cleanup: Use nullptr in new Outliner C++ files 2022-01-13 17:01:47 +01:00
039cc32917 Outliner: Compile all Outliner files in C++
We want to refactor quite some of the Outliner code using C++, this is a
logical step to help the transition to a new architecture.

Includes plenty of fixes to make this compile without warnings, trying
not to change logic. The usual stuff (casts from `void *`, designated
initializers, compound literals, etc.).
2022-01-13 17:01:47 +01:00
1a4f8ab389 Cleanup: Make message-bus utility macros callable from C++
C++ doesn't support compound literals like used here (GCC does via an
extension).
2022-01-13 17:01:47 +01:00
f173973ae4 Fix T94874: Drivers using bone custom properties don't work on modifiers 2022-01-13 15:17:32 +01:00
79e985ea54 Cleanup: fix building all geometry nodes in one translation unit
There were a couple of function name collisions which were caused
by sharing code with the mask modifier. I just removed the dependence
on the mask modifier now. The code that I duplicated for that purpose
is only in a legacy node, so it can be expected to be removed soonish.
2022-01-13 12:39:48 +01:00
19a6220308 Fix link errors after recent FFMPEG / link_directories changes 2022-01-13 11:12:56 +01:00
d53738396f Tests: skip some compositor tests when WITH_LIBMV=OFF 2022-01-13 10:41:34 +01:00
7bb572f208 Fix T94737: Cycles wrong normal map normal with OSL
Ensure valid reflection was moved elsewhere, should not be done in the node
anymore.
2022-01-13 10:40:41 +01:00
0cf2fafd81 Fix T94050, T94570, T94527: Cycles Bevel and AO nodes not working with Metal
Workaround what may be a compiler bug, solution found by Michael Jones.
2022-01-13 10:40:41 +01:00
a3deef6fff Fix Cycles CPU + GPU render not using CPU after recent changes
In some places the task scheduler was not initialized in time.
2022-01-13 10:40:41 +01:00
eaa4cdaa42 Fix T94758: wrong denoising albedo with BSSRDF retro reflection 2022-01-13 10:40:40 +01:00
Brecht Van Lommel
29450a2af3 Build: remove usage of link_directories
We are now always using absolute paths for libraries, as recommended by the
CMake docs.

Followup to D9177.
2022-01-13 10:40:38 +01:00
Brecht Van Lommel
75a1a578bd CMake: use FFmpeg find module on Linux
And change install_deps.sh to build shared (instead of static) FFMPEG
libraries, for consistency with other library dependencies and to simplify
the logic. This may require users of install_deps.sh to rebuild FFMPEG.

This is the last step that lets us get rid of LIBPATH variables and
link_directories() entirely, as recommended by the CMake docs.

Some fixes were needed in the find FFMPEG module to make it actually work,
this code was unused up to now.

Followup to D8855.

Differential Revision: https://developer.blender.org/D9177
2022-01-13 10:27:11 +01:00
f1a488d0f2 Fix T92953: Tool Settings: Drag on Tweak fails with LMB select 2022-01-13 14:30:12 +11:00
a7c9fb59ca Cleanup: follow code-style for float suffix 2022-01-13 12:34:28 +11:00
227f0f3582 Cleanup: quiet missing braces warning 2022-01-13 12:33:34 +11:00
97c2c39916 Fix T94624: Object as font instances don't work
The fundamental limitation is that we can only have one instance
("dupli") generator at a time. Because the mesh output of a curve
object is output as an instances, the geometry set instances existed,
replacing the object as font instances. The "fix" is to reverse the
order. The behavior won't be perfect still, but at least the old
behavior will be preserved, which is really what matters for a
feature like this.

One way to take this change further would be completely disabling
regular geometry evaluation while this option is active. However,
it doesn't seem like that would actually improve the state of the code.

Differential Revision: https://developer.blender.org/D13768
2022-01-12 13:46:13 -06:00
a311fa96aa Fix T85706: wm_window_make_drawable update DPI
When drawing windows on monitors that differ in DPI, we can sometimes
have UI elements draw at an incorrect scale. This patch just ensures
that `wm_window_make_drawable` always updates DPI.

See D10483 for more details.

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

Reviewed by Brecht Van Lommel
2022-01-12 10:37:52 -08:00
e594f23a27 Revert "CMake: use FFmpeg find module on Linux"
This reverts commit 62a0de1673. Linux buildbot
is giving link errors.
2022-01-12 19:07:40 +01:00
fa8c2c7885 Fix T94071: Area Split Improvements
Allow area Split to be initiated in any area and give better feedback
when not allowed.

See D13599 for more details and usage examples.

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

Reviewed by Campbell Barton
2022-01-12 09:45:19 -08:00
a0dcd0bf2c Fix warnings after bab47b60cb
It's not really clear how this part of the defaults code should be used,
I think this is fine now and solves the warnings.
2022-01-12 18:37:53 +01:00
a72a9e099c Cleanup: Correct indentation 2022-01-12 18:37:53 +01:00
Brecht Van Lommel
62a0de1673 CMake: use FFmpeg find module on Linux
And change install_deps.sh to build shared (instead of static) FFMPEG
libraries, for consistency with other library dependencies and to simplify
the logic. This may require users of install_deps.sh to rebuild FFMPEG.

This is the last step that lets us get rid of LIBPATH variables and
link_directories() entirely, as recommended by the CMake docs.

Some fixes were needed in the find FFMPEG module to make it actually work,
this code was unused up to now.

Followup to D8855.

Differential Revision: https://developer.blender.org/D9177
2022-01-12 18:25:24 +01:00
Simon Lenz
bab47b60cb DNA: Add space clip editor defaults
This is my attempt of adding defaults for the space clip editor struct
(in line with https://developer.blender.org/T80164).

It adds the default allocation for `SpaceClip` and
`node_composite_movieclip.cc`. This also solves the error below (for
C++ files using the DNA_default_alloc), which was put forward by
Sergey Sharybin.

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

Reviewed by: Julian Eisel
2022-01-12 18:04:48 +01:00
Bastien Montagne
a909ab984c Outliner: Add way to display warning icon for items.
While theorically fairly generic, current code is only enabled for
bledfile and liboverride views, and only used to display messages from
library IDs.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D13766
2022-01-12 18:01:50 +01:00
5f7ad4baaa BLI_math: Fix building when WITH_GMP is off 2022-01-12 17:24:57 +01:00
Nikhil Shringarpurey
e5858a3ad0 Icons: Remove absolute pathnames and deprecated gradients from SVG files
SVG files contained specific detailed pathnames on developers'
computers. These included full local user profile and path and should
not be in the release.

This patches corrects those lines. It also removes unused gradients from
the private icons SVG.

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

Reviewed by: Yevgeny Makarov, Julian Eisel
2022-01-12 15:03:05 +01:00
ec5560db73 DRW: Add DRW_gpu_wrapper.hh
This adds wrapper classes that make it easier to use GPU objects in C++.

####Motivations:####

 - Easier handling of GPU objects.
 - EEVEE rewrite already makes use of similar wrappers.
 - There is the ongoing effort to use more C++ in the codebase
 and lans to port more engines to it.
 - The shader code refactor will make use of many UBOs with shared
 struct declaration. This helps managing them.
 - Safer handling of `TextureFromPool` which can't be bound as normal
 texture (only texture ref) and can be better tracked in the future.

####Considerations:####

 - I chose the `blender::draw` namespace because `blender::gpu` already has private classes (i.e: `gpu::Texture`).
 - Theses are wrappers that manage a GPU object internally. They might be confused with actual `Texture`. However, the name `TextureWrapper` is a bit too much verbose in my opinion. I'm open to suggestion about better name.

Reviewed By: jbakker

Differential Revision: http://developer.blender.org/D13805
2022-01-12 13:05:18 +01:00
0882069095 Cleanup: codestyle obj_exporter_tests.cc. 2022-01-12 13:02:28 +01:00
1552b86b55 Cleanup: Not needed if statement around delete. 2022-01-12 13:02:28 +01:00
d43b5791e0 BLI: Refactor vector types & functions to use templates
This patch implements the vector types (i.e:`float2`) by making heavy
usage of templating. All vector functions are now outside of the vector
classes (inside the `blender::math` namespace) and are not vector size
dependent for the most part.

In the ongoing effort to make shaders less GL centric, we are aiming
to share more code between GLSL and C++ to avoid code duplication.

####Motivations:
- We are aiming to share UBO and SSBO structures between GLSL and C++.
This means we will use many of the existing vector types and others
we currently don't have (uintX, intX). All these variations were
asking for many more code duplication.
- Deduplicate existing code which is duplicated for each vector size.
- We also want to share small functions. Which means that vector
functions should be static and not in the class namespace.
- Reduce friction to use these types in new projects due to their
incompleteness.
- The current state of the `BLI_(float|double|mpq)(2|3|4).hh` is a
bit of a let down. Most clases are incomplete, out of sync with each
others with different codestyles, and some functions that should be
static are not (i.e: `float3::reflect()`).

####Upsides:
- Still support `.x, .y, .z, .w` for readability.
- Compact, readable and easilly extendable.
- All of the vector functions are available for all the vectors types
and can be restricted to certain types. Also template specialization
let us define exception for special class (like mpq).
- With optimization ON, the compiler unroll the loops and performance
is the same.

####Downsides:
- Might impact debugability. Though I would arge that the bugs are
rarelly caused by the vector class itself (since the operations are
quite trivial) but by the type conversions.
- Might impact compile time. I did not saw a significant impact since
the usage is not really widespread.
- Functions needs to be rewritten to support arbitrary vector length.
For instance, one can't call `len_squared_v3v3` in
`math::length_squared()` and call it a day.
- Type cast does not work with the template version of the `math::`
vector functions. Meaning you need to manually cast `float *` and
`(float *)[3]` to `float3` for the function calls.
i.e: `math::distance_squared(float3(nearest.co), positions[i]);`
- Some parts might loose in readability:
`float3::dot(v1.normalized(), v2.normalized())`
becoming
`math::dot(math::normalize(v1), math::normalize(v2))`
But I propose, when appropriate, to use
`using namespace blender::math;` on function local or file scope to
increase readability.
`dot(normalize(v1), normalize(v2))`

####Consideration:
- Include back `.length()` method. It is quite handy and is more C++
oriented.
- I considered the GLM library as a candidate for replacement. It felt
like too much for what we need and would be difficult to extend / modify
to our needs.
- I used Macros to reduce code in operators declaration and potential
copy paste bugs. This could reduce debugability and could be reverted.
- This touches `delaunay_2d.cc` and the intersection code. I would like
to know @howardt opinion on the matter.
- The `noexcept` on the copy constructor of `mpq(2|3)` is being removed.
But according to @JacquesLucke it is not a real problem for now.

I would like to give a huge thanks to @JacquesLucke who helped during this
and pushed me to reduce the duplication further.

Reviewed By: brecht, sergey, JacquesLucke

Differential Revision: https://developer.blender.org/D13791
2022-01-12 12:57:07 +01:00
fb6bd88644 Revert "BLI: Refactor vector types & functions to use templates"
Includes unwanted changes

This reverts commit 46e049d0ce.
2022-01-12 12:50:02 +01:00
Clment Foucault
46e049d0ce BLI: Refactor vector types & functions to use templates
This patch implements the vector types (i.e:`float2`) by making heavy
usage of templating. All vector functions are now outside of the vector
classes (inside the `blender::math` namespace) and are not vector size
dependent for the most part.

In the ongoing effort to make shaders less GL centric, we are aiming
to share more code between GLSL and C++ to avoid code duplication.

####Motivations:
 - We are aiming to share UBO and SSBO structures between GLSL and C++.
 This means we will use many of the existing vector types and others
 we currently don't have (uintX, intX). All these variations were
 asking for many more code duplication.
 - Deduplicate existing code which is duplicated for each vector size.
 - We also want to share small functions. Which means that vector
 functions should be static and not in the class namespace.
 - Reduce friction to use these types in new projects due to their
 incompleteness.
 - The current state of the `BLI_(float|double|mpq)(2|3|4).hh` is a
 bit of a let down. Most clases are incomplete, out of sync with each
 others with different codestyles, and some functions that should be
 static are not (i.e: `float3::reflect()`).

####Upsides:
 - Still support `.x, .y, .z, .w` for readability.
 - Compact, readable and easilly extendable.
 - All of the vector functions are available for all the vectors types
 and can be restricted to certain types. Also template specialization
 let us define exception for special class (like mpq).
 - With optimization ON, the compiler unroll the loops and performance
 is the same.

####Downsides:
 - Might impact debugability. Though I would arge that the bugs are
 rarelly caused by the vector class itself (since the operations are
 quite trivial) but by the type conversions.
 - Might impact compile time. I did not saw a significant impact since
 the usage is not really widespread.
 - Functions needs to be rewritten to support arbitrary vector length.
 For instance, one can't call `len_squared_v3v3` in
 `math::length_squared()` and call it a day.
 - Type cast does not work with the template version of the `math::`
 vector functions. Meaning you need to manually cast `float *` and
 `(float *)[3]` to `float3` for the function calls.
 i.e: `math::distance_squared(float3(nearest.co), positions[i]);`
 - Some parts might loose in readability:
 `float3::dot(v1.normalized(), v2.normalized())`
 becoming
 `math::dot(math::normalize(v1), math::normalize(v2))`
 But I propose, when appropriate, to use
 `using namespace blender::math;` on function local or file scope to
 increase readability.
 `dot(normalize(v1), normalize(v2))`

####Consideration:
 - Include back `.length()` method. It is quite handy and is more C++
 oriented.
 - I considered the GLM library as a candidate for replacement. It felt
 like too much for what we need and would be difficult to extend / modify
 to our needs.
 - I used Macros to reduce code in operators declaration and potential
 copy paste bugs. This could reduce debugability and could be reverted.
 - This touches `delaunay_2d.cc` and the intersection code. I would like
 to know @howardt opinion on the matter.
 - The `noexcept` on the copy constructor of `mpq(2|3)` is being removed.
 But according to @JacquesLucke it is not a real problem for now.

I would like to give a huge thanks to @JacquesLucke who helped during this
and pushed me to reduce the duplication further.

Reviewed By: brecht, sergey, JacquesLucke

Differential Revision: https://developer.blender.org/D13791
2022-01-12 12:47:43 +01:00
e5766752d0 Revert "BLI: Refactor vector types & functions to use templates"
Reverted because the commit removes a lot of commits.

This reverts commit a2c1c368af.
2022-01-12 12:44:26 +01:00
Nathan Rozendaal
b2ccd8546c Compositor: Add Scene Time Node, Rename Time node
Fixes issue T94603
It adds a new compositor node called Scene Time which is already present as a geo node, having the same basic nodes available in all node trees is a nice thing to have.
Renames "Time" node to "Time Curve", this is done to avoid confusion between the Time node and the Scene Time node.

Reviewed By: jbakker

Maniphest Tasks: T94603

Differential Revision: https://developer.blender.org/D13762
2022-01-12 12:29:44 +01:00
a2c1c368af BLI: Refactor vector types & functions to use templates
This patch implements the vector types (i.e:float2) by making heavy
usage of templating. All vector functions are now outside of the vector
classes (inside the blender::math namespace) and are not vector size
dependent for the most part.

In the ongoing effort to make shaders less GL centric, we are aiming
to share more code between GLSL and C++ to avoid code duplication.

Motivations:
- We are aiming to share UBO and SSBO structures between GLSL and C++.
  This means we will use many of the existing vector types and others we
  currently don't have (uintX, intX). All these variations were asking
  for many more code duplication.
- Deduplicate existing code which is duplicated for each vector size.
- We also want to share small functions. Which means that vector functions
  should be static and not in the class namespace.
- Reduce friction to use these types in new projects due to their
  incompleteness.
- The current state of the BLI_(float|double|mpq)(2|3|4).hh is a bit of a
  let down. Most clases are incomplete, out of sync with each others with
  different codestyles, and some functions that should be static are not
  (i.e: float3::reflect()).

Upsides:
- Still support .x, .y, .z, .w for readability.
- Compact, readable and easilly extendable.
- All of the vector functions are available for all the vectors types and
  can be restricted to certain types. Also template specialization let us
  define exception for special class (like mpq).
- With optimization ON, the compiler unroll the loops and performance is
  the same.

Downsides:
- Might impact debugability. Though I would arge that the bugs are rarelly
  caused by the vector class itself (since the operations are quite trivial)
  but by the type conversions.
- Might impact compile time. I did not saw a significant impact since the
  usage is not really widespread.
- Functions needs to be rewritten to support arbitrary vector length. For
  instance, one can't call len_squared_v3v3 in math::length_squared() and
  call it a day.
- Type cast does not work with the template version of the math:: vector
  functions. Meaning you need to manually cast float * and (float *)[3] to
  float3 for the function calls.
  i.e: math::distance_squared(float3(nearest.co), positions[i]);
- Some parts might loose in readability:
  float3::dot(v1.normalized(), v2.normalized())
  becoming
  math::dot(math::normalize(v1), math::normalize(v2))
  But I propose, when appropriate, to use
  using namespace blender::math; on function local or file scope to
  increase readability. dot(normalize(v1), normalize(v2))

Consideration:
- Include back .length() method. It is quite handy and is more C++
  oriented.
- I considered the GLM library as a candidate for replacement.
  It felt like too much for what we need and would be difficult to
  extend / modify to our needs.
- I used Macros to reduce code in operators declaration and potential
  copy paste bugs. This could reduce debugability and could be reverted.
- This touches delaunay_2d.cc and the intersection code. I would like to
  know @Howard Trickey (howardt) opinion on the matter.
- The noexcept on the copy constructor of mpq(2|3) is being removed.
  But according to @Jacques Lucke (JacquesLucke) it is not a real problem
  for now.

I would like to give a huge thanks to @Jacques Lucke (JacquesLucke) who
helped during this and pushed me to reduce the duplication further.

Reviewed By: brecht, sergey, JacquesLucke

Differential Revision: http://developer.blender.org/D13791
2022-01-12 12:19:39 +01:00
d320f3677e Cleanup: make format 2022-01-12 11:29:18 +01:00
1e61b759c7 Fix T94797: crash when playing animation in eevee rendered view
The issue was caused by rBd09b1d2759861aa012ab2e7e4ce2ffa2.
Since this commit, the image users in gpu materials were updated
during depsgraph evaluation as well. However, there was a race
condition when one thread is deleting gpu materials in `BKE_material_eval`
while another thread is updating the image users at the same time.

The solution is to make sure that deleting gpu materials is done before
iterating over all gpu materials, by adding a new depsgraph relation.
2022-01-12 11:15:22 +01:00
145f1d1e0a Fix T94812: render layer sockets are missing after file load
The main issue was the use of `G_MAIN` during file load.
This patch refactors the code so that iterating over `G_MAIN`
is not necessary anymore. See D13800 for more details.

Differential Revision: https://developer.blender.org/D13800
2022-01-12 11:07:31 +01:00
7a2b181591 Fix T94041: Loading a new file gives crash while rendering in viewport
The issue was caused by Cycles display driver not being able to restore
window's OpenGL context after disposing Cycles-side OpenGL context.

This is due to the window OpenGL re-activation needing to access window
manager which gets cleared out form global main during file reading.

Defer clearing window manager from the global main to until after all
screens are "exited". This allows Cycles to properly stop rendering,
dispose its OpenGL context, and restore window's drawable context.

It is unclear why it was required to clear window manager list early
on. Guess is that it comes from an original code in a1c8543f2a where
there was an early return which then got replaced with an actual logic
without changing the order of de-initialization and window manager list
clear.

Differential Revision: https://developer.blender.org/D13799
2022-01-12 10:01:33 +01:00
ebad1d8d33 CMake: exclude linker options for APPLE and non-UNIX
These are only used for non-apple unix systems.
2022-01-12 18:55:13 +11:00
795cea2cce Revert "Cleanup GPencil strength previous commit"
This reverts commit e339946515.

This broken the tablet pressure and it was impossible to set a proper strength.
2022-01-12 08:45:57 +01:00
7f28084e2a Cleanup: use utility functions 2022-01-12 06:46:12 +01:00
77616082f4 Fix T89542: Crash when loading certain .hdr files
The direct cause of the bug in question was passing in the raw memory
buffer to sscanf. It should be called with a null-terminated buffer;
which isn't guaranteed when blindly trusting the file data.

When attempting to fuzz this code path, a variety of other crashes were
discovered and fixed.

Differential Revision: https://developer.blender.org/D11952
2022-01-11 20:48:32 -08:00
0dc309bef6 Cleanup: remove redundant const qualifiers for POD types 2022-01-12 12:51:11 +11:00
f4492629ea Cleanup: VSE channel drawing
Remove code that very slightly darkened line on bottom of timeline, when
backdrop is enabled. Purpose of the code wasn't dodumented, and 2.79
doesn't seem to produce this darkened line.
Rename drawing functions to appropriate names.
2022-01-12 01:46:27 +01:00
ef5d01d98f deps_builder: GMP 6.2.1
Pretty straightforward update, nothing noteworthy to report.

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

Reviewed by: brecht, sybren
2022-01-11 16:26:30 -07:00
89145341e5 BLF: UI_fontstyle_draw Usage
Add maximum string length argument to UI_fontstyle_draw to reduce usage
of BLF_DRAW_STR_DUMMY_MAX. Reorders arguments to UI_fontstyle_draw_ex

See D13794 for more details.

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

Reviewed by Campbell Barton
2022-01-11 14:52:39 -08:00
bbe59c6014 BLF: Reduction of use of BLF_DRAW_STR_DUMMY_MAX
Reduction of the number of uses of the define BLF_DRAW_STR_DUMMY_MAX
by using actual sizes of static character arrays.

See D13793 for more details.

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

Reviewed by Campbell Barton
2022-01-11 14:08:38 -08:00
ab125f466c Fix T94751: ground created by Setup Tracking Scene not marked as Shadow Catcher
Change that was missing in {rBca64bd0aacda}.
2022-01-11 19:02:04 -03:00
947dc21979 Cleanup: Fix build warning with MSVC
comparing a bool > 0 make MSVC emit
warning C4804: '>': unsafe use of type 'bool' in operation.

int does the job nicely.
2022-01-11 14:57:54 -07:00
5a6ec0f003 Build: Enable unity build for bf_compositor
Blender's compositor code already makes extensive use of
namespace which makes it very simple to enable unity build.
There was one duplicated function that has since to be moved
to a common header.

I saw roughly a 3x speedup of bf_compositor using ninja on
linux using i5 8250u (1:34 down to 0:34).

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D13792
2022-01-11 16:55:45 -05:00
48ff9b57f8 Build: Add precompiled headers for bf_compositor
With this change, compilation saw a 2.4x improvement.

This can be combined with unity build to give an overall 4x improvement

Depends on D13797

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D13798
2022-01-11 16:50:35 -05:00
bdf99a5119 cleanup: hipew remove unused variables
caused 4 warnings, nothing even conditionally
uses them, can be safely removed.
2022-01-11 14:49:29 -07:00
e339946515 Cleanup previous commit
Don't need check minimum constant value, brush value is enough.
2022-01-11 22:48:26 +01:00
ac3d07ad17 Fix T94799: GPencil Strokes drawn at 0.0 Strength still visible
There was a clamp with a value greater than 0.
2022-01-11 22:45:50 +01:00
376e425c02 Fix T93588: some videos loaded flipped over Y axis on macOS Arm
Was not actually flipping in the need_aligned_ffmpeg_buffer case.
2022-01-11 21:43:32 +01:00
45bb6b836a IME Cleanup: Unused GHOST_TEventImeData Member
Removal of unused tmp member of GHOST_TEventImeData. Not used now,
nor was it used by the commit that added it to begin with.

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

Reviewed by Ray Molenkamp
2022-01-11 12:35:11 -08:00
e95b4dc2dd Cleanup: Fix build warnings with MSVC
our UNUSED macro is essentially a no-op for MSVC, which lead to
the situation  where this well meant macro was emitting the
following warning:

C4189: 'UNUSED_i': local variable is initialized but not referenced

However since we have been on c++17 for a while now the UNUSED
macro can be replaced with the standard [[maybe_unused]] attribute
in cpp files.

This changes cleans up the use of the UNUSED macro in the
bf_nodes_geometry project.

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

Reviewed by: JacquesLucke, Severin, Sergey, HooglyBoogly
2022-01-11 12:54:18 -07:00
259a71cd3c Build: use precompiled headers on all platforms
Since CMake 3.16, CMake has native precompiled header (PCH) support.

This change swaps Blender's own PCH implementation with the native implementation.
Previously, PCH was only enabled on Windows however,
this new implementation works on all platforms.

For more information see https://cmake.org/cmake/help/latest/command/target_precompile_headers.html

On my system, Linux with ninja running on an i5 8250U
I saw a 60% reduction in compile times for `bf_freestyle` + linking time.

Reviewed By: LazyDodo, brecht

Differential Revision: https://developer.blender.org/D13797
2022-01-11 14:18:58 -05:00
8cff1ecf9f Fix T94804: GPencil Simplify when strokes are Automerged in Draw Mode
The problem was the points were selected in edit mode and then sampled. Now, in draw mode, the points are always unselected to avoid this effect in the auto merge process.
2022-01-11 19:20:27 +01:00
Henrik Dick
631067e559 Add support for a longest diagonal quad triangulation mode
The new triangulation mode for quads is the opposite of the current default
shortest diagonal mode. It is optimal for cloth simulations using quad meshes.

Differential Revision: http://developer.blender.org/D13777
2022-01-11 18:51:25 +01:00
41ce7807a6 Fix T94299: Object asset set as visible but doesn't show
Differential Revision: https://developer.blender.org/D13738

Reviewed by: Bastien Montagne, Sergey Sharybin
2022-01-11 18:38:05 +01:00
ccac22fec5 Cleanup compiler warning in Windows
`bool` used instead of `int`
2022-01-11 16:48:16 +01:00
6774cae3f2 Fix T94728: Auto Depth problem with Cliping Region
Issue introduced in rB1d49293b80446b89b5b12fa0eeefaf14e5051e48

`drw_manager_init` must be called after `drw_context_state_init` as
`DST.draw_ctx.sh_cfg` (indicating when the view is clipped) must be set
first.

Differential Revision: https://developer.blender.org/D13795
2022-01-11 10:39:39 -03:00
fc0f315106 Cleanup: remove unnecessary 'use_opengl_context' parameter
The argument passed is always false.
2022-01-11 10:28:32 -03:00
Aleksi Juvani
0c94e5d166 Fix PSYS_GLOBAL_HAIR stripped even if connecting the hair fails
After disconnecting hair on an object, if you then hide the particle system, and try connecting the hair again, the operator is cancelled due to `remap_hair_emitter` returning `false` because `target_psmd->mesh_final` is NULL, but `connect_hair` will still strip the `PSYS_GLOBAL_HAIR` flag, which will cause the hair in the hidden particle system to be positioned incorrectly. The correct behavior is to strip the flag only if `remap_hair_emitter` succeeds.

Differential Revision: https://developer.blender.org/D13703
2022-01-11 13:08:13 +01:00
9dc9692b09 Select Similar: hide 'threshold' from UI when not used
When the 'threshold' is not used in the type we are comparing, just hide
it. This was obvious for some types (e.g. Materials), but maybe not so
on others (e.g. Polygon Sides) and potentionally confusing.

Reported by @hitrpr in chat.

Differential Revision: https://developer.blender.org/D13760
2022-01-11 11:47:57 +01:00
255727b752 GPU: Utility function to bind UBO to batches. 2022-01-11 09:57:22 +01:00
Evan Wilson
1949aece21 Explicit Color OCIO role comment fix.
This is an update to the correct OCIO role.

It changes `SceneReference` to `scene_linear`

See https://opencolorio.readthedocs.io/en/latest/guides/authoring/overview.html#config-roles

>     - reference - the color space against which the other color spaces are defined
>NOTE: The reference role has sometimes been misinterpreted as being the space in which “reference art” is stored in.
>
>    - scene_linear - the scene-referred linear-to-light color space, often the same as the reference space

The current OCIO UX working group doc says:

>reference: This role has had multiple interpreted meanings over the years and is a common point of confusion. It is kept in OCIO for backwards compatibility, but the recommendation is that it is not used by apps.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11398
2022-01-11 09:55:22 +01:00
4e8a883bcc Cleanup: use unity build for composite nodes
GIves about a 2.1x improvement in compilation times.
2022-01-11 02:57:14 -05:00
bc02ede98b Cleanup: Deduplicate finv_test function 2022-01-11 02:16:47 -05:00
d608b98145 Cleanup: quite missing-variable-declarations warnings 2022-01-11 18:16:00 +11:00
9af81c2b74 Cleanup: correct exception message 2022-01-11 18:16:00 +11:00
c77f837598 Revert "Cleanup: remove declaration for removed function"
This reverts commit aa363ec2ae.

The function still exists, this commit caused a warning with Clang
So keep MEM_printmemlist_pydict.
2022-01-11 18:16:00 +11:00
fd922f5940 Cleanup: Composite nodes: add namespace for every file
This puts all static functions in composite node files into a new
namespace. This allows using unity build which can improve
compile times significantly.

This is a follow up on rB1df8abff257030ba79bc23dc321f35494f4d91c5
but for compositor nodes.

The namespace name is derived from the file name.
That makes it possible to write some tooling that checks the names later on.
The filename extension (`cc`) is added to the namespace name as well.
his also possibly simplifies tooling but also makes it more obvious that this namespace is specific to a file.

Reviewed By: JacquesLucke, HooglyBoogly, jbakker

Differential Revision: https://developer.blender.org/D13466
2022-01-11 02:11:14 -05:00
f2fb9a0c59 Fix T94768: Crash in VSE prefetching
If timeline contains scene strip outside of edited meta strip, this will
cause crash. This is because prefetchin ignored meta strips being edited
when rendering, but did check for scene strips only inside edited meta
strip.

Change active seqbase pointer when entering meta strip. This makes it
possible to prefetch only content that is being presented to user.
2022-01-11 06:12:15 +01:00
f134341e03 Fix T94671: performance regression with subsurf modifier
rBeed45d2a239a introduced a GPU backend for OpenSubDiv which lets us do
the subdivision at render time. However, some tools might still need to
have the subdivision data available on the CPU side. For this a
subdivision mesh wrapper was also introduced, and is computed whenever a
CPU side mesh is needed. The subdivision settings for this wrapper are
stored during modifier evaluation if GPU subdivision can be done.

The performance regression is due to the fact that although the
subdivision mesh was already computed on the CPU, and no subdivision
wrapper is generated, some checks for creating subdivision data in
`BKE_mesh_wrapper_ensure_subdivision` where still run, one of which is
very expensive.

To fix this we first check the runtime settings of the mesh to see if
subdivision is needed at all.
2022-01-11 03:34:16 +01:00
922ae55a16 Spreadsheet: Add mesh topology information with a debug value
This commit adds topology information from mesh data structs to the
spreadsheet when the debug value `4001` is set. Eventually we could
expose these. For now it can be a useful tool for developers when
working on mesh algorithms.

Differential Revision: https://developer.blender.org/D13735
2022-01-10 16:45:53 -06:00
37b336a8af Cleanup: Remove unused "active ID" node flag
The value of this flag was only retrieved in `nodeGetActiveID`, which
wasn't used anywhere. Other than that, the `NODE_ACTIVE_ID` and
related functions seem to come from the Blender internal renderer.

Differential Revision: https://developer.blender.org/D13770
2022-01-10 16:42:50 -06:00
f4af21038d Geometry Nodes: Move normal field input to be usable elsewhere
This commit moves the normal field input to `BKE_geometry_set.hh`
from the node file so that normals can be used as an implicit input to
other nodes.

Differential Revision: https://developer.blender.org/D13779
2022-01-10 16:41:05 -06:00
fe82b8d1e8 Docs: correct doc-string for bl_run_operators_event_simulate
The event() action swapped type/value arguments.
2022-01-11 09:13:25 +11:00
4b8cf11fa5 macOS: fix xcrun sdk detection for minimal CLT
Differential Revision: https://developer.blender.org/D13783
2022-01-11 01:07:31 +05:30
a4a95c8d36 Docs: Add comments to node socket struct header 2022-01-10 12:29:09 -06:00
ccf06fffbc UI: Allow AltGr Key + C,V,X Text Input
Slight change to our processing of Ctrl-C, Ctrl-V, and Ctrl-X so that
they will not be triggered if Alt is also pressed. This allows entry
of AltGr-C, -V, -X when using International keyboard layouts.

See D13781 for more details

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

Reviewed by Brecht Van Lommel
2022-01-10 09:52:19 -08:00
Takahiro Shizuki
57bea57f5e Fix T94434: Windows IME Pinyin Forward Slash
Treat "/" as a key that should be evaluated by the Win IME system when
the input language is Chinese. This fixes a duplication of the input
character and results in the expected output of a Chinese wide comma.

See D13771 for more details.

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

Reviewed by Brecht Van Lommel
2022-01-10 09:09:13 -08:00
1a27d20df3 Tests: disable all but one simple test for the Cycles Metal device
Until all tests are passing, this lets us run a basic test on the buildbot.

Ref T92212
2022-01-10 17:35:07 +01:00
39ba82f25d Fix T94111: nurb normal calculation does not work
The normals were computed with an uninitialized tilt.
2022-01-10 17:25:42 +01:00
af6a30ebf1 Fix compilation error after recent fix
For some reason GCC accepted C++-style of unused variable marking.
2022-01-10 17:17:31 +01:00
b0a83a6ed4 Fix compile error with msvc 2022-01-10 17:10:07 +01:00
292c2cefe3 Fix T93727: Tiled render error in Cycles after changing temp directory
Consider temporary directory to be variant part of session configuration
which gets communicated to the tile manager on render reset.

This allows to be able to render with one temp directory, change the
directory, render again and have proper render result even with enabled
persistent data.

For the ease of access to the temp directory expose it via the render
engine API (engine.temp_directory).

Differential Revision: https://developer.blender.org/D13790
2022-01-10 16:54:12 +01:00
20cb2c72a5 Fix second render failure with Cycles persistent data
The issue was caused by the recent changes in the way how the
render result is drawn: the display driver now could hold an
OpenGL resources. Those resources are not shared across contexts
so whenever OpenGL context is destroyed those resources are to
be destroyed as well (and not attempted to be re-used for a next
render).

Do such destruction and entire driver re-creation since it does
simplifies things from API usage point of view without causing
measurable slowdown.

Steps to reproduce the issue:
- Set the render resolution to 2x of Full HD
- Enable persistent data
- Render (F12)
- Render again

Observe OpenGL state being corrupted. Easy to see in debug mode
where IMM abstraction level reports issues about the buffer size
not being the proper size. This was caused by the display driver
trying to use VAO from the previous OpenGL context.

Differential Revision: https://developer.blender.org/D13789
2022-01-10 16:53:44 +01:00
d9dd8c287f Fix T94661: Out-of-bounds memory access due to malformed DDS image file
Harden bounds check in the stream reader avoiding integer overflow.
2022-01-10 14:27:54 +01:00
76d69bbb08 Fix Cycles compilation with Optix on Windows.
Since Optix 7.3 is required, update the default path accordingly.
2022-01-10 13:39:53 +01:00
8dd163160e Fix T94766: texture coordinates from other object do not refresh
The core issue is that flushing dependencies are created from an object
to a node tree when it contains e.g. a Texture Coordinate node.
That is an issue because the evaluation of the node tree itself does not
depend on the object (node tree evaluation is essentially a no-op).

Only other systems that parse and evaluate the node tree in a specific
context actually depend on e.g. the position of the referenced object.
It can even be the case that the node tree depends on objects that
the actual evaluator (geometry nodes modifier/material) does not depend
on, because a node is not connected to the output.

Geometry nodes makes the distinction between dependencies to the
node tree and to the evaluator already. Shader nodes do not.
Therefore, shader nodes need a flushing relation from node groups
to their parent node groups.

This brings back some unnecessary updates from rB7e712b2d6a0d
(e.g. when creating a node group from nodes that are not connected
to the output). This is a bit unfortunate, but refactoring how
dependencies work with shader nodes is a out of scope for this fix.
2022-01-10 13:02:57 +01:00
Demeter Dzadik
3ec88ae21d Fix error when keyframing with Custom Properties
Since rBf9ccd26b037d, calling `data.path_resolve()` on custom properties
with `None` value do not cause a `ValueError` exception any more. This
is now taken into account in the keying sets targeting custom
properties.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D13787
2022-01-10 13:01:01 +01:00
f5e90a943f Remove GPU_SHADER_2D_POINT_FIXED_SIZE_UNIFORM_COLOR.
Shader isn't used and not accessible via py-api.
2022-01-10 12:51:21 +01:00
8a772645e2 Remove GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR.
Shader isn't used and not accessible via py-api.
2022-01-10 12:51:21 +01:00
1b57dcf320 Remove GPU_SHADER_2D_POINT_UNIFORM_SIZE_VARYING_COLOR_OUTLINE_AA.
Shader isn't used and not accessible via py-api.
2022-01-10 12:51:21 +01:00
6669431846 Remove GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR.
Shader isn't used and not accessible via py-api.
2022-01-10 12:51:21 +01:00
e12a707692 Remove GPU_SHADER_3D_POINT_VARYING_SIZE_UNIFORM_COLOR.
Shader isn't used and not accessible via the py-api.
2022-01-10 12:51:21 +01:00
f813aab787 Remove GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA.
Shader isn't used and isn't accessible via py-api.
2022-01-10 12:51:21 +01:00
cfb3f5062d Cleanup: Remove unused source files. 2022-01-10 12:51:21 +01:00
3488339475 Cleanup: Consistent naming GPU_SHADER_2D_AREA_BORDERS. 2022-01-10 12:51:21 +01:00
227fd753df GPU: Remove unused UV shaders.
The UV shaders have been migrated to the overlay engine and aren't
accessible via the python API.
2022-01-10 12:51:21 +01:00
bd8fa07a3d Cleanup: add utility macro to simplify using std::enable_if 2022-01-10 12:28:33 +01:00
934db6a820 Fix T94409: GPencil smooth stroke thickness operator weird result
The smooth was not working "smoothly" and any change in the factor produced a weird result.
2022-01-10 12:23:52 +01:00
5aac794b11 Fix compile error in gpu test. 2022-01-10 12:16:25 +01:00
1b1e947162 Fix T94600: Apply single shrinkwrap constraint fails
rBd6891d9bee2b introduced a way to apply a single constraint from the
constraint stack. For this we want to work in the evaluated domain, in
particular the constraint target should be evaluated (the shrinkwrap
constraint needs to have access to the target's evaluated mesh).

Thx a lot to @sergey for handholding here!

Maniphest Tasks: T94600

Differential Revision: https://developer.blender.org/D13765
2022-01-10 11:57:54 +01:00
101fadcf6b Motion Path: Tweak the User Interface
This moves the clear paths button ("X") to the same line of "Update All Paths",
and make it visible at all times.

1. The clear button affects all objects (by default). However the
Calculate/Update Paths only works on the selected objects/objects.
Better to not have them both on the same line.

2. The operator to clear object and pose paths can run even if the active
object/bone has no motion path. However the UI was not showing the button in
those cases.

Before:
{F12757500, size=full}

After:
{F12757502, size=full}

Differential Revision: https://developer.blender.org/D13609
2022-01-10 11:40:37 +01:00
62e8d80a61 Fix out of bounds memory access displaying the compositor crop gizmo
Regression from typo in cbca71a7cf.
2022-01-10 21:09:30 +11:00
6beaa29791 Compositing Convert color space node
Compositor node to convert between color spaces.

Conversion is skipped when converting between the same color spaces or to or from data spaces.
Implementation done for tiled and full frame compositor.

Reviewed By: Blendify, jbakker

Differential Revision: https://developer.blender.org/D12481
2022-01-10 08:59:00 +01:00
eb7333e772 Cleanup: Wintab input processing.
Switched populating GHOST_WintabInfoWin32 vector from resizing and
assigning to reserving and pushing.

Removed unnecessary state tracking for multiple button presses in a
single packet.

Paired initialization with definition, and added default initialization
for GHOST_WintabInfoWin32.
2022-01-09 19:38:11 -08:00
1705587e21 Cleanup: note that compositor vector blur shares logic with zbuf.c
Note that some functions have been copied between these files.
De-duplication isn't trivial as there are differences in some functions.
2022-01-10 13:47:13 +11:00
74c896c081 Cleanup: typos in comments, remove libnumaapi reference 2022-01-10 13:47:12 +11:00
c04d36e922 Cleanup: Missing internationization for socket description 2022-01-09 18:39:34 -05:00
37d6ae16be Fix mistake in previous commit 2022-01-09 18:32:26 -05:00
17c7bac405 Cleanup: redundent semicolons after function braces 2022-01-09 18:24:48 -05:00
6110f3aa1f Cleanup: Use new socket builder API 2022-01-09 17:44:36 -05:00
ca0c69eaeb UI: Make uiTemplateNodeLink work for all socket types
Currently the node link ui template only works with a few socket types.
This commit addes support for the rest of the socket type declarations.

As pointed out in D13776 currently after recent refactors
Shader nodes no longer display in the menu.

In the future more socket types will be used in the shader nodes
and makes the UI template work better for other node trees.

Differential Revision: https://developer.blender.org/D13778
2022-01-09 11:49:08 -05:00
5519a6a520 Fix T94243: weightpaint gradient panel shown in other places
Weightpaint gradient tool panel showed in other modes (and as a separate
panel).

Fix for fix, see
- rBf8a0e102cf5e
- rBe549d6c1bd2d

So now, check mode again and restrict to topbar (prevents an additional
panel since this is already included in the brush settings).

ref rB0837926740b3 in sculpt-dev branch, so thx @joeedh as well!

Maniphest Tasks: T94243

Differential Revision: https://developer.blender.org/D13630
2022-01-09 11:31:57 +01:00
c5ee3ac7e0 Cleanup: Remove no op socket templates 2022-01-09 01:03:39 -05:00
e17ac8dc58 Cleanup: Nodes: Begin splitting shader node buttons into individual files
Currently, most node buttons are defined in `drawnode.cc` however,
this is inconvenient because it requires editing many files when adding new nodes.
The goal is to minimize the number of files needed to add or update a node.

This commit moves most of the node layout functions for shader nodes into their respected
source/blender/nodes/shader/nodes file.

In the future, these functions will be simplified to node_layout.

Some nodes were left in `drawnode.cc` as this would require duplicating code
while this is likely fine it is best to leave that to a seperate commit.
2022-01-09 00:59:34 -05:00
ed1ced2484 Cleanup: Use new socket builder API 2022-01-08 23:16:55 -05:00
9620fdc986 Cleanup: Remove no op socket templates 2022-01-08 22:15:47 -05:00
45bc4e3209 Fix T94713: Alembic crash with empty frames and velocities
Some software or processing tools (videogrammetry in this case) may
export malformed files with velocity data even when the frame is empty
for some reason. We need to explicity compare the data size with the
vertex size, and refuse to load the attribute if there is a data size
mismatch.
2022-01-08 20:46:28 +01:00
d5e73fa13d Fix T94534: dangling pointer in internal link after removing socket
The dangling pointer caused errors further down the line.
The solution is to simply delete an internal link when one
of the corresponding sockets is removed (just like normal
links are removed as well).
2022-01-08 17:36:59 +01:00
937aa8e114 Cleanup: Use new socket builder API 2022-01-07 23:53:57 -05:00
90e5ce6ab5 Cleanup: Loop through socket listbase instead of array
The socket arrays will be removed when using the new socket builder.
So instead we have to loop through the node outputs list.
2022-01-07 23:53:45 -05:00
741ed5fcd2 Fix Cycles compile error after last own commit
We can't include `BLI_utildefines.h` in `RNA_types.h` since Cycles includes
that, but duplicates some of the util defines. So you'd have duplicated
definitions.
2022-01-08 00:28:19 +01:00
34e84d0ee8 Cleanup: Remove unused code from BKE_node.h
Remove a variety of unused functions, declarations without definitions,
incorrect comments, and defines that have been commented for years
2022-01-07 16:16:56 -06:00
09d6846839 Fix Adjust Last Operation panel showing session UUID number button
This is implementation specific data that should never be exposed to regular
users. Also make sure this data is not saved to presets.
2022-01-07 23:06:29 +01:00
3e11c7016e RNA: Support bitwise operators for property flags in C++
Needed for the following commit.
2022-01-07 22:50:55 +01:00
5ba5678e00 Cleanup: Use forward declaration of struct in header
This meant that BKE_mesh.h couldn't be used without
the DNA headers first.
2022-01-07 12:42:04 -06:00
Aleksi Juvani
1152caad32 Fix: connecting hair fails on meshes with no generative modifiers
Fixes a bug introduced in rB5dedb39d447b. `mesh_original` is not set if the
mesh has no generative modifiers, in which case we can use `mesh_final`, which
would seem to be consistent with the rest of the particle code. An alternative
approach would be to make sure that `mesh_original` is always set in
`deformVerts`.

Differential Revision: https://developer.blender.org/D13754
2022-01-07 18:05:03 +01:00
Olivier Maury
34d553671d Fix wrong shadow terminator geometry offset with deformation motion blur
Differential Revision: https://developer.blender.org/D13759
2022-01-07 17:20:04 +01:00
Olivier Maury
ee0928d4be Fix wrong shadow terminator geometry offset for instances
Must take into account SD_OBJECT_TRANSFORM_APPLIED to determine if the normal
was already in world space.

Differential Revision: https://developer.blender.org/D13639
2022-01-07 17:20:04 +01:00
ae28d90578 Fix T93350: Cycles renders shows black during rendering huge resolutions
The root of the issue is caused by Cycles ignoring OpenGL limitation on
the maximum resolution of textures: Cycles was allocating texture of the
final render resolution. It was exceeding limitation on certain GPUs and
driver.

The idea is simple: use multiple textures for the display, each of which
will fit into OpenGL limitations.

There is some code which allows the display driver to know when to start
the new tile. Also added some code to allow force graphics interop to be
re-created. The latter one ended up not used in the final version of the
patch, but it might be helpful for other drivers implementation.

The tile size is limited to 8K now as it is the safest size for textures
on many GPUs and OpenGL drivers.

This is an updated fix with a workaround for freezing with the NVIDIA
driver on Linux.

Differential Revision: https://developer.blender.org/D13385
2022-01-07 17:20:04 +01:00
Michael Jones
efe3d60a2c Cycles: Fix Metal build
This patch fixes a couple of new Metal kernel compilation errors: 1) a kernel parameter count overflow, and 2) missing address space qualifiers.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13763
2022-01-07 16:19:31 +00:00
b7ea6e9d0e LibOverrides: small refactor of resync main public function.
Simplify signature of `BKE_lib_override_library_resync` and make it a
shallow wrapper around new internal `lib_override_library_resync` that
can then be easily extended for other internal needs.

Not functional changes expected here.
2022-01-07 15:25:25 +01:00
Germano Cavalcante
5560f32447 Fix T94078: Wrong Bound Box calculated for curves
`DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN` creates temporary objects that
correspond to duplicates or instances.

These temporary objects can share same pointers with the original object
as in the case of Bounding Box.

Bound Box of temporary objects is marked dirty in
`BKE_object_replace_data_on_shallow_copy` since `ob->data` is different.

This causes the original Bounding Box, calculated for the evaluated
geometry, to be lost.

The solution in this commit is to change the boundbox reference of the
temporary objects, so the boundbox of the non-temporary object (with
the data curve) is not marked dirty.

Differential Revision: https://developer.blender.org/D13581
2022-01-07 10:42:13 -03:00
5085c622ea Cleanup: Remove unused numapi library 2022-01-07 12:19:02 +01:00
312aa67cc7 Remove dead numaapi code in blenlib
It it rather an old experiment now which didn't pay off.
The initial idea was to have main and jobs threads on fast
nodes of TR2 processors. This didn't really work reliably
because in Blender we need to be able to create nested
threads without their affinity set. This is not how some of
OS are creating nested threads, and we don't always have
access to child threads to reset their affinity.

So overall complexity of the initial idea implementation
became too much compared to the performance gain.
2022-01-07 12:19:02 +01:00
ed52de948c LibOverride: Add tag to libraries that had to be recursively resynced.
Request from studio, to help identify quickly libs that need update.

NOTE: Currently only outputing INFO log in console, display of this info
in the outliner will come in a separate commit.
2022-01-07 12:09:50 +01:00
2cc6b249c3 Cycles: Remove usage of libnumaapi
No need for it now since all the threading queries and
scheduling is done via TBB.

Should be no functional changes as all the removed code
is supposed to be unused.
2022-01-07 11:47:37 +01:00
Jagannadhan Ravi
361702f239 Fix T94310: Blender doesn't support with 128 threads well in Win11
Query TBB for the maximum allowed concurrency, which is free from a bug
in own concurrency detection code. One thing to keep in mind is that now
Cycles is limited by the number of threads in the TBB areana from which
Session is created. This isn't a problem for Blender since we do not limit
arena on Blender side. Could be something to watch out for in other Cycles
integrations.

Differential Revision: https://developer.blender.org/D13658
2022-01-07 11:37:30 +01:00
bef2412ca2 Fix T86952: Buffer overflow reading specific DDS images
Add a data boundary check in the flipping code.

This code now also communicates the number of mipmap levels
it processed with an intent to avoid GPU texture from using
more levels than there are in the DDS data.

Differential Revision: https://developer.blender.org/D13755
2022-01-07 11:15:17 +01:00
29e33cfff5 Fix T94659: crash when deleting instances (part 2)
This was missing from rB3e92b4ed2408eacd126c0.
Before only the Separate Geometry node was fixed, because that
node was used in the file from the bug report. The same issue
existed in the Delete Geometry node as well though.
2022-01-07 08:21:34 +01:00
6c906b7c21 Fix T94707: inverted output of separate geometry node incorrect
This was an oversight in rB3e92b4ed2408eacd126c0.
2022-01-07 08:11:25 +01:00
7c04bc9a01 Cleanup: exclude uiFont from DNA, rename filename -> filepath
This isn't saved to the preferences,
so there is no need to store in DNA.

Also remove unused `r_to_l` member.
2022-01-07 18:05:36 +11:00
f24854005d Fix T94708: negative reference count error with Python API callbacks
Regression in 7972785d7b that caused
Python callback arguments to be de-referenced twice - potentially
accessing freed memory. Making a new-file with a circle-select
tool active triggered this (for example).

Now arguments aren't de-referenced when Blender it's self has already
removed the callback handle.
2022-01-07 17:48:54 +11:00
1642028310 Cleanup: use the ELEM macro 2022-01-07 17:48:25 +11:00
82858ca3f4 Fix T94629: The IMB_flip API would fail with large images
Fix IMB_flip[xy] to handle cases where integer overflow might occur when
given sufficiently large image dimensions.

All of these fixes were of a similar class where the intermediate
sub-expression would overflow silently. Widen the types as necessary.

Differential Revision: https://developer.blender.org/D13744
2022-01-06 21:35:04 -08:00
b3dc1a17a0 Fix BKE_image_ensure_tile_token being called with a full path
Assert that only the file name component is passed in
since special handling for UDIM should only be applied to the file name.

Also remove an unnecessary NULL check on the filename argument.
2022-01-07 15:15:08 +11:00
2cd8238ce3 Cleanup: use static sets for comparison, quiet unused arg warnings 2022-01-07 14:47:27 +11:00
f48164b5ea Cleanup: rename sculpt_brushes.c -> sculpt_brush_types.c
This better differentiates sculpt brush types with brush data-blocks,
since the same sculpt brush type may be used for many brushes.
2022-01-07 14:28:49 +11:00
3d3bc74884 Cleanup: remove redundant const qualifiers for POD types
MSVC used to warn about const mismatch for arguments passed by value.
Remove these as newer versions of MSVC no longer show this warning.
2022-01-07 14:16:26 +11:00
bb69c19f08 Cleanup: Fix spelling in filename 2022-01-06 20:51:23 -05:00
e6ca0b33e9 Cleanup: Add bf_nodes_texture library
For sake of consistencey with other node tree types, create its own cmake module.
This change helps keep `bf_nodes` focused on  generic nodes files.

Texture nodes are end of life and hopefully for Blender 4.0 they can be removed.
It is not expected that these will see the updates that the other nodes are getting.
This change also helps isolate the end of life files, we may move some texture
specific node tree execution code out of `node_exec` and into a `node_texture_exec` files.

Differential Revision: https://developer.blender.org/D13743
2022-01-06 18:21:01 -05:00
ed9b21098d Cleanup: Use new socket builder API
This commit converts most shader or bsdf nodes.
2022-01-06 17:57:30 -05:00
3ae664363d Fix T94635: Sculpt Smooth in Surface mode with Anchored Stroke crash
Sculpt Smooth in Surface mode (as opposed to Laplacian) needs a cache
initialized on first time. In anchored stroke mode with spherical falloff
this was skipped though (because this starts of with no PBVH nodes and
an early return checks for this) and `first_time` was set to false before
cache initialization.

Now move the cache initalization to happen earlier (same as the cache
initialization for automasking).

Maniphest Tasks: T94635

Differential Revision: https://developer.blender.org/D13746
2022-01-06 20:55:43 +01:00
3a4952e7c2 Fix Cycles updating display unnecessarily when stopping 3D viewport
Debug code accidentally committed in 466b50d. This was found while
investigating issues with D13385.
2022-01-06 19:10:50 +01:00
0c6b29ee43 Fix T94672: incorrect Workbench shadows with GPU subdivision
The `lines_adjacency` IBO build in the GPU subdivision case was missing
edges at the boundaries of open meshes. As it is used for the shadow
pass, the shadows were then not clipped properly.

This would also make X-Ray mode render differently in those cases.

To fix this, we can simply reuse the buffer finalization routine from the
non-subdivision case, as such edges are handled there.
2022-01-06 16:25:09 +01:00
c2089ae53c GPU subdiv: fix wrong data sizes used for lines adjacency IBO
Function parameters were mismatched, causing an assertion failure in
debug builds.
2022-01-06 16:24:52 +01:00
ddae2d88fa Depsgraph: only link 'IK Constraint -> Init IK Tree' if animated.
This relation is intended to ensure that the properties of the IK
constraint are ready by the time the IK solver tree is built. This
however can cause spurious dependency cycles, because there is only
one init tree node for the whole armature, and the relation actually
implies dependency on all properties of the bone.

This patch reduces spurious dependencies by only creating the relation
if any properties of the IK constraint specifically are animated.

Differential Revision: https://developer.blender.org/D13714
2022-01-06 16:43:18 +03:00
1785286ecc Bone Overlay: support changing bone wireframe opacity.
When weight painting the bone overlay is extremely intrusive,
effectively requiring either extensive use of hiding individual
bones, or disabling the whole bone overlay between selections.

This addresses the issue by adding a bone opacity slider that
is used for the 'wireframe' armature drawing mode. It directly
controls the uniform opacity as a straightforward option.

Differential Revision: https://developer.blender.org/D11804
2022-01-06 16:43:18 +03:00
7bcf21e66e Depsgraph: fix spurious cycles with identically named idprops on bones.
If multiple bones have a custom property with the same name,
depsgraph didn't distinguish between them, potentially leading
to spurious cycles.

This patch moves ID_PROPERTY operation nodes for bone custom
properties from the parameters component to individual bone
components, thus decoupling them.

Differential Revision: https://developer.blender.org/D13729
2022-01-06 16:43:18 +03:00
08aa7861d6 Fix T94685: python error adding Space handlers for Spreadsheet
Oversight in {rB9cb5f0a2282a}.

Above commit made an entry in `rna_Space_refine()`, but the entry in
`rna_Space_refine_reverse()` was missing (and this is what python uses
for the Space callbacks).

Maniphest Tasks: T94685

Differential Revision: https://developer.blender.org/D13751
2022-01-06 13:47:35 +01:00
45277d804e Cleanup: use correct file namespace name 2022-01-06 13:25:42 +01:00
d31b8c316f Cleanup: typos in code. 2022-01-06 11:48:44 +01:00
88e15ff1e6 Fix T94674: crash reading ORCOs from an Alembic animation
The crash is caused as the data is only for the first frame, but the mesh
changes topology, so reading the data in subsequent frames causes a
buffer overflow. To fix this, we check that the data size matches the
mesh's vertex count.
2022-01-06 11:48:44 +01:00
ed3fecae8e Cleanup: USD/ABC, remove const from pass-by-value params
Remove `const` from pass-by-value parameters in function declarations.
The variables passed as parameters can never be modified by the function
anyway, so declaring them as `const` is meaningless. Having the
declaration there could confuse, especially as it suggests it does have
a meaning, training people to write meaningless code.
2022-01-06 11:41:03 +01:00
f9aa6376f1 Cleanup: anim, remove const declarations from pass-by-value params
Remove `const` from pass-by-value parameters in function declarations.
The variables passed as parameters can never be modified by the function
anyway, so declaring them as `const` is meaningless. Having the
declaration there could confuse, especially as it suggests it does have
a meaning, training people to write meaningless code.
2022-01-06 11:41:03 +01:00
1484fe260b Cleanup: Replace FINISHED with CANCELLED
As the operator does nothing, better use cancelled.
2022-01-06 10:22:32 +01:00
e766dc9189 Fix (unreported) crash in liboverride after yesterday's commit.
Own mistake in rBbfb760e16acb.
2022-01-06 10:01:07 +01:00
6f389f1bb8 Cleanup: move public doc-strings into headers
Some recent changes re-introduced public-style doc-strings
in the source file.
2022-01-06 19:25:24 +11:00
c12607baa3 Cleanup: quiet GCC stringop-overflow in bmesh_beautify.c
Also elaborate on the doc-string.
2022-01-06 13:54:56 +11:00
66a4da87f4 Cleanup: sort cmake file lists 2022-01-06 13:54:55 +11:00
ed68e18c1c Cleanup: remove unnecessary slashes and quotes from paths in CMake 2022-01-06 13:54:54 +11:00
2ee37e9031 Cleanup: remove redundant/unused assignment
SRC was being assigned invalid values then overwritten.
2022-01-06 13:54:53 +11:00
499fec6f79 Cleanup: spelling in comments 2022-01-06 13:54:52 +11:00
aa363ec2ae Cleanup: remove declaration for removed function 2022-01-06 13:54:51 +11:00
61e2384b7a Cleanup: compiler warnings 2022-01-06 13:54:49 +11:00
60757f010a CMake: add missing headers 2022-01-06 13:54:48 +11:00
0e53ea4cb5 Correct error when moving doc-strings into header
Error in ffc4c126f5,
which moved doc-strings from implementation into headers.

Some changes in BKE_animsys.h needed to done manually as there
were already doc-strings in both the header and implementation
(with overlapping information).
When making these changes some doc-strings were removed unintentionally.

Thanks for @sybren for the heads up.
2022-01-06 13:54:46 +11:00
4067367b6c Cleanup: Clang-tidy: modernize-redundant-void-arg 2022-01-05 21:44:22 -05:00
c0fb8ea8f3 Cleanup: Spelling/grammar in comments 2022-01-05 19:03:05 -06:00
1d9bac7d92 Cleanup: Use snake case for file names
This is so that we can have "proper" file namespace names in D13466
2022-01-05 17:15:13 -05:00
0e1da8dd12 In obj exporter test, fix a strncpy length and a stray test file left behind. 2022-01-05 17:05:53 -05:00
e55a6bf82b Cleanup: Remove empty node socket template array 2022-01-05 16:45:41 -05:00
c240ab70ae Cleanup: Use new socket builder API
Instead of looping through the old socket template array
looper through the node output listbase.
2022-01-05 16:27:29 -05:00
7c013f1154 Fix: MSVC build error
MSVC2017 and early 2019 versions are under
the impression struct OGLRender is non trivial
type due to the ThreadCondition field, not
entirely sure why, but it is what it is.

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

Reviewed by: JacquesLucke
2022-01-05 14:02:07 -07:00
611da3b7d6 Cleanup: Use new socket builder API 2022-01-05 15:47:15 -05:00
50f694c7de Cleanup: Use new socket builder API
Also enables translation of socket names
2022-01-05 15:47:15 -05:00
a5b4373f95 Fix/workaround macOS Rosetta crash running Cycles AVX tests
Just disable these tests on macOS for now as fixing seems hard, and we want to
be able to cross-compile and test x86_64 on Arm machines on the buildbot.
2022-01-05 21:21:13 +01:00
cdd61bb6d7 Fix Cycles AVX test failure with x86_64 build running on Arm
Don't create const avx vectors before validating if CPU supports AVX.
2022-01-05 20:05:16 +01:00
f7a0f6a0e4 Fix T94563: Cycles standalone build error on with strict float/double casting
Thanks to John David for finding this.
2022-01-05 20:05:16 +01:00
1dc0bf86bb Fix T93695: Discontinuous cutting with the knife tool
An important check to reject edge linehits when a vertex of that edge
was already hit was accidentally removed in
rB6e77afe6ec7b6a73f218f1fef264758abcbc778a
2022-01-05 18:32:23 +00:00
a0edee712a Cleanup: Remove unused node_type_exec for shader node
From what I can tell these are left over from Blender Internal render.

Test still pass locally, also tested a couple eevee scenes.

Reviewed By: JacquesLucke, brecht

Differential Revision: https://developer.blender.org/D13732
2022-01-05 11:52:57 -05:00
8cd6d0fe68 Fix T94169: Missing grease pencil render with tiled rendering
Delay grease pencil for until after the render result is written
to the Blender side.

Differential Revision: https://developer.blender.org/D13740
2022-01-05 17:47:10 +01:00
3c04b44913 Fix Cycles allocating result too early
When tiled rendering was used the render result was
allocated at the end of every view layer render as
opposite of an intended end of all rendering.

Modify the render_result_end so that it only ensures
pixels are allocated if pixels are actually copied
over.
2022-01-05 17:47:10 +01:00
5e7e571b0d Fix Cycles using Cancel semantic on final result write
Seems like a copy-paste bug from another place.
2022-01-05 17:47:10 +01:00
bfb760e16a Fix T94650: LibOverride: Bad handling of (auto)resync in case of single override.
Overrides that are not created as part of an override hierarchy should
not be handled through (auto)resync at all. users are responsible to
hanlde those updates if they need it.

This is achieved by flagging overrides created outside of a hierarchical
process accordingly, and skipping them during resync process.
2022-01-05 17:30:22 +01:00
1403f034ff LibOverride: Cleanup some code.
No functional change.
2022-01-05 17:30:22 +01:00
b63f375775 Assets: disable automatic preview generation for node groups
The current preview generation is more confusing than useful.
Therefore it is better to disable it until better preview generation
methods are found.

Differential Revision: https://developer.blender.org/D13728
2022-01-05 17:01:52 +01:00
3e92b4ed24 Fix T94659: crash when deleting instances
The crash was caused by using `modify_geometry_sets` to modify
instances, which does not generally work unfortunately.
The intended behavior was wrong anyway. In instances mode,
only top level instances should be deleted.

Also removed the old error handling because it doesn't look like it
ever worked. all_is_error remained false all the time.
Furthermore, updating it was not thread safe.

Differential Revision: https://developer.blender.org/D13736
2022-01-05 16:55:09 +01:00
Aleksi Juvani
5dedb39d44 Fix T54488: hair disconnect/reconnect not working with modifiers
Take the Use Modifier Stack setting into account when connecting hair, and
fix wrong results results when using deforming modifiers also.

Differential Revision: https://developer.blender.org/D13704
2022-01-05 16:53:54 +01:00
1031638c51 Cleanup: rename mesh -> geom in some places that now handle multiple geom types 2022-01-05 16:06:34 +01:00
f64d7bfa4a Cleanup: compiler warnings about unused code 2022-01-05 16:06:23 +01:00
8393ccd076 Cycles: Add OptiX temporal denoising support
Enables the `bpy.ops.cycles.denoise_animation()` operator again and modifies it to support
temporal denoising with OptiX. This requires renders that were done with both the "Vector"
and "Denoising Data" passes.

Differential Revision: https://developer.blender.org/D11442
2022-01-05 15:58:36 +01:00
86141a75eb Cleanup: fix typos in source code in intern/
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D13532
2022-01-05 15:35:30 +01:00
29ab711efa Cleanup: Remove unused code (USE_COLOR_U32) 2022-01-05 15:00:07 +01:00
4c3f52e7dc Cycles: support rendering PointCloud motion blur from attribute
This adds support to render PointCloud motion blur from a standard
"velocity" attribute.

This implementation is similar to that of the Mesh geometry, and
perhaps some code could be deduplicated through a more generic API.
`mesh_need_motion_attribute` was renamed `object_need_motion_attribute`
as it does not really require a mesh and moved to `util.h` so that
it can be shared.

This fixes T94622.

Reviewed By: brecht

Maniphest Tasks: T94622

Differential Revision: https://developer.blender.org/D13719
2022-01-05 14:17:57 +01:00
b1bd0f8ffd Enable OpenEXR DWAB compresstion
The DWAB compression was disabled in the d59721c2c3 due to
a bug in the OpenEXR library which is now resolved.

Re-enable the DWAB compression for OpenEXR output. It is a
simple change, and DWAB often behaves better than DWAA.

Differential Revision: https://developer.blender.org/D13713
2022-01-05 14:07:21 +01:00
13e7065dd2 Fix T94564: Mirror clipping is not properly placed in sculpt mode
If a mirror object is used in a mirror modifier, sculptmode did not take
this into account (and instead always clipped on the sculpt objects
local axis).

Now take this into account by storing a matrix in the preparation
function `sculpt_init_mirror_clipping` and use that later in
`SCULPT_clip`.

Maniphest Tasks: T94564

Differential Revision: https://developer.blender.org/D13711
2022-01-05 13:23:37 +01:00
924d2b8df6 Fix T94506: Crash in Compositing 2022-01-05 12:31:37 +01:00
d960c78693 Fix T94545: support realizing instanced collections
This case wasn't handled in rBf5ce243a56a22d718 correctly.
Now `object_get_evaluated_geometry_set` just returns a geometry
set that contains the collection instance for collection instance objects.
2022-01-05 11:47:09 +01:00
33400ffcc9 IDManagement: Add assert against no-main IDs passed to BKE_id_delete.
This high-level function can only deal with IDs in main, trying to use
it to delete/free a no-main ID does nothing.
2022-01-05 10:39:09 +01:00
5df916f23f Fix T94366: Grease Pencil Automerge no immediate UI update
Just an oversight in rBe9607f45d85d.
Now add notifier that toolsettings changed.

Maniphest Tasks: T94366

Differential Revision: https://developer.blender.org/D13723
2022-01-05 09:13:52 +01:00
b7073fa797 Cleanup: Use new socket builder API 2022-01-05 00:59:18 -05:00
458be2ecc4 Nodes: Consistent link drag search for math and vector math nodes
Previously operations for the math node when connecting to
outputs weren't added. It also used a different method to
check whether the link would be valid.
2022-01-04 23:19:12 -06:00
5336fdc6e3 Cleanup: Make shade node util header CPP only
Now that all shader nodes are converted to CPP
this header can now be made into a CPP header.
2022-01-04 23:25:27 -05:00
713d59bcaf Fix T89587: Don't Change Line Width For Previews
Do not temporarily change U.pixelsize while creating object previews
in object_preview_render. It does nothing to the render, but the change
in line width can affect other UI drawing since it is done in a thread.

see D13717 for for details.

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

Reviewed by Julian Eisel
2022-01-04 15:51:18 -08:00
e3748d7fa5 Fix T94145: Knife tool fails in orthographic mode
Calculating min and max orthographic extent forgot to convert to
worldspace coordinates.
2022-01-04 20:26:09 +00:00
07de17ded6 Cleanup: Dont use relative include
Instead let cmake determine the path for file includes
2022-01-04 11:58:21 -05:00
Aaron Carlisle
25018dc061 Cleanup: Nodes: Convert generic shader node files to c++
Along with the general changes to CPP this commit does the following

- Use static casts where possible
- Use new CPP MEM library functions instead of cast
- Use listbase macros where possible
- Declare variables where initialized

Reviewed By: HooglyBoogly, JacquesLucke

Differential Revision: https://developer.blender.org/D13718
2022-01-04 11:42:40 -05:00
f7c0287278 Fix: Link drag search error with random value node from color socket
Dragging from a color socket would hit an assert in a debug build.
The node does not have a color mode currently, so use the vector mode
instead when connecting to a color socket.
2022-01-04 10:32:32 -06:00
55842b4244 Fix T94620: GPencil AutoMerge does not work when Draw On Back is enabled
The problem was the stroke was added to head and the `prev` pointer was NULL. Now check if there is the list is empty`next`.
2022-01-04 17:08:05 +01:00
ad8e2d6661 Fix T94308: Window Manager console error 2022-01-04 17:00:05 +01:00
bbd0c4118b Fix: Build issue with MSVC
std::min was used without including the algorithm
header. Seems to be implicitly included by
something in newer MSVC versions and GCC, however
vs16.4 needed a little help here.
2022-01-04 07:15:51 -07:00
54e2f851a4 Cleanup: Code formatting. 2022-01-04 14:07:27 +01:00
070948b5f1 Fix T94546: Remove soft limit for the Clamp Node value socket. 2022-01-04 12:26:16 +01:00
f7018f7b06 Fix T94544: crash removing image used as camera background via python
Since 2.8, background images are tied to cameras (in 2.79 these were
tied to a View3D I think).
Code in `BKE_library_id_can_use_idtype` wasnt taking this relation
between `Camera` and `Image` into account, thus leading to ID deletion/
unlinking not working properly -- in particular `libblock_remap_data`
not doing its thing (and leaving the camera as a user of the image),
then things went downhill from there...

Now make the "Camera-can-use-an-Image" relation clear in
`BKE_library_id_can_use_idtype`.

Maniphest Tasks: T94544

Differential Revision: https://developer.blender.org/D13722
2022-01-04 12:13:05 +01:00
b2867d4365 Fix T94599: Assert on usercount when deleting image created via operator.
`IMAGE_OT_new` operator would not properly clear the by-default one user
generated by 'new id' code, in case it could not tie the image to
anything.
2022-01-04 10:03:31 +01:00
Manuel Castilla
a2a02e3994 Fix T90830: Crop node cropping is one pixel short
Currently the crop higher limits are inclusive too which contradicts
the documentation as it says that if Left and Right are both 50, it
will result in a zero-sized image. And the result is one pixel out of
the crop gizmo, which is another hint that this is not intended.

In "Full Frame" experimental mode it's two pixels short because of
a misuse of `BLI_rcti_isect_pt` as it considers max limits inclusive.

Reviewed By: jbakker

Maniphest Tasks: T90830

Differential Revision: https://developer.blender.org/D12786
2022-01-04 08:22:37 +01:00
Aidan Davey
325beef7af Fix T91160 - Movie Clip Editor - frame indicator/controller is not displayed
The frame indicator/controller is not displayed when in the Graph or Dopesheet view of the Movie Clip Editor

To solve this we could call the function ED_time_scrub_draw_current_frame in clip_draw_dopesheet_main and graph_region_draw in space_clip.c

Reviewed By: jbakker

Maniphest Tasks: T91160

Differential Revision: https://developer.blender.org/D12659
2022-01-04 08:21:13 +01:00
Aaron Carlisle
7af01de802 Shader Nodes: Unity Build
Enable unity builds for  `bf_nodes_shader`, gives about a 2.7x speedup
of total compile times when just building `bf_nodes_shader`.
On my machine, this equates to saving about 30 seconds.

Differential Revision: https://developer.blender.org/D13720
2022-01-03 23:10:36 -05:00
a9e0caa92d Cleanup: Move node storage macro inside file namespace
Must have been a mistake in previous commits,
this fix is needed to enable unity builds.
2022-01-03 21:52:20 -05:00
d2cc672b0c Fix soft light blend mode math
Function `blend_color_softlight_float` used math different to compositor and
produced result that had abrupt value changes.

Use math based on modified screen blend mode as compositor does.
2022-01-04 02:11:38 +01:00
9c85acf61d Fix out of range color in blend modes
Result of Exclusion and Pin Light blend modes could be greater than 255
which caused artifacts. Limit color value to 0-255 range.
2022-01-04 02:11:38 +01:00
Aaron Carlisle
d3ad04172d Cleanup: Remove bNodeType flag from base registration functions
This flag is only used a few small cases, so instead
of setting the flag for every node only set the
required flag for the nodes that require it.

Mostly the flag is used to set `ntype.flag = NODE_PREVIEW`
For nodes that should have previews by default which
is only some compositor nodes and some texture nodes.

The frame node also sets the `NODE_BACKGROUND` flag.

All other nodes were setting a flag of 0 which has no purpose.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13699
2022-01-03 19:33:14 -05:00
9793bc30ce BLI: Add slice method to MutableSpan
Span had a slice method with an IndexRange argument, but MutableSpan
did not, yet. This commit makes the two types consistent.
2022-01-03 16:27:13 -06:00
675d3cdd69 Cleanup: Clang tidy 2022-01-03 13:52:55 -06:00
4e44cfa3d9 Add a new C++ version of an exporter for the Wavefront .obj format.
This was originally written by Ankit Meel as a GSoC 2020 project.
Howard Trickey added some tests and made some corrections/modifications.
See D13046 for more details.

This commit inserts a new menu item into the export menu called
"Wavefront OBJ (.obj) - New".
For now the old Python exporter remains in the menu, along with
the Python importer, but we plan to remove it soon (leaving the
old addon bundled with Blender but not enabled by default).
2022-01-03 14:49:31 -05:00
c6069c439c Fix T94581: Incorrect geometry delete behavior with instances
Compare the start of the range to zero to figure out whether the
indices for the instances to keep starts at zero. Also rename the
selection argument, since it made it seem like the selected indices
should be removed rather than kept.
2022-01-03 13:19:04 -06:00
a42e972e1b Fix T94316: Asset catalog tree scrolls away when renaming a catalog
The activation of the text button is a bit special, since it happens during
drawing, the layout isn't computed yet then. Comparable cases where the button
is added on top don't use the layout system, so this didn't become an issue
until now. Trigger a delayed call to `UI_but_ensure_in_view()`.
2022-01-03 19:55:49 +01:00
1b9e103a30 Fix T94594: Incorrect spreadsheet data set region type in old files
This completes 1a721c5dbe by versioning old files to correct the
region type. The "tools" region type is relatively standard for this type
of region and doesn't require any changes to the theme, unlike
the "nav bar" type, which would have been a reasonable choice.
2022-01-03 12:54:40 -06:00
b7ad58b945 Geometry Nodes: Edge Angle Node
Calculates the angle in radians between two faces that meet at an edge.
0 to PI in either direction with flat being 0 and folded over on itself PI.
If there are not 2 faces on the edge, the angle will be 0.

For valid edges, the angle is the same as the 'edge angle' overlay.

For the Face and Point domain, the node uses simple interpolation to calculate a value.

Differential Revision: https://developer.blender.org/D13366
2022-01-03 11:16:50 -06:00
ca143fafa6 Cleanup: Silence "integer conversion resulted in a change of sign" warning in Cycles kernel code
Occured because "PATH_RAY_SHADOW_CATCHER_BACKGROUND" is expressed as an unsigned
integer, because too large for a signed integer, but the "PathRayFlag" enum type defaulted to a
signed integer still.
2022-01-03 16:28:44 +01:00
8f9f65bc29 Allow overrides for cloth, collision and force field properties.
Allow overriding simple properties of cloth simulations, colliders
and force fields. Vertex group and shape key selectors in cloth are
still not overridable since they are tied to mesh data.

Force fields have a number of physical fields shared between multiple
RNA fields. Until they are decoupled, they will produce redundant
overrides, and cannot have different hard range limits.

Differential Revision: https://developer.blender.org/D13710
2022-01-03 18:06:13 +03:00
8189471912 Fix T94392: 3D Cursor surface projection onto hidden geometry
Regression introduced in rB098008f42d8127d9b60717c7059d3c55a3bfada7

Previously the selected geometry was ignored along with the hidden one.

The mentioned commit caused neither the hidden nor the selected one to be ignored.

But hidden geometry needs to be ignored.
2022-01-03 11:52:02 -03:00
a230445cae Depsgraph: Remove object-level visibility from geometry builders
Continuation of the D13404 which finished the design of not having
geometry-level nodes dependent on object-level.

Differential Revision: https://developer.blender.org/D13405
2022-01-03 15:30:14 +01:00
a3e634d4d7 Cleanup: Unused variable in Cycles code 2022-01-03 14:46:10 +01:00
6a4ee3fd56 Fix (unreported) i18n utils failing to create MO files in trunk.
Not really important anymore, since those are not used by Blender, but
better be consistent.
2022-01-03 11:48:24 +01:00
e51864a357 Add Georgian to our list of languages.
CC @Tamuna who started the translation for this language.
2022-01-03 11:13:15 +01:00
0a4bd32e59 Blender font: Add georgian script.
Weirdly enough, our 'mono' font already had it, but not the main one.

Copied from DeJaVu sans font.

CC @Tamuna who started the translation for that language.
2022-01-03 11:12:55 +01:00
add4aa7d25 Install_deps: Also cleanup CLANG CMAKE variables
Needed together with LLVM cleanup, otherwise things fail when LLVM gets
updated.
2022-01-03 10:39:37 +01:00
2e00d90938 Cleanup: Renamed to_object_value to to_dictionary_value. 2022-01-03 10:25:16 +01:00
e2fdc6226a Cleanup: rename ValueType.Object to ValueType.Dictionary. 2022-01-03 10:23:09 +01:00
ea8d749587 Cleanup: Rename ObjectValue to DictionaryValue (Serialization).
ObjectValue was to confusing as it is the term from JSON.
2022-01-03 08:10:21 +01:00
180b66ae8a UDIM: Support virtual filenames
This implements the design detailed in T92696 to support virtual
filenames for UDIM textures. Currently, the following 2 substitution
tokens are supported:

| Token | Meaning |
| ----- | ---- |
| <UDIM>   | 1001 + u-tile + v-tile * 10 |
| <UVTILE> | Equivalent to u<u-tile + 1>_v<v-tile + 1> |

Example for u-tile of 3 and v-tile of 1:
filename.<UDIM>_ver0023.png   --> filename.1014_ver0023.png
filename.<UVTILE>_ver0023.png --> filename.u4_v2_ver0023.png

For image loading, the existing workflow is unchanged. A user can select
one or more image files, belonging to one or more UDIM tile sets, and
have Blender load them all as it does today. Now the <UVTILE> format is
"guessed" just as the <UDIM> format was guessed before.

If guessing fails, the user can simply go into the Image Editor and type
the proper substitution in the filename. Once typing is complete,
Blender will reload the files and correctly fill the tiles. This
workflow is new as attempting to fix the guessing in current versions
did not really work, and the user was often stuck with a confusing
situation.

For image saving, the existing workflow is changed slightly. Currently,
when saving, a user has to be sure to type the filename of the first
tile (e.g. filename.1001.png) to save the entire UDIM set. The number
could differ if they start at a different tile etc. This is confusing.
Now, the user should type a filename containing the appropriate
substitution token. By default Blender will fill in a default name using
the <UDIM> token but the user is free to save out images using <UVTILE>
if they wish.

Differential Revision: https://developer.blender.org/D13057
2022-01-02 20:48:59 -08:00
Aaron Carlisle
367fc69dc1 Nodes: Convert several shader nodes to c++
Also add file namespace

This is needed to use new node APIs

Differential Revision: https://developer.blender.org/D13690
2022-01-02 23:35:20 -05:00
8be217ada5 Geometry Nodes: add field node type for constants
It is common to have fields that contain a constant value. Before this
commit, such constants were represented by operation nodes which
don't have inputs. Having a special node type for constants makes
working with them a bit cheaper.

It also allows skipping some unnecessary processing when evaluating
fields, because constant fields can be detected more easily.

This commit also generalizes the concept of field node types a bit.
2022-01-02 14:27:16 +01:00
4c46203cb5 Geometry Nodes: small refactor towards supporting partially lazy nodes
Currently, a node either supports lazyness during execution (like the Switch
node), or it doesn't. If it does support lazyness, then every input is computed
lazily. However, usually not all inputs actually have to be computed lazily.
E.g. the boolean switch input is always required, while the other inputs
should be computed lazily.

Better support for such sockets  can avoid unnecessary round trips through
the node execution function.
2022-01-01 12:50:48 +01:00
Charlie Jolly
6844304dda Nodes: Add Compare node operations to link drag search menu
Exposes compare operations via rna emums.
This uses the rna enum to build the search list using
named operations linked to socket A.
This also weights the Math Node comparison operations lower
for geometry node trees.

Differential Revision: https://developer.blender.org/D13695
2021-12-31 20:32:42 +00:00
e79b4523b4 LineArt: Correct collection intersection mask logic.
The logic used to be:

"if collection doesn't have child collection, check if ob is from this one"

The correct logic should be:

"if collection child does not have this ob, then check this collection".
2021-12-31 21:54:07 +08:00
97ae08c9fc LineArt: Correct clamping of out of bound isect index
Handles rare cases where line doesn't intersect the triangle correctly.
2021-12-31 21:26:39 +08:00
d09b1d2759 Fix T94464: video texture is not refreshing
In the past that worked because the `GPUMaterial` referenced the
`ImageUser` from the image node. However, that design was incompatible
with the recent node tree update refactor (rB7e712b2d6a0d257d272e).
Also, in general it is a bad idea to have references between data that is
owned by two different data blocks.

This incompatibility was resolved by copying the image user from the node
to the `GPUMaterial` (rB28df0107d4a8). Unfortunately, eevee depended
on this reference, because the image user on the node was update when the
frame changed. Because the image user was copied, the image user in the
`GPUMaterial` did not receive the frame update anymore.

This frame update is added back by this commit. The main change is that
the image user iterator now also iterates over image users in `GPUMaterial`s
on material and world data blocks. An issue is that these materials don't
exist on the original data blocks and that caused the check in
`build_animation_images` in the depsgraph to give the wrong answer.
Therefore the check is extended.

Right now the check is not optimal, because it results in more depsgraph
nodes than are necessary. This can be improved when it becomes cheaper
to check if a node tree contains any references to a video texture.
The node tree update refactor mentioned before makes it much easier
to construct this kind of run-time data from the bottom up, instead of
scanning the entire node tree recursively every time some information
is needed.
2021-12-31 14:24:11 +01:00
56344fb30f Cleanup: Silence warning for wrong const char comparison
Incorrectly used comparison for empty string.

Reported in chat by @jacqueslucke.
2021-12-31 13:05:58 +00:00
018272ee5b Fix T94416: incorrect handling when nodes are linked in a loop
This just skips the entire algorithm when there are cycles.
In the future, cycles could be handled more gracefully in the
algorithm, but for now that's not worth it and is not necessary
to fix the bug.
2021-12-31 11:33:47 +01:00
Charlie Jolly
71468f475b Nodes: Weight drag link search for Math nodes
As @hooglyboogly suggested in D13680, this patch adds weighting
to the search results. Dragging from a vector/rgba socket weights
the Vector Math node higher than a float Math node, and vice versa.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13691
2021-12-31 02:34:23 +00:00
0aa7315608 Fix (unreported): remove menu separators from drag link search
Search was picking up the menu separator entries.
Add check for these which are defined by empty identifier strings.
2021-12-31 01:15:00 +00:00
bf4358ed0c Cleanup: Use switch to get gpu shader name
Rather than using the array syntax that doesnt work in C++,
use a switch state which is also much easier to read.
2021-12-30 17:39:23 -05:00
ee2b72fd29 Nodes: Convert several shader nodes to c++
Also add file namespace

This is needed to use new node APIs

Differential Revision: https://developer.blender.org/D13690
2021-12-30 12:42:12 -05:00
e0d1e66732 Fix T93868: GPencil material filter does not work with instances
When the material is used in several objects, the filter by material is not working as expected because the internal pointers are different due eval version.

Now, the original version of the material is compared to keep same address.
2021-12-30 12:48:51 +01:00
Shen Ciao
52da1afbf6 Fix T93134: Set origin broken for curve edit mode
Bug: Set Origin causes unexpected offset on Grease Pencil strokes when Curve Editing is enabled.
Fix: Add transformation of editcurve points in `object_origin_set_exec`.

Reviewed By: #grease_pencil, antoniov

Maniphest Tasks: T93134

Differential Revision: https://developer.blender.org/D13273
2021-12-30 11:29:09 +01:00
49a18cc91e Fix T93163: GPencil scale thickness fails in negative scales
Before the negative scales produced a thickness invalid. Now, the value is used in absolute value to avoid this situation.
2021-12-30 11:18:05 +01:00
0b73b2c6cf Nodes: Improve link drag search for Math and Vector Math nodes
Exposes math operations via rna emums.

This uses the rna enum to build the search list.

Differential Revision: https://developer.blender.org/D13680
2021-12-30 01:22:10 +00:00
6d7dbdbb44 Point Cloud: Optimize bounding box calculation
This is analagous to 6a71b2af66 which did the same
thing for mesh data. Two differences are that here the coordinates
are simply `float3`, and we account for the radius if it's available.
Here I observed a similar performance increase, from 50ms
average to 10ms average, with 16 million points, a 5x speedup.

The calculation is about 1.4 times faster when no radius is used, down
 to 7.3ms average. Before, the calculation was only 1.2 times faster.
2021-12-29 18:39:41 -06:00
9d3264b4fd Cleanup: clang-tidy modernize-redundant-void-arg 2021-12-29 18:51:10 -05:00
d3a31311b9 Nodes: Convert shader, texture category nodes to c++
Also add/correct file namespace

This is needed to use new node APIs

Differential Revision: https://developer.blender.org/D13688
2021-12-29 18:36:15 -05:00
c0fdf16561 Fix T94454: Python API curve to mesh use after free without depsgraph
This was caused by a mistake in eb0eb54d96, which removed
the clearing of the curve edit mode pointers that are set when creating
the temporary data for the conversion. If they are not cleared, the
generic ID free function will also free the edit mode data, which is
wrong when the source curve is in edit mode.
2021-12-29 16:53:02 -06:00
04ead39dae Modifiers: decrease maximum allocation size for Weld vertices
At the time of allocating the buffer with vertices in context, we don't
know exactly how many vertices are affected, but we do know that it is
less than or equal to twice the number of vertices killed.
2021-12-29 17:45:56 -03:00
bb0da7dbbd Fix (unreported): missing relations update after adding scene time node
This just moves the relations update to a lower level function that is used
by other functions. Eventually, the special case for this node should be
generalized.
2021-12-29 19:40:14 +01:00
5e8b42bf86 Cleanup: Remove unused DerivedMesh functions 2021-12-29 12:37:01 -06:00
a94d80716e Geometry Nodes: Support instances in the delete geometry node
Ever since the instance domain was added, this was exposed, it just
didn't do anything. This patch implements the instances domain in the
delete and separate geometry nodes, where it acts on the top-level
instances.

We act on a mutable instances input, with the idea that eventually
copy on write attribute layers will make this less expensive. It also
allows us to keep the instance references in place and to do less
work in some situations.

Ref T93554

Differential Revision: https://developer.blender.org/D13565
2021-12-29 11:31:58 -06:00
a836ded990 Geometry Nodes: Accumulate Fields Node
This function node creates a running total of a given Vector, Float, or
Int field.

Inputs:
  - Value: The field to be accumulated
  - Group Index: The values of this input are used to aggregate the input
    into separate 'bins', creating multiple accumulations.
Outputs:
  - Leading and Trailing: Returns the running totals starting
   at either the first value of each accumulations or 0 respectively.
  - Total: Returns the total accumulation at all positions of the field.

There's currently plenty of duplicate work happening when multiple outputs
are used that could be optimized by a future refactor to field inputs.

Differential Revision: https://developer.blender.org/D12743
2021-12-29 10:25:39 -06:00
279085e18e Fix: Issues with attribute comparison in geometry nodes tests
A few typos in 17770192fb lead to an incorrect count of custom
data layers in the test meshes. We only want to consider layers that are
not anonymous, and there was a copy and paste mistake.
2021-12-29 10:23:53 -06:00
d5b77fd522 Nodes: Composite: UI fixes to time node
- Use default size consistent with other curve nodes
- Use column instead of row for properties
2021-12-29 11:16:44 -05:00
Germano Cavalcante
1c7d7c9150 Fix T94113: Local view + Geometry Nodes is broken for instances
`GeometrySet::compute_boundbox_without_instances` may not initialize min
max in some cases such as meshes without vertices.

This can result in a Bounding Box with impossible dimensions
(min=FLT_MAX, max=-FLT_MAX).

So repeat the same solution seen in `BKE_object_boundbox_calc_from_mesh`
and set boundbox values to zero.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13664
2021-12-29 12:36:58 -03:00
d786b48aab Cleanup: Remove dead code 2021-12-29 10:31:17 -05:00
Aaron Carlisle
465bd66519 Nodes: Cleanup: Remove no op registration functions
All these function paramaters are set to NULL so they arent necessary.

Reviewed By: HooglyBoogly, JacquesLucke

Differential Revision: https://developer.blender.org/D13686
2021-12-29 10:00:50 -05:00
Germano Cavalcante
b7f6377e38 gpu.types.GPUOffScreen: accept format argument for color texture
Some projects need more than 8-bit RGBA off-screen, so add the ability to
accept color format and defaults to RGBA8 so existing code should not be
affected.

Currently supported formats:
- RGBA8 (default)
- RGBA16
- RGBA16F
- RGBA32F

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D13650
2021-12-29 11:46:53 -03:00
bdcc258305 Fix: VSE colormix blend factor not working
Blend factor was used to adjust alpha of background image, which is not
correct. This was done in fdee84fd56 where another change was, that
background alpha is copied into result, which is correct.

Apply blend factor to foreground image alpha channel.
2021-12-29 15:00:57 +01:00
4bf74afacc Fix T94422: Shading/Normals break on array modifier caps
The array modifier does not necessarily tag normals dirty.
If it doesnt, normals are recalculated "internally" using the offset ob
transform. This was happening for the array items, but not for the caps.

Now do the same thing for caps.

Maniphest Tasks: T94422

Differential Revision: https://developer.blender.org/D13681
2021-12-29 10:16:48 +01:00
dc0bf9b702 Fix T94453: Weld modifier crash after recent cleanup
I had assumed that the span's size was the same as the length variable.
In the future, separate lengths could be removed in favor of using
lengths directly from spans.
2021-12-29 00:16:54 -06:00
ba38b06a97 Nodes: Convert shader, shader category nodes to c++
Also add file namespace

This is needed to use new node APIs

Differential Revision: https://developer.blender.org/D13684
2021-12-28 22:51:57 -05:00
b92ef379b7 Cleanup: clang-tidy
Fixes two instances of `-Wunused-but-set-variable`

There are several more of these but these were low hanging
and noisy with one being in a header functions.
2021-12-28 21:53:41 -05:00
53ed7ec7f2 Cleanup: clang-tidy
- modernize-deprecated-headers
- modernize-redundant-void-arg

Missed in rB11ac276caaa6e6d42176452526af97cf972abb5f
2021-12-28 20:58:50 -05:00
c34ea3323a Cleanup: Remove unused node tree "local sync" functions 2021-12-28 18:25:18 -06:00
7006d4f0fb Cleanup: Use indices instead of pointers
This improves code readability.

Take the opportunity and improve the comments too.
2021-12-28 20:42:21 -03:00
1464eff375 Cleanup: Return early, organize variable declarations 2021-12-28 15:36:59 -06:00
c32ce881e8 Nodes: Enable unity build for function nodes
Unity build saves 5 seconds off the total build time when compiling `bf_nodes_function`.
Total build times went from 25s to 20s (20% reduction),
tested with ninja on linux running i5 8250U.
2021-12-28 15:49:42 -05:00
Aaron Carlisle
1e9175e1d7 Nodes: Add bf_nodes_function module
In the future this will be used to support unity builds for function nodes

Differential Revision: https://developer.blender.org/D13682
2021-12-28 15:18:17 -05:00
2668f9181c Nodes: Split shader color ramp into its own file 2021-12-28 14:18:31 -05:00
715e0faabc Nodes: Declare function nodes in individual file namespace
To be used in the future to support unity builds
2021-12-28 14:18:31 -05:00
955748ab1e Fix: Duplicate link search entries for attribute statistic node
Using the output declarations is incorrect because there is a
declaration for each type. Instead loop over the names directly,
since it will make it easier to add an integer mode that only
supports some of the outputs.
2021-12-28 12:44:36 -06:00
4cbcfd22f5 Fix T94442: Trim curve node can crash with duplicate point
The calculation to find the factor between two evaluated points assumed
that the points were not at the same location. This assumption is some-
what reasonable, since we might expect `lower_bound` to skip those
point anyway. However, the report found a case where the first two
evaluated points were coincident, and there is no strong reason not
to make this safe, so add a check for 0 length before the division.
2021-12-28 12:22:14 -06:00
d7c556de32 GPencil: Avoid crashes calling from python
This is part of T94439
2021-12-28 18:50:07 +01:00
2e6ae11326 Nodes: Add bf_nodes_composite module
In the future this will be used to support unity builds for composite nodes

Differential Revision: https://developer.blender.org/D13678
2021-12-28 12:22:06 -05:00
1a721c5dbe Fix T94380: Scrolling zooms in spreadsheet data set region
The region used to be type "Channels", but the standard for this
type is "Tools", which is what the file browser uses. This follows
the changes in rB01df48a98394, which also make the region more
"standard."
2021-12-28 11:05:31 -06:00
0e38002dd5 Cleanup: Loops in VSE effect processing
Some effect functions looped over alternating lines, previously with
different factors. Since only one factor is used, code can be
simplified by looping all lines in one for loop.

There should be no functional changes.
2021-12-28 16:40:09 +01:00
bd9d09ca82 Fix T94439: Some GPencil operators crash when calling from console
This fix avoid the segment fault for several operators.
2021-12-28 16:07:07 +01:00
9bacd54312 LibOverride: better handling of the "no override of bones' shapes" case.
Also avoid overriding collections of bone shape objects, if possible.
2021-12-28 15:08:10 +01:00
23ac79f2c2 LibOverride: Tweak RNA 'need resync' detection code.
* Assert about source ID of an overridden pointer property not being a
  liboverride was not necessary, just skip in that case.
* Tag actual 'real' ID owner for resync, and not (potentially) an embedded one.
2021-12-28 15:08:10 +01:00
44db9f192e Cleanup: Factor in VSE effect processing
2 factor variables were passed to effects, but they were hard coded to
have same value.

Remove duplicate variable from arguments, rename single argument to
`fac`. Inverted factor variables were renamed to `mfac`. Any other
factor related variables are prefixed with `temp_`.

There should be no functional changes.
2021-12-28 14:30:21 +01:00
a7dca135dc Fix loss of cloth disk cache on reload in library overrides.
If the override system creates an override record for the cache
name (no idea why though), it trashes the disk cache on file load.

The reason is that it tries to rename cache files in update handler
when assigning the name, and BLI_rename deletes the target file even
if both names are the same.

This is a safe fix that simply aborts the pointless rename attempt.

Differential Revision: https://developer.blender.org/D13679
2021-12-28 14:56:09 +03:00
b29e33caa2 Fix T94408: missing sockets after adding node group 2021-12-28 11:21:07 +01:00
e28222966b Fix compile error when building without OpenSubDiv
Stubs were missing for functions added to opensubdiv_evaluator_capi.h
2021-12-28 09:36:30 +01:00
d25fa3250a Fix T94420: deadlock with subsurf modifiers
The deadlock was caused as the lock on the Mesh mutex used to compute
the subdivision wrapper was not released in some early exits of the
function.
2021-12-28 09:20:17 +01:00
f6699bfccf Revert "LineArt: Intersection function additional clamping"
This reverts commit 0a68fa8e14.
2021-12-28 11:55:37 +08:00
0a68fa8e14 LineArt: Intersection function additional clamping
To handle a rare case where it leads to a -1 index in isect order lookup
2021-12-28 11:21:25 +08:00
8c4edd1b37 Cleanup: clang format 2021-12-27 16:23:23 -05:00
d5b72fb06c Nodes: Declare shader nodes in individual file namespace
To be used in the future to support unity builds
2021-12-27 16:21:31 -05:00
336f6f4bbd GPencil: Fix error in previous Cleanup 2021-12-27 19:51:32 +01:00
d6dd2f51bb Cleanup: Use vector function 2021-12-27 13:16:47 -05:00
5814de65f9 Cleanup: Store cursor location in tGPspoint as an array
Fixes many instances of `-Wstringop-overread` warning on GCC 11

Differential Revision: https://developer.blender.org/D13672
2021-12-27 12:31:31 -05:00
11ac276caa Cleanup: clang tidy
Use c++ headers; use nullptr; redundant `void` in parameter list;
inconsistent parameter name.
2021-12-27 18:18:37 +01:00
1c9d8fcb47 Render: move editor/render module to c++
Doing this in preparation for some work on asset preview generation.

Differential Revision: https://developer.blender.org/D13676
2021-12-27 17:26:09 +01:00
644e6c7a3e Fix T93941: geometry proximity breaks with high resolution mesh
The calls to `.fill` were overwriting indices that are processed by
other threads.
2021-12-27 17:21:09 +01:00
eed45d2a23 OpenSubDiv: add support for an OpenGL evaluator
This evaluator is used in order to evaluate subdivision at render time, allowing for
faster renders of meshes with a subdivision surface modifier placed at the last
position in the modifier list.

When evaluating the subsurf modifier, we detect whether we can delegate evaluation
to the draw code. If so, the subdivision is first evaluated on the GPU using our own
custom evaluator (only the coarse data needs to be initially sent to the GPU), then,
buffers for the final `MeshBufferCache` are filled on the GPU using a set of
compute shaders. However, some buffers are still filled on the CPU side, if doing so
on the GPU is impractical (e.g. the line adjacency buffer used for x-ray, whose
logic is hardly GPU compatible).

This is done at the mesh buffer extraction level so that the result can be readily used
in the various OpenGL engines, without having to write custom geometry or tesselation
shaders.

We use our own subdivision evaluation shaders, instead of OpenSubDiv's vanilla one, in
order to control the data layout, and interpolation. For example, we store vertex colors
as compressed 16-bit integers, while OpenSubDiv's default evaluator only work for float
types.

In order to still access the modified geometry on the CPU side, for use in modifiers
or transform operators, a dedicated wrapper type is added `MESH_WRAPPER_TYPE_SUBD`.
Subdivision will be lazily evaluated via `BKE_object_get_evaluated_mesh` which will
create such a wrapper if possible. If the final subdivision surface is not needed on
the CPU side, `BKE_object_get_evaluated_mesh_no_subsurf` should be used.

Enabling or disabling GPU subdivision can be done through the user preferences (under
Viewport -> Subdivision).

See patch description for benchmarks.

Reviewed By: campbellbarton, jbakker, fclem, brecht, #eevee_viewport

Differential Revision: https://developer.blender.org/D12406
2021-12-27 16:35:54 +01:00
31e120ef49 Nodes: Support linking to existing group input from link drag search.
Before one could only create a new group input using the link drag search.
With this patch it becomes possible to create a Group Input node for an
existing input.

Differential Revision: https://developer.blender.org/D13674
2021-12-27 16:15:11 +01:00
51a131ddbc BLI: add utility to check if type is any specific type
This adds `blender::is_same_any_v` which is the almost the same as
`std::is_same_v`. The difference is that it allows for checking multiple
types at the same time.

Differential Revision: https://developer.blender.org/D13673
2021-12-27 16:08:11 +01:00
594438ef0d Allocator: add missing include
The placement-new operator requires `#include <new>`.
It is used in `MEM_new`.
2021-12-27 15:41:56 +01:00
7cf5f4cc63 LineArt: Protecting bounding area links.
In case they overflowed the bounding area maximum link count,
Protect the link array so it doesn't crash.
2021-12-27 14:33:58 +08:00
52585b39a1 LineArt: Remove duplicated edge-boundbox linking.
The edge is linked twice from differen calls during line art calculation
Probably caused by a merge and both calls stayed for some reason.
This would lead to edge link overflowing its limit of 2^16 items.
2021-12-27 14:22:09 +08:00
20b438d523 Cleanup: Use array for BKE cursor functions
Missed this function in rB67525b88d2e
2021-12-26 15:08:41 -05:00
5cf993f951 Cleanup: Fix compile warning
Own mistake in rB67525b88d2e
2021-12-26 15:08:41 -05:00
28a8d434d5 Fix T94387: Mesh sequence cache, crash when clicking a panel
The crash happens when opening a panel (added in rB43f5e761a66e87fed664a199cda867639f8daf3e)
when no CacheFile is set in the modifier.

To fix this, check that the CacheFile pointer is not null before attempting to draw anything.
2021-12-26 13:45:49 +01:00
dd3a72f275 Docs: Add to and cleanup attribute API docs
Most of the comment block is similar to the text in the source
code documentation wiki. It's helpful to have some text in
a header file too, so it's closer for programmers already looking
at the code.

This also uses more consistent syntax and wording in the comments
about the attribute API in `GeometryComponent`.

Ref T93753

Differential Revision: https://developer.blender.org/D13661
2021-12-25 15:08:38 -06:00
ceed8f7c06 Cleanup: Use more common variable name
It's preferred to use `area` as a name for `ScrArea` variables.
2021-12-25 14:57:07 -06:00
85abac7e87 Cleanup: Move customdata.c to C++
Differential Revision: https://developer.blender.org/D13666
2021-12-25 14:28:22 -06:00
Christoph Lendenfeld
f7ddb1ed8a Breakdown Implementation
This patch adds the breakdown (or tween) functionality to the graph editor.

The factor defines the linear interpolation from left key to right key.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9375
Ref: D9375
2021-12-25 20:58:47 +01:00
Aaron Carlisle
fbd01624e3 Shader Nodes: Convert bump node to use new socket builder
This node is a bit special in that it uses two internal sockets
for a hack for Eevee; see rBffd5e1e6acd296a187e7af016f9d7f8a9f209f87

As a result, the `SOCK_UNAVAIL` flag is exposed to socket builder API.

Reviewed By: JacquesLucke, fclem

Differential Revision: https://developer.blender.org/D13496
2021-12-25 11:13:15 -05:00
Aaron Carlisle
c5862da5ad Cleanup: use new c++ guarded allocator API in nodes
Also simplify the allocation name to `__func__`

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13665
2021-12-25 11:12:08 -05:00
Christoph Lendenfeld
9085b4a731 Blend To Neighbor Implementation
This patch adds the blend to neighbor operator to the Graph editor.

The operator acts like the blend to neighbor operator for a pose context, just working on keyframes.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9374
Ref: D9374
2021-12-25 13:40:53 +01:00
e505957b47 Fix T94375: Python error when trying to add Grease Pencil brush preset
The prop name was wrong.
2021-12-25 12:53:35 +01:00
28df0107d4 Fix T94362: GPUMaterialTexture references freed ImageUser
The issue was caused by rB7e712b2d6a0d257d272ed35622b41d06274af8df
and the fact that `GPUMaterialTexture` contains an `ImageUser *` which
references the `ImageUser` on e.g. `NodeTexImage`.

Since the node tree update refactor, it is possible that the node tree changes
without changing the actual material. Therefore, either the renderer should
check if the node tree has changed or it should not store pointers to data in
node storage. The latter approach is implemented in this patch.

Differential Revision: https://developer.blender.org/D13663
2021-12-25 11:14:02 +01:00
f1e04116f0 Cleanup: Do not use magic number 2021-12-25 00:02:45 -05:00
67525b88d2 Cleanup: Use array for BKE cursor functions
Differential Revision: https://developer.blender.org/D12962
2021-12-24 23:59:33 -05:00
95c7e8aa13 Update RNA to user manual mapping file 2021-12-24 22:54:59 -05:00
fc45b00720 Cleanup: Define node tree icon in register function
I suppose this was done to reduce then dependencies.
However, most nodes already depend on UI code so this isnt too useful.
2021-12-24 22:47:58 -05:00
6e0cf86e73 Cleanup: use new c++ guarded allocator API
API added in rBa3ad5abf2fe85d623f9e78fefc34e27bdc14632e
2021-12-24 22:18:04 -05:00
79012c6784 Cleanup: Use consistent order for custom data mesh masks
Loops come last in the struct's definition, use the same order when
initializing the common masks in customdata.c (they were switched
with the poly masks).
2021-12-24 18:26:11 -06:00
26c7be71d7 Nodes: Migrate bump shader node to cpp
Needed for D13496
2021-12-24 15:42:58 -05:00
291d2a2222 Cleanup: Remove misleading comments
Most of these custom data layers weren't BMesh only, and the
one that actually looks to be BMesh only has `BM` in its name.
2021-12-24 11:00:01 -06:00
d48fc7d156 Cleanup: Use vector instead of linked list 2021-12-24 10:05:47 -06:00
dd01ce2cd0 Fix T94322: add missing updates after recent refactor
This was a regression in rB7e712b2d6a0d257d272ed35622b41d06274af8df.
2021-12-24 13:39:50 +01:00
ba4b7b4319 Fix T94162: incorrect handling when there are multiple group outputs
Typically a node group should only have a single Group Output node.
However, currently Blender already supports having multiple group outputs,
one of which is active. This wasn't handled correctly by geometry nodes.

Differential Revision: https://developer.blender.org/D13611
2021-12-24 12:34:04 +01:00
c0db8a9a3b Cleanup: remove unused button function
rB05f900e3466b45a19e13bea6dd641e4f7b8b46e9 removed unused button functions,
but since that commit the `uiDefIconTextButBit()` static function sits
unused as well. It's now been removed.
2021-12-24 10:39:36 +01:00
81b3933abb Fix T94357: Node Ungroup operator copies current node tree
This was a mistake in rBfdc4a1a590d8befb1ff which copied the parent
node tree into itself rather than accessing the node group's nodes.
2021-12-23 22:48:55 -06:00
35bd6fe993 Fix T94344: Incorrect size for edge vertices node output
This looks like a copy and paste error from the original commit.
The virtual array output used the number of mesh polygons instead
of the number of edges.
2021-12-23 16:22:07 -06:00
2df912466c Cleanup: Remove outdated comment
After rB01df48a983944ab3f8a, this comment no longer applies.
2021-12-23 13:28:44 -06:00
582f6032fc Cleanup: Move hair object type files to C++
Differential Revision: https://developer.blender.org/D13657
2021-12-23 11:46:45 -06:00
05f900e346 Cleanup: Remove unused UI button definition functions
These were part of the older buttons API that shouldn't be used in
more places at this point. Most layouts should be built with the regular
layout system API and RNA properties. This sort of button can still be
created though, since these were just shortcuts anyway.
2021-12-23 11:30:11 -06:00
43f5e761a6 Cache File: use panels to organize UI
This adds interface panels to organize the Cache File UI parameters for
modifiers and constraints into related components: velocity, time, and
render procedural.

Properties relating to the three aforementioned components are separated
from `uiTemplateCacheFile` into their own functions (e.g.
`uiTemplateCacheFileVelocity` for the velocity one), which are in turn
called from the specific panel creation routines of the modifiers and
constraints (for constraints, the functions are exposed to the RNA).

`uiTemplateCacheFile` now only shows the properties for the file path,
and in the case of constraints, the scale property.

The properties that are only defined per modifier (like the velocity
scale), are shown in the proper modifier layout panel if applicable.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D13652
2021-12-23 18:05:26 +01:00
Christoph Lendenfeld
7a71a95f32 Graph Slider Ops: Show error when no valid keys are found
When using graph slider operators like D9374
it showed a warning when no keys were selected.
However since that stops the modal operation it should be an Error.
Also the message was misleading
since it could error for different reasons than stated.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D13655
Ref: D13655
2021-12-23 14:31:28 +01:00
d71009d980 Avoid exception when no weight paint settings exist
Just an extra check for `None` before accessing its properties.
2021-12-23 14:10:24 +01:00
025c921416 Cleanup: remove BKE_animdata_driver_path_hack
The `BKE_animdata_driver_path_hack()` function has had almost no effect
since rB51b796ff1528, and basically boils down to:

```
return base_path ? base_path : RNA_path_from_ID_to_property(ptr, prop);
```

Since `base_path` was `NULL` in the majority of cases, it's just been
replaced by a direct call to `RNA_path_from_ID_to_property()`. The
conditional now just appears in one remaining case.

This relates to T91387.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D13646
2021-12-23 13:49:58 +01:00
00965c98cb LibOverride: protect better against using on complex inter-dependency cases.
Do not allow 3DView operator to run on the liboverride of an
instantiating Empty object. And tweak behavior in the Outliner
operations too.

Related to T94226.

Note that this remains fairly exotic, bad idea not recommended cases,
such complex inter-dependencies between different libraries inside a
same liboverride hierarchy is just not possible to handle properly.
2021-12-23 10:13:07 +01:00
710e279b19 Fix missing type declaration compile error
rBbd3bd776c893 broke compilation here due to missing type declaration
for basic types as the source file is not including this header. In any
case, it is the responsibility of header files to include headers for
types used by value in function parameters or struct definitions.
2021-12-23 08:01:43 +01:00
41f3164e57 Cleanup: typo in comment 2021-12-23 07:53:47 +01:00
1931387799 Fix: Curve trim node test failure
Caused by 60c59d7d61. The position wasn't copied into the correct
place on each spline. Somehow I didn't catch that in the tests I ran.
2021-12-22 18:38:30 -06:00
8f89196be2 Fix T94232: No selection with set material node empty material list
If the input mesh had no materials already, the new material would
become the only material on the mesh, meaning the material was
added to all of the faces, instead of just the selected faces.

The mesh primitive nodes in geometry nodes already add an empty
slot by default, so this only affects outside geometry.

The fix is just adding an empty slot before the new slot, so the
non-selected material indices can still point to an empty slot.

Differential Revision: https://developer.blender.org/D13654
2021-12-22 18:15:21 -06:00
60c59d7d61 Cleanup: Remove spline add_point method, refactor mesh to curve node
It's better to calculate the size of a spline before creating it, and this
should simplify refactoring to a data structure that stores all point
attribute contiguously (see T94193). The mesh to curve conversion is
simplified slightly now, it creates the curve output after gathering all
of the result vertex indices. This should be more efficient too, since
it only grows an index vector for each spline, not a whole spline.
2021-12-22 17:39:35 -06:00
c593db5a2f Nodes: Add link drag search support for map range node
Previously only the float version of the node was connected to.
This adds connection operations for vector sockets, and exposes
the "Steps" socket properly when it's selected.
2021-12-22 17:22:10 -06:00
6b662ebdb9 Cleanup: Return early 2021-12-22 17:18:37 -06:00
9033d270d5 Fix: Extra space at the front of "Sample Curve" node name 2021-12-22 17:13:16 -06:00
dca5be9b94 Fix: Wrong node link drag search menu items for attribute statistic
Caused by capturing local variables by reference in a function that
outlives the scope it was created in. Also use a more generic function
for the first two inputs.
2021-12-22 16:45:41 -06:00
14621e7720 Fix: Potential use after scope in curve to mesh node
I don't think this has been visible, since I only ran into it after
changing other code that affected this. However, some attributes
can keep a reference to the source component to use when tagging
caches dirty (like the position attribute tagging the normals dirty).
Here, the component was created inside a function, then the attributes
were used afterwards.

Also add some comments warning about this in the header file.
2021-12-22 16:29:00 -06:00
Michael
c6e7fc9744 Fix: Large stack allocation in compositor
When COM_EXPORT_GRAPHVIZ is enabled, DebugInfo::graphviz
uses a char[1000000] as local variable. When this function
is called this is allocated on the stack, which has a size
of just 1MB on mac and may cause a stack overflow.

This patch allocates the memory on the heap and frees
the memory at the end of the function.

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D13628
2021-12-22 13:49:52 -07:00
0fd72a98ac Cleanup: Avoid adding points to splines sequentially
This should be faster because it avoids reallocating the internal
vectors when the size is known beforehand, but it may also help
a potential refactor to a different data structure (see T94193).
2021-12-22 14:35:46 -06:00
b4f978e901 Fix: Missing update when toggling node mute
Toggling node mute doesn't cause node trees to reevaluate after
rB7e712b2d6a0d257. Toggling a link mute still works though. To fix this,
the operator tags the node and node with a new update tag function
(that uses an existing tag internally).

Differential Revision: https://developer.blender.org/D13653
2021-12-22 14:00:34 -06:00
586e2face6 Fix T93408: Snap performance regression at high poll rate
Caused by {rBfba9cd019f21f29bad1a6f3713370c5172dbc97f}.

The snap timer was accidentally modified and damaged.
2021-12-22 16:11:05 -03:00
e2a9e7e803 Nodes: Remove unnecessary node tree socket tagging
`SOCK_IN_USE` is now set in `update_socket_used_tags` in
`node_tree_update.cc` when a node tree is changed.
It doesn't need to run every single redraw. Removing this
results in a small speedup of 0.4 ms when drawing a tree
with about 4000 nodes (from about 70 ms total).

Differential Revision: https://developer.blender.org/D13645
2021-12-22 11:25:55 -06:00
6a71b2af66 Mesh: Parallelize bounding box calculation (WIP)
This replaces the single-threaded calculation of mesh min and max
positions with a `parallel_reduce` loop. Since the bounding box
of a mesh is retrieved quite often (at the end of each evaluation,
currently 2(?!) times when leaving edit mode, etc.), this makes for a
quite noticeable speedup actually.

On my Ryzen 3700x and a 4.2 million vertex mesh, I observed
a 4.4x performance increase, from 14 ms to 4.4 ms.

I added some methods to `float3` so they would be inlined, but
they're also a nice addition, since they're used often anyway.

Differential Revision: https://developer.blender.org/D13572
2021-12-22 11:04:03 -06:00
3579a9e0fc Cleanup: Remove debug print. 2021-12-22 17:53:00 +01:00
921708fc76 Fix (unreported) potential bug in collections parenting update code.
Own mistake in rB2ef192a55b2c. Did not seem to have any visible effect
though...
2021-12-22 17:50:10 +01:00
f577abc5cd Cleanup: Use LISTBASE_FOREACH_ macros. 2021-12-22 17:39:53 +01:00
8d3e57f338 Fix T93799: Outliner: Remaping objects could result in duplicates in a collection.
Fix is similar to how CollectionObject with NULL object pointers are handled.

Using one of the 'free' pad bytes in Object_Runtime struct instead of a
gset (or other external way to detect object duplicates), as this is
several times faster.

NOTE: This makes remapping slightly slower again (adds 10 extra seconds
to file case in T94059).

General improvements of remapping time complexity, especially when
remapping a lot of IDs at once, is a separate topic currently
investigated in D13615.
2021-12-22 17:34:13 +01:00
902318f0fd Fix part of T93799: Outliner: Remap Users crash (for ID Type Object).
This commit fixes the crash itself, however this can still lead to a
same collection 'owning' the same object several time.

Issue here was a bad assumption in layer resync code, that would lead to
removing valid objects from the viewlayer's `object_bases_hash` in
`BKE_layer_collection_sync`, when deleting no-more-used bases, in case
of bases duplicate.
2021-12-22 17:03:20 +01:00
978a930d9c Fix: Build issue on 32 bit archs
The cast to size_t leads to a build issue on 32
bit archs. cursor_delim_type_utf8 expects an int
so an additional cast to size_t is not required.

Reported by user frispete on devtalk.
2021-12-22 08:39:33 -07:00
aba91a745a Fix T93999: GPencil Box tool allows decreasing subdiv, but not increase
The problem was the number of points for each edge of the box was wrong and the wheelmouse effect was anulated.

Also fixed the value displayed in the status bar to keep consistency with subdivision value.

Reviewed By: lichtwerk

Maniphest Tasks: T93999

Differential Revision: https://developer.blender.org/D1363
2021-12-22 16:07:48 +01:00
dbbf0e7f66 Nodes: Improve node tree copy performance
When copying a full node tree, we can avoid an O(n^2) loop finding a
unique name for every node if we assume they already have unique names.
That is a reasonable assumption, since unique names are verified
elsewhere when adding a new node.

Copying a node tree with about 4000 nodes took 42 ms before,
now it takes 6 ms.

Differential Revision: https://developer.blender.org/D13644
2021-12-22 08:52:46 -06:00
fdc4a1a590 Nodes: Refactor to remove node and socket "new" pointers
These pointers point to the new nodes when duplicating,
and their even used to point to "original" nodes for
"localized" trees. They're just a bad design decision
that make code confusing and buggy.

Instead, node copy functions now optionally add to a map
of old to new socket pointers. The case where the compositor
abused these pointers as "original" pointers are handled
by looking up the string node names.

Differential Revision: https://developer.blender.org/D13518
2021-12-22 08:47:46 -06:00
d6224db8f1 Geometry Nodes: improve multi socket handling in evaluator
Previously, the values passed to a multi-input socket were stored
in the order that they arrived in. Then, when the values are accessed,
they are sorted depending on the link order.

Now, the ordering is determined in the beginning before execution starts.
Every value is assigned to the right index directly, avoiding the sort
in the end. This makes the ordering more explicit.
2021-12-22 13:16:01 +01:00
2ce2bffc4d Fix T94295: VSE fades error when no suitable sequences selected
This errored out in two scenarios:
- current frame not in strips framerange (this was reported)
- no strips selected at all

Now handle these cases properly in the operator and give appropriate
report info.

Maniphest Tasks: T94295

Differential Revision: https://developer.blender.org/D13642
2021-12-22 09:28:31 +01:00
d2bf60cc17 Cleanup: Clang tidy, restore alphabetical sorting 2021-12-21 14:32:22 -06:00
Germano Cavalcante
6db0919724 Fix T94191: correct (time) translation headers not showing DeltaX
Caused by {rBb0d9e6797fb8}

For the header (both Graph Editor case in general `headerTranslation` as
well as `headerTimeTranslate`) we are interested in deltas values
(not absolute values).

Since culprit commit, `snapFrameTransform` was not working with deltas
anymore, but we have to compensate for this.

For the Graph Editor, this only worked "by accident" in rB7192e57d63a5,
since `ival` is still zero at this point.

So now, reacquire the delta right after the snap operation.

Also use a more appropriate center value in the translate operator.

Maniphest Tasks: T94191

Differential Revision: https://developer.blender.org/D13641
2021-12-21 13:00:51 -03:00
aa7105f759 Cleanup: use BKE_pose_is_layer_visible in more places
This was added in rBd13970de8627, now use in more places.
2021-12-21 16:45:46 +01:00
bdbd0cffda Nodes: Improve performance when freeing a node tree
This commit makes freeing a node tree about 25 to 30 times faster.
Freeing a node tree happens whenever it is edited. Freeing a node
tree with about 4000 nodes went from 30-50ms to about 2 ms.

This was so slow before because for every node that was freed
when freeing the node tree, `node_free_node` looped over all
other nodes to detach frames, and then looped over all links to
remove any links connected to the node. That was all pointless
work because everything else is about to be freed anyway.

Instead, move that "detaching" behavior to the dedicated function
for removing a single node, and to the "local" version of the free
function to be safe, since I know less about what that version expects.

Differential Revision: https://developer.blender.org/D13636
2021-12-21 09:23:48 -06:00
8cf1994455 Fix T93960: Asset Catalogs I/O fails with unicode file paths on Windows
On Windows, encode file paths as UTF-16 before trying to open the file
for reading/writing.

This introduces a new class `blender::fstream`, which wraps
`std::fstream` and provides this UTF-16 encoding. This class should also
be used in other areas, like the Alembic importer/exporter.

Manifest Task: T93960

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13633
2021-12-21 15:54:09 +01:00
d66a6525c3 Assets: log message when catalog definitions cannot be loaded
Log a message (via `CLOG`) when asset catalog definitions cannot be
loaded.

Reviewed by @jacqueslucke in D13633
2021-12-21 15:53:57 +01:00
7e712b2d6a Nodes: refactor node tree update handling
Goals of this refactor:
* More unified approach to updating everything that needs to be updated
  after a change in a node tree.
* The updates should happen in the correct order and quadratic or worse
  algorithms should be avoided.
* Improve detection of changes to the output to avoid tagging the depsgraph
  when it's not necessary.
* Move towards a more declarative style of defining nodes by having a
  more centralized update procedure.

The refactor consists of two main parts:
* Node tree tagging and update refactor.
  * Generally, when changes are done to a node tree, it is tagged dirty
    until a global update function is called that updates everything in
    the correct order.
  * The tagging is more fine-grained compared to before, to allow for more
    precise depsgraph update tagging.
* Depsgraph changes.
  * The shading specific depsgraph node for node trees as been removed.
  * Instead, there is a new `NTREE_OUTPUT` depsgrap node, which is only
    tagged when the output of the node tree changed (e.g. the Group Output
    or Material Output node).
  * The copy-on-write relation from node trees to the data block they are
    embedded in is now non-flushing. This avoids e.g. triggering a material
    update after the shader node tree changed in unrelated ways. Instead
    the material has a flushing relation to the new `NTREE_OUTPUT` node now.
  * The depsgraph no longer reports data block changes through to cycles
    through `Depsgraph.updates` when only the node tree changed in ways
    that do not affect the output.

Avoiding unnecessary updates seems to work well for geometry nodes and cycles.
The situation is a bit worse when there are drivers on the node tree, but that
could potentially be improved separately in the future.

Avoiding updates in eevee and the compositor is more tricky, but also less urgent.
* Eevee updates are triggered by calling `DRW_notify_view_update` in
  `ED_render_view3d_update` indirectly from `DEG_editors_update`.
* Compositor updates are triggered by `ED_node_composite_job` in `node_area_refresh`.
  This is triggered by calling `ED_area_tag_refresh` in `node_area_listener`.

Removing updates always has the risk of breaking some dependency that no
one was aware of. It's not unlikely that this will happen here as well. Adding
back missing updates should be quite a bit easier than getting rid of
unnecessary updates though.

Differential Revision: https://developer.blender.org/D13246
2021-12-21 15:18:56 +01:00
1abf2f3c7c Cleanup: clang format
Missed in rB7c9e4099854a, sorry.
2021-12-21 14:28:04 +01:00
d13970de86 Fix T92930: Outliner "Show Active" bone fails in certain situations
Outliner would frame the armature object instead of the bone if the bone
was on a hidden armature layer.

Similar to issues reported in e.g. T58068 and T80464, this is due to the
fact that `BKE_pose_channel_active` always checks for the armature layer
(and returns NULL if a bone is not on a visible armature layer).

Now propose to make this layer check **optional** (and e.g. from the
Outliner be more permissive). This also introduces
`BKE_pose_channel_active_if_layer_visible` which just wraps
`BKE_pose_channel_active` with the check being ON.

Maniphest Tasks: T92930

Differential Revision: https://developer.blender.org/D13154
2021-12-21 14:07:48 +01:00
fac42e3fa1 Tests: initialise BKE callbacks before loading blend file
Initialise the BKE callback system in
`BlendfileLoadingBaseTest::SetUpTestCase()`. This allows certain tests
to run in debug mode (when `BLI_assert` is enabled).
2021-12-21 11:12:47 +01:00
68f1b2c671 Fix T93757: Do not force-instantiate indrectly linked objects in linking case. 2021-12-21 10:09:01 +01:00
bb4de77b82 Fix T93839: Copy/Paste of empty instantiating a collection.
Do not also instantiate a collection in the view layer, if it is already
instantiated through an empty object.
2021-12-21 09:52:53 +01:00
c0f06ba614 Fix build error in debug builds from recent commit
r7acd3ad7d8e58b913c5 converted a pointer to a reference,
but an assert still compares the variable to a pointer.
2021-12-20 22:48:31 -06:00
e4de5b4657 Fix T94280: Crash when splitting meta strip
This happens because in `SEQ_time_update_sequence` function
`SEQ_get_meta_by_seqbase` returns uninitialized value. This isn't nice,
but it shouldn't happen in first place. Problem is, that
`SEQ_edit_strip_split` does move strips into detached `ListBase`, so
other functions can't see them anymore. Detached `ListBase` is used
solely to preserve relationships during duplication.

Move strips to original `ListBase` immediately after duplication and
return `NULL` if `SEQ_get_meta_by_seqbase` can't find meta strip.

Splitting itself can still rely on fact, that number of original and
duplicated strips is same and they are placed next to each other in
exactly same order at the end of original `ListBase`.
2021-12-21 05:27:46 +01:00
5457b66301 Cleanup: Use span instead of raw pointer
This is a followup to the previous commit.
2021-12-20 18:10:29 -06:00
7acd3ad7d8 Cleanup: Use simpler loops in weld modifier
In this commit I changed many loops to range-based for loops.
I also removed some of the redundant iterator variables, using
indexing inside the loop instead. Generally an optimizing compiler
should have no problem doing the smartest thing in that situation,
and this way makes it much easier to tell where data is coming from.

I only changed the loops I was confident about, so there is still more
that could be done in the future.

Differential Revision: https://developer.blender.org/D13637
2021-12-20 18:03:06 -06:00
59221476b0 Fix T94262: Grease Pencil Blur Effect DoF mode wrong
This was visible outside of camera view and was not respecting the
"Depth of Field" checkbox on the Camera properties.

Now return early if DoF should not be visible.

Maniphest Tasks: T94262

Differential Revision: https://developer.blender.org/D13631
2021-12-20 21:52:42 +01:00
399f84d479 Run clang-format 2021-12-20 14:30:29 -05:00
d93dd85951 Sculpt: split sculpt.c into three files
Sculpt.c is now three files:

* Sculpt.c: main API methods and the brush stroke operator
* Sculpt_brushes.c: Code for individual brushes.
* Sculpt_ops.c: Sculpt operators other than the brush stroke operator.

TODO: split brush stroke operator into a new file (sculpt_stroke.c?).
2021-12-20 14:20:51 -05:00
Wannes Malfait
e9092110ff Fix T94144: Duplicate edges in dual mesh node
The duplicated edges were caused by 'oversubdivided' edges, i.e. edges
where some of the vertices on them are only connected to two polygons.
The fix finds these vertices and 'dissolves' them so that only one edge
is created.

For most 'normal' meshes this shouldn't occurr, or only very little, so
the performance impact of this change should be neglegible. In practice
this is also avoidable by triangulating the mesh first.

Differential Revision: https://developer.blender.org/D13445
2021-12-20 13:08:05 -06:00
bdb5852e28 Cleanup: Remove mesh valid assertions in debug builds
These are useful for development, but when the primitive nodes
aren't actively changing, the performance cost is not worth it.
2021-12-20 12:46:40 -06:00
Piotr Makal
70de992afe Fix: Incorrect assert conditions in NURBSpline
This fix provides better conditions for asserts in `NURBSpline::knots`
method accounting for cyclic NURBS curves.

Differential Revision: https://developer.blender.org/D13620
2021-12-20 12:43:14 -06:00
76cb11e332 Cleanup: Remove unused node type flag
This flag was checked, but not set anywhere.
2021-12-20 11:03:24 -06:00
82fa2bdf3f Cleanup: Comment formatting in node.cc
Also remove a SCOPED_TIMER I added by mistake in a previous commit.
2021-12-20 10:48:01 -06:00
cb96435047 Geometry Nodes: Parallelize mesh grid primitive
On a Ryzen 3700x, this ended up 2.5x faster than before. More
benchmarking details are included in the differential revision.

For smaller grids, all this should do is increase the
code size a bit, and add a few more if statements.

Differential Revision: https://developer.blender.org/D13617
2021-12-20 10:34:31 -06:00
1d25ba175e Cleanup: Remove unused arguments 2021-12-20 09:57:18 -06:00
6c33a0f6d6 Update our USD 21.02 patch to support gcc-11
There are two issues in USD code that break building it with gcc-11,
one (in `demangle.cpp`) was already fixed upstream, the other (in
`singularTask.h`) is still pending (reported upstream, see
https://github.com/PixarAnimationStudios/USD/issues/1721).

CC #platforms_builds_tests_devices project.
2021-12-20 16:17:42 +01:00
edb3ab0617 Fix T94251: Cycles wrong pointcloud normal for instanced objects
Refactor code a bit also so we need to do fewer matrix transforms for shader
data setup of points and curves.
2021-12-20 14:14:43 +01:00
e2e7f7ea52 Fix Cycles OptiX crash with 3D curves after point cloud changes
Includes refactoring to reduce the number of bits taken by primitive types,
so they more easily fit in the OptiX limit.
2021-12-20 14:14:43 +01:00
Maxime Chambonnet
5adc06d2d8 install_deps: Fix OIIO and OSL build with OpenEXR
Root path variables for those libraries is now using the 'standard' naming
scheme.

With tweaks/cleanups from @mont29.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D13591
2021-12-20 12:52:07 +01:00
deb3d566a5 BLI: fix Vector.prepend declaration
Using `&&` there was a typo. With `&&` the `prepend` method
could not be called with a const reference as argument.
2021-12-20 10:46:43 +01:00
ffd1a7d8c8 Fix T93570: VSE image transforms in preview dont autokey
This was basically not implemented, do this via
`ED_autokeyframe_property` in a new dedicated function in
special_aftertrans_update.

Maniphest Tasks: T93570

Differential Revision: https://developer.blender.org/D13608
2021-12-20 09:12:37 +01:00
fdb2167b4a Docs: use doxygen formatting for BLI
Differentiate doc-strings from title/section text.
2021-12-20 19:07:10 +11:00
5c63c0a58c Docs: use doxygen formatting for DNA
Differentiate doc-strings from title/section text.
Also use explicit doxygen references to struct members
so it's not ambiguous which member is being referenced.

Note that these changes aren't complete (some files weren't touched).
2021-12-20 19:07:10 +11:00
528fc35fed Docs: minor correction to doc-string
The text editor no longer accumulates changes.
2021-12-20 17:42:27 +11:00
0b69793487 Fix T94254: Crash using view_all operator in VSE
Caused by `NULL` dereference in `SEQ_meta_stack_active_get()`.

Check if `Editing` is `NULL` before accessing meta stack.
2021-12-20 02:18:59 +01:00
34fac7a670 Fix: Meta strip not created with alpha over blend mode
Meta add function wasn't updated. All strips now use alpha over
blending, so set it in `SEQ_sequence_alloc()`.
2021-12-20 01:52:40 +01:00
cc367908cd Cleanup: Remove more texture nodes preview handling
Similar to the previous commit, this allowed removing a function to set
a single pixel of a node preview.
2021-12-19 18:37:57 -06:00
0966eab8e9 VSE: Clamp sound strip when adding movie strip
When adding multiple movie strips and sound stream is longer than video,
this results in gaps between video strips, which is undesirable.
2021-12-20 01:35:25 +01:00
c27d0cb7b9 Cleanup: Remove more no-op node preview code
This is a follow-up to rB43875e8dd1d76ee, removing some
processing of non-existent node previews in the shader and
texture nodes systems.
2021-12-19 18:11:47 -06:00
eac6aff741 Cleanup: Const arguments, remove unused argument 2021-12-19 17:57:51 -06:00
6878897a6d Cleanup: Clang tidy lamda function name 2021-12-18 17:18:41 -06:00
8a91673562 Cleanup: Move weld modifier to C++
This moves `MOD_weld.cc` to C++, fixing compiler warnings
coming from the change. It also goes a little bit further and converts
the code to use C++ data structures: `Span`, `Array`, and `Vector`.
This makes the code more shorter and easier to reason about, and
makes memory maneagement more automatic.

Differential Revision: https://developer.blender.org/D13618
2021-12-18 13:42:48 -06:00
491b9cd2b9 Fix: Build error from missing include 2021-12-18 13:41:56 -06:00
b9861055ad Fix: Link drag search missing field nodes from function nodes
When dragging from the inputs of function nodes, other function
nodes wouldn't connect, because their socket declaration field types
weren't set correctly. Instead, they relied on code properly checking
the *node* declaration's `is_function_node()` method. However,
that increases complexity and requires passing the node instead of
just the socket in more places. Instead, set the proper field types
in the socket declaration during building.

Differential Revision: https://developer.blender.org/D13600
2021-12-18 13:31:06 -06:00
d15d512a68 Fix T94173: Missing update for frame node size
Before d56bbfea7b, nodes were updated (size calculated and
buttons added) in reverse order. Instead, now calculate the size of
frame nodes after all other nodes. Separating the drawing further
may be a good step to removing the O(n^2) loop later on.
2021-12-18 13:27:05 -06:00
4c3f57ffa7 Cleanup: compiler warnings with clang
Includes use of memcpy to avoid warnings about deprecated members.
2021-12-18 18:36:34 +01:00
3471b0016c Fix T94215: compositer denoise node UI wrongly shows as disabled
After recent refactoring in 4e98d974b5.
2021-12-18 05:53:38 +01:00
214a56ce8c GPU: add memory barriers for vertex and index buffers
This adds memory barriers to use with `GPU_memory_barrier` to ensure that
writes to a vertex or index buffer issued before the barrier are
completed after it, so they can be safely read later by another shader.

`GPU_BARRIER_VERTEX_ATTRIB_ARRAY` should be used for vertex buffers (`GPUVertBuf`),
and `GPU_BARRIER_ELEMENT_ARRAY` should be used for index buffers (`GPUIndexBuf`).

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13595
2021-12-18 00:55:54 +01:00
Christoph Lendenfeld
8e31e53aa0 Function to return a list of keyframe segments
Add a function that returns a list of keyframe segments
A segment being a continuous selection of keyframes
Will be used by future operators in the graph editor

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D13531
Ref: D13531
2021-12-17 22:43:02 +00:00
76fd2ff9fa Fix T94184: Outliner: Collection dragging tooltip is not updating
In the context of the dragdrop tooltip, the event referenced to the window
is out of date and contains invalid `mval` values.

Avoid using `win->eventstate` as much as possible.
2021-12-17 19:13:14 -03:00
4b21067aea Fix T94116: Drivers can have multiple variables with same name
The RNA setter now ensures that driver variables are uniquely named
(within the scope of the driver).

Versioning code has been added to ensure this uniqueness. The last
variable with the non-unique name retains the original name; this
ensures that the driver will still evaluate to the same value as before
this fix.

This also introduces a new blenlib function `BLI_listbase_from_link()`,
which can be used to find the entire list from any item within the list.

Manifest Task: T94116

Reviewed By: mont29, JacquesLucke

Maniphest Tasks: T94116

Differential Revision: https://developer.blender.org/D13594
2021-12-17 17:31:15 +01:00
2648d920d8 Theme: Node Group color only needs RGB, not RGBA
The node group alpha theme was used for the overlay drawing in the node
editor. Since this was removed (919e513fa8) the alpha channel doesn't
need to be exposed anymore.

Reported as part of T93654.
2021-12-17 16:47:06 +01:00
Hans Goudey
0aabaa4583 Cleanup: Use signed integers in the weld modifier
The style guide mentions that unsigned integers shouldn't be used to
show that a value won't be negative. Many places don't follow this
properly yet. The modifier used to cast an array of `uint` to `int` in
order to pass it to `BLI_kdtree_3d_calc_duplicates_fast`. That is no
longer necessary.

Differential Revision: https://developer.blender.org/D13613
2021-12-17 12:40:01 -03:00
552dce0de7 Cleanup: quiet warning due to incompatible pointer types 2021-12-17 15:46:00 +01:00
77760194fe Cleanup: use new c++ guarded allocator api in some files 2021-12-17 15:42:28 +01:00
a3ad5abf2f Allocator: simplify using guarded allocator in C++ code
Using the `MEM_*` API from C++ code was a bit annoying:
* When converting C to C++ code, one often has to add a type cast on
  returned `void *`. That leads to having the same type name three times
  in the same line. This patch reduces the amount to two and removes the
  `sizeof(...)` from the line.
* The existing alternative of using `OBJECT_GUARDED_NEW` looks a out
  of place compared to other allocation methods. Sometimes
  `MEM_CXX_CLASS_ALLOC_FUNCS` can be used when structs are defined
  in C++ code. It doesn't look great but it's definitely better. The downside
  is that it makes the name of the allocation less useful. That's because
  the same name is used for all allocations of a type, independend of
  where it is allocated.

This patch introduces three new functions: `MEM_new`, `MEM_cnew` and
`MEM_delete`. These cover the majority of use cases (array allocation is
not covered).

The `OBJECT_GUARDED_*` macros are removed because they are not
needed anymore.

Differential Revision: https://developer.blender.org/D13502
2021-12-17 15:42:28 +01:00
Phil Stopford
c0d96ca9a5 UI: make Remap User dialog in outliner wider
The previous size was too small for common object names.

Differential Revision: https://developer.blender.org/D13604
2021-12-17 15:21:12 +01:00
Alessio Monti di Sopra
3b965ba10b UI: Fix node socket alignment in some cases
The patch fixes some misalignments in the nodes' sockets/options
recently introduced in 26d2caee3b, while maintaining the original
fix for T92268.

The original fix made the top padding always of the same size; while
that works when the first row of the other node is `Socket | Socket`,
it doesn't for other more common cases, `like Socket | Node Option`,
where the text results misaligned.

Differential Revision: https://developer.blender.org/D13451
2021-12-17 08:04:28 -06:00
b386f960f6 Fix error in Cycles geometry update tagging after pointcloud addition
Thanks to Christophe Hery for spotting this.
2021-12-17 14:59:24 +01:00
Michael
67734d1853 Fix T94142, T94182: Cycles metal broken after pointcloud changes
Missing ccl_private form an older patch.

Differential Revision: https://developer.blender.org/D13612
2021-12-17 14:46:52 +01:00
f3c1d0e3a3 Fix T94137: GPencil: Eraser does not erase first point
The eraser checks the current, previous and next point (and sets pc0,
pc1 & pc2 corresponding to that for futher occlusion/brush/clipping
checks). For the very first point, it sets pc0 to pc1 [which makes sense,
there is no previous point, so we should assume the previous segment is
"visible" as soon as the first point is], but does so *before* pc1 is
even calculated. This makes following occlusion/brush/clipping checks
work with zero values [which leads to no earsing in most cases].

Now *first* calculate pc1, *then* set pc0 to pc1.

Maniphest Tasks: T94137

Differential Revision: https://developer.blender.org/D13593
2021-12-17 14:38:11 +01:00
7c9e409985 Outliner ID Remap Users: hide ID type from the UI
The correct type should be set by invoke already, changing it to a non-
matching type (e.g. trying to remap Mesh users with a Camera block) does
not really make sense afaict, reason being that we would be presented
with the "Invalid old/new ID pair" message in such case anyways (code
checks GS(old_id->name) == GS(new_id->name)).

This alone wouldnt be a pressing issue, but since doing this with an
object ID type crashes atm., it seems to make sense to clean this up now
(of course the crash should be looked into, but this is for a separate
patch -- if that is solved, we could also think about adding the "Remap
Users" entry back in the context menu for objects as well [which was
removed in rB17bd5c9d4b1e for some reason]).

Part of T93799.

Differential Revision: https://developer.blender.org/D13512
2021-12-17 13:58:25 +01:00
9690b7c91b Fix (unreported): missed running versioning code in some files
The versioning code was accidentally put not at the very bottom.
That lead to a situation where it wasn't run on some files that happened
to be within a specific short time frame.

Since the versioning code is idempotent, it can just run again on existing
files. Therefore, this commit just moves it back to the bottom so that it
is executed on all files again.

Broken Commit: rB5b61737a8f41688699fd1d711a25b7cea86d1530.
2021-12-17 13:49:53 +01:00
367b484841 Fix T94166: set handle position node crashed after refactor
This was an oversight in rB8e2c9f2dd3118bfdb69ccf0ab2b9f968a854aae4.
2021-12-17 10:40:01 +01:00
b9d6271916 GPU: Sort SSBOs In Shader Interface.
SSBOs weren't sorted, but other types were. This was an
oversight when SSBOs were introduced (GPU compute pipeline).

Issue identified by @fclem.
2021-12-17 08:16:06 +01:00
7788293954 Cleanup: Silenced unused var warnings. 2021-12-17 08:04:35 +01:00
0e1bb232e6 UI: move "undo history" from a custom popup to a menu type
This lets the undo history expand as a regular sub-menu
instead of being a popup.

Also disable the active undo step menu item as this is a no-op.
2021-12-17 17:28:57 +11:00
c536eb410c Cleanup: spelling in comments 2021-12-17 15:26:28 +11:00
6b3c3454d3 Cleanup: use more common naming suffix for item callbacks 2021-12-17 15:11:16 +11:00
Johannes Jakob
1f50c2876e UI: Correct "QuickTime" Spelling
Change the spelling of the QuickTime output video container item from
"Quicktime" to "QuickTime"

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

Reviewed by Harley Acheson
2021-12-16 17:59:06 -08:00
b7e151d876 Cleanup: Simplify logic in set material node 2021-12-16 15:44:50 -06:00
da2c564bb0 Geometry Nodes: Support point clouds in the set material node
Now that point clouds can be rendered with cycles, it makes sense
to allow assigning a material to them. Note that like volumes, they
only support a single material though.
2021-12-16 15:39:59 -06:00
35b1e9fc3a Cycles: pointcloud rendering
This add support for rendering of the point cloud object in Blender, as a native
geometry type in Cycles that is more memory and time efficient than instancing
sphere meshes. This can be useful for rendering sand, water splashes, particles,
motion graphics, etc.

Points are currently always rendered as spheres, with backface culling. More
shapes are likely to be added later, but this is the most important one and can
be customized with shaders.

For CPU rendering the Embree primitive is used, for GPU there is our own
intersection code. Motion blur is suppored. Volumes inside points are not
currently supported.

Implemented with help from:
* Kévin Dietrich: Alembic procedural integration
* Patrick Mourse: OptiX integration
* Josh Whelchel: update for cycles-x changes

Ref T92573

Differential Revision: https://developer.blender.org/D9887
2021-12-16 20:54:04 +01:00
2229179faa Revert "Cycles-X: Add hysteresis to resolution divider algorithm"
This reverts commit d8b4275162. It causes reduced
viewport render resolution. Revert for now until I have time to look into this
more closely.
2021-12-16 18:29:27 +01:00
bd12855110 Cleanup: Move curve.c to C++
I need this for a refactor I'm looking into for bounding boxes.
It may be helpful in the future when using `CurveEval` in more places.

Differential Revision: https://developer.blender.org/D13596
2021-12-16 11:22:48 -06:00
197b3502b0 LibOverride: Further improve creation/resync pre-process speed.
Fully get rid of `BKE_collection_object_find` in
`lib_override_group_tag_data_object_to_collection_init`, even if only
used a few times this function was still noticeable in profiling data.

Now instead loop over collections' objects to build required
object-to-collections mapping.

Adds an extra 5-10% speed-up compared to previous commit rB0624fad0f3ff.

Related to T94059.
2021-12-16 18:15:19 +01:00
9765ddf4eb Fix T94109: 3d cursor crash when using shortcut
Operator was erroneously starting edge_slide operation.

Revert part of the changes in rB3fab16fe8eb4 as obedit_type was being
confused with object_mode.
2021-12-16 13:45:35 -03:00
0624fad0f3 LibOverride: Improve speed of resync and creation of liboverrides.
`BKE_collection_object_find` has extremely bad performances (very high
time complexity). While ideally this should be fixed in that API, for
now cache its results once at the beginning of the resync/creation
process.

This makes loading of complex production files with a lot of
liboverrides to resync three to four times faster.

Thanks to @brecht for the profiling in T94059.
2021-12-16 17:27:38 +01:00
b1f865f9d3 LibOverride: Cleanup log about unfound subitems.
Not finding subitem when its name and index are invalid/unset is
expected behavior, and does happen when e.g. inserting a new constraint
or modifier at the begining of the stack.
2021-12-16 16:48:00 +01:00
0f589f8d3c Fix T94115: Selecting current action in undo history undoes all
When selecting the current undo step there is no need to do anything.

Fix and minor refactor to de-duplicate refreshing after running
undo/redo & undo history.
2021-12-16 23:40:11 +11:00
d6902668e3 UI: support Copy To Selected for id-properties [GN modifier properties]
Both {key Alt} editing behavior as well as `Copy To Selected` were not
working on geometry nodes modifiers (even if these matched exactly -
having the same nodegroup - on multiple objects)

Reason is that code checks pointer equality on the discovered properties
[geometry nodes modifier properties are stored as ID properties], but
these are not the same across objects (since these are fetched from
NodesModifierSettings - which are different on different objects).

note: if general custom properties are "API defined" on existing classes,
this was working, we are getting the exact property for different IDs in
this case

Now be more permissive with ID properties not defined on classes in
general and dont check pointer equality for them. For ID properties on
specific IDs (not the ones defined on classes) this //might// be undesired
(havent spotted issues though, even if equally named ID properies with
different types existed -- this then simply does nothing).

For geometry nodes modifiers, new code also checks if the nodegroups are
the same [since generic naming "Input_XXX" is shared for all modifiers --
and starting to copy over things to unrelated modifiers is not desired
here].

Fixes T93983.

Maniphest Tasks: T93983

Differential Revision: https://developer.blender.org/D13573
2021-12-16 13:18:19 +01:00
6da23db5e0 UI: deduplicate code for Copy To Selected and Alt-button tweaking
This resolves an old TODO to deduplicate code in copy_to_selected_button
& ui_selectcontext_begin.
This is also in hindsight of adding id-property support [incl. Geometry
Nodes modifier properties] for this in the next commit.
No behavior change expected here.

ref T93983 & D13573
2021-12-16 13:18:19 +01:00
3e04d37529 Cleanup: correct docstring for driver_variable_name_validate
No functional changes.
2021-12-16 12:54:25 +01:00
59774d64f0 Docs: add doc-strings for BLI_path functions 2021-12-16 21:58:04 +11:00
21c7689b77 Animation: send notifier when keyframe is inserted
`<some_id>.keyframe_insert()` now sends a notifier that animation data
was changed, so that animation-related editors can properly refresh.

Since this function is quite high-level (if necessary it creates the
Action and FCurves), I thought this would be a suitable location for the
notifier. If high keyframing speed is required, it is still recommended
to use `FCurveKeyframePoints.insert(options={'FAST'})` instead.
2021-12-16 11:26:21 +01:00
1818110459 Fix compile error on Windows. 2021-12-16 10:08:31 +01:00
8dbd406ea0 WM: various changes to file writing behavior
Saving with only a filename (from Python) wasn't being prevented,
while it would successfully write the file to the working-directory,
path remapping and setting relative paths wouldn't work afterwards
as `Main.filepath` would have no directory component.

Disallow this since it's a corner case which only ever occurs
when path names without any directories are used from Python,
the overhead of expanding the working-directory for all data saving
operations isn't worthwhile.

The following changes have been made:

- bpy.ops.wm.save_mainfile() without a filepath argument
  fails & reports and error when the file hasn't been saved.

  Previously it would write to "untitled.blend" and set the
  `G.main->filepath` to this as well.

- bpy.ops.wm.save_mainfile(filepath="untitled.blend")
  fails & reports and error as the filename has no directory component.

- `BLI_path_is_abs_from_cwd` was added to check if the path would
  attempt to expand to the CWD.
2021-12-16 16:27:35 +11:00
15c3617009 Cleanup: simplify file saving logic
Revert part of the fix from 073669dd85
that initialized the file-path on first save as it's no longer needed.

Also remove relbase argument to BLI_path_normalize as the destination
file paths shouldn't use relative locations.
2021-12-16 16:27:35 +11:00
Aaron Carlisle
4e98d974b5 Nodes: Begin splitting composite node buttons into individual files
Currently, most node buttons are defined in `drawnode.cc` however,
this is inconvenient because it requires editing many files when adding new nodes.
The goal is to minimize the number of files needed to add or update a node.

This commit moves most of the node layout functions for composite nodes into their respected
`source/blender/nodes/composite/nodes` file.

In the future, these functions will be simplified to `node_layout` once files have their own namespace.
See {D13466} for more information.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13523
2021-12-15 21:30:29 -05:00
5de109cc2d Remove G.relbase_valid
In almost all cases there is no difference between `G.relbase_valid`
and checking `G.main->filepath` isn't an empty string.

In many places a non-empty string is already being used instead of
`G.relbase_valid`.

The only situation where this was needed was when saving from
`wm_file_write` where they temporarily became out of sync.
This has been replaced by adding a new member to `BlendFileWriteParams`
to account for saving an unsaved file for the first time.

Reviewed By: brecht

Ref D13564
2021-12-16 11:41:46 +11:00
4b12f521e3 Cleanup: spelling 2021-12-16 11:38:09 +11:00
807efa8538 Cleanup: clang-format 2021-12-16 11:38:08 +11:00
366ec5f0f8 Cleanup: unused variable warning 2021-12-16 11:38:06 +11:00
b265b447b6 Fix various cases of incorrect filtering in node link drag search
Some nodes didn't check the type of the link's socket for filtering.
Do this with a combination of manually calling the node tree's validate
links function and using the helper function for declarations.

Also clean up a few cases that added geometry sockets manually
when they can use the simpler helper function.
2021-12-15 18:05:45 -06:00
36a830b4d3 Fix: Compare node missing from link drag search
This was missing from rB11be151d58ec0ca955f.
It uses the same approach as the quadrilateral node.
2021-12-15 17:37:55 -06:00
49311a73b8 Fix: Crash in nodes modifier with missing node group
We cannot depend on node->id being non-null for group nodes.
2021-12-15 15:00:20 -06:00
aa55cb2996 Cleanup: Use const arguments, references
Also slightly change naming to avoid camel case.
2021-12-15 14:51:58 -06:00
43875e8dd1 Cleanup: Remove no-op node preview function calls
This patch removes no-op node editor preview code (`PR_NODE_RENDER`)
and most calls to `BKE_node_preview_init_tree`. The only remaining call is
in the compositor.

 - Shader nodes previews don't seem to do anything.
 - In-node previews for the texture node system doesn't work either.

This is a first step to refactoring to remove `preview_xsize`,
`preview_ysize`, and `prvr` from nodes in DNA, aligned with
the general goal of removing runtime/derived data from data
structs.

Differential Revision: https://developer.blender.org/D13578
2021-12-15 14:27:38 -06:00
b32f5a922f Fix T93995: Cycles camera motion blur not working in right stereo view
Thanks to Michael (michael64) for identifying the solution.

Ref D13567
2021-12-15 20:47:54 +01:00
11be151d58 Node Editor: Link Drag Search Menu
This commit adds a search menu when links are dragged above empty
space. When releasing the drag, a menu displays all compatible
sockets with the source link. The "main" sockets (usually the first)
are weighted above other sockets in the search, so they appear first
when you type the name of the node.

A few special operators for creating a reroute or a group input node
are also added to the search.

Translation is started after choosing a node so it can be placed
quickly, since users would likely adjust the position after anyway.

A small "+" is displayed next to the cursor to give a hint about this.

Further improvements are possible after this first iteration:
 - Support custom node trees.
 - Better drawing of items in the search menu.
 - Potential tweaks to filtering of items, depending on user feedback.

Thanks to Juanfran Matheu for developing an initial patch.

Differential Revision: https://developer.blender.org/D8286
2021-12-15 09:51:57 -06:00
474adc6f88 Refactor: Simplify spreadsheet handling of cell values
Previously we used a `CellValue` class to hold the data for a cell,
and called a function to fill it whenever necessary. This is an
unnecessary complication when we have virtual generic arrays
and most data is already easily accessible that way anyway.
This patch removes `CellValue` and uses `fn::GVArray` to provide
access to data instead.

In the future, if rows have different types within a single column,
we can use a `GVArray` of `blender::Any` to interface with the drawing.

Along with that, the use of virtual arrays made it easy to do a
few other cleanups:
 - Use selection domain interpolations from rB5841f8656d95
   for the mesh selection filter.
 - Change the row filter to only calculate for necessary indices.

Differential Revision: https://developer.blender.org/D13478
2021-12-15 09:34:13 -06:00
d79868c4e6 Fix T93975: add more nested instance limit checks
Differential Revision: https://developer.blender.org/D13585
2021-12-15 15:46:39 +01:00
Michael
5f52684a0f Initialize the fourth and final instance variable of MemoryProxy
The constructor of MemoryProxy initializes 3 of 4 instances variables.
If a MemoryProxy is constructed and MemoryProxy::free is called
on this instance, buffer_ is undefined and 'delete buffer_;' causes errors.

Although this misuse pattern does not exist in the current codebase
it already tripped up the Address Sanitizer on various occasions
while debugging unrelated problems.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D13569
2021-12-15 15:46:28 +01:00
1a833dbdb9 Geometry Nodes: Add Selection to Attribute Statistics
This adds a bool field selection input to the Attribute Statistics node.
This is useful for running calculations on a subset of the input field data
rather that then whole set.

Differential Revision: https://developer.blender.org/D13520
2021-12-15 08:04:49 -06:00
e85d7d5a28 Fix T93971: "Center Cursor & Frame All" fails to redraw
bda9e4238a changed smooth-view
not to redraw when there were no changes made.
Redrawing is needed for repositioning the cursor.

Subscribe to changes to the 3d cursor to ensure all view ports
are updated (not just the current one).
2021-12-16 00:15:13 +11:00
c101ded463 Cleanup: remove disabled code
Originally pointcache wasn't supported when the file wasn't saved.
Remove commented code as this hasn't been the case for a long time.
2021-12-15 23:45:11 +11:00
a9d8ff6e21 Cleanup: unused variable warning 2021-12-15 23:43:31 +11:00
883e4c089a MetaBall: optimize memory allocation for meta-ball tessellation
Double the allocation size when the limit is reached instead of
increasing by a fixed number.

Also re-allocate to the exact size once complete instead of over
allocating. This gives a minor speedup in my tests ~19% faster
tessellation for ~1million faces.
2021-12-15 23:40:39 +11:00
6a885e5d89 Fix meta-ball bound-box calculation reading past buffer bounds
This broke "test_undo.view3d_multi_mode_select" test in
"lib/tests/ui_simulate" and is likely exposed by recent changes to
bounding box calculation.

The missing check for DL_INDEX4 dates back to code from 2002 which
intended to check this but was checking for DL_INDEX3 twice
which got removed as part of a cleaned up.

This could be hidden from memory checking tools as meta-balls
over-allocate vertex arrays.
2021-12-15 23:40:33 +11:00
3a856f7967 Fix compile errors on windows. 2021-12-15 11:51:03 +01:00
6051b80dd2 Cleanup: Use pixel in stead of texels in naming. 2021-12-15 11:19:29 +01:00
723fb16343 Images: 1,2,3 channel support for transform function.
Added support for 1, 2, 3 float channel source images. Destination
images must still be 4 channels.
2021-12-15 11:09:31 +01:00
67b657f07c Fix T94082: Curve to point empty evaluated NURBS crash
This is basically the same as rBee4ed99866fbb7ab04, the fix is
simply to check if the spline has evaluated points when deciding
the offsets into the result points array.
2021-12-14 18:57:45 -06:00
644eb68524 Fix T93949: Preview Image Error When No Screen
Fix an error if "File Preview Type" is "Auto" and there is no screen.

See D13574 for details.

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

Reviewed by Julian Eisel
2021-12-14 13:50:40 -08:00
40aee0b2e9 Fix possible use-after-free on error handling during VR view drawing
Whenever an exception happens in VR session code, we cancel the entire
session. Alongside that, we removed the "surface" item used to draw into
an offscreen context. This would mess up the iterator of the surface
draw loop.
Similar to 7afd84df40.
2021-12-14 20:57:39 +01:00
4cfa21f09b Fix null-pointer dereference on error handling during VR view drawing 2021-12-14 20:44:17 +01:00
7afd84df40 Fix possible use-after-free on error handling during VR view drawing
Whenever an exception happens in VR session code, we cancel the entire
session. Alongside that, we removed the "surface" item used to draw into
an offscreen context. But this may still be stored as active surface,
leading to a use-after-free when deactivating this active surface, for
example.
2021-12-14 20:13:58 +01:00
7e8912eb96 Fix Cycles compilation with CUDA / Optix after recent Map Range additions. 2021-12-14 20:01:30 +01:00
Charlie Jolly
5b61737a8f Nodes: Add vector support to Map Range node
This replaces lost functionality from the old GN Attribute Map Range node.
This also adds vector support to the shader version of the node.

Notes:
This breaks forward compatibility as this node now uses data storage.

Reviewed By: HooglyBoogly, brecht

Differential Revision: https://developer.blender.org/D12760
2021-12-14 18:27:01 +00:00
44232a2ce6 Cleanup: Remove unused arguments 2021-12-14 12:16:28 -06:00
d56bbfea7b Cleanup: Remove runtime uiBlock pointer from nodes
Code is simpler when the uiBlocks used during drawing are simply
stored in an array. Additionally, looping can be simpler when we use
an vector to hold a temporary copy of the tree's linked list of nodes.

This patch also slightly changes how uiBlocks are "named" in
`node_uiblocks_init`. Now it uses the node name instead of the
pointer, which is helpful so we rely less on the node's address.

Differential Revision: https://developer.blender.org/D13540
2021-12-14 11:19:47 -06:00
fdd41ac49e Cleanup: Simplify node group input and output socket verification
This commit refactors the way the socket lists for group nodes,
and group input/output nodes are verified to match the group's
interface.

Previously the `bNodeSocket.new_sock` pointer was used to
temporarily mark the new sockets. This made the code confusing
and more complicated than necessary.

Now the old socket list is saved, and sockets are moved directly from
the old list to a new list if they match, or a new socket is created
directly in the new list.

This change is split from D13518, which aims to remove the `new_node`
and `new_sock` pointers. In the future this code might be removed
entirely in favor of using node socket declarations.

Differential Revision: https://developer.blender.org/D13543
2021-12-14 10:56:12 -06:00
f5ce243a56 Geometry Nodes: support instance attributes when realizing instances
This patch refactors the instance-realization code and adds new functionality.
* Named and anonymous attributes are propagated from instances to the
  realized geometry. If the same attribute exists on the geometry and on an
  instance, the attribute on the geometry has precedence.
* The id attribute has special handling to avoid creating the same id on many
  output points. This is necessary to make e.g. the Random Value node work
  as expected afterwards.

Realizing instance attributes has an effect on existing files, especially due to the
id attribute. To avoid breaking existing files, the Realize Instances node now has
a legacy option that is enabled for all already existing Realize Instances nodes.
Removing this legacy behavior does affect some existing files (although not many).
We can decide whether it's worth to remove the old behavior as a separate step.

This refactor also improves performance when realizing instances. That is mainly
due to multi-threading. See D13446 to get the file used for benchmarking. The
curve code is not as optimized as it could be yet. That's mainly because the storage
for these attributes might change soonish and it wasn't worth optimizing for the
current storage format right now.

```
1,000,000 x mesh vertex:       530 ms -> 130 ms
1,000,000 x simple cube:      1290 ms -> 190 ms
1,000,000 x point:            1000 ms -> 150 ms
1,000,000 x curve spiral:     1740 ms -> 330 ms
1,000,000 x curve line:       1110 ms -> 210 ms
10,000 x subdivided cylinder:  170 ms ->  40 ms
10 x subdivided spiral:        180 ms -> 180 ms
```

Differential Revision: https://developer.blender.org/D13446
2021-12-14 15:57:58 +01:00
8e2c9f2dd3 Geometry Nodes: simplify using selection when evaluating fields
We often had to use two `FieldEvaluator` instances to first evaluate
the selection and then the remaining fields. Now both can be done
with a single `FieldEvaluator`. This results in less boilerplate code in
many cases.

Performance is not affected by this change. In a separate patch we
could improve performance by reusing evaluated sub-fields that are
used by the selection and the other fields.

Differential Revision: https://developer.blender.org/D13571
2021-12-14 15:40:27 +01:00
b44a500988 Fix T93920: Wrong field inferencing state with unavailable socket
This commit ignores unavailable sockets in one more place, to fix the
case in T93920.

Differential Revision: https://developer.blender.org/D13562
2021-12-14 08:30:45 -06:00
b5c18288f5 Fix T93649: Blender freezes when saving with active VR session
Dead-lock when VR viewport drawing and depsgraph updates would fight for
the draw-manager GL lock. This didn't usually cause issues because the
depsgraph would be evaluated at this point already, except in rare
exceptions like after file writing.

Fix this by ensuring the XR surface gets its depsgraph updated after
handling notifiers, which is where regular windows also do the depsgraph
updating.
2021-12-14 15:23:50 +01:00
5cce6894d2 Cleanup: consistent naming for the blender file name 2021-12-14 21:32:14 +11:00
381cef1773 Cleanup: remove oudated comment from early COW development
Added in 161ab6109e
2021-12-14 21:17:06 +11:00
c9e5897bb0 Cleanup: use typed enum for wmDrag.flags
Also use 'e' prefix for enum type name.
2021-12-14 21:08:30 +11:00
f6fd3a84c2 Cleanup: reorganize doxygen modules
- Nest compositor pages under the compositor module
- Nest GUI, DNA/RNA & externformats modules under Blender.
- Remove modules from intern which no longer exist.
- Add intern modules (atomic, eigen, glew-mx, libc_compat, locale,
  numaapi, rigidbody, sky, utfconv).
- Use 'intern_' prefix for intern modules since some of the modules
  use generic terms such as locale & atomic.
2021-12-14 20:56:11 +11:00
a207c1cdaf Cleanup: resolve parameter mis-matches in doc-strings
Renamed or removed parameters which no longer exist.
2021-12-14 18:35:23 +11:00
c097c7b855 Cleanup: correct unbalanced doxygen groups
Also add groups in some files.
2021-12-14 16:17:10 +11:00
c1f5d8d023 Fix T91005: Autosplit produces unusable files
Audio PTS was reset for each new file. This caused misalignment of video
and audio streams. In Blender, these files can't be loaded, other
players will fail to align audio and video.

Since timestamps are reset intentionally, reset also video stream
timestamps.

There were other bugs:
After timestamp was reset for audio, write_audio_frames started
encoding from timeline start until target frame, so each split video
had more audio than it should.

Also audio for last frame before splitting was written into new file.

Differential Revision: https://developer.blender.org/D13280
2021-12-14 01:16:24 +01:00
b647509913 Fix T93844: High memory usage during VSE preview
Since 88c02bf826 FFmpeg handles are freed if image is not displayed.
This change did not work correctly if strips are inside meta strip,
because overlap did not consider meta strip boundary, only strips inside
of meta strip.

Pass frame range to `sequencer_all_free_anim_ibufs`, if strip is inside
of meta strip, frame range is reduced to fit meta strip boundary, but if
meta strip is being edited, range must be set to +/-`MAXFRAME`,
otherwise playback performance would be too bad.
2021-12-14 00:43:54 +01:00
2a0a6a0541 Remove G.save_over
The difference between G.save_over and G.relbase_valid was minor.

There is one change in functionality. When saving the default-startup
file from an already loaded blend file - future save actions will
continue to write to the originally loaded file instead of prompting
the user to select a location to save the file.

This change makes saving the startup file behave the same way
"Save a Copy" does.

Reviewed By: brecht

Ref D13556
2021-12-14 09:42:46 +11:00
a603bb3459 Cleanup: clang-format 2021-12-14 09:42:44 +11:00
e688c927eb Fix T94022: Both options GPU/CPU checked under preferences cause viewport render crash. (ARM/Metal)
This fixes crash T94022 when selecting live viewport render with both GPU & CPU devices selected. It is caused by incorrect `KernelBVHLayout` assignment. Similar to `BVH_LAYOUT_MULTI_OPTIX` for Optix, this patch adds a `BVH_LAYOUT_MULTI_METAL` to correctly redirect to the correct Metal BVH layout type.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13561
2021-12-13 22:34:48 +00:00
Piotr Makal
b8952ecec9 Cleanup: Remove unused curve types from enum
There were a few unused enum values: `CU_CARDINAL` and `CU_BSPLINE`
This commit cleans them up from code as they were not used for
anything meaningful.

Differential Revision: https://developer.blender.org/D13554
2021-12-13 15:13:47 -06:00
0606adceb3 UI: String Search: Add an optional weight parameter
This builds off of rBf951aa063f7, adding a weight parameter which can
be used to change the order of items when they have the same match
score. In the future, if string searching gets a C++ API, we could
use an optional parameter for the weight, since it is not used yet.

This will be used for the node link drag search menu (D8286).

Differential Revision: https://developer.blender.org/D13559
2021-12-13 13:58:30 -06:00
Cody Winchester
a90c356467 GPencil: Add randomize options to Length modifier
This patch adds a randomize factor for the start/end lengths in the Length modifier.

Reviewed By: #grease_pencil, antoniov, pepeland, HooglyBoogly

Differential Revision: https://developer.blender.org/D12928
2021-12-13 17:14:44 +01:00
459af75d1e GPencil: New Shrinkwrap modifier
his new modifier is equals to the existing mesh modifier but adapted to grease pencil.

The underlying functions used to calculate the shrink are the same used in meshes.

{F11794101}

Reviewed By: pepeland, HooglyBoogly

Differential Revision: https://developer.blender.org/D13192
2021-12-13 17:09:22 +01:00
49802af7cd Cycles: add text explaining minimum requirements for Metal when no device found 2021-12-13 15:40:59 +01:00
Brecht Van Lommel
3f96555123 Cycles: enable Metal GPU rendering
This adds the remaining bits to enable Metal on macOS. There are still
performance optimizations and other improvements planned, but it should
now be ready for early testing.

This is currently only enabled on in Arm builds for M1 GPUs. It is not
yet working on AMD or Intel GPUs.

Ref T92212

Differential Revision: https://developer.blender.org/D13503
2021-12-13 13:57:13 +01:00
8ba6302696 Geometry Nodes: fix combining field inputs
This was an oversight in rB7b88a4a3ba7eb9b839afa6c42d070812a3af7997.
2021-12-13 13:51:42 +01:00
8709cbb73e Fix T93704: StructRNA.path_resolve fails silently with missing keys
Resolving the path to a missing pose-bone (for example),
was not raising an error as it should have.

Regression introduced in f9ccd26b03,
which didn't update collection lookup logic to fail in the case the
key of a collection wasn't found.
2021-12-13 23:48:17 +11:00
1686979747 Geometry Nodes: move up destruct instructions in procedure
This implements an optimization pass for multi-function procedures.
It optimizes memory reuse by moving destruct instructions up.
For more details see the in-code comment.

In very large fields with many short lived intermediate values, this change
can improve performance 3-4x. Furthermore, in such cases, peak memory
consumption is reduced significantly (e.g. 100x lower peak memory usage).

Differential Revision: https://developer.blender.org/D13548
2021-12-13 13:28:33 +01:00
e549d6c1bd Fix T93169: Weightpaint falloff popover drawn twice
This came with {rBf8a0e102cf5e}.

The panel was meant specifically for the gradient tool, but since it was
given the ".weighpaint" context, it would also draw as part of generic
header toolsettings drawing.

Now remove this context on purpose and only draw this specifically from
the gradient tools ToolDef.

Maniphest Tasks: T93169

Differential Revision: https://developer.blender.org/D13268
2021-12-13 09:38:17 +01:00
bea5a9997d Cleanup: clang-format 2021-12-13 16:22:21 +11:00
36c6b2e893 Cleanup: spelling in comments
Also move notes about where noise functions come from
into the function body as it's not relavant to the public doc-string.
2021-12-13 16:22:20 +11:00
8ad2642c47 Cleanup: use "filepath" term for Main, BlendFileData & FileGlobal
Use "filepath" which is the current convention for naming full paths.

- Main use "name" which isn't obviously a file path.
- BlendFileData & FileGlobal used "filename" which is often
  used for the name component of a path (without the directory).
2021-12-13 16:22:19 +11:00
27231afce5 Cleanup: remove checks for invalid input for Python Run utilities
These arguments must be non-null for useful functionality,
there is no need for paranoid checks.

The return value in case of invalid input for BPY_run_string_as_number
was also wrong (casting -1 to a bool, when false was expected).
2021-12-13 16:22:18 +11:00
80f1527762 Cleanup: Point cloud vs point-cloud in comments
Point cloud is two separate words, this just changes comments in
a few places where we were inconsistent. A small wording change
to another comment is also included.
2021-12-12 23:00:39 -06:00
d9d4b9899e Cleanup: Remove includes in node_util.h header
This ends up including the removed headers in many unnecessary places.
Also, remove unnecessary extern from function definitions.
2021-12-12 22:56:51 -06:00
f5679838bc Docs: document all Global (G) struct members 2021-12-13 14:05:31 +11:00
bc1e517bb3 Docs: improve on doc-strings for BPY_extern_run.h
Also add ATTR_NONNULL function attributes.
2021-12-13 13:12:09 +11:00
03015a9b22 Cleanup/docs: Add comment to spline lookup factor method 2021-12-12 18:03:30 -06:00
92237f11eb Geometry Nodes: improve memory reuse in procedure executor
This reduces the number of separate memory allocations done
by the multi-function procedure executor (which is used by the
field evaluation).

Now a linear memory allocator is used to allocate all intermediate
values. Furthermore, more buffers are reused when possible. This
reduces the total amount of allocated memory and improves
cache efficiency because the values are more likely to be in cache
already.

The performance improvement of this patch are most noticable
when few elements are processed by many functions. The situation
will improve even more with D13548, because then buffers can actually
be reused in practice. I measured up to 20% faster field evaluation
in extreme cases with this change.
2021-12-12 10:34:02 +01:00
b444e1be0f Cleanup: use struct instead of class
Using `class` and `struct` for the same type can cause issues on windows.
2021-12-12 08:58:55 +01:00
Charlie Jolly
8c55481e33 UI: Add curve handle buttons to CurveMap interface
This patch exposes the vector handle options as buttons
and aligns the UI between CurveMap and CurveProfile more closely.
- CurveMap point editing is on a single row like CurveProfile
- Tools menu is moved to the right hand side on both widgets
- Emboss curve map buttons

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D10980
2021-12-12 07:17:35 +00:00
9df13fba69 macOS: add tilde-based path expander
Replaces `HOME` environment variable usage for user
directories like in D12802.

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D13212
2021-12-11 22:29:53 +05:30
23be5fd449 Cleanup: Use const arguments
Also remove unnecessary function to set a node type's
label function that duplicated its definition, and make
another function static.
2021-12-11 09:51:53 -06:00
96387a2eff Cleanup: const, autoreleasepool, remove unneeded cast.
Early return in some places also.
De-duplicate getSystemDir and getUserDir also.

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D13211
2021-12-11 19:07:36 +05:30
7b88a4a3ba Geometry Nodes: remove accidental exponential time algorithm
Calling `foreach_field_input` on a highly nested field (we do that
often) has an exponential running time in the number of nodes.
That is because the same node may be visited many times.
This made Blender freeze on some setups that should work just fine.
Now every field keeps track of its inputs all the time. That replaces
the exponential algorithm with constant time access.
2021-12-11 11:26:55 +01:00
4c705ab8fe Fix compilation error on Windows platform. 2021-12-11 09:48:43 +01:00
8c7d970e2c Sky: Use Gauss-Laguerre quadrature for optical depth calculation
This allows to use fewer evaluations (30 msec down to 23 for me) while giving more accurate results (3x-10x less relative absolute error) compared to classic ray marching.

Not a massive difference, but meh, it's better. For Cycles the speedup doesn't really matter much, but I also have a patch for Eevee support.

I've also tried Gauss-Legendre and Gauss-Lobatto - the latter was always worse, while the former was slightly better at 2deg elevation but notably worse on 15deg.

Unfortunately the same approach can't be used for the integration along the primary ray, since there we also need the accumulated transmission so far at every integration point, not just the total result.

Differential Revision: https://developer.blender.org/D13521
2021-12-11 01:02:11 +01:00
1a02c0d7dd Cleanup: Return early for null check 2021-12-10 16:42:34 -06:00
a8b730e04c Cleanup: Use const argument, rename variables
The const argument makes sense because these are the "source"
sockets, even though a const cast is necessary at one point.
The name "interface_socket" is an improvement over "stemp"
because the latter sounds like "temporary", or it confuses
the old socket template system with a node group's interface.
2021-12-10 14:54:32 -06:00
7c2fb00e66 Cleanup: Remove unnecessary runtime rectangle from nodes in DNA
I assume this `butr` rectangle was used more in the past,
but currently its value is set and used less than 10 lines apart,
so it's trivial to remove 16 bytes from every node. The other
rectangles are also runtime data and could be removed, but
they are more difficult.
2021-12-10 13:52:02 -06:00
5a3d5f751f Revert recent changes to ImBuf transform
This reverts commit 943aed0de3  and f76e04bf4d

The latter caused a test failure: `sequencer_render_transform`
Reverting since the fix is not obvious (to me), and people are
away for the weekend.
2021-12-10 12:55:36 -06:00
5ca38fd612 Cleanup/Docs: Add comments to Mesh header, rearrange fields
Most of the fields in Mesh had no comments, or outdated misleading
comments. For example, "BMESH ONLY" referred to the BMesh project,
not the data structure. Given how much these structs are used, it should
save a lot of time to have proper comments.

I also rearranged the fields in mesh to have a more logical order. Now
the most important fields come first. In the process I was able to
remove 19 bytes of unnecessary padding (31->12). I just had to
change a `short` flag to `char`.

Differential Revision: https://developer.blender.org/D13454
2021-12-10 10:42:28 -06:00
Moritz Röhrich
f886f29355 Fix T93591: Random Value node first and last value proportion
This patch replaces `round_fl_to_int` with `floor` and adjusts the
maximum value accordingly. The call to `round_fl_to_int` is problematic
here because it messes with the probability distribution at the edges
of the value range, meaning the first and last values were only half
as common as all other values. Since `round_fl_to_int` does
`floor(val + 0.5)`, it will not introduce misbehavior in edge cases.

Differential Revision: https://developer.blender.org/D13474
2021-12-10 09:34:30 -06:00
943aed0de3 ImBuf: Extracted UV Wrapping from the Interpolation functions.
Improvement of the IMB_transform function by separating the UVWrapping
method from the color interpolation function. This would allow us to
perform uv wrapping operations separate from the interpolation function.

Currently this wrapping is only supported when interpolating colors.
This change would allow us to perform it on non-color image buffers.
2021-12-10 16:14:36 +01:00
60a9703de8 Added support for large images to openexr. 2021-12-10 15:38:46 +01:00
05df6366a4 Added support for large texture to OCIO. 2021-12-10 15:38:25 +01:00
f76e04bf4d ImBuf: Use templating for IMB_transform.
Reduce the inner loop of IMB_transform by extracting writing to an
output buffer in a template. This reduces a branch in the inner loop and
would allow different number of channels in the future.
2021-12-10 15:19:41 +01:00
37e799e299 Fix crash using 32k images.
Use IMB_get_rect_len to solve overflow issues.
2021-12-10 12:28:48 +01:00
bd2b48e98d Cleanup: move public doc-strings into headers for various API's
Some doc-strings were skipped because of blank-lines between
the doc-string and the symbol and needed to be moved manually.

- Added space below non doc-string comments to make it clear
  these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.

Ref T92709
2021-12-10 21:42:06 +11:00
63f8d18c0f Cleanup: move public doc-strings into headers for 'python/intern'
Ref T92709
2021-12-10 21:40:53 +11:00
3060217d39 Cleanup: move public doc-strings into headers for 'nodes'
Ref T92709
2021-12-10 21:40:30 +11:00
715f57371b Cleanup: spelling in comments 2021-12-10 21:28:56 +11:00
b87b33adbf Cleanup: doxygen comments for node_geo_dual_mesh
- Indent text after dot-points.
- Use an unparsed code-block to display the text verbatim in doxygen.
2021-12-10 21:28:56 +11:00
fcf8fc3eaa Fix Crash: Loading Huge Images.
When loading huge images (30k) blender crashed with a buffer overflow.
The reason is that determine the length of a buffer was done in 32bit
precision and afterwards stored in 64 bit precision.

This patch adds a new function to do the correct calculation in 64bit.
It should be added to other sections in blender as well. But that should
be tested on a per case situation.
2021-12-10 10:37:46 +01:00
William Leeson
57f46b9d5f Fix T92036: Magic Texture in Volumetric World Shaders render differently with the CPU and GPU
When rendering volume surfaces in unbounded worlds the volume stepping can produce large values. If used with a magic texture node the values can results in a Inf float which when used in a sin or cos produces a NaN.

To fix this the input values are mapped into the periodic range of the sin and cos functions (-2*PI 2*PI) this stops the possibility of a Inf occurring and thus the NaN. It also improves the accuracy and smoothness of the result due to loss of precision when large values are summed with smaller ones effectively removing the parts of the smaller number (i.e. those in the -2PI to 2PI range) that result in variation of the output of sin and cos.

Reviewed By: brecht

Maniphest Tasks: T92036

Differential Revision: https://developer.blender.org/D12821
2021-12-10 09:09:20 +01:00
566a458950 Cleanup: move public doc-strings into headers for 'depsgraph'
- Added space below non doc-string comments to make it clear
  these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.

Ref T92709
2021-12-10 12:19:36 +11:00
dffd032bc9 Geometry Nodes: Remove unnecessary copy when replacing data
In the `replace_mesh`/`replace_curve` etc. methods, the component
was retrieved with write access. Retrieving with write access will
duplicate the data if the component has another user. This means that
the replaced geometry data was often duplicated just to be deleted
a moment later.

I expect this would have a large impact in performance in some specific
situations when dealing with large geometry. In a scene with many small
meshes though, I didn't observe a significant difference.

This also makes replacing a geometry set's data with the same data
that's already in the set safe. It would be valid to assert for that
case instead, but this seems safer.

Differential Revision: https://developer.blender.org/D13530
2021-12-09 17:43:30 -06:00
18412744c8 Fix T93687: Transform Gpencil vertices not working if scale is zero
Solution similar to rBd5cefc1844cf.

Basically the problem occurs because `td->smtx` was set to zero matrix.
2021-12-09 18:17:23 -03:00
74a566d211 Cleanup: Return early in null check
I'm planning to make these functions slightly more complicated,
and it makes sense to return early when checking one of the parameters
for null anyway.
2021-12-09 14:34:15 -06:00
Andrii
b8f41825e8 Fix Cycles wrong adaptive sampling render when using sample offset
Sample offset was not accounted for in the adaptive sampling code and caused
issues, like immediately applied adaptive filtering, with non-zero values.

Differential Revision: https://developer.blender.org/D13510
2021-12-09 20:54:41 +01:00
Andrii
dbd64a5592 Cycles: support merging images rendered with adaptive sampling
This patch adds support for merging images rendered with adaptive sampling to
the merge operator (which is currently only exposed in the Python API).

To do this an sample count buffer is created for each render layer from the
sample count pass if it exists, or from the metadata otherwise. This is then
used for averaging passes.

Differential Revision: https://developer.blender.org/D13457
2021-12-09 20:52:46 +01:00
Andrii
20987b0f29 Cleanup: use more modern C++ in Cycles merge operator
Use structured binding and for-each loop, remove reduntant type casts, use
find_if instead of loop.

Differential Revision: https://developer.blender.org/D13456
2021-12-09 20:52:46 +01:00
bd3bd776c8 Geometry Nodes: Scene Time Node
This node outputs the current scene time in seconds or in frames.
Use of this node eliminates the need to use drivers to control values
in the node tree that are driven by the scene time.
Frame is a float value to provide for subframe rendering for motion
blur.

Differential Revision: https://developer.blender.org/D13455
2021-12-09 11:50:25 -06:00
ad44f22397 Fix T93498: Cycles fast GI add method affected by bounces settings
This is only for the replace method.
2021-12-09 18:17:48 +01:00
4b00a779ec Fix T93890: Cycles error with shadow catcher + OptiX denoise without passes 2021-12-09 18:01:26 +01:00
56fa6f58a0 Fix T93874: Cycles crash with fast GI approximation 2021-12-09 17:46:21 +01:00
e427e4dbb1 Fix T93871: Image.has_data returns True for images that failed to load 2021-12-09 17:36:19 +01:00
fc14d02bc5 Fix T93892: Changing bone name leaves non-functional vertex group
The corresponding vertex group was renamed properly, but the armature
influence was broken for that bone.

Caused by {rB3b6ee8cee708}.

Since above commit, vertex group names are stored on object data (mesh/
lattice/gpencil) and if we update these, we have to inform dependency
graph to have immediate effect.

Maniphest Tasks: T93892

Differential Revision: https://developer.blender.org/D13526
2021-12-09 16:47:06 +01:00
5ce1c63e1b Fix T93691: Crash when loading custom thumbnail in custom library
This was an issue with the mixed list of external assets and assets from
the current file. When closing the File Browser to select the custom
preview image, the assets from the current file would be cleared for
reread, to make sure we display up-to-date file data. That is because
the workspace of the temporary File Browser was deleted, causing a
change in the file data (main data-base). The reread would happen in a
background thread, meaning it might not finish before the custom preview
operator runs and queries the active asset. So the preview operator
would get the wrong active asset from context.

Two fixes were needed:
* Make sure current file data is reread before the operator runs, by
  doing this partial rereading on the main thread.
* Ensure the asset list (in fact file list) order stays consistent over
  rereads. If multiple assets with the same name were shown, the
  operator might also have gotten the wrong asset, also leading to a
  crash.

Additionally the file operation handler should probably poll before
executing, to fail gracefully at least (not crash).
2021-12-09 15:51:00 +01:00
74fa4ee92b Fix (unreported): missing null check
A crash happened when `instance_id_attribute` further down in the
function was null. This issue was probably introduced when the
id attribute starting using generic attribute handling.
2021-12-09 13:54:47 +01:00
d812e46f40 Cleanup: move public doc-strings into headers for 'io/usd'
Ref T92709
2021-12-09 22:47:58 +11:00
74e57efb2d Cleanup: move public doc-strings into headers for 'io/alembic'
Ref T92709
2021-12-09 22:37:24 +11:00
69f55b1b62 Cleanup: Various cleanups to the tree-view API
* Correct URL for documentation (was changed recently).
* Add comments.
* Reevaluate and update which functions are public, protected or
  private.
* Reorder functions and classes to be more logical and readable.
* Add helper class for the public item API so individual functions it
  uses can be made protected/private (the helper class is a friend).
  Also allows splitting API implementation from the C-API.
* Move internal layout builder helper class to the source file, out of
  the header.
* More consistent naming.
* Add alias for item-container, so it's more clear how it can be used.
* Use const.
* Remove unnecessary forward declaration.
2021-12-09 12:35:15 +01:00
9183f9f860 Cleanup/Documentation: Add/move comments for asset files
Adds some basic high-level explanations for editor/UI level asset APIs.
Also moves one such comment from the source file to the header file,
so it's in the same file as other API comments.
2021-12-09 12:35:15 +01:00
50f378e5c8 Cleanup: move public doc-strings into headers for 'io/collada'
Ref T92709
2021-12-09 22:25:45 +11:00
973dac9b5f Cleanup: use doxy section for itasc_plugin
It wasn't obvious all callbacks were part of the plugin-API.
2021-12-09 21:19:46 +11:00
7f4878ac7f Cleanup: move public doc-strings into headers for 'functions'
Ref T92709
2021-12-09 21:17:16 +11:00
Azeem Bande-Ali
b8bad3549d Fix T93519: handle prefix names in autocompletes
Autocomplete entires keep track of the length of the prefix
in `name_prefix_offset`. However, the name matching logic
was comparing the string including the prefix which resulted
in tab-completion not working (when the user didn't also type
in the prefix, typically two whitespaces).

This is fixed by passing in a char pointer after the end of
the prefix.

Additionally, some searchbox logic is moved. Previously,
`ui_searchbox_apply` would clear the entry which would mean
that `ui_searchbox_find_index` would never succeed. Now the
search box is only cleared if no match was found.

Differential Revision: https://developer.blender.org/D13483
2021-12-09 11:15:19 +01:00
65de17ece4 Cleanup: move public doc-strings into headers for 'freestyle'
Ref T92709
2021-12-09 21:09:54 +11:00
bc01003673 Cleanup: move public doc-strings into headers for 'nodes/geometry'
Ref T92709
2021-12-09 20:58:39 +11:00
cd4a7be5b2 Cleanup: move public doc-strings into headers for 'io/gpencil'
Ref T92709
2021-12-09 20:34:14 +11:00
3647a1e621 Cleanup: move public doc-strings into headers for 'geometry'
Ref T92709
2021-12-09 20:23:10 +11:00
8ef8f3a60a Cleanup: spelling in comments 2021-12-09 20:21:26 +11:00
15a428eab0 Cleanup: move public doc-strings into headers for 'gpencil_modifiers'
Removed doc-strings for operator definitions as they didn't provide
useful information in addition to the operators own description.

Ref T92709
2021-12-09 20:11:29 +11:00
8aed5dbcf8 Cleanup: move public doc-strings into headers for 'compositor'
Ref T92709
2021-12-09 20:01:49 +11:00
7c76bdca1b Cleanup: move public doc-strings into headers for 'gpu'
Ref T92709
2021-12-09 20:01:47 +11:00
9f546d6908 Cleanup: move public doc-strings into headers for 'imbuf'
Ref T92709
2021-12-09 20:01:45 +11:00
9e365069af Cleanup: move public doc-strings into headers for 'blenlib'
- Added space below non doc-string comments to make it clear
  these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.
- Minor improvements to doc-strings.

Ref T92709
2021-12-09 20:01:44 +11:00
Alaska
d8b4275162 Cycles-X: Add hysteresis to resolution divider algorithm
Adds hysteresis to the resolution divider algorithm to avoid having the resolution bounce around when on the boundary of two resolutions.

Reviewed By: brecht, leesonw

Differential Revision: https://developer.blender.org/D12385
2021-12-09 09:18:47 +01:00
894269ad12 Fix incorrect copying of XR action map items
After using MEM_dupallocN() on the original item, the bindings ListBase
for the new item needs to be cleared and each binding copied separately.
2021-12-09 16:29:05 +09:00
30cebf5747 Cleanup: Remove empty node button layout function
Was unused since the first commit:
rB658b4c0d56dffbcf1476c2a2a019fa0ecfb79376
2021-12-08 22:02:45 -05:00
cf6be711e2 Fix T93869: snap cursor may fail in orthographic view
Float precision issues cause the `ED_view3d_win_to_3d_on_plane` to return
a value even when the view ray is parallel to the plane.

A more general solution might be desired in this case, as other areas that
use `ED_view3d_win_to_3d_on_plane` might have the same problem.

For now, just work around the problem for the snap cursor.
2021-12-08 23:47:26 -03:00
3753a0b72b Fix T93523: Memory leak in Menu Search
Fixes a memory leak introduced by D13225.
Caused by not freeing the hash-map in some cases.

Differential Revision: https://developer.blender.org/D13432
2021-12-09 01:48:11 +01:00
be2213472f Fix T93858: Zstd-compressed .blend files from external tools aren't recognized
The issue here was that after the seek table check, the underlying file wasn't
rewound to the start, so the code that checks for the BLENDER header
immediately reaches EOF and fails.

Since Blender always writes files with a seek table, this bug isn't triggered
by files saved in Blender itself. However, files compressed in external tools
generally don't have a seek table.
2021-12-08 23:35:47 +01:00
f32b63ec58 Fix T93642: value used as transform offset is ignored in some modes
If a transform operator is executed as modal and has a "value" set, that value works as an offset.

However few transform modes were supporting this.

Include more transform modes as supported.
2021-12-08 14:21:57 -03:00
6ebc581b52 Cleanup: Avoid lookup the same property string multiple times
This is a micro-optimization that is useful for operators with many properties.
2021-12-08 14:21:57 -03:00
069d63561a Geometry Nodes: Mesh Island Node
This node is a field input that outputs a separate index for each mesh island.
The indices are based on the order of the lowest-numbered vertex in each island.

Authoring help from @hooglyboogly

Differential Revision: https://developer.blender.org/D13504
2021-12-08 10:14:03 -06:00
72b39d3f92 Fix T93728: Greasepencil separate will loose all vertex groups
Caused by {rB3b6ee8cee708}

The raw data is copied here correctly
[`BKE_gpencil_stroke_weights_duplicate` in
`BKE_gpencil_stroke_duplicate`] but the vertex groups names are missing.
Prior to above commit is was enough to have `ED_object_add_duplicate`
(this seemingly took care of duplicating object's defbase).
Now vertex groups names sit on the `bGPdata` rather than the `Object`,
and since the separate operation creates **new** `bGPdata` we have to
copy vertex groups names - and active index - over [via
`BKE_defgroup_copy_list`].

Maniphest Tasks: T93728

Differential Revision: https://developer.blender.org/D13509
2021-12-08 16:10:07 +01:00
e23b54a59f Cycles: Fix OS version warnings
This patch suppresses OS version warnings and hides currently unsupported Metal GPUs when enumerating devices.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13506
2021-12-08 15:08:12 +00:00
Campbell Barton
5e9dba822d Cleanup: Avoid error prone pointer storage in SnapObjectParams
eed48a7322 caused the `SnapObjectParams` to be stored in the `SnapObjectContext`.

As this pointer is always passing in stack memory, so it seems error prone to keep a reference to this in `SnapObjectContext` since failure to set this will reference undefined stack memory.

So avoid this by moving params out of `SnapObjectContext`.

Differential Revision: https://developer.blender.org/D13401
2021-12-08 12:05:36 -03:00
98bb8e6955 Fix T91680: viewport selection broken in macOS x86 build with Xcode 13
There is an apparent compiler bug here, tweak the code to avoid it. This did
not affect official builds as we were still using Xcode 12.
2021-12-08 15:46:15 +01:00
5b06759473 Cleanup: Use float2 for node view functions
Though the interfacing with `rctf` becomes slightly more complicated,
this should be more helpful as more of this code usese `float2` instead
of two separate floats.
2021-12-08 09:44:02 -05:00
61776befc3 Cleanup: move public doc-strings into headers for 'editors'
Ref T92709
2021-12-09 01:14:10 +11:00
8f1997975d ImBuf: Performance IMB_transform.
This change uses generics to reduce code duplication an increases
flexibility and performance. Performance increase isn't measurable
for end users.
2021-12-08 13:02:55 +01:00
32b1a13fa1 Cleanup: move public doc-strings into headers for 'sequencer'
Ref T92709
2021-12-08 21:05:06 +11:00
e89d42ddff Cleanup: move public doc-strings into headers for 'draw'
Ref T92709
2021-12-08 20:30:05 +11:00
a46ff1dd38 Cleanup: move public doc-strings into headers for 'shader_fx'
Ref T92709
2021-12-08 20:30:05 +11:00
2c0ccb0159 Cleanup: move public doc-strings into headers for 'simulation'
Ref T92709
2021-12-08 20:30:05 +11:00
07726ef1b6 Cleanup: move public doc-strings into headers for 'blentranslation'
Ref T92709
2021-12-08 20:30:05 +11:00
ca0c9757f2 Cleanup: moved IMB_transform to transform.cc.
Part of a refactoring to make IMB_transform more generic to reduce
unneeded branching.
2021-12-08 09:54:52 +01:00
a7b64a714d Cleanup: Silence clang-tidy warnings. 2021-12-08 09:52:38 +01:00
4f48b2992b Cleanup: move public doc-strings into headers for 'blenloader'
Ref T92709
2021-12-08 17:51:45 +11:00
93ba5e2375 Cleanup: move public doc-strings into headers for 'render'
Ref T92709
2021-12-08 17:12:43 +11:00
7e92717439 Cleanup: move public doc-strings into headers for 'windowmanager'
Ref T92709
2021-12-08 17:12:41 +11:00
db795a4727 Cleanup: move public doc-strings into headers for 'makesrna'
Ref T92709
2021-12-08 17:12:40 +11:00
da67a19ed9 Cleanup: move public doc-strings into headers for 'makesdna'
Ref T92709
2021-12-08 17:12:39 +11:00
2545119112 Cleanup: move public doc-strings into headers for 'blendthumb'
Ref T92709
2021-12-08 17:12:37 +11:00
d6c3ea9e7a Cleanup: move public doc-strings into headers for 'blenfont'
Ref T92709
2021-12-08 17:12:35 +11:00
00f3957b8e Cleanup: move public doc-strings into headers for 'modifiers'
Ref T92709
2021-12-08 17:12:33 +11:00
c1279768a7 Cleanup: Clang-Tidy modernize-redundant-void-arg 2021-12-08 00:31:20 -05:00
cbcd74de22 Cleanup: Missing braces in array declaration 2021-12-08 00:30:36 -05:00
b71e29b3da Cleanup: clang-format 2021-12-07 23:12:13 -05:00
47b36ddcce Cleanup: Nodes: clang-tidy modernize-redundant-void-arg 2021-12-07 23:09:19 -05:00
2964c4e1d0 Cleanup: spelling in comments 2021-12-08 13:31:19 +11:00
333dc7b5c4 Nodes: Add Shader Socket to new decleration API
This commit adds the shader socket type to the new socket builder api.

Re commits part of rB0bd3cad04edf4bf9b9d3b1353f955534aa5e6740
2021-12-07 21:05:13 -05:00
0d8c479225 Shader Nodes: Use camel case for file names
Recommits part of rBf60b95b5320f8d6abe6a629fe8fc4f1b94d0d91c
2021-12-07 20:57:25 -05:00
1552c92fb1 Cycles: Fix Metal BVH crash caused by missing WITH_METAL define
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13505
2021-12-07 21:23:52 +00:00
5568455d63 Cleanup: Extend a few comments in BKE_spline.hh 2021-12-07 15:17:10 -05:00
204ae33d75 Revert "Fix T93350: Cycles renders shows black during rendering huge resolutions"
This reverts commit 5e37f70307.

It is leading to freezing of the entire desktop for a few seconds when stopping
3D viewport rendering on my Linux / NVIDIA system.
2021-12-07 20:49:34 +01:00
b815088416 Tests: add Cycles perspective/ortho/panoramic camera regression tests
Ref D12691
2021-12-07 20:08:12 +01:00
Håkan Ardö
24e0165463 Cycles: add Fisheye Lens Polynomial camera model
This allows real world cameras to be modeled by specifying the coordinates of a
4th degree polynomial that relates a pixels distance (in mm) from the optical
center on the sensor to the angle (in radians) of the world ray that is
projected onto that pixel.

This is available as part of the panoramic lens type, however it can also be
used to model lens distortions in projective cameras for example.

Differential Revision: https://developer.blender.org/D12691
2021-12-07 20:05:57 +01:00
205254150a Build: don't look for CUDA toolkit if not using Cycles CUDA device 2021-12-07 19:52:54 +01:00
763cd2e0be Cleanup: fix compiler warning 2021-12-07 19:52:54 +01:00
5bd41b2e25 Shader Nodes: Create a new bf_nodes_shader library
Re commits rBf72cc47d8edf849af98e196f721022bacf86a5e7 but without the unity build
2021-12-07 13:20:22 -05:00
63bd356faf Cleanup: Missing include
This included is needed for the `ATTR_NONNULL` macro used in the header.
As found in a recent c --> c++ if the includes get ordered in a different order
this could result in an error.

Re commits rBc20098e6ec6adee874a12e510aa4a56d89f92838
2021-12-07 13:20:22 -05:00
b9641cfc37 Cleanup: clang-tidy: modernize-redundant-void-arg
Re commits part of rB0578921063fbb081239439062215f2538a31af4b
2021-12-07 13:20:22 -05:00
7fbb767259 Docs: Add more comments to geometry set header
This adds a bit more information to `GeometrySet` and each of the
geometry components. There is probably still more that can be written,
but this includes the most important information that I could think of.

I'd like to include some more general information about the
attribute API in a separate patch.

Differential Revision: https://developer.blender.org/D13501
2021-12-07 13:04:32 -05:00
Sergey Sharybin
5e37f70307 Fix T93350: Cycles renders shows black during rendering huge resolutions
The root of the issue is caused by Cycles ignoring OpenGL limitation on
the maximum resolution of textures: Cycles was allocating texture of the
final render resolution. It was exceeding limitation on certain GPUs and
driver.

The idea is simple: use multiple textures for the display, each of which
will fit into OpenGL limitations.

There is some code which allows the display driver to know when to start
the new tile. Also added some code to allow force graphics interop to be
re-created. The latter one ended up not used in the final version of the
patch, but it might be helpful for other drivers implementation.

The tile size is limited to 8K now as it is the safest size for textures
on many GPUs and OpenGL drivers.

Differential Revision: https://developer.blender.org/D13385
2021-12-07 19:01:42 +01:00
Mikhail Matrosov
a92805bf24 Fix T93418: Cycles shadow terminator Geometry Offset artifacts with translucency
Differential Revision: https://developer.blender.org/D13468
2021-12-07 19:01:39 +01:00
484714992c Build: remove Cycles CUDA/HIP/OPTIX build options on macOS
So those device types are not listed in the preferences. Metal will be
added instead as the only option.
2021-12-07 19:01:39 +01:00
13af88b23f Build: clean up handling of some Cycles build options
* Don't link embree / OSL when WITH_CYCLES is disabled
* Simplify lite config by disabling Cycles as a whole using this
* Remove code handling the removed WITH_CYCLES_NETWORK option
2021-12-07 19:01:39 +01:00
e14f8c2dd7 Cycles: Reintroduce device-only memory handling that got lost in Cycles X merge
Somehow only a part of rBf4f8b6dde32b0438e0b97a6d8ebeb89802987127 ended up in
Cycles X, causing the issue that commit fixed, "OPTIX_ERROR_INVALID_VALUE" when the
system is out of memory, to show up again.
This adds the missing changes to fix that problem.

Maniphest Tasks: T93620

Differential Revision: https://developer.blender.org/D13488
2021-12-07 18:50:10 +01:00
a37dac0a88 Cycles: add Metal device type to device_type_for_description
Add a `DEVICE_METAL` case to the enum-value-to-string mapping function.
2021-12-07 17:47:35 +01:00
fee4b58627 Cycles: fix build on non-Apple systems
Skip compiling `metal.mm` unless `WITH_CYCLES_DEVICE_METAL` is enabled.
2021-12-07 17:46:52 +01:00
c4cee2e221 Geometry Nodes: Edge Neighbors Node
Creates a new Edge Neighbors node which outputs a field
containing the number of faces connected to each edge.

Differential Revision: https://developer.blender.org/D13493
2021-12-07 10:07:24 -06:00
9558fa5196 Cycles: Metal host-side code
This patch adds the Metal host-side code:

- Add all core host-side Metal backend files (device_impl, queue, etc)
- Add MetalRT BVH setup files
- Integrate with Cycles device enumeration code
- Revive `path_source_replace_includes` in util/path (required for MSL compilation)

This patch also includes a couple of small kernel-side fixes:

- Add an implementation of `lgammaf` for Metal [Nemes, Gergő (2010), "New asymptotic expansion for the Gamma function", Archiv der Mathematik](https://users.renyi.hu/~gergonemes/)
- include "work_stealing.h" inside the Metal context class because it accesses state now

Ref T92212

Reviewed By: brecht

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D13423
2021-12-07 15:52:21 +00:00
565b33c0ad Geometry Nodes: new Geometry to Instance node
This adds a new Geometry to Instance node that turns every
connected input geometry into an instance. Those instances
can for example be used in the Instance on Points node.

Differential Revision: https://developer.blender.org/D13500
2021-12-07 15:37:12 +01:00
a8e0fe6a54 Geometry Nodes: move type conversions to blenkernel
The type conversions do not depend on other files in the nodes
module. Furthermore we want to use the conversions in the
geometry module without creating a dependency to the
nodes module there.
2021-12-07 15:22:08 +01:00
2309fa20af Cleanup: Add macro and functions for node storage
The `node_storage` functions to retrieve const and mutable structs
from a node are generated by a short macro that can be placed at the
top of each relevant file. I use this in D8286 to make code snippets
in the socket declarations much shorter, but I thought it would be
good to use it consistently everywhere else too.

The functions are also useful to avoid copy and paste errors,
like the one corrected in the cylinder node in this commit.

Differential Revision: https://developer.blender.org/D13491
2021-12-07 09:09:30 -05:00
Yuchen Wen
6a9775ec6f Fix T93467: Use world bg color for pose library previews
Use the World viewport color when rendering pose library previews.

The World's viewport color is chosen instead of the World shading nodes,
as the latter would require rendering with `OB_RENDER` (instead of
`OB_SOLID`), which would take considerably longer.

Manifest Task: T93467

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D13470
2021-12-07 14:25:00 +01:00
0f48b37aae Revert moving all shader nodes to c++
This reverts to following commits:
* rB5cad004d716da02f511bd34983ac7da820308676
* rB97e3a2d935ba9b21b127eda7ca104d4bcf4e48bd
* rBf60b95b5320f8d6abe6a629fe8fc4f1b94d0d91c
* rB0bd3cad04edf4bf9b9d3b1353f955534aa5e6740
* rBf72cc47d8edf849af98e196f721022bacf86a5e7
* rB3f7014ecc9d523997062eadd62888af5fc70a2b6
* rB0578921063fbb081239439062215f2538a31af4b
* rBc20098e6ec6adee874a12e510aa4a56d89f92838
* rBd5efda72f501ad95679d7ac554086a1fb18c1ac0

The original move to c++ that the other commits depended upon had some issues
that should be fixed before committing it again. The issues were reported in
T93797, T93809 and T93798.

We should also find a better rule for not using c-style casts going forward,
although that wouldn't have been reason enough to revert the commits.
Introducing something like a `MEM_new<T>` and `MEM_delete<T>`
function might help with the the most common case of casting the return
type of `MEM_malloc`.

Going forward, I recommend first committing the changes that don't
require converting files to c++. Then convert the shading node files
in smaller chunks. Especially don't mix fairly low risk changes like
moving some simple nodes, with higher risk changes.
2021-12-07 13:26:39 +01:00
ae5a89e80a Fix T93797, T93809: Crash/undefined-behavior when opening demo file
Error in d5efda72f5. Was changing an iteration that would free items
to an iterator that is not safe for use in such cases.

There still seem to be significant issues with the rendering, but that's
a separate issue to be fixed.
2021-12-07 12:03:10 +01:00
4312cb8545 Fix memory leak when loading large asset libraries 2021-12-07 11:47:06 +01:00
cd494087c1 Fix crash when switching back from render preview.
Issue is that external engine uses the gpu info. but overwrote the
instance data. The draw manager would then detect instance data and
required the engine type to have a instance free callback.

The solution is to save some space in the engine data to hold an empty
and unused instance_data attribute to comply with `ViewportEngineData`
struct.
2021-12-07 11:30:50 +01:00
Jeroen Bakker
b069218a55 DrawManager: Engine Instance Data.
In the original design draw engines had to copy with a limitation that
they were not allowed to reuse complex data structures between drawing
calls. Data that could be reused were limited to:
- GPUFramebuffers
- GPUTextures
- Memory that could be removed calling MEM_freeN (storage list)
- DRWPass

This is fine when the storage list contains arrays or structs but when
more complex data types (vectors, maps) etc wasn't possible.

This patch adds instance_data that can be reused between drawing calls.
The instance_data is controlled by the draw engine and doesn't need to
be limited as described above.

When an engines stores instance_data it must implement the
`DrawEngineType.instance_free` callback to free the data.

The patch originates from eevee rewrite. But was added to master as the
image engine rewrite also has a need for it.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13425
2021-12-07 10:34:38 +01:00
Jeroen Bakker
e2f0b4a0cb Cleanup: Use rcti marking dirty regions when texture painting.
Dirty regions when painting are not using rcti. Meaning less
understandable code. Found issue when refactoring the image_gpu partial
update. In a future change gpu partial update API will be using rcti
also what makes the code even cleaner.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D13260
2021-12-07 10:33:23 +01:00
1de3636624 Cleanup: note that functions in BKE_node.h aren't part of blenkernel 2021-12-07 18:55:57 +11:00
512a560cde Cleanup: remove BKE_ptcache_remove
No longer needed as the temporary directory is cleared on exit.
2021-12-07 18:47:01 +11:00
a55d318d71 Cleanup: sort DNA renaming
Add note at the beginning & end so it's not overlooked.
2021-12-07 18:44:28 +11:00
c6a200c693 Cleanup: clang-format 2021-12-07 18:39:16 +11:00
1e7ef83e46 Cleanup: clarify source/destination args for BKE_spacedata_copylist 2021-12-07 18:26:35 +11:00
a37a6fb445 Cleanup: remove incorrect/unhelpful comments 2021-12-07 18:23:57 +11:00
6483dee141 Cleanup: replace int with bool type 2021-12-07 18:15:15 +11:00
ffc4c126f5 Cleanup: move public doc-strings into headers for 'blenkernel'
- Added space below non doc-string comments to make it clear
  these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.
- Minor improvements to doc-strings.

Ref T92709
2021-12-07 17:38:48 +11:00
luzpaz
f159d49f56 Cleanup: Fix various source typos
This is a continuation of D13462 to clean up source typos.

Differential Revision: https://developer.blender.org/D13471
2021-12-06 22:39:52 -05:00
luzpaz
92dae5775f Cleanup: Fix typos in source code
Source typos corrected

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D13462
2021-12-06 22:23:17 -05:00
50fb0fd636 Docs: Incorrect link to context type
Fixes T93773
2021-12-06 22:07:38 -05:00
5cad004d71 Cleanup: clang format 2021-12-06 18:52:08 -05:00
97e3a2d935 Shader Nodes: Migrate shader category to new node socket declaration API
No functional changes, tests passed and I double checked the nodes by hand.
2021-12-06 18:52:08 -05:00
Christoph Lendenfeld
b1696702cd Fix: Remove line from common invoke
The line that sets the factor_prop in graph_slider_ops.c
has been left in the common invoke function by accident.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D13477
Ref: D13477
2021-12-06 22:27:04 +00:00
Christoph Lendenfeld
ae6f3056fc Cleanup: renames in graph_slider_ops
rename percentage_prop to factor_prop
rename remove_ratio to factor
remove "graphkeys" prefix from functions

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D13476
Ref: D13476
2021-12-06 22:19:00 +00:00
78ae587649 Cleanup: Use C++ types for multi input socket sorting
The algorithm used is still quite inefficient, but at least the code
is easier to read and a little bit simpler now.
2021-12-06 17:12:46 -05:00
aa23e870ec Cleanup: Remove unused includes 2021-12-06 16:50:44 -05:00
01779970c2 Cleanup: Remove unused node flag 2021-12-06 16:35:38 -05:00
b91ac86cfc Cleanup: Remove unnecessary generic includes from headers 2021-12-06 16:04:14 -05:00
5705db5bb3 Fix: Compile error in field input
Instead of essentially hashing a bool, just use a ternary operator.

Differential Revision: https://developer.blender.org/D13494
2021-12-06 15:47:09 -05:00
0ed254574f macOS: Fix build error in hash functions
Remove unneeded recent static_cast attempt.

Reviewed By: HooglyBoogly
Differential Revision: https://developer.blender.org/D13492
2021-12-07 01:38:14 +05:30
Aaron Carlisle
f60b95b532 Shader Nodes: Split each node into own file
This improves both code finding,  for example "color ramp" now has its own file.
And now each node has its own namespace so function names can be simplified
similar to rBfab39440e94

This commit also makes all file names use snake case instead of camel case.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13482
2021-12-06 14:47:49 -05:00
c3c69fee09 Cleanup: Fix warnings about copied Map loop variables
The `Map::items()` iterator does not return references.
2021-12-06 13:49:37 -05:00
86d520f268 Fix: Attempt to fix build error on macOS 2021-12-06 13:47:53 -05:00
Aaron Carlisle
9792994311 Nodes: Add function to set compact socket flag for vectors
This flag is currently only used for vector sockets
so the function is limited to the vector builder.

The flag is only used by two shader nodes at the moment
and this is needed to port them over to the new socket declaration API.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13490
2021-12-06 13:40:02 -05:00
2d4c7fa896 Geometry Nodes: reduce code duplication with new GeometyrFieldInput
Most of our field inputs are currently specific to geometry. This patch introduces
a new `GeometryFieldInput` that reduces the overhead of adding new geometry
field input.

Differential Revision: https://developer.blender.org/D13489
2021-12-06 19:13:24 +01:00
2814740f5b Geometry Nodes: 4 Field Inputs for Mesh Topology Data
Creates 4 new nodes which provide topology information
for the mesh. Values are interpolated from the primary
domain in each case using basic attribute interpolation.

Vertex Neighbors
  - Vertex Count
  - Face Count
Face Neighbors
  - Vertex Count
  - Neighboring Face Count
Edge Vertices
  - Vertex Index 1
  - Vertex Index 2
  - Position 1
  - Position 2
Face Area
  - Face Area

Differential Revision: https://developer.blender.org/D13343
2021-12-06 11:58:08 -06:00
ee4ed99866 Fix T93521: Single point NURBS crash in resample node
The resample node didn't handle the case of when a spline didn't have
any evaluated points. For poly and Bezier splines we should never hit
this case, but it is expected when the number of NURBS control points
is smaller than its order, so we have to handle the case here.

It's not that obvious what to do in this case, there are a few options:
 - Remove the bad splines from the result
 - Generate empty splines for those inputs
 - Skip resampling the bad splines, copy them to the result
 - Arbitrarily generate single point splines

I chose option three, just skipping the "bad" splines. Since the node
already has a selection input, this can be described by just extending
that. "Splines with no evaluated points are implicitly deselected."
The first option would probably be valid too though.

Differential Revision: https://developer.blender.org/D13434
2021-12-06 12:19:27 -05:00
Aaron Carlisle
0bd3cad04e Nodes: Add Shader Socket to new decleration API
This commit adds the shader socket type to the new socket builder api.

As a test, this commit also converts the Add Shader node to the new API

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13485
2021-12-06 11:59:52 -05:00
Aaron Carlisle
f72cc47d8e Shader Nodes: Unity Build
- Create a new `bf_nodes_shader` library
- Enable unity builds for  `bf_nodes_shader`, gives abount a 2.7x speed up for compile times

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13484
2021-12-06 11:47:45 -05:00
0c703b856b Disable asset indexing in the Asset List
Asset indexing should be disabled, but this was overlooked in the
asset list (used for the pose library in the 3D View).
2021-12-06 17:42:16 +01:00
86992a96b8 Asset Indexer: use fixed-length string for ID code
Use fixed-length string to convert `char[2]` to `std::string`. Otherwise
`strlen()` is called, which is problematic as the `char[2]` is not
zero-terminated.
2021-12-06 17:42:16 +01:00
c2292b2cd6 Cleanup: remove unnecessary extern template implementations
This technique isn't really necessary anymore, because unity builds
avoid instantiating the same template too many times already.
2021-12-06 17:31:42 +01:00
7d1a10a9bb Fix T93314: Thumbnails not drawn with default scale
Decrease threshold for drawing thumbnails.

This was unintended change in daaa43232d that was overlooked.
2021-12-06 17:01:51 +01:00
a5e3899853 VSE: Fix strip with mask modifier not blending
Set `ibuf->planes` to `R_IMF_PLANES_RGBA` because mask modifier adds
transparent areas to image.
2021-12-06 17:01:51 +01:00
Aurelien Jarno
477631d9ec cmake: fix linking with WITH_X11_XF86VMODE and bfd
Fix typos in the variables of the Xxf86vm libray to fix link failure
with bfd. These variables are defined in platform_unix.cmake.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D12911
2021-12-06 16:46:23 +01:00
b9c6ef4e8f Fix T93707: Dragging the tweaked NLA strip causes crash
Earlier code assumed that the active strip was on the active track. This
commit detects when this assumption doesn't hold, and adds a more thorough
search of the active strip.
2021-12-06 15:50:21 +01:00
0e52af097f Fix T93611: Curve modifier crash in editmode in certain situations
Caused by {rB3b6ee8cee708}

Above commit was trying to get the vertexgroup from the mesh that is
passed into `deformVertsEM` (but that can be NULL).
When can it be NULL, when is is non-NULL?
`editbmesh_calc_modifiers` only passes in a non-NULL mesh to
`deformVertsEM` under certain conditions:
- a non-deform-only modifier is handled currently
- a non-deform-only modifier preceeds the current modifier
- a deform-only modifier preceeds the current modifier (and the current
one depends on normals)

So the passed-in mesh cannot be relied on, now get the vertex group from
the context object data (like it was before the culprit commit).

Related commit: rB8f22feefbc20

Maniphest Tasks: T93611

Differential Revision: https://developer.blender.org/D13487
2021-12-06 15:20:30 +01:00
989d510e3e Cleanup: remove some temp dev asserts in new link/append code.
No longer needed now that all code uses that new
BKE_blendfile_link_append module, and that instantiation code in
BLO_readfile has been removed.
2021-12-06 11:29:27 +01:00
9a69c456bd Fix T93388: dropping object on grid in orthogonal view misses the floor plane
`ED_view3d_win_to_3d_on_plane` does not use the `clip_start` and
`clip_end` values of the scene, so the `do_clip` option can be misleading
especially in the orthographic view where the `clip_start` is negative.

For now, don't use the `do_clip` option in orthographic view.
2021-12-05 23:40:43 -03:00
3d8dea9ff9 Fix T93732: Snap Cursor not working after changing Add Object settings
`g_data_intern.state_default.gzgrp_type` is a very specific member and
cannot be set to default.
2021-12-05 23:40:43 -03:00
Aaron Carlisle
3f7014ecc9 Shader Nodes: Declare nodes in their own namespace
Follow up on rB1df8abff257030ba79bc23dc321f35494f4d91c5

This puts all static functions in geometry node files into a new
namespace. This allows using unity build which can improve
compile times significantly

- The namespace name is derived from the file name.
  That makes it possible to write some tooling that checks the names later on.
  The filename extension (cc) is added to the namespace name as well.
  This also possibly simplifies tooling but also makes it more obvious that this namespace is specific to a file.
- In the register function of every node, I added a namespace alias namespace `file_ns = blender::nodes::node_shader_*_cc`;.
  This avoids some duplication of the file name and may also simplify tooling, because this line is easy to detect.
  The name `file_ns` stands for "file namespace" and also indicates that this namespace corresponds to the current file.

In the future some nodes will be split up to separate files and given their own namespace
This will allow function names to be simplified similar to rBfab39440e94

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13480
2021-12-05 17:47:33 -05:00
0a8a22fc04 Cleanup: Remove unused next and prev pointers in bNodeType 2021-12-05 17:15:21 -05:00
9a312ba192 Cleanup: Remove unnecesary node type draw callback
As a followup to 338c1060d5, apply the same change to the node
drawing callback. This helps to simplify code when the complexity
of a callback isn't necessary right now.
2021-12-05 17:12:25 -05:00
338c1060d5 Cleanup: Remove unnecessary node type callbacks for drawing
Currently there are a few callbacks on `bNodeType` that do the same
thing for every node type except reroutes and frame nodes. Having a
callback for basic things complicates code and makes it harder to
understand, and reroutes and frames are special cases in larger way.

Arguably frame nodes shouldn't even be drawn like regular nodes,
given that it adds a case of O(N^2) looping through all nodes.
"Unrolling" the callbacks makes it easier to see what's happening,
and therefore easier to optimize.

Differential Revision: https://developer.blender.org/D13463
2021-12-05 16:45:41 -05:00
0578921063 Cleanup: clang-tidy: modernize-redundant-void-arg
This change follows up on recent c --> c++ conversions
2021-12-05 16:38:00 -05:00
c20098e6ec Cleanup: Add missing include
Fixes compilation errors after rBd5efda72f501
Re sorted some includes.
2021-12-05 13:33:15 -05:00
Aaron Carlisle
d5efda72f5 Cleanup: Migrate all shader nodes to c++
This will be useful in the future to use the new socket builder API

Aditional changes:

- Declare variables where initialized
- Do not use relative includes

Differential Revision: https://developer.blender.org/D13465
2021-12-05 12:12:45 -05:00
b32f9bf801 Geometry Nodes: use array instead of map in GeometrySet
`GeometrySet` contains at most one component of each type.
Previously, a map was used to make sure that each component
type only exists once. The overhead of a map (especially with
inline storage) is rather large though. Since all component types
are known at compile time and the number of types is low,
a simple `std::array` works as well.

Some benefits of using `std::array` here:
* Looking up the component of a specific type is a bit faster.
* The size of `GeometrySet` becomes much smaller from 192 to 40 bytes.
* Debugging a `GeometrySet` in many tools becomes simpler because
  one can  easily see which components exists and which don't
2021-12-05 15:10:11 +01:00
d19443074a Fix (unreported): off-by-one error when setting curve handles
The problem is that `current_mask` can become `selection.size()`.
The loop could also be refactored to break out of it when the end
of the selection is reached. This can be done separately.
2021-12-05 14:49:30 +01:00
Aaron Carlisle
5ef5a9fc24 Compositor: Migrate most nodes to new socket builder API
This patch leaves a out a few nodes:

- Group Nodes
- Image input node
- File output node
- Switch View
- Cryptomatte

These nodes above are a bit more complicated and should be worked on individually.

Differential Revision: https://developer.blender.org/D13266
2021-12-03 20:26:38 -05:00
Christoph Lendenfeld
d5920744f4 Create generic modal functions from GRAPH_OT_decimate
This patch extracts the modal functions from GRAPH_OT_decimate
and makes them generic so they can be reused by future operators

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9326
Ref: D9326
2021-12-03 22:24:41 +00:00
56ed4c14d3 Cleanup: Use LISTBASE_FOREACH macro 2021-12-03 16:33:14 -05:00
2d8606b360 Cleanup: Use references in node editor, other improvements
This helps to tell when a pointer is expected to be null, and avoid
overly verbose code when dereferencing. This commit also includes
a few other cleanups in this area:
 - Use const in a few places
 - Use `float2` instead of `float[2]`
 - Remove some unnecessary includes and old code
The change can be continued further in the future.
2021-12-03 16:25:17 -05:00
ca0dbf8c26 Cleanup: Remove unused code
This is very old and is unlikely to be useful in the near future.
2021-12-03 12:31:00 -05:00
d1f118d228 Cleanup: Const, use references, C++ types
Also remove some unnecessary includes
2021-12-03 11:43:10 -05:00
be3f3812dc Cleanup: Comments and ordering in node editor header 2021-12-03 11:31:25 -05:00
cb0fbe1fde Cleanup: Use typed enum for node resize direction 2021-12-03 11:05:59 -05:00
ab927f5ca7 ImBuf: Made Wrapping and Cropping optional in IMB_transform.
`IMB_transform` is used in VSE. It had a required crop parameter
for cropping the source buffer. This is not always needed.

In the image engine we want to use the use the `IMB_transform`
with wrap repeat. Both options are mutual exclusive and due
to performance reasons the wrap repeat is only available when
performing a nearest interpolation.
2021-12-03 13:48:00 +01:00
c4e041da23 Cleanup: move public doc-strings into headers for 'bmesh'
Some minor improvements to doc-strings too.

Ref T92709
2021-12-03 20:10:57 +11:00
Jesse Yurkovich
7c4fc5b58d Fix T93541: Use warning instead of error for exceeding layer limits
Instead of using RPT_ERROR, use RPT_WARNING which will not raise an
exception to Python. This broke some scripts (including FBX import)
which already check for a None return value.

Ref D13458

Reviewed By: campbellbarton
2021-12-03 17:05:18 +11:00
de5d36560f Fix T93574: Asset triangulating a mesh
Correct assert for edit-mesh normal calculation.
2021-12-03 16:55:34 +11:00
56ff954030 UI: Expand tree-view items (e.g. asset catalogs) on click to activate
This actually gives a quite nice behavior in my opinion, especially for
asset catalogs, where activating a catalog makes all assets inside it or
its (grand-)child catalogs visible, so showing the child catalogs then
adds useful information. Maybe this should become a feature for
asset catalogs only, to be evaluated once the tree-view API is used in
more cases. Only asset catalogs are affected by this change right now.

Part of T93582.
2021-12-02 19:49:48 +01:00
c0122cc888 Asset Browser: Don't expand top-level catalogs by default
The "All" item will be expanded of course, and the tree will also be
expanded so that the active item is visible. But feedback was that in
some setups, opening all the top-level catalogs is a bit too much. So
collapse them for a more compact default layout.

Part of T93582.
2021-12-02 19:49:48 +01:00
a159f67ccc Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-12-02 19:37:01 +01:00
f1cca30557 Blender 3.0 - version bump -> release 2021-12-02 19:35:47 +01:00
0988711575 Licenses: Attribution document for Blender 3.0
A few libraries were updated, a few were added, and a few were missing
from the previous license document.
2021-12-02 19:35:01 +01:00
fca6a9fe3f Asset Browser: Remove home icon for "All" item
Originally this wasn't really meant to stay there permanently, but
helped giving things a nicer alignment. Others seemed to like it at
first so it stayed, but after more feedback we decided to remove it
again. The alingment is better now with the previous commit.

Part of T93582.
2021-12-02 19:14:50 +01:00
e38532773b Asset Browser: Nest all catalogs under the "All" item
This makes the relation to the catalogs and the behavior more clear.

Part of T93582.
2021-12-02 19:14:50 +01:00
cef8f5ff50 Docs: add README for HIPEW library 2021-12-02 18:43:42 +01:00
1e98a0cee5 NanoSVG: Mention the version we use 2021-12-02 18:22:05 +01:00
431255e5e8 Docs: 3.0 release description for Linux appdata
Includes a typo fix for 2.93.
2021-12-02 18:02:19 +01:00
27b70428c1 Cleanup: Avoid using C++ keyword as variable name 2021-12-02 11:20:22 -05:00
e6a732daad Merge branch 'blender-v3.0-release' 2021-12-02 16:43:25 +01:00
7e60d8a713 Fix missing Blender logo in Windows store package
D9681 was not properly merged to all branches, leaving a path to a non-existent
icon file in the maniphest.
2021-12-02 16:35:24 +01:00
2fd657db5b Fix T93560: crash with image paint undo and cycles preview render
Cycles preview rendering could free the image buffers being used by drawing in
another thread due to a race condition. This race condition was unlikely before,
but now that preview renders are started right before we draw the image in the
image editor or load it as a texture in the 3D viewport, it's likely to happen.

As we are close to release this is too risky to fix properly, just avoid freeing
the cache for preview renders instead and accept increased memory usage in some
cases.
2021-12-02 16:34:16 +01:00
aec56e562a Fix (unreported): incorrect custom data layer created
Without this fix `CustomDataAttributes::create_by_move`
did not work on named attributes.
2021-12-02 15:32:19 +01:00
a1f0f2eacb Cleanup: Move public docs to BKE_spline.hh header 2021-12-02 09:24:21 -05:00
23ffcb242d Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-12-02 14:40:20 +01:00
61e92eeb3e Fix Action.asset_data["is_single_frame"] set incorrectly
The asset metadata custom property `["is_single_frame"]` was set
incorrectly. Since this is intended for forward compatibility, including
being covered by the asset metadata indexing, it's important to have it
set correctly from the first release of Blender that includes the asset
browser.

Differential Revision: https://developer.blender.org/D13452
2021-12-02 14:35:12 +01:00
1620dcd208 Fix: don't use BLI_strncpy_utf8 for copying file paths
File paths can be any encoding, so using some UTF-8-specific function is
not the right way to go.
2021-12-02 13:02:39 +01:00
c5ec3738d8 Blenloader: move ghost include path from INC to TEST_INC
The Ghost dependency was added to avoid a memory leak (rBc7a1e115b507),
but since that's only for the unit tests, it's better to add the path to
`TEST_INC`.
2021-12-02 12:58:45 +01:00
e130903060 BLI: avoid invoking tbb for small workloads
We often call `parallel_for` in places with very variable
sized workloads. When many elements are processed,
using multi-threading is great, but when processing
few elements (possibly many times) using `parallel_for`
can result in significant overhead.

I measured that this improves performance by >20% in
the refactored realize instances code I'm working on
separately. The change might also help with debugging
sometimes, because the stack trace is smaller and contains
fewer irrevelant symbols.
2021-12-02 12:56:47 +01:00
0f89d05848 Fix T93563: Crash subdividing with overlapping tri and quad
The first loop was left out when finding the split edge boundary.

Error from f2138686d9.
2021-12-02 22:53:44 +11:00
42a6b2fd06 Cleanup: move public doc-strings into headers for 'python' 2021-12-02 22:53:44 +11:00
1766549418 Fix T92308: OptiX denoising fails with high resolutions
The OptiX denoiser does have an upper limit as to how many pixels it can denoise at once, so
this changes the OptiX denoising process to use tiles for high resolution images.
The OptiX SDK does have an utility function for this purpose, so changes are minor, adjusting
the configured tile size and including enough overlap.

Maniphest Tasks: T92308

Differential Revision: https://developer.blender.org/D13436
2021-12-02 12:10:46 +01:00
7da979c070 Merge branch 'blender-v3.0-release' 2021-12-02 11:19:00 +01:00
67c490daaf Fix T93548: Appended (material) assets don't have a fake user
Since our design is to always keep data-blocks marked as assets on exit,
and our technical design for this is to do this via fake users, ensure
the fake user is set for an appended asset.

Reviewed by: Bastien Montagne

Differential Revision: https://developer.blender.org/D13443
2021-12-02 11:18:27 +01:00
68e3755209 Fix T93555: crash when muting nodes with multiple internal links
The crash happened because I was incorrectly and inconsistently assuming
that a socket is part of at most one internal link. However, this is not the case.
In geometry nodes, an input socket can be internally linked to multiple
output sockets. In the general case, an output could also be linked to multiple
input sockets, even though we don't have that in Blender yet.

Dalai gave green light to cherry pick this fix for 3.0.
2021-12-02 11:10:41 +01:00
9f290467ca Blendread: Remove all instantiation logic from BLO_library_link_ code.
Instantiation is now fully handled by BKE_blendfile_link_append module.

Note that this also allows removal of the `BLO_LIBLINK_NEEDS_ID_TAG_DOIT`
flag.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-12-02 11:10:34 +01:00
4fe8c62b56 Cleanup: Readfile: Remove deprecated BLO_library_link_copypaste.
Rewrite of ID paste code in rB3f08488244c0 made this function useless,
ID pasting is now handled by the BKE_blendfile_link_append module too.
2021-12-02 10:27:34 +01:00
198e571e87 Fix T93555: crash when muting nodes with multiple internal links
The crash happened because I was incorrectly and inconsistently assuming
that a socket is part of at most one internal link. However, this is not the case.
In geometry nodes, an input socket can be internally linked to multiple
output sockets. In the general case, an output could also be linked to multiple
input sockets, even though we don't have that in Blender yet.
2021-12-02 09:41:36 +01:00
f1b0b0ffb8 Cleanup: spelling in comments 2021-12-02 16:02:34 +11:00
8f69c91408 Fix T93410: Crash hiding a region from Python used by a popover
Close all active buttons when hiding a region as this can be called
from Python a popover is open from that region.

Failure to do this causes the popover to read from the freed button.

Also rename UI_screen_free_active_but to
UI_screen_free_active_but_highlight since it only frees highlighted
buttons.
2021-12-02 15:53:41 +11:00
0de1d2e84e Cleanup: FIx build with USD after recent refactor
rB218360a89217f4e8321319035bf4d9ff97fb2658 missed a couple renames in USD code paths.
2021-12-01 23:34:51 -05:00
Leon Leno
bb3d03973a UI: Fix scaling of HSV cursor when zooming
The small circle used to choose the hue/saturation and value in the
color widget was drawn with a fixed screen space size. Now scale the
circle used as cursor in the color widget based on the zoom. This
could have been part of a9642f8d61 but the implementation is
different.

Based on a fix provided by Erik Abrahamsson

Differential Revision: https://developer.blender.org/D13444
2021-12-01 22:22:53 -05:00
Nikhil Shringarpurey
26d2caee3b Fix T92268: Group input and output nodes have inconsistent padding
The group output node did not have the same size padding as the group
input, leading to the node looking different and actually being smaller.

Differential Revision: https://developer.blender.org/D13092
2021-12-01 22:04:44 -05:00
218360a892 Cleanup: Rename curve struct fields
These existing names were unhelpful at best, actively confusing at
worst. This patch renames them to be consistent with the terms
used to refer to the values in the UI.
 - `width` -> `offset`
 - `ext1` -> `extrude`
 - `ext2` -> `bevel_radius`

Differential Revision: https://developer.blender.org/D9627
2021-12-01 22:01:35 -05:00
ca9cdba2df Fix: Add tooltip translation marker to disabled hints
This was overlooked, as it seems there's no way for these strings to be
translated currently. Generally it's not that clear whether `N_` or
`TIP_` should be used in this case, but `TIP_` seems more consistent.
To avoid the cost of the translation lookup when the UI text isn't
necessary, we could allow the disabled hint argument to be optional.

Differential Revision: https://developer.blender.org/D13141
2021-12-01 21:55:04 -05:00
b869da0c10 Fix T84710: Instances with only mesh edges or vertices are invisible
Wire-only meshes have a special case in the overlay drawing to give
the wire shader a special color (which avoids the lines being dashed,
somehow). The fast path for duplis didn't have that special case.

Differential Revision: https://developer.blender.org/D13196
2021-12-01 21:47:57 -05:00
70a7685d04 UI: Add an option to display the node editor context path
Since we have the overlays popover, it makes sense to allow toggling the
context path like in the 3D viewport. This commit adds a property,
and turns it on by default in existing files.

Differential Revision: https://developer.blender.org/D13248
2021-12-01 21:45:41 -05:00
2b6c01d98c Fix: Updating geometry nodes test results fails
I ran into this when adding new geometry nodes tests.
The issue was caused by 7168a4fa5c.

Differential Revision: https://developer.blender.org/D13440
2021-12-01 21:22:00 -05:00
70a0d45b69 Merge branch 'blender-v3.0-release' 2021-12-01 21:17:48 -05:00
594656e7a3 Fix T93525: Crash with curve/text armature bone gizmo
The problem is that drw_batch_cache_generate_requested_delayed
is called on the object, which uses the original object data type to
choose which data type to get info for. So for curves and text it uses
the incorrect type (not the evaluated mesh like we hardcoded in the
armature overlay code).

To fix this I hardcoded the "delayed" generation to only use the
evaluated mesh. Luckily it wasn't use elsewhere besides this
armature overlay system. That seems like the simplest fix for
3.0. A proper solution should rewrite this whole area anyway.

Differential Revision: https://developer.blender.org/D13439
2021-12-01 21:16:18 -05:00
fed4fc9c42 Cleanup: Move node_shader_util.c to C++
This will allow using a function I've declared in a C++ header.
2021-12-01 15:08:42 -05:00
8ca8380699 Cleanup: compiler warning 2021-12-01 20:52:31 +01:00
Sebastian Herholz
cb334428b0 Cycles: fix bugs in point and spot light multiple importance sampling
* Spot lights are now handled as disks aligned with the direction of the
  spotlight instead of view aligned disks.

* Point light is now handled separately from the spot light, to fix a case
  where multiple lights are intersected in a row. Before the origin of the
  ray was the previously intersected light and not the origin of the initial
  ray traced from the last surface/volume interaction.

This makes both strategies in multiple importance sampling converge to the same
result. It changes the render results in some scenes, for example the junkshop
scene where there are large point lights overlapping scene geometry and each
other.

Differential Revision: https://developer.blender.org/D13233
2021-12-01 20:20:12 +01:00
9afd6e7b70 Cleanup: clarify material copying for hair and pointclouds
No functional change, just more clear this way it comes from src.
2021-12-01 19:48:48 +01:00
Yuki Hashimoto
7336af3259 Fix some shortcut keys not working on macOS with Japanese input
Differential Revision: https://developer.blender.org/D13414
2021-12-01 19:40:47 +01:00
128ebdb062 Fix: Remove incorrect asserts for empty attributes
While it is an edge case, it isn't incorrect for the attribute storage
to have a zero size, it will just return an empty span or nothing.
2021-12-01 12:44:02 -05:00
bc48da3235 Fix: Instances component does not copy attributes 2021-12-01 12:36:49 -05:00
be6e56b36b Cleanup: Fix errors in previous commit
After 1ef8ef4941 there were build warnings because of unused
arguments. Also missed to change code to iterate `strips` instead of
`seqbase` in 2 functions.
2021-12-01 18:13:09 +01:00
506d672524 Geometry Nodes: deduplicate join geometry code
The Realize Instances and Join Geometry node can share most of their code.
Until now, both nodes had their own implementations though. This patch
removes the implementation in the Join Geometry node in favor of the more
general Realize Instances implementation.

This removes an optimization for avoiding spline copies. This can be brought
back later. The realize instances code has to be rewritten to support attribute
instances anyway.

Differential Revision: https://developer.blender.org/D13417
2021-12-01 17:57:08 +01:00
Wannes Malfait
d54a08c8af Geometry Nodes: Dual Mesh Node
This node calculates the dual of the input mesh. This means that faces
get replaced with vertices and vertices with faces. In principle this
only makes sense when the mesh in manifold, but there is an option to
keep the (non-manifold) boundaries of the mesh intact.

Attributes are propagated:
 - Point domain goes to face domain and vice versa
 - Edge domain and Face corner domain gets mapped to itself
Because of the duality, when the mesh is manifold, the attributes get
mapped to themselves when applying the node twice.

Thanks to Leul Mulugeta (@Leul) for help with the
ascii diagrams in the code comments.

Note that this does not work well with some non-manifold geometry,
like an edge connected to more than 2 faces, or a vertex connected to
only two faces, while not being in the boundary. This is because there
is no good way to define the dual at some of those points. This type
of non-manifold vertices are just removed for this reason.

Differential Revision: https://developer.blender.org/D12949
2021-12-01 11:11:50 -05:00
1757840843 Geometry Nodes: Generalized Compare Node
Replace compare floats node with a generalized compare node. The node
allows for the comparison of float, int, string, color, and vector.

The datatypes support the following operators:
Float, Int: <, >, <=, >=, ==, !=
String: ==, !=
Color: ==, !=, lighter, darker
    (using rgb_to_grayscale value as the brightness value)

Vector Supports 5 comparison modes for: ==, !=, <, >, <=, >=
Average: The average of the components of the vectors are compared.
Dot Product: The dot product of the vectors are compared.
Direction: The angle between the vectors is compared to an angle
Element-wise: The individual components of the vectors are compared.
Length: The lengths of the vectors are compared.

Differential Revision: https://developer.blender.org/D13228
2021-12-01 09:36:25 -06:00
f8dd03d3dd Cleanup: Store instances id attribute with other attributes
Now that we can store any dynamic attribute on the instances component,
we don't need the special case for `id`, it can just be handled by the
generic attribute storage. Mostly this just allows removing a bunch
of redundant code.

I had to add a null check for `update_custom_data_pointers` because
the instances component doesn't have any pointers to inside of
custom data.

Differential Revision: https://developer.blender.org/D13430
2021-12-01 09:27:27 -05:00
Paul Golter
fd8418385c Add layer and pass index parameters to rna_Image_gl_load
This patch adds a layer_idx and pass_idx parameter to the rna_Image_gl_load function. It exposes both to the Python API as optional parameters.
This allows python scripters to specifiy which layer and pass they want to load in to an OpenGL texture. Right now image.gl_load() always takes the first layer and first pass.
This is limiting when working with multilayer openEXRs.

With this patch scripters can do something like this:

```
pass_idx = area.spaces.active.image_user.multilayer_pass
layer_idx = area.spaces.active.image_user.multilayer_layer
image.gl_load(frame=0, layer_idx=layer_idx, pass_idx=pass_idx)
```

As the parameters are optional and default to 0, it should not break existing code.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D13435
2021-12-01 14:58:49 +01:00
1ef8ef4941 Cleanup: Remove seq->tmp_flag DNA member
Commit f0d20198b2 used this field to flag rendered strips which were
queried by `SEQ_query_rendered_strips()`. Then operators iterate all
strips and checks state of `seq->tmp_flag`.

Use collection returned by `SEQ_query_rendered_strips` directly.
There should be no functional changes.

This commit adds functions `all_strips_from_context` and
`selected_strips_from_context` that provide collection of strips based
on context. Most operators can use this collection directly.
There is already `seq->tmp` DNA field, but is should not be used unless
absolutely necessary. Better option is to use human readable flag.
Best is to not use DNA fields for temporary storage in runtime.
2021-12-01 12:49:17 +01:00
d5d91b4ae4 Color adjustments for splash for Blender 3.x series
Tweaks by Andy Goralczyk.
2021-12-01 12:46:20 +01:00
02ab4ad991 Fix T92561: unstable particle distribution with Alembic files
When enabling or disabling a Mesh Sequence Cache modifier of an Object
with a hair particle system, the hair would switch positions. This is
caused because original coordinates in Blender are expected to be
normalized, and toggling the modifier would cause the usage of different
orco layers: one that is normalized, and the other which isn't.

This bug exposes a few related issues:
- if the Alembic file did not have orco data,
`MOD_deform_mesh_eval_get`, used by the particle system modifier, would
add an orco layer without normalization
- `MOD_deform_mesh_eval_get` would also ignore the presence of an orco
layer (e.g. one that could have been read from Alembic)
- if the Alembic file did have orco data, the data would be read
unnormalized

To fix those various issues, original coordinates are normalized when
read from Alembic and unnormalized when written to Alembic; and a new
utility function `BKE_mesh_orco_ensure` is added to add a normalized
orco layer if none exists on the mesh already, this function derives
from the code used in the particle system.

Reviewed By: brecht

Maniphest Tasks: T92561

Differential Revision: https://developer.blender.org/D13306
2021-12-01 12:44:32 +01:00
fd22404837 Cleanup: Use int8 type rather than char for buffer
Indicates that this is just a buffer with an element size of 8 bit, not
a displayable/printable string buffer.
2021-12-01 12:19:43 +01:00
51791004ea Fix errors in user preferences after 2.8 hack removal
How to reproduce it:
* Open User Preferences.
* Got to Add-ons tab.

Issue introduced on d723e331f1

Reported via chat by Pedro Alcaide (povmaniac).
2021-12-01 11:38:08 +01:00
9cec9b4d6e Fix(unreported): LineArt intersection mask logic error.
The stroke generation call mistakenly uses all enabled
types to check intersection mask, the correct behavior
is to use individual edge(chain) type.
2021-12-01 15:55:52 +08:00
24b84e4688 LineArt: Use consitent view vector direction.
Now do not invertes view vector in different stages of calculation.
2021-12-01 15:55:16 +08:00
5eeaf4cce6 LineArt: Use consitent view vector direction.
Now do not invertes view vector in different stages of calculation.
2021-12-01 15:53:30 +08:00
386b112f76 Geometry Nodes: Propagate attributes in Instances to Points node
This is part of T92926, and is very similar to 221b7b27fc, except
slightly similar, because it only transfers from one component, and
it doesn't handle multi-threading at the moment.
2021-11-30 23:30:35 -05:00
Aaron Carlisle
d723e331f1 Cleanup: Remove hack to hide pre 2.8 addons in the user preferences
Should be safe to do so now that 2.8+ has been out for 8 releases and over 2 years now.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12984
2021-11-30 22:55:52 -05:00
1cb99f5808 Merge branch 'blender-v3.0-release' 2021-12-01 11:47:28 +11:00
b3d101ac29 Fix T93100: VSE RMB shift-select fails with "fallback tools"
When the select action was set to "Select Tool", shift-clicking
on sequence strips wasn't selecting the strip.

Regression in 2a2d873124

Thanks to @a.monti for the fix.
2021-12-01 11:43:19 +11:00
88e9e97ee9 Geometry Nodes: Add Point Count to Spline Length Node
- Integer Field input of the number of control points on each spline
  in the spline domain.

  - In the point domain, it is the number of points on the spline that
  contains the given control point.

Differential Revision: https://developer.blender.org/D13279
2021-11-30 15:25:43 -06:00
247f37f765 Fix missing subsurface IOR/Anisotropy socket after refactor in c2ab47e 2021-11-30 22:09:18 +01:00
221b7b27fc Geometry Nodes: propagate attributes in Instance on Points node
This is part of T92926.

Differential Revision: https://developer.blender.org/D13429
2021-11-30 18:37:44 +01:00
88b37b639e LibLink/Append: Some cleanup and addition to comments. 2021-11-30 17:37:00 +01:00
1b4734c57d Geometry Nodes: Curve Menu Organize
Put Spline Parameter in the correct position in the Curve menu.
2021-11-30 10:32:12 -06:00
3f08488244 Rewrite ID Paste code to use new BKE_blendfile_link_append module.
No behavioral changes are expected here.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-11-30 17:18:35 +01:00
b9f54dd48a LibLink/Append: Add a utils to link/append all ID of given types from a given library.
This will be used by the copy/paste code.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-11-30 17:18:26 +01:00
581fb2da10 LibLink/Append: tweak instantiation of collections in viewlayers.
When appended collections are instantiated in viewlayers, do not add to
viewlayers collections children of other instantiated collections.

This default behavior is required for proper copy/paste behavior. If
previous behavior needs to be brought back for regular append operation,
this can be decided and done, but think this default behavior also makes
sense in normal append case.

part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-11-30 17:13:28 +01:00
c822e03e2a Fix: Missing handling of dynamic instance attribute size
The attributes need to be reallocated when the size changes.

Differential Revision: https://developer.blender.org/D13390
2021-11-30 10:59:11 -05:00
2fbb52dd86 Merge branch 'blender-v3.0-release' 2021-11-30 15:41:29 +01:00
3788003cda Fix T93368: Dragging Blends Without Previews
Unfortunately the drop logic for file-path based drag & drop checks the
used icon for its logic. This is very bad and should be changed. But
doing this involves some changes that are better not done during bcon4,
so for now stick to it and update the icon check.

Reviewed by: Julian Eisel

Differential Revision: https://developer.blender.org/D13383?id=45314
2021-11-30 15:40:27 +01:00
74039388cd Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-30 15:36:48 +01:00
7863e03e89 Fix(unreported): LineArt intersection mask logic error.
The stroke generation call mistakenly uses all enabled
types to check intersection mask, the correct behavior
is to use individual edge(chain) type.
2021-11-30 22:24:42 +08:00
Bastien Montagne
de7f1e8e07 Fix T93353: Reload Library Override file loses Constraints, take II.
When adding `INSERT` operations over RNACollection items, rna diffing
code did not properly report the properties as not being equals.

This in turn triggered the 'purge unused exiting override properties'
mechanism, thus deleting the exitsting (valid) insert override property
operation.

NOTE: This should also be backported to 2.93, and probably 2.83.

Reviewed By: sybren, jbakker

Maniphest Tasks: T93353

Differential Revision: https://developer.blender.org/D13426
2021-11-30 15:19:44 +01:00
Germano Cavalcante
251c017534 Fix T93477: Viewport X-Ray is influencing snapping even in material mode
The default snap behavior to perform on tools and cursors is to the
final geometry and not edited geometry.

In snapping to edited geometry, there are some specific behaviors that
are not convenient in some cases. For example the general occlusion
test of X-Ray geometries during dragdrop.

This fix also resolves a regression for tools like measure and placement
that were also ignoring the snap to face in x-ray mode.

Differential Revision: https://developer.blender.org/D13410
2021-11-30 11:03:57 -03:00
0704570721 LibLink/Append: Port bpy.data.libraries.load to new BKE_blendfile_link_append module.
Note that this fully replaces the 'PyCapsule' storage of linked/appended items
in the python API code by the generic storage of items in the
`BlendfileLinkAppendContext` data.

Maniphest Tasks: T91414

Differential Revision: https://developer.blender.org/D13331
2021-11-30 15:02:53 +01:00
8cf0d15b60 Fix T93508: Shift+F1 to switch to asset browser randomly crashes 2021-11-30 14:35:29 +01:00
1cd9fcd98d Geometry Nodes: Rename Curve Parameter, Add Index on Spline
- Rename the Curve Parameter node to Spline Parameter.
  - Add "Index on Spline" to the node. This output is the index of
the current point on it's parent spline rather than the entrire curve.

Differential Revision: https://developer.blender.org/D13275
2021-11-30 07:21:14 -06:00
2f7bec04e8 Asset Browser: Fix incorrect user message
Text would display "No asset selected" when it actually inidicates that
there is no asset active (not selected). Changed it to "No active asset"
now.
2021-11-30 13:01:23 +01:00
3692c0521c Fix Asset Browser properties region toggle not showing open/closed state
The button is supposed to be blue (default theme) when the properties
region is open, to indicate that state.
2021-11-30 12:40:57 +01:00
b67dca9b76 Depsgraph: remove shading parameters component
This component served no purpose anymore. It was technical
dept from the early 2.80 days.

Differential Revision: https://developer.blender.org/D13422
2021-11-30 12:14:23 +01:00
4b971bb87c Asset Bundle Copy button: only report each external dependency once
The `ASSET_OT_bundle_install` operator only works when the blend file is
self-contained. It reports any external dependencies. Before this patch:

- every dependency was mentioned, even when it repeated the same
  filename over and over again, and
- multiple dependencies were all mentioned in the error popup,
  potentially filling the screen.

This is now resolved by:

- only reporting each external file once, and
- referring to the console when there are multiple external dependencies.

Reviewed by: severin, dfelinto

Differential Revision: https://developer.blender.org/D13413
2021-11-30 11:50:38 +01:00
Julian Eisel
2e53f8b4b1 Fix T92577: Cannot open shortcut folders on Windows
`file.select()` wasn't handling redirects as it should when it also
opens directories. This was only uncovered by a change in the keymap.

Reviewed By: Bastien Montagne, Harley Acheson

Differential Revision: https://developer.blender.org/D13388
2021-11-30 11:29:40 +01:00
e1cb2a226c Merge branch 'blender-v3.0-release' 2021-11-30 11:17:04 +01:00
d8edc2c634 VSE: Disable interactivity in combined view
Combined view of timeline and preview causes seemingly unpredictable
behavior after some operators have been allowed to run in preview
region.

Disable new features in this combined view, so behavior should be
consistent with previous versions.

ref: https://developer.blender.org/T92584

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D13419
2021-11-30 11:15:20 +01:00
6f460b76fe LibLink/Append: tweak asserts in main BKE link/append functions.
Now that those functions are much widely used, just return early in case
there is nothing to link/append,  instead of asserting over it.
2021-11-30 11:04:41 +01:00
bc1e3238c4 Merge remote-tracking branch 'origin/blender-v3.0-release'
This includes adjustment of rBc12d8a72cef5 to the new path traversal code
introduced in rBe5e8db73df86.
2021-11-30 10:56:14 +01:00
c12d8a72ce BPath traversing: allow skipping weak library references
Add flag to `BKE_bpath_traverse_id()` and friends to skip weak
references (see below). This makes a distinction between "this blend
file depends on that file" and "this blend file references that file,
but doesn't directly use its data". This distinction is for the Asset
Bundle install operator, which refuses to copy the blend file when it's
not self-contained.

Weak references are those that are not directly used by the blend file,
but are still present to allow path rewriting. For example, when an
Asset is loaded its originating blend file is saved in
`ID::library_weak_reference`; this reference is purely for deduplication
purposes, and not for actually loading any data.

Reviewed by: mont29, brecht

Differential Revision: https://developer.blender.org/D13412
2021-11-30 10:41:23 +01:00
d7f0de0e3a Fix T93442: Crash when proxy building is cancelled
If strip is removed while proxy is built, this causes crash when
building is finished. This happens because proxy anims are freed in
`SEQ_proxy_rebuild_finish()`.

Iterate over available strips and check if original strip still exists
by comparing `SessionUUID`.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13408
2021-11-30 10:08:22 +01:00
Jake
7168a4fa5c Tests: add edit-mesh operator tests
Added operator tests for hide, symmetry_snap, tris_convert_to_quads,
uvs_rotate, uvs_rotate, uv_texture_add, uv_texture_remove,
vert_connect_concave, vert_connect_nonplanar, vertex_color_add,
vertex_color_remove, vertices_smooth_laplacian, wireframe,
sculpt_vertex_color_add and sculpt_vertex_color_remove.

Ref D11798

Reviewed By: campbellbarton
2021-11-30 17:43:24 +11:00
500ec993f5 Revert "Fix: Const warning in editmesh_knife.c"
It's important the coordinates the knife is operating on are never
manipulated since it will cause problems which are difficult to
troubleshoot.

Instead, use a cast in the MEM_freeN(..) call.

This reverts commit 8600d4491f.
2021-11-30 16:30:08 +11:00
Matheus Santos
da279927b1 Text Editor: Line number highlight follow selection
Change the current behavior of line number highlighting to follow the
current selected line text->sell, not the current line text->curl.
2021-11-30 14:32:52 +11:00
ac447ba1a3 Cleanup: clang-format, trailing space 2021-11-30 10:15:17 +11:00
e2473d3baf Cleanup: remove blank lines in comment blocks 2021-11-30 10:15:17 +11:00
76471dbd5e Cleanup: capitalize NOTE tag 2021-11-30 10:15:17 +11:00
4e45265dc6 Cleanup: spelling in comments & strings 2021-11-30 10:15:17 +11:00
262ef26ea3 Cleanup: use colon after doxygen params, correct slash direction 2021-11-30 10:15:17 +11:00
35124acd19 Geometry Nodes: Domain Size Node
The Domain Size node has a single geometry input and a selection for
the component type. Based on the component chosen, outputs containing
single values for the related domains are shown.

Mesh:
  - Point Count
  - Edge Count
  - Face Count
  - Face Corner Count
Curve:
  - Point Count
  - Spline Count
Point Cloud:
  - Point Count
Instances:
  - Instance Count

Differential Revision: https://developer.blender.org/D13365
2021-11-29 13:04:25 -06:00
c2001ec275 Merge branch 'blender-v3.0-release' 2021-11-29 19:25:28 +01:00
e7ae9f493a Fix T93310: crash due to broken image paths
The crash was caused by allocating an uninitialized amount of memory.
This fix initializes a bunch of variables that could cause the error.

It should be possible to also fix this in the function that actually uses
the uninitialized memory, but that could cause unknown consequences
that are a bit too risky for 3.0. Just initializing some variables should
be safe though. For more details see D13369.

Differential Revision: https://developer.blender.org/D13369
2021-11-29 19:23:43 +01:00
4fac3be146 Fix Cycles OptiX doing a bit too much work for almost opaque curve shadows
Found in D13353, likely has no significant impact in performance.
2021-11-29 18:41:37 +01:00
2e6f914e37 Fix debug build error after recent Cycles kernel argument changes 2021-11-29 18:41:37 +01:00
0adb356f2e Merge branch 'blender-v3.0-release' 2021-11-29 17:09:53 +01:00
aa7051c8f2 Fix T93439: Armature widgets from hidden collections are invisible
The are few things in the dependency graph which lead to the issue:
- IDs are only built once.
- Object-data level (Armature, i,e,) builder dependent on the object
  visibility.

This caused issues when an armature is first built as not directly
visible (via driver, i.e.) and then was built as a directly visible.
This did not update visibility flag on the node for the custom shape
object.

The idea behind the fix is to go away form passing object visibility
flag to the geometry-level builders and instead rely on the common
visibility flush post-processing to make sure certain objects are
fully visible when needed.

This is the safest minimal part of the change for 3.0 release which
acts as an additional way to ensure visibility. This means that it
might not be a complete fix (if some configuration was overseen) but
it should not make currently working cases to not work.

The fix should also make modifiers used on rigify widgets to work.

The more complete fix will have `is_object_visible` argument removed
from the geometry-level builder functions.

Differential Revision: https://developer.blender.org/D13404
2021-11-29 16:59:50 +01:00
aff6227412 Merge branch 'blender-v3.0-release' 2021-11-29 16:59:09 +01:00
dae9917915 Fix T93384: Objects with Constraints to curves have wrong locations on file load
Regression since 3.93 caused by 752c6d668b.

Follow the code from 2.93 which was always leaving curve modifiers
evaluation with a valid and clean state of the bounding box.

This is also what was proposed and agreed on in the following
design task: T92206: Bounding Box: compute during depsgraph evaluation

Tested with files from T90808 and T93384.

For the 3.0 going with the safest and minimal change. The rest of
the bounding box un-entanglement is to happen outside of the stable
branch.

Thanks The patch is based on the code from Philipp Oeser and
investigation by Germano Cavalcante and Dr. Sybren A. Stüvel,
thanks!

Differential Revision: https://developer.blender.org/D13409
2021-11-29 16:45:31 +01:00
2206b6b9a0 Fix T92628: .blend thumbnail renders black with Cycles 3D viewport render
Don't use Cycles for rendering thumbnails, fall back to Solid shading.

Differential Revision: https://developer.blender.org/D13406
2021-11-29 16:27:55 +01:00
f613c4c095 Cycles: MetalRT support (kernel side)
This patch adds MetalRT support to Cycles kernel code. It is mostly additive in nature or confined to Metal-specific code, however there are a few areas where this interacts with other code:

- MetalRT closely follows the Optix implementation, and in some cases (notably handling of transforms) it makes sense to extend Optix special-casing to MetalRT. For these generalisations we now have `__KERNEL_GPU_RAYTRACING__` instead of `__KERNEL_OPTIX__`.
- MetalRT doesn't support primitive offsetting (as with `primitiveIndexOffset` in Optix), so we define and populate a new kernel texture, `__object_prim_offset`, containing per-object primitive / curve-segment offsets. This is referenced and applied in MetalRT intersection handlers.
- Two new BVH layout enum values have been added: `BVH_LAYOUT_METAL` and `BVH_LAYOUT_MULTI_METAL_EMBREE` for XPU mode). Some host-side enum case handling has been updated where it is trivial to do so.

Ref T92212

Reviewed By: brecht

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D13353
2021-11-29 15:20:26 +00:00
98a5c924fc Cycles: Metal readiness: Specify DeviceQueue::enqueue arg types
This patch adds new arg-type parameters to `DeviceQueue::enqueue` and its overrides. This is in preparation for the Metal backend which needs this information for correct argument encoding.

Ref T92212

Reviewed By: brecht

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D13357
2021-11-29 14:56:06 +00:00
Pratik Borhade
03c9563582 Fix T93431: Crash when empty is marked as asset
Make `ED_preview_id_is_supported(ID *)` NULL-safe. It's semantically
valid, as it's not possible to render a preview of a NULL ID.

The crash was introduced in 481f032f5c

Reviewed By: sybren, jbakker

Maniphest Tasks: T93431

Differential Revision: https://developer.blender.org/D13398
2021-11-29 15:25:03 +01:00
f9add2d63e Fix: Missing min value for set spline resolution node 2021-11-29 09:11:51 -05:00
Bastien Montagne
e5e8db73df Refactor BKE_bpath module.
The main goal of this refactor is to make BPath module use `IDTypeInfo`,
and move each ID-specific part of the `foreach_path` looper into their
own IDTypeInfo struct, using a new `foreach_path` callback.

Additionally, following improvements/cleanups are included:
* Attempt to get better, more consistent namings.
** In particular, move from `path_visitor` to more standard `foreach_path`.
* Update and extend documentation.
** API doc was moved to header, according to recent discussions on this
   topic.
* Remove `BKE_bpath_relocate_visitor` from API, this is specific
  callback that belongs in `lib_id.c` user code.

NOTE: This commit is expected to be 100% non-behavioral-change. This
implies that several potential further changes were only noted as
comments (like using a more generic solution for
`lib_id_library_local_paths`, addressing inconsistencies like path of
packed libraries always being skipped, regardless of the
`BKE_BPATH_FOREACH_PATH_SKIP_PACKED` `eBPathForeachFlag` flag value,
etc.).

NOTE: basic unittests were added to master already in
rBdcc500e5a265093bc9cc.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13381
2021-11-29 14:22:38 +01:00
6ae34bb071 Fix drawing annotations on surface
Caused by {rBaa0ac0035a0d}.

Similar solution to {rBc0fdaf700a5}.
2021-11-29 09:43:33 -03:00
7c703b4699 Fix T93417: Strip outline not aligned with image
When using non-uniform aspect ratio, strip outline is not aligned
correctly.

Apply pixel aspect ratio to image quad and origin.
2021-11-29 12:44:42 +01:00
f1118ee51e Nodes: Support internal links for custom sockets
Currently, nodes with custom sockets do not get their internal links
populated. So operators like Delete And Reconnect don't work with such
nodes. This patch put custom sockets into consideration when computing
priorities for internal links such that sockets of the same idname get
connected. Additionally, the patch cleanup the function in the process
to avoid redundant code repetition.

Reviewed By: Jacques Lucke

Differential Revision: https://developer.blender.org/D13386
2021-11-29 13:01:53 +02:00
ab2a7aa0da Fix T93438: Auto linking do not work for custom sockets
Currently, custom sockets are no longer supported for automatic linking
when dropping a node on a link. This is because SOCK_CUSTOM is given a
negative priority and is ignored. To fix this, SOCK_CUSTOM is now given
the lowest priority and the rest of the sockets got their priority
incremented.

Reviewed By: Jacques Lucke

Differential Revision: https://developer.blender.org/D13403
2021-11-29 12:34:11 +02:00
cebe5f5bf4 Cleanup: Silenced clang-tidy warning. 2021-11-29 11:26:35 +01:00
0cbcddd91e Merge branch 'blender-v3.0-release' 2021-11-29 02:14:05 -08:00
b31250feba Fix T93456: Properly translate operator on splash screen
Use the translation API to lookup the string before formatting occurs.

Differential Revision: https://developer.blender.org/D13400
2021-11-29 02:04:32 -08:00
444971aa8e Cleanup: typos in comments. 2021-11-28 19:05:22 +01:00
f7f558e293 Cleanup: Deduplicate instances component in spreadsheet
Currently we have a separate `InstancesDataSource`, which does almost
exactly the same thing as `GeometryDataSource`, except that it hardcodes
a few more columns: "Name", "Rotation", and "Scale". We can easily
replace that with a couple of if statements in the geometry data source.

This also makes named attributes on instances display
in the spreadsheet.

Differential Revision: https://developer.blender.org/D13391
2021-11-27 17:09:35 -05:00
e121b5b66c Merge branch 'blender-v3.0-release' 2021-11-27 21:59:57 +01:00
Brecht Van Lommel
d2e6087335 Fix build error with TBB 2021 and booleans
Linux distributions are using newer TBB versions than official releases, and
TBB 2021 is an API breaking release.

In general we should avoid using TBB directly and go through the abstractions
in BLI_task.hh, though there is no abstraction for this.

For 3.0 the safe option is to just not cancel the task but instead early out
in the lambda function. Given the grain size of 2048 there should be no
significant performance difference.

Differential Revision: https://developer.blender.org/D13382
2021-11-27 19:08:06 +01:00
aa6c922d99 Geometry Nodes: Optimize Cube primitive vertex calculation
This patch gets rid of the O(N^3) complexity
of calculate_vertices. Execution time of the node is
reduced from 250ms to 140ms with 500^3 vertices.
In the future edge calculations could be done manually
and reduce the execution time even further.

Differential Revision: https://developer.blender.org/D13207
2021-11-27 19:06:07 +01:00
d2f4fb68f5 Geometry Nodes: Parallelize "Set Spline Type"-node
Parallelizes the loop that converts splines.
It gives around a 2x speedup on curves with over 1k splines.

Differential Revision: https://developer.blender.org/D13389
2021-11-27 18:17:58 +01:00
2531358297 Attempt to fix Windows new bpath tests failing, take IV.
Follow up to rBdcc500e5a265093bc9cc, rB92daff6ac2adb5bb,
rB61bd5882a20c6f3 and rB08264aaf82da8.

Sorry for the noise, this time should be good.
2021-11-26 22:39:34 +01:00
08264aaf82 Attempt to fix Windows new bpath tests failing, take III.
Follow up to rBdcc500e5a265093bc9cc, rB92daff6ac2adb5bb and rB61bd5882a20c6f3.
2021-11-26 22:07:37 +01:00
61bd5882a2 Attempt to fix Windows new bpath tests failing, take II.
Follow up to rBdcc500e5a265093bc9cc and rB92daff6ac2adb5bb.

Also shortening a bit the macros names...
2021-11-26 21:34:48 +01:00
a0bb6bb4d6 Fix T89564: Spline IK breaks when it is far away from the world origin
The isect_line_sphere algorithm became very imprecise when the line and
the sphere were reasonably far away from the world origin.

This would lead to no intersections being reported even if there was a
guaranteed intersection (line crossing from inside the sphere to the
outside).

To fix this we now use the secant root finding method to get an
intersection point. This is much more stable and robust it seems.
2021-11-26 18:24:58 +01:00
97465046c6 Geometry Nodes: add utility to set remaining outputs
Differential Revision: https://developer.blender.org/D13384
2021-11-26 18:01:59 +01:00
92daff6ac2 Attempt to fix Windows new bpath tests failing.
Follow up to rBdcc500e5a265093bc9cc.
2021-11-26 17:57:40 +01:00
2efc2221cc Fix T93402: Linking Collections instantiate extra sub-collections.
Linking is more relax than appending when it comes to instantiating
indirectly linked collections/objects.
2021-11-26 17:49:18 +01:00
0789f61373 Cleanup: remove warnings
This assert was producing warning in debug builds because
it was never hit under some circumstances.
2021-11-26 17:32:09 +01:00
602ecbdf9a Geometry Nodes: optimize Set Position node
This implements four optimizations in the Set Position node:
* Check whether the position input is the current position and ignore
  it if it is. This results in a speedup when only the Offset input is used.
* Use multi-threading when copying to computed values to the
  position attribute. All geometry types benefit from this.
* Use devirtualization for the offset and position input. This optimizes
  the common case that they are either single values or computed
  in the fly in a span.
* Write to `Mesh->mvert` directly instead of creating a temporary span.
  This makes setting mesh vertex positions even more efficient.

In my simple benchmark I'm using a White Noise node to offset the
position of 1,000,000 vertices. The speed is `20 ms -> 4.5 ms` in the
multi-threaded case and `32 ms -> 22 ms` in the single-threaded case.
2021-11-26 15:33:35 +01:00
eb7827e797 Cycles: Fix film convert address space mismatch on Metal
This patch fixes an address space mismatch in the film convert kernels on Metal. The `film_get_pass_pixel_...` functions take a `ccl_private` result pointer, but the film convert kernels pass a `ccl_global` memory pointer. Specialising the pass-fetch functions with templates results in compilation errors on Visual Studio, so instead this patch just adds an intermediate local on Metal.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13350
2021-11-26 13:58:48 +00:00
12a83db83c Fix T93290: Rotation without contraint after extrude has wrong axis
The default orientation of the mode was being indicated as overridden,
although the one of constraint was used.
2021-11-26 10:49:00 -03:00
f86331a033 Geometry Nodes: deduplicate virtual array implementations
For some underlying data (e.g. spans) we had two virtual array
implementations. One for the mutable and one for the immutable
case. Now that most code does not deal with the virtual array
implementations directly anymore (since rBrBd4c868da9f97a),
we can get away with sharing one implementation for both cases.
This means that we have to do a `const_cast` in a few places, but
this is an implementation detail that does not leak into "user code"
(only when explicitly casting a `VArrayImpl` to a `VMutableArrayImpl`,
which should happen nowhere).
2021-11-26 14:47:15 +01:00
ef88047a97 Fix T89081: Freestyle noise seed of zero crash
This leads to division by zero in Freestyle's NoiseShader which also
crashes blender.

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

Maniphest Tasks: T89081

Differential Revision: https://developer.blender.org/D13332
2021-11-26 14:40:07 +01:00
a773cd3850 Fix T93130: Frame Selected with selected paint mask does not work
This broke with {rB20fac2eca723} (which landed in 2.63), so long
standing bug.

Convention for paint modes is:
- when no paint mask is active, `Frame Selected` will focus the last
stroke
- when paint mask is active, `Frame Selected` will focus the selected
mask faces

To check the right vert coords we have to offset with `mp->loopstart`.

Maniphest Tasks: T93130

Differential Revision: https://developer.blender.org/D13247
2021-11-26 14:32:49 +01:00
35c3644e78 Fix T93117: Texture paint clone tool crash in certain situation
Caused by {rBaf162658e127}, so long standing bug.

When changing clone slots (report involved a quite complicated sequence
of selecting textures and undo -- but I think this could happen in more
situations) code checks for UV of new clone slot.
However, since above commit the slot and the clone slot were mixed up,
so in this case the responsible NULL check (for when no UV is assigned)
wasnt working.
Now correct this (NULL check the clone slot uv -- instead of the paint
slot UV).

note: not sure why low level CustomData functions actually dont do the
name NULL checks themselves (seems like callers are always responsible).

Maniphest Tasks: T93117

Differential Revision: https://developer.blender.org/D13378
2021-11-26 14:24:46 +01:00
63342861e7 Fix: error in previous commit
Forgot to actually slice the span in rB6b5e1cfacab4c4605ec2d7bfef360389afe849be.
2021-11-26 13:29:24 +01:00
b066d58216 CMake mini-rewrite: Sync code check with BKE_blender_version_is_alpha
Reproduce the logic we already do in C (BKE_blender_version_is_alpha)
and the CMake file.

Otherwise it can get out of sync if we add/rename the non-alpha release cycles.

No functional change.

Differential Revision: https://developer.blender.org/D13379
2021-11-26 13:05:37 +01:00
236be8e9f1 Fix T93380: Texture paint clone tool crash without clone image
This was crashing using the clone tool without a clone image assigned.

Caused by {rB9111ea78acf4}.
Since above commit, `BKE_image_acquire_ibuf` was using `ima->runtime`
without checking for NULL first.
Since callers are not required to check for this, just return early
here.

note: there is still a memory leak using the clone tool without a clone
image assigned (but this was also the case before said commit and needs
to be investigated separately).

Maniphest Tasks: T93380

Differential Revision: https://developer.blender.org/D13377
2021-11-26 11:46:26 +01:00
dcc500e5a2 BKE_bpath: Add minimal unittests.
This is far from a complete coverage, but should catch most of potential
issues when rewriting this code.
2021-11-26 11:08:14 +01:00
Simon Lenz
c6eaa9c552 MaskEditor: draw active layer on top
Instead of drawing the mask layers in the sequence of their occurence, draw the active mask *always* on top.

Implementation:
- move drawing loop for splines to separate static function
- draw active mask last

Example: lowest layer is active, yet still drawn on top.
{F12140355}

This is part of an effort to make mask editing more intuitive & easy to use: https://developer.blender.org/T93097

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13372
2021-11-26 11:08:05 +01:00
658fd8df0b Geometry Nodes: refactor multi-threading in field evaluation
Previously, there was a fixed grain size for all multi-functions. That was
not sufficient because some functions could benefit a lot from smaller
grain sizes.

This refactors adds a new `MultiFunction::call_auto` method which has the
same effect as just calling `MultiFunction::call` but additionally figures
out how to execute the specific multi-function efficiently. It determines
a good grain size and decides whether the mask indices should be shifted
or not.

Most multi-function evaluations benefit from this, but medium sized work
loads (1000 - 50000 elements) benefit from it the most. Especially when
expensive multi-functions (e.g. noise) is involved. This is because for
smaller work loads, threading is rarely used and for larger work loads
threading worked fine before already.

With this patch, multi-functions can specify execution hints, that allow
the caller to execute it most efficiently. These execution hints still
have to be added to more functions.

Some performance measurements of a field evaluation involving noise and
math nodes, ordered by the number of elements being evaluated:
```
1,000,000: 133 ms   -> 120 ms
  100,000:  30 ms   ->  18 ms
   10,000:  20 ms   ->   2.7 ms
    1,000:   4 ms   ->   0.5 ms
      100:   0.5 ms ->   0.4 ms
```
2021-11-26 11:06:16 +01:00
Martijn Versteegh
004172de38 Clarify a confusing comment.
Affect and effect are too confusing for non-native english speakers
(like me). Also BAKING_MASK_MARGIN doesn't exist anymore in the code.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13361
2021-11-26 10:57:17 +01:00
6b5e1cfaca Geometry Nodes: better devirtualization for sliced virtual arrays
Under some circumstances that can lead to more than a 2x
performance increase, because math nodes can better optimize
for the case when the slice is a single value or span.
2021-11-26 10:08:19 +01:00
2cda65a35a Geometry Nodes: avoid allocation when construct varray for single value
Previously, `GVArray::ForSingle` would always allocate a copy of the passed
in value. Now it only does so when the value is too large or not trivial.
2021-11-26 09:59:41 +01:00
8015433f81 Cleanup: Migrate image_gpu.cc to CC.
To prepare for future changes {T92613}.
2021-11-26 08:16:35 +01:00
e3cf7ebdb1 Cleanup: Silence clang-tidy warning. 2021-11-26 08:00:05 +01:00
a073e1e401 Cleanup: Silence clang-tidy warnings. 2021-11-26 07:59:38 +01:00
7b5a6f452a Merge branch 'blender-v3.0-release' 2021-11-25 18:33:19 +01:00
466b50dbc9 Cycles: expose direct light sampling option in Debug panel, tweak panel layout 2021-11-25 18:30:54 +01:00
2fb8c6805a Fix build error with experimental features after recent release cycle bump
Hair, pointcloud and simulation datablock types should be disabled in the
beta cycles already like other experimental features.
2021-11-25 18:24:46 +01:00
e3d3296327 Merge remote-tracking branch 'origin/blender-v3.0-release'
Merge conflict: Makes sure master is still alpha, while 3.0 is rc.
2021-11-25 18:00:33 +01:00
e6a41e1c80 Blender 3.0 bcon4 - change release cycle to release candidate
This is still a rolling release candidate with new builds every day
as a preparation to the final release.
2021-11-25 17:59:49 +01:00
b2bb3e4b72 Fix T90082: Autoscrolling after renaming in the File Browser broken
Caused by 6b0869039a

Above commit introduced selection after renaming. This includes calling
`file_select_deselect_all` [which resorts and refilters].

So now, to have the correct file for scrolling, get it again after
sorting by calling `file_params_find_renamed` again.

Differential Revision: https://developer.blender.org/D13368
2021-11-25 17:32:40 +01:00
4a3f99ad5a Merge branch 'blender-v3.0-release' 2021-11-25 17:26:53 +01:00
5a11c6e558 Fix missing margin below panels
A minor cosmetic fix. When the view was scrolled all the way to the
bottom, the lowest panel would end right on the view edge. The
scrollable view should get the same margin at the bottom as used at the
top.
2021-11-25 17:15:48 +01:00
5514ca58a4 Fix T92313: Heading of redo panel is not aligned properly
This corrects some alignments issues through new margins introduced in
93544b641b. Basic idea of this fix is to only add the new margins when
drawing a panel with background. These margins were added specifically
for the background boxes, so that makes sense.

Alternative fix to D13199.

This also fixes some margings added unintentionally in mentioned commit.
There is a little jump of the toolbar and the tabs in the Properties
when comparing the UI without this fix to 2.93:
{F12158085} {F12158039}
The jump is gone with this fix applied (compare to the 2.93 screenshot):
{F12158064}
While not a serious issue, this confirms that this fix actually tackles
the root of the issue.
2021-11-25 17:09:45 +01:00
94e8db1e86 Fix T92278: Small size of previews in the shading popover
Don't use the side padding for menu item contents when displaying
previews or icons in a row or grid layout. This can cause problems for
the preview drawing and doesn't make sense to draw there anyway.

This not only fixes the mentioned issue, but also too small heighlight
for the collection color tag in the Outliner context menu.

Alternative to and similar to D13125.
2021-11-25 15:55:04 +01:00
3652f5f758 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-25 15:22:40 +01:00
c91d196159 Fix T93274: Assigning asset catalog doesn't mark file as modified
Assigning a catalog to an asset via drag-and-drop in the asset browser
now creates an undo step. Not only does this allow undoing the action,
it also tags the blend file as modified.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D13370
2021-11-25 15:02:23 +01:00
9812a08848 Fix: Crash when muting the Group Output node
This fixes a crash when muting the "Group Output" node.
It should not be possible to mute it so this patch
sets the `no_muting`-variable on it.

Differential Revision: https://developer.blender.org/D13364
2021-11-25 15:01:38 +01:00
e216660382 Merge branch 'blender-v3.0-release'
Conflicts:
	source/blender/windowmanager/intern/wm_files_link.c
2021-11-25 15:00:06 +01:00
e253fb2143 Fix T93353: Reload Library used as source for liboverride loses Constraints.
Liboverride properties and operations list need to be fully up-to-date
before libraries are reloaded, otherwise re-applying those liboverrides
after linked data is reloaded may miss some changes.
2021-11-25 14:56:56 +01:00
3bf10e5d0a Fix T89996, T90063: bugs with multi-button reset and entering values in popups
This reverts the changes to fix T87448, where entering the same value in number
buttons causes an unnecessary update. This is not stable enough for 3.0 and so
is being reverted, better to have an unnecessary update than no update in other
cases.

This effectively reverts the changes from rBeb06ccc32462 and follow up fixes
rBe1a9ba94c599, rBbbb52a462ef9, rBec30cf0b742f, and rB071799d4fc44. The code is
disabled with a comment on how it could be implemented better.
2021-11-25 14:45:19 +01:00
2378f057a0 Merge branch 'blender-v3.0-release' 2021-11-25 14:21:05 +01:00
bc4c20d414 Fix T93360: 'Iteractive Light Track' do not work over empty background
Bug introduced in {rBaa0ac0035a0d}.

The invalid depth fallback was changed to `FLT_MAX` in order to match the
annotation and gpencil operations.

This broke the `Interactive Light Track` operator which invalidates the
operation if the depth value is `1.0f`.

The chosen solution was to change the value tested in the annotation and
gpencil operations.
2021-11-25 10:18:57 -03:00
ffddf9e5c9 Fix T93338: Curve Guide force field crash
Caused by {rBcf2baa585cc8}.

For Curve Guide force fields to work, the `Path Animation` option has to
be enabled. With it disabled, we are lacking the necessary
`anim_path_accum_length` data initialized [done by
`BKE_anim_path_calc_data`] which `BKE_where_on_path` relies on since
above commit.

Now just check for this before using it - and return early otherwise.
Prior to said commit, `BKE_where_on_path` would equally return early
with a similar message, so that is expected behavior here.

Maniphest Tasks: T93338

Differential Revision: https://developer.blender.org/D13371
2021-11-25 14:16:12 +01:00
447378753d BLI: remove special cases for is_span and is_single methods
Those were not implemented consistently and don't really help in practice.
2021-11-25 13:51:23 +01:00
845716e600 Fix T92609 Default Compositing tab shows red overlay when stereoscopy is turned on
This was caused by the drawing not being done on the right frammebuffer.
2021-11-25 13:40:04 +01:00
d6646f7a8a Fix T93367: wrong attribute propagation in Delete Geometry node
This only happened with non-point selections. It used an incorrect
index mapping for the attribute propagation.
2021-11-25 11:32:12 +01:00
1e2376f41f Merge branch 'blender-v3.0-release' 2021-11-25 10:36:30 +01:00
82808e18e6 Fix T93362: crash when capturing attribute after fillet curve node
The issue was that the attribute propagation in the Fillet Curve node seems
pretty broken. I couldn't really make sense of the old code. It changed the
size of the point attribute domains on splines to 1 for some reason which
led to a crash in the next node.

Differential Revision: https://developer.blender.org/D13362
2021-11-25 10:33:05 +01:00
5ffb9b6dc4 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-25 10:22:32 +01:00
Bastien Montagne
a0acb9bd0c Fix T91444: Edge Loop Preview fails with two Mirror Modifiers
The mirror modifiers merge option caused unnecessary re-ordering
to the vertex array with original vertices merging into their copies.

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

As merging in either direction is supported, keep the source meshes
vertices in-order since it allows the vertex coordinates to be extracted.

NOTE: Since this change introduce issues for some cases (e.g. bound
modifiers like SurfaceDeform), this change is only applied to newly
created modifiers, existing ones will still use the old incorrect merge
behavior.

Reviewed By: @brecht

Maniphest Tasks: T93321, T91444

Differential Revision: https://developer.blender.org/D13355
2021-11-25 10:21:49 +01:00
e6cd4761e7 Fix T93321: Modified Mirror modifier behavior break some other tools like bound SurfaceDeform.
Revert "Fix T91444: Edge Loop Preview fails with two Mirror Modifiers"

This reverts commit 1a7757b0bc.

Caused issue reported in T93321, boiling down to the fact that other
operations or modifiers (like the SurfaceDeform one) rely on the order
of the vertices in the mesh to remain consistent.

Changing this in a modifier would mean those operations need to be
reset/re-created (e.g. rebound for the SurfaceDeform case), which is not
doable in `do_version` code.
2021-11-25 10:21:49 +01:00
726bc3a46b Fix T93155: Approximate shadow catcher displayed wrong on CPU and GPU
Was happening during rendering, causing visual artifacts when doing
CPU+GPU rendering, and giving different in-progress results on different
devices.

The root of the issue comes to the fact that math used in the approximate
shadow catcher calculation might have resulted in negative alpha channel,
and negative values for display are handled differently on CPU and GPU.
Such difference in handling is caused by an approximate conversion used on
the CPU for the performance reasons.

This change makes it so no negative alpha is generated by the approximate
shadow catcher. Not sure if we need some explicit clamping somewhere to
deal with possible negative values coming from somewhere else.

The shadow catcher cornell box tests are to be updated for the new code,
but the new result seems to be more accurate.

Differential Revision: https://developer.blender.org/D13354
2021-11-25 10:17:52 +01:00
610e68590b Merge branch 'blender-v3.0-release' 2021-11-25 10:12:57 +01:00
ce5561b815 Fix Py API: wrong doc about type of Collection property.
Collection property only accepts PropertyGroup type, not ID ones.

Reported on IRC by @frameshift, thanks.
2021-11-25 10:12:35 +01:00
f12a6ff5cb Merge branch 'blender-v3.0-release' 2021-11-25 09:51:12 +01:00
40d28b40df Fix black Cycles result when cancelling tiled rendering with shadow catcher
Noticed when was looking into T93155. Steps to reproduce:

- Open the .blend file from the report
- Hit F12 to start rendering
- After some tiles were rendered hit Esc

The issue is caused by "sticky" cancel reported via Progress. This  means
that once user hit Esc all further requests for cancel state will return
truth, which was preventing OIDN denoiser from completing the denoising
task.

Now only allow stopping the denoiser when interactive rendering requests
a very fast stopping.

Aiming the fix for 3.0 branch.

Differential Revision: https://developer.blender.org/D13352
2021-11-25 09:50:33 +01:00
William Leeson
c49d2cbe92 Merge branch 'blender-v3.0-release' to bring in D13042:
Fix performance decrease with Scrambling Distance on
2021-11-25 09:41:03 +01:00
Alaska
b41c72b710 Fix performance decrease with Scrambling Distance on
With the current code in master, scrambling distance is enabled on non-hardware accelerated ray tracing devices see a measurable performance decrease when compared scrambling distance on vs off. From testing, this performance decrease comes from the large tile sizes scheduled in `tile.cpp`.

This patch attempts to address the performance decrease by using different algorithms to calculate the tile size for devices with hardware accelerated ray traversal and devices without. Large tile sizes for hardware accelerated devices and small tile sizes for others.

Most of this code is based on proposals from @brecht and @leesonw

Reviewed By: brecht, leesonw

Differential Revision: https://developer.blender.org/D13042
2021-11-25 09:32:26 +01:00
827c5b399e Merge branch 'blender-v3.0-release' 2021-11-25 00:04:32 +01:00
8f2db94627 Fix T93357: crash when opening search menu
This is the same fix as in rBde35a90f9f56d3ff3ac80c13bf1ae296853ba877
but for the blender-v3.0-release branch.
2021-11-25 00:03:41 +01:00
c26011efcb Fix T92962 Boolean output indices unstable.
A parallel loop to create the interesection meshes for each triangle
meant that with parallelism, the output order of the created meshes
could vary with each execution. Keep the parallelism for doing the CDTs
for interesection, but move the extraction of the new faces into a
serial loop afterwards, for repeatability.
2021-11-24 15:26:12 -05:00
6b1b3383c6 Merge branch 'blender-v3.0-release' 2021-11-24 21:10:24 +01:00
Leon Leno
a9642f8d61 UI: Improve scaling of widgets when zooming
This commit improves the scaling of some ui widgets when
zooming by making the radius of the rounded corners
dependent on the element's zoom level.

Needed to fix T92278 without padding issues, see D13125.

Reviewed By: Hans Goudey, Julian Eisel

Differential Revision: https://developer.blender.org/D12842
2021-11-24 21:06:32 +01:00
c155a5f9d7 Merge branch 'blender-v3.0-release' 2021-11-24 14:53:16 -03:00
752c6d668b Fix T90808: wrong BoundBox after undo curve selection
There are two functions that recalculate the boundbox of an object:
- One that considers the evaluated geometry
- Another that only considers the object's `data`.

Most of the time, the bound box is calculated on the final object
(with modifiers), so it doesn't seem right to just rely on `ob->data`
to recalculate the `ob->runtime.bb`.

Be sure to calculate the BoundBox based on the final geometry and
only use `ob->data` as a fallback

Differential Revision: https://developer.blender.org/D12282
2021-11-24 14:52:49 -03:00
bbadee6fc1 UI: Blend File Icons Thumbnail View
Changes icon used to indicate blend file when overlaid over larger
document icon when in thumbnail view. Only seen when file does not
have a preview.

Followup to {rB611e4ffaab43}

For more details and examples see D13342

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

Reviewed by Julian Eisel
2021-11-24 09:52:27 -08:00
7a7ae4df43 UI: Blend File Icons Thumbnail View
Changes icon used to indicate blend file when overlaid over larger
document icon when in thumbnail view. Only seen when file does not
have a preview.

Followup to {rB611e4ffaab43}

For more details and examples see D13342

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

Reviewed by Julian Eisel
2021-11-24 09:50:02 -08:00
338408772a Merge branch 'blender-v3.0-release' 2021-11-24 18:37:33 +01:00
71c39a9e2e Asset Browser: Activate a catalog when dragging
Without this it's easy to loose track of which catalog you are dragging.
Things feel generally quite jumpy/disconnected, activating the catalog
makes things feel far less like that.
I consider this an important usability fix, therefore I'm adding it to
the release branch.
2021-11-24 18:05:08 +01:00
cae3b581b0 Asset Browser: Fix catalog being renamed when dropping into parent
When dropping catalogs it is ensured that the name of the moved catalog
is unique within the new parent catalog. When dropping a catalog into
the parent, the catalog would not actually move to a different location,
but it would still be renamed. The unique name logic simply isn't smart
enough to ignore the catalog that is about to be moved.
Address this by disallowing dragging a catalog into its own parent. It's
already there.
2021-11-24 17:59:14 +01:00
499c24ce75 BLI: add slice method to index mask and generic span 2021-11-24 17:49:33 +01:00
cbe9a87d28 Geometry Nodes: use simpler types when devirtualizing virtual array
The compiler is more likely to optimize away the function call
overhead when the used type is simpler and not virtual.
2021-11-24 17:46:00 +01:00
01ab36ebc1 Asset Browser: Support dragging catalogs into top level
This was an oversight when I added catalog drag & drop support. I forgot
to add this for dragging catalogs into the top level by dragging into to
the "All" item as well. This made the drag & drop support rather broken
because it wouldn't work for a basic case.
2021-11-24 17:31:28 +01:00
e206a0ae96 Geometry Nodes: reduce thread switching in evaluator
When a node is executed, it usually schedules other nodes.
Right now, those newly scheduled nodes are added to a
task pool so that another thread can start working on them
immediatly.

However, that leads to the situation where sometimes each
node in a simple chain is executed by another thread. That
leads to additional threading overhead and reduced cache
efficiency (for caches that are not shared between cores).

Now, when a node is executed and schedules other nodes,
the first of those newly scheduled nodes will always be
executed on the same thread once the current node is done.
If it schedules more than one other node, those will be
added to the task pool as before.

The speedup achieved by this is hard to measure. I found it
to be a couple percent faster in some extreme cases, not
much to get excited about. It's nice though that the number
of tasks added to the task pool is commonly reduced by a
factor of 4 or 5.
2021-11-24 17:26:41 +01:00
4930cd5db6 Merge branch 'blender-v3.0-release' 2021-11-24 10:40:13 -05:00
a07089dcb1 Fix T92120 (partially): No bone custom shape with curve object meshes
This part of the drawing code assumes that the bone custom object
has only one evaluated geometry component, and it also uses the
object type to check which data to draw, with the functions like
`DRW_cache_object_surface_get` that just take an object input.
Those functions usually work on evaluated objects, which use the
instancing system to access a temporary object with `object.data`
replaced for data types that don't match the original object.

That assumption used to work, but now curve, point cloud, or volume
objects can have an evaluated mesh which is not accessed with the
same object for render engine drawing.

The "correct" solution for the way this code is structured would be to
loop through all of the geometry components and try to get GPU batches
from every one of them. However, that significantly increases complexity
in an area that should probably be refactored anyway. This patch treats
the mesh as a special case, and only draws the evaluated mesh.

The **best** solution in my opinion might be refactoring this area to
use the instancing system with some sort of viewport-only flag so
the custom shape instances aren't added in the render.

The solution is "partial" because the "Wireframe" option only works
for meshes from mesh objects, even after this fix, and because other
data besides meshes is not displayed at all.

Differential Revision: https://developer.blender.org/D13038
2021-11-24 10:39:33 -05:00
7a97e925fd Cycles: Add support for building with OptiX 7.4 SDK and use built-in catmull-rom curve type
Some enum names were changed/removed in OptiX 7.4, so some changes are necessary to
make things compile still.
In addition, OptiX 7.4 also adds built-in support for catmull-rom curves, so it is no longer
necessary to convert the catmull-rom data to cubic bsplines first, and has endcaps disabled
by default now, so can remove the special handling via any-hit programs that filtered them
out before.

Differential Revision: https://developer.blender.org/D13351
2021-11-24 16:33:04 +01:00
56b068a664 Fix inconsistent UI terminology for tiling option
Was meant to be Use instead of Using.
2021-11-24 15:54:53 +01:00
64d9291d26 Cleanup: formatting 2021-11-24 15:54:53 +01:00
Alessio Monti di Sopra
2cc56495f3 UI: Fix alignment for recently added/edited icons
The patch slightly modifies two recently added icons "FILE_BLEND" and
"CURRENT_FILE" to better align them to the pixel grid, and change the
design of "FILE_BACKUP" to avoid alignment and readability issues, as
well as avoiding the outline version of the Blender logo which violates
the official logo guidelines.

Differential revision: https://developer.blender.org/D13346
2021-11-24 15:51:57 +01:00
72acce43bc Animation: allow marking actions as cyclic for Cycle-Aware Keying.
When a manual frame range is set, allow marking an action as having
Cyclic Animation. This does not affect how the action is evaluated,
but the Cycle-Aware Keying option will automatically make any newly
added F-Curves cyclic. This allows using the option from the start
to build the cycle, rather than only for tweaking an existing loop.

The curves are made cyclic when they have only one key, either
after inserting the first key, or before adding the second one.
The latter case avoids the need to manually make the first added
curve cyclic after marking a newly added action cyclic.

Differential Revision: https://developer.blender.org/D11803
2021-11-24 15:58:32 +03:00
5d59b38605 Animation: allow manually setting the intended playback range for actions.
Some operations, e.g. adding a new action strip to NLA, require
knowing the active frame range of an action. However, currently it
can only be deduced by scanning the keyframes of the curves within
it. This is not ideal if e.g. curves are staggered for overlap.

As suggested by Nathan Vegdahl in comments to T54724, this patch adds
Action properties that allow manually specifying its active frame range.
The settings are exposed via a panel in the Dopesheet and Action Editor.
When enabled, the range is highlighted in the background using a striped
fill to distinguish it from the solid filled regular playback range.

When set, the frame range is used when adding or updating NLA tracks,
and by add-ons using `Action.frame_range`, e.g. FBX exporter.

Differential Revision: https://developer.blender.org/D11803
2021-11-24 15:58:32 +03:00
057cb7e5e7 Context: add accessors returning selected actions for animation editors.
Add a new 'selected_visible_actions' property to allow querying
actions that are selected in animation related editors for use in
UI and operators. The 'selected_editable_actions' variant excludes
linked actions (the only reason an action can be read-only).

In the Action and Shape Key editors there is only one action
that is specified by the field at the top of the editor.

In Dope Sheet it scans the channel rows and returns all actions
related to the selected items. This includes summary items for
actions and groups.

In Graph Editor, it lists actions associated with selected curves.

The new property is also used for Copy To Selected and Alt-Click.

Ref D11803
2021-11-24 15:58:32 +03:00
65f547c3fc Geometry Nodes: add utility to show debug messages in node editor
This is only meant to be used for development purposes for now,
not to show warnings to the user.

Differential Revision: https://developer.blender.org/D13348
2021-11-24 13:39:20 +01:00
9fc5a9c78f macOS: Fix build error due to std::optional<T>::value 2021-11-24 17:41:37 +05:30
7ea4342e73 Geometry Nodes: reduce number of scheduled nodes in evaluator
Previously, there were a couple of cases where nodes were scheduled when
that was not really necessary. This change doesn't seem to have a big impact
on performance, but simplifies the code a bit.
2021-11-24 12:57:36 +01:00
833eb90820 Cleanup: removed shadowed variable 2021-11-24 12:57:36 +01:00
simon
25478bdc9a Merge branch 'blender-v3.0-release' 2021-11-24 12:56:19 +01:00
5a50b46376 Fix T93352: Material previews lost render samples
There are few layers of things which lead to the situation
of more noisy material preview: the do-version of the
preview.blend did not happen (at least from the Python
side as we did not investigate the C side deep). This made
Cycles to use default integrator settings for the preview
file ever since the Cycles X was merged. Those settings are
adaptive sampling with max 4K samples, noise threshold 0.01.
Opening the file in Blender 3.0 for edit did run the versioning
code which effectively lowered the number of samples used for
rendering.

This change makes it so the preview file is configured with
the exact effective settings as seen by Cycles prior to the
file was re-saved (adaptive sampling with the parameters noted
above).

This fix does not chaneg the fact that the versioning code is
not used for preview.blend, it only solves the regression in
the quality of previews.

The fix is done and reviewed with collaboration with Dalai and Sergey.
2021-11-24 12:47:30 +01:00
f5e5a0987a Geometry Nodes: decouple Delete Geometry node from Mask modifier
This dependency was a bit ugly and the functions from the mask modifier
did a few things that we don't need in the Delete Geometry node:
* The mask modifier uses `CustomData_copy_data` which the node doesn't need.
* The mask modifier checks for `-2` in some values, but this special value is
  not used by the node.

Differential Revision: https://developer.blender.org/D13335
2021-11-24 12:00:35 +01:00
050b205a97 CMake: add WITH_UNITY_BUILD option to improve compile times
Unity builds are only used in the `bf_nodes_geometry` module for now.
This module has been prepared to support unity builds already.
Usually, there is a 2-4x speedup when building `bf_nodes_geometry`
compared to without unity builds (e.g. 145s to 55s).

For more information about how unity builds work and how they help
with compile times, see D13341.

Differential Revision: https://developer.blender.org/D13341
2021-11-24 11:40:26 +01:00
3850fdd5b9 Assets: Sanitize threaded preview creation with undo
Basically, this fixes disappearing previews when editing asset metadata
or performing undo/redo actions.

The preview generation in a background job will eventually modify ID
data, but the undo push was done prior to that. So obviously, an undo
then would mean the preview is lost.

This patch makes it so undo/redo will regenerate the preview, if the preview
rendering was invoked but not finished in the undone/redone state.

The preview flag PRV_UNFINISHED wasn't entirely what we needed. So I had to
change it to a slightly different flag, with different semantics.
2021-11-24 11:26:37 +01:00
98a5658239 Cleanup: Renamed DefaultDrawingMode ImageSpaceDrawingMode.
Explains more what it does, not how it is used.
2021-11-24 11:23:44 +01:00
cd818fd081 Assets: Sanitize threaded preview creation with undo
Basically, this fixes disappearing previews when editing asset metadata
or performing undo/redo actions.

The preview generation in a background job will eventually modify ID
data, but the undo push was done prior to that. So obviously, an undo
then would mean the preview is lost.

This patch makes it so undo/redo will regenerate the preview, if the preview
rendering was invoked but not finished in the undone/redone state.

The preview flag PRV_UNFINISHED wasn't entirely what we needed. So I had to
change it to a slightly different flag, with different semantics.
2021-11-24 11:20:35 +01:00
75b53542f2 ImageEngine: Remove unneeded check for tiled image.
Regular images are also tiled images, but with a default tile that leads
to the same result.
2021-11-24 11:02:05 +01:00
17770192fb Tests: exclude anonymous attributes from mesh comparison
The set of anonymous attributes on a geometry is not visible to the user.
2021-11-24 10:38:42 +01:00
e0763760e4 Cleanup: IDTypeInfo new asset_type_info member.
Two issues addressed here:

I) `asset_type_info` is sub-data, not a callback. Therefore, move it
before the callbacks in the `IDTypeInfo` struct.

II) More important, initialize this new attribute in *ALL* `IDTypeInfo`
instances. No member of this struct should ever be left implicitely
uninitilazed, ever.

Aftermath of rBa84f1c02d251.
2021-11-24 10:35:47 +01:00
f8dea3fe64 Fix T93345: missing null check for geometry nodes logger 2021-11-24 10:16:14 +01:00
2ddbf81c47 Cleanup: Add info about attributes init in Mesh IDTypeInfo after conversion to C++.
rB6002914f141f totally lost those info, in C++ we use comments by
convention.
2021-11-24 10:09:35 +01:00
f9db7675e0 Cleanup: use lowercase in private functions. 2021-11-24 10:06:17 +01:00
785503a7e4 Cleanup: use lowercase in private functions. 2021-11-24 10:05:45 +01:00
1a887b0088 Cleanup: use nullptr 2021-11-24 10:05:01 +01:00
4d46e8a5e0 Merge branch 'blender-v3.0-release' 2021-11-24 10:02:57 +01:00
4b259edb0a Cleanup: Silent compilation warning in draw_manager. 2021-11-24 10:02:30 +01:00
de35a90f9f Fix crash when opening search menu.
Asset install bundle poll didn't check the space it was running in and
assumed that it was always running in file browser.
2021-11-24 09:27:47 +01:00
ebe5a5eca8 AssetBrowser: Disable asset indexing.
Asset Indexing is disabled for now as it requires {D12990} to support
object snapping.
2021-11-24 08:32:29 +01:00
Jeroen Bakker
dbeab82a89 T91406: Asset Library Indexing
Asset library indexing would store indexes of asset files to speed up
asset library browsing.

* Indexes are read when they are up to date
** Index should exist
** Index last modify data should be later than the file it indexes
** Index version should match
* The index of a file containing no assets can be load without opening
   the index file. The size of the file should be below a 32 bytes.
* Indexes are stored on a persistent cache folder.
* Unused index files are automatically removed.

The structure of the index files contains all data needed for browsing assets:
```
{
  "version": <file version number>,
  "entries": [{
    "name": "<asset name>",
    "catalog_id": "<catalog_id>",
    "catalog_name": "<catalog_name>",
    "description": "<description>",
    "author": "<author>",
    "tags": ["<tag>"]
  }]
}
```

Reviewed By: sybren, Severin

Maniphest Tasks: T91406

Differential Revision: https://developer.blender.org/D12693
2021-11-24 08:21:40 +01:00
Jeroen Bakker
16fc0da0e7 Animation: Add test cases for ED_keyframes_keylist.
This patch adds test cases to detect edge cases when finding
keylist columns.

The patch originated during development of D12052 to make sure
the new implementation matches the old implementation. It would
be good to add these test cases to master so this part is covered
in a next change might influence the expected edges.

The patch covers `ED_keylist_find_next`, `ED_keylist_find_prev`
and `ED_keylist_find_exact` methods.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D12302
2021-11-24 08:02:50 +01:00
21f22759ea Merge branch 'blender-v3.0-release' 2021-11-23 17:17:36 -08:00
60c0b79256 Add tablet data to Wintab fallback cursor movement. 2021-11-23 17:10:30 -08:00
Christoph Lendenfeld
6b4405d757 Extract keyframe segment calculation
extracts the search for keyframe segments (consecutive selection of keys)
It will be reused by future graph editor operators

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9360
Ref: D9360
2021-11-23 21:38:23 +00:00
d144983f8c Cleanup: unused variable 2021-11-23 18:15:59 -03:00
56f66602c7 Fix (unreported): Local preview icons not loading
Bug introduced in {rB9d7422b817d1}.

The solution is not an init thread for preview tasks that won't complete.
2021-11-23 18:11:54 -03:00
9142 changed files with 744818 additions and 698036 deletions

View File

@@ -205,6 +205,7 @@ ForEachMacros:
- FOREACH_SCENE_COLLECTION_BEGIN
- FOREACH_SCENE_OBJECT_BEGIN
- FOREACH_SELECTED_BASE_BEGIN
- FOREACH_SELECTED_BEZT_BEGIN
- FOREACH_SELECTED_EDITABLE_OBJECT_BEGIN
- FOREACH_SELECTED_OBJECT_BEGIN
- FOREACH_TRANS_DATA_CONTAINER
@@ -264,10 +265,13 @@ ForEachMacros:
- SET_SLOT_PROBING_BEGIN
- MAP_SLOT_PROBING_BEGIN
- VECTOR_SET_SLOT_PROBING_BEGIN
- WL_ARRAY_FOR_EACH
- FOREACH_SPECTRUM_CHANNEL
StatementMacros:
- PyObject_HEAD
- PyObject_VAR_HEAD
- ccl_gpu_kernel_postfix
MacroBlockBegin: "^BSDF_CLOSURE_CLASS_BEGIN$"
MacroBlockEnd: "^BSDF_CLOSURE_CLASS_END$"
MacroBlockBegin: "^OSL_CLOSURE_STRUCT_BEGIN$"
MacroBlockEnd: "^OSL_CLOSURE_STRUCT_END$"

View File

@@ -1,6 +1,8 @@
# The warnings below are disabled because they are too pedantic and not worth fixing.
# Some of them will be enabled as part of the Clang-Tidy task, see T78535.
# NOTE: No comments in the list below is allowed. Clang-tidy will ignore items after comments in the lists flag list.
# This is because the comment is not a valid list item and it will stop parsing flags if a list item is a comment.
Checks: >
-*,
readability-*,
@@ -14,10 +16,9 @@ Checks: >
-readability-make-member-function-const,
-readability-suspicious-call-argument,
-readability-redundant-member-init,
-readability-misleading-indentation,
-readability-use-anyofallof,
-readability-identifier-length,
-readability-function-cognitive-complexity,
@@ -35,6 +36,8 @@ Checks: >
-bugprone-redundant-branch-condition,
-bugprone-suspicious-include,
modernize-*,
-modernize-use-auto,
-modernize-use-trailing-return-type,
@@ -42,8 +45,6 @@ Checks: >
-modernize-use-nodiscard,
-modernize-loop-convert,
-modernize-pass-by-value,
# Cannot be enabled yet, because using raw string literals in tests breaks
# the windows compiler currently.
-modernize-raw-string-literal,
-modernize-return-braced-init-list

View File

@@ -34,6 +34,15 @@ indent_style = space
indent_size = 2
max_line_length = 99
# Tom's Obvious Minimal Language
[*.toml]
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
max_line_length = 120
# reStructuredText
[*.rst]
charset = utf-8
@@ -42,3 +51,12 @@ insert_final_newline = true
indent_style = space
indent_size = 3
max_line_length = 120
# Makefile
[{Makefile,GNUmakefile}]
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = tab
indent_size = 4
max_line_length = 120

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +1,4 @@
# -*- mode: gnumakefile; tab-width: 4; indent-tabs-mode: t; -*-
# vim: tabstop=4
#
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# SPDX-License-Identifier: GPL-2.0-or-later
# This Makefile does an out-of-source CMake build in ../build_`OS`_`CPU`
# eg:
@@ -51,7 +32,7 @@ Other Convenience Targets
* config: Run cmake configuration tool to set build options.
* deps: Build library dependencies (intended only for platform maintainers).
The existance of locally build dependencies overrides the pre-built dependencies from subversion.
The existence of locally build dependencies overrides the pre-built dependencies from subversion.
These must be manually removed from '../lib/' to go back to using the pre-compiled libraries.
Project Files
@@ -63,8 +44,6 @@ Project Files
Package Targets
* package_debian: Build a debian package.
* package_pacman: Build an arch linux pacman package.
* package_archive: Build an archive package.
Testing Targets
@@ -72,24 +51,25 @@ Testing Targets
* test:
Run automated tests with ctest.
* test_cmake:
Runs our own cmake file checker
which detects errors in the cmake file list definitions
* test_pep8:
Checks all python script are pep8
which are tagged to use the stricter formatting
* test_deprecated:
Checks for deprecation tags in our code which may need to be removed
Static Source Code Checking
Not associated with building Blender.
* check_cppcheck: Run blender source through cppcheck (C & C++).
* check_clang_array: Run blender source through clang array checking script (C & C++).
* check_deprecated: Check if there is any deprecated code to remove.
* check_splint: Run blenders source through splint (C only).
* check_sparse: Run blenders source through sparse (C only).
* check_smatch: Run blenders source through smatch (C only).
* check_descriptions: Check for duplicate/invalid descriptions.
* check_licenses: Check license headers follow the SPDX license specification,
using one of the accepted licenses in 'doc/license/SPDX-license-identifiers.txt'
Append with 'SHOW_HEADERS=1' to show all unique headers
which can be useful for spotting license irregularities.
* check_cmake: Runs our own cmake file checker which detects errors in the cmake file list definitions.
* check_pep8: Checks all Python script are pep8 which are tagged to use the stricter formatting.
* check_mypy: Checks all Python scripts using mypy,
see: source/tools/check_source/check_mypy_config.py scripts which are included.
Spell Checkers
This runs the spell checker from the developer tools repositor.
@@ -140,7 +120,7 @@ Utilities
Updates git and all submodules but not svn.
* format:
Format source code using clang (uses PATHS if passed in). For example::
Format source code using clang-format & autopep8 (uses PATHS if passed in). For example::
make format PATHS="source/blender/blenlib source/blender/blenkernel"
@@ -150,6 +130,7 @@ Environment Variables
* BUILD_DIR: Override default build path.
* PYTHON: Use this for the Python command (used for checking tools).
* NPROCS: Number of processes to use building (auto-detect when omitted).
* AUTOPEP8: Command used for Python code-formatting (used for the format target).
Documentation Targets
Not associated with building Blender.
@@ -181,6 +162,7 @@ CPU:=$(shell uname -m)
# Source and Build DIR's
BLENDER_DIR:=$(shell pwd -P)
BUILD_TYPE:=Release
BLENDER_IS_PYTHON_MODULE:=
# CMake arguments, assigned to local variable to make it mutable.
CMAKE_CONFIG_ARGS := $(BUILD_CMAKE_ARGS)
@@ -219,17 +201,47 @@ endif
# in libraries, or python 2 for running make update to get it.
ifeq ($(OS_NCASE),darwin)
ifeq (, $(shell command -v $(PYTHON)))
PYTHON:=$(DEPS_INSTALL_DIR)/python/bin/python3.7m
PYTHON:=$(DEPS_INSTALL_DIR)/python/bin/python3.10
ifeq (, $(shell command -v $(PYTHON)))
PYTHON:=python
endif
endif
endif
# -----------------------------------------------------------------------------
# additional targets for the build configuration
# Set the LIBDIR, an empty string when not found.
LIBDIR:=$(wildcard ../lib/${OS_NCASE}_${CPU})
ifeq (, $(LIBDIR))
LIBDIR:=$(wildcard ../lib/${OS_NCASE}_centos7_${CPU})
endif
ifeq (, $(LIBDIR))
LIBDIR:=$(wildcard ../lib/${OS_NCASE})
endif
# support 'make debug'
# Use the autopep8 module in ../lib/ (which can be executed via Python directly).
# Otherwise the "autopep8" command can be used.
ifndef AUTOPEP8
ifneq (, $(LIBDIR))
AUTOPEP8:=$(wildcard $(LIBDIR)/python/lib/python3.10/site-packages/autopep8.py)
endif
ifeq (, $(AUTOPEP8))
AUTOPEP8:=autopep8
endif
endif
# -----------------------------------------------------------------------------
# Additional targets for the build configuration
# NOTE: These targets can be combined and are applied in reverse order listed here.
# So it's important that `bpy` comes before `release` (for example)
# `make bpy release` first loads `release` configuration, then `bpy`.
# This is important as `bpy` will turn off some settings enabled by release.
ifneq "$(findstring bpy, $(MAKECMDGOALS))" ""
BUILD_DIR:=$(BUILD_DIR)_bpy
CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/bpy_module.cmake" $(CMAKE_CONFIG_ARGS)
BLENDER_IS_PYTHON_MODULE:=1
endif
ifneq "$(findstring debug, $(MAKECMDGOALS))" ""
BUILD_DIR:=$(BUILD_DIR)_debug
BUILD_TYPE:=Debug
@@ -254,10 +266,6 @@ ifneq "$(findstring headless, $(MAKECMDGOALS))" ""
BUILD_DIR:=$(BUILD_DIR)_headless
CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/blender_headless.cmake" $(CMAKE_CONFIG_ARGS)
endif
ifneq "$(findstring bpy, $(MAKECMDGOALS))" ""
BUILD_DIR:=$(BUILD_DIR)_bpy
CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/bpy_module.cmake" $(CMAKE_CONFIG_ARGS)
endif
ifneq "$(findstring developer, $(MAKECMDGOALS))" ""
CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/blender_developer.cmake" $(CMAKE_CONFIG_ARGS)
@@ -295,8 +303,10 @@ endif
# use the default build path can still use utility helpers.
ifeq ($(OS), Darwin)
BLENDER_BIN?="$(BUILD_DIR)/bin/Blender.app/Contents/MacOS/Blender"
BLENDER_BIN_DIR?="$(BUILD_DIR)/bin/Blender.app/Contents/MacOS/Blender"
else
BLENDER_BIN?="$(BUILD_DIR)/bin/blender"
BLENDER_BIN_DIR?="$(BUILD_DIR)/bin"
endif
@@ -328,7 +338,7 @@ CMAKE_CONFIG = cmake $(CMAKE_CONFIG_ARGS) \
# -----------------------------------------------------------------------------
# Tool for 'make config'
# X11 spesific
# X11 specific.
ifdef DISPLAY
CMAKE_CONFIG_TOOL = cmake-gui
else
@@ -353,8 +363,12 @@ all: .FORCE
@echo Building Blender ...
$(BUILD_COMMAND) -C "$(BUILD_DIR)" -j $(NPROCS) install
@echo
@echo edit build configuration with: "$(BUILD_DIR)/CMakeCache.txt" run make again to rebuild.
@echo Blender successfully built, run from: $(BLENDER_BIN)
@echo Edit build configuration with: \"$(BUILD_DIR)/CMakeCache.txt\" run make again to rebuild.
@if test -z "$(BLENDER_IS_PYTHON_MODULE)"; then \
echo Blender successfully built, run from: $(BLENDER_BIN); \
else \
echo Blender successfully built as a Python module, \"bpy\" can be imported from: $(BLENDER_BIN_DIR); \
fi
@echo
debug: all
@@ -405,11 +419,6 @@ help: .FORCE
# -----------------------------------------------------------------------------
# Packages
#
package_debian: .FORCE
cd build_files/package_spec ; DEB_BUILD_OPTIONS="parallel=$(NPROCS)" sh ./build_debian.sh
package_pacman: .FORCE
cd build_files/package_spec/pacman ; MAKEFLAGS="-j$(NPROCS)" makepkg
package_archive: .FORCE
make -C "$(BUILD_DIR)" -s package_archive
@@ -420,21 +429,7 @@ package_archive: .FORCE
# Tests
#
test: .FORCE
$(PYTHON) ./build_files/utils/make_test.py "$(BUILD_DIR)"
# run pep8 check check on scripts we distribute.
test_pep8: .FORCE
$(PYTHON) tests/python/pep8.py > test_pep8.log 2>&1
@echo "written: test_pep8.log"
# run some checks on our cmakefiles.
test_cmake: .FORCE
$(PYTHON) build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
@echo "written: test_cmake_consistency.log"
# run deprecation tests, see if we have anything to remove.
test_deprecated: .FORCE
$(PYTHON) tests/check_deprecated.py
@$(PYTHON) ./build_files/utils/make_test.py "$(BUILD_DIR)"
# -----------------------------------------------------------------------------
@@ -456,44 +451,44 @@ project_eclipse: .FORCE
#
check_cppcheck: .FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) \
"$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
"$(BLENDER_DIR)/check_cppcheck.txt"
@echo "written: check_cppcheck.txt"
check_clang_array: .FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py"
check_splint: .FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py"
check_sparse: .FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py"
check_smatch: .FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py"
check_mypy: .FORCE
$(PYTHON) "$(BLENDER_DIR)/source/tools/check_source/check_mypy.py"
@$(PYTHON) "$(BLENDER_DIR)/source/tools/check_source/check_mypy.py"
check_spelling_py: .FORCE
cd "$(BUILD_DIR)" ; \
@cd "$(BUILD_DIR)" ; \
PYTHONIOENCODING=utf_8 $(PYTHON) \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
"$(BLENDER_DIR)/release/scripts"
check_spelling_c: .FORCE
cd "$(BUILD_DIR)" ; \
@cd "$(BUILD_DIR)" ; \
PYTHONIOENCODING=utf_8 $(PYTHON) \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
--cache-file=$(CHECK_SPELLING_CACHE) \
@@ -503,53 +498,71 @@ check_spelling_c: .FORCE
"$(BLENDER_DIR)/intern/ghost" \
check_spelling_osl: .FORCE
cd "$(BUILD_DIR)" ;\
@cd "$(BUILD_DIR)" ; \
PYTHONIOENCODING=utf_8 $(PYTHON) \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
--cache-file=$(CHECK_SPELLING_CACHE) \
"$(BLENDER_DIR)/intern/cycles/kernel/shaders"
check_descriptions: .FORCE
$(BLENDER_BIN) --background -noaudio --factory-startup --python \
@$(BLENDER_BIN) --background -noaudio --factory-startup --python \
"$(BLENDER_DIR)/source/tools/check_source/check_descriptions.py"
check_deprecated: .FORCE
@PYTHONIOENCODING=utf_8 $(PYTHON) \
source/tools/check_source/check_deprecated.py
check_licenses: .FORCE
@PYTHONIOENCODING=utf_8 $(PYTHON) \
"$(BLENDER_DIR)/source/tools/check_source/check_licenses.py" \
"--show-headers=$(SHOW_HEADERS)"
check_pep8: .FORCE
@PYTHONIOENCODING=utf_8 $(PYTHON) \
tests/python/pep8.py
check_cmake: .FORCE
@PYTHONIOENCODING=utf_8 $(PYTHON) \
source/tools/check_source/check_cmake_consistency.py
# -----------------------------------------------------------------------------
# Utilities
#
source_archive: .FORCE
python3 ./build_files/utils/make_source_archive.py
@$(PYTHON) ./build_files/utils/make_source_archive.py
source_archive_complete: .FORCE
cmake \
@cmake \
-S "$(BLENDER_DIR)/build_files/build_environment" -B"$(BUILD_DIR)/source_archive" \
-DCMAKE_BUILD_TYPE_INIT:STRING=$(BUILD_TYPE) -DPACKAGE_USE_UPSTREAM_SOURCES=OFF
# This assumes CMake is still using a default `PACKAGE_DIR` variable:
python3 ./build_files/utils/make_source_archive.py --include-packages "$(BUILD_DIR)/source_archive/packages"
@$(PYTHON) ./build_files/utils/make_source_archive.py --include-packages "$(BUILD_DIR)/source_archive/packages"
INKSCAPE_BIN?="inkscape"
icons: .FORCE
BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \
@BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
INKSCAPE_BIN=$(INKSCAPE_BIN) \
@INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
INKSCAPE_BIN=$(INKSCAPE_BIN) \
@INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/alert_icons_update.py"
icons_geom: .FORCE
BLENDER_BIN=$(BLENDER_BIN) \
@BLENDER_BIN=$(BLENDER_BIN) \
"$(BLENDER_DIR)/release/datafiles/blender_icons_geom_update.py"
update: .FORCE
$(PYTHON) ./build_files/utils/make_update.py
@$(PYTHON) ./build_files/utils/make_update.py
update_code: .FORCE
$(PYTHON) ./build_files/utils/make_update.py --no-libraries
@$(PYTHON) ./build_files/utils/make_update.py --no-libraries
format: .FORCE
PATH="../lib/${OS_NCASE}_${CPU}/llvm/bin/:../lib/${OS_NCASE}_centos7_${CPU}/llvm/bin/:../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \
$(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
@PATH="${LIBDIR}/llvm/bin/:$(PATH)" $(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
@$(PYTHON) source/tools/utils_maintenance/autopep8_format_paths.py --autopep8-command="$(AUTOPEP8)" $(PATHS)
# -----------------------------------------------------------------------------
@@ -558,25 +571,25 @@ format: .FORCE
# Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation.
doc_py: .FORCE
ASAN_OPTIONS=halt_on_error=0:${ASAN_OPTIONS} \
@ASAN_OPTIONS=halt_on_error=0:${ASAN_OPTIONS} \
$(BLENDER_BIN) \
--background -noaudio --factory-startup \
--python doc/python_api/sphinx_doc_gen.py
sphinx-build -b html -j $(NPROCS) doc/python_api/sphinx-in doc/python_api/sphinx-out
@sphinx-build -b html -j $(NPROCS) doc/python_api/sphinx-in doc/python_api/sphinx-out
@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/index.html'"
doc_doxy: .FORCE
cd doc/doxygen; doxygen Doxyfile
@cd doc/doxygen; doxygen Doxyfile
@echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'"
doc_dna: .FORCE
$(BLENDER_BIN) \
@$(BLENDER_BIN) \
--background -noaudio --factory-startup \
--python doc/blender_file_format/BlendFileDnaExporter_25.py
@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
doc_man: .FORCE
$(PYTHON) doc/manpage/blender.1.py $(BLENDER_BIN) blender.1
@$(PYTHON) doc/manpage/blender.1.py --blender="$(BLENDER_BIN)" --output=blender.1 --verbose
help_features: .FORCE
@$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_print_build_options.py" $(BLENDER_DIR)"/CMakeLists.txt"

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
####################################################################################################
#
@@ -46,8 +30,11 @@ cmake_minimum_required(VERSION 3.5)
include(ExternalProject)
include(cmake/check_software.cmake)
include(cmake/options.cmake)
# versions.cmake needs to be included after options.cmake due to the BLENDER_PLATFORM_ARM variable being needed.
include(cmake/versions.cmake)
include(cmake/boost_build_options.cmake)
include(cmake/download.cmake)
include(cmake/macros.cmake)
if(ENABLE_MINGW64)
include(cmake/setup_mingw64.cmake)
@@ -62,18 +49,16 @@ include(cmake/png.cmake)
include(cmake/jpeg.cmake)
include(cmake/blosc.cmake)
include(cmake/pthreads.cmake)
include(cmake/imath.cmake)
include(cmake/openexr.cmake)
include(cmake/brotli.cmake)
include(cmake/freetype.cmake)
include(cmake/epoxy.cmake)
include(cmake/freeglut.cmake)
include(cmake/glew.cmake)
include(cmake/alembic.cmake)
include(cmake/glfw.cmake)
include(cmake/clew.cmake)
include(cmake/cuew.cmake)
include(cmake/opensubdiv.cmake)
include(cmake/sdl.cmake)
include(cmake/opencollada.cmake)
include(cmake/llvm.cmake)
if(APPLE)
include(cmake/openmp.cmake)
endif()
@@ -90,8 +75,8 @@ endif()
include(cmake/osl.cmake)
include(cmake/tbb.cmake)
include(cmake/openvdb.cmake)
include(cmake/nanovdb.cmake)
include(cmake/python.cmake)
include(cmake/llvm.cmake)
option(USE_PIP_NUMPY "Install NumPy using pip wheel instead of building from source" OFF)
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64"))
set(USE_PIP_NUMPY ON)
@@ -109,12 +94,25 @@ include(cmake/pugixml.cmake)
include(cmake/ispc.cmake)
include(cmake/openimagedenoise.cmake)
include(cmake/embree.cmake)
include(cmake/openpgl.cmake)
include(cmake/fmt.cmake)
include(cmake/robinmap.cmake)
if(NOT APPLE)
include(cmake/xr_openxr.cmake)
if(NOT WIN32 OR BUILD_MODE STREQUAL Release)
include(cmake/dpcpp.cmake)
include(cmake/dpcpp_deps.cmake)
endif()
if(NOT WIN32)
include(cmake/igc.cmake)
include(cmake/gmmlib.cmake)
include(cmake/ocloc.cmake)
endif()
endif()
# OpenColorIO and dependencies.
include(cmake/expat.cmake)
include(cmake/pystring.cmake)
include(cmake/yamlcpp.cmake)
include(cmake/opencolorio.cmake)
@@ -122,8 +120,9 @@ if(BLENDER_PLATFORM_ARM)
include(cmake/sse2neon.cmake)
endif()
if(WITH_WEBP)
include(cmake/webp.cmake)
include(cmake/webp.cmake)
if(NOT APPLE)
include(cmake/level-zero.cmake)
endif()
if(NOT WIN32 OR ENABLE_MINGW64)
@@ -141,6 +140,7 @@ if(NOT WIN32 OR ENABLE_MINGW64)
include(cmake/vpx.cmake)
include(cmake/x264.cmake)
include(cmake/xvidcore.cmake)
include(cmake/aom.cmake)
include(cmake/ffmpeg.cmake)
include(cmake/fftw.cmake)
include(cmake/sndfile.cmake)
@@ -170,6 +170,10 @@ if(UNIX AND NOT APPLE)
include(cmake/libglu.cmake)
include(cmake/mesa.cmake)
include(cmake/wayland_protocols.cmake)
# Can be removed when the build-bot upgrades to v1.20.x or newer.
include(cmake/wayland.cmake)
include(cmake/wayland_libdecor.cmake)
endif()
include(cmake/harvest.cmake)
include(cmake/cve_check.cmake)

View File

@@ -1,46 +1,16 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(ALEMBIC_EXTRA_ARGS
-DBUILDSTATIC=ON
-DLINKSTATIC=ON
-DILMBASE_ROOT=${LIBDIR}/openexr
-DALEMBIC_ILMBASE_INCLUDE_DIRECTORY=${LIBDIR}/openexr/include/OpenEXR
-DALEMBIC_ILMBASE_HALF_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}Half${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DALEMBIC_ILMBASE_IMATH_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}Imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DALEMBIC_ILMBASE_ILMTHREAD_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmThread${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DALEMBIC_ILMBASE_IEX_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DALEMBIC_ILMBASE_IEXMATH_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}IexMath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DUSE_PYILMBASE=0
-DUSE_PYALEMBIC=0
-DUSE_ARNOLD=0
-DUSE_MAYA=0
-DUSE_PRMAN=0
-DUSE_HDF5=Off
-DUSE_STATIC_HDF5=Off
-DUSE_TESTS=Off
-DALEMBIC_NO_OPENGL=1
-DImath_ROOT=${LIBDIR}/imath
-DUSE_PYALEMBIC=OFF
-DUSE_ARNOLD=OFF
-DUSE_MAYA=OFF
-DUSE_PRMAN=OFF
-DUSE_HDF5=OFF
-DUSE_TESTS=OFF
-DUSE_BINARIES=ON
-DALEMBIC_ILMBASE_LINK_STATIC=On
-DALEMBIC_ILMBASE_LINK_STATIC=OFF
-DALEMBIC_SHARED_LIBS=OFF
-DGLUT_INCLUDE_DIR=""
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
)
ExternalProject_Add(external_alembic
@@ -71,6 +41,6 @@ endif()
add_dependencies(
external_alembic
external_zlib
external_openexr
external_imath
)

View File

@@ -0,0 +1,45 @@
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
# The default generator on windows is msbuild, which we do not
# want to use for this dep, as needs to build with mingw
set(AOM_GENERATOR "Ninja")
# The default flags are full of MSVC options given this will be
# building with mingw, it'll have an unhappy time with that and
# we need to clear them out.
set(AOM_CMAKE_FLAGS )
# CMake will correctly identify phreads being available, however
# we do not want to use them, as that gains a dependency on
# libpthreadswin.dll which we do not want. when pthreads is not
# available oam will use a pthreads emulation layer using win32 threads
set(AOM_EXTRA_ARGS_WIN32 -DCMAKE_HAVE_PTHREAD_H=OFF)
else()
set(AOM_GENERATOR "Unix Makefiles")
set(AOM_CMAKE_FLAGS ${DEFAULT_CMAKE_FLAGS})
endif()
set(AOM_EXTRA_ARGS
-DENABLE_TESTDATA=OFF
-DENABLE_TESTS=OFF
-DENABLE_TOOLS=OFF
-DENABLE_EXAMPLES=OFF
${AOM_EXTRA_ARGS_WIN32}
)
# This is slightly different from all other deps in the way that
# aom uses cmake as a build system, but still needs the environment setup
# to include perl so we manually setup the environment and call
# cmake directly for the configure, build and install commands.
ExternalProject_Add(external_aom
URL file://${PACKAGE_DIR}/${AOM_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${AOM_HASH_TYPE}=${AOM_HASH}
PREFIX ${BUILD_DIR}/aom
CONFIGURE_COMMAND ${CONFIGURE_ENV} &&
cd ${BUILD_DIR}/aom/src/external_aom-build/ &&
${CMAKE_COMMAND} -G "${AOM_GENERATOR}" -DCMAKE_INSTALL_PREFIX=${LIBDIR}/aom ${AOM_CMAKE_FLAGS} ${AOM_EXTRA_ARGS} ${BUILD_DIR}/aom/src/external_aom/
BUILD_COMMAND ${CMAKE_COMMAND} --build .
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install
INSTALL_DIR ${LIBDIR}/aom
)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(BLOSC_EXTRA_ARGS
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
@@ -40,7 +24,6 @@ ExternalProject_Add(external_blosc
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${BLOSC_HASH_TYPE}=${BLOSC_HASH}
PREFIX ${BUILD_DIR}/blosc
PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/blosc/src/external_blosc < ${PATCH_DIR}/blosc.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/blosc ${DEFAULT_CMAKE_FLAGS} ${BLOSC_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/blosc
)

View File

@@ -1,33 +1,6 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
set(BOOST_ADDRESS_MODEL 64)
if(BLENDER_PLATFORM_ARM)
set(BOOST_ARCHITECTURE arm)
else()
set(BOOST_ARCHITECTURE x86)
endif()
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(BOOST_TOOLSET toolset=msvc-14.1)
set(BOOST_COMPILER_STRING -vc141)
set(BOOST_CONFIGURE_COMMAND bootstrap.bat)
set(BOOST_BUILD_COMMAND b2)
set(BOOST_BUILD_OPTIONS runtime-link=shared )
@@ -47,11 +20,6 @@ else()
set(BOOST_BUILD_COMMAND ./b2)
set(BOOST_BUILD_OPTIONS cxxflags=${PLATFORM_CXXFLAGS} --disable-icu boost.locale.icu=off)
set(BOOST_PATCH_COMMAND echo .)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(BOOST_ADDRESS_MODEL 64)
else()
set(BOOST_ADDRESS_MODEL 32)
endif()
endif()
if(WITH_BOOST_PYTHON)

View File

@@ -0,0 +1,30 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(BOOST_ADDRESS_MODEL 64)
if(BLENDER_PLATFORM_ARM)
set(BOOST_ARCHITECTURE arm)
else()
set(BOOST_ARCHITECTURE x86)
endif()
if(WIN32)
if(MSVC_VERSION GREATER_EQUAL 1920) # 2019
set(BOOST_TOOLSET toolset=msvc-14.2)
set(BOOST_COMPILER_STRING -vc142)
else() # 2017
set(BOOST_TOOLSET toolset=msvc-14.1)
set(BOOST_COMPILER_STRING -vc141)
endif()
endif()
set(DEFAULT_BOOST_FLAGS
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
-DBoost_USE_MULTITHREADED=ON
-DBoost_USE_STATIC_LIBS=ON
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
-DBoost_ADDITIONAL_VERSIONS=${BOOST_VERSION_SHORT}
-DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/
)

View File

@@ -0,0 +1,22 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(BROTLI_EXTRA_ARGS
)
ExternalProject_Add(external_brotli
URL file://${PACKAGE_DIR}/${BROTLI_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${BROTLI_HASH_TYPE}=${BROTLI_HASH}
PREFIX ${BUILD_DIR}/brotli
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/brotli ${DEFAULT_CMAKE_FLAGS} ${BROTLI_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/brotli
)
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_brotli after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/brotli/include ${HARVEST_TARGET}/brotli/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/brotli/lib/brotlidec-static${LIBEXT} ${HARVEST_TARGET}/brotli/lib/brotlidec-static${LIBEXT}
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/brotli/lib/brotlicommon-static${LIBEXT} ${HARVEST_TARGET}/brotli/lib/brotlicommon-static${LIBEXT}
DEPENDEES install
)
endif()

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(BZIP2_PREFIX "${LIBDIR}/bzip2")
set(BZIP2_CONFIGURE_ENV echo .)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(UNIX)
if(APPLE)
@@ -28,21 +12,13 @@ if(UNIX)
automake
bison
${_libtoolize_name}
meson
ninja
pkg-config
tclsh
yasm
)
if(NOT APPLE)
set(_required_software
${_required_software}
# Needed for Mesa.
meson
ninja
)
endif()
foreach(_software ${_required_software})
find_program(_software_find NAMES ${_software})
if(NOT _software_find)
@@ -70,13 +46,10 @@ if(UNIX)
" ${_software_missing}\n"
"\n"
"On Debian and Ubuntu:\n"
" apt install autoconf automake libtool yasm tcl ninja-build meson python3-mako\n"
" apt install autoconf automake bison libtool yasm tcl ninja-build meson python3-mako\n"
"\n"
"On macOS Intel (with homebrew):\n"
" brew install autoconf automake bison libtool pkg-config yasm\n"
"\n"
"On macOS ARM (with homebrew):\n"
" brew install autoconf automake bison flex libtool pkg-config yasm\n"
"On macOS (with homebrew):\n"
" brew install autoconf automake bison flex libtool meson ninja pkg-config yasm\n"
"\n"
"Other platforms:\n"
" Install equivalent packages.\n")

View File

@@ -1,28 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
set(CLEW_EXTRA_ARGS)
ExternalProject_Add(external_clew
URL file://${PACKAGE_DIR}/${CLEW_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${CLEW_HASH_TYPE}=${CLEW_HASH}
PREFIX ${BUILD_DIR}/clew
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/clew -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${CLEW_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/clew
)

View File

@@ -1,29 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
set(CUEW_EXTRA_ARGS)
ExternalProject_Add(external_cuew
URL file://${PACKAGE_DIR}/${CUEW_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${CUEW_HASH_TYPE}=${CUEW_HASH}
PREFIX ${BUILD_DIR}/cuew
PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/cuew/src/external_cuew < ${PATCH_DIR}/cuew.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/cuew -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${CUEW_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/cuew
)

View File

@@ -0,0 +1,73 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# CVE Check requirements
#
# - A working installation of intels cve-bin-tool [1] has to be available in
# your path
#
# - Not strictly required, but highly recommended is obtaining a NVD key from
# nist since it significantly speeds up downloading/updating the required
# databases one can request a key on the following website:
# https://nvd.nist.gov/developers/request-an-api-key
# Bill of Materials construction
#
# This constructs a CSV cve-bin-tool [1] can read and process. Sadly
# cve-bin-tool at this point does not take a list of CPE's and output a check
# based on that list. so we need to pick apart the CPE retrieve the vendor,
# product and version tokens and generate a CSV.
#
# [1] https://github.com/intel/cve-bin-tool
# Because not all deps are downloaded (ie python packages) but can still have a
# xxx_CPE declared loop over all variables and look for variables ending in CPE.
set(SBOMCONTENTS)
get_cmake_property(_variableNames VARIABLES)
foreach (_variableName ${_variableNames})
if(_variableName MATCHES "CPE$")
string(REPLACE ":" ";" CPE_LIST ${${_variableName}})
list(GET CPE_LIST 3 CPE_VENDOR)
list(GET CPE_LIST 4 CPE_NAME)
list(GET CPE_LIST 5 CPE_VERSION)
set(SBOMCONTENTS "${SBOMCONTENTS}${CPE_VENDOR},${CPE_NAME},${CPE_VERSION}\n")
endif()
endforeach()
configure_file(${CMAKE_SOURCE_DIR}/cmake/cve_check.csv.in ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv @ONLY)
# Custom Targets
#
# This defines two new custom targets one could run in the build folder
# `cve_check` which will output the report to the console, and `cve_check_html`
# which will write out blender_dependencies.html in the build folder that one
# could share with other people or be used to get more information on the
# reported CVE's.
#
# cve-bin-tool takes data from the nist nvd database which rate limits
# unauthenticated requests to 1 requests per 6 seconds making the database
# download take "quite a bit" of time.
#
# When adding -DCVE_CHECK_NVD_KEY=your_api_key_here to your cmake invocation
# this key will be passed on to cve-bin-tool speeding up the process.
#
if(DEFINED CVE_CHECK_NVD_KEY)
set(NVD_ARGS --nvd-api-key ${CVE_CHECK_NVD_KEY})
endif()
# This will just report to the console
add_custom_target(cve_check
COMMAND cve-bin-tool
${NVD_ARGS}
-i ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv
--affected-versions
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv
)
# This will write out blender_dependencies.html
add_custom_target(cve_check_html
COMMAND cve-bin-tool
${NVD_ARGS}
-i ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv
-f html
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv
)

View File

@@ -0,0 +1,2 @@
vendor,product,version
@SBOMCONTENTS@

View File

@@ -1,12 +1,33 @@
# SPDX-License-Identifier: GPL-2.0-or-later
## Update and uncomment this in the release branch
# set(BLENDER_VERSION 3.1)
function(download_source dep)
set(TARGET_FILE ${${dep}_FILE})
set(TARGET_HASH_TYPE ${${dep}_HASH_TYPE})
set(TARGET_HASH ${${dep}_HASH})
if(PACKAGE_USE_UPSTREAM_SOURCES)
set(TARGET_URI ${${dep}_URI})
elseif(BLENDER_VERSION)
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/tags/blender-${BLENDER_VERSION}-release/lib/packages/${TARGET_FILE})
else()
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/trunk/lib/packages/${TARGET_FILE})
endif()
# Validate all required variables are set and give an explicit error message
# rather than CMake erroring out later on with a more ambigious error.
if (NOT DEFINED TARGET_FILE)
message(FATAL_ERROR "${dep}_FILE variable not set")
endif()
if (NOT DEFINED TARGET_HASH)
message(FATAL_ERROR "${dep}_HASH variable not set")
endif()
if (NOT DEFINED TARGET_HASH_TYPE)
message(FATAL_ERROR "${dep}_HASH_TYPE variable not set")
endif()
if (NOT DEFINED TARGET_URI)
message(FATAL_ERROR "${dep}_URI variable not set")
endif()
set(TARGET_FILE ${PACKAGE_DIR}/${TARGET_FILE})
message("Checking source : ${dep} (${TARGET_FILE})")
if(NOT EXISTS ${TARGET_FILE})
@@ -18,6 +39,36 @@ function(download_source dep)
SHOW_PROGRESS
)
endif()
if(EXISTS ${TARGET_FILE})
# Sometimes the download fails, but that is not a
# fail condition for "file(DOWNLOAD" it will warn about
# a crc mismatch and just carry on, we need to explicitly
# catch this and remove the bogus 0 byte file so we can
# retry without having to go find the file and manually
# delete it.
file (SIZE ${TARGET_FILE} TARGET_SIZE)
if(${TARGET_SIZE} EQUAL 0)
file(REMOVE ${TARGET_FILE})
message(FATAL_ERROR "for ${TARGET_FILE} file size 0, download likely failed, deleted...")
endif()
# If we are using sources from the blender repo also
# validate that the hashes match, this takes a
# little more time, but protects us when we are
# building a release package and one of the packages
# is missing or incorrect.
#
# For regular platform maintenaince this is not needed
# since the actual build of the dep will notify the
# platform maintainer if there is a problem with the
# source package and refuse to build.
if(NOT PACKAGE_USE_UPSTREAM_SOURCES)
file(${TARGET_HASH_TYPE} ${TARGET_FILE} LOCAL_HASH)
if(NOT ${TARGET_HASH} STREQUAL ${LOCAL_HASH})
message(FATAL_ERROR "${TARGET_FILE} ${TARGET_HASH_TYPE} mismatch\nExpected\t: ${TARGET_HASH}\nActual\t: ${LOCAL_HASH}")
endif()
endif()
endif()
endfunction(download_source)
download_source(ZLIB)
@@ -29,13 +80,9 @@ download_source(BLOSC)
download_source(PTHREADS)
download_source(OPENEXR)
download_source(FREETYPE)
download_source(GLEW)
download_source(EPOXY)
download_source(FREEGLUT)
download_source(ALEMBIC)
download_source(GLFW)
download_source(CLEW)
download_source(GLFW)
download_source(CUEW)
download_source(OPENSUBDIV)
download_source(SDL)
download_source(OPENCOLLADA)
@@ -48,7 +95,6 @@ download_source(OSL)
download_source(PYTHON)
download_source(TBB)
download_source(OPENVDB)
download_source(NANOVDB)
download_source(NUMPY)
download_source(LAME)
download_source(OGG)
@@ -64,9 +110,7 @@ download_source(FFMPEG)
download_source(FFTW)
download_source(ICONV)
download_source(SNDFILE)
if(WITH_WEBP)
download_source(WEBP)
endif()
download_source(WEBP)
download_source(SPNAV)
download_source(JEMALLOC)
download_source(XML2)
@@ -88,9 +132,35 @@ download_source(MESA)
download_source(NASM)
download_source(XR_OPENXR_SDK)
download_source(WL_PROTOCOLS)
download_source(WAYLAND)
download_source(WAYLAND_LIBDECOR)
download_source(ISPC)
download_source(GMP)
download_source(POTRACE)
download_source(HARU)
download_source(ZSTD)
download_source(SSE2NEON)
download_source(FLEX)
download_source(BROTLI)
download_source(FMT)
download_source(ROBINMAP)
download_source(IMATH)
download_source(PYSTRING)
download_source(OPENPGL)
download_source(LEVEL_ZERO)
download_source(DPCPP)
download_source(VCINTRINSICS)
download_source(OPENCLHEADERS)
download_source(ICDLOADER)
download_source(MP11)
download_source(SPIRV_HEADERS)
download_source(IGC)
download_source(IGC_LLVM)
download_source(IGC_OPENCL_CLANG)
download_source(IGC_VCINTRINSICS)
download_source(IGC_SPIRV_HEADERS)
download_source(IGC_SPIRV_TOOLS)
download_source(IGC_SPIRV_TRANSLATOR)
download_source(GMMLIB)
download_source(OCLOC)
download_source(AOM)

View File

@@ -0,0 +1,109 @@
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(LLVM_GENERATOR "Ninja")
else()
set(LLVM_GENERATOR "Unix Makefiles")
endif()
set(DPCPP_CONFIGURE_ARGS
# When external deps dpcpp needs are not found it will automatically
# download the during the configure stage using FetchContent. Given
# we need to keep an archive of all source used during build for compliance
# reasons it CANNOT download anything we do not know about. By setting
# this property to ON, all downloads are disabled, and we will have to
# provide the missing deps some other way, a build error beats a compliance
# violation
--cmake-opt FETCHCONTENT_FULLY_DISCONNECTED=ON
)
set(DPCPP_SOURCE_ROOT ${BUILD_DIR}/dpcpp/src/external_dpcpp/)
set(DPCPP_EXTRA_ARGS
# When external deps dpcpp needs are not found it will automatically
# download the during the configure stage using FetchContent. Given
# we need to keep an archive of all source used during build for compliance
# reasons it CANNOT download anything we do not know about. By setting
# this property to ON, all downloads are disabled, and we will have to
# provide the missing deps some other way, a build or configure error
# beats a compliance violation
-DFETCHCONTENT_FULLY_DISCONNECTED=ON
-DLLVMGenXIntrinsics_SOURCE_DIR=${BUILD_DIR}/vcintrinsics/src/external_vcintrinsics/
-DOpenCL_HEADERS=file://${PACKAGE_DIR}/${OPENCLHEADERS_FILE}
-DOpenCL_LIBRARY_SRC=file://${PACKAGE_DIR}/${ICDLOADER_FILE}
-DBOOST_MP11_SOURCE_DIR=${BUILD_DIR}/mp11/src/external_mp11/
-DLEVEL_ZERO_LIBRARY=${LIBDIR}/level-zero/lib/${LIBPREFIX}ze_loader${SHAREDLIBEXT}
-DLEVEL_ZERO_INCLUDE_DIR=${LIBDIR}/level-zero/include
-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${BUILD_DIR}/spirvheaders/src/external_spirvheaders/
# Below here is copied from an invocation of buildbot/config.py
-DLLVM_ENABLE_ASSERTIONS=ON
-DLLVM_TARGETS_TO_BUILD=X86
-DLLVM_EXTERNAL_PROJECTS=sycl^^llvm-spirv^^opencl^^libdevice^^xpti^^xptifw
-DLLVM_EXTERNAL_SYCL_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/sycl
-DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/llvm-spirv
-DLLVM_EXTERNAL_XPTI_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/xpti
-DXPTI_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/xpti
-DLLVM_EXTERNAL_XPTIFW_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/xptifw
-DLLVM_EXTERNAL_LIBDEVICE_SOURCE_DIR=${DPCPP_SOURCE_ROOT}/libdevice
-DLLVM_ENABLE_PROJECTS=clang^^sycl^^llvm-spirv^^opencl^^libdevice^^xpti^^xptifw
-DLIBCLC_TARGETS_TO_BUILD=
-DLIBCLC_GENERATE_REMANGLED_VARIANTS=OFF
-DSYCL_BUILD_PI_HIP_PLATFORM=AMD
-DLLVM_BUILD_TOOLS=ON
-DSYCL_ENABLE_WERROR=OFF
-DSYCL_INCLUDE_TESTS=ON
-DLLVM_ENABLE_DOXYGEN=OFF
-DLLVM_ENABLE_SPHINX=OFF
-DBUILD_SHARED_LIBS=OFF
-DSYCL_ENABLE_XPTI_TRACING=ON
-DLLVM_ENABLE_LLD=OFF
-DXPTI_ENABLE_WERROR=OFF
-DSYCL_CLANG_EXTRA_FLAGS=
-DSYCL_ENABLE_PLUGINS=level_zero
-DCMAKE_INSTALL_RPATH=\$ORIGIN
-DPython3_ROOT_DIR=${LIBDIR}/python/
-DPython3_EXECUTABLE=${PYTHON_BINARY}
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
-DLLDB_ENABLE_CURSES=OFF
-DLLVM_ENABLE_TERMINFO=OFF
)
if(WIN32)
list(APPEND DPCPP_EXTRA_ARGS -DPython3_FIND_REGISTRY=NEVER)
endif()
ExternalProject_Add(external_dpcpp
URL file://${PACKAGE_DIR}/${DPCPP_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${DPCPP_HASH_TYPE}=${DPCPP_HASH}
PREFIX ${BUILD_DIR}/dpcpp
CMAKE_GENERATOR ${LLVM_GENERATOR}
SOURCE_SUBDIR llvm
LIST_SEPARATOR ^^
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/dpcpp ${DEFAULT_CMAKE_FLAGS} ${DPCPP_EXTRA_ARGS}
#CONFIGURE_COMMAND ${PYTHON_BINARY} ${BUILD_DIR}/dpcpp/src/external_dpcpp/buildbot/configure.py ${DPCPP_CONFIGURE_ARGS}
#BUILD_COMMAND echo "." #${PYTHON_BINARY} ${BUILD_DIR}/dpcpp/src/external_dpcpp/buildbot/compile.py
INSTALL_COMMAND ${CMAKE_COMMAND} --build . -- deploy-sycl-toolchain
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/dpcpp/src/external_dpcpp < ${PATCH_DIR}/dpcpp.diff
INSTALL_DIR ${LIBDIR}/dpcpp
)
add_dependencies(
external_dpcpp
external_python
external_python_site_packages
external_vcintrinsics
external_openclheaders
external_icdloader
external_mp11
external_level-zero
external_spirvheaders
)
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_dpcpp after_install
COMMAND ${CMAKE_COMMAND} -E rm -f ${LIBDIR}/dpcpp/bin/clang-cl.exe
COMMAND ${CMAKE_COMMAND} -E rm -f ${LIBDIR}/dpcpp/bin/clang-cpp.exe
COMMAND ${CMAKE_COMMAND} -E rm -f ${LIBDIR}/dpcpp/bin/clang.exe
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/dpcpp ${HARVEST_TARGET}/dpcpp
)
endif()

View File

@@ -0,0 +1,61 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# These are build time requirements for dpcpp
# We only have to unpack these dpcpp will build
# them.
ExternalProject_Add(external_vcintrinsics
URL file://${PACKAGE_DIR}/${VCINTRINSICS_FILE}
URL_HASH ${VCINTRINSICS_HASH_TYPE}=${VCINTRINSICS_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/vcintrinsics
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)
# opencl headers do not have to be unpacked, dpcpp will do it
# but it wouldn't hurt to do it anyway as an opertunity to validate
# the hash is correct.
ExternalProject_Add(external_openclheaders
URL file://${PACKAGE_DIR}/${OPENCLHEADERS_FILE}
URL_HASH ${OPENCLHEADERS_HASH_TYPE}=${OPENCLHEADERS_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/openclheaders
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)
# icdloader does not have to be unpacked, dpcpp will do it
# but it wouldn't hurt to do it anyway as an opertunity to validate
# the hash is correct.
ExternalProject_Add(external_icdloader
URL file://${PACKAGE_DIR}/${ICDLOADER_FILE}
URL_HASH ${ICDLOADER_HASH_TYPE}=${ICDLOADER_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/icdloader
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)
ExternalProject_Add(external_mp11
URL file://${PACKAGE_DIR}/${MP11_FILE}
URL_HASH ${MP11_HASH_TYPE}=${MP11_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/mp11
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)
ExternalProject_Add(external_spirvheaders
URL file://${PACKAGE_DIR}/${SPIRV_HEADERS_FILE}
URL_HASH ${SPIRV_HEADERS_HASH_TYPE}=${SPIRV_HEADERS_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/spirvheaders
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
# Note the utility apps may use png/tiff/gif system libraries, but the
# library itself does not depend on them, so should give no problems.
@@ -26,53 +10,33 @@ set(EMBREE_EXTRA_ARGS
-DEMBREE_RAY_MASK=ON
-DEMBREE_FILTER_FUNCTION=ON
-DEMBREE_BACKFACE_CULLING=OFF
-DEMBREE_MAX_ISA=AVX2
-DEMBREE_TASKING_SYSTEM=TBB
-DEMBREE_TBB_ROOT=${LIBDIR}/tbb
-DTBB_ROOT=${LIBDIR}/tbb
-DTBB_STATIC_LIB=${TBB_STATIC_LIBRARY}
)
if (NOT BLENDER_PLATFORM_ARM)
set(EMBREE_EXTRA_ARGS
${EMBREE_EXTRA_ARGS}
-DEMBREE_MAX_ISA=AVX2)
endif()
if(TBB_STATIC_LIBRARY)
set(EMBREE_EXTRA_ARGS
${EMBREE_EXTRA_ARGS}
-DEMBREE_TBB_LIBRARY_NAME=tbb_static
-DEMBREE_TBBMALLOC_LIBRARY_NAME=tbbmalloc_static
-DEMBREE_TBB_COMPONENT=tbb_static
)
endif()
if(WIN32)
set(EMBREE_BUILD_DIR ${BUILD_MODE}/)
if(BUILD_MODE STREQUAL Debug)
list(APPEND EMBREE_EXTRA_ARGS
-DEMBREE_TBBMALLOC_LIBRARY_NAME=tbbmalloc_debug
-DEMBREE_TBB_LIBRARY_NAME=tbb_debug
)
endif()
else()
set(EMBREE_BUILD_DIR)
endif()
if(BLENDER_PLATFORM_ARM)
ExternalProject_Add(external_embree
GIT_REPOSITORY ${EMBREE_ARM_GIT}
GIT_TAG "blender-arm"
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/embree
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/embree ${DEFAULT_CMAKE_FLAGS} ${EMBREE_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/embree
)
else()
ExternalProject_Add(external_embree
URL file://${PACKAGE_DIR}/${EMBREE_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${EMBREE_HASH_TYPE}=${EMBREE_HASH}
PREFIX ${BUILD_DIR}/embree
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/embree/src/external_embree < ${PATCH_DIR}/embree.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/embree ${DEFAULT_CMAKE_FLAGS} ${EMBREE_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/embree
)
endif()
ExternalProject_Add(external_embree
URL file://${PACKAGE_DIR}/${EMBREE_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${EMBREE_HASH_TYPE}=${EMBREE_HASH}
PREFIX ${BUILD_DIR}/embree
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/embree/src/external_embree < ${PATCH_DIR}/embree.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/embree ${DEFAULT_CMAKE_FLAGS} ${EMBREE_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/embree
)
add_dependencies(
external_embree

View File

@@ -0,0 +1,25 @@
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(EPOXY_LIB_TYPE shared)
else()
set(EPOXY_LIB_TYPE static)
endif()
ExternalProject_Add(external_epoxy
URL file://${PACKAGE_DIR}/${EPOXY_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${EPOXY_HASH_TYPE}=${EPOXY_HASH}
PREFIX ${BUILD_DIR}/epoxy
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/epoxy/src/external_epoxy/ < ${PATCH_DIR}/epoxy.diff
CONFIGURE_COMMAND ${CONFIGURE_ENV} && meson setup --prefix ${LIBDIR}/epoxy --default-library ${EPOXY_LIB_TYPE} --libdir lib ${BUILD_DIR}/epoxy/src/external_epoxy-build ${BUILD_DIR}/epoxy/src/external_epoxy -Dtests=false
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
)
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_epoxy after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/epoxy/include ${HARVEST_TARGET}/epoxy/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/epoxy/bin/epoxy-0.dll ${HARVEST_TARGET}/epoxy/bin/epoxy-0.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/epoxy/lib/epoxy.lib ${HARVEST_TARGET}/epoxy/lib/epoxy.lib
DEPENDEES install
)
endif()

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(EXPAT_EXTRA_ARGS
-DEXPAT_BUILD_DOCS=OFF

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_ffi
URL file://${PACKAGE_DIR}/${FFI_FILE}

View File

@@ -1,25 +1,9 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(FFMPEG_CFLAGS "-I${mingw_LIBDIR}/lame/include -I${mingw_LIBDIR}/openjpeg/include/ -I${mingw_LIBDIR}/ogg/include -I${mingw_LIBDIR}/vorbis/include -I${mingw_LIBDIR}/theora/include -I${mingw_LIBDIR}/opus/include -I${mingw_LIBDIR}/vpx/include -I${mingw_LIBDIR}/x264/include -I${mingw_LIBDIR}/xvidcore/include -I${mingw_LIBDIR}/zlib/include")
set(FFMPEG_LDFLAGS "-L${mingw_LIBDIR}/lame/lib -L${mingw_LIBDIR}/openjpeg/lib -L${mingw_LIBDIR}/ogg/lib -L${mingw_LIBDIR}/vorbis/lib -L${mingw_LIBDIR}/theora/lib -L${mingw_LIBDIR}/opus/lib -L${mingw_LIBDIR}/vpx/lib -L${mingw_LIBDIR}/x264/lib -L${mingw_LIBDIR}/xvidcore/lib -L${mingw_LIBDIR}/zlib/lib")
set(FFMPEG_CFLAGS "-I${mingw_LIBDIR}/lame/include -I${mingw_LIBDIR}/openjpeg/include/ -I${mingw_LIBDIR}/ogg/include -I${mingw_LIBDIR}/vorbis/include -I${mingw_LIBDIR}/theora/include -I${mingw_LIBDIR}/opus/include -I${mingw_LIBDIR}/vpx/include -I${mingw_LIBDIR}/x264/include -I${mingw_LIBDIR}/xvidcore/include -I${mingw_LIBDIR}/zlib/include -I${mingw_LIBDIR}/aom/include")
set(FFMPEG_LDFLAGS "-L${mingw_LIBDIR}/lame/lib -L${mingw_LIBDIR}/openjpeg/lib -L${mingw_LIBDIR}/ogg/lib -L${mingw_LIBDIR}/vorbis/lib -L${mingw_LIBDIR}/theora/lib -L${mingw_LIBDIR}/opus/lib -L${mingw_LIBDIR}/vpx/lib -L${mingw_LIBDIR}/x264/lib -L${mingw_LIBDIR}/xvidcore/lib -L${mingw_LIBDIR}/zlib/lib -L${mingw_LIBDIR}/aom/lib")
set(FFMPEG_EXTRA_FLAGS --pkg-config-flags=--static --extra-cflags=${FFMPEG_CFLAGS} --extra-ldflags=${FFMPEG_LDFLAGS})
set(FFMPEG_ENV PKG_CONFIG_PATH=${mingw_LIBDIR}/openjpeg/lib/pkgconfig:${mingw_LIBDIR}/x264/lib/pkgconfig:${mingw_LIBDIR}/vorbis/lib/pkgconfig:${mingw_LIBDIR}/ogg/lib/pkgconfig:${mingw_LIBDIR}:${mingw_LIBDIR}/vpx/lib/pkgconfig:${mingw_LIBDIR}/theora/lib/pkgconfig:${mingw_LIBDIR}/openjpeg/lib/pkgconfig:${mingw_LIBDIR}/opus/lib/pkgconfig:)
set(FFMPEG_ENV PKG_CONFIG_PATH=${mingw_LIBDIR}/openjpeg/lib/pkgconfig:${mingw_LIBDIR}/x264/lib/pkgconfig:${mingw_LIBDIR}/vorbis/lib/pkgconfig:${mingw_LIBDIR}/ogg/lib/pkgconfig:${mingw_LIBDIR}:${mingw_LIBDIR}/vpx/lib/pkgconfig:${mingw_LIBDIR}/theora/lib/pkgconfig:${mingw_LIBDIR}/openjpeg/lib/pkgconfig:${mingw_LIBDIR}/opus/lib/pkgconfig:${mingw_LIBDIR}/aom/lib/pkgconfig:)
if(WIN32)
set(FFMPEG_ENV set ${FFMPEG_ENV} &&)
@@ -95,6 +79,7 @@ ExternalProject_Add(external_ffmpeg
--disable-librtmp
--enable-libx264
--enable-libxvid
--enable-libaom
--disable-libopencore-amrnb
--disable-libopencore-amrwb
--disable-libdc1394
@@ -141,6 +126,7 @@ add_dependencies(
external_vorbis
external_ogg
external_lame
external_aom
)
if(WIN32)
add_dependencies(

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(FFTW_EXTRA_ARGS)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_flac
URL file://${PACKAGE_DIR}/${FLAC_FILE}

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_flex
URL file://${PACKAGE_DIR}/${FLEX_FILE}

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(FLEXBISON_EXTRA_ARGS)

View File

@@ -0,0 +1,14 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(FMT_EXTRA_ARGS
-DFMT_TEST=Off
)
ExternalProject_Add(external_fmt
URL file://${PACKAGE_DIR}/${FMT_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${FMT_HASH_TYPE}=${FMT_HASH}
PREFIX ${BUILD_DIR}/fmt
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/fmt ${DEFAULT_CMAKE_FLAGS} ${FMT_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/fmt
)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
if(BUILD_MODE STREQUAL Release)

View File

@@ -1,31 +1,15 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(FREETYPE_EXTRA_ARGS
-DCMAKE_RELEASE_POSTFIX:STRING=2ST
-DCMAKE_DEBUG_POSTFIX:STRING=2ST_d
-DWITH_BZip2=OFF
-DWITH_HarfBuzz=OFF
-DFT_WITH_HARFBUZZ=OFF
-DFT_WITH_BZIP2=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE
-DCMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE
-DCMAKE_DISABLE_FIND_PACKAGE_BrotliDec=TRUE)
-DFT_DISABLE_BZIP2=ON
-DFT_DISABLE_HARFBUZZ=ON
-DFT_DISABLE_PNG=ON
-DFT_REQUIRE_BROTLI=ON
-DPC_BROTLIDEC_INCLUDEDIR=${LIBDIR}/brotli/include
-DPC_BROTLIDEC_LIBDIR=${LIBDIR}/brotli/lib
)
ExternalProject_Add(external_freetype
URL file://${PACKAGE_DIR}/${FREETYPE_FILE}
@@ -36,6 +20,11 @@ ExternalProject_Add(external_freetype
INSTALL_DIR ${LIBDIR}/freetype
)
add_dependencies(
external_freetype
external_brotli
)
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_freetype after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freetype ${HARVEST_TARGET}/freetype

View File

@@ -1,32 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
set(GLEW_EXTRA_ARGS
-DBUILD_UTILS=Off
-DBUILD_SHARED_LIBS=Off
)
ExternalProject_Add(external_glew
URL file://${PACKAGE_DIR}/${GLEW_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${GLEW_HASH_TYPE}=${GLEW_HASH}
PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E copy ${PATCH_DIR}/cmakelists_glew.txt ${BUILD_DIR}/glew/src/external_glew/CMakeLists.txt
PREFIX ${BUILD_DIR}/glew
CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=${LIBDIR}/glew ${DEFAULT_CMAKE_FLAGS} ${GLEW_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/glew
)

View File

@@ -1,28 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
set(GLFW_EXTRA_ARGS)
ExternalProject_Add(external_glfw
URL file://${PACKAGE_DIR}/${GLFW_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${GLFW_HASH_TYPE}=${GLFW_HASH}
PREFIX ${BUILD_DIR}/glfw
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/glfw -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${GLFW_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/glfw
)

View File

@@ -0,0 +1,13 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(GMMLIB_EXTRA_ARGS
)
ExternalProject_Add(external_gmmlib
URL file://${PACKAGE_DIR}/${GMMLIB_FILE}
URL_HASH ${GMMLIB_HASH_TYPE}=${GMMLIB_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/gmmlib
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/gmmlib ${DEFAULT_CMAKE_FLAGS} ${GMMLIB_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/gmmlib
)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(GMP_EXTRA_ARGS -enable-cxx)
@@ -38,13 +22,6 @@ elseif(UNIX AND NOT APPLE)
)
endif()
if(BLENDER_PLATFORM_ARM)
set(GMP_OPTIONS
${GMP_OPTIONS}
--disable-assembly
)
endif()
ExternalProject_Add(external_gmp
URL file://${PACKAGE_DIR}/${GMP_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(HARU_EXTRA_ARGS
-DLIBHPDF_SHARED=OFF

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
########################################################################
# Copy all generated files to the proper structure as blender prefers
@@ -27,178 +11,194 @@ message("HARVEST_TARGET = ${HARVEST_TARGET}")
if(WIN32)
if(BUILD_MODE STREQUAL Release)
add_custom_target(Harvest_Release_Results
COMMAND # jpeg rename libfile + copy include
${CMAKE_COMMAND} -E copy ${LIBDIR}/jpg/lib/jpeg-static.lib ${HARVEST_TARGET}/jpeg/lib/libjpeg.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpg/include/ ${HARVEST_TARGET}/jpeg/include/ &&
# png
${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib ${HARVEST_TARGET}/png/lib/libpng.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/ &&
# freeglut-> opengl
${CMAKE_COMMAND} -E copy ${LIBDIR}/freeglut/lib/freeglut_static.lib ${HARVEST_TARGET}/opengl/lib/freeglut_static.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freeglut/include/ ${HARVEST_TARGET}/opengl/include/ &&
# glew-> opengl
${CMAKE_COMMAND} -E copy ${LIBDIR}/glew/lib/libglew32.lib ${HARVEST_TARGET}/opengl/lib/glew.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/glew/include/ ${HARVEST_TARGET}/opengl/include/ &&
# tiff
${CMAKE_COMMAND} -E copy ${LIBDIR}/tiff/lib/tiff.lib ${HARVEST_TARGET}/tiff/lib/libtiff.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tiff/include/ ${HARVEST_TARGET}/tiff/include/
DEPENDS
)
endif()
else(WIN32)
function(harvest from to)
set(pattern "")
foreach(f ${ARGN})
set(pattern ${f})
endforeach()
if(pattern STREQUAL "")
get_filename_component(dirpath ${to} DIRECTORY)
get_filename_component(filename ${to} NAME)
install(
FILES ${LIBDIR}/${from}
DESTINATION ${HARVEST_TARGET}/${dirpath}
RENAME ${filename})
else()
install(
DIRECTORY ${LIBDIR}/${from}/
DESTINATION ${HARVEST_TARGET}/${to}
USE_SOURCE_PERMISSIONS
FILES_MATCHING PATTERN ${pattern}
PATTERN "pkgconfig" EXCLUDE
PATTERN "cmake" EXCLUDE
PATTERN "__pycache__" EXCLUDE
PATTERN "tests" EXCLUDE)
if(BUILD_MODE STREQUAL Release)
add_custom_target(Harvest_Release_Results
COMMAND # jpeg rename libfile + copy include
${CMAKE_COMMAND} -E copy ${LIBDIR}/jpeg/lib/jpeg-static.lib ${HARVEST_TARGET}/jpeg/lib/libjpeg.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpeg/include/ ${HARVEST_TARGET}/jpeg/include/ &&
# png
${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib ${HARVEST_TARGET}/png/lib/libpng.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/ &&
# freeglut-> opengl
${CMAKE_COMMAND} -E copy ${LIBDIR}/freeglut/lib/freeglut_static.lib ${HARVEST_TARGET}/opengl/lib/freeglut_static.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freeglut/include/ ${HARVEST_TARGET}/opengl/include/ &&
DEPENDS
)
endif()
endfunction()
harvest(alembic/include alembic/include "*.h")
harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a)
harvest(alembic/bin alembic/bin "*")
harvest(boost/include boost/include "*")
harvest(boost/lib boost/lib "*.a")
harvest(ffmpeg/include ffmpeg/include "*.h")
harvest(ffmpeg/lib ffmpeg/lib "*.a")
harvest(fftw3/include fftw3/include "*.h")
harvest(fftw3/lib fftw3/lib "*.a")
harvest(flac/lib sndfile/lib "libFLAC.a")
harvest(freetype/include freetype/include "*.h")
harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a)
harvest(glew/include glew/include "*.h")
harvest(glew/lib glew/lib "*.a")
harvest(gmp/include gmp/include "*.h")
harvest(gmp/lib gmp/lib "*.a")
harvest(jemalloc/include jemalloc/include "*.h")
harvest(jemalloc/lib jemalloc/lib "*.a")
harvest(jpg/include jpeg/include "*.h")
harvest(jpg/lib jpeg/lib "libjpeg.a")
harvest(lame/lib ffmpeg/lib "*.a")
harvest(llvm/bin llvm/bin "clang-format")
if(BUILD_CLANG_TOOLS)
harvest(llvm/bin llvm/bin "clang-tidy")
harvest(llvm/share/clang llvm/share "run-clang-tidy.py")
endif()
harvest(llvm/include llvm/include "*")
harvest(llvm/bin llvm/bin "llvm-config")
harvest(llvm/lib llvm/lib "libLLVM*.a")
harvest(llvm/lib llvm/lib "libclang*.a")
harvest(llvm/lib/clang llvm/lib/clang "*.h")
if(APPLE)
harvest(openmp/lib openmp/lib "*")
harvest(openmp/include openmp/include "*.h")
endif()
if(BLENDER_PLATFORM_ARM)
harvest(sse2neon sse2neon "*.h")
endif()
harvest(ogg/lib ffmpeg/lib "*.a")
harvest(openal/include openal/include "*.h")
if(UNIX AND NOT APPLE)
harvest(openal/lib openal/lib "*.a")
harvest(blosc/include blosc/include "*.h")
harvest(blosc/lib blosc/lib "*.a")
harvest(zlib/include zlib/include "*.h")
harvest(zlib/lib zlib/lib "*.a")
harvest(xml2/include xml2/include "*.h")
harvest(xml2/lib xml2/lib "*.a")
harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml")
else()
harvest(blosc/lib openvdb/lib "*.a")
harvest(xml2/lib opencollada/lib "*.a")
endif()
harvest(opencollada/include/opencollada opencollada/include "*.h")
harvest(opencollada/lib/opencollada opencollada/lib "*.a")
harvest(opencolorio/include opencolorio/include "*.h")
harvest(opencolorio/lib opencolorio/lib "*.a")
harvest(opencolorio/lib/static opencolorio/lib "*.a")
harvest(openexr/include openexr/include "*.h")
harvest(openexr/lib openexr/lib "*.a")
harvest(openimageio/bin openimageio/bin "idiff")
harvest(openimageio/bin openimageio/bin "maketx")
harvest(openimageio/bin openimageio/bin "oiiotool")
harvest(openimageio/include openimageio/include "*")
harvest(openimageio/lib openimageio/lib "*.a")
harvest(openimagedenoise/include openimagedenoise/include "*")
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
harvest(embree/include embree/include "*.h")
harvest(embree/lib embree/lib "*.a")
harvest(openjpeg/include/openjpeg-2.3 openjpeg/include "*.h")
harvest(openjpeg/lib openjpeg/lib "*.a")
harvest(opensubdiv/include opensubdiv/include "*.h")
harvest(opensubdiv/lib opensubdiv/lib "*.a")
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
harvest(openvdb/lib openvdb/lib "*.a")
harvest(nanovdb/nanovdb nanovdb/include/nanovdb "*.h")
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
harvest(osl/bin osl/bin "oslc")
harvest(osl/include osl/include "*.h")
harvest(osl/lib osl/lib "*.a")
harvest(osl/share/OSL/shaders osl/share/OSL/shaders "*.h")
harvest(png/include png/include "*.h")
harvest(png/lib png/lib "*.a")
harvest(pugixml/include pugixml/include "*.hpp")
harvest(pugixml/lib pugixml/lib "*.a")
harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}")
harvest(python/include python/include "*h")
harvest(python/lib python/lib "*")
harvest(sdl/include/SDL2 sdl/include "*.h")
harvest(sdl/lib sdl/lib "libSDL2.a")
harvest(sndfile/include sndfile/include "*.h")
harvest(sndfile/lib sndfile/lib "*.a")
harvest(spnav/include spnav/include "*.h")
harvest(spnav/lib spnav/lib "*.a")
harvest(tbb/include tbb/include "*.h")
harvest(tbb/lib/libtbb_static.a tbb/lib/libtbb.a)
harvest(theora/lib ffmpeg/lib "*.a")
harvest(tiff/include tiff/include "*.h")
harvest(tiff/lib tiff/lib "*.a")
harvest(vorbis/lib ffmpeg/lib "*.a")
harvest(opus/lib ffmpeg/lib "*.a")
harvest(vpx/lib ffmpeg/lib "*.a")
harvest(webp/lib ffmpeg/lib "*.a")
harvest(x264/lib ffmpeg/lib "*.a")
harvest(xvidcore/lib ffmpeg/lib "*.a")
harvest(usd/include usd/include "*.h")
harvest(usd/lib/usd usd/lib/usd "*")
harvest(usd/plugin usd/plugin "*")
harvest(potrace/include potrace/include "*.h")
harvest(potrace/lib potrace/lib "*.a")
harvest(haru/include haru/include "*.h")
harvest(haru/lib haru/lib "*.a")
harvest(zstd/include zstd/include "*.h")
harvest(zstd/lib zstd/lib "*.a")
if(UNIX AND NOT APPLE)
harvest(libglu/lib mesa/lib "*.so*")
harvest(mesa/lib64 mesa/lib "*.so*")
endif()
function(harvest from to)
set(pattern "")
foreach(f ${ARGN})
set(pattern ${f})
endforeach()
if(pattern STREQUAL "")
get_filename_component(dirpath ${to} DIRECTORY)
get_filename_component(filename ${to} NAME)
install(
FILES ${LIBDIR}/${from}
DESTINATION ${HARVEST_TARGET}/${dirpath}
RENAME ${filename}
)
else()
install(
DIRECTORY ${LIBDIR}/${from}/
DESTINATION ${HARVEST_TARGET}/${to}
USE_SOURCE_PERMISSIONS
FILES_MATCHING PATTERN ${pattern}
PATTERN "pkgconfig" EXCLUDE
PATTERN "cmake" EXCLUDE
PATTERN "__pycache__" EXCLUDE
PATTERN "tests" EXCLUDE
)
endif()
endfunction()
harvest(alembic/include alembic/include "*.h")
harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a)
harvest(alembic/bin alembic/bin "*")
harvest(brotli/include brotli/include "*.h")
harvest(brotli/lib brotli/lib "*.a")
harvest(boost/include boost/include "*")
harvest(boost/lib boost/lib "*.a")
harvest(imath/include imath/include "*.h")
harvest(imath/lib imath/lib "*.a")
harvest(ffmpeg/include ffmpeg/include "*.h")
harvest(ffmpeg/lib ffmpeg/lib "*.a")
harvest(fftw3/include fftw3/include "*.h")
harvest(fftw3/lib fftw3/lib "*.a")
harvest(flac/lib sndfile/lib "libFLAC.a")
harvest(freetype/include freetype/include "*.h")
harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a)
harvest(epoxy/include epoxy/include "*.h")
harvest(epoxy/lib epoxy/lib "*.a")
harvest(gmp/include gmp/include "*.h")
harvest(gmp/lib gmp/lib "*.a")
harvest(jemalloc/include jemalloc/include "*.h")
harvest(jemalloc/lib jemalloc/lib "*.a")
harvest(jpeg/include jpeg/include "*.h")
harvest(jpeg/lib jpeg/lib "libjpeg.a")
harvest(lame/lib ffmpeg/lib "*.a")
if(NOT APPLE)
harvest(level-zero/include/level_zero level-zero/include/level_zero "*.h")
harvest(level-zero/lib level-zero/lib "*.so*")
endif()
harvest(llvm/bin llvm/bin "clang-format")
if(BUILD_CLANG_TOOLS)
harvest(llvm/bin llvm/bin "clang-tidy")
harvest(llvm/share/clang llvm/share "run-clang-tidy.py")
endif()
harvest(llvm/include llvm/include "*")
harvest(llvm/bin llvm/bin "llvm-config")
harvest(llvm/lib llvm/lib "libLLVM*.a")
harvest(llvm/lib llvm/lib "libclang*.a")
harvest(llvm/lib/clang llvm/lib/clang "*.h")
if(APPLE)
harvest(openmp/lib openmp/lib "*")
harvest(openmp/include openmp/include "*.h")
endif()
if(BLENDER_PLATFORM_ARM)
harvest(sse2neon sse2neon "*.h")
endif()
harvest(ogg/lib ffmpeg/lib "*.a")
harvest(openal/include openal/include "*.h")
if(UNIX AND NOT APPLE)
harvest(openal/lib openal/lib "*.a")
harvest(blosc/include blosc/include "*.h")
harvest(blosc/lib blosc/lib "*.a")
harvest(zlib/include zlib/include "*.h")
harvest(zlib/lib zlib/lib "*.a")
harvest(xml2/include xml2/include "*.h")
harvest(xml2/lib xml2/lib "*.a")
harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml")
harvest(wayland/bin wayland/bin "wayland-scanner")
harvest(wayland/include wayland/include "*.h")
harvest(wayland_libdecor/include wayland_libdecor/include "*.h")
else()
harvest(blosc/lib openvdb/lib "*.a")
harvest(xml2/lib opencollada/lib "*.a")
endif()
harvest(opencollada/include/opencollada opencollada/include "*.h")
harvest(opencollada/lib/opencollada opencollada/lib "*.a")
harvest(opencolorio/include opencolorio/include "*.h")
harvest(opencolorio/lib opencolorio/lib "*.a")
harvest(opencolorio/lib/static opencolorio/lib "*.a")
harvest(openexr/include openexr/include "*.h")
harvest(openexr/lib openexr/lib "*.a")
harvest(openimageio/bin openimageio/bin "idiff")
harvest(openimageio/bin openimageio/bin "maketx")
harvest(openimageio/bin openimageio/bin "oiiotool")
harvest(openimageio/include openimageio/include "*")
harvest(openimageio/lib openimageio/lib "*.a")
harvest(openimagedenoise/include openimagedenoise/include "*")
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
harvest(embree/include embree/include "*.h")
harvest(embree/lib embree/lib "*.a")
harvest(openpgl/include openpgl/include "*.h")
harvest(openpgl/lib openpgl/lib "*.a")
harvest(openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION} openpgl/lib/cmake/openpgl "*.cmake")
harvest(openjpeg/include/openjpeg-${OPENJPEG_SHORT_VERSION} openjpeg/include "*.h")
harvest(openjpeg/lib openjpeg/lib "*.a")
harvest(opensubdiv/include opensubdiv/include "*.h")
harvest(opensubdiv/lib opensubdiv/lib "*.a")
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
harvest(openvdb/include/nanovdb openvdb/include/nanovdb "*.h")
harvest(openvdb/lib openvdb/lib "*.a")
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
harvest(osl/bin osl/bin "oslc")
harvest(osl/include osl/include "*.h")
harvest(osl/lib osl/lib "*.a")
harvest(osl/share/OSL/shaders osl/share/OSL/shaders "*.h")
harvest(png/include png/include "*.h")
harvest(png/lib png/lib "*.a")
harvest(pugixml/include pugixml/include "*.hpp")
harvest(pugixml/lib pugixml/lib "*.a")
harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}")
harvest(python/include python/include "*h")
harvest(python/lib python/lib "*")
harvest(sdl/include/SDL2 sdl/include "*.h")
harvest(sdl/lib sdl/lib "libSDL2.a")
harvest(sndfile/include sndfile/include "*.h")
harvest(sndfile/lib sndfile/lib "*.a")
harvest(spnav/include spnav/include "*.h")
harvest(spnav/lib spnav/lib "*.a")
harvest(tbb/include tbb/include "*.h")
harvest(tbb/lib/libtbb_static.a tbb/lib/libtbb.a)
harvest(theora/lib ffmpeg/lib "*.a")
harvest(tiff/include tiff/include "*.h")
harvest(tiff/lib tiff/lib "*.a")
harvest(vorbis/lib ffmpeg/lib "*.a")
harvest(opus/lib ffmpeg/lib "*.a")
harvest(vpx/lib ffmpeg/lib "*.a")
harvest(x264/lib ffmpeg/lib "*.a")
harvest(xvidcore/lib ffmpeg/lib "*.a")
harvest(aom/lib ffmpeg/lib "*.a")
harvest(webp/lib webp/lib "*.a")
harvest(webp/include webp/include "*.h")
harvest(usd/include usd/include "*.h")
harvest(usd/lib/usd usd/lib/usd "*")
harvest(usd/plugin usd/plugin "*")
harvest(potrace/include potrace/include "*.h")
harvest(potrace/lib potrace/lib "*.a")
harvest(haru/include haru/include "*.h")
harvest(haru/lib haru/lib "*.a")
harvest(zstd/include zstd/include "*.h")
harvest(zstd/lib zstd/lib "*.a")
if(UNIX AND NOT APPLE)
harvest(libglu/lib mesa/lib "*.so*")
harvest(mesa/lib64 mesa/lib "*.so*")
harvest(dpcpp dpcpp "*")
harvest(igc dpcpp/lib/igc "*")
harvest(ocloc dpcpp/lib/ocloc "*")
endif()
endif()

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(ICONV_EXTRA_ARGS)

View File

@@ -0,0 +1,126 @@
# SPDX-License-Identifier: GPL-2.0-or-later
unpack_only(igc_vcintrinsics)
unpack_only(igc_spirv_headers)
unpack_only(igc_spirv_tools)
#
# igc_opencl_clang contains patches that need to be applied
# to external_igc_llvm and igc_spirv_translator, we unpack
# igc_opencl_clang first, then have the patch stages of
# external_igc_llvm and igc_spirv_translator apply them.
#
ExternalProject_Add(external_igc_opencl_clang
URL file://${PACKAGE_DIR}/${IGC_OPENCL_CLANG_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${IGC_OPENCL_CLANG_HASH_TYPE}=${IGC_OPENCL_CLANG_HASH}
PREFIX ${BUILD_DIR}/igc_opencl_clang
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/igc_opencl_clang/src/external_igc_opencl_clang/ < ${PATCH_DIR}/igc_opencl_clang.diff
)
set(IGC_OPENCL_CLANG_PATCH_DIR ${BUILD_DIR}/igc_opencl_clang/src/external_igc_opencl_clang/patches)
set(IGC_LLVM_SOURCE_DIR ${BUILD_DIR}/igc_llvm/src/external_igc_llvm)
set(IGC_SPIRV_TRANSLATOR_SOURCE_DIR ${BUILD_DIR}/igc_spirv_translator/src/external_igc_spirv_translator)
ExternalProject_Add(external_igc_llvm
URL file://${PACKAGE_DIR}/${IGC_LLVM_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${IGC_LLVM_HASH_TYPE}=${IGC_LLVM_HASH}
PREFIX ${BUILD_DIR}/igc_llvm
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${IGC_LLVM_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/clang/0001-OpenCL-3.0-support.patch &&
${PATCH_CMD} -p 1 -d ${IGC_LLVM_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/clang/0002-Remove-__IMAGE_SUPPORT__-macro-for-SPIR.patch &&
${PATCH_CMD} -p 1 -d ${IGC_LLVM_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/clang/0003-Avoid-calling-ParseCommandLineOptions-in-BackendUtil.patch &&
${PATCH_CMD} -p 1 -d ${IGC_LLVM_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/clang/0004-OpenCL-support-cl_ext_float_atomics.patch &&
${PATCH_CMD} -p 1 -d ${IGC_LLVM_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/clang/0005-OpenCL-Add-cl_khr_integer_dot_product.patch &&
${PATCH_CMD} -p 1 -d ${IGC_LLVM_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/llvm/0001-Memory-leak-fix-for-Managed-Static-Mutex.patch &&
${PATCH_CMD} -p 1 -d ${IGC_LLVM_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/llvm/0002-Remove-repo-name-in-LLVM-IR.patch
)
add_dependencies(
external_igc_llvm
external_igc_opencl_clang
)
ExternalProject_Add(external_igc_spirv_translator
URL file://${PACKAGE_DIR}/${IGC_SPIRV_TRANSLATOR_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${IGC_SPIRV_TRANSLATOR_HASH_TYPE}=${IGC_SPIRV_TRANSLATOR_HASH}
PREFIX ${BUILD_DIR}/igc_spirv_translator
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${IGC_SPIRV_TRANSLATOR_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/spirv/0001-update-SPIR-V-headers-for-SPV_INTEL_split_barrier.patch &&
${PATCH_CMD} -p 1 -d ${IGC_SPIRV_TRANSLATOR_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/spirv/0002-Add-support-for-split-barriers-extension-SPV_INTEL_s.patch &&
${PATCH_CMD} -p 1 -d ${IGC_SPIRV_TRANSLATOR_SOURCE_DIR} < ${IGC_OPENCL_CLANG_PATCH_DIR}/spirv/0003-Support-cl_bf16_conversions.patch
)
add_dependencies(
external_igc_spirv_translator
external_igc_opencl_clang
)
if(WIN32)
set(IGC_GENERATOR "Ninja")
set(IGC_TARGET Windows64)
else()
set(IGC_GENERATOR "Unix Makefiles")
set(IGC_TARGET Linux64)
endif()
set(IGC_EXTRA_ARGS
-DIGC_OPTION__ARCHITECTURE_TARGET=${IGC_TARGET}
-DIGC_OPTION__ARCHITECTURE_HOST=${IGC_TARGET}
)
if(UNIX AND NOT APPLE)
list(APPEND IGC_EXTRA_ARGS
-DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
-DFLEX_INCLUDE_DIR=${LIBDIR}/flex/include
)
endif()
ExternalProject_Add(external_igc
URL file://${PACKAGE_DIR}/${IGC_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${IGC_HASH_TYPE}=${IGC_HASH}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/igc ${DEFAULT_CMAKE_FLAGS} ${IGC_EXTRA_ARGS}
# IGC is pretty set in its way where sub projects ought to live, for some it offers
# hooks to supply alternatives folders, other are just hardocded with no way to configure
# we symlink everything here, since it's less work than trying to convince the cmake
# scripts to accept alternative locations.
#
PATCH_COMMAND ${CMAKE_COMMAND} -E create_symlink ${BUILD_DIR}/igc_llvm/src/external_igc_llvm/ ${BUILD_DIR}/igc/src/llvm-project &&
${CMAKE_COMMAND} -E create_symlink ${BUILD_DIR}/igc_opencl_clang/src/external_igc_opencl_clang/ ${BUILD_DIR}/igc/src/llvm-project/llvm/projects/opencl-clang &&
${CMAKE_COMMAND} -E create_symlink ${BUILD_DIR}/igc_spirv_translator/src/external_igc_spirv_translator/ ${BUILD_DIR}/igc/src/llvm-project/llvm/projects/llvm-spirv &&
${CMAKE_COMMAND} -E create_symlink ${BUILD_DIR}/igc_spirv_tools/src/external_igc_spirv_tools/ ${BUILD_DIR}/igc/src/SPIRV-Tools &&
${CMAKE_COMMAND} -E create_symlink ${BUILD_DIR}/igc_spirv_headers/src/external_igc_spirv_headers/ ${BUILD_DIR}/igc/src/SPIRV-Headers &&
${CMAKE_COMMAND} -E create_symlink ${BUILD_DIR}/igc_vcintrinsics/src/external_igc_vcintrinsics/ ${BUILD_DIR}/igc/src/vc-intrinsics
PREFIX ${BUILD_DIR}/igc
INSTALL_DIR ${LIBDIR}/igc
INSTALL_COMMAND ${CMAKE_COMMAND} --install . --strip
CMAKE_GENERATOR ${IGC_GENERATOR}
)
add_dependencies(
external_igc
external_igc_vcintrinsics
external_igc_llvm
external_igc_opencl_clang
external_igc_vcintrinsics
external_igc_spirv_headers
external_igc_spirv_tools
external_igc_spirv_translator
)
if(UNIX AND NOT APPLE)
add_dependencies(
external_igc
external_flex
)
endif()

View File

@@ -0,0 +1,24 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(IMATH_EXTRA_ARGS
-DBUILD_SHARED_LIBS=OFF
-DBUILD_TESTING=OFF
-DIMATH_LIB_SUFFIX=${OPENEXR_VERSION_BUILD_POSTFIX}
)
ExternalProject_Add(external_imath
URL file://${PACKAGE_DIR}/${IMATH_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${IMATH_HASH_TYPE}=${IMATH_HASH}
PREFIX ${BUILD_DIR}/imath
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/imath ${DEFAULT_CMAKE_FLAGS} ${IMATH_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/imath
)
if(WIN32)
ExternalProject_Add_Step(external_imath after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/imath/lib ${HARVEST_TARGET}/imath/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/imath/include ${HARVEST_TARGET}/imath/include
DEPENDEES install
)
endif()

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(ISPC_EXTRA_ARGS_WIN
@@ -22,6 +6,7 @@ if(WIN32)
-DBISON_EXECUTABLE=${LIBDIR}/flexbison/win_bison.exe
-DM4_EXECUTABLE=${DOWNLOAD_DIR}/mingw/mingw64/msys/1.0/bin/m4.exe
-DARM_ENABLED=Off
-DPython3_FIND_REGISTRY=NEVER
)
elseif(APPLE)
# Use bison and flex installed via Homebrew.
@@ -43,7 +28,7 @@ elseif(UNIX)
set(ISPC_EXTRA_ARGS_UNIX
-DCMAKE_C_COMPILER=${LIBDIR}/llvm/bin/clang
-DCMAKE_CXX_COMPILER=${LIBDIR}/llvm/bin/clang++
-DARM_ENABLED=Off
-DARM_ENABLED=${BLENDER_PLATFORM_ARM}
-DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
)
endif()
@@ -59,6 +44,8 @@ set(ISPC_EXTRA_ARGS
-DISPC_INCLUDE_TESTS=Off
-DCLANG_LIBRARY_DIR=${LIBDIR}/llvm/lib
-DCLANG_INCLUDE_DIRS=${LIBDIR}/llvm/include
-DPython3_ROOT_DIR=${LIBDIR}/python/
-DPython3_EXECUTABLE=${PYTHON_BINARY}
${ISPC_EXTRA_ARGS_WIN}
${ISPC_EXTRA_ARGS_APPLE}
${ISPC_EXTRA_ARGS_UNIX}
@@ -77,6 +64,7 @@ ExternalProject_Add(external_ispc
add_dependencies(
external_ispc
ll
external_python
)
if(WIN32)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_jemalloc
URL file://${PACKAGE_DIR}/${JEMALLOC_FILE}

View File

@@ -1,61 +1,53 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
# cmake for windows
set(JPEG_EXTRA_ARGS -DNASM=${NASM_PATH} -DWITH_JPEG8=ON -DCMAKE_DEBUG_POSTFIX=d -DWITH_CRT_DLL=On)
# CMAKE for MS-Windows.
set(JPEG_EXTRA_ARGS
-DNASM=${NASM_PATH}
-DWITH_JPEG8=ON
-DCMAKE_DEBUG_POSTFIX=d
-DWITH_CRT_DLL=On
-DENABLE_SHARED=OFF
-DENABLE_STATIC=ON
)
ExternalProject_Add(external_jpeg
URL file://${PACKAGE_DIR}/${JPEG_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${JPEG_HASH_TYPE}=${JPEG_HASH}
PREFIX ${BUILD_DIR}/jpg
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/jpg ${DEFAULT_CMAKE_FLAGS} ${JPEG_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/jpg
PREFIX ${BUILD_DIR}/jpeg
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/jpeg ${DEFAULT_CMAKE_FLAGS} ${JPEG_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/jpeg
)
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_jpeg after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/jpg/lib/jpegd${LIBEXT} ${LIBDIR}/jpg/lib/jpeg${LIBEXT}
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Release)
set(JPEG_LIBRARY jpeg-static${LIBEXT})
else()
set(JPEG_LIBRARY jpeg-staticd${LIBEXT})
endif()
else(WIN32)
# cmake for unix
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_jpeg after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/jpeg/lib/${JPEG_LIBRARY} ${LIBDIR}/jpeg/lib/jpeg${LIBEXT}
DEPENDEES install
)
endif()
else()
# CMAKE for UNIX.
set(JPEG_EXTRA_ARGS
-DWITH_JPEG8=ON
-DENABLE_STATIC=ON
-DENABLE_SHARED=OFF
-DCMAKE_INSTALL_LIBDIR=${LIBDIR}/jpg/lib)
-DCMAKE_INSTALL_LIBDIR=${LIBDIR}/jpeg/lib)
ExternalProject_Add(external_jpeg
URL file://${PACKAGE_DIR}/${JPEG_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${JPEG_HASH_TYPE}=${JPEG_HASH}
PREFIX ${BUILD_DIR}/jpg
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/jpg ${DEFAULT_CMAKE_FLAGS} ${JPEG_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/jpg
PREFIX ${BUILD_DIR}/jpeg
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/jpeg ${DEFAULT_CMAKE_FLAGS} ${JPEG_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/jpeg
)
set(JPEG_LIBRARY libjpeg${LIBEXT})

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(LAME_EXTRA_ARGS)
if(MSVC)

View File

@@ -0,0 +1,21 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(LEVEL_ZERO_EXTRA_ARGS
)
ExternalProject_Add(external_level-zero
URL file://${PACKAGE_DIR}/${LEVEL_ZERO_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${LEVEL_ZERO_HASH_TYPE}=${LEVEL_ZERO_HASH}
PREFIX ${BUILD_DIR}/level-zero
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/level-zero/src/external_level-zero < ${PATCH_DIR}/level-zero.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/level-zero ${DEFAULT_CMAKE_FLAGS} ${LEVEL_ZERO_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/level-zero
)
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_level-zero after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/level-zero ${HARVEST_TARGET}/level-zero
DEPENDEES install
)
endif()

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(LIBGLU_CFLAGS "-static-libgcc")
set(LIBGLU_CXXFLAGS "-static-libgcc -static-libstdc++ -Bstatic -lstdc++ -Bdynamic -l:libstdc++.a")

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(BLENDER_PLATFORM_ARM)
set(LLVM_TARGETS AArch64$<SEMICOLON>ARM)
@@ -41,11 +25,14 @@ set(LLVM_EXTRA_ARGS
-DLLVM_BUILD_LLVM_C_DYLIB=OFF
-DLLVM_ENABLE_UNWIND_TABLES=OFF
-DLLVM_ENABLE_PROJECTS=clang${LLVM_BUILD_CLANG_TOOLS_EXTRA}
-DPython3_ROOT_DIR=${LIBDIR}/python/
-DPython3_EXECUTABLE=${PYTHON_BINARY}
${LLVM_XML2_ARGS}
)
if(WIN32)
set(LLVM_GENERATOR "Ninja")
list(APPEND LLVM_EXTRA_ARGS -DPython3_FIND_REGISTRY=NEVER)
else()
set(LLVM_GENERATOR "Unix Makefiles")
endif()
@@ -90,3 +77,8 @@ if(APPLE)
external_xml2
)
endif()
add_dependencies(
ll
external_python
)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(LZMA_PATCH_CMD echo .)

View File

@@ -0,0 +1,18 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# shorthand to only unpack a certain dependency
macro(unpack_only name)
string(TOUPPER ${name} UPPER_NAME)
set(TARGET_FILE ${${UPPER_NAME}_FILE})
set(TARGET_HASH_TYPE ${${UPPER_NAME}_HASH_TYPE})
set(TARGET_HASH ${${UPPER_NAME}_HASH})
ExternalProject_Add(external_${name}
URL file://${PACKAGE_DIR}/${TARGET_FILE}
URL_HASH ${TARGET_HASH_TYPE}=${TARGET_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/${name}
CONFIGURE_COMMAND echo .
BUILD_COMMAND echo .
INSTALL_COMMAND echo .
)
endmacro()

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(MESA_CFLAGS "-static-libgcc")
set(MESA_CXXFLAGS "-static-libgcc -static-libstdc++ -Bstatic -lstdc++ -Bdynamic -l:libstdc++.a")

View File

@@ -1,55 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
set(NANOVDB_EXTRA_ARGS
# NanoVDB is header-only, so only need the install target
-DNANOVDB_BUILD_UNITTESTS=OFF
-DNANOVDB_BUILD_EXAMPLES=OFF
-DNANOVDB_BUILD_BENCHMARK=OFF
-DNANOVDB_BUILD_DOCS=OFF
-DNANOVDB_BUILD_TOOLS=OFF
-DNANOVDB_CUDA_KEEP_PTX=OFF
# Do not need to include any of the dependencies because of this
-DNANOVDB_USE_OPENVDB=OFF
-DNANOVDB_USE_OPENGL=OFF
-DNANOVDB_USE_OPENCL=OFF
-DNANOVDB_USE_CUDA=OFF
-DNANOVDB_USE_TBB=OFF
-DNANOVDB_USE_BLOSC=OFF
-DNANOVDB_USE_ZLIB=OFF
-DNANOVDB_USE_OPTIX=OFF
-DNANOVDB_ALLOW_FETCHCONTENT=OFF
)
ExternalProject_Add(nanovdb
URL file://${PACKAGE_DIR}/${NANOVDB_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${NANOVDB_HASH_TYPE}=${NANOVDB_HASH}
PREFIX ${BUILD_DIR}/nanovdb
SOURCE_SUBDIR nanovdb
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/nanovdb/src/nanovdb < ${PATCH_DIR}/nanovdb.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/nanovdb ${DEFAULT_CMAKE_FLAGS} ${NANOVDB_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/nanovdb
)
if(WIN32)
ExternalProject_Add_Step(nanovdb after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/nanovdb/nanovdb ${HARVEST_TARGET}/nanovdb/include/nanovdb
DEPENDEES install
)
endif()

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_nasm
URL file://${PACKAGE_DIR}/${NASM_FILE}

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(MSVC)
message("BIN >${PYTHON_BINARY}<")

View File

@@ -0,0 +1,24 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(OCLOC_EXTRA_ARGS
-DNEO_SKIP_UNIT_TESTS=1
-DNEO_BUILD_WITH_OCL=0
-DBUILD_WITH_L0=0
-DIGC_DIR=${LIBDIR}/igc
-DGMM_DIR=${LIBDIR}/gmmlib
)
ExternalProject_Add(external_ocloc
URL file://${PACKAGE_DIR}/${OCLOC_FILE}
URL_HASH ${OCLOC_HASH_TYPE}=${OCLOC_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/ocloc
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/ocloc ${DEFAULT_CMAKE_FLAGS} ${OCLOC_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/ocloc
)
add_dependencies(
external_ocloc
external_igc
external_gmmlib
)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_ogg
URL file://${PACKAGE_DIR}/${OGG_FILE}

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(BUILD_MODE STREQUAL Release)
set(OPENAL_EXTRA_ARGS

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(UNIX)
set(OPENCOLLADA_EXTRA_ARGS

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(OPENCOLORIO_EXTRA_ARGS
-DOCIO_BUILD_APPS=OFF
@@ -27,13 +11,12 @@ set(OPENCOLORIO_EXTRA_ARGS
-DOCIO_BUILD_GPU_TESTS=OFF
-DOCIO_USE_SSE=ON
# Manually build ext packages except for pystring, which does not have
# a CMake or autotools build system that we can easily use.
-DOCIO_INSTALL_EXT_PACKAGES=MISSING
-DHalf_ROOT=${LIBDIR}/openexr
-DHalf_STATIC_LIBRARY=ON
-DOCIO_INSTALL_EXT_PACKAGES=NONE
-Dexpat_ROOT=${LIBDIR}/expat
-Dyaml-cpp_ROOT=${LIBDIR}/yamlcpp
-Dpystring_ROOT=${LIBDIR}/pystring
-DImath_ROOT=${LIBDIR}/imath
)
if(BLENDER_PLATFORM_ARM)
@@ -46,7 +29,9 @@ endif()
if(WIN32)
set(OPENCOLORIO_EXTRA_ARGS
${OPENCOLORIO_EXTRA_ARGS}
-DOCIO_INLINES_HIDDEN=OFF
-Dexpat_LIBRARY=${LIBDIR}/expat/lib/libexpatMD
-Dyaml-cpp_LIBRARY=${LIBDIR}/expat/lib/libyaml-cppmd.lib
-DImath_LIBRARY=${LIBDIR}/imath/lib/imath${OPENEXR_VERSION_POSTFIX}
)
else()
set(OPENCOLORIO_EXTRA_ARGS
@@ -68,7 +53,8 @@ add_dependencies(
external_opencolorio
external_yamlcpp
external_expat
external_openexr
external_imath
external_pystring
)
if(WIN32)
@@ -78,7 +64,7 @@ if(WIN32)
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencolorio/lib ${HARVEST_TARGET}/opencolorio/lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/yamlcpp/lib/libyaml-cppmd.lib ${HARVEST_TARGET}/opencolorio/lib/libyaml-cpp.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/expat/lib/libexpatMD.lib ${HARVEST_TARGET}/opencolorio/lib/libexpatMD.lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/opencolorio/src/external_opencolorio-build/ext/dist/lib/pystring.lib ${HARVEST_TARGET}/opencolorio/lib/pystring.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/pystring/lib/pystring.lib ${HARVEST_TARGET}/opencolorio/lib/pystring.lib
DEPENDEES install
)
endif()
@@ -87,7 +73,7 @@ if(WIN32)
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencolorio/lib/Opencolorio.lib ${HARVEST_TARGET}/opencolorio/lib/OpencolorIO_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/yamlcpp/lib/libyaml-cppmdd.lib ${HARVEST_TARGET}/opencolorio/lib/libyaml-cpp_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/expat/lib/libexpatdMD.lib ${HARVEST_TARGET}/opencolorio/lib/libexpatdMD.lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/opencolorio/src/external_opencolorio-build/ext/dist/lib/pystring.lib ${HARVEST_TARGET}/opencolorio/lib/pystring_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/pystring/lib/pystring.lib ${HARVEST_TARGET}/opencolorio/lib/pystring_d.lib
DEPENDEES install
)
endif()
@@ -95,7 +81,7 @@ else()
ExternalProject_Add_Step(external_opencolorio after_install
COMMAND cp ${LIBDIR}/yamlcpp/lib/libyaml-cpp.a ${LIBDIR}/opencolorio/lib/
COMMAND cp ${LIBDIR}/expat/lib/libexpat.a ${LIBDIR}/opencolorio/lib/
COMMAND cp ${BUILD_DIR}/opencolorio/src/external_opencolorio-build/ext/dist/lib/libpystring.a ${LIBDIR}/opencolorio/lib/
COMMAND cp ${LIBDIR}/pystring/lib/libpystring.a ${LIBDIR}/opencolorio/lib/
DEPENDEES install
)
endif()

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(OPENEXR_CMAKE_CXX_STANDARD_LIBRARIES "kernel32${LIBEXT} user32${LIBEXT} gdi32${LIBEXT} winspool${LIBEXT} shell32${LIBEXT} ole32${LIBEXT} oleaut32${LIBEXT} uuid${LIBEXT} comdlg32${LIBEXT} advapi32${LIBEXT} psapi${LIBEXT}")
@@ -32,12 +16,10 @@ set(OPENEXR_EXTRA_ARGS
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
-DBUILD_TESTING=OFF
-DOPENEXR_BUILD_BOTH_STATIC_SHARED=OFF
-DILMBASE_BUILD_BOTH_STATIC_SHARED=OFF
-DBUILD_SHARED_LIBS=OFF
-DOPENEXR_BUILD_UTILS=OFF
-DPYILMBASE_ENABLE=OFF
-DOPENEXR_VIEWERS_ENABLE=OFF
-DILMBASE_LIB_SUFFIX=${OPENEXR_VERSION_BUILD_POSTFIX}
-DOPENEXR_INSTALL_TOOLS=OFF
-DOPENEXR_INSTALL_EXAMPLES=OFF
-DImath_DIR=${LIBDIR}/imath/lib/cmake/Imath
-DOPENEXR_LIB_SUFFIX=${OPENEXR_VERSION_BUILD_POSTFIX}
)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(OIDN_EXTRA_ARGS
@@ -24,6 +8,8 @@ set(OIDN_EXTRA_ARGS
-DOIDN_STATIC_LIB=ON
-DOIDN_STATIC_RUNTIME=OFF
-DISPC_EXECUTABLE=${LIBDIR}/ispc/bin/ispc
-DOIDN_FILTER_RTLIGHTMAP=OFF
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
)
if(WIN32)
@@ -53,6 +39,7 @@ add_dependencies(
external_openimagedenoise
external_tbb
external_ispc
external_python
)
if(WIN32)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(BUILD_MODE STREQUAL Release)
set(OIIO_TOOLS ON)
@@ -34,40 +18,31 @@ if(WIN32)
set(PNG_LIBNAME libpng16_static${LIBEXT})
set(OIIO_SIMD_FLAGS -DUSE_SIMD=sse2)
set(OPENJPEG_POSTFIX _msvc)
if(BUILD_MODE STREQUAL Debug)
set(TIFF_POSTFIX d)
else()
set(TIFF_POSTFIX)
endif()
else()
set(PNG_LIBNAME libpng${LIBEXT})
set(OIIO_SIMD_FLAGS)
endif()
if(WITH_WEBP)
set(WEBP_ARGS
-DWEBP_INCLUDE_DIR=${LIBDIR}/webp/include
-DWEBP_LIBRARY=${LIBDIR}/webp/lib/${LIBPREFIX}webp${LIBEXT}
)
set(WEBP_DEP external_webp)
set(TIFF_POSTFIX)
endif()
if(MSVC)
set(OPENJPEG_FLAGS
-DOpenJpeg_ROOT=${LIBDIR}/openjpeg_msvc
-DOpenJPEG_ROOT=${LIBDIR}/openjpeg_msvc
)
else()
set(OPENJPEG_FLAGS
-DOpenJpeg_ROOT=${LIBDIR}/openjpeg
-DOpenJPEG_ROOT=${LIBDIR}/openjpeg
)
endif()
set(OPENIMAGEIO_EXTRA_ARGS
-DBUILD_SHARED_LIBS=OFF
${OPENIMAGEIO_LINKSTATIC}
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
-DBoost_USE_MULTITHREADED=ON
-DBoost_USE_STATIC_LIBS=ON
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
${DEFAULT_BOOST_FLAGS}
-DUSE_LIBSQUISH=OFF
-DUSE_QT5=OFF
-DUSE_NUKE=OFF
@@ -78,7 +53,6 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DUSE_LIBHEIF=OFF
-DUSE_OPENGL=OFF
-DUSE_TBB=OFF
-DUSE_FIELD3D=OFF
-DUSE_QT=OFF
-DUSE_PYTHON=OFF
-DUSE_GIF=OFF
@@ -89,7 +63,7 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DUSE_FREETYPE=OFF
-DUSE_LIBRAW=OFF
-DUSE_OPENCOLORIO=OFF
-DUSE_WEBP=${WITH_WEBP}
-DUSE_WEBP=ON
-DOIIO_BUILD_TOOLS=${OIIO_TOOLS}
-DOIIO_BUILD_TESTS=OFF
-DBUILD_TESTING=OFF
@@ -97,16 +71,11 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include
-DPNG_LIBRARY=${LIBDIR}/png/lib/${PNG_LIBNAME}
-DPNG_PNG_INCLUDE_DIR=${LIBDIR}/png/include
-DTIFF_LIBRARY=${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT}
-DTIFF_LIBRARY=${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${TIFF_POSTFIX}${LIBEXT}
-DTIFF_INCLUDE_DIR=${LIBDIR}/tiff/include
-DJPEG_LIBRARY=${LIBDIR}/jpg/lib/${JPEG_LIBRARY}
-DJPEG_INCLUDE_DIR=${LIBDIR}/jpg/include
-DJPEG_LIBRARY=${LIBDIR}/jpeg/lib/${JPEG_LIBRARY}
-DJPEG_INCLUDE_DIR=${LIBDIR}/jpeg/include
${OPENJPEG_FLAGS}
-DOpenEXR_USE_STATIC_LIBS=On
-DILMBASE_INCLUDE_DIR=${LIBDIR}/openexr/include/
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/openexr/include/
-DOPENEXR_HALF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Half${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_IMATH_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_ILMTHREAD_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmThread${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_IEX_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_ILMIMF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}
@@ -114,8 +83,14 @@ set(OPENIMAGEIO_EXTRA_ARGS
-DUSE_EXTERNAL_PUGIXML=ON
-DPUGIXML_LIBRARY=${LIBDIR}/pugixml/lib/${LIBPREFIX}pugixml${LIBEXT}
-DPUGIXML_INCLUDE_DIR=${LIBDIR}/pugixml/include/
${WEBP_FLAGS}
-DBUILD_MISSING_ROBINMAP=OFF
-DBUILD_MISSING_FMT=OFF
-DFMT_INCLUDE_DIR=${LIBDIR}/fmt/include/
-DRobinmap_ROOT=${LIBDIR}/robinmap
-DWebP_ROOT=${LIBDIR}/webp
${OIIO_SIMD_FLAGS}
-DOpenEXR_ROOT=${LIBDIR}/openexr
-DImath_ROOT=${LIBDIR}/imath
)
ExternalProject_Add(external_openimageio
@@ -133,12 +108,15 @@ add_dependencies(
external_png
external_zlib
external_openexr
external_imath
external_jpeg
external_boost
external_tiff
external_pugixml
external_fmt
external_robinmap
external_openjpeg${OPENJPEG_POSTFIX}
${WEBP_DEP}
external_webp
)
if(WIN32)
@@ -153,8 +131,8 @@ if(WIN32)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_openimageio after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO_Util.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_Util_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO_d.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO_Util_d.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_Util_d.lib
DEPENDEES install
)
endif()

View File

@@ -1,38 +1,26 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
# Note the encoder/decoder may use png/tiff/lcms system libraries, but the
# library itself does not depend on them, so should give no problems.
set(OPENJPEG_EXTRA_ARGS -DBUILD_SHARED_LIBS=OFF)
if(WIN32)
set(OPENJPEG_EXTRA_ARGS -G "MSYS Makefiles" -DBUILD_PKGCONFIG_FILES=On)
else()
set(OPENJPEG_EXTRA_ARGS ${DEFAULT_CMAKE_FLAGS})
endif()
set(OPENJPEG_EXTRA_ARGS
${OPENJPEG_EXTRA_ARGS}
-DBUILD_SHARED_LIBS=OFF
-DBUILD_CODEC=OFF
)
ExternalProject_Add(external_openjpeg
URL file://${PACKAGE_DIR}/${OPENJPEG_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENJPEG_HASH_TYPE}=${OPENJPEG_HASH}
PREFIX ${BUILD_DIR}/openjpeg
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/openjpeg/src/external_openjpeg-build && ${CMAKE_COMMAND} ${OPENJPEG_EXTRA_ARGS} -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openjpeg -DBUILD_SHARED_LIBS=Off -DBUILD_THIRDPARTY=OFF ${BUILD_DIR}/openjpeg/src/external_openjpeg
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/openjpeg/src/external_openjpeg-build && ${CMAKE_COMMAND} ${OPENJPEG_EXTRA_ARGS} -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openjpeg ${BUILD_DIR}/openjpeg/src/external_openjpeg
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/openjpeg/src/external_openjpeg-build/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/openjpeg/src/external_openjpeg-build/ && make install
INSTALL_DIR ${LIBDIR}/openjpeg

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(APPLE)
set(OPENMP_PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openmp/src/external_openmp < ${PATCH_DIR}/openmp.diff)

View File

@@ -0,0 +1,47 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Note the utility apps may use png/tiff/gif system libraries, but the
# library itself does not depend on them, so should give no problems.
set(OPENPGL_EXTRA_ARGS
-DOPENPGL_BUILD_STATIC=ON
-DOPENPGL_TBB_ROOT=${LIBDIR}/tbb
-DTBB_ROOT=${LIBDIR}/tbb
-DCMAKE_DEBUG_POSTFIX=_d
)
if(TBB_STATIC_LIBRARY)
set(OPENPGL_EXTRA_ARGS
${OPENPGL_EXTRA_ARGS}
-DOPENPGL_TBB_COMPONENT=tbb_static
)
endif()
ExternalProject_Add(external_openpgl
URL file://${PACKAGE_DIR}/${OPENPGL_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENPGL_HASH_TYPE}=${OPENPGL_HASH}
PREFIX ${BUILD_DIR}/openpgl
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openpgl ${DEFAULT_CMAKE_FLAGS} ${OPENPGL_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openpgl
)
add_dependencies(
external_openpgl
external_tbb
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_openpgl after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openpgl ${HARVEST_TARGET}/openpgl
DEPENDEES install
)
else()
ExternalProject_Add_Step(external_openpgl after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openpgl/lib/openpgl_d.lib ${HARVEST_TARGET}/openpgl/lib/openpgl_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION}/openpgl_Exports-debug.cmake ${HARVEST_TARGET}/openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION}/openpgl_Exports-debug.cmake
DEPENDEES install
)
endif()
endif()

View File

@@ -1,35 +1,25 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(OPENSUBDIV_EXTRA_ARGS
-DNO_LIB=OFF
-DNO_EXAMPLES=ON
-DNO_TUTORIALS=ON
-DNO_REGRESSION=ON
-DNO_PYTHON=ON
-DNO_MAYA=ON
-DNO_PTEX=ON
-DNO_DOC=ON
-DNO_CLEW=OFF
-DNO_OPENCL=OFF
-DNO_TUTORIALS=ON
-DGLEW_INCLUDE_DIR=${LIBDIR}/glew/include
-DGLEW_LIBRARY=${LIBDIR}/glew/lib/libGLEW${LIBEXT}
-DGLFW_INCLUDE_DIR=${LIBDIR}/glfw/include
-DGLFW_LIBRARIES=${LIBDIR}/glfw/lib/glfw3${LIBEXT}
-DNO_OMP=ON
-DNO_TBB=OFF
-DNO_CUDA=ON
-DNO_OPENCL=ON
-DNO_CLEW=ON
-DNO_OPENGL=OFF
-DNO_METAL=OFF
-DNO_DX=ON
-DNO_TESTS=ON
-DNO_GLTESTS=ON
-DNO_GLEW=ON
-DNO_GLFW=ON
-DNO_GLFW_X11=ON
)
if(WIN32)
@@ -37,30 +27,12 @@ if(WIN32)
${OPENSUBDIV_EXTRA_ARGS}
-DTBB_INCLUDE_DIR=${LIBDIR}/tbb/include
-DTBB_LIBRARIES=${LIBDIR}/tbb/lib/tbb.lib
-DCLEW_INCLUDE_DIR=${LIBDIR}/clew/include/CL
-DCLEW_LIBRARY=${LIBDIR}/clew/lib/clew${LIBEXT}
-DCUEW_INCLUDE_DIR=${LIBDIR}/cuew/include
-DCUEW_LIBRARY=${LIBDIR}/cuew/lib/cuew${LIBEXT}
)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(OPENSUBDIV_EXTRA_ARGS
${OPENSUBDIV_EXTRA_ARGS}
-DNO_CUDA=OFF
)
else()
set(OPENSUBDIV_EXTRA_ARGS
${OPENSUBDIV_EXTRA_ARGS}
-DNO_CUDA=ON
)
endif()
else()
set(OPENSUBDIV_EXTRA_ARGS
${OPENSUBDIV_EXTRA_ARGS}
-DNO_CUDA=ON
-DCUEW_INCLUDE_DIR=${LIBDIR}/cuew/include
-DCLEW_INCLUDE_DIR=${LIBDIR}/clew/include/CL
-DCLEW_LIBRARY=${LIBDIR}/clew/lib/static/${LIBPREFIX}clew${LIBEXT}
-DTBB_INCLUDE_DIR=${LIBDIR}/tbb/include
-DTBB_tbb_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb_static${LIBEXT}
)
endif()
@@ -92,9 +64,5 @@ endif()
add_dependencies(
external_opensubdiv
external_glew
external_glfw
external_clew
external_cuew
external_tbb
)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(BUILD_MODE STREQUAL Debug)
set(BLOSC_POST _d)
@@ -29,6 +13,7 @@ else()
endif()
set(OPENVDB_EXTRA_ARGS
${DEFAULT_BOOST_FLAGS}
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
-DBoost_USE_MULTITHREADED=ON
-DBoost_USE_STATIC_LIBS=ON
@@ -40,22 +25,20 @@ set(OPENVDB_EXTRA_ARGS
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
-DBlosc_INCLUDE_DIR=${LIBDIR}/blosc/include/
-DBlosc_LIBRARY=${LIBDIR}/blosc/lib/libblosc${BLOSC_POST}${LIBEXT}
-DOPENVDB_ENABLE_3_ABI_COMPATIBLE=OFF
-DOPENVDB_BUILD_UNITTESTS=Off
-DOPENVDB_BUILD_PYTHON_MODULE=Off
-DBlosc_LIBRARY_RELEASE=${LIBDIR}/blosc/lib/libblosc${BLOSC_POST}${LIBEXT}
-DBlosc_LIBRARY_DEBUG=${LIBDIR}/blosc/lib/libblosc${BLOSC_POST}${LIBEXT}
-DOPENVDB_BUILD_UNITTESTS=OFF
-DOPENVDB_BUILD_PYTHON_MODULE=OFF
-DOPENVDB_BUILD_NANOVDB=ON
-DNANOVDB_BUILD_TOOLS=OFF
-DBlosc_ROOT=${LIBDIR}/blosc/
-DTBB_ROOT=${LIBDIR}/tbb/
-DOpenEXR_ROOT=${LIBDIR}/openexr
-DIlmBase_ROOT=${LIBDIR}/openexr
-DOPENEXR_LIBRARYDIR=${LIBDIR}/openexr/lib
# All libs live in openexr, even the ilmbase ones
-DILMBASE_LIBRARYDIR=${LIBDIR}/openexr/lib
-DOPENVDB_CORE_SHARED=${OPENVDB_SHARED}
-DOPENVDB_CORE_STATIC=${OPENVDB_STATIC}
-DOPENVDB_BUILD_BINARIES=Off
-DOPENVDB_BUILD_BINARIES=OFF
-DCMAKE_DEBUG_POSTFIX=_d
-DILMBASE_USE_STATIC_LIBS=On
-DOPENEXR_USE_STATIC_LIBS=On
-DBLOSC_USE_STATIC_LIBS=ON
-DUSE_NANOVDB=ON
)
if(WIN32)
@@ -64,15 +47,6 @@ if(WIN32)
# needs to link pthreads due to it being a blosc dependency
set(OPENVDB_EXTRA_ARGS ${OPENVDB_EXTRA_ARGS}
-DCMAKE_CXX_STANDARD_LIBRARIES="${LIBDIR}/pthreads/lib/pthreadVC3.lib"
-DUSE_EXR=On
)
else()
# OpenVDB can't find the _static libraries automatically.
set(OPENVDB_EXTRA_ARGS ${OPENVDB_EXTRA_ARGS}
-DTbb_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb_static${LIBEXT}
-DTbb_tbb_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb_static${LIBEXT}
-DTbb_tbbmalloc_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbbmalloc_static${LIBEXT}
-DTbb_tbbmalloc_proxy_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbbmalloc_proxy_static${LIBEXT}
)
endif()
@@ -90,7 +64,6 @@ add_dependencies(
openvdb
external_tbb
external_boost
external_openexr
external_zlib
external_blosc
)
@@ -98,7 +71,7 @@ add_dependencies(
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(openvdb after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openvdb/include/openvdb ${HARVEST_TARGET}/openvdb/include/openvdb
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openvdb/include ${HARVEST_TARGET}/openvdb/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/openvdb.lib ${HARVEST_TARGET}/openvdb/lib/openvdb.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/bin/openvdb.dll ${HARVEST_TARGET}/openvdb/bin/openvdb.dll
DEPENDEES install

View File

@@ -1,25 +1,8 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
option(ENABLE_MINGW64 "Enable building of ffmpeg/iconv/libsndfile/fftw3 by installing mingw64" ON)
endif()
option(WITH_WEBP "Enable building of oiio with webp support" OFF)
option(WITH_BOOST_PYTHON "Enable building of boost with python support" OFF)
cmake_host_system_information(RESULT NUM_CORES QUERY NUMBER_OF_LOGICAL_CORES)
set(MAKE_THREADS ${NUM_CORES} CACHE STRING "Number of threads to run make with")
@@ -32,7 +15,7 @@ message("BuildMode = ${BUILD_MODE}")
if(BUILD_MODE STREQUAL "Debug")
set(LIBDIR ${CMAKE_CURRENT_BINARY_DIR}/Debug)
else(BUILD_MODE STREQUAL "Debug")
else()
set(LIBDIR ${CMAKE_CURRENT_BINARY_DIR}/Release)
endif()
@@ -55,32 +38,33 @@ message("BUILD_DIR = ${BUILD_DIR}")
if(WIN32)
set(PATCH_CMD ${DOWNLOAD_DIR}/mingw/mingw64/msys/1.0/bin/patch.exe)
set(LIBEXT ".lib")
set(SHAREDLIBEXT ".lib")
set(LIBPREFIX "")
# For OIIO and OSL
set(COMMON_DEFINES /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS)
set(COMMON_DEFINES /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS)
if(MSVC_VERSION GREATER 1909)
set(COMMON_MSVC_FLAGS "/Wv:18") #some deps with warnings as error aren't quite ready for dealing with the new 2017 warnings.
endif()
string(APPEND COMMON_MSVC_FLAGS " /bigobj")
if(WITH_OPTIMIZED_DEBUG)
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
else()
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /D_DEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /D_DEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
endif()
set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "/MD ${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "/MD ${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
if(WITH_OPTIMIZED_DEBUG)
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
else()
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /D PLATFORM_WINDOWS /MTd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /D PLATFORM_WINDOWS /MTd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
endif()
set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "/MD /${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "/MD /${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MD ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=2 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
set(PLATFORM_FLAGS)
set(PLATFORM_CXX_FLAGS)
@@ -113,37 +97,20 @@ if(WIN32)
else()
set(PATCH_CMD patch)
set(LIBEXT ".a")
set(SHAREDLIBEXT ".so")
set(LIBPREFIX "lib")
if(APPLE)
# Let's get the current Xcode dir, to support xcode-select
execute_process(
COMMAND xcode-select --print-path
OUTPUT_VARIABLE XCODE_DEV_PATH OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND xcodebuild -version -sdk macosx SDKVersion
OUTPUT_VARIABLE MACOSX_SDK_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT CMAKE_OSX_ARCHITECTURES)
execute_process(COMMAND uname -m OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Detected native architecture ${ARCHITECTURE}.")
set(CMAKE_OSX_ARCHITECTURES "${ARCHITECTURE}")
endif()
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
set(OSX_DEPLOYMENT_TARGET 10.13)
else()
set(OSX_DEPLOYMENT_TARGET 11.00)
endif()
set(OSX_SYSROOT ${XCODE_DEV_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk)
# Use same Xcode detection as Blender itself.
include(../cmake/platform/platform_apple_xcode.cmake)
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
set(BLENDER_PLATFORM_ARM ON)
endif()
set(PLATFORM_CFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
set(PLATFORM_CXXFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -std=c++11 -stdlib=libc++ -arch ${CMAKE_OSX_ARCHITECTURES}")
set(PLATFORM_LDFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
set(PLATFORM_CFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
set(PLATFORM_CXXFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -std=c++11 -stdlib=libc++ -arch ${CMAKE_OSX_ARCHITECTURES}")
set(PLATFORM_LDFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
set(PLATFORM_BUILD_TARGET --build=x86_64-apple-darwin17.0.0) # OS X 10.13
else()
@@ -151,8 +118,8 @@ else()
endif()
set(PLATFORM_CMAKE_FLAGS
-DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_SYSROOT:PATH=${OSX_SYSROOT}
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT}
)
else()
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
@@ -186,8 +153,8 @@ else()
set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG ${PLATFORM_CXXFLAGS}")
set(CONFIGURE_ENV
export MACOSX_DEPLOYMENT_TARGET=${OSX_DEPLOYMENT_TARGET} &&
export MACOSX_SDK_VERSION=${OSX_DEPLOYMENT_TARGET} &&
export MACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} &&
export MACOSX_SDK_VERSION=${CMAKE_OSX_DEPLOYMENT_TARGET} &&
export CFLAGS=${PLATFORM_CFLAGS} &&
export CXXFLAGS=${PLATFORM_CXXFLAGS} &&
export LDFLAGS=${PLATFORM_LDFLAGS}

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_opus
URL file://${PACKAGE_DIR}/${OPUS_FILE}

View File

@@ -1,51 +1,17 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(OSL_CMAKE_CXX_STANDARD_LIBRARIES "kernel32${LIBEXT} user32${LIBEXT} gdi32${LIBEXT} winspool${LIBEXT} shell32${LIBEXT} ole32${LIBEXT} oleaut32${LIBEXT} uuid${LIBEXT} comdlg32${LIBEXT} advapi32${LIBEXT} psapi${LIBEXT}")
set(OSL_FLEX_BISON -DFLEX_EXECUTABLE=${LIBDIR}/flexbison/win_flex.exe -DBISON_EXECUTABLE=${LIBDIR}/flexbison/win_bison.exe)
set(OSL_SIMD_FLAGS -DOIIO_NOSIMD=1 -DOIIO_SIMD=sse2)
else()
set(OSL_CMAKE_CXX_STANDARD_LIBRARIES)
set(OSL_FLEX_BISON)
set(OSL_OPENIMAGEIO_LIBRARY "${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO${LIBEXT};${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO_Util${LIBEXT};${LIBDIR}/png/lib/${LIBPREFIX}png16${LIBEXT};${LIBDIR}/jpg/lib/${LIBPREFIX}jpeg${LIBEXT};${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT};${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}")
set(OSL_OPENIMAGEIO_LIBRARY "${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO${LIBEXT};${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO_Util${LIBEXT};${LIBDIR}/png/lib/${LIBPREFIX}png16${LIBEXT};${LIBDIR}/jpeg/lib/${LIBPREFIX}jpeg${LIBEXT};${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT};${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}")
endif()
set(OSL_ILMBASE_CUSTOM_LIBRARIES "${LIBDIR}/openexr/lib/Imath${OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/Half{OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/IlmThread${OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/Iex${OPENEXR_VERSION_POSTFIX}.lib")
set(OSL_EXTRA_ARGS
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
-DBoost_USE_MULTITHREADED=ON
-DBoost_USE_STATIC_LIBS=ON
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
${DEFAULT_BOOST_FLAGS}
-DOpenEXR_ROOT=${LIBDIR}/openexr/
-DIlmBase_ROOT=${LIBDIR}/openexr/
-DILMBASE_INCLUDE_DIR=${LIBDIR}/openexr/include/
-DOPENEXR_HALF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Half${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_IMATH_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_ILMTHREAD_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmThread${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_IEX_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/openexr/include/
-DOPENEXR_ILMIMF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOpenImageIO_ROOT=${LIBDIR}/openimageio/
-DOSL_BUILD_TESTS=OFF
-DOSL_BUILD_MATERIALX=OFF
@@ -65,10 +31,10 @@ set(OSL_EXTRA_ARGS
-DUSE_QT=OFF
-DUSE_Qt5=OFF
-DINSTALL_DOCS=OFF
${OSL_SIMD_FLAGS}
-Dpugixml_ROOT=${LIBDIR}/pugixml
-DUSE_PYTHON=OFF
-DCMAKE_CXX_STANDARD=14
-DImath_ROOT=${LIBDIR}/imath
)
ExternalProject_Add(external_osl

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(MSVC)
set(PYTARGET ${HARVEST_TARGET}/python/${PYTHON_SHORT_VERSION_NO_DOTS})

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(PNG_EXTRA_ARGS
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(POTRACE_EXTRA_ARGS
)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(PUGIXML_EXTRA_ARGS
)

View File

@@ -0,0 +1,22 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(PYSTRING_EXTRA_ARGS
)
ExternalProject_Add(external_pystring
URL file://${PACKAGE_DIR}/${PYSTRING_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${PYSTRING_HASH_TYPE}=${PYSTRING_HASH}
PREFIX ${BUILD_DIR}/pystring
PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${PATCH_DIR}/cmakelists_pystring.txt ${BUILD_DIR}/pystring/src/external_pystring/CMakeLists.txt
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/pystring ${DEFAULT_CMAKE_FLAGS} ${PYSTRING_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/pystring
)
if(WIN32)
ExternalProject_Add_Step(external_pystring after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/pystring/lib ${HARVEST_TARGET}/pystring/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/pystring/include ${HARVEST_TARGET}/pystring/include
DEPENDEES install
)
endif()

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(PYTHON_POSTFIX)
if(BUILD_MODE STREQUAL Debug)
@@ -43,6 +27,7 @@ if(WIN32)
PREFIX ${BUILD_DIR}/python
CONFIGURE_COMMAND ""
BUILD_COMMAND cd ${BUILD_DIR}/python/src/external_python/pcbuild/ && set IncludeTkinter=false && call build.bat -e -p x64 -c ${BUILD_MODE}
PATCH_COMMAND ${PATCH_CMD} --verbose -p1 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_windows.diff
INSTALL_COMMAND ${PYTHON_BINARY_INTERNAL} ${PYTHON_SRC}/PC/layout/main.py -b ${PYTHON_SRC}/PCbuild/amd64 -s ${PYTHON_SRC} -t ${PYTHON_SRC}/tmp/ --include-stable --include-pip --include-dev --include-launchers --include-venv --include-symbols ${PYTHON_EXTRA_INSTLAL_FLAGS} --copy ${LIBDIR}/python
)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32 AND BUILD_MODE STREQUAL Debug)
set(SITE_PACKAGES_EXTRA --global-option build --global-option --debug)
@@ -31,7 +15,7 @@ ExternalProject_Add(external_python_site_packages
CONFIGURE_COMMAND ${PIP_CONFIGURE_COMMAND}
BUILD_COMMAND ""
PREFIX ${BUILD_DIR}/site_packages
INSTALL_COMMAND ${PYTHON_BINARY} -m pip install ${SITE_PACKAGES_EXTRA} cython==${CYTHON_VERSION} idna==${IDNA_VERSION} charset-normalizer==${CHARSET_NORMALIZER_VERSION} urllib3==${URLLIB3_VERSION} certifi==${CERTIFI_VERSION} requests==${REQUESTS_VERSION} zstandard==${ZSTANDARD_VERSION} --no-binary :all:
INSTALL_COMMAND ${PYTHON_BINARY} -m pip install --no-cache-dir ${SITE_PACKAGES_EXTRA} cython==${CYTHON_VERSION} idna==${IDNA_VERSION} charset-normalizer==${CHARSET_NORMALIZER_VERSION} urllib3==${URLLIB3_VERSION} certifi==${CERTIFI_VERSION} requests==${REQUESTS_VERSION} zstandard==${ZSTANDARD_VERSION} autopep8==${AUTOPEP8_VERSION} pycodestyle==${PYCODESTYLE_VERSION} toml==${TOML_VERSION} --no-binary :all:
)
if(USE_PIP_NUMPY)

View File

@@ -0,0 +1,13 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(ROBINMAP_EXTRA_ARGS
)
ExternalProject_Add(external_robinmap
URL file://${PACKAGE_DIR}/${ROBINMAP_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${ROBINMAP_HASH_TYPE}=${ROBINMAP_HASH}
PREFIX ${BUILD_DIR}/robinmap
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/robinmap ${DEFAULT_CMAKE_FLAGS} ${ROBINMAP_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/robinmap
)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(SDL_EXTRA_ARGS

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
####################################################################################################################
# Mingw64 Builds

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(SNDFILE_EXTRA_ARGS)
set(SNDFILE_ENV PKG_CONFIG_PATH=${mingw_LIBDIR}/ogg/lib/pkgconfig:${mingw_LIBDIR}/vorbis/lib/pkgconfig:${mingw_LIBDIR}/flac/lib/pkgconfig:${mingw_LIBDIR})

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_spnav
URL file://${PACKAGE_DIR}/${SPNAV_FILE}

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(SQLITE_CONFIGURE_ENV echo .)
set(SQLITE_CONFIGURATION_ARGS)

View File

@@ -1,25 +1,9 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_sse2neon
GIT_REPOSITORY ${SSE2NEON_GIT}
GIT_TAG ${SSE2NEON_GIT_HASH}
URL file://${PACKAGE_DIR}/${SSE2NEON_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${SSE2NEON_HASH_TYPE}=${SSE2NEON_HASH}
PREFIX ${BUILD_DIR}/sse2neon
CONFIGURE_COMMAND echo sse2neon - Nothing to configure
BUILD_COMMAND echo sse2neon - nothing to build

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(SSL_CONFIGURE_COMMAND ./Configure)
set(SSL_PATCH_CMD echo .)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(TBB_EXTRA_ARGS
-DTBB_BUILD_SHARED=On

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(UNIX)
set(THEORA_CONFIGURE_ENV ${CONFIGURE_ENV} && export HAVE_PDFLATEX=no)

View File

@@ -1,36 +1,16 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
if(WITH_WEBP)
set(WITH_TIFF_WEBP ON)
else()
set(WITH_TIFF_WEBP OFF)
endif()
# SPDX-License-Identifier: GPL-2.0-or-later
set(TIFF_EXTRA_ARGS
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include
-DJPEG_LIBRARY=${LIBDIR}/jpeg/lib/${JPEG_LIBRARY}
-DJPEG_INCLUDE_DIR=${LIBDIR}/jpeg/include
-DPNG_STATIC=ON
-DBUILD_SHARED_LIBS=OFF
-Dlzma=OFF
-Djbig=OFF
-Dzstd=OFF
-Dwebp=${WITH_TIFF_WEBP}
-Dwebp=OFF
)
ExternalProject_Add(external_tiff
@@ -46,10 +26,12 @@ add_dependencies(
external_tiff
external_zlib
)
if(WIN32 AND BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_tiff after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tiff/lib/tiffd${LIBEXT} ${LIBDIR}/tiff/lib/tiff${LIBEXT}
DEPENDEES install
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_tiff after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tiff/lib/tiff.lib ${HARVEST_TARGET}/tiff/lib/libtiff.lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tiff/include/ ${HARVEST_TARGET}/tiff/include/
DEPENDEES install
)
endif()
endif()

View File

@@ -1,55 +1,72 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
# OIIO and OSL are statically linked for us, but USD doesn't know
set(USD_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DOIIO_STATIC_DEFINE /DOSL_STATIC_DEFINE")
if(BUILD_MODE STREQUAL Debug)
# USD does not look for debug libs, nor does it link them
# when building static, so this is just to keep find_package happy
# if we ever link dynamically on windows util will need to be linked as well.
set(USD_OIIO_CMAKE_DEFINES "-DOIIO_LIBRARIES=${LIBDIR}/openimageio/lib/OpenImageIO_d${LIBEXT}")
endif()
set(USD_PLATFORM_FLAGS
${USD_OIIO_CMAKE_DEFINES}
-DCMAKE_CXX_FLAGS=${USD_CXX_FLAGS}
)
endif()
set(USD_EXTRA_ARGS
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
-DBoost_USE_MULTITHREADED=ON
-DBoost_USE_STATIC_LIBS=ON
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DBoost_NO_SYSTEM_PATHS=ON
-DBoost_NO_BOOST_CMAKE=ON
${DEFAULT_BOOST_FLAGS}
${USD_PLATFORM_FLAGS}
# This is a preventative measure that avoids possible conflicts when add-ons
# try to load another USD library into the same process space.
-DPXR_SET_INTERNAL_NAMESPACE=usdBlender
-DOPENSUBDIV_ROOT_DIR=${LIBDIR}/opensubdiv
-DOpenImageIO_ROOT=${LIBDIR}/openimageio
-DOPENEXR_LIBRARIES=${LIBDIR}/imath/lib/imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/imath/include
-DPXR_ENABLE_PYTHON_SUPPORT=OFF
-DPXR_BUILD_IMAGING=ON
-DPXR_BUILD_TESTS=OFF
-DPXR_BUILD_EXAMPLES=OFF
-DPXR_BUILD_TUTORIALS=OFF
-DPXR_ENABLE_HDF5_SUPPORT=OFF
-DPXR_ENABLE_MATERIALX_SUPPORT=OFF
-DPXR_ENABLE_OPENVDB_SUPPORT=OFF
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
-DPXR_BUILD_MONOLITHIC=ON
# OSL is an optional dependency of the Imaging module. However, since that
# module was included for its support for converting primitive shapes (sphere,
# cube, etc.) to geometry, it's not necessary. Disabling it will make it
# simpler to build Blender; currently only Cycles uses OSL.
-DPXR_ENABLE_OSL_SUPPORT=OFF
# GL support on Linux also links to X11 libraries. Enabling it would break
# headless or Wayland-only builds. OpenGL support would be useful if someone
# wants to work on a Hydra viewport in Blender; when that's actually being
# worked on, we could patch in a new PXR_ENABLE_X11_SUPPORT option (to
# separate OpenGL from X11) and contribute it upstream.
-DPXR_ENABLE_GL_SUPPORT=OFF
# Disable Metal since USD fails to build this when OpenGL is disabled.
-DPXR_ENABLE_METAL_SUPPORT=OFF
# OIIO is used for loading image textures in Hydra Storm / Embree renderers,
# which we don't use.
-DPXR_BUILD_OPENIMAGEIO_PLUGIN=OFF
# USD 22.03 does not support OCIO 2.x
# Tracking ticket https://github.com/PixarAnimationStudios/USD/issues/1386
-DPXR_BUILD_OPENCOLORIO_PLUGIN=OFF
-DPXR_ENABLE_PTEX_SUPPORT=OFF
-DPXR_BUILD_USD_TOOLS=OFF
-DCMAKE_DEBUG_POSTFIX=_d
-DBUILD_SHARED_LIBS=Off
# USD is hellbound on making a shared lib, unless you point this variable to a valid cmake file
# doesn't have to make sense, but as long as it points somewhere valid it will skip the shared lib.
-DPXR_MONOLITHIC_IMPORT=${BUILD_DIR}/usd/src/external_usd/cmake/defaults/Version.cmake
-DTBB_INCLUDE_DIRS=${LIBDIR}/tbb/include
-DTBB_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
-DTbb_TBB_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
# USD wants the tbb debug lib set even when you are doing a release build
# Otherwise it will error out during the cmake configure phase.
-DTBB_LIBRARIES_DEBUG=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
# This is a preventative measure that avoids possible conflicts when add-ons
# try to load another USD library into the same process space.
-DPXR_SET_INTERNAL_NAMESPACE=usdBlender
-DPXR_ENABLE_PYTHON_SUPPORT=OFF
-DPXR_BUILD_IMAGING=OFF
-DPXR_BUILD_TESTS=OFF
-DBUILD_SHARED_LIBS=OFF
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
-DPXR_BUILD_MONOLITHIC=ON
# The PXR_BUILD_USD_TOOLS argument is patched-in by usd.diff. An upstream pull request
# can be found at https://github.com/PixarAnimationStudios/USD/pull/1048.
-DPXR_BUILD_USD_TOOLS=OFF
-DCMAKE_DEBUG_POSTFIX=_d
# USD is hellbound on making a shared lib, unless you point this variable to a valid cmake file
# doesn't have to make sense, but as long as it points somewhere valid it will skip the shared lib.
-DPXR_MONOLITHIC_IMPORT=${BUILD_DIR}/usd/src/external_usd/cmake/defaults/Version.cmake
)
ExternalProject_Add(external_usd
@@ -66,29 +83,31 @@ add_dependencies(
external_usd
external_tbb
external_boost
external_opensubdiv
)
# Since USD 21.11 the libraries are prefixed with "usd_", i.e. "libusd_m.a" became "libusd_usd_m.a".
# See https://github.com/PixarAnimationStudios/USD/blob/release/CHANGELOG.md#2111---2021-11-01
if(NOT WIN32)
if (USD_VERSION VERSION_LESS 21.11)
set(PXR_LIB_PREFIX "")
else()
set(PXR_LIB_PREFIX "usd_")
endif()
endif()
if(WIN32)
# USD currently demands python be available at build time
# and then proceeds not to use it, but still checks that the
# version of the interpreter it is not going to use is atleast 2.7
# so we need this dep currently since there is no system python
# on windows.
add_dependencies(
external_usd
external_python
)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_usd after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/ ${HARVEST_TARGET}/usd
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Release/usd_m.lib ${HARVEST_TARGET}/usd/lib/libusd_m.lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Release/usd_usd_m.lib ${HARVEST_TARGET}/usd/lib/usd_usd_m.lib
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_usd after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/lib ${HARVEST_TARGET}/usd/lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Debug/usd_m_d.lib ${HARVEST_TARGET}/usd/lib/libusd_m_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Debug/usd_usd_m_d.lib ${HARVEST_TARGET}/usd/lib/usd_usd_m_d.lib
DEPENDEES install
)
endif()
@@ -100,7 +119,7 @@ else()
# case (only the shared library). As a result, we need to grab the `libusd_m.a`
# file from the build directory instead of from the install directory.
ExternalProject_Add_Step(external_usd after_install
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/libusd_m.a ${HARVEST_TARGET}/usd/lib/libusd_m.a
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/lib${PXR_LIB_PREFIX}usd_m.a ${HARVEST_TARGET}/usd/lib/lib${PXR_LIB_PREFIX}usd_m.a
DEPENDEES install
)
endif()

View File

@@ -1,30 +1,23 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(ZLIB_VERSION 1.2.11)
# CPE's are used to identify dependencies, for more information on what they
# are please see https://nvd.nist.gov/products/cpe
#
# We use them in combination with cve-bin-tool to scan for known security issues.
#
# Not all of our dependencies are currently in the nvd database so not all
# dependencies have one assigned.
set(ZLIB_VERSION 1.2.12)
set(ZLIB_URI https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz)
set(ZLIB_HASH 1c9f62f0778697a09d36121ead88e08e)
set(ZLIB_HASH 5fc414a9726be31427b440b434d05f78)
set(ZLIB_HASH_TYPE MD5)
set(ZLIB_FILE zlib-${ZLIB_VERSION}.tar.gz)
set(ZLIB_CPE "cpe:2.3:a:zlib:zlib:${ZLIB_VERSION}:*:*:*:*:*:*:*")
set(OPENAL_VERSION 1.20.1)
set(OPENAL_VERSION 1.21.1)
set(OPENAL_URI http://openal-soft.org/openal-releases/openal-soft-${OPENAL_VERSION}.tar.bz2)
set(OPENAL_HASH 556695068ce8375b89986083d810fd35)
set(OPENAL_HASH a936806ebd8de417b0ffd8cf3f48f456)
set(OPENAL_HASH_TYPE MD5)
set(OPENAL_FILE openal-soft-${OPENAL_VERSION}.tar.bz2)
@@ -33,27 +26,31 @@ set(PNG_URI http://prdownloads.sourceforge.net/libpng/libpng-${PNG_VERSION}.tar.
set(PNG_HASH 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca)
set(PNG_HASH_TYPE SHA256)
set(PNG_FILE libpng-${PNG_VERSION}.tar.xz)
set(PNG_CPE "cpe:2.3:a:libpng:libpng:${PNG_VERSION}:*:*:*:*:*:*:*")
set(JPEG_VERSION 2.0.4)
set(JPEG_VERSION 2.1.3)
set(JPEG_URI https://github.com/libjpeg-turbo/libjpeg-turbo/archive/${JPEG_VERSION}.tar.gz)
set(JPEG_HASH 44c43e4a9fb352f47090804529317c88)
set(JPEG_HASH 627b980fad0573e08e4c3b80b290fc91)
set(JPEG_HASH_TYPE MD5)
set(JPEG_FILE libjpeg-turbo-${JPEG_VERSION}.tar.gz)
set(JPEG_CPE "cpe:2.3:a:d.r.commander:libjpeg-turbo:${JPEG_VERSION}:*:*:*:*:*:*:*")
set(BOOST_VERSION 1.73.0)
set(BOOST_VERSION_NODOTS 1_73_0)
set(BOOST_VERSION_NODOTS_SHORT 1_73)
set(BOOST_VERSION 1.78.0)
set(BOOST_VERSION_SHORT 1.78)
set(BOOST_VERSION_NODOTS 1_78_0)
set(BOOST_VERSION_NODOTS_SHORT 1_78)
set(BOOST_URI https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_NODOTS}.tar.gz)
set(BOOST_HASH 4036cd27ef7548b8d29c30ea10956196)
set(BOOST_HASH c2f6428ac52b0e5a3c9b2e1d8cc832b5)
set(BOOST_HASH_TYPE MD5)
set(BOOST_FILE boost_${BOOST_VERSION_NODOTS}.tar.gz)
set(BOOST_CPE "cpe:2.3:a:boost:boost:${BOOST_VERSION}:*:*:*:*:*:*:*")
# Using old version as recommended by OpenVDB build documentation.
set(BLOSC_VERSION 1.5.0)
set(BLOSC_VERSION 1.21.1)
set(BLOSC_URI https://github.com/Blosc/c-blosc/archive/v${BLOSC_VERSION}.tar.gz)
set(BLOSC_HASH 6e4a49c8c06f05aa543f3312cfce3d55)
set(BLOSC_HASH 134b55813b1dca57019d2a2dc1f7a923)
set(BLOSC_HASH_TYPE MD5)
set(BLOSC_FILE blosc-${BLOSC_VERSION}.tar.gz)
set(BLOSC_CPE "cpe:2.3:a:c-blosc2_project:c-blosc2:${BLOSC_VERSION}:*:*:*:*:*:*:*")
set(PTHREADS_VERSION 3.0.0)
set(PTHREADS_URI http://prdownloads.sourceforge.net/pthreads4w/pthreads4w-code-v${PTHREADS_VERSION}.zip)
@@ -61,11 +58,19 @@ set(PTHREADS_HASH f3bf81bb395840b3446197bcf4ecd653)
set(PTHREADS_HASH_TYPE MD5)
set(PTHREADS_FILE pthreads4w-code-${PTHREADS_VERSION}.zip)
set(OPENEXR_VERSION 2.5.5)
set(OPENEXR_VERSION 3.1.5)
set(OPENEXR_URI https://github.com/AcademySoftwareFoundation/openexr/archive/v${OPENEXR_VERSION}.tar.gz)
set(OPENEXR_HASH 85e8a979092c9055d10ed103062d31a0)
set(OPENEXR_HASH a92f38eedd43e56c0af56d4852506886)
set(OPENEXR_HASH_TYPE MD5)
set(OPENEXR_FILE openexr-${OPENEXR_VERSION}.tar.gz)
set(OPENEXR_CPE "cpe:2.3:a:openexr:openexr:${OPENEXR_VERSION}:*:*:*:*:*:*:*")
set(IMATH_VERSION 3.1.5)
set(IMATH_URI https://github.com/AcademySoftwareFoundation/Imath/archive/v${OPENEXR_VERSION}.tar.gz)
set(IMATH_HASH dd375574276c54872b7b3d54053baff0)
set(IMATH_HASH_TYPE MD5)
set(IMATH_FILE imath-${IMATH_VERSION}.tar.gz)
if(WIN32)
# Openexr started appending _d on its own so now
@@ -83,17 +88,18 @@ else()
set(OPENEXR_VERSION_POSTFIX)
endif()
set(FREETYPE_VERSION 2.10.2)
set(FREETYPE_VERSION 2.11.1)
set(FREETYPE_URI http://prdownloads.sourceforge.net/freetype/freetype-${FREETYPE_VERSION}.tar.gz)
set(FREETYPE_HASH b1cb620e4c875cd4d1bfa04945400945)
set(FREETYPE_HASH bd4e3b007474319909a6b79d50908e85)
set(FREETYPE_HASH_TYPE MD5)
set(FREETYPE_FILE freetype-${FREETYPE_VERSION}.tar.gz)
SET(FREETYPE_CPE "cpe:2.3:a:freetype:freetype:${FREETYPE_VERSION}:*:*:*:*:*:*:*")
set(GLEW_VERSION 1.13.0)
set(GLEW_URI http://prdownloads.sourceforge.net/glew/glew/${GLEW_VERSION}/glew-${GLEW_VERSION}.tgz)
set(GLEW_HASH 7cbada3166d2aadfc4169c4283701066)
set(GLEW_HASH_TYPE MD5)
set(GLEW_FILE glew-${GLEW_VERSION}.tgz)
set(EPOXY_VERSION 1.5.10)
set(EPOXY_URI https://github.com/anholt/libepoxy/archive/refs/tags/${EPOXY_VERSION}.tar.gz)
set(EPOXY_HASH f0730aad115c952e77591fcc805b1dc1)
set(EPOXY_HASH_TYPE MD5)
set(EPOXY_FILE libepoxy-${EPOXY_VERSION}.tar.gz)
set(FREEGLUT_VERSION 3.0.0)
set(FREEGLUT_URI http://prdownloads.sourceforge.net/freeglut/freeglut/${FREEGLUT_VERSION}/freeglut-${FREEGLUT_VERSION}.tar.gz)
@@ -101,44 +107,25 @@ set(FREEGLUT_HASH 90c3ca4dd9d51cf32276bc5344ec9754)
set(FREEGLUT_HASH_TYPE MD5)
set(FREEGLUT_FILE freeglut-${FREEGLUT_VERSION}.tar.gz)
set(ALEMBIC_VERSION 1.7.16)
set(ALEMBIC_VERSION 1.8.3)
set(ALEMBIC_URI https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.tar.gz)
set(ALEMBIC_HASH effcc86e42fe6605588e3de57bde6677)
set(ALEMBIC_HASH 2cd8d6e5a3ac4a014e24a4b04f4fadf9)
set(ALEMBIC_HASH_TYPE MD5)
set(ALEMBIC_FILE alembic-${ALEMBIC_VERSION}.tar.gz)
SET(FREETYPE_CPE "cpe:2.3:a:freetype:freetype:${FREETYPE_VERSION}:*:*:*:*:*:*:*")
# hash is for 3.1.2
set(GLFW_GIT_UID 30306e54705c3adae9fe082c816a3be71963485c)
set(GLFW_URI https://github.com/glfw/glfw/archive/${GLFW_GIT_UID}.zip)
set(GLFW_HASH 20cacb1613da7eeb092f3ac4f6b2b3d0)
set(GLFW_HASH_TYPE MD5)
set(GLFW_FILE glfw-${GLFW_GIT_UID}.zip)
# latest uid in git as of 2016-04-01
set(CLEW_GIT_UID 277db43f6cafe8b27c6f1055f69dc67da4aeb299)
set(CLEW_URI https://github.com/OpenCLWrangler/clew/archive/${CLEW_GIT_UID}.zip)
set(CLEW_HASH 2c699d10ed78362e71f56fae2a4c5f98)
set(CLEW_HASH_TYPE MD5)
set(CLEW_FILE clew-${CLEW_GIT_UID}.zip)
# latest uid in git as of 2016-04-01
set(CUEW_GIT_UID 1744972026de9cf27c8a7dc39cf39cd83d5f922f)
set(CUEW_URI https://github.com/CudaWrangler/cuew/archive/${CUEW_GIT_UID}.zip)
set(CUEW_HASH 86760d62978ebfd96cd93f5aa1abaf4a)
set(CUEW_HASH_TYPE MD5)
set(CUEW_FILE cuew-${CUEW_GIT_UID}.zip)
set(OPENSUBDIV_VERSION v3_4_3)
set(OPENSUBDIV_VERSION v3_4_4)
set(OPENSUBDIV_URI https://github.com/PixarAnimationStudios/OpenSubdiv/archive/${OPENSUBDIV_VERSION}.tar.gz)
set(OPENSUBDIV_HASH 7bbfa275d021fb829e521df749160edb)
set(OPENSUBDIV_HASH 39ecc5caf0abebc943d1ce131855e76e)
set(OPENSUBDIV_HASH_TYPE MD5)
set(OPENSUBDIV_FILE opensubdiv-${OPENSUBDIV_VERSION}.tar.gz)
set(SDL_VERSION 2.0.12)
set(SDL_VERSION 2.0.20)
set(SDL_URI https://www.libsdl.org/release/SDL2-${SDL_VERSION}.tar.gz)
set(SDL_HASH 783b6f2df8ff02b19bb5ce492b99c8ff)
set(SDL_HASH a53acc02e1cca98c4123229069b67c9e)
set(SDL_HASH_TYPE MD5)
set(SDL_FILE SDL2-${SDL_VERSION}.tar.gz)
set(SDL_CPE "cpe:2.3:a:libsdl:sdl:${SDL_VERSION}:*:*:*:*:*:*:*")
set(OPENCOLLADA_VERSION v1.6.68)
set(OPENCOLLADA_URI https://github.com/KhronosGroup/OpenCOLLADA/archive/${OPENCOLLADA_VERSION}.tar.gz)
@@ -146,9 +133,9 @@ set(OPENCOLLADA_HASH ee7dae874019fea7be11613d07567493)
set(OPENCOLLADA_HASH_TYPE MD5)
set(OPENCOLLADA_FILE opencollada-${OPENCOLLADA_VERSION}.tar.gz)
set(OPENCOLORIO_VERSION 2.0.0)
set(OPENCOLORIO_VERSION 2.1.1)
set(OPENCOLORIO_URI https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v${OPENCOLORIO_VERSION}.tar.gz)
set(OPENCOLORIO_HASH 1a2e3478b6cd9a1549f24e1b2205e3f0)
set(OPENCOLORIO_HASH 604f562e073f23d88ce89ed4f7f709ba)
set(OPENCOLORIO_HASH_TYPE MD5)
set(OPENCOLORIO_FILE OpenColorIO-${OPENCOLORIO_VERSION}.tar.gz)
@@ -157,6 +144,7 @@ set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LL
set(LLVM_HASH 5a4fab4d7fc84aefffb118ac2c8a4fc0)
set(LLVM_HASH_TYPE MD5)
set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_CPE "cpe:2.3:a:llvm:compiler:${LLVM_VERSION}:*:*:*:*:*:*:*")
if(APPLE)
# Cloth physics test is crashing due to this bug:
@@ -171,82 +159,106 @@ set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENIMAGEIO_VERSION 2.2.15.1)
set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/Release-${OPENIMAGEIO_VERSION}.tar.gz)
set(OPENIMAGEIO_HASH 3db5c5f0b3dc91597c75e5df09eb9072)
set(OPENIMAGEIO_VERSION v2.3.13.0)
set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/refs/tags/${OPENIMAGEIO_VERSION}.tar.gz)
set(OPENIMAGEIO_HASH de45fb38501c4581062b522b53b6141c)
set(OPENIMAGEIO_HASH_TYPE MD5)
set(OPENIMAGEIO_FILE OpenImageIO-${OPENIMAGEIO_VERSION}.tar.gz)
set(TIFF_VERSION 4.1.0)
# 8.0.0 is currently oiio's preferred version although never versions may be available.
# the preferred version can be found in oiio's externalpackages.cmake
set(FMT_VERSION 8.0.0)
set(FMT_URI https://github.com/fmtlib/fmt/archive/refs/tags/${FMT_VERSION}.tar.gz)
set(FMT_HASH 7bce0e9e022e586b178b150002e7c2339994e3c2bbe44027e9abb0d60f9cce83)
set(FMT_HASH_TYPE SHA256)
set(FMT_FILE fmt-${FMT_VERSION}.tar.gz)
set(FMT_CPE "cpe:2.3:a:fmt:fmt:${FMT_VERSION}:*:*:*:*:*:*:*")
# 0.6.2 is currently oiio's preferred version although never versions may be available.
# the preferred version can be found in oiio's externalpackages.cmake
set(ROBINMAP_VERSION v0.6.2)
set(ROBINMAP_URI https://github.com/Tessil/robin-map/archive/refs/tags/${ROBINMAP_VERSION}.tar.gz)
set(ROBINMAP_HASH c08ec4b1bf1c85eb0d6432244a6a89862229da1cb834f3f90fba8dc35d8c8ef1)
set(ROBINMAP_HASH_TYPE SHA256)
set(ROBINMAP_FILE robinmap-${ROBINMAP_VERSION}.tar.gz)
set(TIFF_VERSION 4.4.0)
set(TIFF_URI http://download.osgeo.org/libtiff/tiff-${TIFF_VERSION}.tar.gz)
set(TIFF_HASH 2165e7aba557463acc0664e71a3ed424)
set(TIFF_HASH 376f17f189e9d02280dfe709b2b2bbea)
set(TIFF_HASH_TYPE MD5)
set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz)
set(TIFF_CPE "cpe:2.3:a:libtiff:libtiff:${TIFF_VERSION}:*:*:*:*:*:*:*")
set(OSL_VERSION 1.11.14.1)
set(OSL_VERSION 1.11.17.0)
set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz)
set(OSL_HASH 1abd7ce40481771a9fa937f19595d2f2)
set(OSL_HASH 63265472ce14548839ace2e21e401544)
set(OSL_HASH_TYPE MD5)
set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
set(PYTHON_VERSION 3.9.7)
set(PYTHON_SHORT_VERSION 3.9)
set(PYTHON_SHORT_VERSION_NO_DOTS 39)
set(PYTHON_VERSION 3.10.2)
set(PYTHON_SHORT_VERSION 3.10)
set(PYTHON_SHORT_VERSION_NO_DOTS 310)
set(PYTHON_URI https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz)
set(PYTHON_HASH fddb060b483bc01850a3f412eea1d954)
set(PYTHON_HASH 14e8c22458ed7779a1957b26cde01db9)
set(PYTHON_HASH_TYPE MD5)
set(PYTHON_FILE Python-${PYTHON_VERSION}.tar.xz)
set(PYTHON_CPE "cpe:2.3:a:python:python:${PYTHON_VERSION}:-:*:*:*:*:*:*")
set(TBB_VERSION 2020_U2)
set(TBB_YEAR 2020)
set(TBB_VERSION ${TBB_YEAR}_U3)
set(TBB_URI https://github.com/oneapi-src/oneTBB/archive/${TBB_VERSION}.tar.gz)
set(TBB_HASH 1b711ae956524855088df3bbf5ec65dc)
set(TBB_HASH 55ec8df6eae5ed6364a47f0e671e460c)
set(TBB_HASH_TYPE MD5)
set(TBB_FILE oneTBB-${TBB_VERSION}.tar.gz)
set(TBB_CPE "cpe:2.3:a:intel:threading_building_blocks:${TBB_YEAR}:*:*:*:*:*:*:*")
set(OPENVDB_VERSION 8.0.1)
set(OPENVDB_VERSION 9.0.0)
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
set(OPENVDB_HASH 01b490be16cc0e15c690f9a153c21461)
set(OPENVDB_HASH 684ce40c2f74f3a0c9cac530e1c7b07e)
set(OPENVDB_HASH_TYPE MD5)
set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
set(NANOVDB_GIT_UID dc37d8a631922e7bef46712947dc19b755f3e841)
set(NANOVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_GIT_UID}.tar.gz)
set(NANOVDB_HASH e7b9e863ec2f3b04ead171dec2322807)
set(NANOVDB_HASH_TYPE MD5)
set(NANOVDB_FILE nano-vdb-${NANOVDB_GIT_UID}.tar.gz)
set(IDNA_VERSION 3.2)
set(CHARSET_NORMALIZER_VERSION 2.0.6)
set(URLLIB3_VERSION 1.26.7)
set(IDNA_VERSION 3.3)
set(CHARSET_NORMALIZER_VERSION 2.0.10)
set(URLLIB3_VERSION 1.26.8)
set(URLLIB3_CPE "cpe:2.3:a:urllib3:urllib3:${URLLIB3_VERSION}:*:*:*:*:*:*:*")
set(CERTIFI_VERSION 2021.10.8)
set(REQUESTS_VERSION 2.26.0)
set(CYTHON_VERSION 0.29.24)
set(ZSTANDARD_VERSION 0.15.2 )
set(REQUESTS_VERSION 2.27.1)
set(CYTHON_VERSION 0.29.26)
# The version of the zstd library used to build the Python package should match ZSTD_VERSION defined below.
# At this time of writing, 0.17.0 was already released, but built against zstd 1.5.1, while we use 1.5.0.
set(ZSTANDARD_VERSION 0.16.0)
set(AUTOPEP8_VERSION 1.6.0)
set(PYCODESTYLE_VERSION 2.8.0)
set(TOML_VERSION 0.10.2)
set(NUMPY_VERSION 1.21.2)
set(NUMPY_SHORT_VERSION 1.21)
set(NUMPY_VERSION 1.22.0)
set(NUMPY_SHORT_VERSION 1.22)
set(NUMPY_URI https://github.com/numpy/numpy/releases/download/v${NUMPY_VERSION}/numpy-${NUMPY_VERSION}.zip)
set(NUMPY_HASH 5638d5dae3ca387be562912312db842e)
set(NUMPY_HASH 252de134862a27bd66705d29622edbfe)
set(NUMPY_HASH_TYPE MD5)
set(NUMPY_FILE numpy-${NUMPY_VERSION}.zip)
set(NUMPY_CPE "cpe:2.3:a:numpy:numpy:${NUMPY_VERSION}:*:*:*:*:*:*:*")
set(LAME_VERSION 3.100)
set(LAME_URI http://downloads.sourceforge.net/project/lame/lame/3.100/lame-${LAME_VERSION}.tar.gz)
set(LAME_HASH 83e260acbe4389b54fe08e0bdbf7cddb)
set(LAME_HASH_TYPE MD5)
set(LAME_FILE lame-${LAME_VERSION}.tar.gz)
set(LAME_CPE "cpe:2.3:a:lame_project:lame:${LAME_VERSION}:*:*:*:*:*:*:*")
set(OGG_VERSION 1.3.4)
set(OGG_VERSION 1.3.5)
set(OGG_URI http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz)
set(OGG_HASH fe5670640bd49e828d64d2879c31cb4dde9758681bb664f9bdbf159a01b0c76e)
set(OGG_HASH 0eb4b4b9420a0f51db142ba3f9c64b333f826532dc0f48c6410ae51f4799b664)
set(OGG_HASH_TYPE SHA256)
set(OGG_FILE libogg-${OGG_VERSION}.tar.gz)
set(VORBIS_VERSION 1.3.6)
set(VORBIS_VERSION 1.3.7)
set(VORBIS_URI http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz)
set(VORBIS_HASH 6ed40e0241089a42c48604dc00e362beee00036af2d8b3f46338031c9e0351cb)
set(VORBIS_HASH 0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab)
set(VORBIS_HASH_TYPE SHA256)
set(VORBIS_FILE libvorbis-${VORBIS_VERSION}.tar.gz)
set(VORBIS_CPE "cpe:2.3:a:xiph.org:libvorbis:${VORBIS_VERSION}:*:*:*:*:*:*:*")
set(THEORA_VERSION 1.1.1)
set(THEORA_URI http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.bz2)
@@ -254,17 +266,19 @@ set(THEORA_HASH b6ae1ee2fa3d42ac489287d3ec34c5885730b1296f0801ae577a35193d3affbc
set(THEORA_HASH_TYPE SHA256)
set(THEORA_FILE libtheora-${THEORA_VERSION}.tar.bz2)
set(FLAC_VERSION 1.3.3)
set(FLAC_VERSION 1.3.4)
set(FLAC_URI http://downloads.xiph.org/releases/flac/flac-${FLAC_VERSION}.tar.xz)
set(FLAC_HASH 213e82bd716c9de6db2f98bcadbc4c24c7e2efe8c75939a1a84e28539c4e1748)
set(FLAC_HASH 8ff0607e75a322dd7cd6ec48f4f225471404ae2730d0ea945127b1355155e737 )
set(FLAC_HASH_TYPE SHA256)
set(FLAC_FILE flac-${FLAC_VERSION}.tar.xz)
set(FLAC_CPE "cpe:2.3:a:flac_project:flac:${FLAC_VERSION}:*:*:*:*:*:*:*")
set(VPX_VERSION 1.8.2)
set(VPX_VERSION 1.11.0)
set(VPX_URI https://github.com/webmproject/libvpx/archive/v${VPX_VERSION}/libvpx-v${VPX_VERSION}.tar.gz)
set(VPX_HASH 8735d9fcd1a781ae6917f28f239a8aa358ce4864ba113ea18af4bb2dc8b474ac)
set(VPX_HASH 965e51c91ad9851e2337aebcc0f517440c637c506f3a03948062e3d5ea129a83)
set(VPX_HASH_TYPE SHA256)
set(VPX_FILE libvpx-v${VPX_VERSION}.tar.gz)
set(VPX_CPE "cpe:2.3:a:webmproject:libvpx:${VPX_VERSION}:*:*:*:*:*:*:*")
set(OPUS_VERSION 1.3.1)
set(OPUS_URI https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz)
@@ -272,9 +286,9 @@ set(OPUS_HASH 65b58e1e25b2a114157014736a3d9dfeaad8d41be1c8179866f144a2fb44ff9d)
set(OPUS_HASH_TYPE SHA256)
set(OPUS_FILE opus-${OPUS_VERSION}.tar.gz)
set(X264_VERSION 33f9e1474613f59392be5ab6a7e7abf60fa63622)
set(X264_VERSION 35fe20d1ba49918ec739a5b068c208ca82f977f7)
set(X264_URI https://code.videolan.org/videolan/x264/-/archive/${X264_VERSION}/x264-${X264_VERSION}.tar.gz)
set(X264_HASH 5456450ee1ae02cd2328be3157367a232a0ab73315e8c8f80dab80469524f525)
set(X264_HASH bb4f7da03936b5a030ed5827133b58eb3f701d7e5dce32cca4ba6df93797d42e)
set(X264_HASH_TYPE SHA256)
set(X264_FILE x264-${X264_VERSION}.tar.gz)
@@ -284,22 +298,24 @@ set(XVIDCORE_HASH abbdcbd39555691dd1c9b4d08f0a031376a3b211652c0d8b3b8aa9be1303ce
set(XVIDCORE_HASH_TYPE SHA256)
set(XVIDCORE_FILE xvidcore-${XVIDCORE_VERSION}.tar.gz)
set(OPENJPEG_VERSION 2.3.1)
set(OPENJPEG_SHORT_VERSION 2.3)
set(OPENJPEG_VERSION 2.4.0)
set(OPENJPEG_SHORT_VERSION 2.4)
set(OPENJPEG_URI https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz)
set(OPENJPEG_HASH 63f5a4713ecafc86de51bfad89cc07bb788e9bba24ebbf0c4ca637621aadb6a9)
set(OPENJPEG_HASH 8702ba68b442657f11aaeb2b338443ca8d5fb95b0d845757968a7be31ef7f16d)
set(OPENJPEG_HASH_TYPE SHA256)
set(OPENJPEG_FILE openjpeg-v${OPENJPEG_VERSION}.tar.gz)
set(OPENJPEG_CPE "cpe:2.3:a:uclouvain:openjpeg:${OPENJPEG_VERSION}:*:*:*:*:*:*:*")
set(FFMPEG_VERSION 4.4)
set(FFMPEG_VERSION 5.0)
set(FFMPEG_URI http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2)
set(FFMPEG_HASH 42093549751b582cf0f338a21a3664f52e0a9fbe0d238d3c992005e493607d0e)
set(FFMPEG_HASH c0130b8db2c763430fd1c6905288d61bc44ee0548ad5fcd2dfd650b88432bed9)
set(FFMPEG_HASH_TYPE SHA256)
set(FFMPEG_FILE ffmpeg-${FFMPEG_VERSION}.tar.bz2)
set(FFMPEG_CPE "cpe:2.3:a:ffmpeg:ffmpeg:${FFMPEG_VERSION}:*:*:*:*:*:*:*")
set(FFTW_VERSION 3.3.8)
set(FFTW_VERSION 3.3.10)
set(FFTW_URI http://www.fftw.org/fftw-${FFTW_VERSION}.tar.gz)
set(FFTW_HASH 8aac833c943d8e90d51b697b27d4384d)
set(FFTW_HASH 8ccbf6a5ea78a16dbc3e1306e234cc5c)
set(FFTW_HASH_TYPE MD5)
set(FFTW_FILE fftw-${FFTW_VERSION}.tar.gz)
@@ -314,12 +330,14 @@ set(SNDFILE_URI http://www.mega-nerd.com/libsndfile/files/libsndfile-${SNDFILE_V
set(SNDFILE_HASH 646b5f98ce89ac60cdb060fcd398247c)
set(SNDFILE_HASH_TYPE MD5)
set(SNDFILE_FILE libsndfile-${SNDFILE_VERSION}.tar.gz)
set(SNDFILE_CPE "cpe:2.3:a:libsndfile_project:libsndfile:${SNDFILE_VERSION}:*:*:*:*:*:*:*")
set(WEBP_VERSION 0.6.1)
set(WEBP_VERSION 1.2.2)
set(WEBP_URI https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz)
set(WEBP_HASH b49ce9c3e3e9acae4d91bca44bb85a72)
set(WEBP_HASH b5e2e414a8adee4c25fe56b18dd9c549)
set(WEBP_HASH_TYPE MD5)
set(WEBP_FILE libwebp-${WEBP_VERSION}.tar.gz)
set(WEBP_CPE "cpe:2.3:a:webmproject:libwebp:${WEBP_VERSION}:*:*:*:*:*:*:*")
set(SPNAV_VERSION 0.2.3)
set(SPNAV_URI http://downloads.sourceforge.net/project/spacenav/spacenav%20library%20%28SDK%29/libspnav%20${SPNAV_VERSION}/libspnav-${SPNAV_VERSION}.tar.gz)
@@ -338,6 +356,7 @@ set(XML2_URI http://xmlsoft.org/sources/libxml2-${XML2_VERSION}.tar.gz)
set(XML2_HASH 10942a1dc23137a8aa07f0639cbfece5)
set(XML2_HASH_TYPE MD5)
set(XML2_FILE libxml2-${XML2_VERSION}.tar.gz)
set(XML2_CPE "cpe:2.3:a:xmlsoft:libxml2:${XML2_VERSION}:*:*:*:*:*:*:*")
set(TINYXML_VERSION 2_6_2)
set(TINYXML_VERSION_DOTS 2.6.2)
@@ -345,24 +364,35 @@ set(TINYXML_URI https://nchc.dl.sourceforge.net/project/tinyxml/tinyxml/${TINYXM
set(TINYXML_HASH c1b864c96804a10526540c664ade67f0)
set(TINYXML_HASH_TYPE MD5)
set(TINYXML_FILE tinyxml_${TINYXML_VERSION}.tar.gz)
set(TINYXML_CPE "cpe:2.3:a:tinyxml_project:tinyxml:${TINYXML_VERSION_DOTS}:*:*:*:*:*:*:*")
set(YAMLCPP_VERSION 0.6.3)
set(YAMLCPP_URI https://codeload.github.com/jbeder/yaml-cpp/tar.gz/yaml-cpp-${YAMLCPP_VERSION})
set(YAMLCPP_HASH b45bf1089a382e81f6b661062c10d0c2)
set(YAMLCPP_HASH_TYPE MD5)
set(YAMLCPP_FILE yaml-cpp-${YAMLCPP_VERSION}.tar.gz)
set(YAMLCPP "cpe:2.3:a:yaml-cpp_project:yaml-cpp:${YAMLCPP_VERSION}:*:*:*:*:*:*:*")
set(EXPAT_VERSION 2_2_10)
set(PYSTRING_VERSION v1.1.3)
set(PYSTRING_URI https://codeload.github.com/imageworks/pystring/tar.gz/refs/tags/${PYSTRING_VERSION})
set(PYSTRING_HASH f2c68786b359f5e4e62bed53bc4fb86d)
set(PYSTRING_HASH_TYPE MD5)
set(PYSTRING_FILE pystring-${PYSTRING_VERSION}.tar.gz)
set(EXPAT_VERSION 2_4_4)
set(EXPAT_VERSION_DOTS 2.4.4)
set(EXPAT_URI https://github.com/libexpat/libexpat/archive/R_${EXPAT_VERSION}.tar.gz)
set(EXPAT_HASH 7ca5f09959fcb9a57618368deb627b9f)
set(EXPAT_HASH 2d3e81dee94b452369dc6394ff0f8f98)
set(EXPAT_HASH_TYPE MD5)
set(EXPAT_FILE libexpat-${EXPAT_VERSION}.tar.gz)
set(EXPAT_CPE "cpe:2.3:a:libexpat_project:libexpat:${EXPAT_VERSION_DOTS}:*:*:*:*:*:*:*")
set(PUGIXML_VERSION 1.10)
set(PUGIXML_URI https://github.com/zeux/pugixml/archive/v${PUGIXML_VERSION}.tar.gz)
set(PUGIXML_HASH 0c208b0664c7fb822bf1b49ad035e8fd)
set(PUGIXML_HASH_TYPE MD5)
set(PUGIXML_FILE pugixml-${PUGIXML_VERSION}.tar.gz)
set(PUGIXML_CPE "cpe:2.3:a:pugixml_project:pugixml:${PUGIXML_VERSION}:*:*:*:*:*:*:*")
set(FLEXBISON_VERSION 2.5.24)
set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison/win_flex_bison-${FLEXBISON_VERSION}.zip)
@@ -385,12 +415,14 @@ set(BZIP2_URI http://http.debian.net/debian/pool/main/b/bzip2/bzip2_${BZIP2_VERS
set(BZIP2_HASH ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269)
set(BZIP2_HASH_TYPE SHA256)
set(BZIP2_FILE bzip2_${BZIP2_VERSION}.orig.tar.gz)
set(BZIP2_CPE "cpe:2.3:a:bzip:bzip2:${BZIP2_VERSION}:*:*:*:*:*:*:*")
set(FFI_VERSION 3.3)
set(FFI_URI https://sourceware.org/pub/libffi/libffi-${FFI_VERSION}.tar.gz)
set(FFI_HASH 72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056)
set(FFI_HASH_TYPE SHA256)
set(FFI_FILE libffi-${FFI_VERSION}.tar.gz)
set(FFI_CPE "cpe:2.3:a:libffi_project:libffi:${FFI_VERSION}:*:*:*:*:*:*:*")
set(LZMA_VERSION 5.2.5)
set(LZMA_URI https://tukaani.org/xz/xz-${LZMA_VERSION}.tar.bz2)
@@ -412,29 +444,30 @@ else()
set(SSL_HASH_TYPE SHA256)
set(SSL_FILE openssl-${SSL_VERSION}.tar.gz)
endif()
set(SSL_CPE "cpe:2.3:a:openssl:openssl:${SSL_VERSION}:*:*:*:*:*:*:*")
set(SQLITE_VERSION 3.31.1)
set(SQLITE_URI https://www.sqlite.org/2018/sqlite-src-3240000.zip)
set(SQLITE_HASH fb558c49ee21a837713c4f1e7e413309aabdd9c7)
set(SQLITE_HASH_TYPE SHA1)
set(SQLITE_FILE sqlite-src-3240000.zip)
set(SQLITE_CPE "cpe:2.3:a:sqlite:sqlite:${SQLITE_VERSION}:*:*:*:*:*:*:*")
set(EMBREE_VERSION 3.10.0)
set(EMBREE_VERSION 3.13.4)
set(EMBREE_URI https://github.com/embree/embree/archive/v${EMBREE_VERSION}.zip)
set(EMBREE_HASH 4bbe29e7eaa46417efc75fc5f1e8eb87)
set(EMBREE_HASH 52d0be294d6c88ba7a6c9e046796e7be)
set(EMBREE_HASH_TYPE MD5)
set(EMBREE_FILE embree-v${EMBREE_VERSION}.zip)
set(EMBREE_ARM_GIT https://github.com/brechtvl/embree.git)
set(USD_VERSION 21.02)
set(USD_VERSION 22.03)
set(USD_URI https://github.com/PixarAnimationStudios/USD/archive/v${USD_VERSION}.tar.gz)
set(USD_HASH 1dd1e2092d085ed393c1f7c450a4155a)
set(USD_HASH e0e441a05057692a83124a1195b09eed)
set(USD_HASH_TYPE MD5)
set(USD_FILE usd-v${USD_VERSION}.tar.gz)
set(OIDN_VERSION 1.4.1)
set(OIDN_VERSION 1.4.3)
set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz)
set(OIDN_HASH df4007b0ab93b1c41cdf223b075d01c0)
set(OIDN_HASH 027093eaf5e8b4e45835b991137b38e6)
set(OIDN_HASH_TYPE MD5)
set(OIDN_FILE oidn-${OIDN_VERSION}.src.tar.gz)
@@ -449,16 +482,18 @@ set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa/mesa-${MESA_VERSION}.tar.xz)
set(MESA_HASH 022c7293074aeeced2278c872db4fa693147c70f8595b076cf3f1ef81520766d)
set(MESA_HASH_TYPE SHA256)
set(MESA_FILE mesa-${MESA_VERSION}.tar.xz)
set(MESA_CPE "cpe:2.3:a:mesa3d:mesa:${MESA_VERSION}:*:*:*:*:*:*:*")
set(NASM_VERSION 2.15.02)
set(NASM_URI https://github.com/netwide-assembler/nasm/archive/nasm-${NASM_VERSION}.tar.gz)
set(NASM_HASH aded8b796c996a486a56e0515c83e414116decc3b184d88043480b32eb0a8589)
set(NASM_HASH_TYPE SHA256)
set(NASM_FILE nasm-${NASM_VERSION}.tar.gz)
set(NASM_PCE "cpe:2.3:a:nasm:nasm:${NASM_VERSION}:*:*:*:*:*:*:*")
set(XR_OPENXR_SDK_VERSION 1.0.17)
set(XR_OPENXR_SDK_VERSION 1.0.22)
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
set(XR_OPENXR_SDK_HASH bf0fd8828837edff01047474e90013e1)
set(XR_OPENXR_SDK_HASH a2623ebab3d0b340bc16311b14f02075)
set(XR_OPENXR_SDK_HASH_TYPE MD5)
set(XR_OPENXR_SDK_FILE OpenXR-SDK-${XR_OPENXR_SDK_VERSION}.tar.gz)
@@ -468,23 +503,37 @@ set(WL_PROTOCOLS_URI https://gitlab.freedesktop.org/wayland/wayland-protocols/-/
set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a)
set(WL_PROTOCOLS_HASH_TYPE MD5)
set(ISPC_VERSION v1.16.0)
set(WAYLAND_VERSION 1.21.0)
set(WAYLAND_FILE wayland-${WAYLAND_VERSION}.tar.xz)
set(WAYLAND_URI https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.21.0/downloads/wayland-${WAYLAND_VERSION}.tar.xz)
set(WAYLAND_HASH f2653a2293bcd882d756c6a83d278903)
set(WAYLAND_HASH_TYPE MD5)
set(WAYLAND_LIBDECOR_VERSION 0.1.0)
set(WAYLAND_LIBDECOR_FILE libdecor-${WAYLAND_LIBDECOR_VERSION}.tar.xz)
set(WAYLAND_LIBDECOR_URI https://gitlab.gnome.org/jadahl/libdecor/uploads/81adf91d27620e20bcc5f6b9b312d768/libdecor-${WAYLAND_LIBDECOR_VERSION}.tar.xz )
set(WAYLAND_LIBDECOR_HASH 47b59eba76faa3787f0878bf8700e912)
set(WAYLAND_LIBDECOR_HASH_TYPE MD5)
set(ISPC_VERSION v1.17.0)
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
set(ISPC_HASH 2e3abedbc0ea9aaec17d6562c632454d)
set(ISPC_HASH 4f476a3109332a77fe839a9014c60ca9)
set(ISPC_HASH_TYPE MD5)
set(ISPC_FILE ispc-${ISPC_VERSION}.tar.gz)
set(GMP_VERSION 6.2.0)
set(GMP_VERSION 6.2.1)
set(GMP_URI https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.xz)
set(GMP_HASH a325e3f09e6d91e62101e59f9bda3ec1)
set(GMP_HASH 0b82665c4a92fd2ade7440c13fcaa42b)
set(GMP_HASH_TYPE MD5)
set(GMP_FILE gmp-${GMP_VERSION}.tar.xz)
set(GMP_CPE "cpe:2.3:a:gmplib:gmp:${GMP_VERSION}:*:*:*:*:*:*:*")
set(POTRACE_VERSION 1.16)
set(POTRACE_URI http://potrace.sourceforge.net/download/${POTRACE_VERSION}/potrace-${POTRACE_VERSION}.tar.gz)
set(POTRACE_HASH 5f0bd87ddd9a620b0c4e65652ef93d69)
set(POTRACE_HASH_TYPE MD5)
set(POTRACE_FILE potrace-${POTRACE_VERSION}.tar.gz)
set(POTRACE_CPE "cpe:2.3:a:icoasoft:potrace:${POTRACE_VERSION}:*:*:*:*:*:*:*")
set(HARU_VERSION 2_3_0)
set(HARU_URI https://github.com/libharu/libharu/archive/RELEASE_${HARU_VERSION}.tar.gz)
@@ -497,6 +546,167 @@ set(ZSTD_URI https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}
set(ZSTD_HASH 5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94)
set(ZSTD_HASH_TYPE SHA256)
set(ZSTD_FILE zstd-${ZSTD_VERSION}.tar.gz)
set(ZSTD_CPE "cpe:2.3:a:facebook:zstandard:${ZSTD_VERSION}:*:*:*:*:*:*:*")
set(SSE2NEON_GIT https://github.com/DLTcollab/sse2neon.git)
set(SSE2NEON_GIT_HASH fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)
set(SSE2NEON_VERSION fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)
set(SSE2NEON_URI https://github.com/DLTcollab/sse2neon/archive/${SSE2NEON_VERSION}.tar.gz)
set(SSE2NEON_HASH 0780253525d299c31775ef95853698d03db9c7739942af8570000f4a25a5d605)
set(SSE2NEON_HASH_TYPE SHA256)
set(SSE2NEON_FILE sse2neon-${SSE2NEON_VERSION}.tar.gz)
set(BROTLI_VERSION 1.0.9)
set(BROTLI_URI https://github.com/google/brotli/archive/refs/tags/v${BROTLI_VERSION}.tar.gz)
set(BROTLI_HASH f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46)
set(BROTLI_HASH_TYPE SHA256)
set(BROTLI_FILE brotli-v${BROTLI_VERSION}.tar.gz)
set(BROTLI_CPE "cpe:2.3:a:google:brotli:${BROTLI_VERSION}:*:*:*:*:*:*:*")
set(OPENPGL_VERSION v0.4.0-beta)
set(OPENPGL_SHORT_VERSION 0.4.0)
set(OPENPGL_URI https://github.com/OpenPathGuidingLibrary/openpgl/archive/refs/tags/${OPENPGL_VERSION}.tar.gz)
set(OPENPGL_HASH 58d5b65c533ce6cac3f7e1d51cf169a5411adf356abcd85f04049bbcaecc2e77)
set(OPENPGL_HASH_TYPE SHA256)
set(OPENPGL_FILE openpgl-${OPENPGL_VERSION}.tar.gz)
set(LEVEL_ZERO_VERSION v1.7.15)
set(LEVEL_ZERO_URI https://github.com/oneapi-src/level-zero/archive/refs/tags/${LEVEL_ZERO_VERSION}.tar.gz)
set(LEVEL_ZERO_HASH c39bb05a8e5898aa6c444e1704105b93d3f1888b9c333f8e7e73825ffbfb2617)
set(LEVEL_ZERO_HASH_TYPE SHA256)
set(LEVEL_ZERO_FILE level-zero-${LEVEL_ZERO_VERSION}.tar.gz)
set(DPCPP_VERSION 20220812)
set(DPCPP_URI https://github.com/intel/llvm/archive/refs/tags/sycl-nightly/${DPCPP_VERSION}.tar.gz)
set(DPCPP_HASH 0e3c95346c295f5cf80f3a42d80b1c49481955898530242636ddc002627248d6)
set(DPCPP_HASH_TYPE SHA256)
set(DPCPP_FILE DPCPP-${DPCPP_VERSION}.tar.gz)
########################
### DPCPP DEPS BEGIN ###
########################
# The following deps are build time requirements for dpcpp, when possible
# the source in the dpcpp source tree for the version chosen is documented
# by each dep, these will only have to be downloaded and unpacked, dpcpp
# will take care of building them, unpack is being done in dpcpp_deps.cmake
# Source llvm/lib/SYCLLowerIR/CMakeLists.txt
set(VCINTRINSICS_VERSION 984bb27baacce6ee5c716c2e64845f2a1928025b)
set(VCINTRINSICS_URI https://github.com/intel/vc-intrinsics/archive/${VCINTRINSICS_VERSION}.tar.gz)
set(VCINTRINSICS_HASH abea415a15a0dd11fdc94dee8fb462910f2548311b787e02f42509789e1b0d7b)
set(VCINTRINSICS_HASH_TYPE SHA256)
set(VCINTRINSICS_FILE vc-intrinsics-${VCINTRINSICS_VERSION}.tar.gz)
# Source opencl/CMakeLists.txt
set(OPENCLHEADERS_VERSION dcd5bede6859d26833cd85f0d6bbcee7382dc9b3)
set(OPENCLHEADERS_URI https://github.com/KhronosGroup/OpenCL-Headers/archive/${OPENCLHEADERS_VERSION}.tar.gz)
set(OPENCLHEADERS_HASH ca8090359654e94f2c41e946b7e9d826253d795ae809ce7c83a7d3c859624693)
set(OPENCLHEADERS_HASH_TYPE SHA256)
set(OPENCLHEADERS_FILE opencl_headers-${OPENCLHEADERS_VERSION}.tar.gz)
# Source opencl/CMakeLists.txt
set(ICDLOADER_VERSION aec3952654832211636fc4af613710f80e203b0a)
set(ICDLOADER_URI https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/${ICDLOADER_VERSION}.tar.gz)
set(ICDLOADER_HASH e1880551d67bd8dc31d13de63b94bbfd6b1f315b6145dad1ffcd159b89bda93c)
set(ICDLOADER_HASH_TYPE SHA256)
set(ICDLOADER_FILE icdloader-${ICDLOADER_VERSION}.tar.gz)
# Source sycl/cmake/modules/AddBoostMp11Headers.cmake
# Using external MP11 here, getting AddBoostMp11Headers.cmake to recognize
# our copy in boost directly was more trouble than it was worth.
set(MP11_VERSION 7bc4e1ae9b36ec8ee635c3629b59ec525bbe82b9)
set(MP11_URI https://github.com/boostorg/mp11/archive/${MP11_VERSION}.tar.gz)
set(MP11_HASH 071ee2bd3952ec89882edb3af25dd1816f6b61723f66e42eea32f4d02ceef426)
set(MP11_HASH_TYPE SHA256)
set(MP11_FILE mp11-${MP11_VERSION}.tar.gz)
# Source llvm-spirv/CMakeLists.txt (repo)
# Source llvm-spirv/spirv-headers-tag.conf (hash)
set(SPIRV_HEADERS_VERSION 36c0c1596225e728bd49abb7ef56a3953e7ed468)
set(SPIRV_HEADERS_URI https://github.com/KhronosGroup/SPIRV-Headers/archive/${SPIRV_HEADERS_VERSION}.tar.gz)
set(SPIRV_HEADERS_HASH 7a5c89633f8740456fe8adee052033e134476d267411d1336c0cb1e587a9229a)
set(SPIRV_HEADERS_HASH_TYPE SHA256)
set(SPIRV_HEADERS_FILE SPIR-V-Headers-${SPIRV_HEADERS_VERSION}.tar.gz)
######################
### DPCPP DEPS END ###
######################
##########################################
### Intel Graphics Compiler DEPS BEGIN ###
##########################################
# The following deps are build time requirements for the intel graphics
# compiler, the versions used are taken from the following location
# https://github.com/intel/intel-graphics-compiler/releases
set(IGC_VERSION 1.0.11222)
set(IGC_URI https://github.com/intel/intel-graphics-compiler/archive/refs/tags/igc-${IGC_VERSION}.tar.gz)
set(IGC_HASH d92f0608dcbb52690855685f9447282e5c09c0ba98ae35fabf114fcf8b1e9fcf)
set(IGC_HASH_TYPE SHA256)
set(IGC_FILE igc-${IGC_VERSION}.tar.gz)
set(IGC_LLVM_VERSION llvmorg-11.1.0)
set(IGC_LLVM_URI https://github.com/llvm/llvm-project/archive/refs/tags/${IGC_LLVM_VERSION}.tar.gz)
set(IGC_LLVM_HASH 53a0719f3f4b0388013cfffd7b10c7d5682eece1929a9553c722348d1f866e79)
set(IGC_LLVM_HASH_TYPE SHA256)
set(IGC_LLVM_FILE ${IGC_LLVM_VERSION}.tar.gz)
# WARNING WARNING WARNING
#
# IGC_OPENCL_CLANG contains patches for some of its dependencies.
#
# Whenever IGC_OPENCL_CLANG_VERSION changes, one *MUST* inspect
# IGC_OPENCL_CLANG's patches folder and update igc.cmake to account for
# any added or removed patches.
#
# WARNING WARNING WARNING
set(IGC_OPENCL_CLANG_VERSION bbdd1587f577397a105c900be114b56755d1f7dc)
set(IGC_OPENCL_CLANG_URI https://github.com/intel/opencl-clang/archive/${IGC_OPENCL_CLANG_VERSION}.tar.gz)
set(IGC_OPENCL_CLANG_HASH d08315f1b0d8a6fef33de2b3e6aa7356534c324910634962c72523d970773efc)
set(IGC_OPENCL_CLANG_HASH_TYPE SHA256)
set(IGC_OPENCL_CLANG_FILE opencl-clang-${IGC_OPENCL_CLANG_VERSION}.tar.gz)
set(IGC_VCINTRINSICS_VERSION v0.4.0)
set(IGC_VCINTRINSICS_URI https://github.com/intel/vc-intrinsics/archive/refs/tags/${IGC_VCINTRINSICS_VERSION}.tar.gz)
set(IGC_VCINTRINSICS_HASH c8b92682ad5031cf9d5b82a40e7d5c0e763cd9278660adbcaa69aab988e4b589)
set(IGC_VCINTRINSICS_HASH_TYPE SHA256)
set(IGC_VCINTRINSICS_FILE vc-intrinsics-${IGC_VCINTRINSICS_VERSION}.tar.gz)
set(IGC_SPIRV_HEADERS_VERSION sdk-1.3.204.1)
set(IGC_SPIRV_HEADERS_URI https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/${IGC_SPIRV_HEADERS_VERSION}.tar.gz)
set(IGC_SPIRV_HEADERS_HASH 262864053968c217d45b24b89044a7736a32361894743dd6cfe788df258c746c)
set(IGC_SPIRV_HEADERS_HASH_TYPE SHA256)
set(IGC_SPIRV_HEADERS_FILE SPIR-V-Headers-${IGC_SPIRV_HEADERS_VERSION}.tar.gz)
set(IGC_SPIRV_TOOLS_VERSION sdk-1.3.204.1)
set(IGC_SPIRV_TOOLS_URI https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/${IGC_SPIRV_TOOLS_VERSION}.tar.gz)
set(IGC_SPIRV_TOOLS_HASH 6e19900e948944243024aedd0a201baf3854b377b9cc7a386553bc103b087335)
set(IGC_SPIRV_TOOLS_HASH_TYPE SHA256)
set(IGC_SPIRV_TOOLS_FILE SPIR-V-Tools-${IGC_SPIRV_TOOLS_VERSION}.tar.gz)
set(IGC_SPIRV_TRANSLATOR_VERSION 99420daab98998a7e36858befac9c5ed109d4920)
set(IGC_SPIRV_TRANSLATOR_URI https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/${IGC_SPIRV_TRANSLATOR_VERSION}.tar.gz)
set(IGC_SPIRV_TRANSLATOR_HASH 77dfb4ddb6bfb993535562c02ddea23f0a0d1c5a0258c1afe7e27c894ff783a8)
set(IGC_SPIRV_TRANSLATOR_HASH_TYPE SHA256)
set(IGC_SPIRV_TRANSLATOR_FILE SPIR-V-Translator-${IGC_SPIRV_TRANSLATOR_VERSION}.tar.gz)
########################################
### Intel Graphics Compiler DEPS END ###
########################################
set(GMMLIB_VERSION intel-gmmlib-22.1.2)
set(GMMLIB_URI https://github.com/intel/gmmlib/archive/refs/tags/${GMMLIB_VERSION}.tar.gz)
set(GMMLIB_HASH 3b9a6d5e7e3f5748b3d0a2fb0e980ae943907fece0980bd9c0508e71c838e334)
set(GMMLIB_HASH_TYPE SHA256)
set(GMMLIB_FILE ${GMMLIB_VERSION}.tar.gz)
set(OCLOC_VERSION 22.20.23198)
set(OCLOC_URI https://github.com/intel/compute-runtime/archive/refs/tags/${OCLOC_VERSION}.tar.gz)
set(OCLOC_HASH ab22b8bf2560a57fdd3def0e35a62ca75991406f959c0263abb00cd6cd9ae998)
set(OCLOC_HASH_TYPE SHA256)
set(OCLOC_FILE ocloc-${OCLOC_VERSION}.tar.gz)
set(AOM_VERSION 3.4.0)
set(AOM_URI https://storage.googleapis.com/aom-releases/libaom-${AOM_VERSION}.tar.gz)
set(AOM_HASH bd754b58c3fa69f3ffd29da77de591bd9c26970e3b18537951336d6c0252e354)
set(AOM_HASH_TYPE SHA256)
set(AOM_FILE libaom-${AOM_VERSION}.tar.gz)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_vorbis
URL file://${PACKAGE_DIR}/${VORBIS_FILE}

View File

@@ -1,27 +1,13 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(VPX_EXTRA_FLAGS --target=x86_64-win64-gcc --disable-multithread)
else()
set(VPX_EXTRA_FLAGS --target=x86-win32-gcc --disable-multithread)
endif()
# VPX is determined to use pthreads which it will tell ffmpeg to dynamically
# link, which is not something we're super into distribution wise. However
# if it cannot find pthread.h it'll happily provide a pthread emulation
# layer using win32 threads. So all this patch does is make it not find
# pthead.h
set(VPX_PATCH ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/vpx/src/external_vpx < ${PATCH_DIR}/vpx_windows.diff)
set(VPX_EXTRA_FLAGS --target=x86_64-win64-gcc )
else()
if(APPLE)
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
@@ -34,6 +20,16 @@ else()
endif()
endif()
if(NOT BLENDER_PLATFORM_ARM)
list(APPEND VPX_EXTRA_FLAGS
--enable-sse4_1
--enable-sse3
--enable-ssse3
--enable-avx
--enable-avx2
)
endif()
ExternalProject_Add(external_vpx
URL file://${PACKAGE_DIR}/${VPX_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
@@ -46,11 +42,6 @@ ExternalProject_Add(external_vpx
--enable-static
--disable-install-bins
--disable-install-srcs
--disable-sse4_1
--disable-sse3
--disable-ssse3
--disable-avx
--disable-avx2
--disable-unit-tests
--disable-examples
--enable-vp8
@@ -58,6 +49,7 @@ ExternalProject_Add(external_vpx
${VPX_EXTRA_FLAGS}
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/vpx/src/external_vpx/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/vpx/src/external_vpx/ && make install
PATCH_COMMAND ${VPX_PATCH}
INSTALL_DIR ${LIBDIR}/vpx
)

View File

@@ -0,0 +1,23 @@
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_wayland
URL file://${PACKAGE_DIR}/${WAYLAND_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${WAYLAND_HASH_TYPE}=${WAYLAND_HASH}
PREFIX ${BUILD_DIR}/wayland
PATCH_COMMAND ${PATCH_CMD} -d ${BUILD_DIR}/wayland/src/external_wayland < ${PATCH_DIR}/wayland.diff
# Use `-E` so the `PKG_CONFIG_PATH` can be defined to link against our own LIBEXPAT & LIBXML2.
# Note that passing link args "ffi/lib" should not be needed, but
# `pkgconfig` would incorrectly look in "ffi/lib/../lib64" otherwise.
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${LIBDIR}/expat/lib/pkgconfig:${LIBDIR}/xml2/lib/pkgconfig:${LIBDIR}/ffi/lib/pkgconfig:$PKG_CONFIG_PATH
meson --prefix ${LIBDIR}/wayland -Ddocumentation=false -Dtests=false -Dc_link_args=-L${LIBDIR}/ffi/lib . ../external_wayland
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
)
add_dependencies(
external_wayland
external_expat
external_xml2
external_ffi
)

View File

@@ -0,0 +1,15 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# NOTE: currently only the header file is extracted, no compilation is needed
# as the library is dynamically loaded when found on the system.
ExternalProject_Add(external_wayland_libdecor
URL file://${PACKAGE_DIR}/${WAYLAND_LIBDECOR_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${WAYLAND_LIBDECOR_HASH_TYPE}=${WAYLAND_LIBDECOR_HASH}
PREFIX ${BUILD_DIR}/wayland_libdecor
BUILD_COMMAND echo .
CONFIGURE_COMMAND echo .
INSTALL_COMMAND cp ../external_wayland_libdecor/src/libdecor.h ${LIBDIR}/wayland_libdecor/include/libdecor-0/libdecor.h
INSTALL_DIR ${LIBDIR}/wayland_libdecor/include/libdecor-0
)

View File

@@ -1,27 +1,18 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_wayland_protocols
URL file://${PACKAGE_DIR}/${WL_PROTOCOLS_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${WL_PROTOCOLS_HASH_TYPE}=${WL_PROTOCOLS_HASH}
PREFIX ${BUILD_DIR}/wayland-protocols
CONFIGURE_COMMAND meson --prefix ${LIBDIR}/wayland-protocols . ../external_wayland_protocols -Dtests=false
# Use `-E` so the `PKG_CONFIG_PATH` can be defined to link against our own WAYLAND.
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${LIBDIR}/wayland/lib64/pkgconfig:$PKG_CONFIG_PATH
meson --prefix ${LIBDIR}/wayland-protocols . ../external_wayland_protocols -Dtests=false
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
)
add_dependencies(
external_wayland_protocols
external_wayland
)

View File

@@ -1,28 +1,18 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
# Note the utility apps may use png/tiff/gif system libraries, but the
# library itself does not depend on them, so should give no problems.
set(WEBP_EXTRA_ARGS
-DWEBP_HAVE_SSE2=ON
-DWEBP_HAVE_SSE41=OFF
-DWEBP_HAVE_AVX2=OFF
-DWEBP_BUILD_ANIM_UTILS=OFF
-DWEBP_BUILD_CWEBP=OFF
-DWEBP_BUILD_DWEBP=OFF
-DWEBP_BUILD_GIF2WEBP=OFF
-DWEBP_BUILD_IMG2WEBP=OFF
-DWEBP_BUILD_VWEBP=OFF
-DWEBP_BUILD_WEBPINFO=OFF
-DWEBP_BUILD_WEBPMUX=OFF
-DWEBP_BUILD_EXTRAS=OFF
)
if(WIN32)

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(X264_EXTRA_ARGS --enable-win32thread --cross-prefix=${MINGW_HOST}- --host=${MINGW_HOST})

View File

@@ -1,20 +1,4 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_xml2
URL file://${PACKAGE_DIR}/${XML2_FILE}

Some files were not shown because too many files have changed in this diff Show More