Commit Graph

123121 Commits

Author SHA1 Message Date
Patrick Mours
5ba35b3d15 Fix #106748: Rendering with OSL fails with OPTIX_ERROR_PIPELINE_LINK_ERROR
The OSL GPU services implementation of noise intrinsics was missing the
overloads for derivatives and therefore OptiX pipeline creation would fail if
those were referenced.
2023-04-13 15:52:23 +02:00
Hans Goudey
936e608382 Cleanup: Deduplicate curves data-block copying
After 7eee378eccc8f87e1330, the logic is the same in the
CurvesGeometry copy constructor and the curves data-block
copying.
2023-04-13 09:26:13 -04:00
Hans Goudey
1db918f948 Fix #106901: Dangling pointer after freeing mesh runtime data
This lead to a double-free when deleting the mesh runtime
struct after explicitly clearing the derived caches separately.
2023-04-13 09:21:22 -04:00
Jacques Lucke
7eee378ecc Custom Data: support implicit sharing for custom data layers
This integrates the new implicit-sharing system (from fbcddfcd68adc72f)
with `CustomData`. Now the potentially long arrays referenced by custom
data layers can be shared between different systems but most importantly
between different geometries. This makes e.g. copying a mesh much cheaper
because none of the attributes has to be copied. Only when an attribute
is modified does it have to be copied.

Also see the original design task: #95845.

This reduces memory and improves performance by avoiding unnecessary
data copies. For example, the used memory after loading a highly
subdivided mesh is reduced from 2.4GB to 1.79GB. This is about 25%
less which is the expected amount because in `main` there are 4 copies
of the data:
1. The original data which is allocated when the file is loaded.
2. The copy for the depsgraph allocated during depsgraph evaluation.
3. The copy for the undo system allocated when the first undo step is
  created right after loading the file.
4. GPU buffers allocated for drawing.

This patch only gets rid of copy number 2 for the depsgraph. In theory
the other copies can be removed as part of follow up PRs as well though.

-----

The patch has three main components:
* Slightly modified `CustomData` API to make it work better with implicit
  sharing:
  * `CD_REFERENCE` and `CD_DUPLICATE` have been removed because they are
    meaningless when implicit-sharing is used.
  * `CD_ASSIGN` has been removed as well because it's not an allocation
    type anyway. The functionality of using existing arrays as custom
    data layers has not been removed though.
  * This can still be done with `CustomData_add_layer_with_data` which
    also has a new argument that allows passing in information about
    whether the array is shared.
  * `CD_FLAG_NOFREE` has been removed because it's no longer necessary. It
    only existed because of `CD_REFERENCE`.
  * `CustomData_copy` and `CustomData_merge` have been split up into a
    functions that do copy the actual attribute values and those that do
    not. The latter functions now have the `_layout` suffix
    (e.g. `CustomData_copy_layout`).
* Changes in `customdata.cc` to make it actually use implicit-sharing.
* Changes in various other files to adapt to the changes in `BKE_customdata.h`.

Pull Request: https://projects.blender.org/blender/blender/pulls/106228
2023-04-13 14:57:57 +02:00
Clément Foucault
7e764ec692 GPU: Texture: Expose depth dimension extent
This function was not exposed outside of internal GPU module.

Renaming `draw::Texture::depth()` to `is_depth` for consistency
and removing the ambiguity.
2023-04-13 14:06:53 +02:00
Sebastian Parborg
aa6e95281f Add support for OpenPGL 0.5.0
Some functions changed slightly for this non beta release.
No functional changes though as we didn't use what was removed.

Pull Request: https://projects.blender.org/blender/blender/pulls/106861
2023-04-13 11:44:35 +02:00
Sergey Sharybin
c26083b6be Fix warning in the STL code
The fast_float is an external library, so move it to the
system includes which has less strict compiler flags applied.

This matches how other IO module use this library as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/106892
2023-04-13 11:06:42 +02:00
Sergey Sharybin
e5d50b1787 Fix Cycles unknown passes logged when build with Cycles debug
When WITH_CYCLES_DEBUG is set to ON the following errors are
printed to the console:

E0412 15:51:22.588564 7996345 sync.cpp:737] Unknown pass Guiding Color
E0412 15:51:22.588605 7996345 sync.cpp:737] Unknown pass Guiding Probability
E0412 15:51:22.588613 7996345 sync.cpp:737] Unknown pass Guiding Average Roughness

