Commit Graph

122952 Commits

Author SHA1 Message Date
Chris Blackbourn
ed0e4f4043 UV: refactor uv packing, reduce usage of #BoxPack
No functional changes.
2023-03-31 10:09:48 +13:00
Hans Goudey
cbb813886c Geometry Nodes: Simplify retrieval of node dependencies
Use checks for certain node types with better algorithmic complexity.
They should perform better in some edge case with a lot of nodes or
node group nesting. They're now a bit more similar to each other too.
2023-03-30 16:30:23 -04:00
Brecht Van Lommel
76e0ca6b91 Build: suppress CMake warnings about newer Boost versions
This is the only package that warns about this type of thing, and gets in the
way of actual warnigns on build logs. This requires CMake 3.19+ to take effect,
older versions still show the warnings.
2023-03-30 22:29:14 +02:00
Chris Blackbourn
40f050aadc UV: simplify packing usage of #BoxPack
No functional changes.
2023-03-31 09:02:01 +13:00
Jason Fielder
f6e89233a3 Workbench: Optimize texture usage flags
Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/106229
2023-03-30 21:49:41 +02:00
Jason Fielder
ec94b1da58 Metal: Optimize texture usage in glutil
Ensure compression is enabled by using shader_read
flag only. Also ensure that MTLTexture contents
remain in optimal layout for reading after any
data modifications.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/106234
2023-03-30 21:45:45 +02:00
Brecht Van Lommel
1658b8ab46 Fix Cycles Metal failing when run in parallel, always run serial
The command buffer fails to execute, the cause is unknown. It does not
appear to be related to the binary archive cache as disabling that does
not prevent the issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/106328
2023-03-30 19:46:49 +02:00
Sergey Sharybin
55d642ba2f Fix non-deterministic behavior of mask compositor node
The issue was caused by uninitialized offset used for the scale
variable.

Follow the rest of the usages of the operation which initialize
it explicitly. This makes it very safe and easy fix to backport
to any LTS or corrective release.

Ideally should probably initialize all members in the class
itself, to avoid such situations in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/106325
2023-03-30 18:57:22 +02:00
Jacques Lucke
a145d1563a Cleanup: move flip faces code from nodes to geometry module 2023-03-30 18:44:11 +02:00
Jacques Lucke
55d473ee40 Cleanup: use better default name for unknown parameter
The `<` and `>` don't work well when the name is inserted into a .dot graph.
2023-03-30 18:44:11 +02:00
Lukas Tönne
bdc3f1581d Fix #106261: When geometry output is viewed the cycling operator picks wrong sockets.
The cycling method for the viewer connection starts searching from the next socket
after the last current connection. If a geometry socket is is the last connected
output this caused the method to jump to the next socket after the geometry,
potentially skipping over valid data sockets that are not viewed yet.

The solution is to ignore the geometry sockets in the cycling entirely and only
consider data sockets (i.e. non-geometry sockets).

Pull Request: https://projects.blender.org/blender/blender/pulls/106318
2023-03-30 16:56:56 +02:00
Bastien Montagne
8785862ee4 Replace install-deps bash script by a python one, and only handle distro packages.
This tool now only supports installing packages, it won't build any
dependency anymore. This implies that on most distributions, it wont
make a complete Blender build possible, some features will likely be
misisng.

By default, it only install basic dev environment to enable building
Blender with the precompiled libraries (which is the recommended way).

Passing the `--all` option will make it try to install all known
dependencies from distro packages. This is a development option,
regular Blender build should be done with the precompiled libraries.

Tested on Debian Testing, Arch, Fedora and Suse Tumbleweed.

With the new design, it should be fairly trivial to add more
distributions if desired, and maintenance should also be way simpler.

NOTE: side effect is that a working python3 interpreter is expected on
system running this script. In practice this should not be an issue,
since Python3 is installed by default in almost all regular desktop
linux installations.
2023-03-30 16:30:45 +02:00
Christoph Lendenfeld
be733c240e Animation: Insert Keyframe only on active FCurve
The insert key operator allowed to insert a keyframe on all selected FCurves
and on the Active FCurve at cursor value.
But it didn't allow to insert a keyframe only on the active FCurve.

This patch adds that. It is available in the redo panel and under Key->Insert Keyframes (which can also be called with the I hotkey)