This change fixes this by treating the guiding passes the same
way as all other passes, solving the errors and making it possible
to visualize guiding passes in the viewport later on.

Pull Request: https://projects.blender.org/blender/blender/pulls/106863
2023-04-13 10:27:07 +02:00
Jeroen Bakker
34739f6a6d Fix #106672: MacOS/OpenGL doesn't draw anything Eevee related.
This PR reverts the breaking part of the #106535. This part doesn't seem
to be required to fix the HD4400-HD5500 issue.

Might also fix #106844.

Pull Request: https://projects.blender.org/blender/blender/pulls/106887
2023-04-13 10:18:44 +02:00
Christoph Lendenfeld
a899d57e57 Fix: Ignore hidden FCurves when framing y-extents
On hitting normalize,
when the y-extents of the Graph Editor are framed to the FCurves,
it didn't ignore hidden FCurves.
2023-04-13 09:52:05 +02:00
Jason Fielder
0e5c941049 Fix #106773: resolve Metal grease pencil fill
Changes to viewport state to resolve texture paint color
selection introduced a side effect wherein the correct
attachment size of a framebuffer was reset. This size is
needed when scissor regions are disabled to return the
state to its correct default. When this default was wrong,
certain operators would have incorrect offsets.

To maintain consistency with the OpenGL backend, the
Metal backend independently tracks the raw attachment
size using default_width/height. This will also reset to zero
when attachments are all removed, unlike other state which
may be retained.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/106857
2023-04-13 08:23:34 +02:00
Ankit Meel
ed4374f089 Fix #66722: file doesn't open if app not focused
After double clicking a file, user can click on a different app and
Blender will lose focus. Then it stays on splash screen. So fetch any
window instead of relying on active one to open the file.

pull request #106769
2023-04-13 10:48:29 +05:30
Campbell Barton
0a270e3513 Revert "GHOST/Wayland: avoid up-scaling window content"
This reverts commit 4fe26856152304350930dbeebc31521aa31f0f9f.

Always use the preferred_scale requested by the compositor as this
did not work so well in the intended use case (where the low resolution
monitor text was scaled down and difficult to see).

After discussion with @ZedDB, revert this change since there are cases
where either functionality might be preferred - to ensure Blender's UI
is visible on a low resolution mirrored projector for e.g.

Changing the behavior of the preferred scale makes most sense in the
compositor, instead of controlling it on a per-application basis.
2023-04-13 13:14:24 +10:00
Campbell Barton
684dcd3680 CMake: use GCC's -fuse-ld=mold support (mold now requires GCC 12.1)
GCC did not support mold when support was initially added,
since then GCC has been updated to add support, removing the need
to point to a binary directory containing an alternative `ld` command.

Support for MOLD_BIN CMake option has been kept as mold may be installed
to standard location.
2023-04-13 13:14:19 +10:00
Campbell Barton
a7462f58d1 Fix missing import for DJV on APPLE
We might removing support for this if it's not used,
correct the import for now.
2023-04-13 13:14:17 +10:00
Campbell Barton
11ad851fbe Fix lightmap UV calculation ignoring unselected objects in edit-mode 2023-04-13 13:14:15 +10:00
Campbell Barton
ad5ec544c8 Cleanup: remove unused apply-image option from uvcalc_lightmap
Note that this was a quick update from Blender 2.4's API,
while many other improvements could be made - remove this option as
it does nothing.
2023-04-13 13:14:13 +10:00
Campbell Barton
61cb302dd5 Cleanup: sort cmake file lists 2023-04-13 13:14:11 +10:00
Campbell Barton
678dc456e3 Cleanup: remove duplicate class
Introduced in ba982119cdcacfa8e603457face1d8ebc763ef75.
2023-04-13 13:14:09 +10:00
Campbell Barton
14905cd1d5 Cleanup: quiet pylint's inconsistent-return-statements warning
No functional changes as the return value either relied on None
evaluating to False or wasn't used.
2023-04-13 13:14:06 +10:00
Campbell Barton
6482f9fffe Cleanup: quiet various pylint warnings 2023-04-13 13:14:05 +10:00
Campbell Barton
84e72e8170 Cleanup: remove duplicate assignments, assign 'layout' early in draw(..)
Also remove unused assignments.
2023-04-13 13:14:03 +10:00
Campbell Barton
ab64bd264a Cleanup: consistent naming for tool_settings & operator properties
Use names:
- `tool_settings` instead of `ts`.

- `props` instead of `op` / `prop` / `op_props`
  As Python may reference operators, don't confuse the operator
  properties with an instance of the operator.

In both cases these names were already used for most scripts.
2023-04-13 13:14:01 +10:00
Campbell Barton
b0edd63752 Cleanup: avoid early imports, remove unused variable 2023-04-13 13:13:59 +10:00
Campbell Barton
741d8dc1e2 Cleanup: format, use C++ nullptr & function style casts 2023-04-13 13:13:57 +10:00
Campbell Barton
4bccbceb34 Cleanup: quiet GCC warnings 2023-04-13 13:13:56 +10:00
Joseph Eagar
35071af465 Sculpt: Fix #104631: Tip Roundness on Paint brush causes jitering
I cleaned up the cube brush tip code quite a bit; more remains
to be done.  There is a new function to initialize cube
tip matrices, SCULPT_cube_tip_init.  It's currently only
used by the paint brush, I'll need to do a bit of testing
before using it for clay strips and multiplane scrape.

Note: SCULPT_cube_tip_init uses the brush local matrix code
to avoid code duplication (and to take advantage of the debouncing
that is done there).
2023-04-12 18:33:53 -07:00
Chris Blackbourn
d48939f103 Cleanup: Simplify uv packing engine
Migrating to use uv_phi[] for placement.
2023-04-13 10:05:19 +12:00
Chris Blackbourn
5ba30e07f2 Cleanup: Simplify uv packing api
Migrating preprocessing into the packing engine.
2023-04-13 10:01:43 +12:00
Chris Blackbourn
ecfdbaef9b Cleanup: format 2023-04-13 09:58:15 +12:00
zanqdo
2b565c6bd0 UI: Add slash character support to fuzzy search initials mode
Nodes with names separated by a slash / can
not be searched by their initials.

This commit adds the slash character to
the list of separators for this type of
fuzzy search.

Pull Request: https://projects.blender.org/blender/blender/pulls/106838
2023-04-12 23:53:36 +02:00
Hans Goudey
e35f971da1 Mesh: Avoid unnecessarily initializing corner topology arrays
This data should be initialized when building the mesh. If the arrays
aren't already initialized, there is already a bug. Theoretically this
could improve performance, since we can use `malloc` instead of
`calloc`. In practice I observed less than a 1% difference though.
2023-04-12 15:49:09 -04:00
Hans Goudey
a04098ebba Fix: Incorrect creation of deform mesh with no deform modifiers
Logic error in 99c630cd9cb6d814e5ea, hidden by a null check
in `BKE_id_copy_ex`.
2023-04-12 15:42:14 -04:00
Hans Goudey
16de3ba759 Fix #106845: Extrude node crash when no faces added
The non-individual face mode needs to check if there are any new faces
before accumulating their corner offsets.
2023-04-12 15:40:55 -04:00
Hans Goudey
e03da77033 Curves: Avoid unnecessary allocations in copy and move constructors
These aren't used much in current code, but currently they created
offsets on the result curves, then just freed them again when copying
from the source data. In the future it might be better to completely
avoid using the base constructor in the first place.
2023-04-12 15:32:30 -04:00
Hans Goudey
dccd42766c Cleanup: Use swap to take ownership of mesh data
Swap is commonly used to implement move assignment since it's short
and the logic is relatively simple. Use is here to avoid the need to
spell out the copying and freeing manually. The `BKE_id_free` call
at the end of the function will free whatever data was swapped.
2023-04-12 15:08:15 -04:00
Hans Goudey
642bc5546a Cleanup: Access curves offsets in RNA with C wrapper function
This simplifies the process of adding implicit sharing to the curve
offsets in the future.
2023-04-12 14:58:17 -04:00
Hans Goudey
b7e9906337 Cleanup: Remove unnecessary check when allocating mesh face offsets
The assert already checks this, but even in release builds,
doing nothing is probably worse than a memory leak here.
2023-04-12 14:56:28 -04:00
Hans Goudey
dd229a9d54 Cleanup: Slightly CurvesGeometry reorganize read function
The curve types and the runtime always have to be created when reading
the file from disk, so we might as well do that in `blend_read`, which
will help in the future when the offsets use implicit sharing.
2023-04-12 14:54:18 -04:00
Hans Goudey
87cd22f643 Cleanup: Use early return in legacy curve conversion
Return null instead of an empty curves data-block, which amounts to
the same thing in geometry nodes, with less potential for error in
the rest of the function.
2023-04-12 14:51:24 -04:00
Damien Picard
2b6c1600cf UI: Allow Float Kerning for Text Objects
Change Text Object character `kern` member to float from int, and allow
fractional changes to kerning with Shift-Alt-arrows.