Pull Request: https://projects.blender.org/blender/blender/pulls/106307
2023-03-30 16:29:50 +02:00
Sergey Sharybin
12b001ebce Fix OBJ tests using release folder
This change aimed to solve the following issues:

- Possible threading issue of two tests writing to the same
  file, depending on how the ctest is invoked

- Test using the release directory, and potentially leaving
  temp file behind on test failure, breaking code sign on
  macOS.

Pull Request: https://projects.blender.org/blender/blender/pulls/106311
2023-03-30 15:55:01 +02:00
Sergey Sharybin
8f1925c2f6 Cleanup: make format 2023-03-30 15:28:21 +02:00
Hans Goudey
f9b9430982 Fix: Crash when loading 3.4 autosave file
The MVert to float3 vertex position conversion was skipped using
the wrong case, mesh->mvert wasn't always set when writing
apparently.
2023-03-30 08:37:05 -04:00
Hans Goudey
80319035e6 Fix: Debug assert extracting multiple UV maps in edit mode 2023-03-30 08:24:29 -04:00
Philipp Oeser
7eda8e5367 Fix: unnecessary edge pan updates
Found together with a fix for #106043.

Edge panning (in Node Editors, Outliner and VSE) does unnecessary
updates when the view has not changed at all. This includes adding
`MOUSEMOVE` events (even if you dont move the mouse at all).

Adding `MOUSEMOVE` events results in the transform system constantly running (even if you dont move the mouse) which we certainly want to avoid.

Rectify this by only calling these updates when the view changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/106301
2023-03-30 14:08:57 +02:00
Philipp Oeser
2a6f177e8e Fix #106043: Moving frame node jittering while cursor is still
The fix for #105363 (6d3ce8273a) made the transform system respect
(Frame) nodes `offsetx`/`offsety`.

Now Node Editors run the transform system even if the mouse is still (due to edge panning -- unnecessarily, see PR #106301 for fixing this). And due to the way `frame_node_prepare_for_draw` recalculates these offsets (based on
on updated positions and `node.runtime->totr` [which in turn gets rounded in `node_update_basis` -- so subpixel precision is lost there, see [1]]), this can lead to slight imprecisions/noise/jitter during transform (if we use float offsets, see the PR for more info).

So to counter this, use rounded offsets now [which will keep the whole circle stable].

NOTE: PR #106301 would fix this already for having the cursor still, but this patch still improves slight jitter when moving, so will commit separately.

[1] comment from `node_update_basis`
> /* Round the node origin because text contents are always pixel-aligned. */

Pull Request: https://projects.blender.org/blender/blender/pulls/106096
2023-03-30 14:02:45 +02:00
Julian Eisel
d90795bc3c Asset System: New "weak" asset reference for storing in .blend files
No user visible changes expected.

For brush assets, we need a way to store a reference to a brush in .blend files, so that the last active brush can be restored from the file. See #101908. It seems like a generally useful thing to have.

Adds a new DNA struct to store a "weak" asset reference, that is, a reference that can break under a number of circumstances, but should work reliably enough under normal usage. There's no way to reliably reference an asset currently, so this works on a "best effort" basis. It can break when assets are moved inside the asset library, asset libraries are unregistered from the Preferences, or a file is opened on a different machine with different Preferences, for example. It can also break currently if an asset library is renamed.
It contains:
- Information to identify the asset library the asset can be found in.
- A relative "identifier" (currently a relative path) for the asset within the asset library.

There's further code to resolve a weak reference to file paths and Blender library paths.

Part of #101908.

Co-authored-by: Bastien Montagne <bastien@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/105603
2023-03-30 12:25:42 +02:00
Sergey Sharybin
a12a8a71bb Remove "All Rights Reserved" from Blender Foundation copyright code
The goal is to solve confusion of the "All rights reserved" for licensing
code under an open-source license.

The phrase "All rights reserved" comes from a historical convention that
required this phrase for the copyright protection to apply. This convention
is no longer relevant.

However, even though the phrase has no meaning in establishing the copyright
it has not lost meaning in terms of licensing.

This change makes it so code under the Blender Foundation copyright does
not use "all rights reserved". This is also how the GPL license itself
states how to apply it to the source code:

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software ...