Pull Request: https://projects.blender.org/blender/blender/pulls/105181
2023-04-12 19:11:53 +02:00
Harley Acheson
0ee0e8c0d4 UI: Tooltips for Assets
Show tooltips for Asset Browser items.

Pull Request: https://projects.blender.org/blender/blender/pulls/106189
2023-04-12 18:44:47 +02:00
Hans Goudey
000aef6e5e Cleanup: Use references in mesh.cc 2023-04-12 11:49:43 -04:00
Hans Goudey
baf6892270 Cleanup: Add utility function for clearing mesh geometry
The existing utility cleared vertex group names and active attribute
names, which doesn't always make sense when the geometry is
replaced but the custom data layout remains mainly unchanged.
2023-04-12 11:49:43 -04:00
Damien Picard
2771f53cb7 UI: Fix disconnected and non-clickable checkbox labels in popovers
For popovers, draw the checkbox in header as usual with label, but
hide the panel header label, see ed870f87b942.

Patch by Yevgeny Makarov (@jenkm) in
https://archive.blender.org/developer/D9586

Co-authored-by: Yevgeny Makarov <jenkm>
Pull Request: https://projects.blender.org/blender/blender/pulls/105657
2023-04-12 17:00:51 +02:00
Bastien Montagne
c738d8df84 Cleanup: VSE clipboard: Remove code in blo_lib_link_restore.
This code (looking for matching new IDs to restore by name) is called
from `set_app_data` after a .blend file has been read (also in memfile
undo case).

The part handling VSE clipboard to restore ID pointers is not really
needed, since pasting VSE strips already ensures stored ID pointers are
still valid, and tries to find a new matching one otherwise.
2023-04-12 16:18:25 +02:00
Damien Picard
c40ce3baae Cleanup: I18n: sort disambiguation contexts from BLT_translation.h
The contexts appear twice, in the list of #defines and in the
BLT_I18NCONTEXTS_DESC. Both had gotten out of alphabetical order, and
out of sync.

Pull Request: https://projects.blender.org/blender/blender/pulls/106718
2023-04-12 15:09:21 +02:00
Damien Picard
5cf365554b I18n: disambiguate a few messages
- "Lens" can be a transparent object used in cameras, or specifically
  its property of focal length
- "Empty" can be an adjective meaning void, or an object type. The
  latter is already disambiguated using `ID_ID`
- "New" and "Old" are adjectives that can have agreements in some
  languages
- "Modified" is an adjective that can have agreement in some languages
- "Clipping" can be a property of a camera, or a behavior of the
  mirror modifier
- "Value" in HSV nodes, see #105113
- "Area" in the Face Area geometry node, can mean a measurement or a
  window type
- "New" is an adjective that can have agreement
- "Tab" can be a UI element or a whitespace character
- "Volume" can mean a measurement or an object type. The latter is
  already disambiguated using `ID_ID`

These changes introduce the new `BLT_I18NCONTEXT_TIME` translation
context.

They also remove `BLT_I18NCONTEXT_VIRTUAL_REALITY`, which I added at
one point but then couldn't find which messages I wanted to fix with
it.

Ref #43295

Pull Request: #106718
2023-04-12 15:09:17 +02:00
Hans Goudey
c31434a570 Cleanup: Remove setting polygon loop total from Python
This property is not editable after 7966cd16d6dc4e66d01f,
though doing so didn't seem to give an error. It doesn't have
to be set anymore, since the data is redundant with the
"loop_start" anyway.
2023-04-12 08:38:32 -04:00
Bastien Montagne
30d8cb3be8 Fix #106246: Outliner: Crash on deleting the multi-level objects hierarchy.
Existing code was intrisically wrong, and also potentially very
innefficient.

Now tagging objects for deletion and removal is separated from actual
collection removal and object deletion. This makes the code safer,
simpler and more efficient.

NOTE: There is still an unsolved (already existing in original code)
issue with checks on objects that should not be deleted, noted in code.

Pull Request: https://projects.blender.org/blender/blender/pulls/106821
2023-04-12 14:25:40 +02:00