This change does not change copyright notice in cases when the copyright
is dual (BF and an author), or just an author of the code. It also does
mot change copyright which is inherited from NaN Holding BV as it needs
some further investigation about what is the proper way to handle it.
2023-03-30 10:51:59 +02:00
Christoph Lendenfeld
7e940f184f Animation: Auto frame curves Y extents when hitting normalize
When hitting the "normalize" button in the graph editor, set the y extents of the view to the extents of the `FCurves`.
Previously you had to search for your curves after pressing that button.

Pull Request: https://projects.blender.org/blender/blender/pulls/105857
2023-03-30 10:01:12 +02:00
Aras Pranckevicius
d9de76f5d1 Cleanup: PLY exporter headers cleanup
Move private functions out of headers, cleanup unnecessary includes,
forward declarations instead of includes where possible, avoid global
variables.
2023-03-30 09:56:23 +03:00
Campbell Barton
0fcecc5c1e Cleanup: use methods to convert to/from window scale
Simplifies adding support for the fractional-scale protocol which
requires events to be fractially scaled.
2023-03-30 17:36:31 +11:00
Chris Blackbourn
3cfc3eab93 UV: fix unreported, bad uv packing with convex shape_method.
Pivot wasn't set with convex shape_method when an island has only one triangle.

Regression from 86b1e5e3b6ef
2023-03-30 12:35:45 +13:00
Chris Blackbourn
9ea6771d10 Cleanup: simplify sorting during uv packing
Prevent double-sorting during uv packing with bounding-box packing.

Slight speed improvement, slight packing efficiency improvement.
2023-03-30 12:23:49 +13:00
Campbell Barton
a62f6c8290 Fix out-of-bounds array access when building with GHOST_OPENGL_ALPHA
While this is off by default, best replace hard coded sizes to avoid
out of bounds access if the enum is expanded.
2023-03-30 09:51:44 +11:00
Chris Blackbourn
abb879175e Fix #106283: several uv operations producing missing uvs
Uninitialized memory, regression from in p_flush_uvs [0]

[0] 8ac67a798bfbe
2023-03-30 10:28:41 +13:00
Aras Pranckevicius
7b94e86dd9 PLY: improve UV values merging in the exporter
Similar to recent OBJ UV values merging commit (05a63e3705) - build
mapping of (vertex, UV) by going over the face loops directly, instead
of using BKE_mesh_uv_vert_map_get_vert and then having an additional
map on top. Provide the mapping into ready to use flat arrays, instead
of building a map and then building arrays out of that in a separate
pass.

While at it, avoid the extra cost of building all this complicated
mapping when we don't have or are not exporting UVs.

Timing tests on exporting several models into binary PLY file
(Win10, Ryzen 5950X):

- Suzanne subdivided to level 6 (2.1M verts): 0.93s -> 0.68s
- Rungholt Minecraft level (9.7M verts): 3.3s -> 2.3s
- Stanford Lucy 3D scan (14.0M verts, no UVs): 5.2s -> 1.5s
2023-03-29 23:00:06 +03:00
Michael Jones
5f61eca7af Cycles: Exploit non-uniform threadgroup sizes on Metal
This patch replaces `dispatchThreadgroups` with `dispatchThreads` which takes care of non-uniform threadgroup bounds. This allows us to remove the bounds guards in the integrator kernel entry points.

Pull Request: https://projects.blender.org/blender/blender/pulls/106217
2023-03-29 21:46:11 +02:00
Brecht Van Lommel
8eb9d5342f Fix build error on Ubuntu 20.04 with Wayland after recent changes
The system wayland-protocols version is too old, and xdg-activation-v1.xml
is a more recent addition than xdg-decoration-unstable-v1.xml so check for
that.
2023-03-29 20:28:37 +02:00
Michael Jones
944a5854c6 Cycles: Fix MetalRT shadow all hit bug
This patch fixes a MetalRT issue where viable shadow hits are discounted based on the false assumption that hits are ordered by distance. With this patch, the following unit tests now pass:

- openvdb smoke
- shadow catcher pt transparent lamp only 0.8
- shadow catcher pt transparent lamp only 1.0

Pull Request: https://projects.blender.org/blender/blender/pulls/106276
2023-03-29 20:20:07 +02:00
Jacques Lucke
8ce3bb6e05 Fix: Curves: crash when requesting write access for attribute from multiple threads
This is preparation for #106228, the crash does not happen in `main` currently.
The issue was `positions_for_write` might make a copy of the data if it was
shared. This operation is not thread safe on a single mesh. The solution is to
get write-access to the positions only once before threading starts.
2023-03-29 18:40:13 +02:00
Jacques Lucke
84c93f3a06 Cleanup: use eCustomDataType instead of int
This makes the APIs more correct and simplifies debugging, because
some debuggers can now show the enum name instead of the integer.

Pull Request: https://projects.blender.org/blender/blender/pulls/106268
2023-03-29 17:10:49 +02:00
Hans Goudey
431d9858c5 Cleanup: Retrieve const custom data layers 2023-03-29 11:09:14 -04:00
Hans Goudey
5efa39096c Fix #106134: Broken triangulation without cached face normals
Logic broken in 16fbadde363c8074ec72
2023-03-29 11:09:14 -04:00
Sergey Sharybin
d32d787f5f Clang-Format: Allow empty functions to be single-line
For example

```
OIIOOutputDriver::~OIIOOutputDriver()
{
}
```

becomes

```
OIIOOutputDriver::~OIIOOutputDriver() {}
```

Saves quite some vertical space, which is especially handy for
constructors.

Pull Request: https://projects.blender.org/blender/blender/pulls/105594
2023-03-29 16:50:54 +02:00
Germano Cavalcante
cc7634f2ea Cleanup: deduplicate code 2023-03-29 09:47:41 -03:00
Campbell Barton
bb2c89b20d Fix #106251: "Shift to extend" doesn't work in 3D View Collections panel
Regression in [0], use shift to initialize the extend option when unset.

[0]: d7dd7403a8137e1043df4443898a677291726f0e
2023-03-29 20:05:44 +11:00
Campbell Barton
c0a252b833 Fix #105895: UI scaled down with 125% fractional scaling on Wayland
The DPI returned by the GHOST/Wayland didn't account the buffer being
rendered at a higher (non-fractional) resolution, then scaled down.

This caused the software cursor and UI to rendered very small.
A fractional scale of 101% would show the UI just over 50% of the size
(making the UI to be close to half the scale it should have been).

Resolve by accounting for down-scaling of the buffer to it's
fractional size.
2023-03-29 17:48:53 +11:00
Campbell Barton
68d146d57d Fix error in WM_capabilities_flag (all capabilities were set)
Mistake in [0] caused the flag not to be reset.

[0]: 4e51008a826f178171a510126e905495c6f78a45
2023-03-29 17:33:38 +11:00
Chris Blackbourn
86b1e5e3b6 Cleanup: simplify uv packing api 2023-03-29 17:09:36 +13:00
Campbell Barton
2bc331981d Cleanup: function style casts, remove UNUSED(..) & use nullptr in C++ 2023-03-29 14:37:53 +11:00
Campbell Barton
1ddbe7cadd Cleanup: move doc-strings into headers, remove duplicates
In some cases move implementation details into the function body.
2023-03-29 14:37:34 +11:00
Campbell Barton
ce659dbc4e Cleanup: use doxygen sections 2023-03-29 14:17:32 +11:00
Campbell Barton
35f770a689 Cleanup: duplicate words in comments 2023-03-29 14:17:32 +11:00
Hans Goudey
43f6df853f Merge branch 'blender-v3.5-release' 2023-03-28 22:52:27 -04:00
Julian Eisel
7d0251ed9a Fix #105855: Crash with node add menu assets and keyboard navigation
The UI needs persistent pointers to catalog paths that it can pass
around via context. It was trying to manage this in own storage, but
this didn't work. Not entirely sure why - the menus get redrawn
continuously while assets load, and the root menu rebuilds the mentioned
storage every time. Maybe the submenus redraw a bit later, or the
keyboard navigation handling still accessed data from a previous redraw
somehow.

Either way, instead of managing own catalog path storage, point into the
asset system, which already has persistent storage for the catalog
paths.

Pull Request: https://projects.blender.org/blender/blender/pulls/106237
2023-03-28 22:36:30 -04:00
Germano Cavalcante
df824e2015 Cleanup: use function style casts
Missed in 901a804f9e.
2023-03-28 23:10:11 -03:00
Germano Cavalcante
901a804f9e Cleanup: convert 'view3d_navigate.c' to C++
Anticipate porting this file as changes are planned to it and we are
gradually porting files to C++.
2023-03-29 04:02:16 +02:00